summaryrefslogtreecommitdiff
path: root/xserver/xfixes
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2013-06-07 17:28:57 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2013-06-07 17:28:57 +0000
commitc0190187060808fe0ad2a09b31f4244757572ff9 (patch)
treeb028697436476ae3ff34218b0b233a233d8a7818 /xserver/xfixes
parent33eda071f5846d332b428de759c5b1649e9cf1ba (diff)
Update to X server 1.14.1. Tested by many during t2k13. Thanks.
Diffstat (limited to 'xserver/xfixes')
-rw-r--r--xserver/xfixes/Makefile.in16
-rw-r--r--xserver/xfixes/cursor.c408
-rw-r--r--xserver/xfixes/region.c6
-rw-r--r--xserver/xfixes/select.c23
-rw-r--r--xserver/xfixes/xfixes.c15
-rw-r--r--xserver/xfixes/xfixes.h17
-rw-r--r--xserver/xfixes/xfixesint.h7
7 files changed, 68 insertions, 424 deletions
diff --git a/xserver/xfixes/Makefile.in b/xserver/xfixes/Makefile.in
index fcc1f3a3f..16164c81f 100644
--- a/xserver/xfixes/Makefile.in
+++ b/xserver/xfixes/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
@@ -213,13 +213,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
DOXYGEN = @DOXYGEN@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
-DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
-DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
-DRI_CFLAGS = @DRI_CFLAGS@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
-DRI_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -241,6 +237,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@
FOP = @FOP@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
+GLX_SYS_LIBS = @GLX_SYS_LIBS@
GLX_TLS = @GLX_TLS@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
@@ -265,6 +262,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
@@ -280,7 +278,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
MAIN_LIB = @MAIN_LIB@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
@@ -379,6 +376,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_LIBS = @XNEST_LIBS@
XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
+XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@
@@ -494,7 +492,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -519,9 +517,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
diff --git a/xserver/xfixes/cursor.c b/xserver/xfixes/cursor.c
index 602b9061e..568e717fa 100644
--- a/xserver/xfixes/cursor.c
+++ b/xserver/xfixes/cursor.c
@@ -56,11 +56,11 @@
#include "windowstr.h"
#include "xace.h"
#include "list.h"
+#include "xibarriers.h"
static RESTYPE CursorClientType;
static RESTYPE CursorHideCountType;
static RESTYPE CursorWindowType;
-RESTYPE PointerBarrierType;
static CursorPtr CursorCurrent[MAXDEVICES];
static DevPrivateKeyRec CursorScreenPrivateKeyRec;
@@ -112,14 +112,6 @@ typedef struct _CursorHideCountRec {
XID resource;
} CursorHideCountRec;
-typedef struct PointerBarrierClient *PointerBarrierClientPtr;
-
-struct PointerBarrierClient {
- ScreenPtr screen;
- struct PointerBarrier barrier;
- struct xorg_list entry;
-};
-
/*
* Wrap DisplayCursor to catch cursor change events
*/
@@ -127,9 +119,7 @@ struct PointerBarrierClient {
typedef struct _CursorScreen {
DisplayCursorProcPtr DisplayCursor;
CloseScreenProcPtr CloseScreen;
- ConstrainCursorHarderProcPtr ConstrainCursorHarder;
CursorHideCountPtr pCursorHideCounts;
- struct xorg_list barriers;
} CursorScreenRec, *CursorScreenPtr;
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -172,14 +162,14 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
CursorCurrent[pDev->id] = pCursor;
for (e = cursorEvents; e; e = e->next) {
if ((e->eventMask & XFixesDisplayCursorNotifyMask)) {
- xXFixesCursorNotifyEvent ev;
-
- ev.type = XFixesEventBase + XFixesCursorNotify;
- ev.subtype = XFixesDisplayCursorNotify;
- ev.window = e->pWindow->drawable.id;
- ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
- ev.timestamp = currentTime.milliseconds;
- ev.name = pCursor ? pCursor->name : None;
+ xXFixesCursorNotifyEvent ev = {
+ .type = XFixesEventBase + XFixesCursorNotify,
+ .subtype = XFixesDisplayCursorNotify,
+ .window = e->pWindow->drawable.id,
+ .cursorSerial = pCursor ? pCursor->serialNumber : 0,
+ .timestamp = currentTime.milliseconds,
+ .name = pCursor ? pCursor->name : None
+ };
WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
}
}
@@ -190,19 +180,17 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
}
static Bool
-CursorCloseScreen(int index, ScreenPtr pScreen)
+CursorCloseScreen(ScreenPtr pScreen)
{
CursorScreenPtr cs = GetCursorScreen(pScreen);
Bool ret;
_X_UNUSED CloseScreenProcPtr close_proc;
_X_UNUSED DisplayCursorProcPtr display_proc;
- ConstrainCursorHarderProcPtr constrain_proc;
Unwrap(cs, pScreen, CloseScreen, close_proc);
Unwrap(cs, pScreen, DisplayCursor, display_proc);
- Unwrap(cs, pScreen, ConstrainCursorHarder, constrain_proc);
deleteCursorHideCountsForScreen(pScreen);
- ret = (*pScreen->CloseScreen) (index, pScreen);
+ ret = (*pScreen->CloseScreen) (pScreen);
free(cs);
return ret;
}
@@ -380,7 +368,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
width = pCursor->bits->width;
height = pCursor->bits->height;
npixels = width * height;
- rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
+ rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
+ 1);
if (!rep)
return BadAlloc;
@@ -409,8 +398,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
swapl(&rep->cursorSerial);
SwapLongs(image, npixels);
}
- WriteToClient(client, sizeof(xXFixesGetCursorImageReply) +
- (npixels << 2), (char *) rep);
+ WriteToClient(client,
+ sizeof(xXFixesGetCursorImageReply) + (npixels << 2), rep);
free(rep);
return Success;
}
@@ -473,11 +462,13 @@ ProcXFixesGetCursorName(ClientPtr client)
str = "";
len = strlen(str);
- reply.type = X_Reply;
- reply.length = bytes_to_int32(len);
- reply.sequenceNumber = client->sequence;
- reply.atom = pCursor->name;
- reply.nbytes = len;
+ reply = (xXFixesGetCursorNameReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(len),
+ .atom = pCursor->name,
+ .nbytes = len
+ };
if (client->swapped) {
swaps(&reply.sequenceNumber);
swapl(&reply.length);
@@ -529,8 +520,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
name = pCursor->name ? NameForAtom(pCursor->name) : "";
nbytes = strlen(name);
nbytesRound = pad_to_int32(nbytes);
- rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
- npixels * sizeof(CARD32) + nbytesRound);
+ rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+ npixels * sizeof(CARD32) + nbytesRound, 1);
if (!rep)
return BadAlloc;
@@ -565,7 +556,7 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
SwapLongs(image, npixels);
}
WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) +
- (npixels << 2) + nbytesRound, (char *) rep);
+ (npixels << 2) + nbytesRound, rep);
free(rep);
return Success;
}
@@ -1007,317 +998,28 @@ CursorFreeWindow(pointer data, XID id)
return 1;
}
-static BOOL
-barrier_is_horizontal(const struct PointerBarrier *barrier)
-{
- return barrier->y1 == barrier->y2;
-}
-
-static BOOL
-barrier_is_vertical(const struct PointerBarrier *barrier)
-{
- return barrier->x1 == barrier->x2;
-}
-
-/**
- * @return The set of barrier movement directions the movement vector
- * x1/y1 → x2/y2 represents.
- */
-int
-barrier_get_direction(int x1, int y1, int x2, int y2)
-{
- int direction = 0;
-
- /* which way are we trying to go */
- if (x2 > x1)
- direction |= BarrierPositiveX;
- if (x2 < x1)
- direction |= BarrierNegativeX;
- if (y2 > y1)
- direction |= BarrierPositiveY;
- if (y2 < y1)
- direction |= BarrierNegativeY;
-
- return direction;
-}
-
-/**
- * Test if the barrier may block movement in the direction defined by
- * x1/y1 → x2/y2. This function only tests whether the directions could be
- * blocked, it does not test if the barrier actually blocks the movement.
- *
- * @return TRUE if the barrier blocks the direction of movement or FALSE
- * otherwise.
- */
-BOOL
-barrier_is_blocking_direction(const struct PointerBarrier * barrier,
- int direction)
-{
- /* Barriers define which way is ok, not which way is blocking */
- return (barrier->directions & direction) != direction;
-}
-
-/**
- * Test if the movement vector x1/y1 → x2/y2 is intersecting with the
- * barrier. A movement vector with the startpoint or endpoint adjacent to
- * the barrier itself counts as intersecting.
- *
- * @param x1 X start coordinate of movement vector
- * @param y1 Y start coordinate of movement vector
- * @param x2 X end coordinate of movement vector
- * @param y2 Y end coordinate of movement vector
- * @param[out] distance The distance between the start point and the
- * intersection with the barrier (if applicable).
- * @return TRUE if the barrier intersects with the given vector
- */
-BOOL
-barrier_is_blocking(const struct PointerBarrier * barrier,
- int x1, int y1, int x2, int y2, double *distance)
-{
- BOOL rc = FALSE;
- float ua, ub, ud;
- int dir = barrier_get_direction(x1, y1, x2, y2);
-
- /* Algorithm below doesn't handle edge cases well, hence the extra
- * checks. */
- if (barrier_is_vertical(barrier)) {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveX && x1 == barrier->x1)
- return FALSE;
- if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
- *distance = 0;
- return TRUE;
- }
- }
- else {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveY && y1 == barrier->y1)
- return FALSE;
- if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
- *distance = 0;
- return TRUE;
- }
- }
-
- /* not an edge case, compute distance */
- ua = 0;
- ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 -
- barrier->x1) * (y2 - y1);
- if (ud != 0) {
- ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
- (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
- ub = ((x2 - x1) * (y1 - barrier->y1) -
- (y2 - y1) * (x1 - barrier->x1)) / ud;
- if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
- ua = 0;
- }
-
- if (ua > 0 && ua <= 1) {
- double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
- double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
-
- *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
- rc = TRUE;
- }
-
- return rc;
-}
-
-/**
- * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2.
- *
- * @param dir Only barriers blocking movement in direction dir are checked
- * @param x1 X start coordinate of movement vector
- * @param y1 Y start coordinate of movement vector
- * @param x2 X end coordinate of movement vector
- * @param y2 Y end coordinate of movement vector
- * @return The barrier nearest to the movement origin that blocks this movement.
- */
-static struct PointerBarrier *
-barrier_find_nearest(CursorScreenPtr cs, int dir,
- int x1, int y1, int x2, int y2)
-{
- struct PointerBarrierClient *c;
- struct PointerBarrier *nearest = NULL;
- double min_distance = INT_MAX; /* can't get higher than that in X anyway */
-
- xorg_list_for_each_entry(c, &cs->barriers, entry) {
- struct PointerBarrier *b = &c->barrier;
- double distance;
-
- if (!barrier_is_blocking_direction(b, dir))
- continue;
-
- if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
- if (min_distance > distance) {
- min_distance = distance;
- nearest = b;
- }
- }
- }
-
- return nearest;
-}
-
-/**
- * Clamp to the given barrier given the movement direction specified in dir.
- *
- * @param barrier The barrier to clamp to
- * @param dir The movement direction
- * @param[out] x The clamped x coordinate.
- * @param[out] y The clamped x coordinate.
- */
-void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
- int *y)
-{
- if (barrier_is_vertical(barrier)) {
- if ((dir & BarrierNegativeX) & ~barrier->directions)
- *x = barrier->x1;
- if ((dir & BarrierPositiveX) & ~barrier->directions)
- *x = barrier->x1 - 1;
- }
- if (barrier_is_horizontal(barrier)) {
- if ((dir & BarrierNegativeY) & ~barrier->directions)
- *y = barrier->y1;
- if ((dir & BarrierPositiveY) & ~barrier->directions)
- *y = barrier->y1 - 1;
- }
-}
-
-static void
-CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
- int *x, int *y)
-{
- CursorScreenPtr cs = GetCursorScreen(screen);
-
- if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) &&
- mode == Relative) {
- int ox, oy;
- int dir;
- struct PointerBarrier *nearest = NULL;
-
- /* where are we coming from */
- miPointerGetPosition(dev, &ox, &oy);
-
- /* How this works:
- * Given the origin and the movement vector, get the nearest barrier
- * to the origin that is blocking the movement.
- * Clamp to that barrier.
- * Then, check from the clamped intersection to the original
- * destination, again finding the nearest barrier and clamping.
- */
- dir = barrier_get_direction(ox, oy, *x, *y);
-
- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
- if (nearest) {
- barrier_clamp_to_barrier(nearest, dir, x, y);
-
- if (barrier_is_vertical(nearest)) {
- dir &= ~(BarrierNegativeX | BarrierPositiveX);
- ox = *x;
- }
- else if (barrier_is_horizontal(nearest)) {
- dir &= ~(BarrierNegativeY | BarrierPositiveY);
- oy = *y;
- }
-
- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
- if (nearest) {
- barrier_clamp_to_barrier(nearest, dir, x, y);
- }
- }
- }
-
- if (cs->ConstrainCursorHarder) {
- screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
- screen->ConstrainCursorHarder(dev, screen, mode, x, y);
- screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
- }
-}
-
-static struct PointerBarrierClient *
-CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
- xXFixesCreatePointerBarrierReq * stuff)
-{
- CursorScreenPtr cs = GetCursorScreen(screen);
- struct PointerBarrierClient *ret = malloc(sizeof(*ret));
-
- if (ret) {
- ret->screen = screen;
- ret->barrier.x1 = min(stuff->x1, stuff->x2);
- ret->barrier.x2 = max(stuff->x1, stuff->x2);
- ret->barrier.y1 = min(stuff->y1, stuff->y2);
- ret->barrier.y2 = max(stuff->y1, stuff->y2);
- ret->barrier.directions = stuff->directions & 0x0f;
- if (barrier_is_horizontal(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
- if (barrier_is_vertical(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
- xorg_list_add(&ret->entry, &cs->barriers);
- }
-
- return ret;
-}
-
int
ProcXFixesCreatePointerBarrier(ClientPtr client)
{
- int err;
- WindowPtr pWin;
- struct PointerBarrierClient *barrier;
- struct PointerBarrier b;
-
REQUEST(xXFixesCreatePointerBarrierReq);
- REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+ REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
LEGAL_NEW_RESOURCE(stuff->barrier, client);
- err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
- if (err != Success) {
- client->errorValue = stuff->window;
- return err;
- }
-
- /* This sure does need fixing. */
- if (stuff->num_devices)
- return BadImplementation;
-
- b.x1 = stuff->x1;
- b.x2 = stuff->x2;
- b.y1 = stuff->y1;
- b.y2 = stuff->y2;
-
- if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
- return BadValue;
-
- /* no 0-sized barriers */
- if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
- return BadValue;
-
- if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
- client, stuff)))
- return BadAlloc;
-
- if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
- return BadAlloc;
-
- return Success;
+ return XICreatePointerBarrier(client, stuff);
}
int
SProcXFixesCreatePointerBarrier(ClientPtr client)
{
REQUEST(xXFixesCreatePointerBarrierReq);
+ int i;
+ CARD16 *in_devices = (CARD16 *) &stuff[1];
swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+ swaps(&stuff->num_devices);
+ REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
+
swapl(&stuff->barrier);
swapl(&stuff->window);
swaps(&stuff->x1);
@@ -1325,52 +1027,21 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
swaps(&stuff->x2);
swaps(&stuff->y2);
swapl(&stuff->directions);
- return ProcXFixesVector[stuff->xfixesReqType] (client);
-}
-
-static int
-CursorFreeBarrier(void *data, XID id)
-{
- struct PointerBarrierClient *b = NULL, *barrier;
- ScreenPtr screen;
- CursorScreenPtr cs;
-
- barrier = container_of(data, struct PointerBarrierClient, barrier);
-
- screen = barrier->screen;
- cs = GetCursorScreen(screen);
-
- /* find and unlink from the screen private */
- xorg_list_for_each_entry(b, &cs->barriers, entry) {
- if (b == barrier) {
- xorg_list_del(&b->entry);
- break;
- }
+ for (i = 0; i < stuff->num_devices; i++) {
+ swaps(in_devices + i);
}
- free(barrier);
- return Success;
+ return ProcXFixesVector[stuff->xfixesReqType] (client);
}
int
ProcXFixesDestroyPointerBarrier(ClientPtr client)
{
- int err;
- void *barrier;
-
REQUEST(xXFixesDestroyPointerBarrierReq);
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
- err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
- PointerBarrierType, client, DixDestroyAccess);
- if (err != Success) {
- client->errorValue = stuff->barrier;
- return err;
- }
-
- FreeResource(stuff->barrier, RT_NONE);
- return Success;
+ return XIDestroyPointerBarrier(client, stuff);
}
int
@@ -1402,10 +1073,8 @@ XFixesCursorInit(void)
cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
if (!cs)
return FALSE;
- xorg_list_init(&cs->barriers);
Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
- Wrap(cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
cs->pCursorHideCounts = NULL;
SetCursorScreen(pScreen, cs);
}
@@ -1415,9 +1084,6 @@ XFixesCursorInit(void)
"XFixesCursorHideCount");
CursorWindowType = CreateNewResourceType(CursorFreeWindow,
"XFixesCursorWindow");
- PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
- "XFixesPointerBarrier");
- return CursorClientType && CursorHideCountType && CursorWindowType &&
- PointerBarrierType;
+ return CursorClientType && CursorHideCountType && CursorWindowType;
}
diff --git a/xserver/xfixes/region.c b/xserver/xfixes/region.c
index 624109de1..0e9ca443f 100644
--- a/xserver/xfixes/region.c
+++ b/xserver/xfixes/region.c
@@ -27,7 +27,6 @@
#include "xfixesint.h"
#include "scrnintstr.h"
#include <picturestr.h>
-extern int RenderErrBase;
#include <regionstr.h>
#include <gcstruct.h>
@@ -558,7 +557,8 @@ ProcXFixesFetchRegion(ClientPtr client)
pBox = RegionRects(pRegion);
nBox = RegionNumRects(pRegion);
- reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
+ reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle),
+ 1);
if (!reply)
return BadAlloc;
reply->type = X_Reply;
@@ -585,7 +585,7 @@ ProcXFixesFetchRegion(ClientPtr client)
swaps(&reply->height);
SwapShorts((INT16 *) pRect, nBox * 4);
}
- (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
+ WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
nBox * sizeof(xRectangle), (char *) reply);
free(reply);
return Success;
diff --git a/xserver/xfixes/select.c b/xserver/xfixes/select.c
index a896846a7..ee8ed6f68 100644
--- a/xserver/xfixes/select.c
+++ b/xserver/xfixes/select.c
@@ -77,19 +77,16 @@ XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args)
}
for (e = selectionEvents; e; e = e->next) {
if (e->selection == selection->selection && (e->eventMask & eventMask)) {
- xXFixesSelectionNotifyEvent ev;
-
- memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
- ev.type = XFixesEventBase + XFixesSelectionNotify;
- ev.subtype = subtype;
- ev.window = e->pWindow->drawable.id;
- if (subtype == XFixesSetSelectionOwnerNotify)
- ev.owner = selection->window;
- else
- ev.owner = 0;
- ev.selection = e->selection;
- ev.timestamp = currentTime.milliseconds;
- ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
+ xXFixesSelectionNotifyEvent ev = {
+ .type = XFixesEventBase + XFixesSelectionNotify,
+ .subtype = subtype,
+ .window = e->pWindow->drawable.id,
+ .owner = (subtype == XFixesSetSelectionOwnerNotify) ?
+ selection->window : 0,
+ .selection = e->selection,
+ .timestamp = currentTime.milliseconds,
+ .selectionTimestamp = selection->lastTimeChanged.milliseconds
+ };
WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
}
}
diff --git a/xserver/xfixes/xfixes.c b/xserver/xfixes/xfixes.c
index f80230fd3..48af9ea6e 100644
--- a/xserver/xfixes/xfixes.c
+++ b/xserver/xfixes/xfixes.c
@@ -48,6 +48,7 @@
#include "xfixesint.h"
#include "protocol-versions.h"
+#include "extinit.h"
static unsigned char XFixesReqCode;
int XFixesEventBase;
@@ -61,19 +62,19 @@ static int
ProcXFixesQueryVersion(ClientPtr client)
{
XFixesClientPtr pXFixesClient = GetXFixesClient(client);
- xXFixesQueryVersionReply rep;
+ xXFixesQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
REQUEST(xXFixesQueryVersionReq);
REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
- memset(&rep, 0, sizeof(xXFixesQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
if (version_compare(stuff->majorVersion, stuff->minorVersion,
SERVER_XFIXES_MAJOR_VERSION,
- SERVER_XFIXES_MAJOR_VERSION) < 0) {
+ SERVER_XFIXES_MINOR_VERSION) < 0) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
}
@@ -90,7 +91,7 @@ ProcXFixesQueryVersion(ClientPtr client)
swapl(&rep.majorVersion);
swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep);
return Success;
}
diff --git a/xserver/xfixes/xfixes.h b/xserver/xfixes/xfixes.h
index 19af09f7d..98828710f 100644
--- a/xserver/xfixes/xfixes.h
+++ b/xserver/xfixes/xfixes.h
@@ -30,7 +30,6 @@
#include "resource.h"
extern _X_EXPORT RESTYPE RegionResType;
-extern _X_EXPORT RESTYPE PointerBarrierType;
extern _X_EXPORT int XFixesErrorBase;
#define VERIFY_REGION(pRegion, rid, client, mode) \
@@ -52,20 +51,6 @@ extern _X_EXPORT int XFixesErrorBase;
extern _X_EXPORT RegionPtr
XFixesRegionCopy(RegionPtr pRegion);
-struct PointerBarrier {
- CARD16 x1, x2, y1, y2;
- CARD32 directions;
-};
-
-extern int
- barrier_get_direction(int, int, int, int);
-extern BOOL
-barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
- double *);
-extern BOOL barrier_is_blocking_direction(const struct PointerBarrier *, int);
-extern void
-
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
- int *y);
+#include "xibarriers.h"
#endif /* _XFIXES_H_ */
diff --git a/xserver/xfixes/xfixesint.h b/xserver/xfixes/xfixesint.h
index 71f88a93d..44e889040 100644
--- a/xserver/xfixes/xfixesint.h
+++ b/xserver/xfixes/xfixesint.h
@@ -71,11 +71,6 @@ typedef struct _XFixesClient {
extern int (*ProcXFixesVector[XFixesNumberRequests]) (ClientPtr);
-/* Initialize extension at server startup time */
-
-void
- XFixesExtensionInit(void);
-
/* Save set */
int
ProcXFixesChangeSaveSet(ClientPtr client);
@@ -296,8 +291,10 @@ int
SProcXFixesDestroyPointerBarrier(ClientPtr client);
/* Xinerama */
+#ifdef PANORAMIX
extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
void PanoramiXFixesInit(void);
void PanoramiXFixesReset(void);
+#endif
#endif /* _XFIXESINT_H_ */