mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-08 07:10:18 +01:00
Merge commit 'origin/master' into transform-proposal
Conflicts: configure.ac xkb/ddxLoad.c
This commit is contained in:
commit
04a1da3771
1080 changed files with 51048 additions and 121989 deletions
17
.gitignore
vendored
17
.gitignore
vendored
|
|
@ -37,14 +37,6 @@ xorg-server.pc
|
|||
stamp-h?
|
||||
do-not-use-config.h
|
||||
do-not-use-config.h.in
|
||||
afb/afbbltC.c
|
||||
afb/afbbltCI.c
|
||||
afb/afbbltG.c
|
||||
afb/afbbltO.c
|
||||
afb/afbbltX.c
|
||||
afb/afbseg.c
|
||||
afb/afbtileC.c
|
||||
afb/afbtileG.c
|
||||
cfb/cfb8lineCO.c
|
||||
cfb/cfb8lineCP.c
|
||||
cfb/cfb8lineG.c
|
||||
|
|
@ -278,8 +270,13 @@ hw/xprint/doc/Xprt.1x
|
|||
hw/xprint/doc/Xprt.man
|
||||
hw/xprint/dpmsstubs-wrapper.c
|
||||
hw/xprint/miinitext-wrapper.c
|
||||
hw/xquartz/xpr/Xquartz
|
||||
hw/xquartz/xpr/Xquartz.1
|
||||
hw/xquartz/mach-startup/mach_startup.h
|
||||
hw/xquartz/mach-startup/mach_startupServer.c
|
||||
hw/xquartz/mach-startup/mach_startupServer.h
|
||||
hw/xquartz/mach-startup/mach_startupUser.c
|
||||
hw/xquartz/mach-startup/X11
|
||||
hw/xquartz/mach-startup/Xquartz
|
||||
hw/xquartz/doc/Xquartz.1
|
||||
include/dix-config.h
|
||||
include/kdrive-config.h
|
||||
include/xgl-config.h
|
||||
|
|
|
|||
1
COPYING
1
COPYING
|
|
@ -9,6 +9,7 @@ Stone).
|
|||
Copyright © 2000-2001 Juliusz Chroboczek
|
||||
Copyright © 2006-2007 Intel Corporation
|
||||
Copyright © 2006 Nokia Corporation
|
||||
Copyright © 2006-2008 Peter Hutterer
|
||||
Copyright © 1999 Keith Packard
|
||||
Copyright © 2005-2007 Daniel Stone
|
||||
Copyright © 2006 Luc Verhaegen
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
SUBDIRS = glx
|
||||
|
||||
WINDOWS_EXTRAS = \
|
||||
windows/ChangeLog \
|
||||
windows/glwindows.h \
|
||||
windows/glwrap.c \
|
||||
windows/indirect.c
|
||||
|
||||
EXTRA_DIST = symlink-mesa.sh $(WINDOWS_EXTRAS)
|
||||
13
GL/glx/.gitignore
vendored
13
GL/glx/.gitignore
vendored
|
|
@ -1,13 +0,0 @@
|
|||
glapi.c
|
||||
glcontextmodes.c
|
||||
glcontextmodes.h
|
||||
glthread.c
|
||||
indirect_dispatch.c
|
||||
indirect_dispatch.h
|
||||
indirect_dispatch_swap.c
|
||||
indirect_reqsize.c
|
||||
indirect_reqsize.h
|
||||
indirect_size.h
|
||||
indirect_size_get.c
|
||||
indirect_size_get.h
|
||||
indirect_table.c
|
||||
|
|
@ -1,528 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
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:
|
||||
* Kevin E. Martin <kevin@precisioninsight.com>
|
||||
* Brian E. Paul <brian@precisioninsight.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#define _NEED_GL_CORE_IF
|
||||
#include <GL/xmesa.h>
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <glxserver.h>
|
||||
#include <glxscreens.h>
|
||||
#include <glxdrawable.h>
|
||||
#include <glxcontext.h>
|
||||
#include <glxutil.h>
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#define XMesaCreateVisual (*glcore->XMesaCreateVisual)
|
||||
#define XMesaDestroyVisual (*glcore->XMesaDestroyVisual)
|
||||
|
||||
#define XMesaCreateWindowBuffer (*glcore->XMesaCreateWindowBuffer)
|
||||
#define XMesaCreatePixmapBuffer (*glcore->XMesaCreatePixmapBuffer)
|
||||
#define XMesaDestroyBuffer (*glcore->XMesaDestroyBuffer)
|
||||
#define XMesaSwapBuffers (*glcore->XMesaSwapBuffers)
|
||||
#define XMesaResizeBuffers (*glcore->XMesaResizeBuffers)
|
||||
|
||||
#define XMesaCreateContext (*glcore->XMesaCreateContext)
|
||||
#define XMesaDestroyContext (*glcore->XMesaDestroyContext)
|
||||
#define XMesaCopyContext (*glcore->XMesaCopyContext)
|
||||
#define XMesaMakeCurrent2 (*glcore->XMesaMakeCurrent2)
|
||||
#define XMesaForceCurrent (*glcore->XMesaForceCurrent)
|
||||
#define XMesaLoseCurrent (*glcore->XMesaLoseCurrent)
|
||||
|
||||
typedef struct __GLXMESAscreen __GLXMESAscreen;
|
||||
typedef struct __GLXMESAcontext __GLXMESAcontext;
|
||||
typedef struct __GLXMESAdrawable __GLXMESAdrawable;
|
||||
|
||||
struct __GLXMESAscreen {
|
||||
__GLXscreen base;
|
||||
int index;
|
||||
int num_vis;
|
||||
XMesaVisual *xm_vis;
|
||||
void *driver;
|
||||
|
||||
const __GLcoreModule *glcore;
|
||||
};
|
||||
|
||||
struct __GLXMESAcontext {
|
||||
__GLXcontext base;
|
||||
XMesaContext xmesa;
|
||||
};
|
||||
|
||||
struct __GLXMESAdrawable {
|
||||
__GLXdrawable base;
|
||||
XMesaBuffer xm_buf;
|
||||
__GLXMESAscreen *screen;
|
||||
};
|
||||
|
||||
static XMesaVisual find_mesa_visual(__GLXscreen *screen, XID fbconfigID);
|
||||
|
||||
|
||||
static void
|
||||
__glXMesaDrawableDestroy(__GLXdrawable *base)
|
||||
{
|
||||
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
|
||||
const __GLcoreModule *glcore = glxPriv->screen->glcore;
|
||||
|
||||
if (glxPriv->xm_buf != NULL)
|
||||
XMesaDestroyBuffer(glxPriv->xm_buf);
|
||||
xfree(glxPriv);
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
__glXMesaDrawableResize(__GLXdrawable *base)
|
||||
{
|
||||
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
|
||||
const __GLcoreModule *glcore = glxPriv->screen->glcore;
|
||||
|
||||
XMesaResizeBuffers(glxPriv->xm_buf);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
__glXMesaDrawableSwapBuffers(__GLXdrawable *base)
|
||||
{
|
||||
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
|
||||
const __GLcoreModule *glcore = glxPriv->screen->glcore;
|
||||
|
||||
/* This is terrifying: XMesaSwapBuffers() ends up calling CopyArea
|
||||
* to do the buffer swap, but this assumes that the server holds
|
||||
* the lock and has its context visible. If another screen uses a
|
||||
* DRI driver, that will have installed the DRI enter/leave server
|
||||
* functions, which lifts the lock during GLX dispatch. This is
|
||||
* why we need to re-take the lock and swap in the server context
|
||||
* before calling XMesaSwapBuffers() here. /me shakes head. */
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
|
||||
XMesaSwapBuffers(glxPriv->xm_buf);
|
||||
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static __GLXdrawable *
|
||||
__glXMesaScreenCreateDrawable(__GLXscreen *screen,
|
||||
DrawablePtr pDraw, int type,
|
||||
XID drawId,
|
||||
__GLXconfig *modes)
|
||||
{
|
||||
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
|
||||
const __GLcoreModule *glcore = mesaScreen->glcore;
|
||||
__GLXMESAdrawable *glxPriv;
|
||||
XMesaVisual xm_vis;
|
||||
|
||||
glxPriv = xalloc(sizeof *glxPriv);
|
||||
if (glxPriv == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(glxPriv, 0, sizeof *glxPriv);
|
||||
|
||||
glxPriv->screen = mesaScreen;
|
||||
if (!__glXDrawableInit(&glxPriv->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
xfree(glxPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glxPriv->base.destroy = __glXMesaDrawableDestroy;
|
||||
glxPriv->base.resize = __glXMesaDrawableResize;
|
||||
glxPriv->base.swapBuffers = __glXMesaDrawableSwapBuffers;
|
||||
|
||||
xm_vis = find_mesa_visual(screen, modes->fbconfigID);
|
||||
if (xm_vis == NULL) {
|
||||
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
|
||||
modes->visualID);
|
||||
xfree(glxPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (glxPriv->base.type == DRAWABLE_WINDOW) {
|
||||
glxPriv->xm_buf = XMesaCreateWindowBuffer(xm_vis, (WindowPtr)pDraw);
|
||||
} else {
|
||||
glxPriv->xm_buf = XMesaCreatePixmapBuffer(xm_vis, (PixmapPtr)pDraw, 0);
|
||||
}
|
||||
|
||||
if (glxPriv->xm_buf == NULL) {
|
||||
xfree(glxPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &glxPriv->base;
|
||||
}
|
||||
|
||||
static void
|
||||
__glXMesaContextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
|
||||
const __GLcoreModule *glcore = screen->glcore;
|
||||
|
||||
XMesaDestroyContext(context->xmesa);
|
||||
__glXContextDestroy(&context->base);
|
||||
xfree(context);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXMesaContextMakeCurrent(__GLXcontext *baseContext)
|
||||
|
||||
{
|
||||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
__GLXMESAdrawable *drawPriv = (__GLXMESAdrawable *) context->base.drawPriv;
|
||||
__GLXMESAdrawable *readPriv = (__GLXMESAdrawable *) context->base.readPriv;
|
||||
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
|
||||
const __GLcoreModule *glcore = screen->glcore;
|
||||
|
||||
return XMesaMakeCurrent2(context->xmesa,
|
||||
drawPriv->xm_buf,
|
||||
readPriv->xm_buf);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXMesaContextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
|
||||
const __GLcoreModule *glcore = screen->glcore;
|
||||
|
||||
return XMesaLoseCurrent(context->xmesa);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXMesaContextCopy(__GLXcontext *baseDst,
|
||||
__GLXcontext *baseSrc,
|
||||
unsigned long mask)
|
||||
{
|
||||
__GLXMESAcontext *dst = (__GLXMESAcontext *) baseDst;
|
||||
__GLXMESAcontext *src = (__GLXMESAcontext *) baseSrc;
|
||||
__GLXMESAscreen *screen = (__GLXMESAscreen *) dst->base.pGlxScreen;
|
||||
const __GLcoreModule *glcore = screen->glcore;
|
||||
|
||||
return XMesaCopyContext(src->xmesa, dst->xmesa, mask);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXMesaContextForceCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
|
||||
const __GLcoreModule *glcore = screen->glcore;
|
||||
|
||||
/* GlxSetRenderTables() call for XGL moved in XMesaForceCurrent() */
|
||||
|
||||
return XMesaForceCurrent(context->xmesa);
|
||||
}
|
||||
|
||||
static __GLXcontext *
|
||||
__glXMesaScreenCreateContext(__GLXscreen *screen,
|
||||
__GLXconfig *config,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
|
||||
const __GLcoreModule *glcore = mesaScreen->glcore;
|
||||
__GLXMESAcontext *context;
|
||||
__GLXMESAcontext *shareContext = (__GLXMESAcontext *) baseShareContext;
|
||||
XMesaVisual xm_vis;
|
||||
XMesaContext xm_share;
|
||||
|
||||
context = xalloc (sizeof (__GLXMESAcontext));
|
||||
if (context == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(context, 0, sizeof *context);
|
||||
|
||||
context->base.pGlxScreen = screen;
|
||||
context->base.config = config;
|
||||
|
||||
context->base.destroy = __glXMesaContextDestroy;
|
||||
context->base.makeCurrent = __glXMesaContextMakeCurrent;
|
||||
context->base.loseCurrent = __glXMesaContextLoseCurrent;
|
||||
context->base.copy = __glXMesaContextCopy;
|
||||
context->base.forceCurrent = __glXMesaContextForceCurrent;
|
||||
|
||||
xm_vis = find_mesa_visual(screen, config->fbconfigID);
|
||||
if (!xm_vis) {
|
||||
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
|
||||
config->visualID);
|
||||
xfree(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xm_share = shareContext ? shareContext->xmesa : NULL;
|
||||
context->xmesa = XMesaCreateContext(xm_vis, xm_share);
|
||||
if (!context->xmesa) {
|
||||
xfree(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &context->base;
|
||||
}
|
||||
|
||||
static void
|
||||
__glXMesaScreenDestroy(__GLXscreen *screen)
|
||||
{
|
||||
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
|
||||
const __GLcoreModule *glcore = mesaScreen->glcore;
|
||||
int i;
|
||||
|
||||
if (mesaScreen->xm_vis) {
|
||||
for (i = 0; i < mesaScreen->base.numFBConfigs; i++) {
|
||||
if (mesaScreen->xm_vis[i])
|
||||
XMesaDestroyVisual(mesaScreen->xm_vis[i]);
|
||||
}
|
||||
|
||||
xfree(mesaScreen->xm_vis);
|
||||
}
|
||||
|
||||
dlclose(mesaScreen->driver);
|
||||
|
||||
__glXScreenDestroy(screen);
|
||||
|
||||
xfree(screen);
|
||||
}
|
||||
|
||||
static XMesaVisual
|
||||
find_mesa_visual(__GLXscreen *screen, XID fbconfigID)
|
||||
{
|
||||
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
|
||||
const __GLXconfig *config;
|
||||
unsigned i = 0;
|
||||
|
||||
for (config = screen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->fbconfigID == fbconfigID)
|
||||
return mesaScreen->xm_vis[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const static int numBack = 2;
|
||||
const static int numDepth = 2;
|
||||
const static int numStencil = 2;
|
||||
|
||||
static const int glx_visual_types[] = {
|
||||
GLX_STATIC_GRAY,
|
||||
GLX_GRAY_SCALE,
|
||||
GLX_STATIC_COLOR,
|
||||
GLX_PSEUDO_COLOR,
|
||||
GLX_TRUE_COLOR,
|
||||
GLX_DIRECT_COLOR
|
||||
};
|
||||
|
||||
static __GLXconfig *
|
||||
createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
||||
VisualPtr visual, __GLXconfig *config)
|
||||
{
|
||||
int back, depth, stencil;
|
||||
|
||||
/* FIXME: Ok, I'm making all this up... anybody has a better idea? */
|
||||
|
||||
for (back = numBack - 1; back >= 0; back--)
|
||||
for (depth = 0; depth < numDepth; depth++)
|
||||
for (stencil = 0; stencil < numStencil; stencil++) {
|
||||
config->next = xcalloc(sizeof(*config), 1);
|
||||
config = config->next;
|
||||
|
||||
config->visualRating = GLX_NONE;
|
||||
config->visualType = glx_visual_types[visual->class];
|
||||
config->xRenderable = GL_TRUE;
|
||||
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
|
||||
config->rgbMode = (visual->class >= TrueColor);
|
||||
config->colorIndexMode = !config->rgbMode;
|
||||
config->renderType =
|
||||
(config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
|
||||
config->doubleBufferMode = back;
|
||||
config->haveDepthBuffer = depth;
|
||||
config->depthBits = depth ? visual->nplanes : 0;
|
||||
config->haveStencilBuffer = stencil;
|
||||
config->stencilBits = stencil ? visual->bitsPerRGBValue : 0;
|
||||
config->haveAccumBuffer = 0;
|
||||
|
||||
config->redBits = Ones(visual->redMask);
|
||||
config->greenBits = Ones(visual->greenMask);
|
||||
config->blueBits = Ones(visual->blueMask);
|
||||
config->alphaBits = 0;
|
||||
config->redMask = visual->redMask;
|
||||
config->greenMask = visual->greenMask;
|
||||
config->blueMask = visual->blueMask;
|
||||
config->alphaMask = 0;
|
||||
config->rgbBits = config->rgbMode ? visual->nplanes : 0;
|
||||
config->indexBits = config->colorIndexMode ? visual->nplanes : 0;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
static void
|
||||
createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
|
||||
{
|
||||
__GLXconfig head, *tail;
|
||||
int i;
|
||||
|
||||
/* We assume here that each existing visual correspond to a
|
||||
* different visual class. Note, this runs before COMPOSITE adds
|
||||
* its visual, so it's not entirely crazy. */
|
||||
pGlxScreen->numFBConfigs = pScreen->numVisuals * numBack * numDepth * numStencil;
|
||||
|
||||
head.next = NULL;
|
||||
tail = &head;
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
tail = createFBConfigsForVisual(pGlxScreen, pScreen,
|
||||
&pScreen->visuals[i], tail);
|
||||
|
||||
pGlxScreen->fbconfigs = head.next;
|
||||
}
|
||||
|
||||
static void
|
||||
createMesaVisuals(__GLXMESAscreen *pMesaScreen)
|
||||
{
|
||||
const __GLcoreModule *glcore = pMesaScreen->glcore;
|
||||
__GLXconfig *config;
|
||||
ScreenPtr pScreen;
|
||||
VisualPtr visual = NULL;
|
||||
int i, j;
|
||||
|
||||
i = 0;
|
||||
pScreen = pMesaScreen->base.pScreen;
|
||||
pMesaScreen->xm_vis =
|
||||
xcalloc(pMesaScreen->base.numFBConfigs, sizeof (XMesaVisual));
|
||||
for (config = pMesaScreen->base.fbconfigs; config != NULL; config = config->next) {
|
||||
for (j = 0; j < pScreen->numVisuals; j++)
|
||||
if (pScreen->visuals[j].vid == config->visualID) {
|
||||
visual = &pScreen->visuals[j];
|
||||
break;
|
||||
}
|
||||
|
||||
pMesaScreen->xm_vis[i++] =
|
||||
XMesaCreateVisual(pScreen,
|
||||
visual,
|
||||
config->rgbMode,
|
||||
(config->alphaBits > 0),
|
||||
config->doubleBufferMode,
|
||||
config->stereoMode,
|
||||
GL_TRUE, /* ximage_flag */
|
||||
config->depthBits,
|
||||
config->stencilBits,
|
||||
config->accumRedBits,
|
||||
config->accumGreenBits,
|
||||
config->accumBlueBits,
|
||||
config->accumAlphaBits,
|
||||
config->samples,
|
||||
config->level,
|
||||
config->visualRating);
|
||||
}
|
||||
}
|
||||
|
||||
static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
||||
|
||||
static __GLXscreen *
|
||||
__glXMesaScreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
__GLXMESAscreen *screen;
|
||||
char filename[128];
|
||||
|
||||
screen = xalloc(sizeof *screen);
|
||||
if (screen == NULL)
|
||||
return NULL;
|
||||
|
||||
snprintf(filename, sizeof filename, "%s/%s.so",
|
||||
dri_driver_path, "libGLcore");
|
||||
|
||||
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (screen->driver == NULL) {
|
||||
LogMessage(X_ERROR, "GLX error: dlopen of %s failed (%s)\n",
|
||||
filename, dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->glcore = dlsym(screen->driver, __GL_CORE);
|
||||
if (screen->glcore == NULL) {
|
||||
LogMessage(X_ERROR, "GLX error: dlsym for %s failed (%s)\n",
|
||||
__GL_CORE, dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the GLX visuals that are supported by this screen and create
|
||||
* XMesa's visuals.
|
||||
*/
|
||||
createFBConfigs(&screen->base, pScreen);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
/* Now that GLX has created the corresponding X visual, create the mesa visuals. */
|
||||
createMesaVisuals(screen);
|
||||
|
||||
screen->base.destroy = __glXMesaScreenDestroy;
|
||||
screen->base.createContext = __glXMesaScreenCreateContext;
|
||||
screen->base.createDrawable = __glXMesaScreenCreateDrawable;
|
||||
screen->base.swapInterval = NULL;
|
||||
screen->base.pScreen = pScreen;
|
||||
|
||||
LogMessage(X_INFO, "GLX: Loaded and initialized %s\n", filename);
|
||||
|
||||
return &screen->base;
|
||||
|
||||
handle_error:
|
||||
|
||||
if (screen->driver)
|
||||
dlclose(screen->driver);
|
||||
|
||||
xfree(screen);
|
||||
|
||||
FatalError("GLX: could not load software renderer\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__GLXprovider __glXMesaProvider = {
|
||||
__glXMesaScreenProbe,
|
||||
"MESA",
|
||||
NULL
|
||||
};
|
||||
|
||||
__GLXprovider *
|
||||
GlxGetMesaProvider (void)
|
||||
{
|
||||
return &__glXMesaProvider;
|
||||
}
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# A script that symlinks source files from Mesa to modular
|
||||
#
|
||||
# Author: Soren Sandmann (sandmann@redhat.com) (original)
|
||||
# adapted for Mesa by Adam Jackson (ajax@nwnk.net)
|
||||
|
||||
#
|
||||
# Things we would like to do
|
||||
#
|
||||
# - Check that all the relevant files exist
|
||||
# - AUTHORS, autogen.sh, configure.ac, ...
|
||||
# - Check that we have actually linked everything
|
||||
# - if a file doesn't need to be linked, then it needs
|
||||
# to be listed as "not-linked"
|
||||
# - Compute diffs between all the files (shouldn't be necessary)
|
||||
# - possibly check that files are listet in Makefile.am's
|
||||
# - Clean target directory of irrelevant files
|
||||
#
|
||||
|
||||
check_destinations () {
|
||||
# don't do anything - we are relying on the side
|
||||
# effect of dst_dir
|
||||
true
|
||||
}
|
||||
|
||||
check_exist() {
|
||||
# Check whether $1 exists
|
||||
|
||||
if [ ! -e $1 ] ; then
|
||||
error "$1 not found"
|
||||
fi
|
||||
}
|
||||
|
||||
delete_existing() {
|
||||
# Delete $2
|
||||
|
||||
rm -f $2
|
||||
}
|
||||
|
||||
link_files() {
|
||||
# Link $1 to $2
|
||||
|
||||
if [ ! -e $2 ] ; then
|
||||
ln -s $1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
check_args $1 $2
|
||||
|
||||
run check_destinations "Creating destination directories"
|
||||
run check_exist "Checking that the source files exist"
|
||||
run delete_existing "Deleting existing files"
|
||||
run link_files "Linking files"
|
||||
}
|
||||
|
||||
## actual symlinking
|
||||
|
||||
symlink_glx() {
|
||||
# this is... unpleasant
|
||||
src_dir src/glx/x11
|
||||
dst_dir glx
|
||||
|
||||
action indirect_size.h
|
||||
action glcontextmodes.c
|
||||
action glcontextmodes.h
|
||||
action indirect_dispatch.c
|
||||
action indirect_dispatch.h
|
||||
action indirect_dispatch_swap.c
|
||||
action indirect_reqsize.c
|
||||
action indirect_reqsize.h
|
||||
action indirect_size_get.c
|
||||
action indirect_size_get.h
|
||||
action indirect_table.c
|
||||
|
||||
src_dir src/mesa/glapi
|
||||
|
||||
action glapi.c
|
||||
action glthread.c
|
||||
}
|
||||
|
||||
#########
|
||||
#
|
||||
# Helper functions
|
||||
#
|
||||
#########
|
||||
|
||||
error() {
|
||||
echo
|
||||
echo \ \ \ error:\ \ \ $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
# printing out what's going on
|
||||
run_module() {
|
||||
# $1 module
|
||||
# $2 explanation
|
||||
echo -n $EXPLANATION for $1 module ...\
|
||||
symlink_$1
|
||||
echo DONE
|
||||
}
|
||||
|
||||
run() {
|
||||
# $1 what to do
|
||||
# $2 explanation
|
||||
|
||||
ACTION=$1 EXPLANATION=$2 run_module glx
|
||||
}
|
||||
|
||||
src_dir() {
|
||||
REAL_SRC_DIR=$SRC_DIR/$1
|
||||
if [ ! -d $REAL_SRC_DIR ] ; then
|
||||
error "Source directory $REAL_SRC_DIR does not exist"
|
||||
fi
|
||||
}
|
||||
|
||||
dst_dir() {
|
||||
REAL_DST_DIR=$DST_DIR/$1
|
||||
if [ ! -d $REAL_DST_DIR ] ; then
|
||||
mkdir -p $REAL_DST_DIR
|
||||
fi
|
||||
}
|
||||
|
||||
action() {
|
||||
if [ -z $2 ] ; then
|
||||
$ACTION $REAL_SRC_DIR/$1 $REAL_DST_DIR/$1
|
||||
else
|
||||
$ACTION $REAL_SRC_DIR/$1 $REAL_DST_DIR/$2
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo symlink-mesa.sh src-dir dst-dir
|
||||
echo src-dir: the Mesa source directory
|
||||
echo dst-dir: the GL subdirectory of the Xserver modular tree
|
||||
}
|
||||
|
||||
# Check commandline args
|
||||
check_args() {
|
||||
if [ -z $1 ] ; then
|
||||
echo Missing source dir
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $2 ] ; then
|
||||
echo Missing destination dir
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $1 ] ; then
|
||||
echo $1 is not a dir
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $2 ] ; then
|
||||
echo $2 is not a dir
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $1 = $2 ] ; then
|
||||
echo source and destination can\'t be the same
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
D=`dirname "$relpath"`
|
||||
B=`basename "$relpath"`
|
||||
abspath="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
|
||||
|
||||
SRC_DIR=`( cd $1 ; pwd )`
|
||||
DST_DIR=`(cd $2 ; pwd )`
|
||||
}
|
||||
|
||||
main $1 $2
|
||||
10
Makefile.am
10
Makefile.am
|
|
@ -9,16 +9,12 @@ if XTRAP
|
|||
XTRAP_DIR=XTrap
|
||||
endif
|
||||
|
||||
if AFB
|
||||
AFB_DIR=afb
|
||||
endif
|
||||
|
||||
if MFB
|
||||
MFB_DIR=mfb
|
||||
endif
|
||||
|
||||
if GLX
|
||||
GLX_DIR=GL
|
||||
GLX_DIR=glx
|
||||
endif
|
||||
|
||||
if DBE
|
||||
|
|
@ -44,7 +40,6 @@ SUBDIRS = \
|
|||
xkb \
|
||||
$(DBE_DIR) \
|
||||
$(MFB_DIR) \
|
||||
$(AFB_DIR) \
|
||||
$(RECORD_DIR) \
|
||||
xfixes \
|
||||
damageext \
|
||||
|
|
@ -88,13 +83,12 @@ DIST_SUBDIRS = \
|
|||
xkb \
|
||||
dbe \
|
||||
mfb \
|
||||
afb \
|
||||
record \
|
||||
xfixes \
|
||||
damageext \
|
||||
XTrap \
|
||||
composite \
|
||||
GL \
|
||||
glx \
|
||||
exa \
|
||||
config \
|
||||
hw
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ SOFTWARE.
|
|||
# include "extnsionst.h" /* Server ExtensionEntry definitions */
|
||||
# include "scrnintstr.h" /* Screen struct */
|
||||
#endif
|
||||
#include "inputstr.h"
|
||||
|
||||
#include <X11/extensions/xtrapdi.h>
|
||||
#include <X11/extensions/xtrapddmi.h>
|
||||
|
|
@ -96,8 +97,8 @@ int XETrapSimulateXEvent(register xXTrapInputReq *request,
|
|||
xEvent xev;
|
||||
register int x = request->input.x;
|
||||
register int y = request->input.y;
|
||||
DevicePtr keydev = (DevicePtr)inputInfo.keyboard;
|
||||
DevicePtr ptrdev = (DevicePtr)inputInfo.pointer;
|
||||
DevicePtr keydev = (DevicePtr)PickKeyboard(client);
|
||||
DevicePtr ptrdev = (DevicePtr)PickPointer(client);
|
||||
|
||||
if (request->input.screen < screenInfo.numScreens)
|
||||
{
|
||||
|
|
@ -130,8 +131,8 @@ int XETrapSimulateXEvent(register xXTrapInputReq *request,
|
|||
{ /* Set new cursor position on screen */
|
||||
XETrap_avail.data.cur_x = x;
|
||||
XETrap_avail.data.cur_y = y;
|
||||
NewCurrentScreen (pScr, x, y); /* fix from amnonc@mercury.co.il */
|
||||
if (!(*pScr->SetCursorPosition)(pScr, x, y, xFalse))
|
||||
NewCurrentScreen (inputInfo.pointer, pScr, x, y); /* fix from amnonc@mercury.co.il */
|
||||
if (!(*pScr->SetCursorPosition)(inputInfo.pointer, pScr, x, y, xFalse))
|
||||
{
|
||||
status = BadImplementation;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#endif
|
||||
#include "pixmapstr.h" /* DrawableRec */
|
||||
#include "windowstr.h" /* Drawable Lookup structures */
|
||||
#include "inputstr.h"
|
||||
#include <X11/extensions/xtrapdi.h>
|
||||
#include <X11/extensions/xtrapddmi.h>
|
||||
#include <X11/extensions/xtrapproto.h>
|
||||
|
|
@ -101,7 +102,7 @@ globalref int_function XETrapProcVector[256L]; /* The "shadowed" ProcVector */
|
|||
#ifndef VECTORED_EVENTS
|
||||
globalref int_function EventProcVector[XETrapCoreEvents];
|
||||
#else
|
||||
extern WindowPtr GetCurrentRootWindow();
|
||||
extern WindowPtr GetCurrentRootWindow(DeviceIntPtr);
|
||||
globalref int_function EventProcVector[128L];
|
||||
#endif
|
||||
static int_function keybd_process_inp = NULL; /* Used for VECTORED_EVENTS */
|
||||
|
|
@ -1564,7 +1565,7 @@ void XETrapStampAndMail(xEvent *x_event)
|
|||
data.u.event.u.u.type == ButtonRelease ||
|
||||
data.u.event.u.u.type == KeyPress ||
|
||||
data.u.event.u.u.type == KeyRelease)) {
|
||||
int scr = XineramaGetCursorScreen();
|
||||
int scr = XineramaGetCursorScreen(inputInfo.pointer);
|
||||
data.u.event.u.keyButtonPointer.rootX +=
|
||||
panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x;
|
||||
data.u.event.u.keyButtonPointer.rootY +=
|
||||
|
|
@ -1619,7 +1620,9 @@ int XETrapEventVector(ClientPtr client, xEvent *x_event)
|
|||
(x_event->u.u.type <= MotionNotify) &&
|
||||
(!x_event->u.keyButtonPointer.sameScreen)))
|
||||
{ /* we've moved/warped to another screen */
|
||||
WindowPtr root_win = GetCurrentRootWindow();
|
||||
/* XXX: we're getting the client's pointer root window.
|
||||
* is this correct? Should it be the client's keyboard? */
|
||||
WindowPtr root_win = GetCurrentRootWindow(PickPointer(client));
|
||||
current_screen = root_win->drawable.pScreen->myNum;
|
||||
}
|
||||
data.hdr.screen = current_screen;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
|
|||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
if XORG
|
||||
sdk_HEADERS = xvdix.h xvmcext.h
|
||||
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h
|
||||
endif
|
||||
|
||||
# Sources always included in libXextbuiltin.la & libXext.la
|
||||
|
|
@ -23,7 +23,8 @@ BUILTIN_SRCS = \
|
|||
shape.c \
|
||||
sleepuntil.c \
|
||||
sleepuntil.h \
|
||||
xtest.c
|
||||
xtest.c \
|
||||
geext.c
|
||||
|
||||
# Sources always included in libXextmodule.la & libXext.la
|
||||
MODULE_SRCS = \
|
||||
|
|
@ -98,12 +99,6 @@ if XEVIE
|
|||
BUILTIN_SRCS += $(XEVIE_SRCS)
|
||||
endif
|
||||
|
||||
# XPrint: Printing via X Protocol
|
||||
XPRINT_SRCS = xprint.c
|
||||
if XPRINT
|
||||
BUILTIN_SRCS += $(XPRINT_SRCS)
|
||||
endif
|
||||
|
||||
# Multi-buffering extension
|
||||
MULTIBUFFER_SRCS = mbuf.c
|
||||
EXTRA_MULTIBUFFER_SRCS = mbufbf.c mbufpx.c
|
||||
|
|
@ -149,10 +144,10 @@ EXTRA_DIST = \
|
|||
$(XCALIBRATE_SRCS) \
|
||||
$(XINERAMA_SRCS) \
|
||||
$(XEVIE_SRCS) \
|
||||
$(XPRINT_SRCS) \
|
||||
$(MULTIBUFFER_SRCS) \
|
||||
$(EXTRA_MULTIBUFFER_SRCS) \
|
||||
$(FONTCACHE_SRCS) \
|
||||
$(BIGFONT_SRCS) \
|
||||
$(DPMS_SRCS)
|
||||
$(DPMS_SRCS) \
|
||||
$(GE_SRCS)
|
||||
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ BigReqResetProc (extEntry)
|
|||
|
||||
static int
|
||||
ProcBigReqDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xBigReqEnableReq);
|
||||
xBigReqEnableReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&stuff->length, n);
|
||||
|
|
|
|||
60
Xext/dpms.c
60
Xext/dpms.c
|
|
@ -87,11 +87,11 @@ DPMSResetProc (extEntry)
|
|||
|
||||
static int
|
||||
ProcDPMSGetVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
/* REQUEST(xDPMSGetVersionReq); */
|
||||
xDPMSGetVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
||||
|
||||
|
|
@ -110,11 +110,11 @@ ProcDPMSGetVersion(client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcDPMSCapable(register ClientPtr client)
|
||||
ProcDPMSCapable(ClientPtr client)
|
||||
{
|
||||
/* REQUEST(xDPMSCapableReq); */
|
||||
xDPMSCapableReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
|
||||
|
|
@ -132,11 +132,11 @@ ProcDPMSCapable(register ClientPtr client)
|
|||
|
||||
static int
|
||||
ProcDPMSGetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
/* REQUEST(xDPMSGetTimeoutsReq); */
|
||||
xDPMSGetTimeoutsReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ ProcDPMSGetTimeouts(client)
|
|||
|
||||
static int
|
||||
ProcDPMSSetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSSetTimeoutsReq);
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ ProcDPMSSetTimeouts(client)
|
|||
|
||||
static int
|
||||
ProcDPMSEnable(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
Bool was_enabled = DPMSEnabled;
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ ProcDPMSEnable(client)
|
|||
|
||||
static int
|
||||
ProcDPMSDisable(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
/* REQUEST(xDPMSDisableReq); */
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ ProcDPMSDisable(client)
|
|||
|
||||
static int
|
||||
ProcDPMSForceLevel(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSForceLevelReq);
|
||||
|
||||
|
|
@ -250,11 +250,11 @@ ProcDPMSForceLevel(client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcDPMSInfo(register ClientPtr client)
|
||||
ProcDPMSInfo(ClientPtr client)
|
||||
{
|
||||
/* REQUEST(xDPMSInfoReq); */
|
||||
xDPMSInfoReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ ProcDPMSInfo(register ClientPtr client)
|
|||
|
||||
static int
|
||||
ProcDPMSDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
|
|
@ -303,9 +303,9 @@ ProcDPMSDispatch (client)
|
|||
|
||||
static int
|
||||
SProcDPMSGetVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xDPMSGetVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -316,10 +316,10 @@ SProcDPMSGetVersion(client)
|
|||
}
|
||||
|
||||
static int
|
||||
SProcDPMSCapable(register ClientPtr client)
|
||||
SProcDPMSCapable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSCapableReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
|
|
@ -329,10 +329,10 @@ SProcDPMSCapable(register ClientPtr client)
|
|||
|
||||
static int
|
||||
SProcDPMSGetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSGetTimeoutsReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
||||
|
|
@ -342,10 +342,10 @@ SProcDPMSGetTimeouts(client)
|
|||
|
||||
static int
|
||||
SProcDPMSSetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSSetTimeoutsReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
||||
|
|
@ -358,10 +358,10 @@ SProcDPMSSetTimeouts(client)
|
|||
|
||||
static int
|
||||
SProcDPMSEnable(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSEnableReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
|
@ -371,10 +371,10 @@ SProcDPMSEnable(client)
|
|||
|
||||
static int
|
||||
SProcDPMSDisable(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSDisableReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
||||
|
|
@ -384,10 +384,10 @@ SProcDPMSDisable(client)
|
|||
|
||||
static int
|
||||
SProcDPMSForceLevel(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSForceLevelReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
|
||||
|
|
@ -399,10 +399,10 @@ SProcDPMSForceLevel(client)
|
|||
|
||||
static int
|
||||
SProcDPMSInfo(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSInfoReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
||||
|
|
@ -412,7 +412,7 @@ SProcDPMSInfo(client)
|
|||
|
||||
static int
|
||||
SProcDPMSDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
|
|||
|
|
@ -93,10 +93,10 @@ FontCacheResetProc (extEntry)
|
|||
|
||||
static int
|
||||
ProcFontCacheQueryVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xFontCacheQueryVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xFontCacheQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -116,11 +116,11 @@ ProcFontCacheQueryVersion(client)
|
|||
|
||||
static int
|
||||
ProcFontCacheGetCacheSettings(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xFontCacheGetCacheSettingsReply rep;
|
||||
FontCacheSettings cinfo;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -154,11 +154,11 @@ ProcFontCacheGetCacheSettings(client)
|
|||
|
||||
static int
|
||||
ProcFontCacheGetCacheStatistics(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xFontCacheGetCacheStatisticsReply rep;
|
||||
FontCacheStatistics cstats;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -207,7 +207,7 @@ ProcFontCacheGetCacheStatistics(client)
|
|||
|
||||
static int
|
||||
ProcFontCacheChangeCacheSettings(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
FontCacheSettings cs;
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ ProcFontCacheChangeCacheSettings(client)
|
|||
|
||||
static int
|
||||
ProcFontCacheDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
@ -256,9 +256,9 @@ ProcFontCacheDispatch (client)
|
|||
|
||||
static int
|
||||
SProcFontCacheQueryVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xFontCacheQueryVersionReq);
|
||||
swaps(&stuff->length, n);
|
||||
return ProcFontCacheQueryVersion(client);
|
||||
|
|
@ -268,7 +268,7 @@ static int
|
|||
SProcFontCacheGetCacheSettings(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xFontCacheGetCacheSettingsReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
|
||||
|
|
@ -279,7 +279,7 @@ static int
|
|||
SProcFontCacheGetCacheStatistics(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xFontCacheGetCacheStatisticsReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
|
||||
|
|
@ -290,7 +290,7 @@ static int
|
|||
SProcFontCacheChangeCacheSettings(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xFontCacheChangeCacheSettingsReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
|
||||
|
|
@ -304,7 +304,7 @@ SProcFontCacheChangeCacheSettings(client)
|
|||
|
||||
static int
|
||||
SProcFontCacheDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
|
|||
427
Xext/geext.c
Normal file
427
Xext/geext.c
Normal file
|
|
@ -0,0 +1,427 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
#include "windowstr.h"
|
||||
#include <X11/extensions/ge.h>
|
||||
|
||||
#include "geint.h"
|
||||
#include "geext.h"
|
||||
|
||||
/* Currently supported XGE version */
|
||||
#define SERVER_GE_MAJOR 1
|
||||
#define SERVER_GE_MINOR 0
|
||||
|
||||
|
||||
int GEEventBase;
|
||||
int GEErrorBase;
|
||||
DevPrivateKey GEClientPrivateKey = &GEClientPrivateKey;
|
||||
int GEEventType; /* The opcode for all GenericEvents will have. */
|
||||
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
/* Forward declarations */
|
||||
static void SGEGenericEvent(xEvent* from, xEvent* to);
|
||||
|
||||
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
|
||||
|
||||
/************************************************************/
|
||||
/* request handlers */
|
||||
/************************************************************/
|
||||
|
||||
static int
|
||||
ProcGEQueryVersion(ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||
xGEQueryVersionReply rep;
|
||||
REQUEST(xGEQueryVersionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GEQueryVersion;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
/* return the supported version by the server */
|
||||
rep.majorVersion = SERVER_GE_MAJOR;
|
||||
rep.minorVersion = SERVER_GE_MINOR;
|
||||
|
||||
/* Remember version the client requested */
|
||||
pGEClient->major_version = stuff->majorVersion;
|
||||
pGEClient->minor_version = stuff->minorVersion;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swaps(&rep.majorVersion, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xGEQueryVersionReply), (char*)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
int (*ProcGEVector[GENumberRequests])(ClientPtr) = {
|
||||
/* Version 1.0 */
|
||||
ProcGEQueryVersion
|
||||
};
|
||||
|
||||
/************************************************************/
|
||||
/* swapped request handlers */
|
||||
/************************************************************/
|
||||
static int
|
||||
SProcGEQueryVersion(ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xGEQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
|
||||
swaps(&stuff->majorVersion, n);
|
||||
swaps(&stuff->minorVersion, n);
|
||||
return(*ProcGEVector[stuff->ReqType])(client);
|
||||
}
|
||||
|
||||
int (*SProcGEVector[GENumberRequests])(ClientPtr) = {
|
||||
/* Version 1.0 */
|
||||
SProcGEQueryVersion
|
||||
};
|
||||
|
||||
|
||||
/************************************************************/
|
||||
/* callbacks */
|
||||
/************************************************************/
|
||||
|
||||
/* dispatch requests */
|
||||
static int
|
||||
ProcGEDispatch(ClientPtr client)
|
||||
{
|
||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||
REQUEST(xGEReq);
|
||||
|
||||
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
|
||||
return BadRequest;
|
||||
if (stuff->ReqType > version_requests[pGEClient->major_version])
|
||||
return BadRequest;
|
||||
|
||||
return (ProcGEVector[stuff->ReqType])(client);
|
||||
}
|
||||
|
||||
/* dispatch swapped requests */
|
||||
static int
|
||||
SProcGEDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGEReq);
|
||||
if (stuff->ReqType >= GENumberRequests)
|
||||
return BadRequest;
|
||||
return (*SProcGEVector[stuff->ReqType])(client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a new client inits a connection to the X server.
|
||||
*
|
||||
* We alloc a simple struct to store the client's major/minor version. Can be
|
||||
* used in the furture for versioning support.
|
||||
*/
|
||||
static void
|
||||
GEClientCallback(CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
GEClientInfoPtr pGEClient = GEGetClient(pClient);
|
||||
|
||||
if (pGEClient == NULL)
|
||||
{
|
||||
pGEClient = xcalloc(1, sizeof(GEClientInfoRec));
|
||||
dixSetPrivate(&pClient->devPrivates, GEClientPrivateKey, pGEClient);
|
||||
}
|
||||
|
||||
pGEClient->major_version = 0;
|
||||
pGEClient->minor_version = 0;
|
||||
}
|
||||
|
||||
/* Reset extension. Called on server shutdown. */
|
||||
static void
|
||||
GEResetProc(ExtensionEntry *extEntry)
|
||||
{
|
||||
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
|
||||
EventSwapVector[GenericEvent] = NotImplemented;
|
||||
|
||||
GEEventBase = 0;
|
||||
GEErrorBase = 0;
|
||||
GEEventType = 0;
|
||||
}
|
||||
|
||||
/* Calls the registered event swap function for the extension.
|
||||
*
|
||||
* Each extension can register a swap function to handle GenericEvents being
|
||||
* swapped properly. The server calls SGEGenericEvent() before the event is
|
||||
* written on the wire, this one calls the registered swap function to do the
|
||||
* work.
|
||||
*/
|
||||
static void
|
||||
SGEGenericEvent(xEvent* from, xEvent* to)
|
||||
{
|
||||
xGenericEvent* gefrom = (xGenericEvent*)from;
|
||||
xGenericEvent* geto = (xGenericEvent*)to;
|
||||
|
||||
if (gefrom->extension > MAXEXTENSIONS)
|
||||
{
|
||||
ErrorF("GE: Invalid extension offset for event.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GEExtensions[gefrom->extension & 0x7F].evswap)
|
||||
GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto);
|
||||
}
|
||||
|
||||
/* Init extension, register at server.
|
||||
* Since other extensions may rely on XGE (XInput does already), it is a good
|
||||
* idea to init XGE first, before any other extension.
|
||||
*/
|
||||
void
|
||||
GEExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
|
||||
{
|
||||
FatalError("GEExtensionInit: register client callback failed.\n");
|
||||
}
|
||||
|
||||
if((extEntry = AddExtension(GE_NAME,
|
||||
GENumberEvents, GENumberErrors,
|
||||
ProcGEDispatch, SProcGEDispatch,
|
||||
GEResetProc, StandardMinorOpcode)) != 0)
|
||||
{
|
||||
GEEventBase = extEntry->eventBase;
|
||||
GEErrorBase = extEntry->errorBase;
|
||||
GEEventType = GEEventBase;
|
||||
|
||||
memset(GEExtensions, 0, sizeof(GEExtensions));
|
||||
|
||||
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
|
||||
} else {
|
||||
FatalError("GEInit: AddExtensions failed.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* interface for extensions */
|
||||
/************************************************************/
|
||||
|
||||
/* Register an extension with GE. The given swap function will be called each
|
||||
* time an event is sent to a client with different byte order.
|
||||
* @param extension The extensions major opcode
|
||||
* @param ev_swap The event swap function.
|
||||
* @param ev_fill Called for an event before delivery. The extension now has
|
||||
* the chance to fill in necessary fields for the event.
|
||||
*/
|
||||
void
|
||||
GERegisterExtension(int extension,
|
||||
void (*ev_swap)(xGenericEvent* from, xGenericEvent* to),
|
||||
void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev,
|
||||
WindowPtr pWin, GrabPtr pGrab))
|
||||
{
|
||||
if ((extension & 0x7F) >= MAXEXTENSIONS)
|
||||
FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
|
||||
|
||||
/* extension opcodes are > 128, might as well save some space here */
|
||||
GEExtensions[extension & 0x7f].evswap = ev_swap;
|
||||
GEExtensions[extension & 0x7f].evfill = ev_fill;
|
||||
}
|
||||
|
||||
|
||||
/* 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)
|
||||
{
|
||||
ev->type = GenericEvent;
|
||||
ev->extension = extension;
|
||||
ev->length = 0;
|
||||
}
|
||||
|
||||
/* Recalculates the summary mask for the window. */
|
||||
static void
|
||||
GERecalculateWinMask(WindowPtr pWin)
|
||||
{
|
||||
int i;
|
||||
GenericMaskPtr it;
|
||||
GenericClientMasksPtr evmasks;
|
||||
|
||||
if (!pWin->optional)
|
||||
return;
|
||||
|
||||
evmasks = pWin->optional->geMasks;
|
||||
|
||||
for (i = 0; i < MAXEXTENSIONS; i++)
|
||||
{
|
||||
evmasks->eventMasks[i] = 0;
|
||||
}
|
||||
|
||||
it = pWin->optional->geMasks->geClients;
|
||||
while(it)
|
||||
{
|
||||
for (i = 0; i < MAXEXTENSIONS; i++)
|
||||
{
|
||||
evmasks->eventMasks[i] |= it->eventMask[i];
|
||||
}
|
||||
it = it->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set generic event mask for given window. */
|
||||
void
|
||||
GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
|
||||
WindowPtr pWin, int extension, Mask mask)
|
||||
{
|
||||
GenericMaskPtr cli;
|
||||
|
||||
extension = (extension & 0x7F);
|
||||
|
||||
if (extension > MAXEXTENSIONS)
|
||||
{
|
||||
ErrorF("Invalid extension number.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pWin->optional && !MakeWindowOptional(pWin))
|
||||
{
|
||||
ErrorF("GE: Could not make window optional.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mask)
|
||||
{
|
||||
GenericClientMasksPtr evmasks = pWin->optional->geMasks;
|
||||
|
||||
/* check for existing client */
|
||||
cli = evmasks->geClients;
|
||||
while(cli)
|
||||
{
|
||||
if (cli->client == pClient && cli->dev == pDev)
|
||||
break;
|
||||
cli = cli->next;
|
||||
}
|
||||
if (!cli)
|
||||
{
|
||||
/* new client and/or new device */
|
||||
cli = (GenericMaskPtr)xcalloc(1, sizeof(GenericMaskRec));
|
||||
if (!cli)
|
||||
{
|
||||
ErrorF("GE: Insufficient memory to alloc client.\n");
|
||||
return;
|
||||
}
|
||||
cli->next = evmasks->geClients;
|
||||
cli->client = pClient;
|
||||
cli->dev = pDev;
|
||||
evmasks->geClients = cli;
|
||||
}
|
||||
cli->eventMask[extension] = mask;
|
||||
} else
|
||||
{
|
||||
/* remove client. */
|
||||
cli = pWin->optional->geMasks->geClients;
|
||||
if (cli->client == pClient && cli->dev == pDev)
|
||||
{
|
||||
pWin->optional->geMasks->geClients = cli->next;
|
||||
xfree(cli);
|
||||
} else
|
||||
{
|
||||
GenericMaskPtr prev = cli;
|
||||
cli = cli->next;
|
||||
|
||||
while(cli)
|
||||
{
|
||||
if (cli->client == pClient && cli->dev == pDev)
|
||||
{
|
||||
prev->next = cli->next;
|
||||
xfree(cli);
|
||||
break;
|
||||
}
|
||||
prev = cli;
|
||||
cli = cli->next;
|
||||
}
|
||||
}
|
||||
if (!cli)
|
||||
return;
|
||||
}
|
||||
|
||||
GERecalculateWinMask(pWin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return TRUE if the mask for the given device is set.
|
||||
* @param pWin Window the event may be delivered to.
|
||||
* @param pDev Device the device originating the event. May be NULL.
|
||||
* @param extension Extension ID
|
||||
* @param mask Event mask
|
||||
*/
|
||||
BOOL
|
||||
GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
|
||||
int extension, Mask mask)
|
||||
{
|
||||
GenericMaskPtr gemask;
|
||||
|
||||
if (!pWin->optional || !pWin->optional->geMasks)
|
||||
return FALSE;
|
||||
|
||||
extension &= 0x7F;
|
||||
|
||||
if (!pWin->optional->geMasks->eventMasks[extension] & mask)
|
||||
return FALSE;
|
||||
|
||||
|
||||
gemask = pWin->optional->geMasks->geClients;
|
||||
|
||||
while(gemask)
|
||||
{
|
||||
if ((!gemask->dev || gemask->dev == pDev) &&
|
||||
(gemask->eventMask[extension] & mask))
|
||||
return TRUE;
|
||||
|
||||
gemask = gemask->next;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
114
Xext/geext.h
Normal file
114
Xext/geext.h
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
|
||||
Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
|
||||
|
||||
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 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_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _GEEXT_H_
|
||||
#define _GEEXT_H_
|
||||
#include <X11/extensions/geproto.h>
|
||||
|
||||
|
||||
/**
|
||||
* This struct is used both in the window and by grabs to determine the event
|
||||
* mask for a client.
|
||||
* A window will have a linked list of these structs, with one entry per
|
||||
* client per device, null-terminated.
|
||||
* A grab has only one instance of this struct.
|
||||
*/
|
||||
typedef struct _GenericMaskRec {
|
||||
ClientPtr client; /* client who set the event mask */
|
||||
DeviceIntPtr dev;
|
||||
Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */
|
||||
struct _GenericMaskRec* next;
|
||||
} GenericMaskRec, *GenericMaskPtr;
|
||||
|
||||
|
||||
/* Struct to keep information about registered extensions
|
||||
*
|
||||
* evswap ... use to swap event fields for different byte ordered clients.
|
||||
* evfill ... use to fill various event fields from the given parameters.
|
||||
*/
|
||||
typedef struct _GEExtension {
|
||||
void (*evswap)(xGenericEvent* from, xGenericEvent* to);
|
||||
void (*evfill)(xGenericEvent* ev,
|
||||
DeviceIntPtr pDev, /* device */
|
||||
WindowPtr pWin, /* event window */
|
||||
GrabPtr pGrab /* current grab, may be NULL */
|
||||
);
|
||||
} GEExtension, *GEExtensionPtr;
|
||||
|
||||
|
||||
/* All registered extensions and their handling functions. */
|
||||
extern GEExtension GEExtensions[MAXEXTENSIONS];
|
||||
|
||||
/* Returns the extension offset from the event */
|
||||
#define GEEXT(ev) (((xGenericEvent*)(ev))->extension)
|
||||
|
||||
#define GEEXTIDX(ev) (GEEXT(ev) & 0x7F)
|
||||
/* Typecast to generic event */
|
||||
#define GEV(ev) ((xGenericEvent*)(ev))
|
||||
/* True if mask is set for extension on window */
|
||||
#define GEMaskIsSet(pWin, extension, mask) \
|
||||
((pWin)->optional && \
|
||||
(pWin)->optional->geMasks && \
|
||||
((pWin)->optional->geMasks->eventMasks[(extension) & 0x7F] & (mask)))
|
||||
|
||||
/* Returns first client */
|
||||
#define GECLIENT(pWin) \
|
||||
(((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL)
|
||||
|
||||
/* Returns the event_fill for the given event */
|
||||
#define GEEventFill(ev) \
|
||||
GEExtensions[GEEXTIDX(xE)].evfill
|
||||
|
||||
#define GEIsType(ev, ext, ev_type) \
|
||||
((ev->u.u.type == GenericEvent) && \
|
||||
((xGenericEvent*)(ev))->extension == ext && \
|
||||
((xGenericEvent*)(ev))->evtype == ev_type)
|
||||
|
||||
|
||||
/* Interface for other extensions */
|
||||
void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
|
||||
WindowPtr pWin, int extension, Mask mask);
|
||||
|
||||
void GERegisterExtension(
|
||||
int extension,
|
||||
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to),
|
||||
void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev,
|
||||
WindowPtr pWin, GrabPtr pGrab)
|
||||
);
|
||||
|
||||
void GEInitEvent(xGenericEvent* ev, int extension);
|
||||
BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
|
||||
int extension, Mask mask);
|
||||
|
||||
void GEExtensionInit(void);
|
||||
|
||||
#endif /* _GEEXT_H_ */
|
||||
56
Xext/geint.h
Normal file
56
Xext/geint.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _GEINT_H_
|
||||
#define _GEINT_H_
|
||||
|
||||
#define NEED_EVENTS
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include <X11/extensions/geproto.h>
|
||||
|
||||
extern int GEEventType;
|
||||
extern int GEEventBase;
|
||||
extern int GEErrorBase;
|
||||
extern DevPrivateKey GEClientPrivateKey;
|
||||
|
||||
typedef struct _GEClientInfo {
|
||||
CARD32 major_version;
|
||||
CARD32 minor_version;
|
||||
} GEClientInfoRec, *GEClientInfoPtr;
|
||||
|
||||
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
|
||||
|
||||
extern int (*ProcGEVector[/*GENumRequests*/])(ClientPtr);
|
||||
extern int (*SProcGEVector[/*GENumRequests*/])(ClientPtr);
|
||||
|
||||
#endif /* _GEINT_H_ */
|
||||
76
Xext/mbuf.c
76
Xext/mbuf.c
|
|
@ -262,10 +262,10 @@ ExtensionEntry *extEntry;
|
|||
|
||||
static int
|
||||
ProcGetBufferVersion (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xMbufGetBufferVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xMbufGetBufferVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -421,11 +421,11 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
|
|||
|
||||
static int
|
||||
ProcCreateImageBuffers (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xMbufCreateImageBuffersReq);
|
||||
xMbufCreateImageBuffersReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
WindowPtr pWin;
|
||||
XID *ids;
|
||||
int len, nbuf, i, err, rc;
|
||||
|
|
@ -486,7 +486,7 @@ ProcCreateImageBuffers (client)
|
|||
|
||||
static int
|
||||
ProcDisplayImageBuffers (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xMbufDisplayImageBuffersReq);
|
||||
MultibufferPtr *pMultibuffer;
|
||||
|
|
@ -559,7 +559,7 @@ MultibufferResType);
|
|||
|
||||
static int
|
||||
ProcDestroyImageBuffers (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST (xMbufDestroyImageBuffersReq);
|
||||
WindowPtr pWin;
|
||||
|
|
@ -575,7 +575,7 @@ ProcDestroyImageBuffers (client)
|
|||
|
||||
static int
|
||||
ProcSetMBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST (xMbufSetMBufferAttributesReq);
|
||||
WindowPtr pWin;
|
||||
|
|
@ -674,7 +674,7 @@ ProcGetMBufferAttributes (client)
|
|||
|
||||
static int
|
||||
ProcSetBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xMbufSetBufferAttributesReq);
|
||||
MultibufferPtr pMultibuffer;
|
||||
|
|
@ -716,7 +716,7 @@ ProcSetBufferAttributes (client)
|
|||
|
||||
int
|
||||
ProcGetBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xMbufGetBufferAttributesReq);
|
||||
MultibufferPtr pMultibuffer;
|
||||
|
|
@ -760,7 +760,7 @@ ProcGetBufferAttributes (client)
|
|||
|
||||
static int
|
||||
ProcGetBufferInfo (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST (xMbufGetBufferInfoReq);
|
||||
DrawablePtr pDrawable;
|
||||
|
|
@ -825,7 +825,7 @@ ProcGetBufferInfo (client)
|
|||
|
||||
static int
|
||||
ProcClearImageBufferArea (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST (xMbufClearImageBufferAreaReq);
|
||||
MultibufferPtr pMultibuffer;
|
||||
|
|
@ -887,7 +887,7 @@ ProcClearImageBufferArea (client)
|
|||
|
||||
static int
|
||||
ProcMultibufferDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
|
|
@ -918,9 +918,9 @@ ProcMultibufferDispatch (client)
|
|||
|
||||
static int
|
||||
SProcGetBufferVersion (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufGetBufferVersionReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -929,9 +929,9 @@ SProcGetBufferVersion (client)
|
|||
|
||||
static int
|
||||
SProcCreateImageBuffers (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufCreateImageBuffersReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -943,9 +943,9 @@ SProcCreateImageBuffers (client)
|
|||
|
||||
static int
|
||||
SProcDisplayImageBuffers (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufDisplayImageBuffersReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -958,9 +958,9 @@ SProcDisplayImageBuffers (client)
|
|||
|
||||
static int
|
||||
SProcDestroyImageBuffers (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufDestroyImageBuffersReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -971,9 +971,9 @@ SProcDestroyImageBuffers (client)
|
|||
|
||||
static int
|
||||
SProcSetMBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufSetMBufferAttributesReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -986,9 +986,9 @@ SProcSetMBufferAttributes (client)
|
|||
|
||||
static int
|
||||
SProcGetMBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufGetMBufferAttributesReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -999,9 +999,9 @@ SProcGetMBufferAttributes (client)
|
|||
|
||||
static int
|
||||
SProcSetBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufSetBufferAttributesReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1014,9 +1014,9 @@ SProcSetBufferAttributes (client)
|
|||
|
||||
static int
|
||||
SProcGetBufferAttributes (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufGetBufferAttributesReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1027,9 +1027,9 @@ SProcGetBufferAttributes (client)
|
|||
|
||||
static int
|
||||
SProcGetBufferInfo (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufGetBufferInfoReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1040,9 +1040,9 @@ SProcGetBufferInfo (client)
|
|||
|
||||
static int
|
||||
SProcClearImageBufferArea(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST(xMbufClearImageBufferAreaReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -1057,7 +1057,7 @@ SProcClearImageBufferArea(client)
|
|||
|
||||
static int
|
||||
SProcMultibufferDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
|
|
@ -1277,7 +1277,7 @@ QueueDisplayRequest (client, activateTime)
|
|||
/* swap the request back so we can simply re-execute it */
|
||||
if (client->swapped)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xMbufDisplayImageBuffersReq);
|
||||
|
||||
SwapRestL(stuff);
|
||||
|
|
@ -1350,9 +1350,9 @@ MultibufferExpose (pMultibuffer, pRegion)
|
|||
{
|
||||
xEvent *pEvent;
|
||||
PixmapPtr pPixmap;
|
||||
register xEvent *pe;
|
||||
register BoxPtr pBox;
|
||||
register int i;
|
||||
xEvent *pe;
|
||||
BoxPtr pBox;
|
||||
int i;
|
||||
int numRects;
|
||||
|
||||
pPixmap = pMultibuffer->pPixmap;
|
||||
|
|
@ -1662,7 +1662,7 @@ OtherClientDelete (value, id)
|
|||
XID id;
|
||||
{
|
||||
MultibufferPtr pMultibuffer = (MultibufferPtr)value;
|
||||
register OtherClientsPtr other, prev;
|
||||
OtherClientsPtr other, prev;
|
||||
|
||||
prev = 0;
|
||||
for (other = pMultibuffer->otherClients; other; other = other->next)
|
||||
|
|
|
|||
|
|
@ -600,9 +600,9 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
|
|||
{
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
register int i;
|
||||
register BoxPtr pbox;
|
||||
register xRectangle *prect;
|
||||
int i;
|
||||
BoxPtr pbox;
|
||||
xRectangle *prect;
|
||||
int numRects;
|
||||
XID value;
|
||||
|
||||
|
|
@ -882,7 +882,7 @@ bufChangeWindowAttributes(pWin, mask)
|
|||
static void
|
||||
bufWindowExposures(pWin, prgn, other_exposed)
|
||||
WindowPtr pWin;
|
||||
register RegionPtr prgn, other_exposed;
|
||||
RegionPtr prgn, other_exposed;
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ _X_EXPORT unsigned long XRT_PIXMAP;
|
|||
_X_EXPORT unsigned long XRT_GC;
|
||||
_X_EXPORT unsigned long XRT_COLORMAP;
|
||||
|
||||
static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr);
|
||||
_X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
|
@ -668,10 +671,10 @@ Bool PanoramiXCreateConnectionBlock(void)
|
|||
|
||||
connSetupPrefix.length = length >> 2;
|
||||
|
||||
xfree(PanoramiXVisuals);
|
||||
for (i = 0; i < PanoramiXNumDepths; i++)
|
||||
xfree(PanoramiXDepths[i].vids);
|
||||
xfree(PanoramiXDepths);
|
||||
PanoramiXDepths = NULL;
|
||||
|
||||
/*
|
||||
* OK, change some dimensions so it looks as if it were one big screen
|
||||
|
|
@ -709,7 +712,7 @@ Bool PanoramiXCreateConnectionBlock(void)
|
|||
* do their own back-mapping.
|
||||
*/
|
||||
static Bool
|
||||
VisualsEqual(VisualPtr a, VisualPtr b)
|
||||
VisualsEqual(VisualPtr a, ScreenPtr pScreenB, VisualPtr b)
|
||||
{
|
||||
return ((a->class == b->class) &&
|
||||
(a->ColormapEntries == b->ColormapEntries) &&
|
||||
|
|
@ -759,7 +762,6 @@ static void
|
|||
PanoramiXMaybeAddVisual(VisualPtr pVisual)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
VisualPtr candidate = NULL;
|
||||
int j, k;
|
||||
Bool found = FALSE;
|
||||
|
||||
|
|
@ -767,10 +769,10 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
|
|||
pScreen = screenInfo.screens[j];
|
||||
found = FALSE;
|
||||
|
||||
candidate = pScreen->visuals;
|
||||
for (k = 0; k < pScreen->numVisuals; k++) {
|
||||
candidate++;
|
||||
if (VisualsEqual(pVisual, candidate)
|
||||
VisualPtr candidate = &pScreen->visuals[k];
|
||||
|
||||
if ((*XineramaVisualsEqualPtr)(pVisual, pScreen, candidate)
|
||||
#ifdef GLXPROXY
|
||||
&& glxMatchVisual(screenInfo.screens[0], pVisual, pScreen)
|
||||
#endif
|
||||
|
|
@ -844,8 +846,9 @@ PanoramiXConsolidate(void)
|
|||
_X_EXPORT VisualID
|
||||
PanoramiXTranslateVisualID(int screen, VisualID orig)
|
||||
{
|
||||
ScreenPtr pOtherScreen = screenInfo.screens[screen];
|
||||
VisualPtr pVisual = NULL;
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < PanoramiXNumVisuals; i++) {
|
||||
if (orig == PanoramiXVisuals[i].vid) {
|
||||
|
|
@ -857,12 +860,18 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
|
|||
if (!pVisual)
|
||||
return 0;
|
||||
|
||||
/* if screen is 0, orig is already the correct visual ID */
|
||||
if (screen == 0)
|
||||
return orig;
|
||||
|
||||
/* found the original, now translate it relative to the backend screen */
|
||||
for (i = 0; i < PanoramiXNumScreens; i++)
|
||||
for (j = 0; j < screenInfo.screens[i]->numVisuals; j++)
|
||||
if (VisualsEqual(pVisual, &screenInfo.screens[i]->visuals[j]))
|
||||
return screenInfo.screens[i]->visuals[j].vid;
|
||||
|
||||
for (i = 0; i < pOtherScreen->numVisuals; i++) {
|
||||
VisualPtr pOtherVisual = &pOtherScreen->visuals[i];
|
||||
|
||||
if ((*XineramaVisualsEqualPtr)(pVisual, pOtherScreen, pOtherVisual))
|
||||
return pOtherVisual->vid;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +925,7 @@ ProcPanoramiXGetState(ClientPtr client)
|
|||
REQUEST(xPanoramiXGetStateReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetStateReply rep;
|
||||
register int n, rc;
|
||||
int n, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
@ -943,7 +952,7 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
|
|||
REQUEST(xPanoramiXGetScreenCountReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetScreenCountReply rep;
|
||||
register int n, rc;
|
||||
int n, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
@ -969,7 +978,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
|||
REQUEST(xPanoramiXGetScreenSizeReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetScreenSizeReply rep;
|
||||
register int n, rc;
|
||||
int n, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
@ -1014,7 +1023,7 @@ ProcXineramaIsActive(ClientPtr client)
|
|||
rep.state = !noPanoramiXExtension;
|
||||
#endif
|
||||
if (client->swapped) {
|
||||
register int n;
|
||||
int n;
|
||||
swaps (&rep.sequenceNumber, n);
|
||||
swapl (&rep.length, n);
|
||||
swapl (&rep.state, n);
|
||||
|
|
@ -1037,7 +1046,7 @@ ProcXineramaQueryScreens(ClientPtr client)
|
|||
rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
|
||||
rep.length = rep.number * sz_XineramaScreenInfo >> 2;
|
||||
if (client->swapped) {
|
||||
register int n;
|
||||
int n;
|
||||
swaps (&rep.sequenceNumber, n);
|
||||
swapl (&rep.length, n);
|
||||
swapl (&rep.number, n);
|
||||
|
|
@ -1055,7 +1064,7 @@ ProcXineramaQueryScreens(ClientPtr client)
|
|||
scratch.height = panoramiXdataPtr[i].height;
|
||||
|
||||
if(client->swapped) {
|
||||
register int n;
|
||||
int n;
|
||||
swaps (&scratch.x_org, n);
|
||||
swaps (&scratch.y_org, n);
|
||||
swaps (&scratch.width, n);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ static int
|
|||
SProcPanoramiXQueryVersion (ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXQueryVersionReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
|
||||
|
|
@ -62,7 +62,7 @@ static int
|
|||
SProcPanoramiXGetState(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXGetStateReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
||||
|
|
@ -74,7 +74,7 @@ static int
|
|||
SProcPanoramiXGetScreenCount(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenCountReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
|
|
@ -86,7 +86,7 @@ static int
|
|||
SProcPanoramiXGetScreenSize(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenSizeReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
|
|
@ -100,7 +100,7 @@ static int
|
|||
SProcXineramaIsActive(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXineramaIsActiveReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
|
||||
|
|
@ -112,7 +112,7 @@ static int
|
|||
SProcXineramaQueryScreens(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXineramaQueryScreensReq);
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,16 @@ extern unsigned long XRT_PIXMAP;
|
|||
extern unsigned long XRT_GC;
|
||||
extern unsigned long XRT_COLORMAP;
|
||||
|
||||
/*
|
||||
* Drivers are allowed to wrap this function. Each wrapper can decide that the
|
||||
* two visuals are unequal, but if they are deemed equal, the wrapper must call
|
||||
* down and return FALSE if the wrapped function does. This ensures that all
|
||||
* layers agree that the visuals are equal. The first visual is always from
|
||||
* screen 0.
|
||||
*/
|
||||
typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr);
|
||||
extern XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
|
||||
|
||||
extern void XineramaGetImageData(
|
||||
DrawablePtr *pDrawables,
|
||||
int left,
|
||||
|
|
|
|||
10
Xext/saver.c
10
Xext/saver.c
|
|
@ -751,10 +751,10 @@ ScreenSaverHandle (pScreen, xstate, force)
|
|||
|
||||
static int
|
||||
ProcScreenSaverQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xScreenSaverQueryVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xScreenSaverQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -772,11 +772,11 @@ ProcScreenSaverQueryVersion (client)
|
|||
|
||||
static int
|
||||
ProcScreenSaverQueryInfo (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xScreenSaverQueryInfoReq);
|
||||
xScreenSaverQueryInfoReply rep;
|
||||
register int n, rc;
|
||||
int n, rc;
|
||||
ScreenSaverStuffPtr pSaver;
|
||||
DrawablePtr pDraw;
|
||||
CARD32 lastInput;
|
||||
|
|
@ -849,7 +849,7 @@ ProcScreenSaverQueryInfo (client)
|
|||
|
||||
static int
|
||||
ProcScreenSaverSelectInput (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xScreenSaverSelectInputReq);
|
||||
DrawablePtr pDraw;
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ ProcSecurityQueryVersion(
|
|||
rep.minorVersion = SECURITY_MINOR_VERSION;
|
||||
if(client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.majorVersion, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
|
|
@ -585,7 +585,7 @@ ProcSecurityGenerateAuthorization(
|
|||
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swapl(&rep.length, n);
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.authId, n);
|
||||
|
|
@ -658,7 +658,7 @@ SProcSecurityQueryVersion(
|
|||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityQueryVersionReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
|
||||
|
|
@ -673,7 +673,7 @@ SProcSecurityGenerateAuthorization(
|
|||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||
register char n;
|
||||
char n;
|
||||
CARD32 *values;
|
||||
unsigned long nvalues;
|
||||
|
||||
|
|
@ -696,7 +696,7 @@ SProcSecurityRevokeAuthorization(
|
|||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
|
||||
|
|
@ -1037,7 +1037,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
74
Xext/shape.c
74
Xext/shape.c
|
|
@ -276,10 +276,10 @@ CreateClipShape (pWin)
|
|||
|
||||
static int
|
||||
ProcShapeQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xShapeQueryVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -304,7 +304,7 @@ ProcShapeQueryVersion (client)
|
|||
|
||||
static int
|
||||
ProcShapeRectangles (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
|
|
@ -375,7 +375,7 @@ ProcShapeRectangles (client)
|
|||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeRectangles(
|
||||
register ClientPtr client)
|
||||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeRectanglesReq);
|
||||
PanoramiXRes *win;
|
||||
|
|
@ -404,7 +404,7 @@ ProcPanoramiXShapeRectangles(
|
|||
|
||||
static int
|
||||
ProcShapeMask (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
|
|
@ -474,7 +474,7 @@ ProcShapeMask (client)
|
|||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeMask(
|
||||
register ClientPtr client)
|
||||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeMaskReq);
|
||||
PanoramiXRes *win, *pmap;
|
||||
|
|
@ -511,7 +511,7 @@ ProcPanoramiXShapeMask(
|
|||
|
||||
static int
|
||||
ProcShapeCombine (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
WindowPtr pSrcWin, pDestWin;
|
||||
ScreenPtr pScreen;
|
||||
|
|
@ -603,7 +603,7 @@ ProcShapeCombine (client)
|
|||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeCombine(
|
||||
register ClientPtr client)
|
||||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeCombineReq);
|
||||
PanoramiXRes *win, *win2;
|
||||
|
|
@ -635,7 +635,7 @@ ProcPanoramiXShapeCombine(
|
|||
|
||||
static int
|
||||
ProcShapeOffset (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
|
|
@ -676,7 +676,7 @@ ProcShapeOffset (client)
|
|||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeOffset(
|
||||
register ClientPtr client)
|
||||
ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeOffsetReq);
|
||||
PanoramiXRes *win;
|
||||
|
|
@ -700,13 +700,13 @@ ProcPanoramiXShapeOffset(
|
|||
|
||||
static int
|
||||
ProcShapeQueryExtents (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xShapeQueryExtentsReq);
|
||||
WindowPtr pWin;
|
||||
xShapeQueryExtentsReply rep;
|
||||
BoxRec extents, *pExtents;
|
||||
register int n, rc;
|
||||
int n, rc;
|
||||
RegionPtr region;
|
||||
|
||||
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
|
||||
|
|
@ -811,7 +811,7 @@ ShapeFreeEvents (data, id)
|
|||
|
||||
static int
|
||||
ProcShapeSelectInput (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xShapeSelectInputReq);
|
||||
WindowPtr pWin;
|
||||
|
|
@ -983,14 +983,14 @@ SendShapeNotify (pWin, which)
|
|||
|
||||
static int
|
||||
ProcShapeInputSelected (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xShapeInputSelectedReq);
|
||||
WindowPtr pWin;
|
||||
ShapeEventPtr pShapeEvent, *pHead;
|
||||
int enabled, rc;
|
||||
xShapeInputSelectedReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
@ -1024,7 +1024,7 @@ ProcShapeInputSelected (client)
|
|||
|
||||
static int
|
||||
ProcShapeGetRectangles (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xShapeGetRectanglesReq);
|
||||
WindowPtr pWin;
|
||||
|
|
@ -1032,7 +1032,7 @@ ProcShapeGetRectangles (client)
|
|||
xRectangle *rects;
|
||||
int nrects, i, rc;
|
||||
RegionPtr region;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
@ -1110,7 +1110,7 @@ ProcShapeGetRectangles (client)
|
|||
|
||||
static int
|
||||
ProcShapeDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
|
|
@ -1175,9 +1175,9 @@ SShapeNotifyEvent(from, to)
|
|||
|
||||
static int
|
||||
SProcShapeQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xShapeQueryVersionReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1186,9 +1186,9 @@ SProcShapeQueryVersion (client)
|
|||
|
||||
static int
|
||||
SProcShapeRectangles (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST (xShapeRectanglesReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1202,9 +1202,9 @@ SProcShapeRectangles (client)
|
|||
|
||||
static int
|
||||
SProcShapeMask (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST (xShapeMaskReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1218,9 +1218,9 @@ SProcShapeMask (client)
|
|||
|
||||
static int
|
||||
SProcShapeCombine (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST (xShapeCombineReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1234,9 +1234,9 @@ SProcShapeCombine (client)
|
|||
|
||||
static int
|
||||
SProcShapeOffset (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST (xShapeOffsetReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1249,9 +1249,9 @@ SProcShapeOffset (client)
|
|||
|
||||
static int
|
||||
SProcShapeQueryExtents (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST (xShapeQueryExtentsReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1262,9 +1262,9 @@ SProcShapeQueryExtents (client)
|
|||
|
||||
static int
|
||||
SProcShapeSelectInput (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
REQUEST (xShapeSelectInputReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1275,9 +1275,9 @@ SProcShapeSelectInput (client)
|
|||
|
||||
static int
|
||||
SProcShapeInputSelected (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST (xShapeInputSelectedReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -1288,10 +1288,10 @@ SProcShapeInputSelected (client)
|
|||
|
||||
static int
|
||||
SProcShapeGetRectangles (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xShapeGetRectanglesReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
||||
|
|
@ -1301,7 +1301,7 @@ SProcShapeGetRectangles (client)
|
|||
|
||||
static int
|
||||
SProcShapeDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
|
|
|
|||
42
Xext/shm.c
42
Xext/shm.c
|
|
@ -336,10 +336,10 @@ ShmRegisterFbFuncs(pScreen)
|
|||
|
||||
static int
|
||||
ProcShmQueryVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xShmQueryVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -431,7 +431,7 @@ shm_access(ClientPtr client, SHMPERM_TYPE *perm, int readonly)
|
|||
|
||||
static int
|
||||
ProcShmAttach(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
SHMSTAT_TYPE buf;
|
||||
ShmDescPtr shmdesc;
|
||||
|
|
@ -511,7 +511,7 @@ ShmDetachSegment(value, shmseg)
|
|||
|
||||
static int
|
||||
ProcShmDetach(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
ShmDescPtr shmdesc;
|
||||
REQUEST(xShmDetachReq);
|
||||
|
|
@ -588,7 +588,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
|
|||
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShmPutImage(register ClientPtr client)
|
||||
ProcPanoramiXShmPutImage(ClientPtr client)
|
||||
{
|
||||
int j, result = 0, orig_x, orig_y;
|
||||
PanoramiXRes *draw, *gc;
|
||||
|
|
@ -735,7 +735,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
}
|
||||
|
||||
if (client->swapped) {
|
||||
register int n;
|
||||
int n;
|
||||
swaps(&xgi.sequenceNumber, n);
|
||||
swapl(&xgi.length, n);
|
||||
swapl(&xgi.visual, n);
|
||||
|
|
@ -748,7 +748,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
|
||||
static int
|
||||
ProcPanoramiXShmCreatePixmap(
|
||||
register ClientPtr client)
|
||||
ClientPtr client)
|
||||
{
|
||||
ScreenPtr pScreen = NULL;
|
||||
PixmapPtr pMap = NULL;
|
||||
|
|
@ -856,7 +856,7 @@ CreatePmap:
|
|||
|
||||
static int
|
||||
ProcShmPutImage(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
GCPtr pGC;
|
||||
DrawablePtr pDraw;
|
||||
|
|
@ -960,7 +960,7 @@ ProcShmPutImage(client)
|
|||
|
||||
static int
|
||||
ProcShmGetImage(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
DrawablePtr pDraw;
|
||||
long lenPer = 0, length;
|
||||
|
|
@ -1079,7 +1079,7 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
|
|||
int depth;
|
||||
char *addr;
|
||||
{
|
||||
register PixmapPtr pPixmap;
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
|
||||
if (!pPixmap)
|
||||
|
|
@ -1095,12 +1095,12 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
|
|||
|
||||
static int
|
||||
ProcShmCreatePixmap(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
PixmapPtr pMap;
|
||||
DrawablePtr pDraw;
|
||||
DepthPtr pDepth;
|
||||
register int i, rc;
|
||||
int i, rc;
|
||||
ShmDescPtr shmdesc;
|
||||
REQUEST(xShmCreatePixmapReq);
|
||||
unsigned int width, height, depth;
|
||||
|
|
@ -1177,7 +1177,7 @@ CreatePmap:
|
|||
|
||||
static int
|
||||
ProcShmDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
@ -1226,9 +1226,9 @@ SShmCompletionEvent(from, to)
|
|||
|
||||
static int
|
||||
SProcShmQueryVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xShmQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -1239,7 +1239,7 @@ static int
|
|||
SProcShmAttach(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xShmAttachReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xShmAttachReq);
|
||||
|
|
@ -1252,7 +1252,7 @@ static int
|
|||
SProcShmDetach(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xShmDetachReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xShmDetachReq);
|
||||
|
|
@ -1264,7 +1264,7 @@ static int
|
|||
SProcShmPutImage(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xShmPutImageReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
||||
|
|
@ -1287,7 +1287,7 @@ static int
|
|||
SProcShmGetImage(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xShmGetImageReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xShmGetImageReq);
|
||||
|
|
@ -1306,7 +1306,7 @@ static int
|
|||
SProcShmCreatePixmap(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xShmCreatePixmapReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
||||
|
|
@ -1321,7 +1321,7 @@ SProcShmCreatePixmap(client)
|
|||
|
||||
static int
|
||||
SProcShmDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
|
|||
38
Xext/sync.c
38
Xext/sync.c
|
|
@ -1405,7 +1405,7 @@ ProcSyncListSystemCounters(client)
|
|||
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.nCounters, n);
|
||||
|
|
@ -1425,7 +1425,7 @@ ProcSyncListSystemCounters(client)
|
|||
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swapl(&walklist->counter, n);
|
||||
swapl(&walklist->resolution_hi, n);
|
||||
swapl(&walklist->resolution_lo, n);
|
||||
|
|
@ -1514,7 +1514,7 @@ ProcSyncGetPriority(client)
|
|||
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.priority, n);
|
||||
}
|
||||
|
|
@ -1799,7 +1799,7 @@ ProcSyncQueryCounter(client)
|
|||
rep.value_lo = XSyncValueLow32(pCounter->value);
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.value_hi, n);
|
||||
|
|
@ -1981,7 +1981,7 @@ ProcSyncQueryAlarm(client)
|
|||
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
char n;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.counter, n);
|
||||
|
|
@ -2070,7 +2070,7 @@ SProcSyncInitialize(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncInitializeReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncInitializeReq);
|
||||
|
|
@ -2083,7 +2083,7 @@ SProcSyncListSystemCounters(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncListSystemCountersReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncListSystemCountersReq);
|
||||
|
|
@ -2096,7 +2096,7 @@ SProcSyncCreateCounter(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncCreateCounterReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncCreateCounterReq);
|
||||
|
|
@ -2112,7 +2112,7 @@ SProcSyncSetCounter(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncSetCounterReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncSetCounterReq);
|
||||
|
|
@ -2128,7 +2128,7 @@ SProcSyncChangeCounter(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncChangeCounterReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncChangeCounterReq);
|
||||
|
|
@ -2144,7 +2144,7 @@ SProcSyncQueryCounter(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncQueryCounterReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncQueryCounterReq);
|
||||
|
|
@ -2158,7 +2158,7 @@ SProcSyncDestroyCounter(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncDestroyCounterReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncDestroyCounterReq);
|
||||
|
|
@ -2172,7 +2172,7 @@ SProcSyncAwait(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncAwaitReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
|
||||
|
|
@ -2187,7 +2187,7 @@ SProcSyncCreateAlarm(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncCreateAlarmReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
|
||||
|
|
@ -2203,7 +2203,7 @@ SProcSyncChangeAlarm(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncChangeAlarmReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
|
||||
|
|
@ -2218,7 +2218,7 @@ SProcSyncQueryAlarm(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncQueryAlarmReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncQueryAlarmReq);
|
||||
|
|
@ -2232,7 +2232,7 @@ SProcSyncDestroyAlarm(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncDestroyAlarmReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncDestroyAlarmReq);
|
||||
|
|
@ -2246,7 +2246,7 @@ SProcSyncSetPriority(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncSetPriorityReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncSetPriorityReq);
|
||||
|
|
@ -2261,7 +2261,7 @@ SProcSyncGetPriority(client)
|
|||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xSyncGetPriorityReq);
|
||||
register char n;
|
||||
char n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xSyncGetPriorityReq);
|
||||
|
|
|
|||
|
|
@ -78,10 +78,10 @@ XCMiscResetProc (extEntry)
|
|||
|
||||
static int
|
||||
ProcXCMiscGetVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xXCMiscGetVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -100,10 +100,10 @@ ProcXCMiscGetVersion(client)
|
|||
|
||||
static int
|
||||
ProcXCMiscGetXIDRange(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xXCMiscGetXIDRangeReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
XID min_id, max_id;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
|
||||
|
|
@ -124,11 +124,11 @@ ProcXCMiscGetXIDRange(client)
|
|||
|
||||
static int
|
||||
ProcXCMiscGetXIDList(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xXCMiscGetXIDListReq);
|
||||
xXCMiscGetXIDListReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
XID *pids;
|
||||
unsigned int count;
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ ProcXCMiscGetXIDList(client)
|
|||
|
||||
static int
|
||||
ProcXCMiscDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
@ -182,9 +182,9 @@ ProcXCMiscDispatch (client)
|
|||
|
||||
static int
|
||||
SProcXCMiscGetVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xXCMiscGetVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -196,9 +196,9 @@ SProcXCMiscGetVersion(client)
|
|||
|
||||
static int
|
||||
SProcXCMiscGetXIDRange(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -207,9 +207,9 @@ SProcXCMiscGetXIDRange(client)
|
|||
|
||||
static int
|
||||
SProcXCMiscGetXIDList(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xXCMiscGetXIDListReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -219,7 +219,7 @@ SProcXCMiscGetXIDList(client)
|
|||
|
||||
static int
|
||||
SProcXCMiscDispatch (client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
|
|||
28
Xext/xevie.c
28
Xext/xevie.c
|
|
@ -153,7 +153,7 @@ void XevieResetProc (ExtensionEntry *extEntry)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcXevieQueryVersion (register ClientPtr client)
|
||||
int ProcXevieQueryVersion (ClientPtr client)
|
||||
{
|
||||
xXevieQueryVersionReply rep;
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ int ProcXevieQueryVersion (register ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcXevieStart (register ClientPtr client)
|
||||
int ProcXevieStart (ClientPtr client)
|
||||
{
|
||||
xXevieStartReply rep;
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ int ProcXevieStart (register ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcXevieEnd (register ClientPtr client)
|
||||
int ProcXevieEnd (ClientPtr client)
|
||||
{
|
||||
xXevieEndReply rep;
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ int ProcXevieEnd (register ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcXevieSend (register ClientPtr client)
|
||||
int ProcXevieSend (ClientPtr client)
|
||||
{
|
||||
REQUEST (xXevieSendReq);
|
||||
xXevieSendReply rep;
|
||||
|
|
@ -278,7 +278,7 @@ int ProcXevieSend (register ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcXevieSelectInput (register ClientPtr client)
|
||||
int ProcXevieSelectInput (ClientPtr client)
|
||||
{
|
||||
REQUEST (xXevieSelectInputReq);
|
||||
xXevieSelectInputReply rep;
|
||||
|
|
@ -296,7 +296,7 @@ int ProcXevieSelectInput (register ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcXevieDispatch (register ClientPtr client)
|
||||
int ProcXevieDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST (xReq);
|
||||
switch (stuff->data)
|
||||
|
|
@ -317,9 +317,9 @@ int ProcXevieDispatch (register ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int SProcXevieQueryVersion (register ClientPtr client)
|
||||
int SProcXevieQueryVersion (ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST(xXevieQueryVersionReq);
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -332,7 +332,7 @@ int SProcXevieQueryVersion (register ClientPtr client)
|
|||
static
|
||||
int SProcXevieStart (ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST (xXevieStartReq);
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -344,7 +344,7 @@ int SProcXevieStart (ClientPtr client)
|
|||
static
|
||||
int SProcXevieEnd (ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST (xXevieEndReq);
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -356,7 +356,7 @@ int SProcXevieEnd (ClientPtr client)
|
|||
static
|
||||
int SProcXevieSend (ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
xEvent eventT;
|
||||
EventSwapPtr proc;
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ int SProcXevieSend (ClientPtr client)
|
|||
static
|
||||
int SProcXevieSelectInput (ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST (xXevieSelectInputReq);
|
||||
swaps (&stuff->length, n);
|
||||
|
|
@ -389,7 +389,7 @@ int SProcXevieSelectInput (ClientPtr client)
|
|||
|
||||
|
||||
static
|
||||
int SProcXevieDispatch (register ClientPtr client)
|
||||
int SProcXevieDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
|
|
@ -471,7 +471,7 @@ XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
|
|||
xevieModifiersOn = TRUE;
|
||||
|
||||
xE->u.keyButtonPointer.event = xeviewin->drawable.id;
|
||||
xE->u.keyButtonPointer.root = GetCurrentRootWindow()->drawable.id;
|
||||
xE->u.keyButtonPointer.root = GetCurrentRootWindow(dev)->drawable.id;
|
||||
xE->u.keyButtonPointer.child = (xeviewin->firstChild)
|
||||
? xeviewin->firstChild->drawable.id:0;
|
||||
xE->u.keyButtonPointer.rootX = xeviehot.x;
|
||||
|
|
|
|||
2617
Xext/xprint.c
2617
Xext/xprint.c
File diff suppressed because it is too large
Load diff
|
|
@ -94,7 +94,7 @@ ProcXResQueryClients (ClientPtr client)
|
|||
scratch.resource_mask = RESOURCE_ID_MASK;
|
||||
|
||||
if(client->swapped) {
|
||||
register int n;
|
||||
int n;
|
||||
swapl (&scratch.resource_base, n);
|
||||
swapl (&scratch.resource_mask, n);
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ ProcXResQueryClientResources (ClientPtr client)
|
|||
scratch.count = counts[i];
|
||||
|
||||
if(client->swapped) {
|
||||
register int n;
|
||||
int n;
|
||||
swapl (&scratch.resource_type, n);
|
||||
swapl (&scratch.count, n);
|
||||
}
|
||||
|
|
|
|||
673
Xext/xtest.c
673
Xext/xtest.c
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
|
||||
Copyright 1992, 1998 The Open Group
|
||||
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.
|
||||
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 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.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", 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.
|
||||
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>
|
||||
|
|
@ -42,20 +42,18 @@ from The Open Group.
|
|||
#include "scrnintstr.h"
|
||||
#include "dixevents.h"
|
||||
#include "sleepuntil.h"
|
||||
#include "mi.h"
|
||||
#define _XTEST_SERVER_
|
||||
#include <X11/extensions/XTest.h>
|
||||
#include <X11/extensions/xteststr.h>
|
||||
#ifdef XINPUT
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#define EXTENSION_EVENT_BASE 64
|
||||
#endif /* XINPUT */
|
||||
|
||||
#include "modinit.h"
|
||||
|
||||
#ifdef XINPUT
|
||||
extern int DeviceValuator;
|
||||
#endif /* XINPUT */
|
||||
extern int DeviceMotionNotify;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
|
|
@ -63,12 +61,12 @@ extern int DeviceValuator;
|
|||
#endif
|
||||
|
||||
static void XTestResetProc(
|
||||
ExtensionEntry * /* extEntry */
|
||||
);
|
||||
ExtensionEntry * /* extEntry */
|
||||
);
|
||||
static int XTestSwapFakeInput(
|
||||
ClientPtr /* client */,
|
||||
xReq * /* req */
|
||||
);
|
||||
ClientPtr /* client */,
|
||||
xReq * /* req */
|
||||
);
|
||||
|
||||
static DISPATCH_PROC(ProcXTestCompareCursor);
|
||||
static DISPATCH_PROC(ProcXTestDispatch);
|
||||
|
|
@ -85,23 +83,23 @@ void
|
|||
XTestExtensionInit(INITARGS)
|
||||
{
|
||||
AddExtension(XTestExtensionName, 0, 0,
|
||||
ProcXTestDispatch, SProcXTestDispatch,
|
||||
XTestResetProc, StandardMinorOpcode);
|
||||
ProcXTestDispatch, SProcXTestDispatch,
|
||||
XTestResetProc, StandardMinorOpcode);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
XTestResetProc (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestGetVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
xXTestGetVersionReply rep;
|
||||
register int n;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -110,8 +108,8 @@ ProcXTestGetVersion(client)
|
|||
rep.majorVersion = XTestMajorVersion;
|
||||
rep.minorVersion = XTestMinorVersion;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
|
|
@ -119,37 +117,38 @@ ProcXTestGetVersion(client)
|
|||
|
||||
static int
|
||||
ProcXTestCompareCursor(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestCompareCursorReq);
|
||||
xXTestCompareCursorReply rep;
|
||||
WindowPtr pWin;
|
||||
CursorPtr pCursor;
|
||||
register int n, rc;
|
||||
int n, rc;
|
||||
DeviceIntPtr ptr = PickPointer(client);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
if (stuff->cursor == None)
|
||||
pCursor = NullCursor;
|
||||
pCursor = NullCursor;
|
||||
else if (stuff->cursor == XTestCurrentCursor)
|
||||
pCursor = GetSpriteCursor();
|
||||
pCursor = GetSpriteCursor(ptr);
|
||||
else {
|
||||
rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
|
||||
client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = stuff->cursor;
|
||||
return (rc == BadValue) ? BadCursor : rc;
|
||||
}
|
||||
rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
|
||||
client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = stuff->cursor;
|
||||
return (rc == BadValue) ? BadCursor : rc;
|
||||
}
|
||||
}
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.same = (wCursor(pWin) == pCursor);
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
|
|
@ -157,345 +156,307 @@ ProcXTestCompareCursor(client)
|
|||
|
||||
static int
|
||||
ProcXTestFakeInput(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestFakeInputReq);
|
||||
int nev, n, type, rc;
|
||||
xEvent *ev;
|
||||
DeviceIntPtr dev = NULL;
|
||||
WindowPtr root;
|
||||
#ifdef XINPUT
|
||||
Bool extension = FALSE;
|
||||
deviceValuator *dv = NULL;
|
||||
int base;
|
||||
int *values;
|
||||
#endif /* XINPUT */
|
||||
int valuators[MAX_VALUATORS] = {0};
|
||||
int numValuators = 0;
|
||||
int firstValuator;
|
||||
EventListPtr events;
|
||||
int nevents;
|
||||
int i;
|
||||
int base = 0;
|
||||
|
||||
nev = (stuff->length << 2) - sizeof(xReq);
|
||||
if ((nev % sizeof(xEvent)) || !nev)
|
||||
return BadLength;
|
||||
return BadLength;
|
||||
nev /= sizeof(xEvent);
|
||||
UpdateCurrentTime();
|
||||
ev = (xEvent *)&((xReq *)stuff)[1];
|
||||
type = ev->u.u.type & 0177;
|
||||
#ifdef XINPUT
|
||||
|
||||
if (type >= EXTENSION_EVENT_BASE)
|
||||
{
|
||||
type -= DeviceValuator;
|
||||
switch (type) {
|
||||
case XI_DeviceKeyPress:
|
||||
case XI_DeviceKeyRelease:
|
||||
case XI_DeviceButtonPress:
|
||||
case XI_DeviceButtonRelease:
|
||||
case XI_DeviceMotionNotify:
|
||||
case XI_ProximityIn:
|
||||
case XI_ProximityOut:
|
||||
break;
|
||||
default:
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
if (nev == 1 && type == XI_DeviceMotionNotify)
|
||||
return BadLength;
|
||||
if (type == XI_DeviceMotionNotify)
|
||||
base = ((deviceValuator *)(ev+1))->first_valuator;
|
||||
else
|
||||
base = 0;
|
||||
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)
|
||||
{
|
||||
client->errorValue = dv->first_valuator;
|
||||
return BadValue;
|
||||
}
|
||||
if (!dv->num_valuators || dv->num_valuators > 6)
|
||||
{
|
||||
client->errorValue = dv->num_valuators;
|
||||
return BadValue;
|
||||
}
|
||||
base += dv->num_valuators;
|
||||
}
|
||||
type = type - XI_DeviceKeyPress + KeyPress;
|
||||
extension = TRUE;
|
||||
}
|
||||
else
|
||||
#endif /* XINPUT */
|
||||
extension = TRUE;
|
||||
|
||||
/* check device */
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
|
||||
DixWriteAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = stuff->deviceid & 0177;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* check type */
|
||||
type -= DeviceValuator;
|
||||
switch (type) {
|
||||
case XI_DeviceKeyPress:
|
||||
case XI_DeviceKeyRelease:
|
||||
case XI_DeviceButtonPress:
|
||||
case XI_DeviceButtonRelease:
|
||||
case XI_DeviceMotionNotify:
|
||||
case XI_ProximityIn:
|
||||
case XI_ProximityOut:
|
||||
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 */
|
||||
|
||||
if (type == XI_DeviceMotionNotify)
|
||||
{
|
||||
firstValuator = ((deviceValuator *)(ev+1))->first_valuator;
|
||||
if (firstValuator > dev->valuator->numAxes)
|
||||
{
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
} else
|
||||
firstValuator = 0;
|
||||
|
||||
if (nev == 1 && type == XI_DeviceMotionNotify && !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)
|
||||
{
|
||||
client->errorValue = dv->type;
|
||||
return BadValue;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
base += dv->num_valuators;
|
||||
numValuators += dv->num_valuators;
|
||||
|
||||
if (firstValuator + numValuators > dev->valuator->numAxes)
|
||||
{
|
||||
client->errorValue = dv->num_valuators;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
type = type - XI_DeviceKeyPress + KeyPress;
|
||||
|
||||
} else
|
||||
{
|
||||
if (nev != 1)
|
||||
return BadLength;
|
||||
switch (type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
case MotionNotify:
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
break;
|
||||
default:
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
default:
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (dev->u.lastSlave)
|
||||
dev = dev->u.lastSlave;
|
||||
}
|
||||
|
||||
/* If the event has a time set, wait for it to pass */
|
||||
if (ev->u.keyButtonPointer.time)
|
||||
{
|
||||
TimeStamp activateTime;
|
||||
CARD32 ms;
|
||||
TimeStamp activateTime;
|
||||
CARD32 ms;
|
||||
|
||||
activateTime = currentTime;
|
||||
ms = activateTime.milliseconds + ev->u.keyButtonPointer.time;
|
||||
if (ms < activateTime.milliseconds)
|
||||
activateTime.months++;
|
||||
activateTime.milliseconds = ms;
|
||||
ev->u.keyButtonPointer.time = 0;
|
||||
activateTime = currentTime;
|
||||
ms = activateTime.milliseconds + ev->u.keyButtonPointer.time;
|
||||
if (ms < activateTime.milliseconds)
|
||||
activateTime.months++;
|
||||
activateTime.milliseconds = ms;
|
||||
ev->u.keyButtonPointer.time = 0;
|
||||
|
||||
/* see mbuf.c:QueueDisplayRequest for code similar to this */
|
||||
/* see mbuf.c:QueueDisplayRequest for code similar to this */
|
||||
|
||||
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);
|
||||
swaps(&stuff->length, n);
|
||||
}
|
||||
ResetCurrentRequest (client);
|
||||
client->sequence--;
|
||||
return Success;
|
||||
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);
|
||||
swaps(&stuff->length, n);
|
||||
}
|
||||
ResetCurrentRequest (client);
|
||||
client->sequence--;
|
||||
return Success;
|
||||
}
|
||||
#ifdef XINPUT
|
||||
if (extension)
|
||||
{
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
|
||||
DixWriteAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = stuff->deviceid & 0177;
|
||||
return rc;
|
||||
}
|
||||
if (nev > 1)
|
||||
{
|
||||
dv = (deviceValuator *)(ev + 1);
|
||||
if (!dev->valuator || dv->first_valuator >= dev->valuator->numAxes)
|
||||
{
|
||||
client->errorValue = dv->first_valuator;
|
||||
return BadValue;
|
||||
}
|
||||
if (dv->first_valuator + dv->num_valuators >
|
||||
dev->valuator->numAxes)
|
||||
{
|
||||
client->errorValue = dv->num_valuators;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* XINPUT */
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
#ifdef XINPUT
|
||||
if (!extension)
|
||||
#endif /* XINPUT */
|
||||
dev = inputInfo.keyboard;
|
||||
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
|
||||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
case MotionNotify:
|
||||
#ifdef XINPUT
|
||||
if (extension)
|
||||
{
|
||||
if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute)
|
||||
{
|
||||
values = dev->valuator->axisVal + dv->first_valuator;
|
||||
for (n = 1; n < nev; n++)
|
||||
{
|
||||
dv = (deviceValuator *)(ev + n);
|
||||
switch (dv->num_valuators)
|
||||
{
|
||||
case 6:
|
||||
dv->valuator5 += values[5];
|
||||
case 5:
|
||||
dv->valuator4 += values[4];
|
||||
case 4:
|
||||
dv->valuator3 += values[3];
|
||||
case 3:
|
||||
dv->valuator2 += values[2];
|
||||
case 2:
|
||||
dv->valuator1 += values[1];
|
||||
case 1:
|
||||
dv->valuator0 += values[0];
|
||||
}
|
||||
values += 6;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* XINPUT */
|
||||
dev = inputInfo.pointer;
|
||||
if (ev->u.keyButtonPointer.root == None)
|
||||
root = GetCurrentRootWindow();
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
int x, y;
|
||||
GetSpritePosition(&x, &y);
|
||||
ev->u.keyButtonPointer.rootX += x;
|
||||
ev->u.keyButtonPointer.rootY += y;
|
||||
}
|
||||
else if (ev->u.u.detail != xFalse)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
|
||||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
case MotionNotify:
|
||||
/* broken lib, XI events have root uninitialized */
|
||||
if (extension || ev->u.keyButtonPointer.root == None)
|
||||
root = GetCurrentRootWindow(dev);
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension) {
|
||||
ScreenPtr pScreen = root->drawable.pScreen;
|
||||
BoxRec box;
|
||||
int i;
|
||||
int x = ev->u.keyButtonPointer.rootX + panoramiXdataPtr[0].x;
|
||||
int y = ev->u.keyButtonPointer.rootY + panoramiXdataPtr[0].y;
|
||||
if (!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
|
||||
x, y, &box)) {
|
||||
FOR_NSCREENS(i) {
|
||||
if (i == pScreen->myNum) continue;
|
||||
if (POINT_IN_REGION(pScreen,
|
||||
&XineramaScreenRegions[i],
|
||||
x, y, &box)) {
|
||||
root = WindowTable[i];
|
||||
x -= panoramiXdataPtr[i].x;
|
||||
y -= panoramiXdataPtr[i].y;
|
||||
ev->u.keyButtonPointer.rootX = x;
|
||||
ev->u.keyButtonPointer.rootY = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* FIXME: Xinerama! */
|
||||
|
||||
if (ev->u.keyButtonPointer.rootX < 0)
|
||||
ev->u.keyButtonPointer.rootX = 0;
|
||||
else if (ev->u.keyButtonPointer.rootX >= root->drawable.width)
|
||||
ev->u.keyButtonPointer.rootX = root->drawable.width - 1;
|
||||
if (ev->u.keyButtonPointer.rootY < 0)
|
||||
ev->u.keyButtonPointer.rootY = 0;
|
||||
else if (ev->u.keyButtonPointer.rootY >= root->drawable.height)
|
||||
ev->u.keyButtonPointer.rootY = root->drawable.height - 1;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if ((!noPanoramiXExtension
|
||||
&& root->drawable.pScreen->myNum != XineramaGetCursorScreen())
|
||||
|| (noPanoramiXExtension && root != GetCurrentRootWindow()))
|
||||
|
||||
#else
|
||||
if (root != GetCurrentRootWindow())
|
||||
#endif
|
||||
{
|
||||
NewCurrentScreen(root->drawable.pScreen,
|
||||
ev->u.keyButtonPointer.rootX,
|
||||
ev->u.keyButtonPointer.rootY);
|
||||
return client->noClientException;
|
||||
}
|
||||
(*root->drawable.pScreen->SetCursorPosition)
|
||||
(root->drawable.pScreen,
|
||||
ev->u.keyButtonPointer.rootX,
|
||||
ev->u.keyButtonPointer.rootY, FALSE);
|
||||
dev->valuator->lastx = ev->u.keyButtonPointer.rootX;
|
||||
dev->valuator->lasty = ev->u.keyButtonPointer.rootY;
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
#ifdef XINPUT
|
||||
if (!extension)
|
||||
#endif /* XINPUT */
|
||||
dev = inputInfo.pointer;
|
||||
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
if (!extension)
|
||||
{
|
||||
dev = PickPointer(client);
|
||||
if (dev->u.lastSlave)
|
||||
dev = dev->u.lastSlave;
|
||||
}
|
||||
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);
|
||||
ev->u.keyButtonPointer.time = currentTime.milliseconds;
|
||||
(*dev->public.processInputProc)(ev, dev, nev);
|
||||
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||
|
||||
GetEventList(&events);
|
||||
switch(type) {
|
||||
case MotionNotify:
|
||||
nevents = GetPointerEvents(events, dev, type, 0,
|
||||
(ev->u.u.detail == xFalse) ? POINTER_ABSOLUTE : 0,
|
||||
firstValuator, numValuators, valuators);
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
nevents = GetPointerEvents(events, dev, type, ev->u.u.detail,
|
||||
POINTER_ABSOLUTE, firstValuator,
|
||||
numValuators, valuators);
|
||||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
nevents = GetKeyboardEvents(events, dev, type, ev->u.u.detail);
|
||||
break;
|
||||
}
|
||||
|
||||
OsBlockSignals();
|
||||
for (i = 0; i < nevents; i++)
|
||||
mieqEnqueue(dev, events->event);
|
||||
OsReleaseSignals();
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestGrabControl(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestGrabControlReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
||||
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
|
||||
{
|
||||
client->errorValue = stuff->impervious;
|
||||
client->errorValue = stuff->impervious;
|
||||
return(BadValue);
|
||||
}
|
||||
if (stuff->impervious)
|
||||
MakeClientGrabImpervious(client);
|
||||
MakeClientGrabImpervious(client);
|
||||
else
|
||||
MakeClientGrabPervious(client);
|
||||
MakeClientGrabPervious(client);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestDispatch (client)
|
||||
register ClientPtr client;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestGetVersion(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xXTestGetVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -506,9 +467,9 @@ SProcXTestGetVersion(client)
|
|||
|
||||
static int
|
||||
SProcXTestCompareCursor(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xXTestCompareCursorReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -520,49 +481,49 @@ SProcXTestCompareCursor(client)
|
|||
|
||||
static int
|
||||
XTestSwapFakeInput(client, req)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
xReq *req;
|
||||
{
|
||||
register int nev;
|
||||
register xEvent *ev;
|
||||
int nev;
|
||||
xEvent *ev;
|
||||
xEvent sev;
|
||||
EventSwapPtr proc;
|
||||
|
||||
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
|
||||
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) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
(*proc)(ev, &sev);
|
||||
*ev = sev;
|
||||
/* Swap event */
|
||||
proc = EventSwapVector[ev->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
if (!proc || proc == NotImplemented) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
(*proc)(ev, &sev);
|
||||
*ev = sev;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestFakeInput(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
n = XTestSwapFakeInput(client, stuff);
|
||||
if (n != Success)
|
||||
return n;
|
||||
return n;
|
||||
return ProcXTestFakeInput(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestGrabControl(client)
|
||||
register ClientPtr client;
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
REQUEST(xXTestGrabControlReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
|
@ -572,20 +533,20 @@ SProcXTestGrabControl(client)
|
|||
|
||||
static int
|
||||
SProcXTestDispatch (client)
|
||||
register ClientPtr client;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -541,8 +541,8 @@ int reason;
|
|||
event.u.videoNotify.drawable = pDraw->id;
|
||||
event.u.videoNotify.port = pPort->id;
|
||||
event.u.videoNotify.reason = reason;
|
||||
(void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask,
|
||||
NoEventMask, NullGrab);
|
||||
TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
|
||||
NoEventMask, NoEventMask, NullGrab);
|
||||
}
|
||||
pn = pn->next;
|
||||
}
|
||||
|
|
@ -573,8 +573,8 @@ XvdiSendPortNotify(
|
|||
event.u.portNotify.port = pPort->id;
|
||||
event.u.portNotify.attribute = attribute;
|
||||
event.u.portNotify.value = value;
|
||||
(void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask,
|
||||
NoEventMask, NullGrab);
|
||||
TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
|
||||
NoEventMask, NoEventMask, NullGrab);
|
||||
}
|
||||
pn = pn->next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -613,8 +613,8 @@ ProcXvMCGetDRInfo(ClientPtr client)
|
|||
#ifdef HAS_XVMCSHM
|
||||
patternP = (CARD32 *)shmat( stuff->shmKey, NULL, SHM_RDONLY );
|
||||
if ( -1 != (long) patternP) {
|
||||
register volatile CARD32 *patternC = patternP;
|
||||
register int i;
|
||||
volatile CARD32 *patternC = patternP;
|
||||
int i;
|
||||
CARD32 magic = stuff->magic;
|
||||
|
||||
rep.isLocal = 1;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,12 @@ AM_CFLAGS = $(DIX_CFLAGS)
|
|||
libXi_la_SOURCES = \
|
||||
allowev.c \
|
||||
allowev.h \
|
||||
chdevcur.c \
|
||||
chdevcur.h \
|
||||
chgdctl.c \
|
||||
chgdctl.h \
|
||||
chdevhier.c \
|
||||
chdevhier.h \
|
||||
chgfctl.c \
|
||||
chgfctl.h \
|
||||
chgkbd.c \
|
||||
|
|
@ -17,15 +21,21 @@ libXi_la_SOURCES = \
|
|||
chgprop.h \
|
||||
chgptr.c \
|
||||
chgptr.h \
|
||||
chaccess.c \
|
||||
chaccess.h \
|
||||
closedev.c \
|
||||
closedev.h \
|
||||
devbell.c \
|
||||
devbell.h \
|
||||
exevents.c \
|
||||
exglobals.h \
|
||||
extgrbdev.c \
|
||||
extgrbdev.h \
|
||||
extinit.c \
|
||||
getbmap.c \
|
||||
getbmap.h \
|
||||
getcptr.c \
|
||||
getcptr.h \
|
||||
getdctl.c \
|
||||
getdctl.h \
|
||||
getfctl.c \
|
||||
|
|
@ -54,14 +64,20 @@ libXi_la_SOURCES = \
|
|||
listdev.h \
|
||||
opendev.c \
|
||||
opendev.h \
|
||||
querydp.c \
|
||||
querydp.h \
|
||||
queryst.c \
|
||||
queryst.h \
|
||||
qryacces.c \
|
||||
qryacces.h \
|
||||
selectev.c \
|
||||
selectev.h \
|
||||
sendexev.c \
|
||||
sendexev.h \
|
||||
setbmap.c \
|
||||
setbmap.h \
|
||||
setcptr.c \
|
||||
setcptr.h \
|
||||
setdval.c \
|
||||
setdval.h \
|
||||
setfocus.c \
|
||||
|
|
@ -75,6 +91,10 @@ libXi_la_SOURCES = \
|
|||
ungrdevb.c \
|
||||
ungrdevb.h \
|
||||
ungrdevk.c \
|
||||
ungrdevk.h
|
||||
ungrdevk.h \
|
||||
warpdevp.c \
|
||||
warpdevp.h \
|
||||
xiselev.c \
|
||||
xiselev.h
|
||||
|
||||
EXTRA_DIST = stubs.c
|
||||
|
|
|
|||
12
Xi/allowev.c
12
Xi/allowev.c
|
|
@ -106,22 +106,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
|
|||
|
||||
switch (stuff->mode) {
|
||||
case ReplayThisDevice:
|
||||
AllowSome(client, time, thisdev, NOT_GRABBED);
|
||||
AllowSome(client, time, thisdev, NOT_GRABBED, FALSE);
|
||||
break;
|
||||
case SyncThisDevice:
|
||||
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
|
||||
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT, FALSE);
|
||||
break;
|
||||
case AsyncThisDevice:
|
||||
AllowSome(client, time, thisdev, THAWED);
|
||||
AllowSome(client, time, thisdev, THAWED, FALSE);
|
||||
break;
|
||||
case AsyncOtherDevices:
|
||||
AllowSome(client, time, thisdev, THAW_OTHERS);
|
||||
AllowSome(client, time, thisdev, THAW_OTHERS, FALSE);
|
||||
break;
|
||||
case SyncAll:
|
||||
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
|
||||
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT, FALSE);
|
||||
break;
|
||||
case AsyncAll:
|
||||
AllowSome(client, time, thisdev, THAWED_BOTH);
|
||||
AllowSome(client, time, thisdev, THAWED_BOTH, FALSE);
|
||||
break;
|
||||
default:
|
||||
client->errorValue = stuff->mode;
|
||||
|
|
|
|||
158
Xi/chaccess.c
Normal file
158
Xi/chaccess.c
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "chaccess.h"
|
||||
|
||||
/***********************************************************************
|
||||
* This procedure allows a client to change window access control.
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeWindowAccess(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
REQUEST(xChangeWindowAccessReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->win, n);
|
||||
return ProcXChangeWindowAccess(client);
|
||||
}
|
||||
|
||||
int
|
||||
ProcXChangeWindowAccess(ClientPtr client)
|
||||
{
|
||||
int padding, rc, i;
|
||||
XID* deviceids = NULL;
|
||||
WindowPtr win;
|
||||
DeviceIntPtr* perm_devices = NULL;
|
||||
DeviceIntPtr* deny_devices = NULL;
|
||||
REQUEST(xChangeWindowAccessReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeWindowAccessReq);
|
||||
|
||||
|
||||
padding = (4 - (((stuff->npermit + stuff->ndeny) * sizeof(XID)) % 4)) % 4;
|
||||
|
||||
if (stuff->length != ((sizeof(xChangeWindowAccessReq) +
|
||||
(((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2))
|
||||
{
|
||||
return BadLength;
|
||||
}
|
||||
|
||||
|
||||
rc = dixLookupWindow(&win, stuff->win, client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Are we clearing? if so, ignore the rest */
|
||||
if (stuff->clear)
|
||||
{
|
||||
rc = ACClearWindowAccess(client, win, stuff->clear);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (stuff->npermit || stuff->ndeny)
|
||||
deviceids = (XID*)&stuff[1];
|
||||
|
||||
if (stuff->npermit)
|
||||
{
|
||||
perm_devices =
|
||||
(DeviceIntPtr*)xalloc(stuff->npermit * sizeof(DeviceIntPtr));
|
||||
if (!perm_devices)
|
||||
{
|
||||
ErrorF("[Xi] ProcXChangeWindowAccess: alloc failure.\n");
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
/* if one of the devices cannot be accessed, we don't do anything.*/
|
||||
for (i = 0; i < stuff->npermit; i++)
|
||||
{
|
||||
rc = dixLookupDevice(&perm_devices[i], deviceids[i], client,
|
||||
DixWriteAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
xfree(perm_devices);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stuff->ndeny)
|
||||
{
|
||||
deny_devices =
|
||||
(DeviceIntPtr*)xalloc(stuff->ndeny * sizeof(DeviceIntPtr));
|
||||
if (!deny_devices)
|
||||
{
|
||||
ErrorF("[Xi] ProcXChangeWindowAccecss: alloc failure.\n");
|
||||
xfree(perm_devices);
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
for (i = 0; i < stuff->ndeny; i++)
|
||||
{
|
||||
rc = dixLookupDevice(&deny_devices[i],
|
||||
deviceids[i+stuff->npermit],
|
||||
client,
|
||||
DixWriteAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
xfree(perm_devices);
|
||||
xfree(deny_devices);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = ACChangeWindowAccess(client, win, stuff->defaultRule,
|
||||
perm_devices, stuff->npermit,
|
||||
deny_devices, stuff->ndeny);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
xfree(perm_devices);
|
||||
xfree(deny_devices);
|
||||
return Success;
|
||||
}
|
||||
|
||||
36
Xi/chaccess.h
Normal file
36
Xi/chaccess.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef CHACCESS_H
|
||||
#define CHACCESS_H 1
|
||||
|
||||
int SProcXChangeWindowAccess(ClientPtr /* client */);
|
||||
int ProcXChangeWindowAccess(ClientPtr /* client */);
|
||||
|
||||
#endif /* CHACCESS_H */
|
||||
111
Xi/chdevcur.c
Normal file
111
Xi/chdevcur.c
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to change a given device pointer's cursor.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "input.h"
|
||||
|
||||
#include "chdevcur.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to set one pointer's cursor.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeDeviceCursor(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
|
||||
REQUEST(xChangeDeviceCursorReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xChangeDeviceCursorReq);
|
||||
return (ProcXChangeDeviceCursor(client));
|
||||
}
|
||||
|
||||
int ProcXChangeDeviceCursor(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
WindowPtr pWin = NULL;
|
||||
DeviceIntPtr pDev = NULL;
|
||||
CursorPtr pCursor = NULL;
|
||||
|
||||
REQUEST(xChangeDeviceCursorReq);
|
||||
REQUEST_SIZE_MATCH(xChangeDeviceCursorReq);
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (stuff->win != None)
|
||||
{
|
||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (stuff->cursor == None)
|
||||
{
|
||||
if (pWin == WindowTable[pWin->drawable.pScreen->myNum])
|
||||
pCursor = rootCursor;
|
||||
else
|
||||
pCursor = (CursorPtr)None;
|
||||
}
|
||||
else
|
||||
{
|
||||
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
|
||||
RT_CURSOR, DixReadAccess);
|
||||
if (!pCursor)
|
||||
{
|
||||
return BadCursor;
|
||||
}
|
||||
}
|
||||
|
||||
ChangeWindowDeviceCursor(pWin, pDev, pCursor);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
39
Xi/chdevcur.h
Normal file
39
Xi/chdevcur.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef CHDEVCUR_H
|
||||
#define CHDEVCUR_H 1
|
||||
|
||||
int SProcXChangeDeviceCursor(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXChangeDeviceCursor(ClientPtr /* client */
|
||||
);
|
||||
|
||||
#endif /* CHDEVCUR_H */
|
||||
306
Xi/chdevhier.c
Normal file
306
Xi/chdevhier.c
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request change in the device hierarchy.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XInput.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include <X11/extensions/geproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "geext.h"
|
||||
#include "xace.h"
|
||||
|
||||
#include "chdevhier.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to change the device hierarchy through
|
||||
* adding new master devices, removing them, etc.
|
||||
*
|
||||
*/
|
||||
|
||||
int SProcXChangeDeviceHierarchy(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
|
||||
REQUEST(xChangeDeviceHierarchyReq);
|
||||
swaps(&stuff->length, n);
|
||||
return (ProcXChangeDeviceHierarchy(client));
|
||||
}
|
||||
|
||||
#define SWAPIF(cmd) if (client->swapped) { cmd; }
|
||||
|
||||
int
|
||||
ProcXChangeDeviceHierarchy(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr ptr, keybd;
|
||||
DeviceIntRec dummyDev;
|
||||
xAnyHierarchyChangeInfo *any;
|
||||
int required_len = sizeof(xChangeDeviceHierarchyReq);
|
||||
char n;
|
||||
int rc;
|
||||
int nchanges = 0;
|
||||
deviceHierarchyChangedEvent ev;
|
||||
|
||||
REQUEST(xChangeDeviceHierarchyReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceHierarchyReq);
|
||||
|
||||
any = (xAnyHierarchyChangeInfo*)&stuff[1];
|
||||
while(stuff->num_changes--)
|
||||
{
|
||||
SWAPIF(swapl(&any->type, n));
|
||||
SWAPIF(swaps(&any->length, n));
|
||||
|
||||
required_len += any->length;
|
||||
if ((stuff->length * 4) < required_len)
|
||||
return BadLength;
|
||||
|
||||
switch(any->type)
|
||||
{
|
||||
case CH_CreateMasterDevice:
|
||||
{
|
||||
xCreateMasterInfo* c = (xCreateMasterInfo*)any;
|
||||
char* name;
|
||||
|
||||
SWAPIF(swaps(&c->namelen, n));
|
||||
name = xcalloc(c->namelen + 1, sizeof(char));
|
||||
strncpy(name, (char*)&c[1], c->namelen);
|
||||
|
||||
|
||||
rc = AllocMasterDevice(client, name, &ptr, &keybd);
|
||||
if (rc != Success)
|
||||
{
|
||||
xfree(name);
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
if (!c->sendCore)
|
||||
ptr->coreEvents = keybd->coreEvents = FALSE;
|
||||
|
||||
ActivateDevice(ptr);
|
||||
ActivateDevice(keybd);
|
||||
|
||||
if (c->enable)
|
||||
{
|
||||
EnableDevice(ptr);
|
||||
EnableDevice(keybd);
|
||||
}
|
||||
xfree(name);
|
||||
nchanges++;
|
||||
}
|
||||
break;
|
||||
case CH_RemoveMasterDevice:
|
||||
{
|
||||
xRemoveMasterInfo* r = (xRemoveMasterInfo*)any;
|
||||
|
||||
if (r->returnMode != AttachToMaster &&
|
||||
r->returnMode != Floating)
|
||||
return BadValue;
|
||||
|
||||
rc = dixLookupDevice(&ptr, r->deviceid, client,
|
||||
DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (!ptr->isMaster)
|
||||
{
|
||||
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)
|
||||
{
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
/* disable keyboards first */
|
||||
if (IsPointerDevice(ptr))
|
||||
{
|
||||
rc = dixLookupDevice(&keybd,
|
||||
ptr->spriteInfo->paired->id,
|
||||
client,
|
||||
DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
}
|
||||
else
|
||||
{
|
||||
keybd = ptr;
|
||||
rc = dixLookupDevice(&ptr,
|
||||
keybd->spriteInfo->paired->id,
|
||||
client,
|
||||
DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
|
||||
/* Disabling sends the devices floating, reattach them if
|
||||
* desired. */
|
||||
if (r->returnMode == AttachToMaster)
|
||||
{
|
||||
DeviceIntPtr attached,
|
||||
newptr,
|
||||
newkeybd;
|
||||
|
||||
rc = dixLookupDevice(&newptr, r->returnPointer,
|
||||
client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (!newptr->isMaster)
|
||||
{
|
||||
client->errorValue = r->returnPointer;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
rc = dixLookupDevice(&newkeybd, r->returnKeyboard,
|
||||
client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (!newkeybd->isMaster)
|
||||
{
|
||||
client->errorValue = r->returnKeyboard;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
for (attached = inputInfo.devices;
|
||||
attached;
|
||||
attached = attached->next)
|
||||
{
|
||||
if (!attached->isMaster) {
|
||||
if (attached->u.master == ptr)
|
||||
AttachDevice(client, attached, newptr);
|
||||
if (attached->u.master == keybd)
|
||||
AttachDevice(client, attached, newkeybd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* can't disable until we removed pairing */
|
||||
keybd->spriteInfo->paired = NULL;
|
||||
ptr->spriteInfo->paired = NULL;
|
||||
DisableDevice(keybd);
|
||||
DisableDevice(ptr);
|
||||
|
||||
RemoveDevice(keybd);
|
||||
RemoveDevice(ptr);
|
||||
nchanges++;
|
||||
}
|
||||
break;
|
||||
case CH_ChangeAttachment:
|
||||
{
|
||||
xChangeAttachmentInfo* c = (xChangeAttachmentInfo*)any;
|
||||
|
||||
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
||||
DixWriteAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (ptr->isMaster)
|
||||
{
|
||||
client->errorValue = c->deviceid;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
if (c->changeMode == Floating)
|
||||
AttachDevice(client, ptr, NULL);
|
||||
else
|
||||
{
|
||||
DeviceIntPtr newmaster;
|
||||
rc = dixLookupDevice(&newmaster, c->newMaster,
|
||||
client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
if (!newmaster->isMaster)
|
||||
{
|
||||
client->errorValue = c->newMaster;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
if (!((IsPointerDevice(newmaster) &&
|
||||
IsPointerDevice(ptr)) ||
|
||||
(IsKeyboardDevice(newmaster) &&
|
||||
IsKeyboardDevice(ptr))))
|
||||
{
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
AttachDevice(client, ptr, newmaster);
|
||||
}
|
||||
nchanges++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
any = (xAnyHierarchyChangeInfo*)((char*)any + any->length);
|
||||
}
|
||||
|
||||
unwind:
|
||||
|
||||
if (nchanges > 0) /* even if an error occured, we need to send an event if
|
||||
we changed anything in the hierarchy. */
|
||||
{
|
||||
ev.type = GenericEvent;
|
||||
ev.extension = IReqCode;
|
||||
ev.length = 0;
|
||||
ev.evtype = XI_DeviceHierarchyChangedNotify;
|
||||
ev.time = GetTimeInMillis();
|
||||
|
||||
SendEventToAllWindows(&dummyDev, XI_DeviceHierarchyChangedMask,
|
||||
(xEvent*)&ev, 1);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
42
Xi/chdevhier.h
Normal file
42
Xi/chdevhier.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request change in the device hierarchy.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef CHDEVHIER_H
|
||||
#define CHDEVHIER_H 1
|
||||
|
||||
int SProcXChangeDeviceHierarchy(ClientPtr /* client */);
|
||||
int ProcXChangeDeviceHierarchy(ClientPtr /* client */);
|
||||
|
||||
#endif
|
||||
|
|
@ -167,7 +167,7 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
ret = BadMatch;
|
||||
goto out;
|
||||
}
|
||||
if ((dev->grab) && !SameClient(dev->grab, client)) {
|
||||
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) {
|
||||
rep.status = AlreadyGrabbed;
|
||||
ret = Success;
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -150,10 +150,10 @@ ProcXCloseDevice(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (d->grab && SameClient(d->grab, client))
|
||||
(*d->DeactivateGrab) (d); /* release active grab */
|
||||
if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
|
||||
(*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
|
||||
|
||||
/* Remove event selections from all windows for events from this device
|
||||
/* Remove event selections from all windows for events from this device
|
||||
* and selected by this client.
|
||||
* Delete passive grabs from all windows for this device. */
|
||||
|
||||
|
|
|
|||
1100
Xi/exevents.c
1100
Xi/exevents.c
File diff suppressed because it is too large
Load diff
|
|
@ -31,11 +31,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
#include "privates.h"
|
||||
|
||||
#ifndef EXGLOBALS_H
|
||||
#define EXGLOBALS_H 1
|
||||
|
||||
extern int IReqCode;
|
||||
extern int IEventBase;
|
||||
extern int BadDevice;
|
||||
extern int BadMode;
|
||||
extern int DeviceBusy;
|
||||
|
|
@ -50,6 +52,8 @@ extern Mask DeviceOwnerGrabButtonMask;
|
|||
extern Mask DeviceButtonGrabMask;
|
||||
extern Mask DeviceButtonMotionMask;
|
||||
extern Mask DevicePresenceNotifyMask;
|
||||
extern Mask DeviceEnterWindowMask;
|
||||
extern Mask DeviceLeaveWindowMask;
|
||||
extern Mask PropagateMask[];
|
||||
|
||||
extern int DeviceValuator;
|
||||
|
|
@ -68,7 +72,10 @@ extern int DeviceButtonStateNotify;
|
|||
extern int DeviceMappingNotify;
|
||||
extern int ChangeDeviceNotify;
|
||||
extern int DevicePresenceNotify;
|
||||
extern int DeviceEnterNotify;
|
||||
extern int DeviceLeaveNotify;
|
||||
|
||||
extern int RT_INPUTCLIENT;
|
||||
|
||||
extern DevPrivateKey XIClientPrivateKey;
|
||||
#endif /* EXGLOBALS_H */
|
||||
|
|
|
|||
221
Xi/extgrbdev.c
Normal file
221
Xi/extgrbdev.c
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to fake data for a given device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include <X11/extensions/Xge.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "grabdev.h" /* CreateMaskFromList */
|
||||
|
||||
#include "extgrbdev.h"
|
||||
|
||||
int
|
||||
SProcXExtendedGrabDevice(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
int i;
|
||||
long* p;
|
||||
|
||||
REQUEST(xExtendedGrabDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xExtendedGrabDeviceReq);
|
||||
|
||||
swapl(&stuff->grab_window, n);
|
||||
swapl(&stuff->time, n);
|
||||
swapl(&stuff->confine_to, n);
|
||||
swapl(&stuff->cursor, n);
|
||||
swaps(&stuff->event_count, n);
|
||||
swaps(&stuff->generic_event_count, n);
|
||||
|
||||
p = (long *)&stuff[1];
|
||||
for (i = 0; i < stuff->event_count; i++) {
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
|
||||
for (i = 0; i < stuff->generic_event_count; i++) {
|
||||
p++; /* first 4 bytes are extension type and padding */
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
|
||||
return ProcXExtendedGrabDevice(client);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ProcXExtendedGrabDevice(ClientPtr client)
|
||||
{
|
||||
xExtendedGrabDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
int rc = Success,
|
||||
errval = 0,
|
||||
i;
|
||||
WindowPtr grab_window,
|
||||
confineTo = 0;
|
||||
CursorPtr cursor = NULL;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
TimeStamp time;
|
||||
XGenericEventMask* xgeMask;
|
||||
GenericMaskPtr gemasks = NULL;
|
||||
|
||||
REQUEST(xExtendedGrabDeviceReq);
|
||||
REQUEST_AT_LEAST_SIZE(xExtendedGrabDeviceReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_ExtendedGrabDevice;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = 0;
|
||||
|
||||
if (stuff->length != (sizeof(xExtendedGrabDeviceReq) >> 2) +
|
||||
stuff->event_count + 2 * stuff->generic_event_count)
|
||||
{
|
||||
errval = 0;
|
||||
rc = BadLength;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||
if (rc != Success) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = dixLookupWindow(&grab_window,
|
||||
stuff->grab_window,
|
||||
client,
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
errval = stuff->grab_window;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (stuff->confine_to)
|
||||
{
|
||||
rc = dixLookupWindow(&confineTo,
|
||||
stuff->confine_to,
|
||||
client,
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
errval = stuff->confine_to;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (stuff->cursor)
|
||||
{
|
||||
cursor = (CursorPtr)SecurityLookupIDByType(client,
|
||||
stuff->cursor,
|
||||
RT_CURSOR,
|
||||
DixReadAccess);
|
||||
if (!cursor)
|
||||
{
|
||||
errval = stuff->cursor;
|
||||
rc = BadCursor;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (CreateMaskFromList(client,
|
||||
(XEventClass*)&stuff[1],
|
||||
stuff->event_count,
|
||||
tmp,
|
||||
dev,
|
||||
X_GrabDevice) != Success)
|
||||
return Success;
|
||||
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
||||
if (stuff->generic_event_count)
|
||||
{
|
||||
xgeMask =
|
||||
(XGenericEventMask*)(((XEventClass*)&stuff[1]) + stuff->event_count);
|
||||
|
||||
gemasks = xcalloc(1, sizeof(GenericMaskRec));
|
||||
gemasks->client = client;
|
||||
gemasks->next = NULL;
|
||||
gemasks->eventMask[xgeMask->extension & 0x7F] = xgeMask->evmask;
|
||||
|
||||
xgeMask++;
|
||||
for (i = 1; i < stuff->generic_event_count; i++, xgeMask++)
|
||||
gemasks->eventMask[xgeMask->extension & 0x7F]= xgeMask->evmask;
|
||||
}
|
||||
|
||||
ExtGrabDevice(client, dev, stuff->device_mode,
|
||||
grab_window, confineTo, time, stuff->owner_events,
|
||||
cursor, tmp[stuff->deviceid].mask,
|
||||
gemasks);
|
||||
|
||||
if (rc != Success) {
|
||||
errval = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
if (gemasks)
|
||||
xfree(gemasks);
|
||||
|
||||
if (rc == Success)
|
||||
{
|
||||
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
|
||||
}
|
||||
else
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
SRepXExtendedGrabDevice(ClientPtr client, int size,
|
||||
xExtendedGrabDeviceReply* rep)
|
||||
{
|
||||
char n;
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swaps(&rep->length, n);
|
||||
WriteToClient(client, size, (char*)rep);
|
||||
}
|
||||
43
Xi/extgrbdev.h
Normal file
43
Xi/extgrbdev.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef EXTGRBDEV_H
|
||||
#define EXTGRBDEV_H 1
|
||||
|
||||
int SProcXExtendedGrabDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXExtendedGrabDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void SRepXExtendedGrabDevice(ClientPtr client,
|
||||
int size,
|
||||
xExtendedGrabDeviceReply* rep);
|
||||
|
||||
#endif /* EXTGRBDEV_H */
|
||||
511
Xi/extinit.c
511
Xi/extinit.c
|
|
@ -63,6 +63,8 @@ SOFTWARE.
|
|||
#include "extnsionst.h" /* extension entry */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include <X11/extensions/geproto.h>
|
||||
#include "geext.h" /* extension interfaces for ge */
|
||||
|
||||
#include "dixevents.h"
|
||||
#include "exevents.h"
|
||||
|
|
@ -70,18 +72,24 @@ SOFTWARE.
|
|||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
#include "registry.h"
|
||||
#include "privates.h"
|
||||
|
||||
/* modules local to Xi */
|
||||
#include "allowev.h"
|
||||
#include "chaccess.h"
|
||||
#include "chdevcur.h"
|
||||
#include "chgdctl.h"
|
||||
#include "chdevhier.h"
|
||||
#include "chgfctl.h"
|
||||
#include "chgkbd.h"
|
||||
#include "chgprop.h"
|
||||
#include "chgptr.h"
|
||||
#include "closedev.h"
|
||||
#include "extgrbdev.h"
|
||||
#include "devbell.h"
|
||||
#include "getbmap.h"
|
||||
#include "getbmap.h"
|
||||
#include "getcptr.h"
|
||||
#include "getdctl.h"
|
||||
#include "getfctl.h"
|
||||
#include "getfocus.h"
|
||||
|
|
@ -97,11 +105,14 @@ SOFTWARE.
|
|||
#include "gtmotion.h"
|
||||
#include "listdev.h"
|
||||
#include "opendev.h"
|
||||
#include "qryacces.c"
|
||||
#include "querydp.h"
|
||||
#include "queryst.h"
|
||||
#include "selectev.h"
|
||||
#include "sendexev.h"
|
||||
#include "chgkmap.h"
|
||||
#include "setbmap.h"
|
||||
#include "setcptr.h"
|
||||
#include "setdval.h"
|
||||
#include "setfocus.h"
|
||||
#include "setmmap.h"
|
||||
|
|
@ -109,12 +120,25 @@ SOFTWARE.
|
|||
#include "ungrdev.h"
|
||||
#include "ungrdevb.h"
|
||||
#include "ungrdevk.h"
|
||||
#include "warpdevp.h"
|
||||
#include "xiselev.h"
|
||||
|
||||
|
||||
static Mask lastExtEventMask = 1;
|
||||
int ExtEventIndex;
|
||||
Mask ExtValidMasks[EMASKSIZE];
|
||||
Mask ExtExclusiveMasks[EMASKSIZE];
|
||||
|
||||
|
||||
/**
|
||||
* Filters for various generic events.
|
||||
* Evtype is index, mask is value at index.
|
||||
*/
|
||||
static Mask xi_filters[4] = {
|
||||
XI_DeviceHierarchyChangedMask,
|
||||
XI_DeviceClassesChangedMask,
|
||||
};
|
||||
|
||||
static struct dev_type
|
||||
{
|
||||
Atom type;
|
||||
|
|
@ -143,6 +167,109 @@ static struct dev_type
|
|||
CARD8 event_base[numInputClasses];
|
||||
XExtEventInfo EventInfo[32];
|
||||
|
||||
/**
|
||||
* 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 */
|
||||
ProcXQueryDevicePointer, /* 36 */
|
||||
ProcXWarpDevicePointer, /* 37 */
|
||||
ProcXChangeDeviceCursor, /* 38 */
|
||||
ProcXChangeDeviceHierarchy, /* 39 */
|
||||
ProcXChangeWindowAccess, /* 40 */
|
||||
ProcXQueryWindowAccess, /* 41 */
|
||||
ProcXSetClientPointer, /* 42 */
|
||||
ProcXGetClientPointer, /* 43 */
|
||||
ProcXiSelectEvent, /* 44 */
|
||||
ProcXExtendedGrabDevice /* 45 */
|
||||
};
|
||||
|
||||
/* 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 */
|
||||
SProcXQueryDevicePointer, /* 36 */
|
||||
SProcXWarpDevicePointer, /* 37 */
|
||||
SProcXChangeDeviceCursor, /* 38 */
|
||||
SProcXChangeDeviceHierarchy, /* 39 */
|
||||
SProcXChangeWindowAccess, /* 40 */
|
||||
SProcXQueryWindowAccess, /* 41 */
|
||||
SProcXSetClientPointer, /* 42 */
|
||||
SProcXGetClientPointer, /* 43 */
|
||||
SProcXiSelectEvent, /* 44 */
|
||||
SProcXExtendedGrabDevice /* 45 */
|
||||
};
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Globals referenced elsewhere in the server.
|
||||
|
|
@ -150,6 +277,7 @@ XExtEventInfo EventInfo[32];
|
|||
*/
|
||||
|
||||
int IReqCode = 0;
|
||||
int IEventBase = 0;
|
||||
int BadDevice = 0;
|
||||
static int BadEvent = 1;
|
||||
int BadMode = 2;
|
||||
|
|
@ -166,6 +294,8 @@ Mask DeviceOwnerGrabButtonMask;
|
|||
Mask DeviceButtonGrabMask;
|
||||
Mask DeviceButtonMotionMask;
|
||||
Mask DevicePresenceNotifyMask;
|
||||
Mask DeviceEnterWindowMask;
|
||||
Mask DeviceLeaveWindowMask;
|
||||
|
||||
int DeviceValuator;
|
||||
int DeviceKeyPress;
|
||||
|
|
@ -183,6 +313,8 @@ int DeviceButtonStateNotify;
|
|||
int DeviceMappingNotify;
|
||||
int ChangeDeviceNotify;
|
||||
int DevicePresenceNotify;
|
||||
int DeviceEnterNotify;
|
||||
int DeviceLeaveNotify;
|
||||
|
||||
int RT_INPUTCLIENT;
|
||||
|
||||
|
|
@ -194,18 +326,42 @@ int RT_INPUTCLIENT;
|
|||
|
||||
extern XExtensionVersion AllExtensionVersions[];
|
||||
|
||||
|
||||
Mask PropagateMask[MAX_DEVICES];
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Versioning support
|
||||
*
|
||||
*/
|
||||
|
||||
DevPrivateKey XIClientPrivateKey = &XIClientPrivateKey;
|
||||
|
||||
static XExtensionVersion thisversion = { XI_Present,
|
||||
XI_2_Major,
|
||||
XI_2_Minor
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Declarations of local routines.
|
||||
*
|
||||
*/
|
||||
|
||||
static XExtensionVersion thisversion = { XI_Present,
|
||||
XI_Add_DevicePresenceNotify_Major,
|
||||
XI_Add_DevicePresenceNotify_Minor
|
||||
};
|
||||
static void
|
||||
XIClientCallback(CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
XIClientPtr pXIClient;
|
||||
|
||||
pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
|
||||
pXIClient->major_version = 0;
|
||||
pXIClient->minor_version = 0;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
|
|
@ -218,83 +374,15 @@ static int
|
|||
ProcIDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data == X_GetExtensionVersion)
|
||||
return (ProcXGetExtensionVersion(client));
|
||||
if (stuff->data == X_ListInputDevices)
|
||||
return (ProcXListInputDevices(client));
|
||||
else if (stuff->data == X_OpenDevice)
|
||||
return (ProcXOpenDevice(client));
|
||||
else if (stuff->data == X_CloseDevice)
|
||||
return (ProcXCloseDevice(client));
|
||||
else if (stuff->data == X_SetDeviceMode)
|
||||
return (ProcXSetDeviceMode(client));
|
||||
else if (stuff->data == X_SelectExtensionEvent)
|
||||
return (ProcXSelectExtensionEvent(client));
|
||||
else if (stuff->data == X_GetSelectedExtensionEvents)
|
||||
return (ProcXGetSelectedExtensionEvents(client));
|
||||
else if (stuff->data == X_ChangeDeviceDontPropagateList)
|
||||
return (ProcXChangeDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceDontPropagateList)
|
||||
return (ProcXGetDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceMotionEvents)
|
||||
return (ProcXGetDeviceMotionEvents(client));
|
||||
else if (stuff->data == X_ChangeKeyboardDevice)
|
||||
return (ProcXChangeKeyboardDevice(client));
|
||||
else if (stuff->data == X_ChangePointerDevice)
|
||||
return (ProcXChangePointerDevice(client));
|
||||
else if (stuff->data == X_GrabDevice)
|
||||
return (ProcXGrabDevice(client));
|
||||
else if (stuff->data == X_UngrabDevice)
|
||||
return (ProcXUngrabDevice(client));
|
||||
else if (stuff->data == X_GrabDeviceKey)
|
||||
return (ProcXGrabDeviceKey(client));
|
||||
else if (stuff->data == X_UngrabDeviceKey)
|
||||
return (ProcXUngrabDeviceKey(client));
|
||||
else if (stuff->data == X_GrabDeviceButton)
|
||||
return (ProcXGrabDeviceButton(client));
|
||||
else if (stuff->data == X_UngrabDeviceButton)
|
||||
return (ProcXUngrabDeviceButton(client));
|
||||
else if (stuff->data == X_AllowDeviceEvents)
|
||||
return (ProcXAllowDeviceEvents(client));
|
||||
else if (stuff->data == X_GetDeviceFocus)
|
||||
return (ProcXGetDeviceFocus(client));
|
||||
else if (stuff->data == X_SetDeviceFocus)
|
||||
return (ProcXSetDeviceFocus(client));
|
||||
else if (stuff->data == X_GetFeedbackControl)
|
||||
return (ProcXGetFeedbackControl(client));
|
||||
else if (stuff->data == X_ChangeFeedbackControl)
|
||||
return (ProcXChangeFeedbackControl(client));
|
||||
else if (stuff->data == X_GetDeviceKeyMapping)
|
||||
return (ProcXGetDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_ChangeDeviceKeyMapping)
|
||||
return (ProcXChangeDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_GetDeviceModifierMapping)
|
||||
return (ProcXGetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_SetDeviceModifierMapping)
|
||||
return (ProcXSetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_GetDeviceButtonMapping)
|
||||
return (ProcXGetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_SetDeviceButtonMapping)
|
||||
return (ProcXSetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_QueryDeviceState)
|
||||
return (ProcXQueryDeviceState(client));
|
||||
else if (stuff->data == X_SendExtensionEvent)
|
||||
return (ProcXSendExtensionEvent(client));
|
||||
else if (stuff->data == X_DeviceBell)
|
||||
return (ProcXDeviceBell(client));
|
||||
else if (stuff->data == X_SetDeviceValuators)
|
||||
return (ProcXSetDeviceValuators(client));
|
||||
else if (stuff->data == X_GetDeviceControl)
|
||||
return (ProcXGetDeviceControl(client));
|
||||
else if (stuff->data == X_ChangeDeviceControl)
|
||||
return (ProcXChangeDeviceControl(client));
|
||||
if (stuff->data > IREQUESTS || !ProcIVector[stuff->data])
|
||||
return BadRequest;
|
||||
|
||||
return (BadRequest);
|
||||
return (*ProcIVector[stuff->data])(client);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SProcXDispatch
|
||||
* SProcXDispatch
|
||||
*
|
||||
* Main swapped dispatch routine for requests to this extension.
|
||||
* This routine is used if server and client do not have the same byte ordering.
|
||||
|
|
@ -305,78 +393,10 @@ static int
|
|||
SProcIDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data == X_GetExtensionVersion)
|
||||
return (SProcXGetExtensionVersion(client));
|
||||
if (stuff->data == X_ListInputDevices)
|
||||
return (SProcXListInputDevices(client));
|
||||
else if (stuff->data == X_OpenDevice)
|
||||
return (SProcXOpenDevice(client));
|
||||
else if (stuff->data == X_CloseDevice)
|
||||
return (SProcXCloseDevice(client));
|
||||
else if (stuff->data == X_SetDeviceMode)
|
||||
return (SProcXSetDeviceMode(client));
|
||||
else if (stuff->data == X_SelectExtensionEvent)
|
||||
return (SProcXSelectExtensionEvent(client));
|
||||
else if (stuff->data == X_GetSelectedExtensionEvents)
|
||||
return (SProcXGetSelectedExtensionEvents(client));
|
||||
else if (stuff->data == X_ChangeDeviceDontPropagateList)
|
||||
return (SProcXChangeDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceDontPropagateList)
|
||||
return (SProcXGetDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceMotionEvents)
|
||||
return (SProcXGetDeviceMotionEvents(client));
|
||||
else if (stuff->data == X_ChangeKeyboardDevice)
|
||||
return (SProcXChangeKeyboardDevice(client));
|
||||
else if (stuff->data == X_ChangePointerDevice)
|
||||
return (SProcXChangePointerDevice(client));
|
||||
else if (stuff->data == X_GrabDevice)
|
||||
return (SProcXGrabDevice(client));
|
||||
else if (stuff->data == X_UngrabDevice)
|
||||
return (SProcXUngrabDevice(client));
|
||||
else if (stuff->data == X_GrabDeviceKey)
|
||||
return (SProcXGrabDeviceKey(client));
|
||||
else if (stuff->data == X_UngrabDeviceKey)
|
||||
return (SProcXUngrabDeviceKey(client));
|
||||
else if (stuff->data == X_GrabDeviceButton)
|
||||
return (SProcXGrabDeviceButton(client));
|
||||
else if (stuff->data == X_UngrabDeviceButton)
|
||||
return (SProcXUngrabDeviceButton(client));
|
||||
else if (stuff->data == X_AllowDeviceEvents)
|
||||
return (SProcXAllowDeviceEvents(client));
|
||||
else if (stuff->data == X_GetDeviceFocus)
|
||||
return (SProcXGetDeviceFocus(client));
|
||||
else if (stuff->data == X_SetDeviceFocus)
|
||||
return (SProcXSetDeviceFocus(client));
|
||||
else if (stuff->data == X_GetFeedbackControl)
|
||||
return (SProcXGetFeedbackControl(client));
|
||||
else if (stuff->data == X_ChangeFeedbackControl)
|
||||
return (SProcXChangeFeedbackControl(client));
|
||||
else if (stuff->data == X_GetDeviceKeyMapping)
|
||||
return (SProcXGetDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_ChangeDeviceKeyMapping)
|
||||
return (SProcXChangeDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_GetDeviceModifierMapping)
|
||||
return (SProcXGetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_SetDeviceModifierMapping)
|
||||
return (SProcXSetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_GetDeviceButtonMapping)
|
||||
return (SProcXGetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_SetDeviceButtonMapping)
|
||||
return (SProcXSetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_QueryDeviceState)
|
||||
return (SProcXQueryDeviceState(client));
|
||||
else if (stuff->data == X_SendExtensionEvent)
|
||||
return (SProcXSendExtensionEvent(client));
|
||||
else if (stuff->data == X_DeviceBell)
|
||||
return (SProcXDeviceBell(client));
|
||||
else if (stuff->data == X_SetDeviceValuators)
|
||||
return (SProcXSetDeviceValuators(client));
|
||||
else if (stuff->data == X_GetDeviceControl)
|
||||
return (SProcXGetDeviceControl(client));
|
||||
else if (stuff->data == X_ChangeDeviceControl)
|
||||
return (SProcXChangeDeviceControl(client));
|
||||
if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
|
||||
return BadRequest;
|
||||
|
||||
return (BadRequest);
|
||||
return (*SProcIVector[stuff->data])(client);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
@ -386,11 +406,6 @@ SProcIDispatch(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
/* FIXME: this would be more concise and readable in ANSI C */
|
||||
#define DISPATCH(code) \
|
||||
if (rep->RepType == X_##code) \
|
||||
SRepX##code (client, len, (x##code##Reply *) rep)
|
||||
|
||||
static void
|
||||
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
||||
/* All we look at is the type field */
|
||||
|
|
@ -445,6 +460,16 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
|||
else if (rep->RepType == X_ChangeDeviceControl)
|
||||
SRepXChangeDeviceControl(client, len,
|
||||
(xChangeDeviceControlReply *) rep);
|
||||
else if (rep->RepType == X_QueryDevicePointer)
|
||||
SRepXQueryDevicePointer(client, len,
|
||||
(xQueryDevicePointerReply *) rep);
|
||||
else if (rep->RepType == X_QueryWindowAccess)
|
||||
SRepXQueryWindowAccess(client, len,
|
||||
(xQueryWindowAccessReply*) rep);
|
||||
else if (rep->RepType == X_GetClientPointer)
|
||||
SRepXGetClientPointer(client, len, (xGetClientPointerReply*) rep);
|
||||
else if (rep->RepType == X_ExtendedGrabDevice)
|
||||
SRepXExtendedGrabDevice(client, len, (xExtendedGrabDeviceReply*) rep);
|
||||
else {
|
||||
FatalError("XINPUT confused sending swapped reply");
|
||||
}
|
||||
|
|
@ -550,6 +575,80 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to
|
|||
swaps(&to->control, n);
|
||||
}
|
||||
|
||||
static void
|
||||
SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to)
|
||||
{
|
||||
char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swapl(&to->time, n);
|
||||
}
|
||||
|
||||
static void
|
||||
SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to)
|
||||
{
|
||||
char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swapl(&to->time, n);
|
||||
swapl(&to->root, n);
|
||||
swapl(&to->event, n);
|
||||
swapl(&to->child, n);
|
||||
swaps(&to->rootX, n);
|
||||
swaps(&to->rootY, n);
|
||||
swaps(&to->eventX, n);
|
||||
swaps(&to->eventY, n);
|
||||
}
|
||||
|
||||
static void
|
||||
SDeviceClassesChangedEvent(deviceClassesChangedEvent* from,
|
||||
deviceClassesChangedEvent* to)
|
||||
{
|
||||
char n;
|
||||
int i, j;
|
||||
xAnyClassPtr any;
|
||||
|
||||
*to = *from;
|
||||
memcpy(&to[1], &from[1], from->length * 4);
|
||||
|
||||
swaps(&to->sequenceNumber, n);
|
||||
swapl(&to->length, n);
|
||||
swapl(&to->time, n);
|
||||
|
||||
/* now swap the actual classes */
|
||||
any = (xAnyClassPtr)&to[1];
|
||||
for (i = 0; i < to->num_classes; i++)
|
||||
{
|
||||
switch(any->class)
|
||||
{
|
||||
case KeyClass:
|
||||
swaps(&((xKeyInfoPtr)any)->num_keys, n);
|
||||
break;
|
||||
case ButtonClass:
|
||||
swaps(&((xButtonInfoPtr)any)->num_buttons, n);
|
||||
break;
|
||||
case ValuatorClass:
|
||||
{
|
||||
xValuatorInfoPtr v = (xValuatorInfoPtr)any;
|
||||
xAxisInfoPtr a = (xAxisInfoPtr)&v[1];
|
||||
|
||||
swapl(&v->motion_buffer_size, n);
|
||||
for (j = 0; j < v->num_axes; j++)
|
||||
{
|
||||
swapl(&a->min_value, n);
|
||||
swapl(&a->max_value, n);
|
||||
swapl(&a->resolution, n);
|
||||
a++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
any = (xAnyClassPtr)((char*)any + any->length);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to have its propagation suppressed.
|
||||
|
|
@ -596,7 +695,7 @@ GetNextExtEventMask(void)
|
|||
*
|
||||
* Since extension event types will never be less than 64, we can use
|
||||
* 0-63 in the EventInfo array as the "type" to be used to look up this
|
||||
* mask. This means that the corresponding macros such as
|
||||
* mask. This means that the corresponding macros such as
|
||||
* DevicePointerMotionHint must have access to the same constants.
|
||||
*
|
||||
*/
|
||||
|
|
@ -634,13 +733,16 @@ SetExclusiveAccess(Mask mask)
|
|||
static void
|
||||
SetMaskForExtEvent(Mask mask, int event)
|
||||
{
|
||||
int i;
|
||||
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = event;
|
||||
|
||||
if ((event < LASTEvent) || (event >= 128))
|
||||
FatalError("MaskForExtensionEvent: bogus event number");
|
||||
SetMaskForEvent(mask, event);
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
SetMaskForEvent(i, mask, event);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
|
@ -670,6 +772,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
DeviceKeyStateNotify = ChangeDeviceNotify + 1;
|
||||
DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
|
||||
DevicePresenceNotify = DeviceButtonStateNotify + 1;
|
||||
DeviceEnterNotify = DevicePresenceNotify + 1;
|
||||
DeviceLeaveNotify = DeviceEnterNotify + 1;
|
||||
|
||||
event_base[KeyClass] = DeviceKeyPress;
|
||||
event_base[ButtonClass] = DeviceButtonPress;
|
||||
|
|
@ -721,8 +825,20 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
SetEventInfo(GetNextExtEventMask(), _deviceButton3Motion);
|
||||
SetEventInfo(GetNextExtEventMask(), _deviceButton4Motion);
|
||||
SetEventInfo(GetNextExtEventMask(), _deviceButton5Motion);
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
DeviceButtonMotionMask = GetNextExtEventMask();
|
||||
SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
|
||||
if (DeviceButtonMotionMask != ButtonMotionMask)
|
||||
{
|
||||
/* This should never happen, but if it does, hide under the
|
||||
* bed and cry for help. */
|
||||
ErrorF("[Xi] DeviceButtonMotionMask != ButtonMotionMask. Trouble!\n");
|
||||
}
|
||||
|
||||
DeviceFocusChangeMask = GetNextExtEventMask();
|
||||
SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
|
||||
|
|
@ -745,12 +861,21 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
|
||||
DevicePresenceNotifyMask = GetNextExtEventMask();
|
||||
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
|
||||
|
||||
DeviceEnterWindowMask = GetNextExtEventMask();
|
||||
SetMaskForExtEvent(DeviceEnterWindowMask, DeviceEnterNotify);
|
||||
AllowPropagateSuppress(DeviceEnterWindowMask);
|
||||
|
||||
DeviceLeaveWindowMask = GetNextExtEventMask();
|
||||
SetMaskForExtEvent(DeviceLeaveWindowMask, DeviceLeaveNotify);
|
||||
AllowPropagateSuppress(DeviceLeaveWindowMask);
|
||||
|
||||
SetEventInfo(0, _noExtensionEvent);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* This function restores extension event types and masks to their
|
||||
* This function restores extension event types and masks to their
|
||||
* initial state.
|
||||
*
|
||||
*/
|
||||
|
|
@ -758,13 +883,17 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
static void
|
||||
RestoreExtensionEvents(void)
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
IReqCode = 0;
|
||||
IEventBase = 0;
|
||||
|
||||
for (i = 0; i < ExtEventIndex - 1; i++) {
|
||||
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
|
||||
SetMaskForEvent(0, EventInfo[i].type);
|
||||
{
|
||||
for (j = 0; j < MAX_DEVICES; j++)
|
||||
SetMaskForEvent(j, 0, EventInfo[i].type);
|
||||
}
|
||||
EventInfo[i].mask = 0;
|
||||
EventInfo[i].type = 0;
|
||||
}
|
||||
|
|
@ -786,6 +915,8 @@ RestoreExtensionEvents(void)
|
|||
DeviceKeyStateNotify = 13;
|
||||
DeviceButtonStateNotify = 13;
|
||||
DevicePresenceNotify = 14;
|
||||
DeviceEnterNotify = 15;
|
||||
DeviceLeaveNotify = 16;
|
||||
|
||||
BadDevice = 0;
|
||||
BadEvent = 1;
|
||||
|
|
@ -824,9 +955,27 @@ IResetProc(ExtensionEntry * unused)
|
|||
EventSwapVector[DeviceMappingNotify] = NotImplemented;
|
||||
EventSwapVector[ChangeDeviceNotify] = NotImplemented;
|
||||
EventSwapVector[DevicePresenceNotify] = NotImplemented;
|
||||
EventSwapVector[DeviceEnterNotify] = NotImplemented;
|
||||
EventSwapVector[DeviceLeaveNotify] = NotImplemented;
|
||||
RestoreExtensionEvents();
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Returns TRUE if the device has some sort of pointer type.
|
||||
*
|
||||
*/
|
||||
|
||||
Bool
|
||||
DeviceIsPointerType(DeviceIntPtr dev)
|
||||
{
|
||||
if (dev_type[1].type == dev->type)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Assign an id and type to an input device.
|
||||
|
|
@ -909,11 +1058,45 @@ SEventIDispatch(xEvent * from, xEvent * to)
|
|||
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
|
||||
else if (type == DevicePresenceNotify)
|
||||
DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
|
||||
else if (type == DeviceEnterNotify)
|
||||
DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify);
|
||||
else if (type == DeviceLeaveNotify)
|
||||
DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify);
|
||||
else {
|
||||
FatalError("XInputExtension: Impossible event!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* EventSwap for generic events coming from the GE extension.
|
||||
*/
|
||||
|
||||
static void
|
||||
XIGEEventSwap(xGenericEvent* from, xGenericEvent* to)
|
||||
{
|
||||
int n;
|
||||
|
||||
swaps(&from->sequenceNumber, n);
|
||||
switch(from->evtype)
|
||||
{
|
||||
case XI_DeviceClassesChangedNotify:
|
||||
SDeviceClassesChangedEvent((deviceClassesChangedEvent*)from,
|
||||
(deviceClassesChangedEvent*)to);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EventFill to fill various fields for events before they are delivered to
|
||||
* the client.
|
||||
*/
|
||||
static void
|
||||
XIGEEventFill(xGenericEvent* ev, DeviceIntPtr pDev,
|
||||
WindowPtr pWin, GrabPtr grab)
|
||||
{
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* IExtensionInit - initialize the input extension.
|
||||
|
|
@ -923,6 +1106,7 @@ SEventIDispatch(xEvent * from, xEvent * to)
|
|||
*
|
||||
* This extension has several events and errors.
|
||||
*
|
||||
* XI is mandatory nowadays, so if we fail to init XI, we die.
|
||||
*/
|
||||
|
||||
void
|
||||
|
|
@ -930,10 +1114,17 @@ XInputExtensionInit(void)
|
|||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
if (!dixRequestPrivate(XIClientPrivateKey, 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);
|
||||
if (extEntry) {
|
||||
IReqCode = extEntry->base;
|
||||
IEventBase = extEntry->eventBase;
|
||||
AllExtensionVersions[IReqCode - 128] = thisversion;
|
||||
MakeDeviceTypeAtoms();
|
||||
RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
|
||||
|
|
@ -956,6 +1147,12 @@ XInputExtensionInit(void)
|
|||
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
||||
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
||||
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceEnterNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceLeaveNotify] = SEventIDispatch;
|
||||
|
||||
/* init GE events */
|
||||
GERegisterExtension(IReqCode, XIGEEventSwap, XIGEEventFill);
|
||||
SetGenericFilter(IReqCode, xi_filters);
|
||||
} else {
|
||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
|
|
|
|||
108
Xi/getcptr.c
Normal file
108
Xi/getcptr.c
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "getcptr.h"
|
||||
|
||||
/***********************************************************************
|
||||
* This procedure allows a client to query another client's client pointer
|
||||
* setting.
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetClientPointer(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
REQUEST(xGetClientPointerReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->win, n);
|
||||
return ProcXGetClientPointer(client);
|
||||
}
|
||||
|
||||
int ProcXGetClientPointer(ClientPtr client)
|
||||
{
|
||||
int err;
|
||||
WindowPtr win;
|
||||
ClientPtr winclient;
|
||||
xGetClientPointerReply rep;
|
||||
REQUEST(xGetClientPointerReq);
|
||||
REQUEST_SIZE_MATCH(xGetClientPointerReq);
|
||||
|
||||
err = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
|
||||
if (err != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetClientPointer,
|
||||
stuff->win, err);
|
||||
return Success;
|
||||
}
|
||||
|
||||
winclient = wClient(win);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetClientPointer;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.set = (winclient->clientPtr != NULL);
|
||||
rep.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetClientPointerReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetClientPointer function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXGetClientPointer(ClientPtr client, int size,
|
||||
xGetClientPointerReply* rep)
|
||||
{
|
||||
char n;
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
||||
43
Xi/getcptr.h
Normal file
43
Xi/getcptr.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef GETCPTR_H
|
||||
#define GETCPTR_H 1
|
||||
int SProcXGetClientPointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetClientPointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void SRepXGetClientPointer(ClientPtr /* client */,
|
||||
int /* size */,
|
||||
xGetClientPointerReply* /* rep */
|
||||
);
|
||||
|
||||
#endif /* GETCPTR_H */
|
||||
29
Xi/getvers.c
29
Xi/getvers.c
|
|
@ -59,6 +59,7 @@ SOFTWARE.
|
|||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "getvers.h"
|
||||
|
|
@ -85,7 +86,7 @@ SProcXGetExtensionVersion(ClientPtr client)
|
|||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
* This procedure returns the major/minor version of the X Input extension.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -93,6 +94,7 @@ int
|
|||
ProcXGetExtensionVersion(ClientPtr client)
|
||||
{
|
||||
xGetExtensionVersionReply rep;
|
||||
XIClientPtr pXIClient;
|
||||
|
||||
REQUEST(xGetExtensionVersionReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
|
|
@ -101,18 +103,29 @@ ProcXGetExtensionVersion(ClientPtr client)
|
|||
stuff->nbytes + 3) >> 2)
|
||||
return BadLength;
|
||||
|
||||
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
|
||||
/* GetExtensionVersionReq before XI 2 didn't supply the client's
|
||||
* major/minor. So we don't actually have a clue what they support.
|
||||
* {major|minor}Version was added as part of XI, so if they are set, we
|
||||
* know we can trust it. In this case the client must set nbytes to 0
|
||||
* though, otherwise we have to assume that the version are padding
|
||||
* garbage.
|
||||
*/
|
||||
if (!stuff->nbytes) /* Client using XQueryInputVersion(). */
|
||||
{
|
||||
pXIClient->major_version = stuff->majorVersion;
|
||||
pXIClient->minor_version = stuff->minorVersion;
|
||||
} /* else version unknown, leave it at 0.0 */
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetExtensionVersion;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.major_version = 0;
|
||||
rep.minor_version = 0;
|
||||
|
||||
rep.present = TRUE;
|
||||
if (rep.present) {
|
||||
rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
|
||||
rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
|
||||
}
|
||||
rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
|
||||
rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
|
||||
|
||||
return Success;
|
||||
|
|
|
|||
22
Xi/grabdev.c
22
Xi/grabdev.c
|
|
@ -131,7 +131,7 @@ ProcXGrabDevice(ClientPtr client)
|
|||
rc = GrabDevice(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->grabWindow,
|
||||
stuff->ownerEvents, stuff->time,
|
||||
tmp[stuff->deviceid].mask, &rep.status);
|
||||
tmp[stuff->deviceid].mask, &rep.status, FALSE);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
|
@ -144,6 +144,24 @@ ProcXGrabDevice(ClientPtr client)
|
|||
*
|
||||
* This procedure creates an event mask from a list of XEventClasses.
|
||||
*
|
||||
* Procedure is as follows:
|
||||
* An XEventClass is (deviceid << 8 | eventtype). For each entry in the list,
|
||||
* get the device. Then run through all available event indices (those are
|
||||
* set when XI starts up) and binary OR's the device's mask to whatever the
|
||||
* event mask for the given event type was.
|
||||
* If an error occurs, it is sent to the client. Errors are generated if
|
||||
* - if the device given in the event classs is invalid
|
||||
* - if the device in the class list is not the device given as parameter (no
|
||||
* error if parameter is NULL)
|
||||
*
|
||||
* mask has to be size EMASKSIZE and pre-allocated.
|
||||
*
|
||||
* @param client The client to send the error to (if one occurs)
|
||||
* @param list List of event classes as sent from the client.
|
||||
* @param count Number of elements in list.
|
||||
* @param mask Preallocated mask (size EMASKSIZE).
|
||||
* @param dev The device we're creating masks for.
|
||||
* @param req The request we're processing. Used to fill in error fields.
|
||||
*/
|
||||
|
||||
int
|
||||
|
|
@ -161,7 +179,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
|
|||
|
||||
for (i = 0; i < count; i++, list++) {
|
||||
device = *list >> 8;
|
||||
if (device > 255)
|
||||
if (device > 255) /* FIXME: we only use 7 bit for devices? */
|
||||
return BadClass;
|
||||
|
||||
rc = dixLookupDevice(&tdev, device, client, DixReadAccess);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else {
|
||||
mdev = inputInfo.keyboard;
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else {
|
||||
mdev = inputInfo.keyboard;
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
rep.nEvents = 0;
|
||||
rep.axes = axes;
|
||||
rep.mode = v->mode & DeviceMode;
|
||||
rep.mode = Absolute; /* XXX we don't do relative at the moment */
|
||||
rep.length = 0;
|
||||
start = ClientTimeToServerTime(stuff->start);
|
||||
stop = ClientTimeToServerTime(stuff->stop);
|
||||
|
|
@ -132,14 +132,10 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
|||
stop = currentTime;
|
||||
num_events = v->numMotionEvents;
|
||||
if (num_events) {
|
||||
size = sizeof(Time) + (axes * sizeof(INT32));
|
||||
tsize = num_events * size;
|
||||
coords = (INT32 *) xalloc(tsize);
|
||||
if (!coords)
|
||||
return BadAlloc;
|
||||
rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
|
||||
start.milliseconds, stop.milliseconds,
|
||||
(ScreenPtr) NULL);
|
||||
size = sizeof(Time) + (axes * sizeof(INT32));
|
||||
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords,/* XXX */
|
||||
start.milliseconds, stop.milliseconds,
|
||||
(ScreenPtr) NULL, FALSE);
|
||||
}
|
||||
if (rep.nEvents > 0) {
|
||||
length = (rep.nEvents * size + 3) >> 2;
|
||||
|
|
|
|||
114
Xi/listdev.c
114
Xi/listdev.c
|
|
@ -64,11 +64,11 @@ SOFTWARE.
|
|||
#include "XIstubs.h"
|
||||
#include "extnsionst.h"
|
||||
#include "exglobals.h" /* FIXME */
|
||||
#include "exevents.h"
|
||||
#include "xace.h"
|
||||
|
||||
#include "listdev.h"
|
||||
|
||||
#define VPC 20 /* Max # valuators per chunk */
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
|
|
@ -93,7 +93,7 @@ SProcXListInputDevices(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
void
|
||||
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
||||
{
|
||||
int chunks;
|
||||
|
|
@ -153,7 +153,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
|
|||
b2->class = ButtonClass;
|
||||
b2->length = sizeof(xButtonInfo);
|
||||
b2->num_buttons = b->numButtons;
|
||||
if (client->swapped) {
|
||||
if (client && client->swapped) {
|
||||
swaps(&b2->num_buttons, n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof(xButtonInfo);
|
||||
|
|
@ -177,9 +177,9 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
|
|||
dev->id = d->id;
|
||||
dev->type = d->type;
|
||||
dev->num_classes = num_classes;
|
||||
if (d == inputInfo.keyboard)
|
||||
if (d->isMaster && IsKeyboardDevice(d))
|
||||
dev->use = IsXKeyboard;
|
||||
else if (d == inputInfo.pointer)
|
||||
else if (d->isMaster && IsPointerDevice(d))
|
||||
dev->use = IsXPointer;
|
||||
else if (d->key && d->kbdfeed)
|
||||
dev->use = IsXExtensionKeyboard;
|
||||
|
|
@ -187,6 +187,11 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
|
|||
dev->use = IsXExtensionPointer;
|
||||
else
|
||||
dev->use = IsXExtensionDevice;
|
||||
if (!d->isMaster)
|
||||
dev->attached = (d->u.master) ? d->u.master->id : IsFloating;
|
||||
else
|
||||
dev->attached = GetPairedDevice(d)->id;
|
||||
|
||||
if (client->swapped) {
|
||||
swapl(&dev->type, n); /* macro - braces are required */
|
||||
}
|
||||
|
|
@ -211,7 +216,7 @@ CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
|
|||
k2->min_keycode = k->curKeySyms.minKeyCode;
|
||||
k2->max_keycode = k->curKeySyms.maxKeyCode;
|
||||
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
||||
if (client->swapped) {
|
||||
if (client && client->swapped) {
|
||||
swaps(&k2->num_keys, n);
|
||||
}
|
||||
*buf += sizeof(xKeyInfo);
|
||||
|
|
@ -223,7 +228,7 @@ CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
|
|||
*
|
||||
* Devices may have up to 255 valuators. The length of a ValuatorClass is
|
||||
* defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
|
||||
* The maximum length is therefore (8 + 255 * 12) = 3068. However, the
|
||||
* The maximum length is therefore (8 + 255 * 12) = 3068. However, the
|
||||
* length field is one byte. If a device has more than 20 valuators, we
|
||||
* must therefore return multiple valuator classes to the client.
|
||||
*
|
||||
|
|
@ -249,7 +254,7 @@ CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf)
|
|||
v2->num_axes = t_axes;
|
||||
v2->mode = v->mode & DeviceMode;
|
||||
v2->motion_buffer_size = v->numMotionEvents;
|
||||
if (client->swapped) {
|
||||
if (client && client->swapped) {
|
||||
swapl(&v2->motion_buffer_size, n);
|
||||
}
|
||||
*buf += sizeof(xValuatorInfo);
|
||||
|
|
@ -259,7 +264,7 @@ CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf)
|
|||
a2->min_value = a->min_value;
|
||||
a2->max_value = a->max_value;
|
||||
a2->resolution = a->resolution;
|
||||
if (client->swapped) {
|
||||
if (client && client->swapped) {
|
||||
swapl(&a2->min_value, n);
|
||||
swapl(&a2->max_value, n);
|
||||
swapl(&a2->resolution, n);
|
||||
|
|
@ -284,17 +289,24 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
|
|||
{
|
||||
CopyDeviceName(namebuf, d->name);
|
||||
CopySwapDevice(client, d, 0, devbuf);
|
||||
if (d->key != NULL) {
|
||||
CopySwapKeyClass(client, d->key, classbuf);
|
||||
dev->num_classes++;
|
||||
CopySwapClasses(client, d, &dev->num_classes, classbuf);
|
||||
}
|
||||
|
||||
void
|
||||
CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
|
||||
char** classbuf)
|
||||
{
|
||||
if (dev->key != NULL) {
|
||||
CopySwapKeyClass(client, dev->key, classbuf);
|
||||
(*num_classes)++;
|
||||
}
|
||||
if (d->button != NULL) {
|
||||
CopySwapButtonClass(client, d->button, classbuf);
|
||||
dev->num_classes++;
|
||||
if (dev->button != NULL) {
|
||||
CopySwapButtonClass(client, dev->button, classbuf);
|
||||
(*num_classes)++;
|
||||
}
|
||||
if (d->valuator != NULL) {
|
||||
dev->num_classes +=
|
||||
CopySwapValuatorClass(client, d->valuator, classbuf);
|
||||
if (dev->valuator != NULL) {
|
||||
(*num_classes) +=
|
||||
CopySwapValuatorClass(client, dev->valuator, classbuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,12 +314,17 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
|
|||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
* If this request is called by a client that has not issued a
|
||||
* GetExtensionVersion request with major/minor version set, we don't send the
|
||||
* complete device list. Instead, we only send the VCP, the VCK and floating
|
||||
* SDs. This resembles the setup found on XI 1.x machines.
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXListInputDevices(ClientPtr client)
|
||||
{
|
||||
xListInputDevicesReply rep;
|
||||
XIClientPtr pXIClient;
|
||||
int numdevs = 0;
|
||||
int namesize = 1; /* need 1 extra byte for strcpy */
|
||||
int rc, size = 0;
|
||||
|
|
@ -326,20 +343,38 @@ ProcXListInputDevices(ClientPtr client)
|
|||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
|
||||
AddOtherInputDevices();
|
||||
|
||||
for (d = inputInfo.devices; d; d = d->next) {
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
SizeDeviceInfo(d, &namesize, &size);
|
||||
if (pXIClient->major_version < XI_2_Major)
|
||||
{
|
||||
if (d->isMaster &&
|
||||
d != inputInfo.pointer &&
|
||||
d != inputInfo.keyboard)
|
||||
continue; /* don't send master devices other than VCP/VCK */
|
||||
|
||||
if (!d->isMaster && d->u.master)
|
||||
continue; /* don't send attached SDs */
|
||||
}
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
SizeDeviceInfo(d, &namesize, &size);
|
||||
numdevs++;
|
||||
}
|
||||
|
||||
for (d = inputInfo.off_devices; d; d = d->next) {
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
SizeDeviceInfo(d, &namesize, &size);
|
||||
if (pXIClient->major_version < XI_2_Major &&
|
||||
!d->isMaster &&
|
||||
d->u.master) /* XXX can off_devices be attached? */
|
||||
continue; /* don't send attached SDs */
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
SizeDeviceInfo(d, &namesize, &size);
|
||||
numdevs++;
|
||||
}
|
||||
|
||||
|
|
@ -350,11 +385,30 @@ ProcXListInputDevices(ClientPtr client)
|
|||
savbuf = devbuf;
|
||||
|
||||
dev = (xDeviceInfoPtr) devbuf;
|
||||
for (d = inputInfo.devices; d; d = d->next, dev++)
|
||||
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
|
||||
for (d = inputInfo.off_devices; d; d = d->next, dev++)
|
||||
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
|
||||
for (d = inputInfo.devices; d; d = d->next)
|
||||
{
|
||||
if (pXIClient->major_version < XI_2_Major)
|
||||
{
|
||||
if (d->isMaster &&
|
||||
d != inputInfo.pointer &&
|
||||
d != inputInfo.keyboard)
|
||||
continue; /* don't count master devices other than VCP/VCK */
|
||||
|
||||
if (!d->isMaster && d->u.master)
|
||||
continue; /* don't count attached SDs */
|
||||
}
|
||||
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
|
||||
}
|
||||
|
||||
for (d = inputInfo.off_devices; d; d = d->next)
|
||||
{
|
||||
if (pXIClient->major_version < XI_2_Major &&
|
||||
!d->isMaster &&
|
||||
d->u.master) /* XXX can off_devices be attached? */
|
||||
continue; /* don't send attached SDs */
|
||||
|
||||
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
|
||||
}
|
||||
rep.ndevices = numdevs;
|
||||
rep.length = (total_length + 3) >> 2;
|
||||
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
|
||||
|
|
|
|||
13
Xi/listdev.h
13
Xi/listdev.h
|
|
@ -30,6 +30,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef LISTDEV_H
|
||||
#define LISTDEV_H 1
|
||||
|
||||
#define VPC 20 /* Max # valuators per chunk */
|
||||
|
||||
int SProcXListInputDevices(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
@ -41,4 +43,15 @@ void SRepXListInputDevices(ClientPtr /* client */ ,
|
|||
xListInputDevicesReply * /* rep */
|
||||
);
|
||||
|
||||
void
|
||||
CopySwapClasses(ClientPtr /* client */,
|
||||
DeviceIntPtr /* dev */,
|
||||
CARD8* /* num_classes */,
|
||||
char** /* classbuf */);
|
||||
|
||||
void
|
||||
SizeDeviceInfo(DeviceIntPtr /* dev */,
|
||||
int* /* namesize */,
|
||||
int* /* size */);
|
||||
|
||||
#endif /* LISTDEV_H */
|
||||
|
|
|
|||
16
Xi/opendev.c
16
Xi/opendev.c
|
|
@ -62,6 +62,7 @@ SOFTWARE.
|
|||
#include "XIstubs.h"
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "exglobals.h"
|
||||
#include "exevents.h"
|
||||
|
||||
#include "opendev.h"
|
||||
|
||||
|
|
@ -98,15 +99,13 @@ ProcXOpenDevice(ClientPtr client)
|
|||
int status = Success;
|
||||
xOpenDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
XIClientPtr pXIClient;
|
||||
|
||||
REQUEST(xOpenDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xOpenDeviceReq);
|
||||
|
||||
if (stuff->deviceid == inputInfo.pointer->id ||
|
||||
stuff->deviceid == inputInfo.keyboard->id)
|
||||
return BadDevice;
|
||||
|
||||
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)
|
||||
|
|
@ -116,6 +115,15 @@ ProcXOpenDevice(ClientPtr client)
|
|||
} else if (status != Success)
|
||||
return status;
|
||||
|
||||
/* Don't let XI 1.x clients open devices other than floating SDs. */
|
||||
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
if (pXIClient->major_version < XI_2_Major)
|
||||
{
|
||||
if (dev->isMaster || (!dev->isMaster && dev->u.master))
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
|
||||
OpenInputDevice(dev, client, &status);
|
||||
if (status != Success)
|
||||
return status;
|
||||
|
|
|
|||
121
Xi/qryacces.c
Normal file
121
Xi/qryacces.c
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "qryacces.h"
|
||||
|
||||
/***********************************************************************
|
||||
* This procedure allows a client to query window access control.
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXQueryWindowAccess(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
REQUEST(xQueryWindowAccessReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->win, n);
|
||||
return ProcXQueryWindowAccess(client);
|
||||
}
|
||||
|
||||
int
|
||||
ProcXQueryWindowAccess(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
WindowPtr win;
|
||||
DeviceIntPtr *perm, *deny;
|
||||
int nperm, ndeny, i;
|
||||
int defaultRule;
|
||||
XID* deviceids;
|
||||
xQueryWindowAccessReply rep;
|
||||
|
||||
REQUEST(xQueryWindowAccessReq);
|
||||
REQUEST_SIZE_MATCH(xQueryWindowAccessReq);
|
||||
|
||||
rc = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
ACQueryWindowAccess(win, &defaultRule, &perm, &nperm, &deny, &ndeny);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_QueryWindowAccess;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = ((nperm + ndeny) * sizeof(XID) + 3) >> 2;
|
||||
rep.defaultRule = defaultRule;
|
||||
rep.npermit = nperm;
|
||||
rep.ndeny = ndeny;
|
||||
WriteReplyToClient(client, sizeof(xQueryWindowAccessReply), &rep);
|
||||
|
||||
if (nperm + ndeny)
|
||||
{
|
||||
deviceids = (XID*)xalloc((nperm + ndeny) * sizeof(XID));
|
||||
if (!deviceids)
|
||||
{
|
||||
ErrorF("[Xi] ProcXQueryWindowAccess: xalloc failure.\n");
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
for (i = 0; i < nperm; i++)
|
||||
deviceids[i] = perm[i]->id;
|
||||
for (i = 0; i < ndeny; i++)
|
||||
deviceids[i + nperm] = deny[i]->id;
|
||||
|
||||
WriteToClient(client, (nperm + ndeny) * sizeof(XID), (char*)deviceids);
|
||||
xfree(deviceids);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
SRepXQueryWindowAccess(ClientPtr client,
|
||||
int size,
|
||||
xQueryWindowAccessReply* rep)
|
||||
{
|
||||
char n;
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char*)rep);
|
||||
}
|
||||
38
Xi/qryacces.h
Normal file
38
Xi/qryacces.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef QRYACCES_H
|
||||
#define QRYACCES_H 1
|
||||
|
||||
int SProcXQueryWindowAccess(ClientPtr /* client */);
|
||||
int ProcXQueryWindowAccess(ClientPtr /* client */);
|
||||
void SRepXQueryWindowAccess(ClientPtr /* client */,
|
||||
int /* size */,
|
||||
xQueryWindowAccessReply* /* rep */);
|
||||
#endif
|
||||
166
Xi/querydp.c
Normal file
166
Xi/querydp.c
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to query the pointer location of an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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 <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiXsrv.h"
|
||||
#endif
|
||||
|
||||
#include "querydp.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to query the pointer of a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXQueryDevicePointer(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
|
||||
REQUEST(xQueryDevicePointerReq);
|
||||
swaps(&stuff->length, n);
|
||||
return (ProcXQueryDevicePointer(client));
|
||||
}
|
||||
|
||||
int
|
||||
ProcXQueryDevicePointer(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
xQueryDevicePointerReply rep;
|
||||
DeviceIntPtr pDev;
|
||||
WindowPtr pWin, t;
|
||||
SpritePtr pSprite;
|
||||
|
||||
REQUEST(xQueryDevicePointerReq);
|
||||
REQUEST_SIZE_MATCH(xQueryDevicePointerReq);
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (pDev->valuator == NULL)
|
||||
{
|
||||
client->errorValue = stuff->deviceid;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_QueryDevicePointer,
|
||||
stuff->win, rc);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (pDev->valuator->motionHintWindow)
|
||||
MaybeStopHint(pDev, client);
|
||||
|
||||
pSprite = pDev->spriteInfo->sprite;
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_QueryDevicePointer;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.mask = pDev->button->state | inputInfo.keyboard->key->state;
|
||||
rep.root = (GetCurrentRootWindow(pDev))->drawable.id;
|
||||
rep.rootX = pSprite->hot.x;
|
||||
rep.rootY = pSprite->hot.y;
|
||||
rep.child = None;
|
||||
rep.deviceid = pDev->id;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if(!noPanoramiXExtension) {
|
||||
rep.rootX += panoramiXdataPtr[0].x;
|
||||
rep.rootY += panoramiXdataPtr[0].y;
|
||||
if (stuff->win == rep.root)
|
||||
{
|
||||
rep.winX += panoramiXdataPtr[0].x;
|
||||
rep.winY += panoramiXdataPtr[0].y;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
WriteReplyToClient(client, sizeof(xQueryDevicePointerReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XQueryDevicePointer function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXQueryDevicePointer(ClientPtr client, int size,
|
||||
xQueryDevicePointerReply * rep)
|
||||
{
|
||||
char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
||||
44
Xi/querydp.h
Normal file
44
Xi/querydp.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef QUERYDP_H
|
||||
#define QUERYDP_H 1
|
||||
|
||||
int SProcXQueryDevicePointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXQueryDevicePointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void SRepXQueryDevicePointer(ClientPtr /* client */ ,
|
||||
int /* size */ ,
|
||||
xQueryDevicePointerReply * /* rep */
|
||||
);
|
||||
|
||||
#endif /* QUERYDP_H */
|
||||
|
|
@ -112,7 +112,7 @@ SProcXSendExtensionEvent(ClientPtr client)
|
|||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Send an event to some client, as if it had come from an extension input
|
||||
* Send an event to some client, as if it had come from an extension input
|
||||
* device.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
103
Xi/setcptr.c
Normal file
103
Xi/setcptr.c
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to set the client pointer for the owner of the given window.
|
||||
* All subsequent calls that are ambiguous will choose the client pointer as
|
||||
* default value.
|
||||
*/
|
||||
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "setcptr.h"
|
||||
|
||||
int
|
||||
SProcXSetClientPointer(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
|
||||
REQUEST(xSetClientPointerReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xSetClientPointerReq);
|
||||
return (ProcXSetClientPointer(client));
|
||||
}
|
||||
|
||||
int
|
||||
ProcXSetClientPointer(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr pDev;
|
||||
ClientPtr targetClient;
|
||||
int rc;
|
||||
|
||||
REQUEST(xSetClientPointerReq);
|
||||
REQUEST_SIZE_MATCH(xSetClientPointerReq);
|
||||
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (!IsPointerDevice(pDev) || !pDev->isMaster)
|
||||
{
|
||||
client->errorValue = stuff->deviceid;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
if (stuff->win != None)
|
||||
{
|
||||
rc = dixLookupClient(&targetClient, stuff->win, client,
|
||||
DixWriteAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
} else
|
||||
targetClient = client;
|
||||
|
||||
if (!SetClientPointer(targetClient, client, pDev))
|
||||
{
|
||||
client->errorValue = stuff->win;
|
||||
return BadAccess;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
36
Xi/setcptr.h
Normal file
36
Xi/setcptr.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef SETCPTR_H
|
||||
#define SETCPTR_H 1
|
||||
|
||||
int SProcXSetClientPointer(ClientPtr /* client */);
|
||||
int ProcXSetClientPointer(ClientPtr /* client */);
|
||||
|
||||
#endif /* SETCPTR_H */
|
||||
|
|
@ -115,7 +115,7 @@ ProcXSetDeviceValuators(ClientPtr client)
|
|||
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
|
||||
return BadValue;
|
||||
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else
|
||||
rep.status = SetDeviceValuators(client, dev, (int *)&stuff[1],
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ ProcXSetDeviceMode(ClientPtr client)
|
|||
return rc;
|
||||
if (dev->valuator == NULL)
|
||||
return BadMatch;
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else
|
||||
rep.status = SetDeviceMode(client, dev, stuff->mode);
|
||||
|
|
|
|||
10
Xi/stubs.c
10
Xi/stubs.c
|
|
@ -89,7 +89,7 @@ CloseInputDevice(DeviceIntPtr d, ClientPtr client)
|
|||
*
|
||||
* Caller: ProcXListInputDevices
|
||||
*
|
||||
* This is the implementation-dependent routine to initialize an input
|
||||
* This is the implementation-dependent routine to initialize an input
|
||||
* device to the point that information about it can be listed.
|
||||
* Some implementations open all input devices when the server is first
|
||||
* initialized, and never close them. Other implementations open only
|
||||
|
|
@ -101,12 +101,12 @@ CloseInputDevice(DeviceIntPtr d, ClientPtr client)
|
|||
* This procedure should be used by implementations that do not initialize
|
||||
* all input devices at server startup. It should do device-dependent
|
||||
* initialization for any devices not previously initialized, and call
|
||||
* AddInputDevice for each of those devices so that a DeviceIntRec will be
|
||||
* AddInputDevice for each of those devices so that a DeviceIntRec will be
|
||||
* created for them.
|
||||
*
|
||||
* The default implementation is to do nothing (assume all input devices
|
||||
* are initialized during X server initialization and kept open).
|
||||
* The commented-out sample code shows what you might do if you don't want
|
||||
* The commented-out sample code shows what you might do if you don't want
|
||||
* the default.
|
||||
*
|
||||
*/
|
||||
|
|
@ -115,7 +115,7 @@ void
|
|||
AddOtherInputDevices(void)
|
||||
{
|
||||
/**********************************************************************
|
||||
for each uninitialized device, do something like:
|
||||
for each uninitialized device, do something like:
|
||||
|
||||
DeviceIntPtr dev;
|
||||
DeviceProc deviceProc;
|
||||
|
|
@ -138,7 +138,7 @@ AddOtherInputDevices(void)
|
|||
* initialized, and never close them. Other implementations open only
|
||||
* the X pointer and keyboard devices during server initialization,
|
||||
* and only open other input devices when some client makes an
|
||||
* XOpenDevice request. This entry point is for the latter type of
|
||||
* XOpenDevice request. This entry point is for the latter type of
|
||||
* implementation.
|
||||
*
|
||||
* If the physical device is not already open, do it here. In this case,
|
||||
|
|
|
|||
|
|
@ -101,12 +101,12 @@ ProcXUngrabDevice(ClientPtr client)
|
|||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
grab = dev->grab;
|
||||
grab = dev->deviceGrab.grab;
|
||||
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
if ((CompareTimeStamps(time, currentTime) != LATER) &&
|
||||
(CompareTimeStamps(time, dev->grabTime) != EARLIER) &&
|
||||
(grab) && SameClient(grab, client))
|
||||
(*dev->DeactivateGrab) (dev);
|
||||
(CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
|
||||
(grab) && SameClient(grab, client) && !grab->coreGrab)
|
||||
(*dev->deviceGrab.DeactivateGrab) (dev);
|
||||
return Success;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ ProcXUngrabDeviceButton(ClientPtr client)
|
|||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
mdev = inputInfo.keyboard;
|
||||
mdev = PickKeyboard(client);
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ ProcXUngrabDeviceKey(ClientPtr client)
|
|||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
mdev = inputInfo.keyboard;
|
||||
mdev = PickKeyboard(client);
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
|
|
|
|||
177
Xi/warpdevp.c
Normal file
177
Xi/warpdevp.c
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to Warp the pointer location of an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#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/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "mipointer.h" /* for miPointerUpdateSprite */
|
||||
|
||||
|
||||
#include "warpdevp.h"
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to warp the pointer of a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXWarpDevicePointer(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
|
||||
REQUEST(xWarpDevicePointerReq);
|
||||
swaps(&stuff->length, n);
|
||||
return (ProcXWarpDevicePointer(client));
|
||||
}
|
||||
|
||||
int
|
||||
ProcXWarpDevicePointer(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
int x, y;
|
||||
WindowPtr dest = NULL;
|
||||
DeviceIntPtr pDev;
|
||||
SpritePtr pSprite;
|
||||
ScreenPtr newScreen;
|
||||
|
||||
REQUEST(xWarpDevicePointerReq);
|
||||
REQUEST_SIZE_MATCH(xWarpDevicePointerReq);
|
||||
|
||||
/* FIXME: panoramix stuff is missing, look at ProcWarpPointer */
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (stuff->dst_win != None)
|
||||
{
|
||||
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
pSprite = pDev->spriteInfo->sprite;
|
||||
x = pSprite->hotPhys.x;
|
||||
y = pSprite->hotPhys.y;
|
||||
|
||||
if (stuff->src_win != None)
|
||||
{
|
||||
int winX, winY;
|
||||
WindowPtr src;
|
||||
|
||||
rc = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
winX = src->drawable.x;
|
||||
winY = src->drawable.y;
|
||||
if (src->drawable.pScreen != pSprite->hotPhys.pScreen ||
|
||||
x < winX + stuff->src_x ||
|
||||
y < winY + stuff->src_y ||
|
||||
(stuff->src_width != 0 &&
|
||||
winX + stuff->src_x + (int)stuff->src_width < 0) ||
|
||||
(stuff->src_height != 0 &&
|
||||
winY + stuff->src_y + (int)stuff->src_height < y) ||
|
||||
!PointInWindowIsVisible(src, 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->dst_x;
|
||||
y += stuff->dst_y;
|
||||
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
else if (x > newScreen->width)
|
||||
x = newScreen->width - 1;
|
||||
|
||||
if (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 defined(SHAPE)
|
||||
if (pSprite->hotShape)
|
||||
ConfineToShape(pDev, pSprite->hotShape, &x, &y);
|
||||
#endif
|
||||
(*newScreen->SetCursorPosition)(pDev, newScreen, x, y, TRUE);
|
||||
} else if (!PointerConfinedToScreen(pDev))
|
||||
{
|
||||
NewCurrentScreen(pDev, newScreen, x, y);
|
||||
}
|
||||
|
||||
/* if we don't update the device, we get a jump next time it moves */
|
||||
pDev->last.valuators[0] = x;
|
||||
pDev->last.valuators[1] = x;
|
||||
miPointerUpdateSprite(pDev);
|
||||
|
||||
/* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it
|
||||
here though. */
|
||||
return Success;
|
||||
}
|
||||
|
||||
39
Xi/warpdevp.h
Normal file
39
Xi/warpdevp.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef WARPDEVP_H
|
||||
#define WARPDEVP_H 1
|
||||
|
||||
int SProcXWarpDevicePointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXWarpDevicePointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
#endif /* WARPDEVP_H */
|
||||
81
Xi/xiselev.c
Normal file
81
Xi/xiselev.c
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dixstruct.h"
|
||||
#include "windowstr.h"
|
||||
|
||||
#include "exglobals.h"
|
||||
#include "xiselev.h"
|
||||
#include "geext.h"
|
||||
|
||||
int
|
||||
SProcXiSelectEvent(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
|
||||
REQUEST(xXiSelectEventReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXiSelectEventReq);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->mask, n);
|
||||
return (ProcXiSelectEvent(client));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ProcXiSelectEvent(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
WindowPtr pWin;
|
||||
DeviceIntPtr pDev;
|
||||
REQUEST(xXiSelectEventReq);
|
||||
REQUEST_SIZE_MATCH(xXiSelectEventReq);
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (stuff->deviceid & (0x1 << 7)) /* all devices */
|
||||
pDev = NULL;
|
||||
else {
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
||||
GEWindowSetMask(client, pDev, pWin, IReqCode, stuff->mask);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
40
Xi/xiselev.h
Normal file
40
Xi/xiselev.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* 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, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef XISELEV_H
|
||||
#define XISELEV_H 1
|
||||
|
||||
int SProcXiSelectEvent(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXiSelectEvent(ClientPtr /* client */
|
||||
);
|
||||
|
||||
#endif /* XISELEV_H */
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
noinst_LTLIBRARIES = libafb.la
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
libafb_gen_sources = afbbltC.c afbbltX.c afbbltCI.c afbbltO.c afbbltG.c afbtileC.c afbtileG.c afbseg.c
|
||||
|
||||
DISTCLEANFILES = $(libafb_gen_sources)
|
||||
|
||||
libafb_la_SOURCES = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpixmap.c \
|
||||
afbimage.c afbline.c afbbres.c afbhrzvert.c afbbresd.c afbpushpxl.c afbply1rct.c \
|
||||
afbzerarc.c afbfillarc.c afbfillsp.c afbsetsp.c afbscrinit.c afbplygblt.c \
|
||||
afbclip.c afbgetsp.c afbpolypnt.c afbbitblt.c afbcmap.c afbimggblt.c afbpntarea.c \
|
||||
afbmisc.c afbtegblt.c $(libafb_gen_sources)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/mfb -I$(top_srcdir)/hw/xfree86/os-support
|
||||
|
||||
EXTRA_DIST = afbline.c afbblt.c afbtile.c README Xdaniver.doc
|
||||
|
||||
afbseg.c:
|
||||
echo "#define POLYSEGMENT" > $@
|
||||
echo "#include \"$(srcdir)/afbline.c\"" >> $@
|
||||
|
||||
afbbltC.c:
|
||||
echo "#define MROP Mcopy" > $@
|
||||
echo "#include \"$(srcdir)/afbblt.c\"" >> $@
|
||||
|
||||
afbbltX.c:
|
||||
echo "#define MROP Mxor" > $@
|
||||
echo "#include \"$(srcdir)/afbblt.c\"" >> $@
|
||||
|
||||
afbbltCI.c:
|
||||
echo "#define MROP McopyInverted" > $@
|
||||
echo "#include \"$(srcdir)/afbblt.c\"" >> $@
|
||||
|
||||
afbbltO.c:
|
||||
echo "#define MROP Mor" > $@
|
||||
echo "#include \"$(srcdir)/afbblt.c\"" >> $@
|
||||
|
||||
afbbltG.c:
|
||||
echo "#define MROP 0" > $@
|
||||
echo "#include \"$(srcdir)/afbblt.c\"" >> $@
|
||||
|
||||
afbtileC.c:
|
||||
echo "#define MROP Mcopy" > $@
|
||||
echo "#include \"$(srcdir)/afbtile.c\"" >> $@
|
||||
|
||||
afbtileG.c:
|
||||
echo "#define MROP 0" > $@
|
||||
echo "#include \"$(srcdir)/afbtile.c\"" >> $@
|
||||
|
||||
sdk_HEADERS = afb.h
|
||||
10
afb/README
10
afb/README
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
All stuff in this directory is based on Xdaniver (read Xdaniver.doc).
|
||||
|
||||
Actually this is the same code as in the ilbm directory, except that here the
|
||||
conversion from normal bitplanes to interleaved bitplanes didn't happen.
|
||||
|
||||
--
|
||||
Geert Uytterhoeven Geert.Uytterhoeven@cs.kuleuven.ac.be
|
||||
Wavelets, Linux/m68k on Amiga http://www.cs.kuleuven.ac.be/~geert/
|
||||
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium
|
||||
218
afb/Xdaniver.doc
218
afb/Xdaniver.doc
|
|
@ -1,218 +0,0 @@
|
|||
|
||||
What is it?
|
||||
-----------
|
||||
|
||||
Xdaniver is a fast, colour X11R6 server for the Amiga's custom chip set
|
||||
under NetBSD 1.0 and NetBSD-current, supporting all the Amiga's display
|
||||
depths from 1 to 4 (upto 16 colours) on ECS machines and 1 to 8 (upto 256
|
||||
colours) on AGA machines (though, not all resolutions are available, see
|
||||
General Information below).
|
||||
|
||||
Xdaniver is designed to be a drop-in replacement for the Xmono server provided
|
||||
with the X11R6 binary distribution supplied by Bernd Ernesti available from
|
||||
ftp.uni-regensburg.de or one of its mirrors.
|
||||
|
||||
Unlike previous colour X servers for the Amiga that emulate a chunky pixel
|
||||
screen in fast RAM, use the standard frame buffer drivers provided with the
|
||||
X11R6 source code to draw and then use a chunky to planar conversion routine
|
||||
to write the results to the screen (all very slow), Xdaniver uses a heavily
|
||||
modified mono frame buffer driver to draw directly using the Amiga's planar
|
||||
format. The net result is much faster drawing and support for all the Amiga's
|
||||
custom display depths but, as usual, the fewer planes used, the faster the
|
||||
drawing operations of the X server. Even so, on my A1200 with a 33Mhz 68030,
|
||||
I'm getting reasonable performance when using 8 bit planes in Dbl NTSC mode.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
You will need to have first obtained and installed the X11R6 binary
|
||||
distribution available from ftp.uni-regensburg.de in
|
||||
/pub/NetBSD-Amiga/contrib/X11 or one of its mirrors. Xdaniver has been
|
||||
compiled to expect font and configuration files sitting under
|
||||
/usr/local/X11R6, if your setup is different you will need to provide a
|
||||
symbolic link from /usr/local/X11R6 to where your tree resides or supply
|
||||
several command line flags to the server.
|
||||
|
||||
To get Xdaniver running as the default X server, copy the uncompressed binary
|
||||
into /usr/local/X11R6/bin, remove the current X file from that directory
|
||||
(which is a symbolic link to Xmono) and replace it with a link to Xdaniver:
|
||||
|
||||
gzip -d < X11R6.Xdaniver.1.01.tar.gz | tar xvf -
|
||||
mv Xdaniver /usr/local/X11R6/bin
|
||||
cd /usr/local/X11R6/bin
|
||||
rm X
|
||||
ln -s Xdaniver X
|
||||
|
||||
Note that on some setups, the devices /dev/kbd, /dev/mouse and /dev/view??
|
||||
have been created to be accessable only by superuser; Xdaniver needs to open
|
||||
these devices. To workaround this problem, log on as superuser and then
|
||||
either make Xdaniver setuid root:
|
||||
|
||||
chown root Xdaniver
|
||||
chmod 4755 Xdaniver
|
||||
|
||||
or give everyone access the devices:
|
||||
|
||||
chmod 666 /dev/kbd /dev/mouse /dev/view??
|
||||
|
||||
the latter option is a possible cause of a security hole if your machine is
|
||||
ever used multi-user.
|
||||
|
||||
General Information
|
||||
-------------------
|
||||
|
||||
The default resolution of the server is 700x430 and the default depth 4. AGA
|
||||
users might what to increase the display depth by editing the startx script
|
||||
and providing a -depth <depth> argument to Xdaniver on the xinit line of the
|
||||
script. As always, the lower the depth, the faster the drawing and window
|
||||
manipulation of the server.
|
||||
|
||||
The resolution can be altered similarly by suppling -width <width> and
|
||||
-height <height> arguments to the server.
|
||||
|
||||
The NetBSD kernel selects actual screen modes by picking a mode who's
|
||||
natural, non-overscanned size best-fits the requested resolution.
|
||||
Unfortunately, for AGA users, the 1.0 kernel only has support for the
|
||||
Dbl-NTSC AGA display mode and only this mode has support for depths greater
|
||||
than 4. The NetBSD-current (work-in-progress) kernel also has support for
|
||||
Dbl-PAL but still no support for the Super72 or other super-hires modes
|
||||
(perhaps some kind, kernel-hacker could add support for them ?).
|
||||
|
||||
If you have a 2 button mouse (like me) you might want to try and use the 3
|
||||
button mouse emulation. On other systems, it is usual for the left and right
|
||||
buttons to be provided and emulate the middle button by pressing both
|
||||
buttons together, however, the middle button is tends to be used more than
|
||||
the right button so I have provided two options:
|
||||
|
||||
-emulateright (or -3), the two physical mouse buttons act as left and middle
|
||||
and pressing them both together emulates the right button.
|
||||
|
||||
-emulatemiddle (or -2), the two physical mouse buttons act as left and right
|
||||
and pressing them both together emulated the middle button.
|
||||
|
||||
When using screen depths of less than 6 (4 is the maximum for ECS machines)
|
||||
the lack of possible colours on screen at once causes problems for many X
|
||||
applications. Specifying -cc 2 as a command line argument to Xdaniver
|
||||
causes the server to switch the default visual type from PsuedoColor to
|
||||
StaticColor; to put it simply, the server prefills the colormap with a
|
||||
selection of 16 colours (depth 4) and when an application asks for a
|
||||
particular colour, its gets allocated one that is closest to one from the
|
||||
selection of 16. This removes the 'WARNING: Cannot allocate colormap entry
|
||||
for "XXX"' errors but at the expense of applications not being able to get
|
||||
the precise colour they wanted. Also, some badly written X applications fail
|
||||
altogether when presented with a StaticColor visual.
|
||||
|
||||
Bugs/Limitations
|
||||
----------------
|
||||
|
||||
The limited choice of display resolutions for AGA/ECS machines is a real
|
||||
pain - requires a kernel change to fix. Worse still, the kernel specifies
|
||||
the maximum overscan resolution on the Dbl-NTSC to be 724x482 but selecting
|
||||
anything more than 702x430 on my machine causes the screen either sheer
|
||||
diagonally (as if the bytes per row calculation in Xdaniver or the kernel is
|
||||
wrong) or completely loose sync (suggesting a custom chip register sync
|
||||
calculation bug). As other, non-aga modes aren't affected when selection
|
||||
overscan both problems seem to point to a kernel driver bug. Also, depths
|
||||
greater than 4 for AGA users are only supported by the kernel in the Dbl-NTSC
|
||||
mode (and Dbl-PAL with the current-NetBSD kernel).
|
||||
|
||||
I know of one bug so-far (there will be more), The PutImage request of an XY
|
||||
format image expects the bitplane order to be the reverse of that specified
|
||||
in the X protocol but since virtually all applications use the Z (chunky)
|
||||
format, you are unlikely to come across this problem.
|
||||
|
||||
The PutImage request of Z format images is a little slow - when I have time
|
||||
I'll try and add one of the fast assembly chunky-to-planar routines developed
|
||||
for doom style games/demos. Unfortunately, the current crop all require a
|
||||
picture size that is a multiple of 32 pixels and so cannot be used out-of-the-
|
||||
box.
|
||||
|
||||
Some extra performance could easily be squeezed out of the terminal font
|
||||
drawing code (used by xterm) - when I have time I'll add the code.
|
||||
|
||||
The Amiga's blitter and sprites are totally unused and will remain so
|
||||
until/if someone else adds support to the kernel. The blitter would help
|
||||
speed up screen scrolling and window manipulation and sprite support could
|
||||
be used for the X pointer shape (if small enough) which would speed up all
|
||||
drawing operations (no need to remove the software based pointer shape
|
||||
first, draw, then replace the pointer shape).
|
||||
|
||||
I removed the X image extension (XIE) from the X server as it increased the
|
||||
size of the binary by some 400k. I haven't come across any applications that
|
||||
need it yet (I haven't been looking!) so if you need the extension for some
|
||||
reason send me e-mail and I'll build a server with the extension included.
|
||||
|
||||
The 3 button mouse emulation is very simple - to emulate the 3rd button you
|
||||
have to press both button precisely at the same moment - I've got quite good
|
||||
at it now. When I have some spare time I'll add a timer so you will have a
|
||||
few milli-seconds between one button being pressed and the next and it still
|
||||
being registered as the emulated button.
|
||||
|
||||
AGA users don't forget to provide the -A flag to loadbsd to enable the one
|
||||
AGA mode in the 1.0 kernel but only if you have a VGA, multisync or dual-scan
|
||||
monitor, of course !
|
||||
|
||||
Xdaniver has been tested on:
|
||||
|
||||
A1200, 33Mhz 68030, 8Mb RAM and NetBSD 1.0 by myself.
|
||||
A4000/40, 12Mb RAM and NetBSD 1.0 by Andreas Holzhammer.
|
||||
A3000, 12Mb RAM and NetBSD 1.0 by Charlie Root, Stuart Park and others.
|
||||
A3000, 25Mhz 68040, 18Mb RAM and NetBSD-current by Michael K. Sanders.
|
||||
A2000, 8Mb RAM and NetBSD (version unknown) by Hubert Feyrer.
|
||||
|
||||
Release and Bug Fix History
|
||||
---------------------------
|
||||
|
||||
1.0 - First release
|
||||
|
||||
1.01 Bugs fixed:
|
||||
- Narrow (<32 pixels) Z format GetImage requests corrupted the stack
|
||||
and could cause the server to core dump. (Xpaint caused this problem)
|
||||
- Drawing dots (PolyPoint request) into a clipped window caused a
|
||||
c pointer to go out of range, causing a core dump (xv showed this
|
||||
problem).
|
||||
|
||||
New features:
|
||||
- Simple 3 button mouse emulation using a 2 button mouse; specify
|
||||
-emulate_middle (or -2) or -emulate_right (or -3) on the server's
|
||||
command line and press both mouse buttons together emulate the 'missing'
|
||||
button.
|
||||
- Basic beep sound support added by sending bell characters to the
|
||||
console.
|
||||
- Source code released.
|
||||
|
||||
Disclaimer and Copyright Notices
|
||||
--------------------------------
|
||||
|
||||
Multi-depth planar frame buffer code:
|
||||
Copyright (c) 1995 by Daniver Limited.
|
||||
|
||||
Large portions:
|
||||
Copyright (c) 1994 by Eduardo Horvath.
|
||||
Copyright (c) 1987-1995 by the Regents of the University of California.
|
||||
Copyright (c) 1987 by Sun Microsystems, Inc. Mountain View, CA.
|
||||
Copyright (c) 1987-1995 by X Consortium.
|
||||
Copyright (c) 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
Copyright (c) 1989 Network Computing Devices, Inc., Mountain View, California.
|
||||
|
||||
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. The Daniver Limited,
|
||||
the above companies and individuals makes no representations about the
|
||||
suitability of this software for any purpose. It is provided "as is" without
|
||||
express or implied warranty.
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
Thanks to Bernd Ernesti for making the operating system server source code
|
||||
available for others to use and Eduardo Horvath and Andy Heffernan, who (I
|
||||
think) did the original Xmono server port.
|
||||
|
||||
Also, many thanks to the first brave users who tested Xdaniver for me on other
|
||||
Amiga setups and found a few bugs in the process.
|
||||
|
||||
Gary Henderson.
|
||||
|
||||
Daytime: garyh@wet.sbi.com
|
||||
Home: gary@daniver.demon.co.uk
|
||||
972
afb/afb.h
972
afb/afb.h
|
|
@ -1,972 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
/* Monochrome Frame Buffer definitions
|
||||
written by drewry, september 1986
|
||||
*/
|
||||
|
||||
#include "pixmap.h"
|
||||
#include "region.h"
|
||||
#include "gc.h"
|
||||
#include "colormap.h"
|
||||
#include "regionstr.h"
|
||||
#include "privates.h"
|
||||
#include "mibstore.h"
|
||||
#include "mfb.h"
|
||||
|
||||
extern int afbInverseAlu[];
|
||||
/* warning: PixelType definition duplicated in maskbits.h */
|
||||
#ifndef PixelType
|
||||
#define PixelType CARD32
|
||||
#endif /* PixelType */
|
||||
|
||||
#define AFB_MAX_DEPTH 8
|
||||
|
||||
/* afbbitblt.c */
|
||||
|
||||
extern void afbDoBitblt(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
|
||||
extern RegionPtr afbCopyArea(
|
||||
DrawablePtr /*pSrcDrawable*/,
|
||||
DrawablePtr /*pDstDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*srcx*/,
|
||||
int /*srcy*/,
|
||||
int /*width*/,
|
||||
int /*height*/,
|
||||
int /*dstx*/,
|
||||
int /*dsty*/
|
||||
);
|
||||
|
||||
/* afbbltC.c */
|
||||
|
||||
extern void afbDoBitbltCopy(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbbltCI.c */
|
||||
|
||||
extern void afbDoBitbltCopyInverted(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbbltG.c */
|
||||
|
||||
extern void afbDoBitbltGeneral(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbbltO.c */
|
||||
|
||||
extern void afbDoBitbltOr(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbbltX.c */
|
||||
|
||||
extern void afbDoBitbltXor(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbbres.c */
|
||||
|
||||
extern void afbBresS(
|
||||
PixelType * /*addrl*/,
|
||||
int /*nlwidth*/,
|
||||
int /*sizeDst*/,
|
||||
int /*depthDst*/,
|
||||
int /*signdx*/,
|
||||
int /*signdy*/,
|
||||
int /*axis*/,
|
||||
int /*x1*/,
|
||||
int /*y1*/,
|
||||
int /*e*/,
|
||||
int /*e1*/,
|
||||
int /*e2*/,
|
||||
int /*len*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
/* afbbresd.c */
|
||||
|
||||
extern void afbBresD(
|
||||
int * /*pdashIndex*/,
|
||||
unsigned char * /*pDash*/,
|
||||
int /*numInDashList*/,
|
||||
int * /*pdashOffset*/,
|
||||
int /*isDoubleDash*/,
|
||||
PixelType * /*addrl*/,
|
||||
int /*nlwidth*/,
|
||||
int /*sizeDst*/,
|
||||
int /*depthDst*/,
|
||||
int /*signdx*/,
|
||||
int /*signdy*/,
|
||||
int /*axis*/,
|
||||
int /*x1*/,
|
||||
int /*y1*/,
|
||||
int /*e*/,
|
||||
int /*e1*/,
|
||||
int /*e2*/,
|
||||
int /*len*/,
|
||||
unsigned char * /*rrops*/,
|
||||
unsigned char * /*bgrrops*/
|
||||
);
|
||||
|
||||
/* afbclip.c */
|
||||
|
||||
extern RegionPtr afbPixmapToRegion(
|
||||
PixmapPtr /*pPix*/
|
||||
);
|
||||
|
||||
/* afbcmap.c */
|
||||
|
||||
extern int afbListInstalledColormaps(
|
||||
ScreenPtr /*pScreen*/,
|
||||
Colormap * /*pmaps*/
|
||||
);
|
||||
|
||||
extern void afbInstallColormap(
|
||||
ColormapPtr /*pmap*/
|
||||
);
|
||||
|
||||
extern void afbUninstallColormap(
|
||||
ColormapPtr /*pmap*/
|
||||
);
|
||||
|
||||
extern void afbResolveColor(
|
||||
unsigned short * /*pred*/,
|
||||
unsigned short * /*pgreen*/,
|
||||
unsigned short * /*pblue*/,
|
||||
VisualPtr /*pVisual*/
|
||||
);
|
||||
|
||||
extern Bool afbInitializeColormap(
|
||||
ColormapPtr /*pmap*/
|
||||
);
|
||||
|
||||
extern Bool afbInitVisuals(
|
||||
VisualPtr * /*visualp*/,
|
||||
DepthPtr * /*depthp*/,
|
||||
int * /*nvisualp*/,
|
||||
int * /*ndepthp*/,
|
||||
int * /*rootDepthp*/,
|
||||
VisualID * /*defaultVisp*/,
|
||||
unsigned long /*sizes*/,
|
||||
int /*bitsPerRGB*/
|
||||
);
|
||||
|
||||
/* afbfillarc.c */
|
||||
|
||||
extern void afbPolyFillArcSolid(
|
||||
DrawablePtr /*pDraw*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*narcs*/,
|
||||
xArc * /*parcs*/
|
||||
);
|
||||
/* afbfillrct.c */
|
||||
|
||||
extern void afbPolyFillRect(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*nrectFill*/,
|
||||
xRectangle * /*prectInit*/
|
||||
);
|
||||
|
||||
/* afbply1rct.c */
|
||||
extern void afbFillPolygonSolid(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*mode*/,
|
||||
int /*shape*/,
|
||||
int /*count*/,
|
||||
DDXPointPtr /*ptsIn*/
|
||||
);
|
||||
|
||||
/* afbfillsp.c */
|
||||
|
||||
extern void afbSolidFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
extern void afbStippleFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
extern void afbTileFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
extern void afbUnnaturalTileFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
extern void afbUnnaturalStippleFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
extern void afbOpaqueStippleFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
extern void afbUnnaturalOpaqueStippleFS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*nInit*/,
|
||||
DDXPointPtr /*pptInit*/,
|
||||
int * /*pwidthInit*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
|
||||
/* afbfont.c */
|
||||
|
||||
extern Bool afbRealizeFont(
|
||||
ScreenPtr /*pscr*/,
|
||||
FontPtr /*pFont*/
|
||||
);
|
||||
|
||||
extern Bool afbUnrealizeFont(
|
||||
ScreenPtr /*pscr*/,
|
||||
FontPtr /*pFont*/
|
||||
);
|
||||
/* afbgc.c */
|
||||
|
||||
extern Bool afbCreateGC(
|
||||
GCPtr /*pGC*/
|
||||
);
|
||||
|
||||
extern void afbReduceRop(
|
||||
int /*alu*/,
|
||||
Pixel /*src*/,
|
||||
unsigned long /*planemask*/,
|
||||
int /*depth*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
|
||||
/* afbgetsp.c */
|
||||
|
||||
extern void afbGetSpans(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
int /*wMax*/,
|
||||
DDXPointPtr /*ppt*/,
|
||||
int * /*pwidth*/,
|
||||
int /*nspans*/,
|
||||
char * /*pdstStart*/
|
||||
);
|
||||
/* afbhrzvert.c */
|
||||
|
||||
extern void afbHorzS(
|
||||
PixelType * /*addrl*/,
|
||||
int /*nlwidth*/,
|
||||
int /*sizeDst*/,
|
||||
int /*depthDst*/,
|
||||
int /*x1*/,
|
||||
int /*y1*/,
|
||||
int /*len*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
|
||||
extern void afbVertS(
|
||||
PixelType * /*addrl*/,
|
||||
int /*nlwidth*/,
|
||||
int /*sizeDst*/,
|
||||
int /*depthDst*/,
|
||||
int /*x1*/,
|
||||
int /*y1*/,
|
||||
int /*len*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
/* afbigbblak.c */
|
||||
|
||||
extern void afbImageGlyphBlt (
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*x*/,
|
||||
int /*y*/,
|
||||
unsigned int /*nglyph*/,
|
||||
CharInfoPtr * /*ppci*/,
|
||||
pointer /*pglyphBase*/
|
||||
);
|
||||
/* afbigbwht.c */
|
||||
|
||||
/* afbimage.c */
|
||||
|
||||
extern void afbPutImage(
|
||||
DrawablePtr /*dst*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*depth*/,
|
||||
int /*x*/,
|
||||
int /*y*/,
|
||||
int /*w*/,
|
||||
int /*h*/,
|
||||
int /*leftPad*/,
|
||||
int /*format*/,
|
||||
char * /*pImage*/
|
||||
);
|
||||
|
||||
extern void afbGetImage(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
int /*sx*/,
|
||||
int /*sy*/,
|
||||
int /*w*/,
|
||||
int /*h*/,
|
||||
unsigned int /*format*/,
|
||||
unsigned long /*planeMask*/,
|
||||
char * /*pdstLine*/
|
||||
);
|
||||
/* afbline.c */
|
||||
|
||||
extern void afbLineSS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*mode*/,
|
||||
int /*npt*/,
|
||||
DDXPointPtr /*pptInit*/
|
||||
);
|
||||
|
||||
extern void afbLineSD(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*mode*/,
|
||||
int /*npt*/,
|
||||
DDXPointPtr /*pptInit*/
|
||||
);
|
||||
|
||||
/* afbmisc.c */
|
||||
|
||||
extern void afbQueryBestSize(
|
||||
int /*class*/,
|
||||
unsigned short * /*pwidth*/,
|
||||
unsigned short * /*pheight*/,
|
||||
ScreenPtr /*pScreen*/
|
||||
);
|
||||
/* afbpntarea.c */
|
||||
|
||||
extern void afbSolidFillArea(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
|
||||
extern void afbStippleAreaPPW(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
PixmapPtr /*pstipple*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
extern void afbStippleArea(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
PixmapPtr /*pstipple*/,
|
||||
int /*xOff*/,
|
||||
int /*yOff*/,
|
||||
unsigned char * /*rrops*/
|
||||
);
|
||||
/* afbplygblt.c */
|
||||
|
||||
extern void afbPolyGlyphBlt(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*x*/,
|
||||
int /*y*/,
|
||||
unsigned int /*nglyph*/,
|
||||
CharInfoPtr * /*ppci*/,
|
||||
pointer /*pglyphBase*/
|
||||
);
|
||||
|
||||
/* afbpixmap.c */
|
||||
|
||||
extern PixmapPtr afbCreatePixmap(
|
||||
ScreenPtr /*pScreen*/,
|
||||
int /*width*/,
|
||||
int /*height*/,
|
||||
int /*depth*/,
|
||||
unsigned /*usage_hint*/
|
||||
);
|
||||
|
||||
extern Bool afbDestroyPixmap(
|
||||
PixmapPtr /*pPixmap*/
|
||||
);
|
||||
|
||||
extern void afbXRotatePixmap(
|
||||
PixmapPtr /*pPix*/,
|
||||
int /*rw*/
|
||||
);
|
||||
|
||||
extern void afbYRotatePixmap(
|
||||
PixmapPtr /*pPix*/,
|
||||
int /*rh*/
|
||||
);
|
||||
|
||||
extern void afbCopyRotatePixmap(
|
||||
PixmapPtr /*psrcPix*/,
|
||||
PixmapPtr * /*ppdstPix*/,
|
||||
int /*xrot*/,
|
||||
int /*yrot*/
|
||||
);
|
||||
/* afbpolypnt.c */
|
||||
|
||||
extern void afbPolyPoint(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*mode*/,
|
||||
int /*npt*/,
|
||||
xPoint * /*pptInit*/
|
||||
);
|
||||
/* afbpushpxl.c */
|
||||
|
||||
extern void afbPushPixels(
|
||||
GCPtr /*pGC*/,
|
||||
PixmapPtr /*pBitMap*/,
|
||||
DrawablePtr /*pDrawable*/,
|
||||
int /*dx*/,
|
||||
int /*dy*/,
|
||||
int /*xOrg*/,
|
||||
int /*yOrg*/
|
||||
);
|
||||
|
||||
/* afbscrinit.c */
|
||||
|
||||
extern Bool afbScreenInit(
|
||||
ScreenPtr /*pScreen*/,
|
||||
pointer /*pbits*/,
|
||||
int /*xsize*/,
|
||||
int /*ysize*/,
|
||||
int /*dpix*/,
|
||||
int /*dpiy*/,
|
||||
int /*width*/
|
||||
);
|
||||
|
||||
/* afbseg.c */
|
||||
|
||||
extern void afbSegmentSS(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*nseg*/,
|
||||
xSegment * /*pSeg*/
|
||||
);
|
||||
|
||||
extern void afbSegmentSD(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*nseg*/,
|
||||
xSegment * /*pSeg*/
|
||||
);
|
||||
/* afbsetsp.c */
|
||||
|
||||
extern void afbSetSpans(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr /*pGC*/,
|
||||
char * /*psrc*/,
|
||||
DDXPointPtr /*ppt*/,
|
||||
int * /*pwidth*/,
|
||||
int /*nspans*/,
|
||||
int /*fSorted*/
|
||||
);
|
||||
/* afbtegblt.c */
|
||||
|
||||
extern void afbTEGlyphBlt(
|
||||
DrawablePtr /*pDrawable*/,
|
||||
GCPtr/*pGC*/,
|
||||
int /*x*/,
|
||||
int /*y*/,
|
||||
unsigned int /*nglyph*/,
|
||||
CharInfoPtr * /*ppci*/,
|
||||
pointer /*pglyphBase*/
|
||||
);
|
||||
/* afbtileC.c */
|
||||
|
||||
extern void afbTileAreaPPWCopy(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbtileG.c */
|
||||
|
||||
extern void afbTileAreaPPWGeneral(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
|
||||
extern void afbTileAreaCopy(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
int /*xOff*/,
|
||||
int /*yOff*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbtileG.c */
|
||||
|
||||
extern void afbTileAreaGeneral(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
int /*xOff*/,
|
||||
int /*yOff*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
|
||||
extern void afbOpaqueStippleAreaPPWCopy(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
unsigned char */*rropsOS*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbtileG.c */
|
||||
|
||||
extern void afbOpaqueStippleAreaPPWGeneral(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
unsigned char */*rropsOS*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
|
||||
extern void afbOpaqueStippleAreaCopy(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
int /*xOff*/,
|
||||
int /*yOff*/,
|
||||
unsigned char */*rropsOS*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
/* afbtileG.c */
|
||||
|
||||
extern void afbOpaqueStippleAreaGeneral(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/,
|
||||
int /*xOff*/,
|
||||
int /*yOff*/,
|
||||
unsigned char */*rropsOS*/,
|
||||
unsigned long /*planemask*/
|
||||
);
|
||||
|
||||
/* afbwindow.c */
|
||||
|
||||
extern Bool afbCreateWindow(
|
||||
WindowPtr /*pWin*/
|
||||
);
|
||||
|
||||
extern Bool afbDestroyWindow(
|
||||
WindowPtr /*pWin*/
|
||||
);
|
||||
|
||||
extern Bool afbMapWindow(
|
||||
WindowPtr /*pWindow*/
|
||||
);
|
||||
|
||||
extern Bool afbPositionWindow(
|
||||
WindowPtr /*pWin*/,
|
||||
int /*x*/,
|
||||
int /*y*/
|
||||
);
|
||||
|
||||
extern Bool afbUnmapWindow(
|
||||
WindowPtr /*pWindow*/
|
||||
);
|
||||
|
||||
extern void afbCopyWindow(
|
||||
WindowPtr /*pWin*/,
|
||||
DDXPointRec /*ptOldOrg*/,
|
||||
RegionPtr /*prgnSrc*/
|
||||
);
|
||||
|
||||
extern Bool afbChangeWindowAttributes(
|
||||
WindowPtr /*pWin*/,
|
||||
unsigned long /*mask*/
|
||||
);
|
||||
/* afbzerarc.c */
|
||||
|
||||
extern void afbZeroPolyArcSS(
|
||||
DrawablePtr /*pDraw*/,
|
||||
GCPtr /*pGC*/,
|
||||
int /*narcs*/,
|
||||
xArc * /*parcs*/
|
||||
);
|
||||
|
||||
/*
|
||||
private field of pixmap
|
||||
pixmap.devPrivate = (PixelType *)pointer_to_bits
|
||||
pixmap.devKind = width_of_pixmap_in_bytes
|
||||
|
||||
private field of screen
|
||||
a pixmap, for which we allocate storage. devPrivate is a pointer to
|
||||
the bits in the hardware framebuffer. note that devKind can be poked to
|
||||
make the code work for framebuffers that are wider than their
|
||||
displayable screen (e.g. the early vsII, which displayed 960 pixels
|
||||
across, but was 1024 in the hardware.)
|
||||
|
||||
private field of GC
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char rrops[AFB_MAX_DEPTH]; /* reduction of rasterop to 1 of 3 */
|
||||
unsigned char rropOS[AFB_MAX_DEPTH]; /* rop for opaque stipple */
|
||||
} afbPrivGC;
|
||||
typedef afbPrivGC *afbPrivGCPtr;
|
||||
|
||||
extern DevPrivateKey afbScreenPrivateKey;
|
||||
extern DevPrivateKey afbGCPrivateKey;
|
||||
extern DevPrivateKey afbWindowPrivateKey;
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
extern DevPrivateKey frameWindowPrivateKey;
|
||||
#endif
|
||||
|
||||
#define afbGetGCPrivate(pGC) \
|
||||
((afbPrivGC *)dixLookupPrivate(&(pGC)->devPrivates, afbGCPrivateKey))
|
||||
|
||||
/* Common macros for extracting drawing information */
|
||||
|
||||
#define afbGetTypedWidth(pDrawable,wtype)( \
|
||||
(((pDrawable)->type == DRAWABLE_WINDOW) ? \
|
||||
(int)(((PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey)->devKind) : \
|
||||
(int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
|
||||
|
||||
#define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char)
|
||||
|
||||
#define afbGetPixelWidth(pDrawable) afbGetTypedWidth(pDrawable, PixelType)
|
||||
|
||||
#define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
|
||||
PixmapPtr _pPix; \
|
||||
if ((pDrawable)->type == DRAWABLE_WINDOW) \
|
||||
_pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
|
||||
else \
|
||||
_pPix = (PixmapPtr)(pDrawable); \
|
||||
(pointer) = (ptype *) _pPix->devPrivate.ptr; \
|
||||
(width) = ((int) _pPix->devKind) / sizeof (wtype); \
|
||||
}
|
||||
|
||||
#define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\
|
||||
PixmapPtr _pPix; \
|
||||
if ((pDrawable)->type == DRAWABLE_WINDOW) \
|
||||
_pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
|
||||
else \
|
||||
_pPix = (PixmapPtr)(pDrawable); \
|
||||
(pointer) = (PixelType *)_pPix->devPrivate.ptr; \
|
||||
(width) = ((int)_pPix->devKind) / sizeof (PixelType); \
|
||||
(size) = (width) * _pPix->drawable.height; \
|
||||
(dep) = _pPix->drawable.depth; (void)(dep); \
|
||||
}
|
||||
|
||||
#define afbGetByteWidthAndPointer(pDrawable, width, pointer) \
|
||||
afbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
|
||||
|
||||
#define afbGetPixelWidthAndPointer(pDrawable, width, pointer) \
|
||||
afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
|
||||
|
||||
#define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
|
||||
PixmapPtr _pPix = (PixmapPtr)dixLookupPrivate(&(pWin)->drawable.pScreen->devPrivates, afbScreenPrivateKey); \
|
||||
(pointer) = (ptype *) _pPix->devPrivate.ptr; \
|
||||
(width) = ((int) _pPix->devKind) / sizeof (wtype); \
|
||||
}
|
||||
|
||||
#define afbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
|
||||
afbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
|
||||
|
||||
#define afbGetWindowByteWidthAndPointer(pWin, width, pointer) \
|
||||
afbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
|
||||
|
||||
/* afb uses the following macros to calculate addresses in drawables.
|
||||
* To support banked framebuffers, the macros come in four flavors.
|
||||
* All four collapse into the same definition on unbanked devices.
|
||||
*
|
||||
* afbScanlineFoo - calculate address and do bank switching
|
||||
* afbScanlineFooNoBankSwitch - calculate address, don't bank switch
|
||||
* afbScanlineFooSrc - calculate address, switch source bank
|
||||
* afbScanlineFooDst - calculate address, switch destination bank
|
||||
*/
|
||||
|
||||
/* The NoBankSwitch versions are the same for banked and unbanked cases */
|
||||
|
||||
#define afbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
|
||||
#define afbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
|
||||
#define afbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
|
||||
afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
|
||||
#define afbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
|
||||
afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
|
||||
|
||||
#ifdef MFB_LINE_BANK
|
||||
|
||||
#include "afblinebank.h" /* get macro definitions from this file */
|
||||
|
||||
#else /* !MFB_LINE_BANK - unbanked case */
|
||||
|
||||
#define afbScanlineInc(_ptr, _off) afbScanlineIncNoBankSwitch(_ptr, _off)
|
||||
#define afbScanlineIncSrc(_ptr, _off) afbScanlineInc(_ptr, _off)
|
||||
#define afbScanlineIncDst(_ptr, _off) afbScanlineInc(_ptr, _off)
|
||||
|
||||
#define afbScanlineOffset(_ptr, _off) afbScanlineOffsetNoBankSwitch(_ptr, _off)
|
||||
#define afbScanlineOffsetSrc(_ptr, _off) afbScanlineOffset(_ptr, _off)
|
||||
#define afbScanlineOffsetDst(_ptr, _off) afbScanlineOffset(_ptr, _off)
|
||||
|
||||
#define afbScanlineSrc(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
|
||||
#define afbScanlineDst(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
|
||||
|
||||
#define afbScanlineDeltaSrc(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
|
||||
#define afbScanlineDeltaDst(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
|
||||
|
||||
#endif /* MFB_LINE_BANK */
|
||||
|
||||
#define afbScanlineDelta(_ptr, _y, _w) \
|
||||
afbScanlineOffset(_ptr, (_y) * (_w))
|
||||
|
||||
#define afbScanline(_ptr, _x, _y, _w) \
|
||||
afbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
|
||||
|
||||
/* precomputed information about each glyph for GlyphBlt code.
|
||||
this saves recalculating the per glyph information for each box.
|
||||
*/
|
||||
|
||||
typedef struct _afbpos{
|
||||
int xpos; /* xposition of glyph's origin */
|
||||
int xchar; /* x position mod 32 */
|
||||
int leftEdge;
|
||||
int rightEdge;
|
||||
int topEdge;
|
||||
int bottomEdge;
|
||||
PixelType *pdstBase; /* longword with character origin */
|
||||
int widthGlyph; /* width in bytes of this glyph */
|
||||
} afbTEXTPOS;
|
||||
|
||||
/* reduced raster ops for afb */
|
||||
#define RROP_BLACK GXclear
|
||||
#define RROP_WHITE GXset
|
||||
#define RROP_NOP GXnoop
|
||||
#define RROP_INVERT GXinvert
|
||||
#define RROP_COPY GXcopy
|
||||
|
||||
/* macros for afbbitblt.c, afbfillsp.c
|
||||
these let the code do one switch on the rop per call, rather
|
||||
than a switch on the rop per item (span or rectangle.)
|
||||
*/
|
||||
|
||||
#define fnCLEAR(src, dst) (0)
|
||||
#define fnAND(src, dst) (src & dst)
|
||||
#define fnANDREVERSE(src, dst) (src & ~dst)
|
||||
#define fnCOPY(src, dst) (src)
|
||||
#define fnANDINVERTED(src, dst) (~src & dst)
|
||||
#define fnNOOP(src, dst) (dst)
|
||||
#define fnXOR(src, dst) (src ^ dst)
|
||||
#define fnOR(src, dst) (src | dst)
|
||||
#define fnNOR(src, dst) (~(src | dst))
|
||||
#define fnEQUIV(src, dst) (~src ^ dst)
|
||||
#define fnINVERT(src, dst) (~dst)
|
||||
#define fnORREVERSE(src, dst) (src | ~dst)
|
||||
#define fnCOPYINVERTED(src, dst) (~src)
|
||||
#define fnORINVERTED(src, dst) (~src | dst)
|
||||
#define fnNAND(src, dst) (~(src & dst))
|
||||
#undef fnSET
|
||||
#define fnSET(src, dst) (~0)
|
||||
|
||||
/* Using a "switch" statement is much faster in most cases
|
||||
* since the compiler can do a look-up table or multi-way branch
|
||||
* instruction, depending on the architecture. The result on
|
||||
* A Sun 3/50 is at least 2.5 times faster, assuming a uniform
|
||||
* distribution of RasterOp operation types.
|
||||
*
|
||||
* However, doing some profiling on a running system reveals
|
||||
* GXcopy is the operation over 99.5% of the time and
|
||||
* GXxor is the next most frequent (about .4%), so we make special
|
||||
* checks for those first.
|
||||
*
|
||||
* Note that this requires a change to the "calling sequence"
|
||||
* since we can't engineer a "switch" statement to have an lvalue.
|
||||
*/
|
||||
#undef DoRop
|
||||
#define DoRop(result, alu, src, dst) \
|
||||
{ \
|
||||
if (alu == GXcopy) \
|
||||
result = fnCOPY (src, dst); \
|
||||
else if (alu == GXxor) \
|
||||
result = fnXOR (src, dst); \
|
||||
else \
|
||||
switch (alu) { \
|
||||
case GXclear: \
|
||||
result = fnCLEAR (src, dst); \
|
||||
break; \
|
||||
case GXand: \
|
||||
result = fnAND (src, dst); \
|
||||
break; \
|
||||
case GXandReverse: \
|
||||
result = fnANDREVERSE (src, dst); \
|
||||
break; \
|
||||
case GXandInverted: \
|
||||
result = fnANDINVERTED (src, dst); \
|
||||
break; \
|
||||
default: \
|
||||
case GXnoop: \
|
||||
result = fnNOOP (src, dst); \
|
||||
break; \
|
||||
case GXor: \
|
||||
result = fnOR (src, dst); \
|
||||
break; \
|
||||
case GXnor: \
|
||||
result = fnNOR (src, dst); \
|
||||
break; \
|
||||
case GXequiv: \
|
||||
result = fnEQUIV (src, dst); \
|
||||
break; \
|
||||
case GXinvert: \
|
||||
result = fnINVERT (src, dst); \
|
||||
break; \
|
||||
case GXorReverse: \
|
||||
result = fnORREVERSE (src, dst); \
|
||||
break; \
|
||||
case GXcopyInverted: \
|
||||
result = fnCOPYINVERTED (src, dst); \
|
||||
break; \
|
||||
case GXorInverted: \
|
||||
result = fnORINVERTED (src, dst); \
|
||||
break; \
|
||||
case GXnand: \
|
||||
result = fnNAND (src, dst); \
|
||||
break; \
|
||||
case GXset: \
|
||||
result = fnSET (src, dst); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/* C expression fragments for various operations. These get passed in
|
||||
* as -D's on the compile command line. See afb/Imakefile. This
|
||||
* fixes XBUG 6319.
|
||||
*
|
||||
* This seems like a good place to point out that afb's use of the
|
||||
* words black and white is an unfortunate misnomer. In afb code, black
|
||||
* means zero, and white means one.
|
||||
*/
|
||||
#define MFB_OPEQ_WHITE |=
|
||||
#define MFB_OPEQ_BLACK &=~
|
||||
#define MFB_OPEQ_INVERT ^=
|
||||
#define MFB_EQWHOLEWORD_WHITE =~0
|
||||
#define MFB_EQWHOLEWORD_BLACK =0
|
||||
#define MFB_EQWHOLEWORD_INVERT ^=~0
|
||||
#define MFB_OP_WHITE /* nothing */
|
||||
#define MFB_OP_BLACK ~
|
||||
343
afb/afbbitblt.c
343
afb/afbbitblt.c
|
|
@ -1,343 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xprotostr.h>
|
||||
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mi.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/* CopyArea and CopyPlane for a monchrome frame buffer
|
||||
|
||||
|
||||
clip the source rectangle to the source's available bits. (this
|
||||
avoids copying unnecessary pieces that will just get exposed anyway.)
|
||||
this becomes the new shape of the destination.
|
||||
clip the destination region to the composite clip in the
|
||||
GC. this requires translating the destination region to (dstx, dsty).
|
||||
build a list of source points, one for each rectangle in the
|
||||
destination. this is a simple translation.
|
||||
go do the multiple rectangle copies
|
||||
do graphics exposures
|
||||
*/
|
||||
/** Optimized for drawing pixmaps into windows, especially when drawing into
|
||||
** unobscured windows. Calls to the general-purpose region code were
|
||||
** replaced with rectangle-to-rectangle clipping comparisions. This is
|
||||
** possible, since the pixmap is a single rectangle. In an unobscured
|
||||
** window, the destination clip is also a single rectangle, and region
|
||||
** code can be avoided entirely. This is a big savings, since the region
|
||||
** code uses XAlloc() and makes many function calls.
|
||||
**
|
||||
** In addition, if source is a pixmap, there is no need to call the
|
||||
** expensive miHandleExposures() routine. Instead, we simply return NULL.
|
||||
**
|
||||
** Previously, drawing a pixmap into an unobscured window executed at least
|
||||
** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code.
|
||||
**
|
||||
** Now, the same operation requires no XAlloc()'s, no region function calls,
|
||||
** and much less overhead. Nice for drawing lots of small pixmaps.
|
||||
*/
|
||||
|
||||
void
|
||||
afbDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, long unsigned int planemask)
|
||||
{
|
||||
switch (alu) {
|
||||
case GXcopy:
|
||||
afbDoBitbltCopy(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
||||
break;
|
||||
case GXxor:
|
||||
afbDoBitbltXor(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
afbDoBitbltCopyInverted(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
||||
break;
|
||||
case GXor:
|
||||
afbDoBitbltOr(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
||||
break;
|
||||
default:
|
||||
afbDoBitbltGeneral(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*afb_blit_func)
|
||||
(DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long);
|
||||
|
||||
static RegionPtr
|
||||
afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, afb_blit_func doBitBlt, long unsigned int planemask)
|
||||
{
|
||||
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
|
||||
Bool freeSrcClip = FALSE;
|
||||
|
||||
RegionPtr prgnExposed;
|
||||
RegionRec rgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
register DDXPointPtr ppt;
|
||||
register BoxPtr pbox;
|
||||
int i;
|
||||
register int dx;
|
||||
register int dy;
|
||||
xRectangle origSource;
|
||||
DDXPointRec origDest;
|
||||
int numRects;
|
||||
BoxRec fastBox;
|
||||
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 != pDstDrawable) && pSrcDrawable->pScreen->SourceValidate)
|
||||
(*pSrcDrawable->pScreen->SourceValidate)(pSrcDrawable, srcx, srcy, width,
|
||||
height);
|
||||
|
||||
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 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 {
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
|
||||
}
|
||||
|
||||
dstx += pDstDrawable->x;
|
||||
dsty += pDstDrawable->y;
|
||||
|
||||
if (pDstDrawable->type == DRAWABLE_WINDOW)
|
||||
if (!((WindowPtr)pDstDrawable)->realized) {
|
||||
if (!fastClip)
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, 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 (REGION_NUM_RECTS(cclip) == 1) {
|
||||
BoxPtr pBox = REGION_RECTS(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) {
|
||||
REGION_NULL(pGC->pScreen, &rgnDst);
|
||||
} else {
|
||||
REGION_INIT(pGC->pScreen, &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;
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
|
||||
}
|
||||
} else
|
||||
REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
|
||||
|
||||
if (!fastClip) {
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
|
||||
pGC->pCompositeClip);
|
||||
}
|
||||
|
||||
/* Do bit blitting */
|
||||
numRects = REGION_NUM_RECTS(&rgnDst);
|
||||
if (numRects && width && height) {
|
||||
if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
|
||||
sizeof(DDXPointRec)))) {
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return NULL;
|
||||
}
|
||||
pbox = REGION_RECTS(&rgnDst);
|
||||
ppt = pptSrc;
|
||||
for (i = numRects; --i >= 0; pbox++, ppt++) {
|
||||
ppt->x = pbox->x1 + dx;
|
||||
ppt->y = pbox->y1 + dy;
|
||||
}
|
||||
|
||||
(*doBitBlt)(pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc,
|
||||
planemask);
|
||||
|
||||
xfree(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, (unsigned long)0);
|
||||
}
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return prgnExposed;
|
||||
}
|
||||
|
||||
RegionPtr
|
||||
afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty)
|
||||
{
|
||||
afb_blit_func doBitBlt;
|
||||
|
||||
switch (pGC->alu) {
|
||||
case GXcopy:
|
||||
doBitBlt = afbDoBitbltCopy;
|
||||
break;
|
||||
case GXxor:
|
||||
doBitBlt = afbDoBitbltXor;
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
doBitBlt = afbDoBitbltCopyInverted;
|
||||
break;
|
||||
case GXor:
|
||||
doBitBlt = afbDoBitbltOr;
|
||||
break;
|
||||
default:
|
||||
doBitBlt = afbDoBitbltGeneral;
|
||||
break;
|
||||
}
|
||||
|
||||
return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
|
||||
width, height, dstx, dsty, doBitBlt, pGC->planemask));
|
||||
}
|
||||
563
afb/afbblt.c
563
afb/afbblt.c
|
|
@ -1,563 +0,0 @@
|
|||
/*
|
||||
* afb copy area
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Copyright (c) 1989 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
Author: Keith Packard
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "afb.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
#include "fastblt.h"
|
||||
#include "mergerop.h"
|
||||
|
||||
void
|
||||
MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
|
||||
DrawablePtr pSrc, pDst;
|
||||
int alu;
|
||||
RegionPtr prgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
unsigned long planemask;
|
||||
{
|
||||
PixelType *psrcBase, *pdstBase; /* start of src and dst bitmaps */
|
||||
int widthSrc, widthDst; /* add to get to same position in next line */
|
||||
int sizeSrc, sizeDst;
|
||||
|
||||
BoxPtr pbox;
|
||||
int nbox;
|
||||
|
||||
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
|
||||
/* temporaries for shuffling rectangles */
|
||||
DDXPointPtr pptTmp, pptNew1, pptNew2;
|
||||
/* shuffling boxes entails shuffling the
|
||||
source points too */
|
||||
int w, h;
|
||||
int xdir; /* 1 = left right, -1 = right left/ */
|
||||
int ydir; /* 1 = top down, -1 = bottom up */
|
||||
|
||||
PixelType *psrcLine, *pdstLine;
|
||||
/* pointers to line with current src and dst */
|
||||
register PixelType *psrc; /* pointer to current src longword */
|
||||
register PixelType *pdst; /* pointer to current dst longword */
|
||||
|
||||
MROP_DECLARE_REG()
|
||||
|
||||
/* following used for looping through a line */
|
||||
PixelType startmask, endmask; /* masks for writing ends of dst */
|
||||
int nlMiddle; /* whole longwords in dst */
|
||||
int xoffSrc, xoffDst;
|
||||
register int leftShift, rightShift;
|
||||
register PixelType bits;
|
||||
register PixelType bits1;
|
||||
register int nl; /* temp copy of nlMiddle */
|
||||
|
||||
int careful;
|
||||
int depthSrc;
|
||||
int depthDst;
|
||||
|
||||
MROP_INITIALIZE(alu,0);
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pSrc, widthSrc, sizeSrc, depthSrc,
|
||||
psrcBase);
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDst, widthDst, sizeDst, depthDst,
|
||||
pdstBase);
|
||||
|
||||
/* Special case where depth of dest pixmap is 1 but source pixmap isn't
|
||||
* Used for GetImage to copy a plane from a source pixmap to a particular
|
||||
* dest pixmap plane.
|
||||
* Note: planemask should have only one bit set or several planes from
|
||||
* the source will be copied to the same dest plane.
|
||||
*/
|
||||
if (depthDst == 1 && depthDst != depthSrc)
|
||||
sizeDst = 0;
|
||||
|
||||
/* 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 = REGION_RECTS(prgnDst);
|
||||
nbox = REGION_NUM_RECTS(prgnDst);
|
||||
|
||||
pboxNew1 = NULL;
|
||||
pptNew1 = NULL;
|
||||
pboxNew2 = NULL;
|
||||
pptNew2 = NULL;
|
||||
if (careful && (pptSrc->y < pbox->y1)) {
|
||||
/* walk source botttom to top */
|
||||
ydir = -1;
|
||||
widthSrc = -widthSrc;
|
||||
widthDst = -widthDst;
|
||||
|
||||
if (nbox > 1) {
|
||||
/* keep ordering in each band, reverse order of bands */
|
||||
pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
|
||||
if(!pboxNew1)
|
||||
return;
|
||||
pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
|
||||
if(!pptNew1) {
|
||||
xfree(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)xalloc(sizeof(BoxRec) * nbox);
|
||||
pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
|
||||
if(!pboxNew2 || !pptNew2) {
|
||||
if (pptNew2)
|
||||
xfree(pptNew2);
|
||||
if (pboxNew2)
|
||||
xfree(pboxNew2);
|
||||
if (pboxNew1) {
|
||||
xfree(pptNew1);
|
||||
xfree(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;
|
||||
}
|
||||
|
||||
while(nbox--) {
|
||||
int d;
|
||||
for (d = 0; d < depthSrc; d++) {
|
||||
PixelType *psrcB;
|
||||
PixelType *pdstB;
|
||||
|
||||
if (!(planemask & (1 << d)))
|
||||
continue;
|
||||
|
||||
psrcB = psrcBase + sizeSrc * d; /* @@@ NEXT PLANE @@@ */
|
||||
pdstB = pdstBase + sizeDst * d; /* @@@ NEXT PLANE @@@ */
|
||||
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
if (ydir == -1) { /* start at last scanline of rectangle */
|
||||
psrcLine = afbScanlineDeltaSrc(psrcB, -(pptSrc->y+h-1), widthSrc);
|
||||
pdstLine = afbScanlineDeltaDst(pdstB, -(pbox->y2-1), widthDst);
|
||||
} else { /* start at first scanline */
|
||||
psrcLine = afbScanlineDeltaSrc(psrcB, pptSrc->y, widthSrc);
|
||||
pdstLine = afbScanlineDeltaDst(pdstB, pbox->y1, widthDst);
|
||||
}
|
||||
if ((pbox->x1 & PIM) + w <= PPW) {
|
||||
maskpartialbits (pbox->x1, w, startmask);
|
||||
endmask = 0;
|
||||
nlMiddle = 0;
|
||||
} else {
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
|
||||
}
|
||||
if (xdir == 1) {
|
||||
xoffSrc = pptSrc->x & PIM;
|
||||
xoffDst = pbox->x1 & PIM;
|
||||
pdstLine += (pbox->x1 >> PWSH);
|
||||
psrcLine += (pptSrc->x >> PWSH);
|
||||
#ifdef DO_UNALIGNED_BITBLT
|
||||
nl = xoffSrc - xoffDst;
|
||||
psrcLine = (PixelType *)(((unsigned char *) psrcLine) + nl);
|
||||
#else
|
||||
if (xoffSrc == xoffDst)
|
||||
#endif
|
||||
{
|
||||
while (h--) {
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
if (startmask) {
|
||||
*pdst = MROP_MASK(*psrc, *pdst, startmask);
|
||||
psrc++;
|
||||
pdst++;
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
|
||||
psrc += nl & (UNROLL-1);
|
||||
pdst += nl & (UNROLL-1);
|
||||
|
||||
#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
|
||||
#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
|
||||
|
||||
#define LoopReset \
|
||||
pdst += UNROLL; \
|
||||
psrc += UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
|
||||
#define BodyEven(n) BodyOdd(n)
|
||||
|
||||
#define LoopReset ;
|
||||
|
||||
#endif
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
#ifdef NOTDEF
|
||||
/* you'd think this would be faster --
|
||||
* a single instruction instead of 6
|
||||
* but measurements show it to be ~15% slower
|
||||
*/
|
||||
while ((nl -= 6) >= 0) {
|
||||
asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
|
||||
: "=m" (*(char *)pdst)
|
||||
: "m" (*(char *)psrc)
|
||||
: "d0", "d1", "d2", "d3",
|
||||
"a2", "a3");
|
||||
pdst += 6;
|
||||
}
|
||||
nl += 6;
|
||||
while (nl--)
|
||||
*pdst++ = *psrc++;
|
||||
#endif
|
||||
DuffL(nl, label1,
|
||||
*pdst = MROP_SOLID (*psrc, *pdst);
|
||||
pdst++; psrc++;)
|
||||
#endif
|
||||
|
||||
if (endmask)
|
||||
*pdst = MROP_MASK(*psrc, *pdst, endmask);
|
||||
afbScanlineIncDst(pdstLine, widthDst);
|
||||
afbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#ifndef DO_UNALIGNED_BITBLT
|
||||
else {
|
||||
if (xoffSrc > xoffDst) {
|
||||
leftShift = (xoffSrc - xoffDst);
|
||||
rightShift = PPW - leftShift;
|
||||
} else {
|
||||
rightShift = (xoffDst - xoffSrc);
|
||||
leftShift = PPW - rightShift;
|
||||
}
|
||||
while (h--) {
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
bits = 0;
|
||||
if (xoffSrc > xoffDst)
|
||||
bits = *psrc++;
|
||||
if (startmask) {
|
||||
bits1 = BitLeft(bits,leftShift);
|
||||
bits = *psrc++;
|
||||
bits1 |= BitRight(bits,rightShift);
|
||||
*pdst = MROP_MASK(bits1, *pdst, startmask);
|
||||
pdst++;
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
bits1 = bits;
|
||||
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
|
||||
psrc += nl & (UNROLL-1);
|
||||
pdst += nl & (UNROLL-1);
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = psrc[-n]; \
|
||||
pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = psrc[-n]; \
|
||||
pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
|
||||
|
||||
#define LoopReset \
|
||||
pdst += UNROLL; \
|
||||
psrc += UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = *psrc++; \
|
||||
*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
|
||||
pdst++;
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = *psrc++; \
|
||||
*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
|
||||
pdst++;
|
||||
|
||||
#define LoopReset ;
|
||||
|
||||
#endif /* !FAST_CONSTANT_OFFSET_MODE */
|
||||
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
DuffL(nl,label2,
|
||||
bits1 = BitLeft(bits, leftShift);
|
||||
bits = *psrc++;
|
||||
*pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
|
||||
pdst++;
|
||||
)
|
||||
#endif
|
||||
|
||||
if (endmask) {
|
||||
bits1 = BitLeft(bits, leftShift);
|
||||
if (BitLeft(endmask, rightShift)) {
|
||||
bits = *psrc;
|
||||
bits1 |= BitRight(bits, rightShift);
|
||||
}
|
||||
*pdst = MROP_MASK (bits1, *pdst, endmask);
|
||||
}
|
||||
afbScanlineIncDst(pdstLine, widthDst);
|
||||
afbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#endif /* DO_UNALIGNED_BITBLT */
|
||||
} else { /* xdir == -1 */
|
||||
xoffSrc = (pptSrc->x + w - 1) & PIM;
|
||||
xoffDst = (pbox->x2 - 1) & PIM;
|
||||
pdstLine += ((pbox->x2-1) >> PWSH) + 1;
|
||||
psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
|
||||
#ifdef DO_UNALIGNED_BITBLT
|
||||
nl = xoffSrc - xoffDst;
|
||||
psrcLine = (PixelType *)
|
||||
(((unsigned char *) psrcLine) + nl);
|
||||
#else
|
||||
if (xoffSrc == xoffDst)
|
||||
#endif
|
||||
{
|
||||
while (h--) {
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
if (endmask) {
|
||||
pdst--;
|
||||
psrc--;
|
||||
*pdst = MROP_MASK (*psrc, *pdst, endmask);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
psrc -= nl & (UNROLL - 1);
|
||||
pdst -= nl & (UNROLL - 1);
|
||||
|
||||
#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
|
||||
|
||||
#define BodyEven(n) BodyOdd(n)
|
||||
|
||||
#define LoopReset \
|
||||
pdst -= UNROLL;\
|
||||
psrc -= UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
|
||||
#define BodyEven(n) BodyOdd(n)
|
||||
#define LoopReset ;
|
||||
|
||||
#endif
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
DuffL(nl,label3,
|
||||
--pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
|
||||
#endif
|
||||
|
||||
if (startmask) {
|
||||
--pdst;
|
||||
--psrc;
|
||||
*pdst = MROP_MASK(*psrc, *pdst, startmask);
|
||||
}
|
||||
afbScanlineIncDst(pdstLine, widthDst);
|
||||
afbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#ifndef DO_UNALIGNED_BITBLT
|
||||
else {
|
||||
if (xoffDst > xoffSrc) {
|
||||
rightShift = (xoffDst - xoffSrc);
|
||||
leftShift = PPW - rightShift;
|
||||
} else {
|
||||
leftShift = (xoffSrc - xoffDst);
|
||||
rightShift = PPW - leftShift;
|
||||
}
|
||||
while (h--) {
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
bits = 0;
|
||||
if (xoffDst > xoffSrc)
|
||||
bits = *--psrc;
|
||||
if (endmask) {
|
||||
bits1 = BitRight(bits, rightShift);
|
||||
bits = *--psrc;
|
||||
bits1 |= BitLeft(bits, leftShift);
|
||||
pdst--;
|
||||
*pdst = MROP_MASK(bits1, *pdst, endmask);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
bits1 = bits;
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
psrc -= nl & (UNROLL - 1);
|
||||
pdst -= nl & (UNROLL - 1);
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = psrc[n-1]; \
|
||||
pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = psrc[n-1]; \
|
||||
pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
|
||||
|
||||
#define LoopReset \
|
||||
pdst -= UNROLL; \
|
||||
psrc -= UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = *--psrc; --pdst; \
|
||||
*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = *--psrc; --pdst; \
|
||||
*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
|
||||
|
||||
#define LoopReset ;
|
||||
|
||||
#endif
|
||||
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
DuffL(nl, label4,
|
||||
bits1 = BitRight(bits, rightShift);
|
||||
bits = *--psrc;
|
||||
--pdst;
|
||||
*pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
|
||||
)
|
||||
#endif
|
||||
|
||||
if (startmask) {
|
||||
bits1 = BitRight(bits, rightShift);
|
||||
if (BitRight (startmask, leftShift)) {
|
||||
bits = *--psrc;
|
||||
bits1 |= BitLeft(bits, leftShift);
|
||||
}
|
||||
--pdst;
|
||||
*pdst = MROP_MASK(bits1, *pdst, startmask);
|
||||
}
|
||||
afbScanlineIncDst(pdstLine, widthDst);
|
||||
afbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pbox++;
|
||||
pptSrc++;
|
||||
}
|
||||
if (pboxNew2) {
|
||||
xfree(pptNew2);
|
||||
xfree(pboxNew2);
|
||||
}
|
||||
if (pboxNew1) {
|
||||
xfree(pptNew1);
|
||||
xfree(pboxNew1);
|
||||
}
|
||||
}
|
||||
323
afb/afbbres.c
323
afb/afbbres.c
|
|
@ -1,323 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "misc.h"
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
|
||||
/* Solid bresenham line */
|
||||
/* NOTES
|
||||
e2 is used less often than e1, so it's not in a register
|
||||
*/
|
||||
|
||||
void
|
||||
afbBresS(addrlbase, nlwidth, sizeDst, depthDst, signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, len, rrops)
|
||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
||||
int nlwidth; /* width in longwords of bitmap */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int signdx, signdy; /* signs of directions */
|
||||
int axis; /* major axis (Y_AXIS or X_AXIS) */
|
||||
int x1, y1; /* initial point */
|
||||
register int e; /* error accumulator */
|
||||
register int e1; /* bresenham increments */
|
||||
int e2;
|
||||
int len; /* length of line */
|
||||
unsigned char *rrops;
|
||||
{
|
||||
register int yinc; /* increment to next scanline, in bytes */
|
||||
register PixelType *addrl; /* bitmask long pointer */
|
||||
register PixelType bit; /* current bit being set/cleared/etc. */
|
||||
PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
|
||||
PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
|
||||
|
||||
register int e3 = e2-e1;
|
||||
PixelType tmp;
|
||||
int saveE;
|
||||
int saveLen;
|
||||
int d;
|
||||
|
||||
/* point to longword containing first point */
|
||||
yinc = signdy * nlwidth;
|
||||
e = e-e1; /* to make looping easier */
|
||||
|
||||
if (!len)
|
||||
return;
|
||||
|
||||
saveLen = len;
|
||||
saveE = e;
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(addrlbase, x1, y1, nlwidth);
|
||||
addrlbase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
len = saveLen;
|
||||
e = saveE;
|
||||
bit = mfbGetmask(x1 & PIM);
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
if (axis == X_AXIS) {
|
||||
if (signdx > 0) {
|
||||
tmp = *addrl;
|
||||
for (;;) {
|
||||
tmp &= ~bit;
|
||||
if (!--len)
|
||||
break;
|
||||
bit = SCRRIGHT(bit,1);
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
*addrl = tmp;
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit) {
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
}
|
||||
tmp = *addrl;
|
||||
} else if (!bit) {
|
||||
*addrl = tmp;
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
} else {
|
||||
tmp = *addrl;
|
||||
for (;;) {
|
||||
tmp &= ~bit;
|
||||
if (!--len)
|
||||
break;
|
||||
e += e1;
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (e >= 0) {
|
||||
*addrl = tmp;
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit) {
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
}
|
||||
tmp = *addrl;
|
||||
} else if (!bit) {
|
||||
*addrl = tmp;
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
}
|
||||
} /* if X_AXIS */ else {
|
||||
if (signdx > 0) {
|
||||
while(len--) {
|
||||
*addrl &= ~bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
}
|
||||
} else {
|
||||
while(len--) {
|
||||
*addrl &= ~bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
break;
|
||||
|
||||
case RROP_WHITE:
|
||||
if (axis == X_AXIS) {
|
||||
if (signdx > 0) {
|
||||
tmp = *addrl;
|
||||
for (;;) {
|
||||
tmp |= bit;
|
||||
if (!--len)
|
||||
break;
|
||||
e += e1;
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (e >= 0) {
|
||||
*addrl = tmp;
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit) {
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
}
|
||||
tmp = *addrl;
|
||||
} else if (!bit) {
|
||||
*addrl = tmp;
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
} else {
|
||||
tmp = *addrl;
|
||||
for (;;) {
|
||||
tmp |= bit;
|
||||
if (!--len)
|
||||
break;
|
||||
e += e1;
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (e >= 0) {
|
||||
*addrl = tmp;
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit) {
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
}
|
||||
tmp = *addrl;
|
||||
} else if (!bit) {
|
||||
*addrl = tmp;
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
}
|
||||
} /* if X_AXIS */ else {
|
||||
if (signdx > 0) {
|
||||
while(len--) {
|
||||
*addrl |= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
}
|
||||
} else {
|
||||
while(len--) {
|
||||
*addrl |= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
break;
|
||||
|
||||
case RROP_INVERT:
|
||||
if (axis == X_AXIS) {
|
||||
if (signdx > 0) {
|
||||
while(len--) {
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
}
|
||||
} else {
|
||||
while(len--) {
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
}
|
||||
}
|
||||
} /* if X_AXIS */ else {
|
||||
if (signdx > 0) {
|
||||
while(len--) {
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
}
|
||||
} else {
|
||||
while(len--) {
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit; addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
} /* switch */
|
||||
} /* for (d = ... ) */
|
||||
}
|
||||
214
afb/afbbresd.c
214
afb/afbbresd.c
|
|
@ -1,214 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "misc.h"
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
|
||||
/* Dashed bresenham line */
|
||||
|
||||
#define StepDash\
|
||||
if (!--dashRemaining) { \
|
||||
if (++ dashIndex == numInDashList) \
|
||||
dashIndex = 0; \
|
||||
dashRemaining = pDash[dashIndex]; \
|
||||
rop = fgrop; \
|
||||
if (dashIndex & 1) \
|
||||
rop = bgrop; \
|
||||
}
|
||||
|
||||
void
|
||||
afbBresD(pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
|
||||
addrlbase, nlwidth, sizeDst, depthDst,
|
||||
signdx, signdy, axis, x1, y1, e, e1, e2, len, rrops, bgrrops)
|
||||
int *pdashIndex; /* current dash */
|
||||
unsigned char *pDash; /* dash list */
|
||||
int numInDashList; /* total length of dash list */
|
||||
int *pdashOffset; /* offset into current dash */
|
||||
int isDoubleDash;
|
||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
||||
int nlwidth; /* width in longwords of bitmap */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int signdx, signdy; /* signs of directions */
|
||||
int axis; /* major axis (Y_AXIS or X_AXIS) */
|
||||
int x1, y1; /* initial point */
|
||||
register int e; /* error accumulator */
|
||||
register int e1; /* bresenham increments */
|
||||
int e2;
|
||||
int len; /* length of line */
|
||||
unsigned char *rrops;
|
||||
unsigned char *bgrrops;
|
||||
{
|
||||
register int yinc; /* increment to next scanline, in bytes */
|
||||
register PixelType *addrl;
|
||||
register int e3 = e2-e1;
|
||||
register unsigned long bit;
|
||||
PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
|
||||
PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
|
||||
int dashIndex;
|
||||
int dashOffset;
|
||||
int dashRemaining;
|
||||
int rop;
|
||||
int fgrop;
|
||||
int bgrop;
|
||||
int saveE;
|
||||
int saveLen;
|
||||
int d;
|
||||
|
||||
dashOffset = *pdashOffset;
|
||||
dashIndex = *pdashIndex;
|
||||
dashRemaining = pDash[dashIndex] - dashOffset;
|
||||
/* point to longword containing first point */
|
||||
|
||||
yinc = signdy * nlwidth;
|
||||
e = e-e1; /* to make looping easier */
|
||||
|
||||
saveE = e;
|
||||
saveLen = len;
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(addrlbase, x1, y1, nlwidth);
|
||||
addrlbase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
|
||||
fgrop = rrops[d];
|
||||
bgrop = bgrrops[d];
|
||||
|
||||
e = saveE;
|
||||
len = saveLen;
|
||||
bit = mfbGetmask(x1 & PIM);
|
||||
|
||||
rop = fgrop;
|
||||
if (!isDoubleDash)
|
||||
bgrop = -1;
|
||||
if (dashIndex & 1)
|
||||
rop = bgrop;
|
||||
|
||||
if (axis == X_AXIS) {
|
||||
if (signdx > 0) {
|
||||
while(len--) {
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
StepDash
|
||||
}
|
||||
} else {
|
||||
while(len--) {
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
afbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
} /* if X_AXIS */ else {
|
||||
if (signdx > 0) {
|
||||
while(len--) {
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
StepDash
|
||||
}
|
||||
} else {
|
||||
while(len--) {
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
afbScanlineInc(addrl, yinc);
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
} /* for (d = ...) */
|
||||
*pdashIndex = dashIndex;
|
||||
*pdashOffset = pDash[dashIndex] - dashRemaining;
|
||||
}
|
||||
248
afb/afbclip.c
248
afb/afbclip.c
|
|
@ -1,248 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "regionstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "gc.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "afb.h"
|
||||
|
||||
#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \
|
||||
if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
|
||||
(!((reg)->data->numRects && \
|
||||
((r-1)->y1 == (ry1)) && \
|
||||
((r-1)->y2 == (ry2)) && \
|
||||
((r-1)->x1 <= (rx1)) && \
|
||||
((r-1)->x2 >= (rx2))))) \
|
||||
{ \
|
||||
if ((reg)->data->numRects == (reg)->data->size) \
|
||||
{ \
|
||||
miRectAlloc(reg, 1); \
|
||||
fr = REGION_BOXPTR(reg); \
|
||||
r = fr + (reg)->data->numRects; \
|
||||
} \
|
||||
r->x1 = (rx1); \
|
||||
r->y1 = (ry1); \
|
||||
r->x2 = (rx2); \
|
||||
r->y2 = (ry2); \
|
||||
(reg)->data->numRects++; \
|
||||
if(r->x1 < (reg)->extents.x1) \
|
||||
(reg)->extents.x1 = r->x1; \
|
||||
if(r->x2 > (reg)->extents.x2) \
|
||||
(reg)->extents.x2 = r->x2; \
|
||||
r++; \
|
||||
}
|
||||
|
||||
/* Convert bitmap clip mask into clipping region.
|
||||
* First, goes through each line and makes boxes by noting the transitions
|
||||
* from 0 to 1 and 1 to 0.
|
||||
* Then it coalesces the current line with the previous if they have boxes
|
||||
* at the same X coordinates.
|
||||
*/
|
||||
RegionPtr
|
||||
afbPixmapToRegion(pPix)
|
||||
PixmapPtr pPix;
|
||||
{
|
||||
register RegionPtr pReg;
|
||||
register PixelType *pw, w;
|
||||
register int ib;
|
||||
int width, h, base, rx1 = 0, crects;
|
||||
PixelType *pwLineEnd;
|
||||
int irectPrevStart, irectLineStart;
|
||||
register BoxPtr prectO, prectN;
|
||||
BoxPtr FirstRect, rects, prectLineStart;
|
||||
Bool fInBox, fSame;
|
||||
register PixelType mask0 = mfbGetmask(0);
|
||||
PixelType *pwLine;
|
||||
int nWidth;
|
||||
|
||||
pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1);
|
||||
if(!pReg)
|
||||
return NullRegion;
|
||||
FirstRect = REGION_BOXPTR(pReg);
|
||||
rects = FirstRect;
|
||||
|
||||
pwLine = (PixelType *) pPix->devPrivate.ptr;
|
||||
nWidth = pPix->devKind / PGSZB;
|
||||
|
||||
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(*pw & mask0) {
|
||||
fInBox = TRUE;
|
||||
rx1 = 0;
|
||||
}
|
||||
else
|
||||
fInBox = FALSE;
|
||||
/* Process all words which are fully in the pixmap */
|
||||
pwLineEnd = pw + (width >> PWSH);
|
||||
for (base = 0; pw < pwLineEnd; base += PPW) {
|
||||
w = *pw++;
|
||||
if (fInBox) {
|
||||
if (!~w)
|
||||
continue;
|
||||
} else {
|
||||
if (!w)
|
||||
continue;
|
||||
}
|
||||
for(ib = 0; ib < PPW; 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 = SCRLEFT(w, 1);
|
||||
}
|
||||
}
|
||||
if(width & PIM) {
|
||||
/* Process final partial word on line */
|
||||
w = *pw++;
|
||||
for(ib = 0; ib < (width & PIM); 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 = SCRLEFT(w, 1);
|
||||
}
|
||||
}
|
||||
/* If scanline ended with last bit set, end the box */
|
||||
if(fInBox) {
|
||||
ADDRECT(pReg, rects, FirstRect,
|
||||
rx1, h, base + (width & PIM), 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 = REGION_BOXPTR(pReg)->y1;
|
||||
pReg->extents.y2 = REGION_END(pReg)->y2;
|
||||
if (pReg->data->numRects == 1) {
|
||||
xfree(pReg->data);
|
||||
pReg->data = (RegDataPtr)NULL;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (!miValidRegion(pReg))
|
||||
FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
|
||||
#endif
|
||||
return(pReg);
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/************************************************************
|
||||
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
|
||||
|
||||
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 no-
|
||||
tice appear in all copies and that both that copyright no-
|
||||
tice and this permission notice appear in supporting docu-
|
||||
mentation, and that the names of Sun or X Consortium
|
||||
not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific prior
|
||||
written permission. Sun and X Consortium make no
|
||||
representations about the suitability of this software for
|
||||
any purpose. It is provided "as is" without any express or
|
||||
implied warranty.
|
||||
|
||||
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
|
||||
ABLE 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/Xproto.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "colormapst.h"
|
||||
#include "resource.h"
|
||||
#include "micmap.h"
|
||||
#include "afb.h"
|
||||
|
||||
int
|
||||
afbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
|
||||
{
|
||||
return miListInstalledColormaps(pScreen, pmaps);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
afbInstallColormap(ColormapPtr pmap)
|
||||
{
|
||||
miInstallColormap(pmap);
|
||||
}
|
||||
|
||||
void
|
||||
afbUninstallColormap(ColormapPtr pmap)
|
||||
{
|
||||
miUninstallColormap(pmap);
|
||||
}
|
||||
|
||||
void
|
||||
afbResolveColor(short unsigned int *pred, short unsigned int *pgreen, short unsigned int *pblue, register VisualPtr pVisual)
|
||||
{
|
||||
miResolveColor(pred, pgreen, pblue, pVisual);
|
||||
}
|
||||
|
||||
Bool
|
||||
afbInitializeColormap(register ColormapPtr pmap)
|
||||
{
|
||||
return miInitializeColormap(pmap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a list of formats for a screen, create a list
|
||||
* of visuals and depths for the screen which correspond to
|
||||
* the set which can be used with this version of afb.
|
||||
*/
|
||||
|
||||
Bool
|
||||
afbInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, long unsigned int sizes, int bitsPerRGB)
|
||||
{
|
||||
return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
|
||||
defaultVisp, sizes, bitsPerRGB, -1);
|
||||
}
|
||||
347
afb/afbfillarc.c
347
afb/afbfillarc.c
|
|
@ -1,347 +0,0 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright (c) 1989 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
********************************************************/
|
||||
|
||||
|
||||
#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 "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mifillarc.h"
|
||||
#include "mi.h"
|
||||
|
||||
static void
|
||||
afbFillEllipseSolid(DrawablePtr pDraw, xArc *arc, register unsigned char *rrops)
|
||||
{
|
||||
int x, y, e;
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg;
|
||||
register int slw;
|
||||
miFillArcRec info;
|
||||
PixelType *addrlt, *addrlb;
|
||||
register PixelType *pdst;
|
||||
PixelType *addrl;
|
||||
register int n;
|
||||
register int d;
|
||||
int nlwidth;
|
||||
register int xpos;
|
||||
PixelType startmask, endmask;
|
||||
int nlmiddle;
|
||||
int depthDst;
|
||||
int sizeDst;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
|
||||
addrlt);
|
||||
miFillArcSetup(arc, &info);
|
||||
MIFILLARCSETUP();
|
||||
xorg += pDraw->x;
|
||||
yorg += pDraw->y;
|
||||
addrlb = addrlt;
|
||||
addrlt += nlwidth * (yorg - y);
|
||||
addrlb += nlwidth * (yorg + y + dy);
|
||||
while (y) {
|
||||
addrlt += nlwidth;
|
||||
addrlb -= nlwidth;
|
||||
MIFILLARCSTEP(slw);
|
||||
if (!slw)
|
||||
continue;
|
||||
xpos = xorg - x;
|
||||
pdst = addrl = afbScanlineOffset(addrlt, (xpos >> PWSH));
|
||||
if (((xpos & PIM) + slw) < PPW) {
|
||||
maskpartialbits(xpos, slw, startmask);
|
||||
for (d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
*pdst &= ~startmask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*pdst |= startmask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*pdst ^= startmask;
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (miFillArcLower(slw)) {
|
||||
pdst = afbScanlineOffset(addrlb, (xpos >> PWSH));
|
||||
|
||||
for (d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
*pdst &= ~startmask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*pdst |= startmask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*pdst ^= startmask;
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
maskbits(xpos, slw, startmask, endmask, nlmiddle);
|
||||
for (d = 0; d < depthDst; d++, addrl += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
n = nlmiddle;
|
||||
pdst = addrl;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
if (startmask)
|
||||
*pdst++ &= ~startmask;
|
||||
while (n--)
|
||||
*pdst++ = 0;
|
||||
if (endmask)
|
||||
*pdst &= ~endmask;
|
||||
break;
|
||||
|
||||
case RROP_WHITE:
|
||||
if (startmask)
|
||||
*pdst++ |= startmask;
|
||||
while (n--)
|
||||
*pdst++ = ~0;
|
||||
if (endmask)
|
||||
*pdst |= endmask;
|
||||
break;
|
||||
|
||||
case RROP_INVERT:
|
||||
if (startmask)
|
||||
*pdst++ ^= startmask;
|
||||
while (n--)
|
||||
*pdst++ ^= ~0;
|
||||
if (endmask)
|
||||
*pdst ^= endmask;
|
||||
break;
|
||||
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!miFillArcLower(slw))
|
||||
continue;
|
||||
addrl = afbScanlineOffset(addrlb, (xpos >> PWSH));
|
||||
for (d = 0; d < depthDst; d++, addrl += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
n = nlmiddle;
|
||||
pdst = addrl;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
if (startmask)
|
||||
*pdst++ &= ~startmask;
|
||||
while (n--)
|
||||
*pdst++ = 0;
|
||||
if (endmask)
|
||||
*pdst &= ~endmask;
|
||||
break;
|
||||
|
||||
case RROP_WHITE:
|
||||
if (startmask)
|
||||
*pdst++ |= startmask;
|
||||
while (n--)
|
||||
*pdst++ = ~0;
|
||||
if (endmask)
|
||||
*pdst |= endmask;
|
||||
break;
|
||||
|
||||
case RROP_INVERT:
|
||||
if (startmask)
|
||||
*pdst++ ^= startmask;
|
||||
while (n--)
|
||||
*pdst++ ^= ~0;
|
||||
if (endmask)
|
||||
*pdst ^= endmask;
|
||||
break;
|
||||
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define FILLSPAN(xl,xr,addr) \
|
||||
if (xr >= xl) { \
|
||||
width = xr - xl + 1; \
|
||||
addrl = afbScanlineOffset(addr, (xl >> PWSH)); \
|
||||
if (((xl & PIM) + width) < PPW) { \
|
||||
maskpartialbits(xl, width, startmask); \
|
||||
for (pdst = addrl, d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */ \
|
||||
switch (rrops[d]) { \
|
||||
case RROP_BLACK: \
|
||||
*pdst &= ~startmask; \
|
||||
break; \
|
||||
case RROP_WHITE: \
|
||||
*pdst |= startmask; \
|
||||
break; \
|
||||
case RROP_INVERT: \
|
||||
*pdst ^= startmask; \
|
||||
break; \
|
||||
case RROP_NOP: \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} else { \
|
||||
maskbits(xl, width, startmask, endmask, nlmiddle); \
|
||||
for (d = 0; d < depthDst; d++, addrl += sizeDst) { /* @@@ NEXT PLANE @@@ */ \
|
||||
n = nlmiddle; \
|
||||
pdst = addrl; \
|
||||
switch (rrops[d]) { \
|
||||
case RROP_BLACK: \
|
||||
if (startmask) \
|
||||
*pdst++ &= ~startmask; \
|
||||
while (n--) \
|
||||
*pdst++ = 0; \
|
||||
if (endmask) \
|
||||
*pdst &= ~endmask; \
|
||||
break; \
|
||||
case RROP_WHITE: \
|
||||
if (startmask) \
|
||||
*pdst++ |= startmask; \
|
||||
while (n--) \
|
||||
*pdst++ = ~0; \
|
||||
if (endmask) \
|
||||
*pdst |= endmask; \
|
||||
break; \
|
||||
case RROP_INVERT: \
|
||||
if (startmask) \
|
||||
*pdst++ ^= startmask; \
|
||||
while (n--) \
|
||||
*pdst++ ^= ~0; \
|
||||
if (endmask) \
|
||||
*pdst ^= endmask; \
|
||||
break; \
|
||||
case RROP_NOP: \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define FILLSLICESPANS(flip,addr) \
|
||||
if (!flip) { \
|
||||
FILLSPAN(xl, xr, addr); \
|
||||
} else { \
|
||||
xc = xorg - x; \
|
||||
FILLSPAN(xc, xr, addr); \
|
||||
xc += slw - 1; \
|
||||
FILLSPAN(xl, xc, addr); \
|
||||
}
|
||||
|
||||
static void
|
||||
afbFillArcSliceSolidCopy(DrawablePtr pDraw, GCPtr pGC, xArc *arc, register unsigned char *rrops)
|
||||
{
|
||||
PixelType *addrl;
|
||||
register PixelType *pdst;
|
||||
register int n;
|
||||
register int d;
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
|
||||
register int x, y, e;
|
||||
miFillArcRec info;
|
||||
miArcSliceRec slice;
|
||||
int xl, xr, xc;
|
||||
PixelType *addrlt, *addrlb;
|
||||
int nlwidth;
|
||||
int width;
|
||||
PixelType startmask, endmask;
|
||||
int nlmiddle;
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
|
||||
addrlt);
|
||||
miFillArcSetup(arc, &info);
|
||||
miFillArcSliceSetup(arc, &slice, pGC);
|
||||
MIFILLARCSETUP();
|
||||
xorg += pDraw->x;
|
||||
yorg += pDraw->y;
|
||||
addrlb = addrlt;
|
||||
addrlt = afbScanlineDeltaNoBankSwitch(addrlt, yorg - y, nlwidth);
|
||||
addrlb = afbScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, nlwidth);
|
||||
slice.edge1.x += pDraw->x;
|
||||
slice.edge2.x += pDraw->x;
|
||||
while (y > 0) {
|
||||
afbScanlineIncNoBankSwitch(addrlt, nlwidth);
|
||||
afbScanlineIncNoBankSwitch(addrlb, -nlwidth);
|
||||
MIFILLARCSTEP(slw);
|
||||
MIARCSLICESTEP(slice.edge1);
|
||||
MIARCSLICESTEP(slice.edge2);
|
||||
if (miFillSliceUpper(slice)) {
|
||||
MIARCSLICEUPPER(xl, xr, slice, slw);
|
||||
FILLSLICESPANS(slice.flip_top, addrlt);
|
||||
}
|
||||
if (miFillSliceLower(slice)) {
|
||||
MIARCSLICELOWER(xl, xr, slice, slw);
|
||||
FILLSLICESPANS(slice.flip_bot, addrlb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
afbPolyFillArcSolid(register DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
|
||||
{
|
||||
afbPrivGC *priv;
|
||||
register xArc *arc;
|
||||
register int i;
|
||||
BoxRec box;
|
||||
RegionPtr cclip;
|
||||
unsigned char *rrops;
|
||||
|
||||
priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
rrops = priv->rrops;
|
||||
cclip = pGC->pCompositeClip;
|
||||
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;
|
||||
box.x2 = box.x1 + (int)arc->width + 1;
|
||||
box.y2 = box.y1 + (int)arc->height + 1;
|
||||
if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) {
|
||||
if ((arc->angle2 >= FULLCIRCLE) ||
|
||||
(arc->angle2 <= -FULLCIRCLE))
|
||||
afbFillEllipseSolid(pDraw, arc, rrops);
|
||||
else
|
||||
afbFillArcSliceSolidCopy(pDraw, pGC, arc, rrops);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
miPolyFillArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
}
|
||||
292
afb/afbfillrct.c
292
afb/afbfillrct.c
|
|
@ -1,292 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#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 "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#define MODEQ(a, b) ((a) %= (b))
|
||||
|
||||
/*
|
||||
filled rectangles.
|
||||
translate the rectangles, clip them, and call the
|
||||
helper function in the GC.
|
||||
*/
|
||||
|
||||
#define NUM_STACK_RECTS 1024
|
||||
|
||||
void
|
||||
afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit)
|
||||
|
||||
|
||||
/* number of rectangles to fill */
|
||||
/* Pointer to first rectangle to fill */
|
||||
{
|
||||
xRectangle *prect;
|
||||
RegionPtr prgnClip;
|
||||
register BoxPtr pbox;
|
||||
register BoxPtr pboxClipped;
|
||||
BoxPtr pboxClippedBase;
|
||||
BoxPtr pextent;
|
||||
BoxRec stackRects[NUM_STACK_RECTS];
|
||||
int numRects;
|
||||
int n;
|
||||
int xorg, yorg;
|
||||
afbPrivGC *priv;
|
||||
unsigned char *rrops;
|
||||
unsigned char *rropsOS;
|
||||
|
||||
priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
prgnClip = pGC->pCompositeClip;
|
||||
rrops = priv->rrops;
|
||||
rropsOS = priv->rropOS;
|
||||
|
||||
prect = prectInit;
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
if (xorg || yorg) {
|
||||
prect = prectInit;
|
||||
n = nrectFill;
|
||||
Duff(n, prect->x += xorg; prect->y += yorg; prect++);
|
||||
}
|
||||
|
||||
prect = prectInit;
|
||||
|
||||
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
|
||||
if (numRects > NUM_STACK_RECTS) {
|
||||
pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
|
||||
if (!pboxClippedBase)
|
||||
return;
|
||||
}
|
||||
else
|
||||
pboxClippedBase = stackRects;
|
||||
|
||||
pboxClipped = pboxClippedBase;
|
||||
|
||||
if (REGION_NUM_RECTS(prgnClip) == 1) {
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_RECTS(prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--) {
|
||||
if ((pboxClipped->x1 = prect->x) < x1)
|
||||
pboxClipped->x1 = x1;
|
||||
|
||||
if ((pboxClipped->y1 = prect->y) < y1)
|
||||
pboxClipped->y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
pboxClipped->x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
pboxClipped->y2 = by2;
|
||||
|
||||
prect++;
|
||||
if ((pboxClipped->x1 < pboxClipped->x2) &&
|
||||
(pboxClipped->y1 < pboxClipped->y2)) {
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--) {
|
||||
BoxRec box;
|
||||
|
||||
if ((box.x1 = prect->x) < x1)
|
||||
box.x1 = x1;
|
||||
|
||||
if ((box.y1 = prect->y) < y1)
|
||||
box.y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
box.x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
box.y2 = by2;
|
||||
|
||||
prect++;
|
||||
|
||||
if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
|
||||
continue;
|
||||
|
||||
n = REGION_NUM_RECTS (prgnClip);
|
||||
pbox = REGION_RECTS(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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pboxClipped != pboxClippedBase) {
|
||||
switch (pGC->fillStyle) {
|
||||
case FillSolid:
|
||||
afbSolidFillArea(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, rrops);
|
||||
break;
|
||||
case FillTiled:
|
||||
switch (pGC->alu) {
|
||||
case GXcopy:
|
||||
if (pGC->pRotatedPixmap)
|
||||
afbTileAreaPPWCopy(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, GXcopy,
|
||||
pGC->pRotatedPixmap, pGC->planemask);
|
||||
else
|
||||
afbTileAreaCopy (pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, GXcopy,
|
||||
pGC->tile.pixmap,
|
||||
pGC->patOrg.x, pGC->patOrg.y,
|
||||
pGC->planemask);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (pGC->pRotatedPixmap)
|
||||
afbTileAreaPPWGeneral(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC->alu,
|
||||
pGC->pRotatedPixmap,
|
||||
pGC->planemask);
|
||||
else
|
||||
afbTileAreaGeneral(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC->alu,
|
||||
pGC->tile.pixmap,
|
||||
pGC->patOrg.x, pGC->patOrg.y,
|
||||
pGC->planemask);
|
||||
break;
|
||||
} /* switch (alu) */
|
||||
break;
|
||||
|
||||
case FillStippled:
|
||||
if (pGC->pRotatedPixmap)
|
||||
afbStippleAreaPPW(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC->pRotatedPixmap, rrops);
|
||||
else
|
||||
afbStippleArea(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC->stipple,
|
||||
pGC->patOrg.x, pGC->patOrg.y, rrops);
|
||||
break;
|
||||
|
||||
case FillOpaqueStippled:
|
||||
switch (pGC->alu) {
|
||||
case GXcopy:
|
||||
if (pGC->pRotatedPixmap)
|
||||
afbOpaqueStippleAreaPPWCopy(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, GXcopy,
|
||||
pGC->pRotatedPixmap,
|
||||
rropsOS, pGC->planemask);
|
||||
else
|
||||
afbOpaqueStippleAreaCopy(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, GXcopy,
|
||||
pGC->stipple,
|
||||
pGC->patOrg.x, pGC->patOrg.y, rropsOS,
|
||||
pGC->planemask);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (pGC->pRotatedPixmap)
|
||||
afbOpaqueStippleAreaPPWGeneral(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC->alu,
|
||||
pGC->pRotatedPixmap,
|
||||
rropsOS,
|
||||
pGC->planemask);
|
||||
else
|
||||
afbOpaqueStippleAreaGeneral(pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC->alu,
|
||||
pGC->stipple,
|
||||
pGC->patOrg.x, pGC->patOrg.y,
|
||||
rropsOS,
|
||||
pGC->planemask);
|
||||
break;
|
||||
} /* switch (alu) */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pboxClippedBase != stackRects)
|
||||
xfree(pboxClippedBase);
|
||||
}
|
||||
1130
afb/afbfillsp.c
1130
afb/afbfillsp.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "afb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
afbRealizeFont( pscr, pFont)
|
||||
ScreenPtr pscr;
|
||||
FontPtr pFont;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
afbUnrealizeFont( pscr, pFont)
|
||||
ScreenPtr pscr;
|
||||
FontPtr pFont;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
685
afb/afbgc.c
685
afb/afbgc.c
|
|
@ -1,685 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "afb.h"
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "region.h"
|
||||
|
||||
#include "mistruct.h"
|
||||
#include "migc.h"
|
||||
|
||||
#include "maskbits.h"
|
||||
|
||||
static void afbDestroyGC(GCPtr);
|
||||
static void afbValidateGC(GCPtr, unsigned long, DrawablePtr);
|
||||
|
||||
static GCFuncs afbFuncs = {
|
||||
afbValidateGC,
|
||||
miChangeGC,
|
||||
miCopyGC,
|
||||
afbDestroyGC,
|
||||
miChangeClip,
|
||||
miDestroyClip,
|
||||
miCopyClip
|
||||
};
|
||||
|
||||
static GCOps afbGCOps = {
|
||||
afbSolidFS,
|
||||
afbSetSpans,
|
||||
afbPutImage,
|
||||
afbCopyArea,
|
||||
miCopyPlane,
|
||||
afbPolyPoint,
|
||||
afbLineSS,
|
||||
afbSegmentSS,
|
||||
miPolyRectangle,
|
||||
afbZeroPolyArcSS,
|
||||
afbFillPolygonSolid,
|
||||
afbPolyFillRect,
|
||||
afbPolyFillArcSolid,
|
||||
miPolyText8,
|
||||
miPolyText16,
|
||||
miImageText8,
|
||||
miImageText16,
|
||||
afbTEGlyphBlt,
|
||||
afbPolyGlyphBlt,
|
||||
afbPushPixels
|
||||
};
|
||||
|
||||
static void
|
||||
afbReduceOpaqueStipple(PixelType fg, PixelType bg, unsigned long planemask,
|
||||
int depth, unsigned char *rop)
|
||||
{
|
||||
register int d;
|
||||
register Pixel mask = 1;
|
||||
|
||||
bg ^= fg;
|
||||
|
||||
for (d = 0; d < depth; d++, mask <<= 1) {
|
||||
if (!(planemask & mask))
|
||||
rop[d] = RROP_NOP;
|
||||
else if (!(bg & mask)) {
|
||||
/* Both fg and bg have a 0 or 1 in this plane */
|
||||
if (fg & mask)
|
||||
rop[d] = RROP_WHITE;
|
||||
else
|
||||
rop[d] = RROP_BLACK;
|
||||
} else {
|
||||
/* Both fg and bg have different bits on this plane */
|
||||
if (fg & mask)
|
||||
rop[d] = RROP_COPY;
|
||||
else
|
||||
rop[d] = RROP_INVERT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
afbCreateGC(pGC)
|
||||
register GCPtr pGC;
|
||||
{
|
||||
afbPrivGC *pPriv;
|
||||
|
||||
pGC->clientClip = NULL;
|
||||
pGC->clientClipType = CT_NONE;
|
||||
|
||||
/* some of the output primitives aren't really necessary, since
|
||||
they will be filled in ValidateGC because of dix/CreateGC()
|
||||
setting all the change bits. Others are necessary because although
|
||||
they depend on being a monochrome frame buffer, they don't change
|
||||
*/
|
||||
|
||||
pGC->ops = &afbGCOps;
|
||||
pGC->funcs = &afbFuncs;
|
||||
|
||||
/* afb wants to translate before scan convesion */
|
||||
pGC->miTranslate = 1;
|
||||
|
||||
pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
|
||||
pPriv->rrops);
|
||||
afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
||||
pGC->depth, pPriv->rropOS);
|
||||
|
||||
pGC->fExpose = TRUE;
|
||||
pGC->pRotatedPixmap = NullPixmap;
|
||||
pGC->freeCompClip = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
afbComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable)
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
WindowPtr pWin = (WindowPtr) pDrawable;
|
||||
RegionPtr pregWin;
|
||||
Bool freeTmpClip, freeCompClip;
|
||||
|
||||
if (pGC->subWindowMode == IncludeInferiors) {
|
||||
pregWin = NotClippedByChildren(pWin);
|
||||
freeTmpClip = TRUE;
|
||||
} else {
|
||||
pregWin = &pWin->clipList;
|
||||
freeTmpClip = FALSE;
|
||||
}
|
||||
freeCompClip = pGC->freeCompClip;
|
||||
|
||||
/*
|
||||
* if there is no client clip, we can get by with just keeping the
|
||||
* pointer we got, and remembering whether or not should destroy (or
|
||||
* maybe re-use) it later. this way, we avoid unnecessary copying of
|
||||
* regions. (this wins especially if many clients clip by children
|
||||
* and have no client clip.)
|
||||
*/
|
||||
if (pGC->clientClipType == CT_NONE) {
|
||||
if (freeCompClip)
|
||||
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
||||
pGC->pCompositeClip = pregWin;
|
||||
pGC->freeCompClip = freeTmpClip;
|
||||
} else {
|
||||
/*
|
||||
* we need one 'real' region to put into the composite clip. if
|
||||
* pregWin the current composite clip are real, we can get rid of
|
||||
* one. if pregWin is real and the current composite clip isn't,
|
||||
* use pregWin for the composite clip. if the current composite
|
||||
* clip is real and pregWin isn't, use the current composite
|
||||
* clip. if neither is real, create a new region.
|
||||
*/
|
||||
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
||||
pDrawable->x + pGC->clipOrg.x,
|
||||
pDrawable->y + pGC->clipOrg.y);
|
||||
|
||||
if (freeCompClip) {
|
||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
|
||||
pGC->clientClip);
|
||||
if (freeTmpClip)
|
||||
REGION_DESTROY(pGC->pScreen, pregWin);
|
||||
} else if (freeTmpClip) {
|
||||
REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip);
|
||||
pGC->pCompositeClip = pregWin;
|
||||
} else {
|
||||
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
|
||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||
pregWin, pGC->clientClip);
|
||||
}
|
||||
pGC->freeCompClip = TRUE;
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
||||
-(pDrawable->x + pGC->clipOrg.x),
|
||||
-(pDrawable->y + pGC->clipOrg.y));
|
||||
}
|
||||
} /* end of composite clip for a window */
|
||||
else {
|
||||
BoxRec pixbounds;
|
||||
|
||||
/* XXX should we translate by drawable.x/y here ? */
|
||||
pixbounds.x1 = 0;
|
||||
pixbounds.y1 = 0;
|
||||
pixbounds.x2 = pDrawable->width;
|
||||
pixbounds.y2 = pDrawable->height;
|
||||
|
||||
if (pGC->freeCompClip) {
|
||||
REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
|
||||
} else {
|
||||
pGC->freeCompClip = TRUE;
|
||||
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
|
||||
}
|
||||
|
||||
if (pGC->clientClipType == CT_REGION) {
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
|
||||
-pGC->clipOrg.y);
|
||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||
pGC->pCompositeClip, pGC->clientClip);
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
|
||||
pGC->clipOrg.y);
|
||||
}
|
||||
} /* end of composite clip for pixmap */
|
||||
} /* end afbComputeCompositeClip */
|
||||
|
||||
/* Clipping conventions
|
||||
if the drawable is a window
|
||||
CT_REGION ==> pCompositeClip really is the composite
|
||||
CT_other ==> pCompositeClip is the window clip region
|
||||
if the drawable is a pixmap
|
||||
CT_REGION ==> pCompositeClip is the translated client region
|
||||
clipped to the pixmap boundary
|
||||
CT_other ==> pCompositeClip is the pixmap bounding box
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
afbValidateGC(pGC, changes, pDrawable)
|
||||
register GCPtr pGC;
|
||||
unsigned long changes;
|
||||
DrawablePtr pDrawable;
|
||||
{
|
||||
register afbPrivGCPtr devPriv;
|
||||
int mask; /* stateChanges */
|
||||
int index; /* used for stepping through bitfields */
|
||||
int xrot, yrot; /* rotations for tile and stipple pattern */
|
||||
/* flags for changing the proc vector
|
||||
and updating things in devPriv
|
||||
*/
|
||||
int new_rotate, new_rrop, new_line, new_text, new_fill;
|
||||
DDXPointRec oldOrg; /* origin of thing GC was last used with */
|
||||
|
||||
oldOrg = pGC->lastWinOrg;
|
||||
|
||||
pGC->lastWinOrg.x = pDrawable->x;
|
||||
pGC->lastWinOrg.y = pDrawable->y;
|
||||
|
||||
/* we need to re-rotate the tile if the previous window/pixmap
|
||||
origin (oldOrg) differs from the new window/pixmap origin
|
||||
(pGC->lastWinOrg)
|
||||
*/
|
||||
new_rotate = (oldOrg.x != pGC->lastWinOrg.x) ||
|
||||
(oldOrg.y != pGC->lastWinOrg.y);
|
||||
|
||||
|
||||
devPriv = (afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
|
||||
/*
|
||||
if the client clip is different or moved OR
|
||||
the subwindowMode has changed OR
|
||||
the window's clip has changed since the last validation
|
||||
we need to recompute the composite clip
|
||||
*/
|
||||
if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
|
||||
(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
|
||||
afbComputeCompositeClip(pGC, pDrawable);
|
||||
|
||||
new_rrop = FALSE;
|
||||
new_line = FALSE;
|
||||
new_text = FALSE;
|
||||
new_fill = FALSE;
|
||||
|
||||
mask = changes;
|
||||
while (mask) {
|
||||
index = lowbit(mask);
|
||||
mask &= ~index;
|
||||
|
||||
/* this switch acculmulates a list of which procedures
|
||||
might have to change due to changes in the GC. in
|
||||
some cases (e.g. changing one 16 bit tile for another)
|
||||
we might not really need a change, but the code is
|
||||
being paranoid.
|
||||
this sort of batching wins if, for example, the alu
|
||||
and the font have been changed, or any other pair
|
||||
of items that both change the same thing.
|
||||
*/
|
||||
switch (index) {
|
||||
case GCPlaneMask:
|
||||
case GCFunction:
|
||||
case GCForeground:
|
||||
new_rrop = TRUE;
|
||||
break;
|
||||
case GCBackground:
|
||||
new_rrop = TRUE; /* for opaque stipples */
|
||||
break;
|
||||
case GCLineStyle:
|
||||
case GCLineWidth:
|
||||
case GCJoinStyle:
|
||||
new_line = TRUE;
|
||||
break;
|
||||
case GCCapStyle:
|
||||
break;
|
||||
case GCFillStyle:
|
||||
new_fill = TRUE;
|
||||
break;
|
||||
case GCFillRule:
|
||||
break;
|
||||
case GCTile:
|
||||
if(pGC->tileIsPixel)
|
||||
break;
|
||||
new_rotate = TRUE;
|
||||
new_fill = TRUE;
|
||||
break;
|
||||
|
||||
case GCStipple:
|
||||
if(pGC->stipple == (PixmapPtr)NULL)
|
||||
break;
|
||||
new_rotate = TRUE;
|
||||
new_fill = TRUE;
|
||||
break;
|
||||
|
||||
case GCTileStipXOrigin:
|
||||
new_rotate = TRUE;
|
||||
break;
|
||||
|
||||
case GCTileStipYOrigin:
|
||||
new_rotate = TRUE;
|
||||
break;
|
||||
|
||||
case GCFont:
|
||||
new_text = TRUE;
|
||||
break;
|
||||
case GCSubwindowMode:
|
||||
break;
|
||||
case GCGraphicsExposures:
|
||||
break;
|
||||
case GCClipXOrigin:
|
||||
break;
|
||||
case GCClipYOrigin:
|
||||
break;
|
||||
case GCClipMask:
|
||||
break;
|
||||
case GCDashOffset:
|
||||
break;
|
||||
case GCDashList:
|
||||
break;
|
||||
case GCArcMode:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* deal with the changes we've collected .
|
||||
new_rrop must be done first because subsequent things
|
||||
depend on it.
|
||||
*/
|
||||
|
||||
if(new_rotate || new_fill) {
|
||||
Bool new_pix = FALSE;
|
||||
|
||||
/* figure out how much to rotate */
|
||||
xrot = pGC->patOrg.x;
|
||||
yrot = pGC->patOrg.y;
|
||||
xrot += pDrawable->x;
|
||||
yrot += pDrawable->y;
|
||||
|
||||
switch (pGC->fillStyle) {
|
||||
case FillTiled:
|
||||
/* copy current tile and stipple */
|
||||
if (!pGC->tileIsPixel &&
|
||||
(pGC->tile.pixmap->drawable.width <= PPW) &&
|
||||
!(pGC->tile.pixmap->drawable.width &
|
||||
(pGC->tile.pixmap->drawable.width - 1))) {
|
||||
afbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
|
||||
xrot, yrot);
|
||||
new_pix = TRUE;
|
||||
}
|
||||
break;
|
||||
case FillStippled:
|
||||
case FillOpaqueStippled:
|
||||
if (pGC->stipple && (pGC->stipple->drawable.width <= PPW) &&
|
||||
!(pGC->stipple->drawable.width &
|
||||
(pGC->stipple->drawable.width - 1))) {
|
||||
afbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
|
||||
xrot, yrot);
|
||||
new_pix = TRUE;
|
||||
}
|
||||
}
|
||||
/* destroy any previously rotated tile or stipple */
|
||||
if (!new_pix && pGC->pRotatedPixmap) {
|
||||
(*pDrawable->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
|
||||
pGC->pRotatedPixmap = (PixmapPtr)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* duck out here when the GC is unchanged
|
||||
*/
|
||||
|
||||
if (!changes)
|
||||
return;
|
||||
|
||||
if (new_rrop || new_fill) {
|
||||
afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pDrawable->depth,
|
||||
devPriv->rrops);
|
||||
afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
||||
pGC->depth, devPriv->rropOS);
|
||||
new_fill = TRUE;
|
||||
}
|
||||
|
||||
if (new_line || new_fill || new_text) {
|
||||
if (!pGC->ops->devPrivate.val) {
|
||||
pGC->ops = miCreateGCOps(pGC->ops);
|
||||
pGC->ops->devPrivate.val = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_line || new_fill) {
|
||||
if (pGC->lineWidth == 0) {
|
||||
if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid)
|
||||
pGC->ops->PolyArc = afbZeroPolyArcSS;
|
||||
else
|
||||
pGC->ops->PolyArc = miZeroPolyArc;
|
||||
} else
|
||||
pGC->ops->PolyArc = miPolyArc;
|
||||
if (pGC->lineStyle == LineSolid) {
|
||||
if(pGC->lineWidth == 0) {
|
||||
if (pGC->fillStyle == FillSolid) {
|
||||
pGC->ops->PolySegment = afbSegmentSS;
|
||||
pGC->ops->Polylines = afbLineSS;
|
||||
}
|
||||
else
|
||||
{
|
||||
pGC->ops->PolySegment = miPolySegment;
|
||||
pGC->ops->Polylines = miZeroLine;
|
||||
}
|
||||
} else {
|
||||
pGC->ops->PolySegment = miPolySegment;
|
||||
pGC->ops->Polylines = miWideLine;
|
||||
}
|
||||
} else {
|
||||
if(pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) {
|
||||
pGC->ops->PolySegment = afbSegmentSD;
|
||||
pGC->ops->Polylines = afbLineSD;
|
||||
} else {
|
||||
pGC->ops->PolySegment = miPolySegment;
|
||||
pGC->ops->Polylines = miWideDash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_text || new_fill) {
|
||||
if ((pGC->font) &&
|
||||
(FONTMAXBOUNDS(pGC->font,rightSideBearing) -
|
||||
FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
|
||||
FONTMINBOUNDS(pGC->font,characterWidth) < 0)) {
|
||||
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
|
||||
pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
|
||||
} else {
|
||||
/* special case ImageGlyphBlt for terminal emulator fonts */
|
||||
if ((pGC->font) &&
|
||||
TERMINALFONT(pGC->font)) {
|
||||
pGC->ops->ImageGlyphBlt = afbTEGlyphBlt;
|
||||
} else {
|
||||
pGC->ops->ImageGlyphBlt = afbImageGlyphBlt;
|
||||
}
|
||||
|
||||
/* now do PolyGlyphBlt */
|
||||
if (pGC->fillStyle == FillSolid) {
|
||||
pGC->ops->PolyGlyphBlt = afbPolyGlyphBlt;
|
||||
} else {
|
||||
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_fill) {
|
||||
/* install a suitable fillspans and pushpixels */
|
||||
pGC->ops->PushPixels = afbPushPixels;
|
||||
pGC->ops->FillPolygon = miFillPolygon;
|
||||
pGC->ops->PolyFillArc = miPolyFillArc;
|
||||
|
||||
switch (pGC->fillStyle) {
|
||||
case FillSolid:
|
||||
pGC->ops->FillSpans = afbSolidFS;
|
||||
pGC->ops->FillPolygon = afbFillPolygonSolid;
|
||||
pGC->ops->PolyFillArc = afbPolyFillArcSolid;
|
||||
break;
|
||||
case FillTiled:
|
||||
if (pGC->pRotatedPixmap)
|
||||
pGC->ops->FillSpans = afbTileFS;
|
||||
else
|
||||
pGC->ops->FillSpans = afbUnnaturalTileFS;
|
||||
break;
|
||||
case FillOpaqueStippled:
|
||||
if (pGC->pRotatedPixmap)
|
||||
pGC->ops->FillSpans = afbOpaqueStippleFS;
|
||||
else
|
||||
pGC->ops->FillSpans = afbUnnaturalOpaqueStippleFS;
|
||||
break;
|
||||
|
||||
case FillStippled:
|
||||
if (pGC->pRotatedPixmap)
|
||||
pGC->ops->FillSpans = afbStippleFS;
|
||||
else
|
||||
pGC->ops->FillSpans = afbUnnaturalStippleFS;
|
||||
break;
|
||||
}
|
||||
} /* end of new_fill */
|
||||
}
|
||||
|
||||
static void
|
||||
afbDestroyGC(pGC)
|
||||
GCPtr pGC;
|
||||
{
|
||||
if (pGC->pRotatedPixmap)
|
||||
(*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
|
||||
if (pGC->freeCompClip)
|
||||
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
||||
miDestroyGCOps(pGC->ops);
|
||||
}
|
||||
|
||||
void
|
||||
afbReduceRop(alu, src, planemask, depth, rop)
|
||||
register int alu;
|
||||
register Pixel src;
|
||||
register unsigned long planemask;
|
||||
int depth;
|
||||
register unsigned char *rop;
|
||||
{
|
||||
register int d;
|
||||
register Pixel mask = 1;
|
||||
|
||||
for (d = 0; d < depth; d++, mask <<= 1) {
|
||||
if (!(planemask & mask))
|
||||
rop[d] = RROP_NOP;
|
||||
else if ((src & mask) == 0) /* src is black */
|
||||
switch (alu) {
|
||||
case GXclear:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXand:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXandReverse:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXcopy:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXandInverted:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXnoop:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXxor:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXor:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXnor:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXequiv:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXinvert:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXorReverse:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
case GXorInverted:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
case GXnand:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
case GXset:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
}
|
||||
else /* src is white */
|
||||
switch (alu) {
|
||||
case GXclear:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXand:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXandReverse:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXcopy:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
case GXandInverted:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXnoop:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXxor:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXor:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
case GXnor:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXequiv:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXinvert:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXorReverse:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
rop[d] = RROP_BLACK;
|
||||
break;
|
||||
case GXorInverted:
|
||||
rop[d] = RROP_NOP;
|
||||
break;
|
||||
case GXnand:
|
||||
rop[d] = RROP_INVERT;
|
||||
break;
|
||||
case GXset:
|
||||
rop[d] = RROP_WHITE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
165
afb/afbgetsp.c
165
afb/afbgetsp.c
|
|
@ -1,165 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "region.h"
|
||||
#include "gc.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "servermd.h"
|
||||
|
||||
/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
|
||||
* and continuing for pwidth[i] bits
|
||||
* Each scanline returned will be server scanline padded, i.e., it will come
|
||||
* out to an integral number of words.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
afbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
|
||||
DrawablePtr pDrawable; /* drawable from which to get bits */
|
||||
int wMax; /* largest value of all *pwidths */
|
||||
register DDXPointPtr ppt; /* points to start copying from */
|
||||
int *pwidth; /* list of number of bits to copy */
|
||||
int nspans; /* number of scanlines to copy */
|
||||
char *pchardstStart; /* where to put the bits */
|
||||
{
|
||||
PixelType *pdstStart = (PixelType *)pchardstStart;
|
||||
register PixelType *pdst; /* where to put the bits */
|
||||
register PixelType *psrc; /* where to get the bits */
|
||||
register PixelType tmpSrc; /* scratch buffer for bits */
|
||||
PixelType *psrcBase; /* start of src bitmap */
|
||||
int widthSrc; /* width of pixmap in bytes */
|
||||
int sizeSrc;
|
||||
int depthSrc;
|
||||
register DDXPointPtr pptLast; /* one past last point to get */
|
||||
int xEnd; /* last pixel to copy from */
|
||||
register int nstart;
|
||||
register int d;
|
||||
int nend = 0;
|
||||
int srcStartOver;
|
||||
PixelType startmask, endmask;
|
||||
unsigned int srcBit;
|
||||
int nlMiddle, nl;
|
||||
int w;
|
||||
|
||||
pptLast = ppt + nspans;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthSrc, sizeSrc, depthSrc,
|
||||
psrcBase);
|
||||
pdst = pdstStart;
|
||||
|
||||
while(ppt < pptLast) {
|
||||
/* XXX should this really be << PWSH, or * 8, or * PGSZB? */
|
||||
xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
|
||||
pwidth++;
|
||||
for (d = 0; d < depthSrc; d++) {
|
||||
psrc = afbScanline(psrcBase, ppt->x, ppt->y, widthSrc);
|
||||
psrcBase += sizeSrc; /* @@@ NEXT PLANE @@@ */
|
||||
w = xEnd - ppt->x;
|
||||
srcBit = ppt->x & PIM;
|
||||
|
||||
if (srcBit + w <= PPW)
|
||||
{
|
||||
getandputbits0(psrc, srcBit, w, pdst);
|
||||
pdst++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
maskbits(ppt->x, w, startmask, endmask, nlMiddle);
|
||||
if (startmask)
|
||||
nstart = PPW - srcBit;
|
||||
else
|
||||
nstart = 0;
|
||||
if (endmask)
|
||||
nend = xEnd & PIM;
|
||||
srcStartOver = srcBit + nstart > PLST;
|
||||
if (startmask)
|
||||
{
|
||||
getandputbits0(psrc, srcBit, nstart, pdst);
|
||||
if(srcStartOver)
|
||||
psrc++;
|
||||
}
|
||||
nl = nlMiddle;
|
||||
#ifdef FASTPUTBITS
|
||||
Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;);
|
||||
#else
|
||||
while (nl--)
|
||||
{
|
||||
tmpSrc = *psrc;
|
||||
putbits(tmpSrc, nstart, PPW, pdst);
|
||||
psrc++;
|
||||
pdst++;
|
||||
}
|
||||
#endif
|
||||
if (endmask)
|
||||
{
|
||||
putbits(*psrc, nstart, nend, pdst);
|
||||
if(nstart + nend > PPW)
|
||||
pdst++;
|
||||
}
|
||||
if (startmask || endmask)
|
||||
pdst++;
|
||||
}
|
||||
}
|
||||
ppt++;
|
||||
}
|
||||
}
|
||||
209
afb/afbhrzvert.c
209
afb/afbhrzvert.c
|
|
@ -1,209 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "gc.h"
|
||||
#include "window.h"
|
||||
#include "pixmap.h"
|
||||
#include "region.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/* horizontal solid line
|
||||
abs(len) > 1
|
||||
*/
|
||||
void
|
||||
afbHorzS(pbase, nlwidth, sizeDst, depthDst, x1, y1, len, rrops)
|
||||
PixelType *pbase; /* pointer to base of bitmap */
|
||||
register int nlwidth; /* width in longwords of bitmap */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int x1; /* initial point */
|
||||
int y1;
|
||||
int len; /* length of line */
|
||||
register unsigned char *rrops;
|
||||
{
|
||||
register PixelType *addrl;
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
register int nlmiddle;
|
||||
register int d;
|
||||
int saveNLmiddle;
|
||||
|
||||
/* force the line to go left to right
|
||||
but don't draw the last point
|
||||
*/
|
||||
if (len < 0) {
|
||||
x1 += len;
|
||||
x1 += 1;
|
||||
len = -len;
|
||||
}
|
||||
|
||||
/* all bits inside same longword */
|
||||
if ( ((x1 & PIM) + len) < PPW) {
|
||||
maskpartialbits(x1, len, startmask);
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(pbase, x1, y1, nlwidth);
|
||||
pbase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
*addrl &= ~startmask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*addrl |= startmask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*addrl ^= startmask;
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} /* for (d = ...) */
|
||||
} else {
|
||||
maskbits(x1, len, startmask, endmask, nlmiddle);
|
||||
saveNLmiddle = nlmiddle;
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(pbase, x1, y1, nlwidth);
|
||||
pbase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
nlmiddle = saveNLmiddle;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
if (startmask)
|
||||
*addrl++ &= ~startmask;
|
||||
Duff (nlmiddle, *addrl++ = 0x0);
|
||||
if (endmask)
|
||||
*addrl &= ~endmask;
|
||||
break;
|
||||
|
||||
case RROP_WHITE:
|
||||
if (startmask)
|
||||
*addrl++ |= startmask;
|
||||
Duff (nlmiddle, *addrl++ = ~0);
|
||||
if (endmask)
|
||||
*addrl |= endmask;
|
||||
break;
|
||||
|
||||
case RROP_INVERT:
|
||||
if (startmask)
|
||||
*addrl++ ^= startmask;
|
||||
Duff (nlmiddle, *addrl++ ^= ~0);
|
||||
if (endmask)
|
||||
*addrl ^= endmask;
|
||||
break;
|
||||
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} /* for (d = ... ) */
|
||||
}
|
||||
}
|
||||
|
||||
/* vertical solid line
|
||||
this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
|
||||
better code. sigh. we know that len will never be 0 or 1, so
|
||||
it's OK to use it.
|
||||
*/
|
||||
void
|
||||
afbVertS(pbase, nlwidth, sizeDst, depthDst, x1, y1, len, rrops)
|
||||
PixelType *pbase; /* pointer to base of bitmap */
|
||||
register int nlwidth; /* width in longwords of bitmap */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int x1, y1; /* initial point */
|
||||
register int len; /* length of line */
|
||||
unsigned char *rrops;
|
||||
{
|
||||
register PixelType *addrl;
|
||||
register PixelType bitmask;
|
||||
int saveLen;
|
||||
int d;
|
||||
|
||||
if (len < 0) {
|
||||
nlwidth = -nlwidth;
|
||||
len = -len;
|
||||
}
|
||||
|
||||
saveLen = len;
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(pbase, x1, y1, nlwidth);
|
||||
pbase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
len = saveLen;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
bitmask = mfbGetrmask(x1 & PIM);
|
||||
Duff(len, *addrl &= bitmask; afbScanlineInc(addrl, nlwidth) );
|
||||
break;
|
||||
|
||||
case RROP_WHITE:
|
||||
bitmask = mfbGetmask(x1 & PIM);
|
||||
Duff(len, *addrl |= bitmask; afbScanlineInc(addrl, nlwidth) );
|
||||
break;
|
||||
|
||||
case RROP_INVERT:
|
||||
bitmask = mfbGetmask(x1 & PIM);
|
||||
Duff(len, *addrl ^= bitmask; afbScanlineInc(addrl, nlwidth) );
|
||||
break;
|
||||
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} /* for (d = ...) */
|
||||
}
|
||||
272
afb/afbimage.c
272
afb/afbimage.c
|
|
@ -1,272 +0,0 @@
|
|||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
#include "servermd.h"
|
||||
#include "mfb.h"
|
||||
|
||||
void
|
||||
afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage)
|
||||
DrawablePtr pDraw;
|
||||
GCPtr pGC;
|
||||
int depth, x, y, width, height;
|
||||
int leftPad;
|
||||
int format;
|
||||
char *pImage;
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
if ((width == 0) || (height == 0))
|
||||
return;
|
||||
|
||||
if (format != ZPixmap || depth == 1 || pDraw->depth == 1) {
|
||||
pPixmap = GetScratchPixmapHeader(pDraw->pScreen, width+leftPad, height,
|
||||
depth, depth,
|
||||
BitmapBytePad(width+leftPad),
|
||||
(pointer)pImage);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
|
||||
pGC->fExpose = FALSE;
|
||||
if (format == XYBitmap)
|
||||
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
||||
0, width, height, x, y, 1);
|
||||
else {
|
||||
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
||||
0, width, height, x, y);
|
||||
}
|
||||
|
||||
pGC->fExpose = TRUE;
|
||||
FreeScratchPixmapHeader(pPixmap);
|
||||
} else {
|
||||
/* Chunky to planar conversion required */
|
||||
|
||||
PixmapPtr pPixmap;
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
int widthSrc;
|
||||
int start_srcshift;
|
||||
register int b;
|
||||
register int dstshift;
|
||||
register int shift_step;
|
||||
register PixelType dst;
|
||||
register PixelType srcbits;
|
||||
register PixelType *pdst;
|
||||
register PixelType *psrc;
|
||||
int start_bit;
|
||||
register int nl;
|
||||
register int h;
|
||||
register int d;
|
||||
int sizeDst;
|
||||
PixelType *pdstBase;
|
||||
int widthDst;
|
||||
int depthDst;
|
||||
|
||||
/* Create a tmp pixmap */
|
||||
pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth,
|
||||
CREATE_PIXMAP_USAGE_SCRATCH);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer((DrawablePtr)pPixmap, widthDst,
|
||||
sizeDst, depthDst, pdstBase);
|
||||
|
||||
widthSrc = PixmapWidthInPadUnits(width, depth);
|
||||
/* XXX: if depth == 8, use fast chunky to planar assembly function.*/
|
||||
if (depth > 4) {
|
||||
start_srcshift = 24;
|
||||
shift_step = 8;
|
||||
} else {
|
||||
start_srcshift = 28;
|
||||
shift_step = 4;
|
||||
}
|
||||
|
||||
for (d = 0; d < depth; d++, pdstBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
start_bit = start_srcshift + d;
|
||||
psrc = (PixelType *)pImage;
|
||||
pdst = pdstBase;
|
||||
h = height;
|
||||
|
||||
while (h--) {
|
||||
dstshift = PPW - 1;
|
||||
dst = 0;
|
||||
nl = widthSrc;
|
||||
while (nl--) {
|
||||
srcbits = *psrc++;
|
||||
for (b = start_bit; b >= 0; b -= shift_step) {
|
||||
dst |= ((srcbits >> b) & 1) << dstshift;
|
||||
if (--dstshift < 0) {
|
||||
dstshift = PPW - 1;
|
||||
*pdst++ = dst;
|
||||
dst = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dstshift != PPW - 1)
|
||||
*pdst++ = dst;
|
||||
}
|
||||
} /* for (d = ...) */
|
||||
|
||||
pGC->fExpose = FALSE;
|
||||
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
|
||||
width, height, x, y);
|
||||
pGC->fExpose = TRUE;
|
||||
(*pScreen->DestroyPixmap)(pPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
afbGetImage(pDrawable, sx, sy, width, height, format, planemask, pdstLine)
|
||||
DrawablePtr pDrawable;
|
||||
int sx, sy, width, height;
|
||||
unsigned int format;
|
||||
unsigned long planemask;
|
||||
char *pdstLine;
|
||||
{
|
||||
BoxRec box;
|
||||
DDXPointRec ptSrc;
|
||||
RegionRec rgnDst;
|
||||
ScreenPtr pScreen;
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
if ((width == 0) || (height == 0))
|
||||
return;
|
||||
|
||||
pScreen = pDrawable->pScreen;
|
||||
sx += pDrawable->x;
|
||||
sy += pDrawable->y;
|
||||
|
||||
if (format == XYPixmap || pDrawable->depth == 1) {
|
||||
pPixmap = GetScratchPixmapHeader(pScreen, width, height, 1, 1,
|
||||
BitmapBytePad(width), (pointer)pdstLine);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
|
||||
ptSrc.x = sx;
|
||||
ptSrc.y = sy;
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = width;
|
||||
box.y2 = height;
|
||||
REGION_INIT(pScreen, &rgnDst, &box, 1);
|
||||
|
||||
pPixmap->drawable.depth = 1;
|
||||
pPixmap->drawable.bitsPerPixel = 1;
|
||||
/* dix layer only ever calls GetImage with 1 bit set in planemask
|
||||
* when format is XYPixmap.
|
||||
*/
|
||||
afbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, &ptSrc,
|
||||
planemask);
|
||||
|
||||
FreeScratchPixmapHeader(pPixmap);
|
||||
REGION_UNINIT(pScreen, &rgnDst);
|
||||
} else {
|
||||
/* Planar to chunky conversion required */
|
||||
|
||||
PixelType *psrcBits;
|
||||
PixelType *psrcLine;
|
||||
PixelType startmask, endmask;
|
||||
int depthSrc;
|
||||
int widthSrc;
|
||||
int sizeSrc;
|
||||
int sizeDst;
|
||||
int widthDst;
|
||||
register PixelType *psrc;
|
||||
register PixelType *pdst;
|
||||
register PixelType dst;
|
||||
register PixelType srcbits;
|
||||
register int d;
|
||||
register int b;
|
||||
register int dstshift;
|
||||
register int shift_step;
|
||||
register int start_endbit;
|
||||
int start_startbit;
|
||||
register int end_endbit = 0;
|
||||
register int start_dstshift;
|
||||
register int nl;
|
||||
register int h;
|
||||
int nlmiddle;
|
||||
|
||||
widthDst = PixmapWidthInPadUnits(width, pDrawable->depth);
|
||||
sizeDst = widthDst * height;
|
||||
|
||||
/* Clear the dest image */
|
||||
bzero(pdstLine, sizeDst << 2);
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthSrc, sizeSrc,
|
||||
depthSrc, psrcBits);
|
||||
|
||||
psrcBits = afbScanline(psrcBits, sx, sy, widthSrc);
|
||||
|
||||
start_startbit = PPW - 1 - (sx & PIM);
|
||||
if ((sx & PIM) + width < PPW) {
|
||||
maskpartialbits(sx, width, startmask);
|
||||
nlmiddle = 0;
|
||||
endmask = 0;
|
||||
start_endbit = PPW - ((sx + width) & PIM);
|
||||
} else {
|
||||
maskbits(sx, width, startmask, endmask, nlmiddle);
|
||||
start_endbit = 0;
|
||||
end_endbit = PPW - ((sx + width) & PIM);
|
||||
}
|
||||
/* ZPixmap images have either 4 or 8 bits per pixel dependent on
|
||||
* depth.
|
||||
*/
|
||||
if (depthSrc > 4) {
|
||||
start_dstshift = 24;
|
||||
shift_step = 8;
|
||||
} else {
|
||||
start_dstshift = 28;
|
||||
shift_step = 4;
|
||||
}
|
||||
#define SHIFT_BITS(start_bit,end_bit) \
|
||||
for (b = (start_bit); b >= (end_bit); b--) { \
|
||||
dst |= ((srcbits >> b) & 1) << dstshift; \
|
||||
if ((dstshift -= shift_step) < 0) { \
|
||||
dstshift = start_dstshift + d; \
|
||||
*pdst++ = dst; \
|
||||
dst = *pdst; \
|
||||
} \
|
||||
} \
|
||||
|
||||
for (d = 0; d < depthSrc; d++, psrcBits += sizeSrc) { /* @@@ NEXT PLANE @@@ */
|
||||
psrcLine = psrcBits;
|
||||
pdst = (PixelType *)pdstLine;
|
||||
h = height;
|
||||
|
||||
while (h--) {
|
||||
psrc = psrcLine;
|
||||
psrcLine += widthSrc;
|
||||
dst = *pdst;
|
||||
dstshift = start_dstshift + d;
|
||||
|
||||
if (startmask) {
|
||||
srcbits = *psrc++ & startmask;
|
||||
SHIFT_BITS(start_startbit, start_endbit);
|
||||
}
|
||||
|
||||
nl = nlmiddle;
|
||||
while (nl--) {
|
||||
srcbits = *psrc++;
|
||||
SHIFT_BITS(PPW - 1, 0);
|
||||
}
|
||||
if (endmask) {
|
||||
srcbits = *psrc & endmask;
|
||||
SHIFT_BITS(PPW - 1, end_endbit);
|
||||
}
|
||||
|
||||
if (dstshift != start_dstshift + d)
|
||||
*pdst++ = dst;
|
||||
} /* while (h--) */
|
||||
} /* for (d = ...) */
|
||||
}
|
||||
}
|
||||
472
afb/afbimggblt.c
472
afb/afbimggblt.c
|
|
@ -1,472 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "afb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/*
|
||||
we should eventually special-case fixed-width fonts for ImageText.
|
||||
|
||||
this works for fonts with glyphs <= 32 bits wide.
|
||||
|
||||
the clipping calculations are done for worst-case fonts.
|
||||
we make no assumptions about the heights, widths, or bearings
|
||||
of the glyphs. if we knew that the glyphs are all the same height,
|
||||
we could clip the tops and bottoms per clipping box, rather
|
||||
than per character per clipping box. if we knew that the glyphs'
|
||||
left and right bearings were wlle-behaved, we could clip a single
|
||||
character at the start, output until the last unclipped
|
||||
character, and then clip the last one. this is all straightforward
|
||||
to determine based on max-bounds and min-bounds from the font.
|
||||
there is some inefficiency introduced in the per-character
|
||||
clipping to make what's going on clearer.
|
||||
|
||||
(it is possible, for example, for a font to be defined in which the
|
||||
next-to-last character in a font would be clipped out, but the last
|
||||
one wouldn't. the code below deals with this.)
|
||||
|
||||
Image text looks at the bits in the glyph and the fg and bg in the
|
||||
GC. it paints a rectangle, as defined in the protocol dcoument,
|
||||
and the paints the characters.
|
||||
|
||||
the register allocations for startmask and endmask may not
|
||||
be the right thing. are there two other deserving candidates?
|
||||
xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
|
||||
*/
|
||||
|
||||
void
|
||||
afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
||||
DrawablePtr pDrawable;
|
||||
GC *pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
pointer pglyphBase; /* start of array of glyphs */
|
||||
{
|
||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
||||
BoxRec bbox; /* string's bounding box */
|
||||
xRectangle backrect;/* backing rectangle to paint.
|
||||
in the general case, NOT necessarily
|
||||
the same as the string's bounding box
|
||||
*/
|
||||
|
||||
CharInfoPtr pci;
|
||||
int xorg, yorg; /* origin of drawable in bitmap */
|
||||
int widthDst; /* width of dst in longwords */
|
||||
|
||||
/* these keep track of the character origin */
|
||||
PixelType *pdstBase;
|
||||
/* points to longword with character origin */
|
||||
int xchar; /* xorigin of char (mod 32) */
|
||||
|
||||
/* these are used for placing the glyph */
|
||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
||||
register PixelType *pdst;
|
||||
/* pointer to current longword in dst */
|
||||
|
||||
register int d;
|
||||
int depthDst;
|
||||
int sizeDst;
|
||||
int hSave;
|
||||
int w; /* width of glyph in bits */
|
||||
int h; /* height of glyph */
|
||||
int widthGlyph; /* width of glyph, in bytes */
|
||||
unsigned char rrops[AFB_MAX_DEPTH];
|
||||
register unsigned char *pglyph;
|
||||
/* pointer to current row of glyph */
|
||||
unsigned char *pglyphSave;
|
||||
|
||||
/* used for putting down glyph */
|
||||
register PixelType tmpSrc;
|
||||
/* for getting bits from glyph */
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
|
||||
register int nFirst;/* bits of glyph in current longword */
|
||||
PixelType *pdstSave;
|
||||
int oldFill;
|
||||
afbPrivGC *pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
|
||||
pdstBase);
|
||||
|
||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
||||
|
||||
backrect.x = x;
|
||||
backrect.y = y - FONTASCENT(pGC->font);
|
||||
backrect.width = info.overallWidth;
|
||||
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
|
||||
|
||||
x += xorg;
|
||||
y += yorg;
|
||||
|
||||
bbox.x1 = x + info.overallLeft;
|
||||
bbox.x2 = x + info.overallRight;
|
||||
bbox.y1 = y - info.overallAscent;
|
||||
bbox.y2 = y + info.overallDescent;
|
||||
|
||||
oldFill = pGC->fillStyle;
|
||||
pGC->fillStyle = FillSolid;
|
||||
afbReduceRop (pGC->alu, pGC->bgPixel, pGC->planemask, pGC->depth,
|
||||
pPriv->rrops);
|
||||
afbPolyFillRect(pDrawable, pGC, 1, &backrect);
|
||||
pGC->fillStyle = oldFill;
|
||||
afbReduceRop (pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
|
||||
pPriv->rrops);
|
||||
afbReduceRop (GXcopy, pGC->fgPixel, pGC->planemask, pGC->depth, rrops);
|
||||
|
||||
/* the faint-hearted can open their eyes now */
|
||||
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
|
||||
case rgnOUT:
|
||||
break;
|
||||
case rgnIN:
|
||||
pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xchar = x & PIM;
|
||||
|
||||
while(nglyph--) {
|
||||
pci = *ppci;
|
||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
||||
hSave = pci->metrics.ascent + pci->metrics.descent;
|
||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
/* start at top scanline of glyph */
|
||||
pdstSave = afbScanlineDelta(pdstBase, -pci->metrics.ascent,
|
||||
widthDst);
|
||||
|
||||
/* find correct word in scanline and x offset within it
|
||||
for left edge of glyph
|
||||
*/
|
||||
xoff = xchar + pci->metrics.leftSideBearing;
|
||||
if (xoff > PLST) {
|
||||
pdstSave++;
|
||||
xoff &= PIM;
|
||||
} else if (xoff < 0) {
|
||||
xoff += PPW;
|
||||
pdstSave--;
|
||||
}
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
h = hSave;
|
||||
pdst = pdstSave;
|
||||
pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
pglyph = pglyphSave;
|
||||
|
||||
if ((xoff + w) <= PPW) {
|
||||
/* glyph all in one longword */
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* glyph crosses longword boundary */
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
||||
*(pdst+1) |= SCRLEFT(tmpSrc, nFirst) & endmask;
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} /* glyph crosses longwords boundary */
|
||||
} /* depth loop */
|
||||
/* update character origin */
|
||||
x += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST) {
|
||||
xchar -= PPW;
|
||||
pdstBase++;
|
||||
} else if (xchar < 0) {
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
ppci++;
|
||||
} /* while nglyph-- */
|
||||
break;
|
||||
case rgnPART:
|
||||
{
|
||||
afbTEXTPOS *ppos;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
RegionPtr cclip;
|
||||
int xpos; /* x position of char origin */
|
||||
int i;
|
||||
BoxRec clip;
|
||||
int leftEdge, rightEdge;
|
||||
int topEdge, bottomEdge;
|
||||
int glyphRow; /* first row of glyph not wholly
|
||||
clipped out */
|
||||
int glyphCol; /* leftmost visible column of glyph */
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
int getWidth; /* bits to get from glyph */
|
||||
#endif
|
||||
|
||||
if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS))))
|
||||
return;
|
||||
|
||||
pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xpos = x;
|
||||
xchar = xpos & PIM;
|
||||
|
||||
for (i = 0; i < nglyph; i++) {
|
||||
pci = ppci[i];
|
||||
|
||||
ppos[i].xpos = xpos;
|
||||
ppos[i].xchar = xchar;
|
||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
||||
ppos[i].pdstBase = pdstBase;
|
||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
xpos += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST) {
|
||||
xchar &= PIM;
|
||||
pdstBase++;
|
||||
} else if (xchar < 0) {
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
}
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
pbox = REGION_RECTS(cclip);
|
||||
nbox = REGION_NUM_RECTS(cclip);
|
||||
|
||||
/* HACK ALERT
|
||||
since we continue out of the loop below so often, it
|
||||
is easier to increment pbox at the top than at the end.
|
||||
don't try this at home.
|
||||
*/
|
||||
pbox--;
|
||||
while(nbox--) {
|
||||
pbox++;
|
||||
clip.x1 = max(bbox.x1, pbox->x1);
|
||||
clip.y1 = max(bbox.y1, pbox->y1);
|
||||
clip.x2 = min(bbox.x2, pbox->x2);
|
||||
clip.y2 = min(bbox.y2, pbox->y2);
|
||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
||||
continue;
|
||||
|
||||
for(i=0; i<nglyph; i++) {
|
||||
pci = ppci[i];
|
||||
xchar = ppos[i].xchar;
|
||||
|
||||
/* clip the left and right edges */
|
||||
if (ppos[i].leftEdge < clip.x1)
|
||||
leftEdge = clip.x1;
|
||||
else
|
||||
leftEdge = ppos[i].leftEdge;
|
||||
|
||||
if (ppos[i].rightEdge > clip.x2)
|
||||
rightEdge = clip.x2;
|
||||
else
|
||||
rightEdge = ppos[i].rightEdge;
|
||||
|
||||
w = rightEdge - leftEdge;
|
||||
if (w <= 0)
|
||||
continue;
|
||||
|
||||
/* clip the top and bottom edges */
|
||||
if (ppos[i].topEdge < clip.y1)
|
||||
topEdge = clip.y1;
|
||||
else
|
||||
topEdge = ppos[i].topEdge;
|
||||
|
||||
if (ppos[i].bottomEdge > clip.y2)
|
||||
bottomEdge = clip.y2;
|
||||
else
|
||||
bottomEdge = ppos[i].bottomEdge;
|
||||
|
||||
hSave = bottomEdge - topEdge;
|
||||
if (hSave <= 0)
|
||||
continue;
|
||||
|
||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
||||
widthGlyph = ppos[i].widthGlyph;
|
||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
||||
pglyphSave += (glyphRow * widthGlyph);
|
||||
|
||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
||||
(pci->metrics.leftSideBearing);
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
getWidth = w + glyphCol;
|
||||
#endif
|
||||
|
||||
pdstSave = afbScanlineDelta(ppos[i].pdstBase, -(y-topEdge),
|
||||
widthDst);
|
||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
||||
if (xoff > PLST) {
|
||||
xoff &= PIM;
|
||||
pdstSave++;
|
||||
} else if (xoff < 0) {
|
||||
xoff += PPW;
|
||||
pdstSave--;
|
||||
}
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
h = hSave;
|
||||
pdst = pdstSave;
|
||||
pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
pglyph = pglyphSave;
|
||||
|
||||
if ((xoff + w) <= PPW) {
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
||||
*(pdst+1) |= SCRLEFT(tmpSrc, nFirst) & endmask;
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* depth */
|
||||
} /* for each glyph */
|
||||
} /* while nbox-- */
|
||||
xfree(ppos);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
707
afb/afbline.c
707
afb/afbline.c
|
|
@ -1,707 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mistruct.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
|
||||
/* single-pixel lines on a color frame buffer
|
||||
|
||||
NON-SLOPED LINES
|
||||
horizontal lines are always drawn left to right; we have to
|
||||
move the endpoints right by one after they're swapped.
|
||||
horizontal lines will be confined to a single band of a
|
||||
region. the code finds that band (giving up if the lower
|
||||
bound of the band is above the line we're drawing); then it
|
||||
finds the first box in that band that contains part of the
|
||||
line. we clip the line to subsequent boxes in that band.
|
||||
vertical lines are always drawn top to bottom (y-increasing.)
|
||||
this requires adding one to the y-coordinate of each endpoint
|
||||
after swapping.
|
||||
|
||||
SLOPED LINES
|
||||
when clipping a sloped line, we bring the second point inside
|
||||
the clipping box, rather than one beyond it, and then add 1 to
|
||||
the length of the line before drawing it. this lets us use
|
||||
the same box for finding the outcodes for both endpoints. since
|
||||
the equation for clipping the second endpoint to an edge gives us
|
||||
1 beyond the edge, we then have to move the point towards the
|
||||
first point by one step on the major axis.
|
||||
eventually, there will be a diagram here to explain what's going
|
||||
on. the method uses Cohen-Sutherland outcodes to determine
|
||||
outsideness, and a method similar to Pike's layers for doing the
|
||||
actual clipping.
|
||||
|
||||
*/
|
||||
|
||||
void
|
||||
#ifdef POLYSEGMENT
|
||||
afbSegmentSS(pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
#else
|
||||
afbLineSS(pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
#endif
|
||||
{
|
||||
int nboxInit;
|
||||
register int nbox;
|
||||
BoxPtr pboxInit;
|
||||
register BoxPtr pbox;
|
||||
#ifndef POLYSEGMENT
|
||||
register DDXPointPtr ppt; /* pointer to list of translated points */
|
||||
#endif
|
||||
|
||||
unsigned int oc1; /* outcode of point 1 */
|
||||
unsigned int oc2; /* outcode of point 2 */
|
||||
|
||||
PixelType *addrlBase; /* pointer to start of drawable */
|
||||
int nlwidth; /* width in longwords of destination pixmap */
|
||||
int xorg, yorg; /* origin of window */
|
||||
|
||||
int adx; /* abs values of dx and dy */
|
||||
int ady;
|
||||
int signdx; /* sign of dx and dy */
|
||||
int signdy;
|
||||
int e, e1, e2; /* bresenham error and increments */
|
||||
int len; /* length of segment */
|
||||
int axis; /* major axis */
|
||||
int octant;
|
||||
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
|
||||
int depthDst;
|
||||
#ifndef POLYSEGMENT
|
||||
PixelType *addrl; /* address of destination pixmap */
|
||||
int d;
|
||||
#endif
|
||||
int sizeDst;
|
||||
unsigned char *rrops;
|
||||
|
||||
/* a bunch of temporaries */
|
||||
register int y1, y2;
|
||||
register int x1, x2;
|
||||
RegionPtr cclip;
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
|
||||
addrlBase);
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
#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) {
|
||||
register int tmp;
|
||||
|
||||
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--;
|
||||
}
|
||||
|
||||
if (nbox) {
|
||||
/* stop when lower edge of box is beyond end of line */
|
||||
while((nbox) && (y2 >= pbox->y1)) {
|
||||
if ((x1 >= pbox->x1) && (x1 < pbox->x2)) {
|
||||
int y1t, y2t;
|
||||
/* this box has part of the line in it */
|
||||
y1t = max(y1, pbox->y1);
|
||||
y2t = min(y2, pbox->y2);
|
||||
if (y1t != y2t)
|
||||
afbVertS(addrlBase, nlwidth, sizeDst, depthDst, x1, y1t,
|
||||
y2t-y1t, rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
}
|
||||
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) {
|
||||
register int tmp;
|
||||
|
||||
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 tmp;
|
||||
|
||||
/* when we leave this band, we're done */
|
||||
tmp = pbox->y1;
|
||||
while((nbox) && (pbox->y1 == tmp)) {
|
||||
int x1t, x2t;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
x1t = max(x1, pbox->x1);
|
||||
x2t = min(x2, pbox->x2);
|
||||
if (x1t != x2t)
|
||||
afbHorzS(addrlBase, nlwidth, sizeDst, depthDst, x1t, y1,
|
||||
x2t-x1t, rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
nbox--;
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#ifndef POLYSEGMENT
|
||||
x2 = ppt->x + xorg;
|
||||
#endif
|
||||
}
|
||||
else /* sloped line */
|
||||
{
|
||||
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;
|
||||
} else {
|
||||
axis = Y_AXIS;
|
||||
e1 = adx << 1;
|
||||
e2 = e1 - (ady << 1);
|
||||
e = e1 - ady;
|
||||
SetYMajorOctant(octant);
|
||||
}
|
||||
|
||||
FIXUP_ERROR(e, octant, bias);
|
||||
|
||||
/* we have bresenham parameters and two points.
|
||||
all we have to do now is clip and draw.
|
||||
*/
|
||||
|
||||
while(nbox--) {
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, x1, y1, pbox);
|
||||
OUTCODES(oc2, x2, y2, pbox);
|
||||
if ((oc1 | oc2) == 0) {
|
||||
if (axis == X_AXIS)
|
||||
len = adx;
|
||||
else
|
||||
len = ady;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#endif
|
||||
afbBresS(addrlBase, nlwidth, sizeDst, depthDst, signdx, signdy,
|
||||
axis, x1, y1, e, e1, e2, len, rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
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);
|
||||
#ifdef POLYSEGMENT
|
||||
if (clip2 != 0 || pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#else
|
||||
len += (clip2 != 0);
|
||||
#endif
|
||||
if (len) {
|
||||
/* unwind bresenham error term to first point */
|
||||
if (clip1) {
|
||||
clipdx = abs(new_x1 - x1);
|
||||
clipdy = abs(new_y1 - y1);
|
||||
if (axis == X_AXIS)
|
||||
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
|
||||
else
|
||||
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
|
||||
}
|
||||
else
|
||||
err = e;
|
||||
afbBresS(addrlBase, nlwidth, sizeDst, depthDst, signdx,
|
||||
signdy, axis, new_x1, new_y1, err, e1, e2, len,
|
||||
rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
}
|
||||
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)) {
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(addrlBase, x2, y2, nlwidth);
|
||||
addrlBase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
|
||||
switch(rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
*addrl &= mfbGetrmask(x2 & PIM);
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*addrl |= mfbGetmask(x2 & PIM);
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*addrl ^= mfbGetmask(x2 & PIM);
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} /* for (d = ...) */
|
||||
break;
|
||||
} else
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw dashed 1-pixel lines.
|
||||
*/
|
||||
|
||||
void
|
||||
#ifdef POLYSEGMENT
|
||||
afbSegmentSD(pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
register GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
#else
|
||||
afbLineSD(pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
register GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
#endif
|
||||
{
|
||||
int nboxInit;
|
||||
register int nbox;
|
||||
BoxPtr pboxInit;
|
||||
register BoxPtr pbox;
|
||||
#ifndef POLYSEGMENT
|
||||
register DDXPointPtr ppt; /* pointer to list of translated points */
|
||||
#endif
|
||||
|
||||
register unsigned int oc1; /* outcode of point 1 */
|
||||
register unsigned int oc2; /* outcode of point 2 */
|
||||
|
||||
PixelType *addrlBase; /* address of destination pixmap */
|
||||
int nlwidth; /* width in longwords of destination pixmap */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int xorg, yorg; /* origin of window */
|
||||
|
||||
int adx; /* abs values of dx and dy */
|
||||
int ady;
|
||||
int signdx; /* sign of dx and dy */
|
||||
int signdy;
|
||||
int e, e1, e2; /* bresenham error and increments */
|
||||
int len; /* length of segment */
|
||||
int axis; /* major axis */
|
||||
int octant;
|
||||
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
|
||||
int x1, x2, y1, y2;
|
||||
RegionPtr cclip;
|
||||
unsigned char *rrops;
|
||||
unsigned char bgrrops[AFB_MAX_DEPTH];
|
||||
unsigned char *pDash;
|
||||
int dashOffset;
|
||||
int numInDashList;
|
||||
int dashIndex;
|
||||
int isDoubleDash;
|
||||
int dashIndexTmp, dashOffsetTmp;
|
||||
int unclippedlen;
|
||||
#ifndef POLYSEGMENT
|
||||
PixelType *addrl;
|
||||
int d;
|
||||
#endif
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
|
||||
addrlBase);
|
||||
|
||||
/* compute initial dash values */
|
||||
|
||||
pDash = (unsigned char *) pGC->dash;
|
||||
numInDashList = pGC->numInDashList;
|
||||
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
|
||||
dashIndex = 0;
|
||||
dashOffset = 0;
|
||||
miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
|
||||
numInDashList, &dashOffset);
|
||||
|
||||
if (isDoubleDash)
|
||||
afbReduceRop (pGC->alu, pGC->bgPixel, pGC->planemask, pGC->depth,
|
||||
bgrrops);
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
#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
|
||||
|
||||
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;
|
||||
unclippedlen = adx;
|
||||
} else {
|
||||
axis = Y_AXIS;
|
||||
e1 = adx << 1;
|
||||
e2 = e1 - (ady << 1);
|
||||
e = e1 - ady;
|
||||
unclippedlen = ady;
|
||||
SetYMajorOctant(octant);
|
||||
}
|
||||
|
||||
FIXUP_ERROR(e, octant, bias);
|
||||
|
||||
/* we have bresenham parameters and two points.
|
||||
all we have to do now is clip and draw.
|
||||
*/
|
||||
|
||||
while(nbox--) {
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, x1, y1, pbox);
|
||||
OUTCODES(oc2, x2, y2, pbox);
|
||||
if ((oc1 | oc2) == 0) {
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
unclippedlen++;
|
||||
dashIndexTmp = dashIndex;
|
||||
dashOffsetTmp = dashOffset;
|
||||
afbBresD(&dashIndexTmp, pDash, numInDashList, &dashOffsetTmp,
|
||||
isDoubleDash, addrlBase, nlwidth, sizeDst, depthDst,
|
||||
signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen,
|
||||
rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
break;
|
||||
#else
|
||||
afbBresD(&dashIndex, pDash, numInDashList, &dashOffset,
|
||||
isDoubleDash, addrlBase, nlwidth, sizeDst, depthDst,
|
||||
signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen,
|
||||
rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
goto dontStep;
|
||||
#endif
|
||||
} else if (oc1 & oc2) {
|
||||
pbox++;
|
||||
} else /* have to clip */ {
|
||||
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;
|
||||
}
|
||||
dashIndexTmp = dashIndex;
|
||||
dashOffsetTmp = dashOffset;
|
||||
if (clip1) {
|
||||
int dlen;
|
||||
|
||||
if (axis == X_AXIS)
|
||||
dlen = abs(new_x1 - x1);
|
||||
else
|
||||
dlen = abs(new_y1 - y1);
|
||||
miStepDash (dlen, &dashIndexTmp, pDash,
|
||||
numInDashList, &dashOffsetTmp);
|
||||
}
|
||||
if (axis == X_AXIS)
|
||||
len = abs(new_x2 - new_x1);
|
||||
else
|
||||
len = abs(new_y2 - new_y1);
|
||||
#ifdef POLYSEGMENT
|
||||
if (clip2 != 0 || pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#else
|
||||
len += (clip2 != 0);
|
||||
#endif
|
||||
if (len) {
|
||||
/* unwind bresenham error term to first point */
|
||||
if (clip1) {
|
||||
clipdx = abs(new_x1 - x1);
|
||||
clipdy = abs(new_y1 - y1);
|
||||
if (axis == X_AXIS)
|
||||
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
|
||||
else
|
||||
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
|
||||
}
|
||||
else
|
||||
err = e;
|
||||
afbBresD(&dashIndexTmp, pDash, numInDashList, &dashOffsetTmp,
|
||||
isDoubleDash, addrlBase, nlwidth, sizeDst, depthDst,
|
||||
signdx, signdy, axis, new_x1, new_y1, err, e1, e2,
|
||||
len, rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
} /* while (nbox--) */
|
||||
#ifndef POLYSEGMENT
|
||||
/*
|
||||
* walk the dash list around to the next line
|
||||
*/
|
||||
miStepDash (unclippedlen, &dashIndex, pDash,
|
||||
numInDashList, &dashOffset);
|
||||
dontStep: ;
|
||||
#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) &&
|
||||
((dashIndex & 1) == 0 || isDoubleDash) &&
|
||||
((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)) {
|
||||
int rop;
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
addrl = afbScanline(addrlBase, x2, y2, nlwidth);
|
||||
addrlBase += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
|
||||
rop = rrops[d];
|
||||
if (dashIndex & 1)
|
||||
rop = bgrrops[d];
|
||||
|
||||
switch (rop) {
|
||||
case RROP_BLACK:
|
||||
*addrl &= mfbGetrmask(x2 & PIM);
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*addrl |= mfbGetmask(x2 & PIM);
|
||||
break;
|
||||
|
||||
case RROP_INVERT:
|
||||
*addrl ^= mfbGetmask(x2 & PIM);
|
||||
break;
|
||||
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} /* for (d = ...) */
|
||||
break;
|
||||
} else
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "misc.h"
|
||||
#include "cursor.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "afb.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
afbQueryBestSize(class, pwidth, pheight, pScreen)
|
||||
int class;
|
||||
unsigned short *pwidth;
|
||||
unsigned short *pheight;
|
||||
ScreenPtr pScreen;
|
||||
{
|
||||
unsigned width, test;
|
||||
|
||||
switch(class) {
|
||||
case CursorShape:
|
||||
if (*pwidth > pScreen->width)
|
||||
*pwidth = pScreen->width;
|
||||
if (*pheight > pScreen->height)
|
||||
*pheight = pScreen->height;
|
||||
break;
|
||||
case TileShape:
|
||||
case StippleShape:
|
||||
width = *pwidth;
|
||||
if (!width) break;
|
||||
/* Return the closes power of two not less than what they gave me */
|
||||
test = 0x80000000;
|
||||
/* Find the highest 1 bit in the width given */
|
||||
while(!(test & width))
|
||||
test >>= 1;
|
||||
/* If their number is greater than that, bump up to the next
|
||||
* power of two */
|
||||
if((test - 1) & width)
|
||||
test <<= 1;
|
||||
*pwidth = test;
|
||||
/* We don't care what height they use */
|
||||
break;
|
||||
}
|
||||
}
|
||||
299
afb/afbpixmap.c
299
afb/afbpixmap.c
|
|
@ -1,299 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
/* pixmap management
|
||||
written by drewry, september 1986
|
||||
|
||||
on a monchrome device, a pixmap is a bitmap.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "mi.h"
|
||||
|
||||
#include "servermd.h"
|
||||
#include "mfb.h"
|
||||
|
||||
PixmapPtr
|
||||
afbCreatePixmap(pScreen, width, height, depth, usage_hint)
|
||||
ScreenPtr pScreen;
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
unsigned usage_hint;
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
size_t datasize;
|
||||
size_t paddedWidth;
|
||||
|
||||
paddedWidth = BitmapBytePad(width);
|
||||
|
||||
if (paddedWidth > 32767 || height > 32767 || depth > 4)
|
||||
return NullPixmap;
|
||||
|
||||
datasize = height * paddedWidth * depth;
|
||||
pPixmap = AllocatePixmap(pScreen, datasize);
|
||||
if (!pPixmap)
|
||||
return(NullPixmap);
|
||||
pPixmap->drawable.type = DRAWABLE_PIXMAP;
|
||||
pPixmap->drawable.class = 0;
|
||||
pPixmap->drawable.pScreen = pScreen;
|
||||
pPixmap->drawable.depth = depth;
|
||||
pPixmap->drawable.bitsPerPixel = depth;
|
||||
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 = paddedWidth;
|
||||
pPixmap->refcnt = 1;
|
||||
pPixmap->devPrivate.ptr = datasize ?
|
||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
||||
pPixmap->usage_hint = usage_hint;
|
||||
return(pPixmap);
|
||||
}
|
||||
|
||||
Bool
|
||||
afbDestroyPixmap(pPixmap)
|
||||
PixmapPtr pPixmap;
|
||||
{
|
||||
if(--pPixmap->refcnt)
|
||||
return(TRUE);
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
static PixmapPtr
|
||||
afbCopyPixmap(PixmapPtr pSrc)
|
||||
{
|
||||
register PixmapPtr pDst;
|
||||
int size;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
size = pSrc->drawable.height * pSrc->devKind * pSrc->drawable.depth;
|
||||
pScreen = pSrc->drawable.pScreen;
|
||||
pDst = (*pScreen->CreatePixmap)(pScreen,
|
||||
pSrc->drawable.width,
|
||||
pSrc->drawable.height,
|
||||
pSrc->drawable.depth, 0);
|
||||
if (!pDst)
|
||||
return(NullPixmap);
|
||||
memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
|
||||
return(pDst);
|
||||
}
|
||||
|
||||
|
||||
/* replicates a pattern to be a full 32 bits wide.
|
||||
relies on the fact that each scnaline is longword padded.
|
||||
doesn't do anything if pixmap is not a factor of 32 wide.
|
||||
changes width field of pixmap if successful, so that the fast
|
||||
XRotatePixmap code gets used if we rotate the pixmap later.
|
||||
|
||||
calculate number of times to repeat
|
||||
for each scanline of pattern
|
||||
zero out area to be filled with replicate
|
||||
left shift and or in original as many times as needed
|
||||
*/
|
||||
static void
|
||||
afbPadPixmap(PixmapPtr pPixmap)
|
||||
{
|
||||
register int width = pPixmap->drawable.width;
|
||||
register int h;
|
||||
register PixelType mask;
|
||||
register PixelType *p;
|
||||
register PixelType bits; /* real pattern bits */
|
||||
register int i;
|
||||
int d;
|
||||
int rep; /* repeat count for pattern */
|
||||
|
||||
if (width >= PPW)
|
||||
return;
|
||||
|
||||
rep = PPW/width;
|
||||
if (rep*width != PPW)
|
||||
return;
|
||||
|
||||
mask = mfbGetendtab(width);
|
||||
|
||||
p = (PixelType *)(pPixmap->devPrivate.ptr);
|
||||
|
||||
for (d = 0; d < pPixmap->drawable.depth; d++) {
|
||||
for (h = 0; h < pPixmap->drawable.height; h++) {
|
||||
*p &= mask;
|
||||
bits = *p;
|
||||
for(i = 1; i < rep; i++) {
|
||||
bits = SCRRIGHT(bits, width);
|
||||
*p |= bits;
|
||||
}
|
||||
p++; /* @@@ NEXT PLANE @@@ */
|
||||
}
|
||||
}
|
||||
pPixmap->drawable.width = PPW;
|
||||
}
|
||||
|
||||
/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
|
||||
* words are PPW bits wide, and that the least significant bit appears on the
|
||||
* left.
|
||||
*/
|
||||
void
|
||||
afbXRotatePixmap(pPix, rw)
|
||||
PixmapPtr pPix;
|
||||
register int rw;
|
||||
{
|
||||
register PixelType *pw, *pwFinal;
|
||||
register PixelType t;
|
||||
|
||||
if (pPix == NullPixmap)
|
||||
return;
|
||||
|
||||
pw = (PixelType *)pPix->devPrivate.ptr;
|
||||
rw %= (int)pPix->drawable.width;
|
||||
if (rw < 0)
|
||||
rw += (int)pPix->drawable.width;
|
||||
if(pPix->drawable.width == PPW) {
|
||||
pwFinal = pw + pPix->drawable.height * pPix->drawable.depth;
|
||||
while(pw < pwFinal) {
|
||||
t = *pw;
|
||||
*pw++ = SCRRIGHT(t, rw) |
|
||||
(SCRLEFT(t, (PPW-rw)) & mfbGetendtab(rw));
|
||||
}
|
||||
} else {
|
||||
/* We no longer do this. Validate doesn't try to rotate odd-size
|
||||
* tiles or stipples. afbUnnatural<tile/stipple>FS works directly off
|
||||
* the unrotate tile/stipple in the GC
|
||||
*/
|
||||
ErrorF("X internal error: trying to rotate odd-sized pixmap.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Rotates pixmap pPix by h lines. Assumes that h is always less than
|
||||
pPix->height
|
||||
works on any width.
|
||||
*/
|
||||
void
|
||||
afbYRotatePixmap(pPix, rh)
|
||||
register PixmapPtr pPix;
|
||||
int rh;
|
||||
{
|
||||
int nbyDown; /* bytes to move down to row 0; also offset of
|
||||
row rh */
|
||||
int nbyUp; /* bytes to move up to line rh; also
|
||||
offset of first line moved down to 0 */
|
||||
char *pbase;
|
||||
char *ptmp;
|
||||
int height;
|
||||
int d;
|
||||
|
||||
if (pPix == NullPixmap)
|
||||
return;
|
||||
height = (int) pPix->drawable.height;
|
||||
rh %= height;
|
||||
if (rh < 0)
|
||||
rh += height;
|
||||
|
||||
nbyDown = rh * pPix->devKind;
|
||||
nbyUp = (pPix->devKind * height) - nbyDown;
|
||||
|
||||
if(!(ptmp = (char *)xalloc(nbyUp)))
|
||||
return;
|
||||
|
||||
for (d = 0; d < pPix->drawable.depth; d++) {
|
||||
pbase = (char *)pPix->devPrivate.ptr + pPix->devKind * height * d; /* @@@ NEXT PLANE @@@ */
|
||||
|
||||
memmove(ptmp, pbase, nbyUp); /* save the low rows */
|
||||
memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
|
||||
memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */
|
||||
}
|
||||
xfree(ptmp);
|
||||
}
|
||||
|
||||
void
|
||||
afbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
|
||||
register PixmapPtr psrcPix, *ppdstPix;
|
||||
int xrot, yrot;
|
||||
{
|
||||
register PixmapPtr pdstPix;
|
||||
|
||||
if ((pdstPix = *ppdstPix) &&
|
||||
(pdstPix->devKind == psrcPix->devKind) &&
|
||||
(pdstPix->drawable.height == psrcPix->drawable.height) &&
|
||||
(pdstPix->drawable.depth == psrcPix->drawable.depth)) {
|
||||
memmove((char *)pdstPix->devPrivate.ptr,
|
||||
(char *)psrcPix->devPrivate.ptr,
|
||||
psrcPix->drawable.height * psrcPix->devKind *
|
||||
psrcPix->drawable.depth);
|
||||
pdstPix->drawable.width = psrcPix->drawable.width;
|
||||
pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
} else {
|
||||
if (pdstPix)
|
||||
/* FIX XBUG 6168 */
|
||||
(*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
|
||||
*ppdstPix = pdstPix = afbCopyPixmap(psrcPix);
|
||||
if (!pdstPix)
|
||||
return;
|
||||
}
|
||||
afbPadPixmap(pdstPix);
|
||||
if (xrot)
|
||||
afbXRotatePixmap(pdstPix, xrot);
|
||||
if (yrot)
|
||||
afbYRotatePixmap(pdstPix, yrot);
|
||||
}
|
||||
300
afb/afbply1rct.c
300
afb/afbply1rct.c
|
|
@ -1,300 +0,0 @@
|
|||
/*
|
||||
*
|
||||
Copyright (c) 1990 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
*
|
||||
* Author: Keith Packard, MIT X Consortium
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mistruct.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#if defined(mips) || defined(sparc)
|
||||
#define GetHighWord(x) (((int)(x)) >> 16)
|
||||
#else
|
||||
#define GetHighWord(x) (((int)(x)) / 65536)
|
||||
#endif
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int)((short) (i))))
|
||||
#define coordToInt(x,y) (((x) << 16) | (y))
|
||||
#define intToX(i) (GetHighWord(i))
|
||||
#define intToY(i) ((int)((short) i))
|
||||
#else
|
||||
#define intToCoord(i,x,y) (((x) = (int)((short) (i))), ((y) = GetHighWord(i)))
|
||||
#define coordToInt(x,y) (((y) << 16) | (x))
|
||||
#define intToX(i) ((int)((short) (i)))
|
||||
#define intToY(i) (GetHighWord(i))
|
||||
#endif
|
||||
|
||||
void
|
||||
afbFillPolygonSolid (pDrawable, pGC, shape, mode, count, ptsIn)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int shape;
|
||||
int mode;
|
||||
int count;
|
||||
DDXPointPtr ptsIn;
|
||||
{
|
||||
afbPrivGCPtr devPriv;
|
||||
int nlwidth;
|
||||
PixelType *addrl, *addr;
|
||||
int maxy;
|
||||
int origin;
|
||||
register int vertex1, vertex2;
|
||||
int c;
|
||||
BoxPtr extents;
|
||||
int clip;
|
||||
int y;
|
||||
int *vertex1p = NULL, *vertex2p;
|
||||
int *endp;
|
||||
int x1 = 0, x2 = 0;
|
||||
int dx1 = 0, dx2 = 0;
|
||||
int dy1 = 0, dy2 = 0;
|
||||
int e1 = 0, e2 = 0;
|
||||
int step1 = 0, step2 = 0;
|
||||
int sign1 = 0, sign2 = 0;
|
||||
int h;
|
||||
int l, r;
|
||||
PixelType mask, bits = ~((PixelType)0);
|
||||
int nmiddle;
|
||||
register unsigned char *rrops;
|
||||
register int n;
|
||||
register int d;
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
register PixelType *pdst;
|
||||
|
||||
devPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
if (mode == CoordModePrevious || shape != Convex ||
|
||||
REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
|
||||
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
|
||||
return;
|
||||
}
|
||||
origin = *((int *) &pDrawable->x);
|
||||
origin -= (origin & 0x8000) << 1;
|
||||
extents = &pGC->pCompositeClip->extents;
|
||||
vertex1 = *((int *) &extents->x1) - origin;
|
||||
vertex2 = *((int *) &extents->x2) - origin - 0x00010001;
|
||||
clip = 0;
|
||||
y = 32767;
|
||||
maxy = 0;
|
||||
vertex2p = (int *) ptsIn;
|
||||
endp = vertex2p + count;
|
||||
while (count--) {
|
||||
c = *vertex2p;
|
||||
clip |= (c - vertex1) | (vertex2 - c);
|
||||
c = intToY(c);
|
||||
if (c < y) {
|
||||
y = c;
|
||||
vertex1p = vertex2p;
|
||||
}
|
||||
vertex2p++;
|
||||
if (c > maxy)
|
||||
maxy = c;
|
||||
}
|
||||
if (y == maxy)
|
||||
return;
|
||||
|
||||
if (clip & 0x80008000) {
|
||||
miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
|
||||
return;
|
||||
}
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
|
||||
addrl);
|
||||
rrops = devPriv->rrops;
|
||||
addrl = afbScanlineDelta(addrl, y + pDrawable->y, nlwidth);
|
||||
origin = intToX(origin);
|
||||
vertex2p = vertex1p;
|
||||
vertex2 = vertex1 = *vertex2p++;
|
||||
if (vertex2p == endp)
|
||||
vertex2p = (int *) ptsIn;
|
||||
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
|
||||
x = intToX(vertex); \
|
||||
if ((dy = intToY(c) - y)) { \
|
||||
dx = intToX(c) - x; \
|
||||
step = 0; \
|
||||
if (dx >= 0) { \
|
||||
e = 0; \
|
||||
sign = 1; \
|
||||
if (dx >= dy) {\
|
||||
step = dx / dy; \
|
||||
dx = dx % dy; \
|
||||
} \
|
||||
} else { \
|
||||
e = 1 - dy; \
|
||||
sign = -1; \
|
||||
dx = -dx; \
|
||||
if (dx >= dy) { \
|
||||
step = - (dx / dy); \
|
||||
dx = dx % dy; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
x += origin; \
|
||||
vertex = c; \
|
||||
}
|
||||
|
||||
#define Step(x,dx,dy,e,sign,step) {\
|
||||
x += step; \
|
||||
if ((e += dx) > 0) { \
|
||||
x += sign; \
|
||||
e -= dy; \
|
||||
} \
|
||||
}
|
||||
for (;;) {
|
||||
if (y == intToY(vertex1)) {
|
||||
do {
|
||||
if (vertex1p == (int *) ptsIn)
|
||||
vertex1p = endp;
|
||||
c = *--vertex1p;
|
||||
Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
|
||||
} 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)
|
||||
} 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 */
|
||||
y += h;
|
||||
for (;;) {
|
||||
l = x1;
|
||||
r = x2;
|
||||
nmiddle = x2 - x1;
|
||||
if (nmiddle < 0) {
|
||||
nmiddle = -nmiddle;
|
||||
l = x2;
|
||||
r = x1;
|
||||
}
|
||||
c = l & PIM;
|
||||
l -= c;
|
||||
l = l >> PWSH;
|
||||
addr = addrl + l;
|
||||
if (c + nmiddle < PPW) {
|
||||
mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
|
||||
for (pdst = addr, d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
*pdst &= ~mask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*pdst |= mask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*pdst ^= mask;
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (c) {
|
||||
mask = SCRRIGHT(bits, c);
|
||||
for (pdst = addr, d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
*pdst &= ~mask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*pdst |= mask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*pdst ^= mask;
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
nmiddle += c - PPW;
|
||||
addr++;
|
||||
}
|
||||
nmiddle >>= PWSH;
|
||||
mask = ~SCRRIGHT(bits, r & PIM);
|
||||
|
||||
for (d = 0; d < depthDst; d++, addr += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
n = nmiddle;
|
||||
pdst = addr;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
Duff (n, *pdst++ = 0;)
|
||||
if (mask)
|
||||
*pdst &= ~mask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
Duff (n, *pdst++ = ~0;);
|
||||
if (mask)
|
||||
*pdst |= mask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
Duff (n, *pdst++ ^= ~0;);
|
||||
if (mask)
|
||||
*pdst ^= mask;
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!--h)
|
||||
break;
|
||||
afbScanlineInc(addrl, nlwidth);
|
||||
Step(x1,dx1,dy1,e1,sign1,step1)
|
||||
Step(x2,dx2,dy2,e2,sign2,step2)
|
||||
}
|
||||
if (y == maxy)
|
||||
break;
|
||||
afbScanlineInc(addrl, nlwidth);
|
||||
}
|
||||
}
|
||||
463
afb/afbplygblt.c
463
afb/afbplygblt.c
|
|
@ -1,463 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "afb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/*
|
||||
this works for fonts with glyphs <= 32 bits wide.
|
||||
|
||||
the clipping calculations are done for worst-case fonts.
|
||||
we make no assumptions about the heights, widths, or bearings
|
||||
of the glyphs. if we knew that the glyphs are all the same height,
|
||||
we could clip the tops and bottoms per clipping box, rather
|
||||
than per character per clipping box. if we knew that the glyphs'
|
||||
left and right bearings were wlle-behaved, we could clip a single
|
||||
character at the start, output until the last unclipped
|
||||
character, and then clip the last one. this is all straightforward
|
||||
to determine based on max-bounds and min-bounds from the font.
|
||||
there is some inefficiency introduced in the per-character
|
||||
clipping to make what's going on clearer.
|
||||
|
||||
(it is possible, for example, for a font to be defined in which the
|
||||
next-to-last character in a font would be clipped out, but the last
|
||||
one wouldn't. the code below deals with this.)
|
||||
|
||||
*/
|
||||
|
||||
void
|
||||
afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
||||
DrawablePtr pDrawable;
|
||||
GC *pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
pointer pglyphBase; /* start of array of glyphs */
|
||||
{
|
||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
||||
BoxRec bbox; /* string's bounding box */
|
||||
|
||||
CharInfoPtr pci;
|
||||
int xorg, yorg; /* origin of drawable in bitmap */
|
||||
int widthDst; /* width of dst in longwords */
|
||||
|
||||
/* these keep track of the character origin */
|
||||
PixelType *pdstBase;
|
||||
/* points to longword with character origin */
|
||||
int xchar; /* xorigin of char (mod 32) */
|
||||
|
||||
/* these are used for placing the glyph */
|
||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
||||
register PixelType *pdst; /* pointer to current longword in dst */
|
||||
|
||||
register int d;
|
||||
int depthDst;
|
||||
int sizeDst;
|
||||
int hSave;
|
||||
int w; /* width of glyph in bits */
|
||||
int h; /* height of glyph */
|
||||
int widthGlyph; /* width of glyph, in bytes */
|
||||
unsigned char *rrops;
|
||||
register unsigned char *pglyph;
|
||||
/* pointer to current row of glyph */
|
||||
unsigned char *pglyphSave;
|
||||
|
||||
/* used for putting down glyph */
|
||||
register PixelType tmpSrc;
|
||||
/* for getting bits from glyph */
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
|
||||
register int nFirst; /* bits of glyph in current longword */
|
||||
PixelType *pdstSave;
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
|
||||
pdstBase);
|
||||
|
||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
||||
|
||||
x += xorg;
|
||||
y += yorg;
|
||||
|
||||
bbox.x1 = x + info.overallLeft;
|
||||
bbox.x2 = x + info.overallRight;
|
||||
bbox.y1 = y - info.overallAscent;
|
||||
bbox.y2 = y + info.overallDescent;
|
||||
|
||||
rrops = ((afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
|
||||
case rgnOUT:
|
||||
break;
|
||||
case rgnIN:
|
||||
pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xchar = x & PIM;
|
||||
|
||||
while(nglyph--) {
|
||||
pci = *ppci;
|
||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
||||
hSave = pci->metrics.ascent + pci->metrics.descent;
|
||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
/* start at top scanline of glyph */
|
||||
pdstSave = afbScanlineDelta(pdstBase, -pci->metrics.ascent,
|
||||
widthDst);
|
||||
|
||||
/* find correct word in scanline and x offset within it
|
||||
for left edge of glyph
|
||||
*/
|
||||
xoff = xchar + pci->metrics.leftSideBearing;
|
||||
if (xoff > PLST) {
|
||||
pdstSave++;
|
||||
xoff &= PIM;
|
||||
} else if (xoff < 0) {
|
||||
xoff += PPW;
|
||||
pdstSave--;
|
||||
}
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
h = hSave;
|
||||
pdst = pdstSave;
|
||||
pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
pglyph = pglyphSave;
|
||||
|
||||
if ((xoff + w) <= PPW) {
|
||||
/* glyph all in one longword */
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
switch (rrops[d]) {
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* glyph crosses longword boundary */
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
switch (rrops[d]) {
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) |= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) ^= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} /* glyph crosses longwords boundary */
|
||||
} /* depth loop */
|
||||
/* update character origin */
|
||||
x += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST) {
|
||||
xchar -= PPW;
|
||||
pdstBase++;
|
||||
} else if (xchar < 0) {
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
ppci++;
|
||||
} /* while nglyph-- */
|
||||
break;
|
||||
case rgnPART:
|
||||
{
|
||||
afbTEXTPOS *ppos;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
RegionPtr cclip;
|
||||
int xpos; /* x position of char origin */
|
||||
int i;
|
||||
BoxRec clip;
|
||||
int leftEdge, rightEdge;
|
||||
int topEdge, bottomEdge;
|
||||
int glyphRow; /* first row of glyph not wholly
|
||||
clipped out */
|
||||
int glyphCol; /* leftmost visible column of glyph */
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
int getWidth; /* bits to get from glyph */
|
||||
#endif
|
||||
|
||||
if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS))))
|
||||
return;
|
||||
|
||||
pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xpos = x;
|
||||
xchar = xpos & PIM;
|
||||
|
||||
for (i = 0; i < nglyph; i++) {
|
||||
pci = ppci[i];
|
||||
|
||||
ppos[i].xpos = xpos;
|
||||
ppos[i].xchar = xchar;
|
||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
||||
ppos[i].pdstBase = pdstBase;
|
||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
xpos += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST) {
|
||||
xchar &= PIM;
|
||||
pdstBase++;
|
||||
} else if (xchar < 0) {
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
}
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
pbox = REGION_RECTS(cclip);
|
||||
nbox = REGION_NUM_RECTS(cclip);
|
||||
|
||||
/* HACK ALERT
|
||||
since we continue out of the loop below so often, it
|
||||
is easier to increment pbox at the top than at the end.
|
||||
don't try this at home.
|
||||
*/
|
||||
pbox--;
|
||||
while(nbox--) {
|
||||
pbox++;
|
||||
clip.x1 = max(bbox.x1, pbox->x1);
|
||||
clip.y1 = max(bbox.y1, pbox->y1);
|
||||
clip.x2 = min(bbox.x2, pbox->x2);
|
||||
clip.y2 = min(bbox.y2, pbox->y2);
|
||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
||||
continue;
|
||||
|
||||
for(i=0; i<nglyph; i++) {
|
||||
pci = ppci[i];
|
||||
xchar = ppos[i].xchar;
|
||||
|
||||
/* clip the left and right edges */
|
||||
if (ppos[i].leftEdge < clip.x1)
|
||||
leftEdge = clip.x1;
|
||||
else
|
||||
leftEdge = ppos[i].leftEdge;
|
||||
|
||||
if (ppos[i].rightEdge > clip.x2)
|
||||
rightEdge = clip.x2;
|
||||
else
|
||||
rightEdge = ppos[i].rightEdge;
|
||||
|
||||
w = rightEdge - leftEdge;
|
||||
if (w <= 0)
|
||||
continue;
|
||||
|
||||
/* clip the top and bottom edges */
|
||||
if (ppos[i].topEdge < clip.y1)
|
||||
topEdge = clip.y1;
|
||||
else
|
||||
topEdge = ppos[i].topEdge;
|
||||
|
||||
if (ppos[i].bottomEdge > clip.y2)
|
||||
bottomEdge = clip.y2;
|
||||
else
|
||||
bottomEdge = ppos[i].bottomEdge;
|
||||
|
||||
hSave = bottomEdge - topEdge;
|
||||
if (hSave <= 0)
|
||||
continue;
|
||||
|
||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
||||
widthGlyph = ppos[i].widthGlyph;
|
||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
||||
pglyphSave += (glyphRow * widthGlyph);
|
||||
|
||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
||||
(pci->metrics.leftSideBearing);
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
getWidth = w + glyphCol;
|
||||
#endif
|
||||
|
||||
pdstSave = afbScanlineDelta(ppos[i].pdstBase, -(y-topEdge),
|
||||
widthDst);
|
||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
||||
if (xoff > PLST) {
|
||||
xoff &= PIM;
|
||||
pdstSave++;
|
||||
} else if (xoff < 0) {
|
||||
xoff += PPW;
|
||||
pdstSave--;
|
||||
}
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
h = hSave;
|
||||
pdst = pdstSave;
|
||||
pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
pglyph = pglyphSave;
|
||||
|
||||
if ((xoff + w) <= PPW) {
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
switch (rrops[d]) {
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
switch (rrops[d]) {
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) |= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) ^= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
afbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* depth */
|
||||
} /* for each glyph */
|
||||
} /* while nbox-- */
|
||||
xfree(ppos);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
655
afb/afbpntarea.c
655
afb/afbpntarea.c
|
|
@ -1,655 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "windowstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/*
|
||||
the solid fillers are called for rectangles and window backgrounds.
|
||||
the boxes are already translated.
|
||||
maybe this should always take a pixmap instead of a drawable?
|
||||
|
||||
NOTE:
|
||||
iy = ++iy < tileHeight ? iy : 0
|
||||
is equivalent to iy%= tileheight, and saves a division.
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
afbSolidFillArea (pDraw, nbox, pbox, rrops)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
register unsigned char *rrops;
|
||||
{
|
||||
int nlwidth; /* width in longwords of the drawable */
|
||||
int w; /* width of current box */
|
||||
register int h; /* height of current box */
|
||||
register PixelType *p; /* pointer to bits we're writing */
|
||||
register int nlw; /* loop version of nlwMiddle */
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
/* masks for reggedy bits at either end of line */
|
||||
register int nlwExtra;
|
||||
/* to get from right of box to left of next span */
|
||||
int nlwMiddle; /* number of longwords between sides of boxes */
|
||||
PixelType *pbits; /* pointer to start of drawable */
|
||||
PixelType *saveP;
|
||||
int saveH;
|
||||
int depthDst;
|
||||
int sizeDst;
|
||||
register int d;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
|
||||
pbits);
|
||||
|
||||
while (nbox--) {
|
||||
w = pbox->x2 - pbox->x1;
|
||||
saveH = pbox->y2 - pbox->y1;
|
||||
|
||||
saveP = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
|
||||
|
||||
if ( ((pbox->x1 & PIM) + w) < PPW) {
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
h = saveH;
|
||||
p = saveP;
|
||||
saveP += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
maskpartialbits(pbox->x1, w, startmask);
|
||||
nlwExtra = nlwidth;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
Duff(h, *p &= ~startmask; afbScanlineInc(p, nlwExtra));
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
Duff(h, *p |= startmask; afbScanlineInc(p, nlwExtra));
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
Duff(h, *p ^= startmask; afbScanlineInc(p, nlwExtra));
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} /* for (d = ..) */
|
||||
} else {
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
h = saveH;
|
||||
p = saveP;
|
||||
saveP += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
nlwExtra = nlwidth - nlwMiddle;
|
||||
|
||||
if (startmask && endmask) {
|
||||
nlwExtra -= 1;
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
*p &= ~startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ = 0);
|
||||
*p &= ~endmask;
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
*p |= startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ = ~0);
|
||||
*p |= endmask;
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
*p ^= startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ ^= ~0);
|
||||
*p ^= endmask;
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} else if (startmask && !endmask) {
|
||||
nlwExtra -= 1;
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
*p &= ~startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ = 0);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
*p |= startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ = ~0);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
*p ^= startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ ^= ~0);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} else if (!startmask && endmask) {
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ = 0);
|
||||
*p &= ~endmask;
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ = ~0);
|
||||
*p |= endmask;
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ ^= ~0);
|
||||
*p ^= endmask;
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
case RROP_NOP:
|
||||
break;
|
||||
}
|
||||
} else { /* no ragged bits at either end */
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ = 0);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ = ~0);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ ^= ~0);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
}
|
||||
} /* for (d = 0 ... ) */
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
|
||||
/* stipple a list of boxes -
|
||||
|
||||
you can use the reduced rasterop for stipples. if rrop is
|
||||
black, AND the destination with (not stipple pattern). if rrop is
|
||||
white OR the destination with the stipple pattern. if rrop is invert,
|
||||
XOR the destination with the stipple pattern.
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
afbStippleAreaPPW (pDraw, nbox, pbox, pstipple, rrops)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
PixmapPtr pstipple;
|
||||
unsigned char *rrops;
|
||||
{
|
||||
register PixelType *psrc;
|
||||
/* pointer to bits in tile, if needed */
|
||||
int tileHeight; /* height of the tile */
|
||||
register PixelType srcpix;
|
||||
|
||||
int nlwidth; /* width in longwords of the drawable */
|
||||
int w; /* width of current box */
|
||||
register int nlw; /* loop version of nlwMiddle */
|
||||
register PixelType *p; /* pointer to bits we're writing */
|
||||
register int h; /* height of current box */
|
||||
PixelType startmask;
|
||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
||||
int nlwMiddle; /* number of longwords between sides of boxes */
|
||||
int nlwExtra; /* to get from right of box to left of next span */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int d;
|
||||
int saveIy;
|
||||
register int iy; /* index of current scanline in tile */
|
||||
PixelType *pbits; /* pointer to start of drawable */
|
||||
PixelType *pBase;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
|
||||
pBase);
|
||||
|
||||
tileHeight = pstipple->drawable.height;
|
||||
psrc = (PixelType *)(pstipple->devPrivate.ptr);
|
||||
|
||||
while (nbox--) {
|
||||
w = pbox->x2 - pbox->x1;
|
||||
saveIy = pbox->y1 % tileHeight;
|
||||
pbits = pBase;
|
||||
|
||||
if ( ((pbox->x1 & PIM) + w) < PPW) {
|
||||
maskpartialbits(pbox->x1, w, startmask);
|
||||
nlwExtra = nlwidth;
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
p = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
|
||||
pbits += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
iy = saveIy;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
*p &= ~(srcpix & startmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
*p |= (srcpix & startmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
*p ^= (srcpix & startmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} /* for (d = ...) */
|
||||
|
||||
} else {
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
||||
|
||||
for (d = 0; d < depthDst; d++) {
|
||||
nlwExtra = nlwidth - nlwMiddle;
|
||||
p = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
|
||||
pbits += sizeDst; /* @@@ NEXT PLANE @@@ */
|
||||
iy = saveIy;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
if (startmask && endmask) {
|
||||
nlwExtra -= 1;
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p &= ~(srcpix & startmask);
|
||||
p++;
|
||||
Duff (nlw, *p++ &= ~srcpix);
|
||||
*p &= ~(srcpix & endmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p |= (srcpix & startmask);
|
||||
p++;
|
||||
Duff (nlw, *p++ |= srcpix);
|
||||
*p |= (srcpix & endmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p ^= (srcpix & startmask);
|
||||
p++;
|
||||
Duff (nlw, *p++ ^= srcpix);
|
||||
*p ^= (srcpix & endmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} else if (startmask && !endmask) {
|
||||
nlwExtra -= 1;
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p &= ~(srcpix & startmask);
|
||||
p++;
|
||||
Duff(nlw, *p++ &= ~srcpix);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p |= (srcpix & startmask);
|
||||
p++;
|
||||
Duff(nlw, *p++ |= srcpix);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p ^= (srcpix & startmask);
|
||||
p++;
|
||||
Duff(nlw, *p++ ^= srcpix);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} else if (!startmask && endmask) {
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ &= ~srcpix);
|
||||
*p &= ~(srcpix & endmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ |= srcpix);
|
||||
*p |= (srcpix & endmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ ^= srcpix);
|
||||
*p ^= (srcpix & endmask);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_NOP:
|
||||
break;
|
||||
} /* switch */
|
||||
} else { /* no ragged bits at either end */
|
||||
switch (rrops[d]) {
|
||||
case RROP_BLACK:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ &= ~srcpix);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ |= srcpix);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
while (h--) {
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ ^= srcpix);
|
||||
afbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
break;
|
||||
} /* switch */
|
||||
}
|
||||
} /* for (d = ...) */
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
afbStippleArea (pDraw, nbox, pbox, pTile, xOff, yOff, rrops)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
PixmapPtr pTile;
|
||||
int xOff;
|
||||
int yOff;
|
||||
unsigned char *rrops;
|
||||
{
|
||||
register PixelType *psrc; /* pointer to bits in tile, if needed */
|
||||
int nlwidth; /* width in longwords of the drawable */
|
||||
register int h; /* height of current box */
|
||||
register PixelType *pdst; /* pointer to bits we're writing */
|
||||
int sizeDst;
|
||||
int depthDst;
|
||||
int tileLine;
|
||||
int iline;
|
||||
int w, width, x, xSrc, ySrc, srcStartOver, nend;
|
||||
int tlwidth, rem, tileWidth, tileHeight, endinc;
|
||||
int saveW;
|
||||
register int rop;
|
||||
PixelType *psrcT;
|
||||
int d;
|
||||
int nstart;
|
||||
PixelType startmask;
|
||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
||||
int nlMiddle; /* number of longwords between sides of boxes */
|
||||
int iy;
|
||||
PixelType *pBase; /* pointer to start of drawable */
|
||||
PixelType *saveP;
|
||||
PixelType *pStartDst;
|
||||
PixelType *pStartTile;
|
||||
int saveH;
|
||||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
|
||||
pBase);
|
||||
|
||||
tileHeight = pTile->drawable.height;
|
||||
tileWidth = pTile->drawable.width;
|
||||
tlwidth = pTile->devKind / sizeof (PixelType);
|
||||
|
||||
xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
|
||||
ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
|
||||
|
||||
while (nbox--) {
|
||||
saveW = pbox->x2 - pbox->x1;
|
||||
iline = (pbox->y1 - ySrc) % tileHeight;
|
||||
psrcT = (PixelType *) pTile->devPrivate.ptr;
|
||||
tileLine = iline * tlwidth;
|
||||
saveH = pbox->y2 - pbox->y1;
|
||||
saveP = afbScanline(pBase, pbox->x1, pbox->y1, nlwidth);
|
||||
|
||||
for (d = 0; d < depthDst; d++, saveP += sizeDst) { /* @@@ NEXT PLANE @@@ */
|
||||
h = saveH;
|
||||
pStartDst = saveP;
|
||||
pStartTile = psrcT + tileLine;
|
||||
iy = iline;
|
||||
|
||||
while (h--) {
|
||||
x = pbox->x1;
|
||||
width = saveW;
|
||||
pdst = pStartDst;
|
||||
rop = rrops[d];
|
||||
|
||||
while(width > 0) {
|
||||
psrc = pStartTile;
|
||||
w = min(tileWidth, width);
|
||||
if((rem = (x - xSrc) % tileWidth) != 0) {
|
||||
/* if we're in the middle of the tile, get
|
||||
as many bits as will finish the span, or
|
||||
as many as will get to the left edge of the tile,
|
||||
or a longword worth, starting at the appropriate
|
||||
offset in the tile.
|
||||
*/
|
||||
w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
|
||||
endinc = rem / BITMAP_SCANLINE_PAD;
|
||||
getandputrrop((psrc + endinc), (rem & PIM), (x & PIM),
|
||||
w, pdst, rop)
|
||||
if((x & PIM) + w >= PPW)
|
||||
pdst++;
|
||||
} else if(((x & PIM) + w) < PPW) {
|
||||
/* doing < PPW bits is easy, and worth special-casing */
|
||||
putbitsrrop(*psrc, x & PIM, w, pdst, rop);
|
||||
} else {
|
||||
/* start at the left edge of the tile,
|
||||
and put down as much as we can
|
||||
*/
|
||||
maskbits(x, w, startmask, endmask, nlMiddle);
|
||||
|
||||
if (startmask)
|
||||
nstart = PPW - (x & PIM);
|
||||
else
|
||||
nstart = 0;
|
||||
if (endmask)
|
||||
nend = (x + w) & PIM;
|
||||
else
|
||||
nend = 0;
|
||||
|
||||
srcStartOver = nstart > PLST;
|
||||
|
||||
if(startmask) {
|
||||
putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop);
|
||||
pdst++;
|
||||
if(srcStartOver)
|
||||
psrc++;
|
||||
}
|
||||
|
||||
while(nlMiddle--) {
|
||||
getandputrrop0(psrc, nstart, PPW, pdst, rop);
|
||||
pdst++;
|
||||
psrc++;
|
||||
}
|
||||
|
||||
if(endmask) {
|
||||
getandputrrop0(psrc, nstart, nend, pdst, rop);
|
||||
}
|
||||
}
|
||||
x += w;
|
||||
width -= w;
|
||||
} /* while (width > 0) */
|
||||
|
||||
pStartDst += nlwidth;
|
||||
if (++iy >= tileHeight) {
|
||||
iy = 0;
|
||||
pStartTile = psrcT;
|
||||
} else
|
||||
pStartTile += tlwidth;
|
||||
|
||||
} /* while (h) */
|
||||
} /* for (d = ... ) */
|
||||
pbox++;
|
||||
} /* for each box */
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue