Commit 30722f51 authored by alanh's avatar alanh
Browse files

Import of XFree86 4.0.1

parent 55378d1c
......@@ -3,30 +3,34 @@ XCOMM $XConsortium: Imakefile /main/2 1996/09/28 17:06:40 rws $
XCOMM $XFree86: xc/programs/Xserver/dbe/Imakefile,v 3.7 1999/08/14 10:49:27 dawes Exp $
XCOMM $XFree86: xc/programs/Xserver/dbe/Imakefile,v 3.9 2000/04/06 14:47:46 dawes Exp $
#if DoLoadableServer
#define IHaveSubdirs
#endif
#define IHaveModules
#include <Server.tmpl>
#if DoLoadableServer
MSRCS = dbemodule.c
MOBJS = dbemodule.o
SUBDIRS = module
#endif
SRCS = dbe.c midbe.c $(MSRCS)
OBJS = dbe.o midbe.o $(MOBJS)
INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(EXTRAINCLUDES)
SRCS = dbe.c midbe.c
OBJS = dbe.o midbe.o
INCLUDES = -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(EXTRAINCLUDES)
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
ModuleObjectRule()
NormalLibraryObjectRule()
LibraryModuleTarget(dbe,$(OBJS))
NormalLibraryTarget(dbe,$(OBJS))
LintLibraryTarget(dbe,$(SRCS))
NormalLintTarget($(SRCS))
InstallLibraryModule(dbe,$(MODULEDIR),extensions)
#if DoLoadableServer
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
#endif
DependTarget()
InstallDriverSDKLibraryModule(dbe,$(DRIVERSDKMODULEDIR),extensions)
......@@ -30,13 +30,13 @@
* Machine-independent DBE code
*
*****************************************************************************/
/* $XFree86: xc/programs/Xserver/dbe/midbe.c,v 3.2 2000/04/06 14:47:46 dawes Exp $ */
/* INCLUDES */
#define NEED_REPLIES
#define NEED_EVENTS
#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
......@@ -54,6 +54,11 @@
#include "gcstruct.h"
#include "inputstr.h"
#ifndef IN_MODULE
#include <stdio.h>
#else
#include "xf86_ansic.h"
#endif
/* DEFINES */
......
XCOMM $XConsortium: Imakefile /main/2 1996/09/28 17:06:40 rws $
XCOMM $XFree86: xc/programs/Xserver/dbe/module/Imakefile,v 1.1 2000/04/06 15:35:03 dawes Exp $
#define IHaveModules
#include <Server.tmpl>
#if DoLoadableServer
MSRCS = dbemodule.c
MOBJS = dbemodule.o
#endif
SRCS = dbe.c midbe.c $(MSRCS)
OBJS = dbe.o midbe.o $(MOBJS)
INCLUDES = -I.. -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(EXTRAINCLUDES)
LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln
LinkSourceFile(dbemodule.c,..)
LinkSourceFile(midbe.c,..)
LinkSourceFile(dbe.c,..)
ModuleObjectRule()
LibraryModuleTarget(dbe,$(OBJS))
LintLibraryTarget(dbe,$(SRCS))
NormalLintTarget($(SRCS))
InstallLibraryModule(dbe,$(MODULEDIR),extensions)
DependTarget()
InstallDriverSDKLibraryModule(dbe,$(DRIVERSDKMODULEDIR),extensions)
......@@ -64,7 +64,7 @@ SOFTWARE.
* *
*****************************************************************/
/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.18 2000/02/12 03:39:39 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.19 2000/05/05 17:53:46 keithp Exp $ */
#ifdef PANORAMIX_DEBUG
#include <stdio.h>
......@@ -253,17 +253,18 @@ FlushClientCaches(id)
}
#ifdef SMART_SCHEDULE
#undef SMART_DEBUG
#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
Bool SmartScheduleDisable;
int SmartMaxPriority = 20;
int SmartMinPriority = -20;
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
long SmartScheduleTime;
ClientPtr SmartLastClient;
int SmartLastIndex;
int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
#ifdef SMART_DEBUG
long SmartLastPrint;
......@@ -283,20 +284,21 @@ SmartScheduleClient (int *clientReady, int nready)
bestPrio = -0x7fffffff;
bestRobin = 0;
idle = nready * 2 * SmartScheduleSlice;
idle = 2 * SmartScheduleSlice;
for (i = 0; i < nready; i++)
{
client = clientReady[i];
pClient = clients[client];
/* Praise clients which are idle */
if ((now - pClient->smart_stop_tick) >= idle)
if ((now - pClient->smart_check_tick) >= idle)
{
if (pClient->smart_priority < 0)
pClient->smart_priority++;
}
pClient->smart_check_tick = now;
/* check priority to select best client */
robin = (pClient->index - SmartLastIndex) & 0xff;
robin = (pClient->index - SmartLastIndex[pClient->smart_priority-SMART_MIN_PRIORITY]) & 0xff;
if (pClient->smart_priority > bestPrio ||
(pClient->smart_priority == bestPrio && robin > bestRobin))
{
......@@ -316,14 +318,15 @@ SmartScheduleClient (int *clientReady, int nready)
SmartLastPrint = now;
}
#endif
pClient = clients[best];
SmartLastIndex[bestPrio-SMART_MIN_PRIORITY] = pClient->index;
/*
* Set current client pointer
*/
if (SmartLastClient != clients[best])
if (SmartLastClient != pClient)
{
SmartLastClient = clients[best];
SmartLastIndex = SmartLastClient->index;
SmartLastClient->smart_start_tick = now;
pClient->smart_start_tick = now;
SmartLastClient = pClient;
}
/*
* Adjust slice
......@@ -335,10 +338,10 @@ SmartScheduleClient (int *clientReady, int nready)
* has run, bump the slice up to get maximal
* performance from a single client
*/
if ((now - SmartLastClient->smart_start_tick) > 1000 &&
SmartScheduleSlice < SMART_SCHEDULE_MAX_SLICE)
if ((now - pClient->smart_start_tick) > 1000 &&
SmartScheduleSlice < SmartScheduleMaxSlice)
{
SmartScheduleSlice += 20;
SmartScheduleSlice += SmartScheduleInterval;
}
}
else
......@@ -425,7 +428,7 @@ Dispatch()
(SmartScheduleTime - start_tick) >= SmartScheduleSlice)
{
/* Penalize clients which consume ticks */
if (client->smart_priority > SmartMinPriority)
if (client->smart_priority > SMART_MIN_PRIORITY)
client->smart_priority--;
break;
}
......@@ -3697,6 +3700,7 @@ void InitClient(client, i, ospriv)
client->smart_priority = 0;
client->smart_start_tick = SmartScheduleTime;
client->smart_stop_tick = SmartScheduleTime;
client->smart_check_tick = SmartScheduleTime;
#endif
}
......
/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.22 2000/02/08 17:18:54 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.23 2000/04/04 19:24:47 dawes Exp $ */
/************************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
......@@ -1732,12 +1732,13 @@ find_existing_fpe(list, num, name, len)
static int
#if NeedFunctionPrototypes
SetFontPathElements(int npaths, unsigned char *paths, int *bad)
SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
#else
SetFontPathElements(npaths, paths, bad)
SetFontPathElements(npaths, paths, bad, persist)
int npaths;
unsigned char *paths;
int *bad;
Bool persist;
#endif
{
int i,
......@@ -1758,71 +1759,83 @@ SetFontPathElements(npaths, paths, bad)
if (fpe_functions[i].set_path_hook)
(*fpe_functions[i].set_path_hook) ();
}
for (i = 0; i < npaths; i++) {
for (i = 0; i < npaths; i++)
{
len = (unsigned int) (*cp++);
if (len) {
if (len == 0)
{
if (persist)
ErrorF ("Removing empty element from the valid list of fontpaths\n");
err = BadValue;
}
else
{
/* if it's already in our active list, just reset it */
/*
* note that this can miss FPE's in limbo -- may be worth catching
* them, though it'd muck up refcounting
*/
fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
if (fpe) {
if (fpe)
{
err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
if (err == Successful) {
if (err == Successful)
{
UseFPE(fpe);/* since it'll be decref'd later when freed
* from the old list */
fplist[valid_paths++] = fpe;
cp += len;
continue;
}
/* if error or can't do it, act like it's a new one */
}
fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
if (!fpe) {
err = BadAlloc;
goto bail;
}
fpe->name = (char *) xalloc(len + 1);
if (!fpe->name) {
xfree(fpe);
err = BadAlloc;
goto bail;
}
fpe->refcount = 1;
strncpy(fpe->name, (char *) cp, (int) len);
cp += len;
fpe->name[len] = '\0';
fpe->name_length = len;
fpe->type = DetermineFPEType(fpe->name);
if (fpe->type == -1) {
xfree(fpe->name);
xfree(fpe);
err = BadValue;
goto bail;
else
fpe = 0;
}
err = (*fpe_functions[fpe->type].init_fpe) (fpe);
if (!loadableFonts) {
if (err != Successful) {
xfree(fpe->name);
/* if error or can't do it, act like it's a new one */
if (!fpe)
{
fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
if (!fpe)
{
err = BadAlloc;
goto bail;
}
fpe->name = (char *) xalloc(len + 1);
if (!fpe->name)
{
xfree(fpe);
err = BadValue;
err = BadAlloc;
goto bail;
}
fplist[valid_paths++] = fpe;
} else {
if (err == Successful) /* a successful font, add it to list */
fplist[valid_paths++] = fpe;
fpe->refcount = 1;
strncpy(fpe->name, (char *) cp, (int) len);
fpe->name[len] = '\0';
fpe->name_length = len;
fpe->type = DetermineFPEType(fpe->name);
if (fpe->type == -1)
err = BadValue;
else
ErrorF("Removing %s from the valid list of fontpaths\n",
fpe->name);
err = (*fpe_functions[fpe->type].init_fpe) (fpe);
if (err != Successful)
{
if (persist)
{
ErrorF("Could not init font path element %s, removing from list!\n",
fpe->name);
}
xfree (fpe->name);
xfree (fpe);
}
}
} else {
err = BadValue;
goto bail;
}
if (err != Successful)
{
if (!persist)
goto bail;
}
else
{
fplist[valid_paths++] = fpe;
}
cp += len;
}
FreeFontPath(font_path_elements, num_fpes, FALSE);
......@@ -1834,8 +1847,8 @@ SetFontPathElements(npaths, paths, bad)
return Success;
bail:
*bad = i;
while (--i >= 0)
FreeFPE(fplist[i]);
while (--valid_paths >= 0)
FreeFPE(fplist[valid_paths]);
xfree(fplist);
return err;
}
......@@ -1854,7 +1867,7 @@ SetFontPath(client, npaths, paths, error)
if (SetDefaultFontPath(defaultFontPath) != Success)
return BadName;
} else {
err = SetFontPathElements(npaths, paths, error);
err = SetFontPathElements(npaths, paths, error, FALSE);
}
return err;
}
......@@ -1894,7 +1907,7 @@ SetDefaultFontPath(path)
}
*nump = (unsigned char) size;
err = SetFontPathElements(num, newpath, &bad);
err = SetFontPathElements(num, newpath, &bad, TRUE);
DEALLOCATE_LOCAL(newpath);
......
/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.29 2000/02/21 01:16:28 mvojkovi Exp $ */
/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.34 2000/05/05 17:53:48 keithp Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
......@@ -282,7 +282,7 @@ static Mask filters[128] =
static CARD8 criticalEvents[32] =
{
0x3c /* key and button events */
0x7c /* key and button events */
};
#ifdef PANORAMIX
......@@ -1584,9 +1584,7 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
if (BitIsOn(criticalEvents, type))
{
#ifdef SMART_SCHEDULE
extern int SmartMaxPriority;
if (client->smart_priority < SmartMaxPriority)
if (client->smart_priority < SMART_MAX_PRIORITY)
client->smart_priority++;
#endif
SetCriticalOutputPending();
......@@ -1821,16 +1819,6 @@ FixUpEventFromWindow(xE, pWin, child, calcChild)
XE_KBPTR.rootX - pWin->drawable.x;
XE_KBPTR.eventY =
XE_KBPTR.rootY - pWin->drawable.y;
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
XE_KBPTR.rootX += panoramiXdataPtr[0].x;
XE_KBPTR.rootY += panoramiXdataPtr[0].y;
if(pWin == WindowTable[0]) {
XE_KBPTR.eventX += panoramiXdataPtr[0].x;
XE_KBPTR.eventY += panoramiXdataPtr[0].y;
}
}
#endif
}
else
{
......@@ -2186,6 +2174,117 @@ NewCurrentScreen(newScreen, x, y)
if (newScreen != sprite.hotPhys.pScreen)
ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE);
}
#ifdef PANORAMIX
static Bool
PanoramiXPointInWindowIsVisible(
WindowPtr pWin,
int x,
int y
)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
BoxRec box;
int i, xoff, yoff;
if (!pWin->realized) return FALSE;
if (POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
return TRUE;
if(!PanoramiXSetWindowPntrs(pWin)) return FALSE;
xoff = x + panoramiXdataPtr[0].x;
yoff = y + panoramiXdataPtr[0].y;
for(i = 1; i < PanoramiXNumScreens; i++) {
pWin = sprite.windows[i];
pScreen = pWin->drawable.pScreen;
x = xoff - panoramiXdataPtr[i].x;
y = yoff - panoramiXdataPtr[i].y;
if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
return TRUE;
}
return FALSE;
}
static int
PanoramiXWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
int x, y;
REQUEST(xWarpPointerReq);
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
if (!dest)
return BadWindow;
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
if (stuff->srcWid != None)
{
int winX, winY;
XID winID = stuff->srcWid;
WindowPtr source;
source = SecurityLookupWindow(winID, client, SecurityReadAccess);
if (!source) return BadWindow;
winX = source->drawable.x;
winY = source->drawable.y;
if(source == WindowTable[0]) {
winX -= panoramiXdataPtr[0].x;
winY -= panoramiXdataPtr[0].y;
}
if (x < winX + stuff->srcX ||
y < winY + stuff->srcY ||
(stuff->srcWidth != 0 &&
winX + stuff->srcX + (int)stuff->srcWidth < x) ||
(stuff->srcHeight != 0 &&
winY + stuff->srcY + (int)stuff->srcHeight < y) ||
!PanoramiXPointInWindowIsVisible(source, x, y))
return Success;
}
if (dest) {
x = dest->drawable.x;
y = dest->drawable.y;
if(dest == WindowTable[0]) {
x -= panoramiXdataPtr[0].x;
y -= panoramiXdataPtr[0].y;
}
}
x += stuff->dstX;
y += stuff->dstY;
if (x < sprite.physLimits.x1)
x = sprite.physLimits.x1;
else if (x >= sprite.physLimits.x2)
x = sprite.physLimits.x2 - 1;
if (y < sprite.physLimits.y1)
y = sprite.physLimits.y1;
else if (y >= sprite.physLimits.y2)
y = sprite.physLimits.y2 - 1;
if (sprite.hotShape)
ConfineToShape(sprite.hotShape, &x, &y);
PanoramiXSetCursorPosition(x, y, TRUE);
return Success;
}
#endif
int
ProcWarpPointer(client)
ClientPtr client;
......@@ -2197,6 +2296,12 @@ ProcWarpPointer(client)
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
#ifdef PANORAMIX
if(!noPanoramiXExtension)
return PanoramiXWarpPointer(client);
#endif
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
......@@ -2227,7 +2332,8 @@ ProcWarpPointer(client)
!PointInWindowIsVisible(source, x, y))
return Success;
}
if (dest) {
if (dest)
{
x = dest->drawable.x;
y = dest->drawable.y;
newScreen = dest->drawable.pScreen;
......@@ -2237,19 +2343,14 @@ ProcWarpPointer(client)
x += stuff->dstX;
y += stuff->dstY;
#ifdef PANORAMIX
if(noPanoramiXExtension) /* Clip to the SLS not Screen 0 */
#endif
{
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 (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 == sprite.hotPhys.pScreen)
{
......@@ -2261,14 +2362,9 @@ ProcWarpPointer(client)
y = sprite.physLimits.y1;
else if (y >= sprite.physLimits.y2)
y = sprite.physLimits.y2 - 1;
#if defined(SHAPE) || defined(PANORAMIX)
#if defined(SHAPE)
if (sprite.hotShape)
ConfineToShape(sprite.hotShape, &x, &y);
#endif
#ifdef PANORAMIX
if(!noPanoramiXExtension)
PanoramiXSetCursorPosition(x, y, TRUE);
else
#endif
(*newScreen->SetCursorPosition)(newScreen, x, y, TRUE);
}
......@@ -3856,18 +3952,12 @@ ProcQueryPointer(client)
rep.root = (ROOT)->drawable.id;
rep.rootX = sprite.hot.x;
rep.rootY = sprite.hot.y;