summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkeithp <keithp>2002-09-29 23:39:40 +0000
committerkeithp <keithp>2002-09-29 23:39:40 +0000
commita5a5ea02c4d3ed97275f74f038e0330f3c4505e7 (patch)
treec3d98cae7a312dc4cd9ea4a37823278929c70ae0
parente50f73c70229a69abf96be6ee657c0565aede19f (diff)
Update RandR to 1.0 (library version 2.0)
-rw-r--r--config/cf/X11.tmpl4
-rw-r--r--lib/X11/XErrorDB8
-rw-r--r--lib/Xrandr/Xrandr.c437
-rw-r--r--lib/Xrandr/Xrandr.h85
-rw-r--r--lib/Xrandr/Xrandrint.h44
-rw-r--r--lib/Xrender/Xrender.c19
-rw-r--r--lib/Xrender/Xrender.h4
-rw-r--r--programs/Xserver/hw/kdrive/fbdev/fbdev.c44
-rw-r--r--programs/Xserver/hw/kdrive/kdrive.c47
-rw-r--r--programs/Xserver/hw/kdrive/kdrive.h6
-rw-r--r--programs/Xserver/hw/kdrive/mach64/mach64.c7
-rw-r--r--programs/Xserver/hw/kdrive/vesa/vesa.c55
-rw-r--r--programs/Xserver/hw/kdrive/vesa/vesa.h4
-rw-r--r--programs/Xserver/hw/xfree86/CHANGELOG2
-rw-r--r--programs/Xserver/randr/Imakefile4
-rw-r--r--programs/Xserver/randr/mirandr.c70
-rw-r--r--programs/Xserver/randr/randr.c581
-rw-r--r--programs/Xserver/randr/randrstr.h88
-rw-r--r--programs/Xserver/render/picture.c13
-rw-r--r--programs/Xserver/render/picturestr.h5
-rw-r--r--programs/xrandr/Imakefile4
-rw-r--r--programs/xrandr/xrandr.c185
22 files changed, 745 insertions, 971 deletions
diff --git a/config/cf/X11.tmpl b/config/cf/X11.tmpl
index dfa64258b..80ce3d1ce 100644
--- a/config/cf/X11.tmpl
+++ b/config/cf/X11.tmpl
@@ -5,7 +5,7 @@ XCOMM
XCOMM
XCOMM
XCOMM
-XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.166 2002/09/11 21:57:07 tsi Exp $
+XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.168 2002/09/26 02:56:47 keithp Exp $
/***************************************************************************
* *
@@ -2164,7 +2164,7 @@ ProjectUnsharedLibReferences(XRENDER,Xrender,$(XRENDERLIBSRC),XBuildLibDir)
XRANDRRLIBSRC = $(LIBSRC)/Xrandr
#if SharedLibXrandr
#ifndef SharedXrandrRev
-#define SharedXrandrRev 1.0
+#define SharedXrandrRev 2.0
#endif
SharedLibReferences(XRANDR,Xrandr,$(XRANDRLIBSRC),SOXRANDRREV,SharedXrandrRev)
#else
diff --git a/lib/X11/XErrorDB b/lib/X11/XErrorDB
index 27fabc31e..4db1bf72f 100644
--- a/lib/X11/XErrorDB
+++ b/lib/X11/XErrorDB
@@ -830,4 +830,12 @@ XProtoError.Adobe-DPS-Extension.1: PSErrorBadSpace (invalid Space parameter)
XlibMessage.Adobe-DPS-Extension.1: Space id in failed request: 0x%lx
XProtoError.Adobe-DPS-Extension.2: PSErrorAbort (interpreter aborted)
XlibMessage.Adobe-DPS-Extension.2: Value in failed request: 0x%lx
+! RANDR
+XRequest.RANDR.0: RRQueryVersion
+XRequest.RANDR.1: RROldGetScreenInfo
+XRequest.RANDR.2: RRSetScreenConfig
+XRequest.RANDR.3: RROldScreenChangeSelectInput
+XRequest.RANDR.4: RRSelectInput
+XRequest.RANDR.5: RRGetScreenInfo
+
diff --git a/lib/Xrandr/Xrandr.c b/lib/Xrandr/Xrandr.c
index 3db045376..e0640dde4 100644
--- a/lib/Xrandr/Xrandr.c
+++ b/lib/Xrandr/Xrandr.c
@@ -1,29 +1,35 @@
/*
- * $XFree86: xc/lib/Xrandr/Xrandr.c,v 1.5 2001/06/07 17:54:01 keithp Exp $
+ * $XFree86: xc/lib/Xrandr/Xrandr.c,v 1.6 2001/06/11 01:37:53 keithp Exp $
*
* Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett Packard Company, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Compaq not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
+ * documentation, and that the name of Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. HP makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Author: Jim Gettys, Compaq Computer Corporation, Inc.
+ * Author: Jim Gettys, HP Labs, HP.
*/
+
#include <stdio.h>
#include <X11/Xlib.h>
+/* we need to be able to manipulate the Display structure on events */
+#include <X11/Xlibint.h>
+#include <X11/extensions/render.h>
+#include <X11/extensions/Xrender.h>
#include "Xrandrint.h"
XExtensionInfo XRRExtensionInfo;
@@ -72,7 +78,7 @@ static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
aevent->timestamp = awire->timestamp;
aevent->config_timestamp = awire->configTimestamp;
aevent->size_index = awire->sizeID;
- aevent->visual_group_index = awire->visualGroupID;
+ aevent->subpixel_order = awire->subpixelOrder;
aevent->rotation = awire->rotation;
aevent->width = awire->widthInPixels;
aevent->height = awire->heightInPixels;
@@ -105,7 +111,7 @@ static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire)
awire->root = aevent->root;
awire->window = aevent->window;
awire->sizeID = aevent->size_index;
- awire->visualGroupID = aevent->visual_group_index;
+ awire->subpixelOrder = aevent->subpixel_order;
awire->widthInPixels = aevent->width;
awire->heightInPixels = aevent->height;
awire->widthInMillimeters = aevent->mwidth;
@@ -119,84 +125,156 @@ XExtDisplayInfo *
XRRFindDisplay (Display *dpy)
{
XExtDisplayInfo *dpyinfo;
+ XRandRInfo *xrri;
+ int i, numscreens;
dpyinfo = XextFindDisplay (&XRRExtensionInfo, dpy);
- if (!dpyinfo)
+ if (!dpyinfo) {
dpyinfo = XextAddDisplay (&XRRExtensionInfo, dpy,
XRRExtensionName,
&rr_extension_hooks,
RRNumberEvents, 0);
+ numscreens = ScreenCount(dpy);
+ xrri = Xmalloc (sizeof(XRandRInfo) +
+ sizeof(char *) * numscreens);
+ xrri->config = (XRRScreenConfiguration **)(xrri + 1);
+ for(i = 0; i < numscreens; i++)
+ xrri->config[i] = NULL;
+ xrri->major_version = -1;
+ dpyinfo->data = (char *) xrri;
+ }
return dpyinfo;
}
static int
XRRCloseDisplay (Display *dpy, XExtCodes *codes)
{
+ int i;
+ XRRScreenConfiguration **configs;
XExtDisplayInfo *info = XRRFindDisplay (dpy);
- if (info->data) XFree (info->data);
-
- return XextRemoveDisplay (&XRRExtensionInfo, dpy);
-}
-
-/****************************************************************************
- * *
- * RandR public interfaces *
- * *
- ****************************************************************************/
-int XRRVisualToDepth(Display *dpy, Visual *visual)
-{
- int s;
- for (s = 0; s < ScreenCount(dpy); s++) {
- Screen *sp = ScreenOfDisplay(dpy, s);
- int d;
- for (d = 0; d < sp->ndepths; d++) {
- int v;
- for (v = 0; v < sp->depths[s].nvisuals; v++) {
- if ( &sp->depths[s].visuals[v] == visual ) return d;
+ LockDisplay(dpy);
+ /*
+ * free cached data
+ */
+ configs = (XRRScreenConfiguration **) info->data;
+ if (configs) {
+ for (i = 0; i < ScreenCount(dpy); i++) {
+ if (configs[i] != NULL) XFree (configs[i]);
}
+ XFree (configs);
}
- }
- return -1; /* should not ever happen */
-}
-Visual *XRRVisualIDToVisual(Display *dpy, int screen, VisualID id)
-{
- int d, v;
- Screen *sp = ScreenOfDisplay(dpy, screen);
- for (d = 0; d < sp->ndepths; d++) {
- for (v = 0; v < sp->depths[d].nvisuals; v++) {
- if ( sp->depths[d].visuals[v].visualid == id )
- return (&sp->depths[d].visuals[v]);
- }
- }
- return NULL;
+ if (info->data) XFree (info->data);
+ UnlockDisplay(dpy);
+ return XextRemoveDisplay (&XRRExtensionInfo, dpy);
}
+
-Rotation XRRRotations(XRRScreenConfiguration *config, Rotation *current_rotation)
+Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation)
{
*current_rotation = config->current_rotation;
return config->rotations;
}
-XRRScreenSize *XRRSizes(XRRScreenConfiguration *config, int *nsizes)
+XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes)
{
*nsizes = config->nsizes;
return config->sizes;
}
-Time XRRTimes (XRRScreenConfiguration *config, Time *config_timestamp)
+Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp)
{
*config_timestamp = config->config_timestamp;
return config->timestamp;
}
-SizeID XRRCurrentConfig (XRRScreenConfiguration *config, VisualGroupID *visual_group, Rotation *rotation)
+
+SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
+ Rotation *rotation)
{
- *visual_group = (VisualGroupID) config->current_visual_group;
*rotation = (Rotation) config->current_rotation;
return (SizeID) config->current_size;
}
+/*
+ * Go get the screen configuration data and salt it away for future use;
+ * returns NULL if extension not supported
+ */
+static XRRScreenConfiguration *_XRRValidateCache (Display *dpy, int screen)
+{
+ XExtDisplayInfo *info = XRRFindDisplay (dpy);
+ XRRScreenConfiguration **configs;
+ XRandRInfo *xrri;
+
+ if (XextHasExtension(info)) {
+ xrri = (XRandRInfo *) info->data;
+ configs = xrri->config;
+
+ if (configs[screen] == NULL)
+ configs[screen] = XRRGetScreenInfo (dpy, RootWindow(dpy, screen));
+ return configs[screen];
+ } else {
+ return NULL;
+ }
+}
+
+/* given a screen, return the information from the (possibly) cached data */
+Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation)
+{
+ XRRScreenConfiguration *config;
+ Rotation cr;
+ LockDisplay(dpy);
+ if ((config = _XRRValidateCache(dpy, screen))) {
+ *current_rotation = config->current_rotation;
+ cr = config->rotations;
+ UnlockDisplay(dpy);
+ return cr;
+ }
+ else {
+ UnlockDisplay(dpy);
+ *current_rotation = RR_Rotate_0;
+ return 0; /* no rotations supported */
+ }
+}
+
+/* given a screen, return the information from the (possibly) cached data */
+XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes)
+{
+ XRRScreenConfiguration *config;
+ XRRScreenSize *sizes;
+
+ LockDisplay(dpy);
+ if ((config = _XRRValidateCache(dpy, screen))) {
+ *nsizes = config->nsizes;
+ sizes = config->sizes;
+ UnlockDisplay(dpy);
+ return sizes;
+ }
+ else {
+ UnlockDisplay(dpy);
+ *nsizes = 0;
+ return NULL;
+ }
+}
+
+/* given a screen, return the information from the (possibly) cached data */
+Time XRRTimes (Display *dpy, int screen, Time *config_timestamp)
+{
+ XRRScreenConfiguration *config;
+ Time ts;
+
+ LockDisplay(dpy);
+ if ((config = _XRRValidateCache(dpy, screen))) {
+ *config_timestamp = config->config_timestamp;
+ ts = config->timestamp;
+ UnlockDisplay(dpy);
+ return ts;
+ } else {
+ UnlockDisplay(dpy);
+ return CurrentTime;
+ }
+}
+
int XRRRootToScreen(Display *dpy, Window root)
{
int snum;
@@ -209,7 +287,7 @@ int XRRRootToScreen(Display *dpy, Window root)
Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
- XExtDisplayInfo *info = XRRFindDisplay (dpy);
+ XExtDisplayInfo *info = XRRFindDisplay (dpy);
if (XextHasExtension(info)) {
*event_basep = info->codes->first_event;
@@ -228,71 +306,135 @@ Status XRRQueryVersion (Display *dpy,
XExtDisplayInfo *info = XRRFindDisplay (dpy);
xRRQueryVersionReply rep;
xRRQueryVersionReq *req;
+ XRandRInfo *xrri;
RRCheckExtension (dpy, info, 0);
- LockDisplay (dpy);
- GetReq (RRQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->randrReqType = X_RRQueryVersion;
- req->majorVersion = RANDR_MAJOR;
- req->minorVersion = RANDR_MINOR;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ xrri = (XRandRInfo *) info->data;
+
+ /*
+ * only get the version information from the server if we don't have it already
+ */
+ if (xrri->major_version == -1) {
+ LockDisplay (dpy);
+ GetReq (RRQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->randrReqType = X_RRQueryVersion;
+ req->majorVersion = RANDR_MAJOR;
+ req->minorVersion = RANDR_MINOR;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
+ }
+ xrri->major_version = rep.majorVersion;
+ xrri->minor_version = rep.minorVersion;
}
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
+ *major_versionp = xrri->major_version;
+ *minor_versionp = xrri->minor_version;
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
-XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
+typedef struct _randrVersionState {
+ unsigned long version_seq;
+ Bool error;
+ int major_version;
+ int minor_version;
+} _XRRVersionState;
+
+static Bool
+_XRRVersionHandler (Display *dpy,
+ xReply *rep,
+ char *buf,
+ int len,
+ XPointer data)
+{
+ xRRQueryVersionReply replbuf;
+ xRRQueryVersionReply *repl;
+ _XRRVersionState *state = (_XRRVersionState *) data;
+
+ if (dpy->last_request_read != state->version_seq)
+ return False;
+ if (rep->generic.type == X_Error)
+ {
+ state->error = True;
+ return False;
+ }
+ repl = (xRRQueryVersionReply *)
+ _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len,
+ (SIZEOF(xRRQueryVersionReply) - SIZEOF(xReply)) >> 2,
+ True);
+ state->major_version = repl->majorVersion;
+ state->minor_version = repl->minorVersion;
+ return True;
+}
+/* need a version that does not hold the display lock */
+static XRRScreenConfiguration *_XRRGetScreenInfo (Display *dpy, Window window)
{
XExtDisplayInfo *info = XRRFindDisplay(dpy);
xRRGetScreenInfoReply rep;
xRRGetScreenInfoReq *req;
+ _XAsyncHandler async;
+ _XRRVersionState async_state;
int nbytes, rbytes;
- int i, j;
- int nvisuals, ngroups;
+ int i;
int snum;
xScreenSizes *psize;
char *data;
struct _XRRScreenConfiguration *scp;
- XRRVisualGroup *vgp;
- XRRGroupOfVisualGroup *gvgp;
- XRRVisualGroup **gp;
XRRScreenSize *ssp;
- Visual **vgpp;
CARD32 *data32;
- CARD16 *data16;
+ xRRQueryVersionReq *vreq;
+ XRandRInfo *xrri;
RRCheckExtension (dpy, info, 0);
- LockDisplay (dpy);
+ xrri = (XRandRInfo *) info->data;
+
+ /* hide a version query in the request */
+ GetReq (RRQueryVersion, vreq);
+ vreq->reqType = info->codes->major_opcode;
+ vreq->randrReqType = X_RRQueryVersion;
+ vreq->majorVersion = RANDR_MAJOR;
+ vreq->minorVersion = RANDR_MINOR;
+
+ async_state.version_seq = dpy->request;
+ async_state.error = False;
+ async.next = dpy->async_handlers;
+ async.handler = _XRRVersionHandler;
+ async.data = (XPointer) &async_state;
+ dpy->async_handlers = &async;
+
GetReq (RRGetScreenInfo, req);
req->reqType = info->codes->major_opcode;
req->randrReqType = X_RRGetScreenInfo;
req->window = window;
+
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
{
- UnlockDisplay (dpy);
+ DeqAsyncHandler (dpy, &async);
SyncHandle ();
return NULL;
}
+ DeqAsyncHandler (dpy, &async);
+ if (async_state.error)
+ {
+ SyncHandle();
+ }
+ xrri->major_version = async_state.major_version;
+ xrri->minor_version = async_state.minor_version;
+
nbytes = (long) rep.length << 2;
data = (char *) Xmalloc ((unsigned) nbytes);
if (!data)
{
_XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
_XReadPad (dpy, data, nbytes);
- UnlockDisplay (dpy);
SyncHandle ();
/*
@@ -304,60 +446,23 @@ XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
/* pick up in the protocol buffer after the protocol size information */
psize = (xScreenSizes *) data;
data32 = (CARD32 *) &psize[rep.nSizes];
- vgp = (XRRVisualGroup *) ssp; /* visual groups after size structures */
- /* and groups of visual groups structures after the array of visual groups */
- gvgp = (XRRGroupOfVisualGroup *) &vgp[rep.nVisualGroups];
-
- /*
- * first we count up the number of groups
- */
- nvisuals = 0;
- for (i = 0; i < rep.nVisualGroups; i++) {
- j = *data32;
- data32 += j + 1;
- nvisuals += j;
- }
-
- /*
- * Next comes the groups of visual groups
- */
-
- data16 = (CARD16 *) data32;
- /*
- * We count up the number of groups
- */
- ngroups = 0;
- for (i = 0; i < rep.nGroupsOfVisualGroups; i++) {
- j = *data16;
- data16 += j + 1;
- ngroups += j;
- }
rbytes = sizeof (XRRScreenConfiguration) +
- (rep.nVisualGroups * sizeof (XRRVisualGroup)) +
- (rep.nGroupsOfVisualGroups * sizeof (XRRGroupOfVisualGroup)) +
- (rep.nSizes * sizeof (XRRScreenSize)) +
- (nvisuals * sizeof (Visual *)) +
- (ngroups * sizeof (XRRGroupOfVisualGroup *));
+ (rep.nSizes * sizeof (XRRScreenSize));
+
scp = (struct _XRRScreenConfiguration *) Xmalloc(rbytes);
if (scp == NULL) return NULL;
ssp = (XRRScreenSize *)(scp + 1);
- vgp = (XRRVisualGroup *) (&ssp[rep.nSizes]);
- gvgp = (XRRGroupOfVisualGroup *) (&vgp[rep.nVisualGroups]);
- vgpp = (Visual **) (&gvgp[rep.nGroupsOfVisualGroups]);
- gp = (XRRVisualGroup **) (&vgpp[ngroups]);
/* set up the screen configuration structure */
- scp->screen = ScreenOfDisplay (dpy, (snum = XRRRootToScreen(dpy, rep.root)));
+ scp->screen =
+ ScreenOfDisplay (dpy, (snum = XRRRootToScreen(dpy, rep.root)));
- scp->visual_group = vgp;
- scp->groups_of_visual_groups = gvgp;
scp->sizes = ssp;
scp->rotations = rep.setOfRotations;
scp->current_size = rep.sizeID;
- scp->current_visual_group = rep.visualGroupID;
scp->current_rotation = rep.rotation;
scp->timestamp = rep.timestamp;
scp->config_timestamp = rep.configTimestamp;
@@ -368,7 +473,7 @@ XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
*/
/*
- * First comes the size information
+ * Just the size information
*/
psize = (xScreenSizes *) data;
for (i = 0; i < rep.nSizes; i++) {
@@ -376,57 +481,44 @@ XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
ssp[i].height = psize[i].heightInPixels;
ssp[i].mwidth = psize[i].widthInMillimeters;
ssp[i].mheight = psize[i].heightInMillimeters;
- ssp[i].group = psize[i].visualGroup;
}
- /*
- * Next comes the visual groups
- */
-
- data32 = (CARD32 *) &psize[i];
-
- for (i = 0; i < rep.nVisualGroups; i++) {
- vgp[i].visuals = vgpp;
- vgp[i].nvisuals = (int) *data32++;
- for (j = 0; j < vgp->nvisuals; j++) {
- *vgpp = XRRVisualIDToVisual(dpy, snum, (VisualID) *data32++);
- vgpp += 1;
- }
- }
-
-
- data16 = (CARD16 *) data32;
-
- for (i = 0; i < rep.nGroupsOfVisualGroups; i++) {
- gvgp[i].groups = gp;
- gvgp[i].ngroups = (int) *data16++;
- for (j = 0; j < gvgp[i].ngroups; j++) {
- gvgp[i].groups[j] = &vgp[*data16++];
- gp += 1;
- }
- }
-
return (XRRScreenConfiguration *)(scp);
}
+
+XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
+{
+ XRRScreenConfiguration *config;
+ LockDisplay (dpy);
+ config = _XRRGetScreenInfo(dpy, window);
+ UnlockDisplay (dpy);
+ return config;
+}
+
-void XRRFreeScreenInfo (XRRScreenConfiguration *config)
+void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config)
{
Xfree (config);
}
-void XRRScreenChangeSelectInput (Display *dpy, Window window, Bool enable)
+
+/*
+ * in protocol version 0.1, routine added to allow selecting for new events.
+ */
+
+void XRRSelectInput (Display *dpy, Window window, int mask)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
- xRRScreenChangeSelectInputReq *req;
+ xRRSelectInputReq *req;
RRSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
- GetReq (RRScreenChangeSelectInput, req);
+ GetReq (RRSelectInput, req);
req->reqType = info->codes->major_opcode;
- req->randrReqType = X_RRScreenChangeSelectInput;
+ req->randrReqType = X_RRSelectInput;
req->window = window;
- req->enable = xFalse;
- if (enable) req->enable = xTrue;
+ req->enable = 0;
+ if (mask) req->enable = mask;
UnlockDisplay (dpy);
SyncHandle ();
return;
@@ -436,7 +528,6 @@ Status XRRSetScreenConfig (Display *dpy,
XRRScreenConfiguration *config,
Drawable draw,
int size_index,
- int visual_group_index,
Rotation rotation, Time timestamp)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
@@ -451,7 +542,6 @@ Status XRRSetScreenConfig (Display *dpy,
req->randrReqType = X_RRSetScreenConfig;
req->drawable = draw;
req->sizeID = size_index;
- req->visualGroupID = visual_group_index;
req->rotation = rotation;
req->timestamp = timestamp;
req->configTimestamp = config->config_timestamp;
@@ -464,9 +554,56 @@ Status XRRSetScreenConfig (Display *dpy,
config->screen = ScreenOfDisplay (dpy, XRRRootToScreen(dpy, rep.root));
config->current_size = size_index;
config->current_rotation = rotation;
- config->current_visual_group = visual_group_index;
}
UnlockDisplay (dpy);
SyncHandle ();
return(rep.status);
}
+
+int XRRUpdateConfiguration(XEvent *event)
+{
+ XRRScreenChangeNotifyEvent *scevent;
+ XConfigureEvent *rcevent;
+ Display *dpy = event->xany.display;
+ XExtDisplayInfo *info;
+ XRandRInfo *xrri;
+ int snum;
+
+ /* first, see if it is a vanilla configure notify event */
+ if (event->type == ConfigureNotify) {
+ rcevent = (XConfigureEvent *) event;
+ snum = XRRRootToScreen(dpy, rcevent->window);
+ dpy->screens[snum].width = rcevent->width;
+ dpy->screens[snum].height = rcevent->height;
+ return 1;
+ }
+
+ info = XRRFindDisplay(dpy);
+ RRCheckExtension (dpy, info, 0);
+
+ switch (event->type - info->codes->first_event) {
+ case RRScreenChangeNotify:
+ scevent = (XRRScreenChangeNotifyEvent *) event;
+ snum = XRRRootToScreen(dpy,
+ ((XRRScreenChangeNotifyEvent *) event)->root);
+ dpy->screens[snum].width = scevent->width;
+ dpy->screens[snum].height = scevent->height;
+ dpy->screens[snum].mwidth = scevent->mwidth;
+ dpy->screens[snum].mheight = scevent->mheight;
+ XRenderSetSubpixelOrder (dpy, snum, scevent->subpixel_order);
+ break;
+ default:
+ return 0;
+ }
+ xrri = (XRandRInfo *) info->data;
+ /*
+ * so the next time someone wants some data, it will be fetched;
+ * it might be better to force the round trip immediately, but
+ * I dislike pounding the server simultaneously when not necessary
+ */
+ if (xrri->config[snum] != NULL) {
+ XFree (xrri->config[snum]);
+ xrri->config[snum] = NULL;
+ }
+ return 1;
+}
diff --git a/lib/Xrandr/Xrandr.h b/lib/Xrandr/Xrandr.h
index 3a3fc1607..bd39d602b 100644
--- a/lib/Xrandr/Xrandr.h
+++ b/lib/Xrandr/Xrandr.h
@@ -1,7 +1,8 @@
/*
- * $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.7 2001/08/01 00:44:40 tsi Exp $
+ * $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.8 2001/11/23 23:26:38 keithp Exp $
*
* Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett-Packard Company, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -9,18 +10,18 @@
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Compaq not be used in advertising or
* publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
+ * written prior permission. HP makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Author: Jim Gettys, Compaq Computer Corporation
+ * Author: Jim Gettys, HP Labs, HP.
*/
#ifndef _XRANDR_H_
@@ -32,15 +33,6 @@
_XFUNCPROTOBEGIN
-typedef struct {
- int nvisuals;
- Visual **visuals;
-} XRRVisualGroup;
-
-typedef struct {
- int ngroups;
- XRRVisualGroup **groups;
-} XRRGroupOfVisualGroup;
typedef struct {
int width, height;
@@ -49,7 +41,7 @@ typedef struct {
} XRRScreenSize;
/*
- * Events
+ * Events.
*/
typedef struct {
@@ -59,10 +51,10 @@ typedef struct {
Display *display; /* Display the event was read from */
Window window; /* window which selected for this event */
Window root; /* Root window for changed screen */
- Time timestamp;
- Time config_timestamp;
+ Time timestamp; /* when the screen change occurred */
+ Time config_timestamp; /* when the last configuration change */
SizeID size_index;
- VisualGroupID visual_group_index;
+ SubpixelOrder subpixel_order;
Rotation rotation;
int width;
int height;
@@ -70,11 +62,11 @@ typedef struct {
int mheight;
} XRRScreenChangeNotifyEvent;
+
/* internal representation is private to the library */
typedef struct _XRRScreenConfiguration XRRScreenConfiguration;
Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep);
-
Status XRRQueryVersion (Display *dpy,
int *major_versionp,
int *minor_versionp);
@@ -82,32 +74,65 @@ Status XRRQueryVersion (Display *dpy,
XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
Drawable draw);
-void XRRFreeScreenInfo (XRRScreenConfiguration *config);
-
+void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);
+
+/*
+ * Note that screen configuration changes are only permitted if the client can
+ * prove it has up to date configuration information. We are trying to
+ * insist that it become possible for screens to change dynamically, so
+ * we want to ensure the client knows what it is talking about when requesting
+ * changes.
+ */
Status XRRSetScreenConfig (Display *dpy,
XRRScreenConfiguration *config,
Drawable draw,
int size_index,
- int visual_group_index,
Rotation rotation,
Time timestamp);
-XRRScreenSize *XRRSizes(XRRScreenConfiguration *config, int *nsizes);
-
-void XRRScreenChangeSelectInput (Display *dpy, Window window, Bool enable);
-Visual *XRRVisualIDToVisual(Display *dpy, int screen, VisualID id);
+Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
-int XRRVisualToDepth(Display *dpy, Visual *visual);
+Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);
-Rotation XRRRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
+XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);
-Time XRRTimes (XRRScreenConfiguration *config, Time *config_timestamp);
-
-SizeID XRRCurrentConfig (XRRScreenConfiguration *config, VisualGroupID *visual_group, Rotation *rotation);
+SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
+ Rotation *rotation);
int XRRRootToScreen(Display *dpy, Window root);
+/*
+ * returns the screen configuration for the specified screen; does a lazy
+ * evalution to delay getting the information, and caches the result.
+ * These routines should be used in preference to XRRGetScreenInfo
+ * to avoid unneeded round trips to the X server. These are new
+ * in protocol version 0.1.
+ */
+
+
+XRRScreenConfiguration *XRRScreenConfig(Display *dpy, int screen);
+XRRScreenConfiguration *XRRConfig(Screen *screen);
+void XRRSelectInput(Display *dpy, Window window, int mask);
+
+/*
+ * the following are always safe to call, even if RandR is not implemented
+ * on a screen
+ */
+
+
+Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);
+XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);
+Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);
+
+
+/*
+ * intended to take RRScreenChangeNotify, or
+ * ConfigureNotify (on the root window)
+ * returns 1 if it is an event type it understands, 0 if not
+ */
+int XRRUpdateConfiguration(XEvent *event);
+
_XFUNCPROTOEND
#endif /* _XRANDR_H_ */
diff --git a/lib/Xrandr/Xrandrint.h b/lib/Xrandr/Xrandrint.h
index 31741f317..7957d39d1 100644
--- a/lib/Xrandr/Xrandrint.h
+++ b/lib/Xrandr/Xrandrint.h
@@ -1,26 +1,28 @@
/*
- * $XFree86: xc/lib/Xrandr/Xrandrint.h,v 1.1 2001/05/23 03:29:44 keithp Exp $
+ * $XFree86: xc/lib/Xrandr/Xrandrint.h,v 1.2 2001/06/07 15:33:43 keithp Exp $
*
- * Copyright © 2000 Compaq Computer Corporation, Inc.
+ *
+ * Copyright © 2000, Compaq Computer Corporation,
+ * Copyright © 2002, Hewlett Packard, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Compaq not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
+ * documentation, and that the name of Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. HP makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Author: Jim Gettys, Compaq Computer Corporation, Inc.
+ * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
*/
#ifndef _XRANDRINT_H_
@@ -41,27 +43,41 @@ extern char XrandrExtensionName[];
#define RRCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, XRRExtensionName, val)
-
#define RRSimpleCheckExtension(dpy,i) \
XextSimpleCheckExtension (dpy, i, XRRExtensionName)
-XExtDisplayInfo *
-XRRFindDisplay (Display *dpy);
+XExtDisplayInfo *XRRFindDisplay (Display *dpy);
+
/* deliberately opaque internal data structure; can be extended,
but not reordered */
struct _XRRScreenConfiguration {
Screen *screen; /* the root window in GetScreenInfo */
- XRRVisualGroup *visual_group;
- XRRGroupOfVisualGroup *groups_of_visual_groups;
XRRScreenSize *sizes;
Rotation rotations;
Rotation current_rotation;
int nsizes;
int current_size;
- int current_visual_group;
Time timestamp;
Time config_timestamp;
+ int subpixel_order; /* introduced in randr v0.1 */
};
+/*
+ * if a configure notify on the root is recieved, or
+ * an XRRScreenChangeNotify is recieved,
+ * XRRUpdateConfiguration should be called to update the X library's
+ * view of the screen configuration; it will also invalidate the cache
+ * provided by XRRScreenConfig and XRRConfig, and force a round trip
+ * when next used. Returns invalid status if not an event type
+ * the library routine understand.
+ */
+
+/* we cache one screen configuration/screen */
+
+typedef struct _XRandRInfo {
+ XRRScreenConfiguration **config;
+ int major_version, minor_version; /* major_version = -1 means we don't know */
+} XRandRInfo;
+
#endif /* _XRANDRINT_H_ */
diff --git a/lib/Xrender/Xrender.c b/lib/Xrender/Xrender.c
index 27caa165e..87926a924 100644
--- a/lib/Xrender/Xrender.c
+++ b/lib/Xrender/Xrender.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/lib/Xrender/Xrender.c,v 1.10 2002/05/17 23:54:57 keithp Exp $
+ * $XFree86: xc/lib/Xrender/Xrender.c,v 1.11 2002/09/26 02:56:52 keithp Exp $
*
* Copyright © 2000 SuSE, Inc.
*
@@ -337,6 +337,23 @@ XRenderQuerySubpixelOrder (Display *dpy, int screen)
return xri->screen[screen].subpixel;
}
+Bool
+XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel)
+{
+ XExtDisplayInfo *info = XRenderFindDisplay (dpy);
+ XRenderInfo *xri;
+
+ if (!XextHasExtension (info))
+ return False;
+
+ if (!XRenderQueryFormats (dpy))
+ return False;
+
+ xri = (XRenderInfo *) info->data;
+ xri->screen[screen].subpixel = subpixel;
+ return True;
+}
+
XRenderPictFormat *
XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual)
{
diff --git a/lib/Xrender/Xrender.h b/lib/Xrender/Xrender.h
index 467462f15..1fab8f62f 100644
--- a/lib/Xrender/Xrender.h
+++ b/lib/Xrender/Xrender.h
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/lib/Xrender/Xrender.h,v 1.12 2002/05/15 06:42:49 keithp Exp $
+ * $XFree86: xc/lib/Xrender/Xrender.h,v 1.15 2002/09/26 02:56:52 keithp Exp $
*
* Copyright © 2000 SuSE, Inc.
*
@@ -171,6 +171,8 @@ Status XRenderQueryFormats (Display *dpy);
int XRenderQuerySubpixelOrder (Display *dpy, int screen);
+Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel);
+
XRenderPictFormat *
XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual);
diff --git a/programs/Xserver/hw/kdrive/fbdev/fbdev.c b/programs/Xserver/hw/kdrive/fbdev/fbdev.c
index b5e2df9f9..6b943f906 100644
--- a/programs/Xserver/hw/kdrive/fbdev/fbdev.c
+++ b/programs/Xserver/hw/kdrive/fbdev/fbdev.c
@@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.27 2001/07/20 19:35:29 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.28 2001/07/24 19:06:03 keithp Exp $ */
#include "fbdev.h"
@@ -417,6 +417,7 @@ fbdevLayerCreate (ScreenPtr pScreen)
update = 0;
window = 0;
}
+
return LayerCreate (pScreen, kind, screen->fb[0].depth,
pPixmap, update, window, scrpriv->rotation, 0);
}
@@ -430,8 +431,6 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
FbdevPriv *priv = pScreenPriv->card->driver;
KdScreenInfo *screen = pScreenPriv->screen;
FbdevScrPriv *scrpriv = screen->driver;
- RRVisualGroupPtr pVisualGroup;
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
RRScreenSizePtr pSize;
Rotation rotateKind;
int rotation;
@@ -445,42 +444,11 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
if (n == pScreen->numDepths)
return FALSE;
- pVisualGroup = RRCreateVisualGroup (pScreen);
- if (!pVisualGroup)
- return FALSE;
- if (!RRAddDepthToVisualGroup (pScreen,
- pVisualGroup,
- &pScreen->allowedDepths[n]))
- {
- RRDestroyVisualGroup (pScreen, pVisualGroup);
- return FALSE;
- }
-
- pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup);
- if (!pVisualGroup)
- return FALSE;
-
- pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen);
-
- if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen,
- pGroupOfVisualGroup,
- pVisualGroup))
- {
- RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- /* pVisualGroup left until screen closed */
- return FALSE;
- }
-
- pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- if (!pGroupOfVisualGroup)
- return FALSE;
-
pSize = RRRegisterSize (pScreen,
screen->width,
screen->height,
screen->width_mm,
- screen->height_mm,
- pGroupOfVisualGroup);
+ screen->height_mm);
rotation = scrpriv->rotation - screen->rotation;
if (rotation < 0)
@@ -502,7 +470,7 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
break;
}
- RRSetCurrentConfig (pScreen, rotateKind, pSize, pVisualGroup);
+ RRSetCurrentConfig (pScreen, rotateKind, pSize);
return TRUE;
}
@@ -532,8 +500,7 @@ fbdevLayerRemove (WindowPtr pWin, pointer value)
fbdevRandRSetConfig (ScreenPtr pScreen,
Rotation rotateKind,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup)
+ RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
@@ -598,6 +565,7 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
WalkTree (pScreen, fbdevLayerRemove, (pointer) scrpriv->pLayer);
LayerDestroy (pScreen, scrpriv->pLayer);
scrpriv->pLayer = pNewLayer;
+ KdSetSubpixelOrder (pScreen, scrpriv->rotation);
if (wasEnabled)
KdEnableScreen (pScreen);
}
diff --git a/programs/Xserver/hw/kdrive/kdrive.c b/programs/Xserver/hw/kdrive/kdrive.c
index e068fd18b..e7fabd96c 100644
--- a/programs/Xserver/hw/kdrive/kdrive.c
+++ b/programs/Xserver/hw/kdrive/kdrive.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.21tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.25 2002/09/26 02:56:48 keithp Exp $
*
* Copyright © 1999 Keith Packard
*
@@ -384,6 +384,7 @@ KdParseScreen (KdScreenInfo *screen,
screen->height = 0;
screen->width_mm = 0;
screen->height_mm = 0;
+ screen->subpixel_order = kdSubpixelOrder;
screen->rate = 0;
for (fb = 0; fb < KD_MAX_FB; fb++)
screen->fb[fb].depth = 0;
@@ -427,7 +428,8 @@ KdParseScreen (KdScreenInfo *screen,
kdOrigin.y = 0;
kdDumbDriver = FALSE;
kdSoftCursor = FALSE;
-
+ kdSubpixelOrder = SubPixelUnknown;
+
if (delim == '@')
{
arg = KdParseFindNext (arg, "x", save, &delim);
@@ -854,6 +856,45 @@ KdCreateWindow (WindowPtr pWin)
return fbCreateWindow (pWin);
}
+void
+KdSetSubpixelOrder (ScreenPtr pScreen, int rotation)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int subpixel_order = screen->subpixel_order;
+ int subpixel_dir;
+ int i;
+
+ struct {
+ int subpixel_order;
+ int direction;
+ } orders[] = {
+ { SubPixelHorizontalRGB, 0 },
+ { SubPixelHorizontalBGR, 180 },
+ { SubPixelVerticalRGB, 270 },
+ { SubPixelVerticalBGR, 90 },
+ };
+
+ /* map subpixel to direction */
+ for (i = 0; i < 4; i++)
+ if (orders[i].subpixel_order == subpixel_order)
+ break;
+ if (i < 4)
+ {
+ subpixel_dir = orders[i].direction;
+ /* add rotation */
+ subpixel_dir += rotation;
+ /* map back to subpixel order */
+ for (i = 0; i < 4; i++)
+ if (orders[i].direction == subpixel_dir)
+ {
+ subpixel_order = orders[i].subpixel_order;
+ break;
+ }
+ }
+ PictureSetSubpixelOrder (pScreen, subpixel_order);
+}
+
/* Pass through AddScreen, which doesn't take any closure */
static KdScreenInfo *kdCurrentScreen;
@@ -1025,7 +1066,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
- PictureSetSubpixelOrder (pScreen, kdSubpixelOrder);
+ KdSetSubpixelOrder (pScreen, screen->rotation);
/*
* Enable the hardware
diff --git a/programs/Xserver/hw/kdrive/kdrive.h b/programs/Xserver/hw/kdrive/kdrive.h
index d2f0d47d5..5a4db18b0 100644
--- a/programs/Xserver/hw/kdrive/kdrive.h
+++ b/programs/Xserver/hw/kdrive/kdrive.h
@@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.21 2001/10/12 06:33:07 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.22 2002/08/02 16:15:02 keithp Exp $ */
#include <stdio.h>
#include "X.h"
@@ -108,6 +108,7 @@ typedef struct _KdScreenInfo {
int rate;
int width_mm;
int height_mm;
+ int subpixel_order;
Bool dumb;
Bool softCursor;
int mynum;
@@ -561,6 +562,9 @@ void
KdInitOutput (ScreenInfo *pScreenInfo,
int argc, char **argv);
+void
+KdSetSubpixelOrder (ScreenPtr pScreen, int rotation);
+
/* kinfo.c */
KdCardInfo *
KdCardInfoAdd (KdCardFuncs *funcs,
diff --git a/programs/Xserver/hw/kdrive/mach64/mach64.c b/programs/Xserver/hw/kdrive/mach64/mach64.c
index 6e49465c0..c78718330 100644
--- a/programs/Xserver/hw/kdrive/mach64/mach64.c
+++ b/programs/Xserver/hw/kdrive/mach64/mach64.c
@@ -19,7 +19,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.7 2001/07/24 19:06:03 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.8 2001/07/24 21:26:17 keithp Exp $ */
#include "mach64.h"
#include <sys/io.h>
@@ -123,14 +123,13 @@ mach64InitScreen (ScreenPtr pScreen)
#ifdef RANDR
mach64RandRSetConfig (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup)
+ RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
KdCheckSync (pScreen);
- if (!vesaRandRSetConfig (pScreen, rotation, pSize, pVisualGroup))
+ if (!vesaRandRSetConfig (pScreen, rotation, pSize))
return FALSE;
return TRUE;
diff --git a/programs/Xserver/hw/kdrive/vesa/vesa.c b/programs/Xserver/hw/kdrive/vesa/vesa.c
index 85e44d535..3fcc9a2e3 100644
--- a/programs/Xserver/hw/kdrive/vesa/vesa.c
+++ b/programs/Xserver/hw/kdrive/vesa/vesa.c
@@ -19,7 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.17 2001/09/05 07:12:42 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.18 2001/09/14 19:25:17 keithp Exp $ */
#include "vesa.h"
#ifdef RANDR
@@ -1010,8 +1010,6 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
int nmode;
int n;
- RRVisualGroupPtr pVisualGroup;
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
RRScreenSizePtr pSize;
*rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270;
@@ -1026,46 +1024,6 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
xfree (priv->modes);
priv->modes = modes;
priv->nmode = nmode;
- /*
- * XXX Create a single set of visual sets that has all of the visuals
- * for the root depth
- */
- for (n = 0; n < pScreen->numDepths; n++)
- if (pScreen->allowedDepths[n].numVids)
- break;
- if (n == pScreen->numDepths)
- return FALSE;
-
- pVisualGroup = RRCreateVisualGroup (pScreen);
- if (!pVisualGroup)
- return FALSE;
-
- if (!RRAddDepthToVisualGroup (pScreen,
- pVisualGroup,
- &pScreen->allowedDepths[n]))
- {
- RRDestroyVisualGroup (pScreen, pVisualGroup);
- return FALSE;
- }
- pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup);
- if (!pVisualGroup)
- return FALSE;
-
- pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen);
-
- if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen,
- pGroupOfVisualGroup,
- pVisualGroup))
- {
- RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- /* pVisualGroup left until screen closed */
- return FALSE;
- }
-
- pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- if (!pGroupOfVisualGroup)
- return FALSE;
-
for (n = 0; n < nmode; n++)
{
mode = &priv->modes[n];
@@ -1102,8 +1060,7 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
}
pSize = RRRegisterSize (pScreen,
width, height,
- width_mm, height_mm,
- pGroupOfVisualGroup);
+ width_mm, height_mm);
if (mode->XResolution == screen->width &&
mode->YResolution == screen->height)
{
@@ -1117,8 +1074,7 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
case 180: rot = RR_Rotate_180; break;
case 270: rot = RR_Rotate_270; break;
}
- RRSetCurrentConfig (pScreen, rot, pSize,
- pVisualGroup);
+ RRSetCurrentConfig (pScreen, rot, pSize);
}
}
}
@@ -1152,8 +1108,7 @@ vesaLayerRemove (WindowPtr pWin, pointer value)
Bool
vesaRandRSetConfig (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup)
+ RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
VesaModePtr mode;
@@ -1300,6 +1255,8 @@ vesaRandRSetConfig (ScreenPtr pScreen,
pscr->pLayer = pNewLayer;
+ /* set the subpixel order */
+ KdSetSubpixelOrder (pScreen, pscr->rotate);
if (wasEnabled)
KdEnableScreen (pScreen);
diff --git a/programs/Xserver/hw/kdrive/vesa/vesa.h b/programs/Xserver/hw/kdrive/vesa/vesa.h
index fc8f7fa19..bab436fab 100644
--- a/programs/Xserver/hw/kdrive/vesa/vesa.h
+++ b/programs/Xserver/hw/kdrive/vesa/vesa.h
@@ -19,7 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.11 2001/07/20 19:35:30 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.12 2001/09/05 07:12:42 keithp Exp $ */
#ifndef _VESA_H_
#define _VESA_H_
@@ -165,4 +165,4 @@ vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
int
vesaProcessArgument (int argc, char **argv, int i);
-#endif _VESA_H_
+#endif /* _VESA_H_ */
diff --git a/programs/Xserver/hw/xfree86/CHANGELOG b/programs/Xserver/hw/xfree86/CHANGELOG
index fca4f2df6..ed7fa938d 100644
--- a/programs/Xserver/hw/xfree86/CHANGELOG
+++ b/programs/Xserver/hw/xfree86/CHANGELOG
@@ -1,4 +1,6 @@
XFree86 4.2.99.2 (xx September 2002)
+ 352. Update RandR extension to 1.0. Eliminate depth switching
+ (Keith Packard)
351. Fix XDarwin rootless crash when window resizing with complex bit
gravity (Greg Parker).
350. Fix some incorrect mappings in the gbk-0.enc encodings file (#5313,
diff --git a/programs/Xserver/randr/Imakefile b/programs/Xserver/randr/Imakefile
index 51c6bd37e..73b0dfbba 100644
--- a/programs/Xserver/randr/Imakefile
+++ b/programs/Xserver/randr/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2000/08/25 23:40:56 keithp Exp $
+XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $
#include <Server.tmpl>
SRCS = randr.c mirandr.c
@@ -7,7 +7,7 @@ XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2000/08/25 23:40:56 ke
INCLUDES = -I../include -I../mi -I../../../include/fonts \
-I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
- -I$(FONTINCSRC)
+ -I$(FONTINCSRC) -I../render
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
NormalLibraryTarget(randr,$(OBJS))
diff --git a/programs/Xserver/randr/mirandr.c b/programs/Xserver/randr/mirandr.c
index e5915ad99..579029115 100644
--- a/programs/Xserver/randr/mirandr.c
+++ b/programs/Xserver/randr/mirandr.c
@@ -1,29 +1,30 @@
/*
- * $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.4 2001/06/03 21:52:44 keithp Exp $
+ * $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.5 2001/06/04 09:45:40 keithp Exp $
*
- * Copyright © 2001 Compaq Computer Corporation
+ * Copyright © 2000, Compaq Computer Corporation,
+ * Copyright © 2002, Hewlett Packard, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Compaq not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Compaq makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
+ * documentation, and that the name of Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. HP makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
*
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Author: Jim Gettys, Compaq Computer Corporation
+ * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
*/
+
#include "scrnintstr.h"
#include "mi.h"
#include "randr.h"
@@ -36,6 +37,7 @@
* can be displayed simultaneously. It further assumes that
* only a single size is available. Hardware providing
* additional capabilties should use different code.
+ * XXX what to do here....
*/
Bool
@@ -49,52 +51,23 @@ miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
if (pScreen->allowedDepths[i].numVids)
{
- RRVisualGroupPtr pVisualGroup;
-
- pVisualGroup = RRCreateVisualGroup (pScreen);
- if (pVisualGroup)
- {
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
RRScreenSizePtr pSize;
- if (!RRAddDepthToVisualGroup (pScreen,
- pVisualGroup,
- &pScreen->allowedDepths[i]))
- {
- RRDestroyVisualGroup (pScreen, pVisualGroup);
- return FALSE;
- }
- pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup);
- if (!pVisualGroup)
- return FALSE;
-
- pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen);
-
- if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen,
- pGroupOfVisualGroup,
- pVisualGroup))
- {
- RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- /* pVisualGroup left until screen closed */
- return FALSE;
- }
-
pSize = RRRegisterSize (pScreen,
pScreen->width,
pScreen->height,
pScreen->mmWidth,
- pScreen->mmHeight,
- pGroupOfVisualGroup);
+ pScreen->mmHeight);
if (!pSize)
return FALSE;
if (!setConfig)
{
- RRSetCurrentConfig (pScreen, RR_Rotate_0, pSize, pVisualGroup);
+ RRSetCurrentConfig (pScreen, RR_Rotate_0, pSize);
setConfig = TRUE;
}
- }
}
}
+ return TRUE;
}
/*
@@ -104,8 +77,7 @@ miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
Bool
miRRSetConfig (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup)
+ RRScreenSizePtr pSize)
{
return TRUE;
}
diff --git a/programs/Xserver/randr/randr.c b/programs/Xserver/randr/randr.c
index 9f33c49b3..d539cfbad 100644
--- a/programs/Xserver/randr/randr.c
+++ b/programs/Xserver/randr/randr.c
@@ -1,28 +1,30 @@
/*
- * $XFree86: xc/programs/Xserver/randr/randr.c,v 1.11 2001/06/26 19:47:00 keithp Exp $
+ * $XFree86: xc/programs/Xserver/randr/randr.c,v 1.12 2001/07/20 19:30:11 keithp Exp $
*
- * Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2000, Compaq Computer Corporation,
+ * Copyright © 2002, Hewlett Packard, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Compaq not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
+ * documentation, and that the name of Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. HP makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Author: Jim Gettys, Compaq Computer Corporation, Inc.
+ * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
*/
+
#define NEED_REPLIES
#define NEED_EVENTS
#include "X.h"
@@ -39,6 +41,8 @@
#include "randr.h"
#include "randrproto.h"
#include "randrstr.h"
+#include "render.h" /* we share subpixel order information */
+#include "picturestr.h"
#include "Xfuncproto.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
@@ -82,6 +86,7 @@ typedef struct _RREvent {
ClientPtr client;
WindowPtr window;
XID clientResource;
+ int mask;
} RREventRec;
int rrPrivIndex = -1;
@@ -100,18 +105,14 @@ RRCloseScreen (int i, ScreenPtr pScreen)
unwrap (pScrPriv, pScreen, CloseScreen);
if (pScrPriv->pSizes)
xfree (pScrPriv->pSizes);
- if (pScrPriv->pGroupsOfVisualGroups)
- xfree (pScrPriv->pGroupsOfVisualGroups);
- if (pScrPriv->pVisualGroups)
- xfree (pScrPriv->pVisualGroups);
xfree (pScrPriv);
RRNScreens -= 1; /* ok, one fewer screen with RandR running */
return (*pScreen->CloseScreen) (i, pScreen);
}
static void
-SRRScreenChangeNotifyEvent(from, to)
- xRRScreenChangeNotifyEvent *from, *to;
+SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
+ xRRScreenChangeNotifyEvent *to)
{
to->type = from->type;
to->rotation = from->rotation;
@@ -121,11 +122,11 @@ SRRScreenChangeNotifyEvent(from, to)
cpswapl(from->root, to->root);
cpswapl(from->window, to->window);
cpswaps(from->sizeID, to->sizeID);
- cpswaps(from->visualGroupID, to->visualGroupID);
cpswaps(from->widthInPixels, to->widthInPixels);
cpswaps(from->heightInPixels, to->heightInPixels);
cpswaps(from->widthInMillimeters, to->widthInMillimeters);
cpswaps(from->heightInMillimeters, to->heightInMillimeters);
+ cpswaps(from->subpixelOrder, to->subpixelOrder);
}
Bool RRScreenInit(ScreenPtr pScreen)
@@ -162,13 +163,6 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv->rotations = RR_Rotate_0;
pScrPriv->swaps = 0;
- pScrPriv->nVisualGroups = 0;
- pScrPriv->nVisualGroupsInUse = 0;
- pScrPriv->pVisualGroups = 0;
-
- pScrPriv->nGroupsOfVisualGroups = 0;
- pScrPriv->nGroupsOfVisualGroupsInUse = 0;
- pScrPriv->pGroupsOfVisualGroups = 0;
pScrPriv->nSizes = 0;
pScrPriv->nSizesInUse = 0;
@@ -176,7 +170,6 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv->rotation = RR_Rotate_0;
pScrPriv->pSize = 0;
- pScrPriv->pVisualGroup = 0;
RRNScreens += 1; /* keep count of screens that implement randr */
return TRUE;
@@ -271,12 +264,12 @@ TellChanged (WindowPtr pWin, pointer value)
se.rotation = (CARD8) pScrPriv->rotation;
se.timestamp = pScrPriv->lastSetTime.milliseconds;
se.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
- se.root = pRoot->drawable.id;
+ se.root = pRoot->drawable.id;
se.window = pWin->drawable.id;
+ se.subpixelOrder = PictureGetSubpixelOrder (pScreen);
if (pSize)
{
se.sizeID = pSize->id;
- se.visualGroupID = pScrPriv->pVisualGroup->id;
se.widthInPixels = pSize->width;
se.heightInPixels = pSize->height;
se.widthInMillimeters = pSize->mmWidth;
@@ -289,20 +282,21 @@ TellChanged (WindowPtr pWin, pointer value)
* forget to set the current configuration on GetInfo
*/
se.sizeID = 0xffff;
- se.visualGroupID = 0xffff;
se.widthInPixels = 0;
se.heightInPixels = 0;
se.widthInMillimeters = 0;
se.heightInMillimeters = 0;
}
-
+ fprintf(stderr, "size = %d\n, widthmm = %d, heightmm=%d\n",
+ sizeof(se), se.widthInMillimeters, se.heightInMillimeters);
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
{
client = pRREvent->client;
if (client == serverClient || client->clientGone)
continue;
se.sequenceNumber = client->sequence;
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ if(pRREvent->mask & RRScreenChangeNotifyMask)
+ WriteEventsToClient (client, 1, (xEvent *) &se);
}
return WT_WALKCHILDREN;
}
@@ -315,16 +309,6 @@ RRGetInfo (ScreenPtr pScreen)
Bool changed;
Rotation rotations;
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- pScrPriv->pVisualGroups[i].oldReferenced = pScrPriv->pVisualGroups[i].referenced;
- pScrPriv->pVisualGroups[i].referenced = FALSE;
- }
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- {
- pScrPriv->pGroupsOfVisualGroups[i].oldReferenced = pScrPriv->pGroupsOfVisualGroups[i].referenced;
- pScrPriv->pGroupsOfVisualGroups[i].referenced = FALSE;
- }
for (i = 0; i < pScrPriv->nSizes; i++)
{
pScrPriv->pSizes[i].oldReferenced = pScrPriv->pSizes[i].referenced;
@@ -346,24 +330,6 @@ RRGetInfo (ScreenPtr pScreen)
}
j = 0;
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- if (pScrPriv->pVisualGroups[i].oldReferenced != pScrPriv->pVisualGroups[i].referenced)
- changed = TRUE;
- if (pScrPriv->pVisualGroups[i].referenced)
- pScrPriv->pVisualGroups[i].id = j++;
- }
- pScrPriv->nVisualGroupsInUse = j;
- j = 0;
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- {
- if (pScrPriv->pGroupsOfVisualGroups[i].oldReferenced != pScrPriv->pGroupsOfVisualGroups[i].referenced)
- changed = TRUE;
- if (pScrPriv->pGroupsOfVisualGroups[i].referenced)
- pScrPriv->pGroupsOfVisualGroups[i].id = j++;
- }
- pScrPriv->nGroupsOfVisualGroupsInUse = j;
- j = 0;
for (i = 0; i < pScrPriv->nSizes; i++)
{
if (pScrPriv->pSizes[i].oldReferenced != pScrPriv->pSizes[i].referenced)
@@ -410,6 +376,8 @@ ProcRRQueryVersion (ClientPtr client)
REQUEST(xRRQueryVersionReq);
REQUEST_SIZE_MATCH(xRRQueryVersionReq);
+ (void) stuff->majorVersion;
+ (void) stuff->minorVersion;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -425,53 +393,6 @@ ProcRRQueryVersion (ClientPtr client)
return (client->noClientException);
}
-static Bool
-RRVisualGroupContains (RRVisualGroupPtr pVisualGroup,
- VisualID visual)
-{
- int i;
-
- for (i = 0; i < pVisualGroup->nvisuals; i++)
- if (pVisualGroup->visuals[i]->vid == visual)
- return TRUE;
- return FALSE;
-}
-
-static CARD16
-RRNumMatchingVisualGroups (ScreenPtr pScreen,
- VisualID visual)
-{
- rrScrPriv(pScreen);
- int i;
- CARD16 n = 0;
- RRVisualGroupPtr pVisualGroup;
-
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- pVisualGroup = &pScrPriv->pVisualGroups[i];
- if (pVisualGroup->referenced && RRVisualGroupContains (pVisualGroup, visual))
- n++;
- }
- return n;
-}
-
-static void
-RRGetMatchingVisualGroups (ScreenPtr pScreen,
- VisualID visual,
- VisualGroupID *pVisualGroupIDs)
-{
- rrScrPriv(pScreen);
- int i;
- CARD16 n = 0;
- RRVisualGroupPtr pVisualGroup;
-
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- pVisualGroup = &pScrPriv->pVisualGroups[i];
- if (pVisualGroup->referenced && RRVisualGroupContains (pVisualGroup, visual))
- *pVisualGroupIDs++ = pVisualGroup->id;
- }
-}
extern char *ConnectionInfo;
@@ -537,6 +458,7 @@ ProcRRGetScreenInfo (ClientPtr client)
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
+ rep.pad1 = rep.pad2 = 0;
if (!pScrPriv)
{
rep.type = X_Reply;
@@ -546,24 +468,16 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
rep.timestamp = currentTime.milliseconds;
rep.configTimestamp = currentTime.milliseconds;
- rep.nVisualGroups = 0;
- rep.nGroupsOfVisualGroups = 0;
rep.nSizes = 0;
rep.sizeID = 0;
- rep.visualGroupID = 0;
rep.rotation = RR_Rotate_0;
extra = 0;
extraLen = 0;
}
else
{
- int i, j;
- int nGroupsOfVisualGroupsElements;
- RRGroupOfVisualGroupPtr pGroupsOfVisualGroups;
- int nVisualGroupElements;
- RRVisualGroupPtr pVisualGroup;
+ int i;
xScreenSizes *size;
- CARD16 *data16;
CARD32 *data32;
RRGetInfo (pScreen);
@@ -576,46 +490,15 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
- rep.nVisualGroups = pScrPriv->nVisualGroupsInUse;
rep.rotation = pScrPriv->rotation;
rep.nSizes = pScrPriv->nSizesInUse;
- rep.nGroupsOfVisualGroups = pScrPriv->nGroupsOfVisualGroupsInUse;
if (pScrPriv->pSize)
rep.sizeID = pScrPriv->pSize->id;
else
return BadImplementation;
- if (pScrPriv->pVisualGroup)
- rep.visualGroupID = pScrPriv->pVisualGroup->id;
- else
- return BadImplementation;
- /*
- * Count up the total number of spaces needed to transmit
- * the groups of visual groups
- */
- nGroupsOfVisualGroupsElements = 0;
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- {
- pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[i];
- if (pGroupsOfVisualGroups->referenced)
- nGroupsOfVisualGroupsElements += pGroupsOfVisualGroups->ngroups + 1;
- }
- /*
- * Count up the total number of spaces needed to transmit
- * the visual groups
- */
- nVisualGroupElements = 0;
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- pVisualGroup = &pScrPriv->pVisualGroups[i];
- if (pVisualGroup->referenced)
- nVisualGroupElements += pVisualGroup->nvisuals + 1;
- }
- /*
- * Allocate space for the extra information
- */
- extraLen = (rep.nSizes * sizeof (xScreenSizes) +
- nVisualGroupElements * sizeof (CARD32) +
- nGroupsOfVisualGroupsElements * sizeof (CARD16));
+
+ extraLen = rep.nSizes * sizeof (xScreenSizes) ;
+
extra = (CARD8 *) xalloc (extraLen);
if (!extra)
return BadAlloc;
@@ -631,59 +514,22 @@ ProcRRGetScreenInfo (ClientPtr client)
size->heightInPixels = pScrPriv->pSizes[i].height;
size->widthInMillimeters = pScrPriv->pSizes[i].mmWidth;
size->heightInMillimeters = pScrPriv->pSizes[i].mmHeight;
- size->visualGroup = pScrPriv->pGroupsOfVisualGroups[pScrPriv->pSizes[i].groupOfVisualGroups].id;
if (client->swapped)
{
swaps (&size->widthInPixels, n);
swaps (&size->heightInPixels, n);
swaps (&size->widthInMillimeters, n);
swaps (&size->heightInMillimeters, n);
- swaps (&size->visualGroup, n);
}
size++;
}
}
data32 = (CARD32 *) size;
- /*
- * Next comes the visual groups
- */
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- pVisualGroup = &pScrPriv->pVisualGroups[i];
- if (pVisualGroup->referenced)
- {
- *data32++ = pVisualGroup->nvisuals;
- for (j = 0; j < pVisualGroup->nvisuals; j++)
- *data32++ = pVisualGroup->visuals[j]->vid;
- }
- }
- if (client->swapped)
- SwapLongs (data32 - nVisualGroupElements, nVisualGroupElements);
- /*
- * Next comes the groups of visual groups
- */
- data16 = (CARD16 *) data32;
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- {
- pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[i];
- if (pGroupsOfVisualGroups->referenced)
- {
- *data16++ = (CARD16) pGroupsOfVisualGroups->ngroups;
- for (j = 0; j < pGroupsOfVisualGroups->ngroups; j++)
- {
- pVisualGroup = &pScrPriv->pVisualGroups[pGroupsOfVisualGroups->groups[j]];
- *data16++ = (CARD16) pVisualGroup->id;
- }
- }
- }
-
- if (client->swapped)
- SwapShorts ((CARD16 *) data32, data16 - (CARD16 *) data32);
-
- if ((CARD8 *) data16 - (CARD8 *) extra != extraLen)
+
+ if ((CARD8 *) data32 - (CARD8 *) extra != extraLen)
FatalError ("RRGetScreenInfo bad extra len %d != %d\n",
- (CARD8 *) data16 - (CARD8 *) extra, extraLen);
- rep.length = extraLen >> 2;
+ (CARD8 *) data32 - (CARD8 *) extra, extraLen);
+ rep.length = (extraLen + 3) >> 2;
}
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
@@ -691,14 +537,12 @@ ProcRRGetScreenInfo (ClientPtr client)
swapl(&rep.timestamp, n);
swaps(&rep.rotation, n);
swaps(&rep.nSizes, n);
- swaps(&rep.nVisualGroups, n);
swaps(&rep.sizeID, n);
- swaps(&rep.visualGroupID, n);
}
WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *)&rep);
if (extraLen)
{
- WriteToClient (client, extraLen, extra);
+ WriteToClient (client, extraLen, (char *) extra);
xfree (extra);
}
return (client->noClientException);
@@ -716,8 +560,6 @@ ProcRRSetScreenConfig (ClientPtr client)
TimeStamp configTime;
TimeStamp time;
RRScreenSizePtr pSize;
- RRVisualGroupPtr pVisualGroup;
- RRGroupOfVisualGroupPtr pGroupsOfVisualGroups;
int i;
Rotation rotation;
short oldWidth, oldHeight;
@@ -761,6 +603,7 @@ ProcRRSetScreenConfig (ClientPtr client)
/*
* Search for the requested size
*/
+ pSize = 0;
for (i = 0; i < pScrPriv->nSizes; i++)
{
pSize = &pScrPriv->pSizes[i];
@@ -777,45 +620,12 @@ ProcRRSetScreenConfig (ClientPtr client)
}
/*
- * Search for the requested visual group
- */
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- {
- pVisualGroup = &pScrPriv->pVisualGroups[i];
- if (pVisualGroup->referenced && pVisualGroup->id == stuff->visualGroupID)
- break;
- }
- if (i == pScrPriv->nVisualGroups)
- {
- /*
- * Invalid group ID
- */
- client->errorValue = stuff->visualGroupID;
- return BadValue;
- }
-
- /*
- * Make sure visualgroup is supported by size
- */
- pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[pSize->groupOfVisualGroups];
- for (i = 0; i < pGroupsOfVisualGroups->ngroups; i++)
- {
- if (pGroupsOfVisualGroups->groups[i] == pVisualGroup - pScrPriv->pVisualGroups)
- break;
- }
- if (i == pGroupsOfVisualGroups->ngroups)
- {
- /*
- * requested group not supported by requested size
- */
- return BadMatch;
- }
-
- /*
* Validate requested rotation
*/
rotation = (Rotation) stuff->rotation;
- switch (rotation) {
+
+ /* test the rotation bits only! */
+ switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_90:
case RR_Rotate_180:
@@ -828,14 +638,16 @@ ProcRRSetScreenConfig (ClientPtr client)
client->errorValue = stuff->rotation;
return BadValue;
}
- if (!(pScrPriv->rotations & rotation))
+
+ if ((~pScrPriv->rotations) & rotation)
{
/*
- * requested rotation not supported by screen
+ * requested rotation or reflection not supported by screen
*/
+ client->errorValue = stuff->rotation;
return BadMatch;
}
-
+
/*
* Make sure the requested set-time is not older than
* the last set-time
@@ -850,7 +662,7 @@ ProcRRSetScreenConfig (ClientPtr client)
* call out to ddx routine to effect the change
*/
if (!(*pScrPriv->rrSetConfig) (pScreen, rotation,
- pSize, pVisualGroup))
+ pSize))
{
/*
* unknown DDX failure, report to client
@@ -862,7 +674,7 @@ ProcRRSetScreenConfig (ClientPtr client)
/*
* set current extension configuration pointers
*/
- RRSetCurrentConfig (pScreen, rotation, pSize, pVisualGroup);
+ RRSetCurrentConfig (pScreen, rotation, pSize);
/*
* Deliver ScreenChangeNotify events whenever
@@ -899,7 +711,7 @@ sendReply:
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds;
rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
-
+
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);
@@ -914,21 +726,24 @@ sendReply:
}
static int
-ProcRRScreenChangeSelectInput (ClientPtr client)
+ProcRRSelectInput (ClientPtr client)
{
- REQUEST(xRRScreenChangeSelectInputReq);
+ REQUEST(xRRSelectInputReq);
WindowPtr pWin;
RREventPtr pRREvent, pNewRREvent, *pHead;
XID clientResource;
- REQUEST_SIZE_MATCH(xRRScreenChangeSelectInputReq);
+ REQUEST_SIZE_MATCH(xRRSelectInputReq);
pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess);
if (!pWin)
return BadWindow;
pHead = (RREventPtr *)SecurityLookupIDByType(client,
pWin->drawable.id, EventType, SecurityWriteAccess);
- switch (stuff->enable) {
- case xTrue:
+
+
+ if (stuff->enable &
+ (RRScreenChangeNotifyMask)) {
+
if (pHead) {
/* check for existing entry. */
@@ -949,6 +764,7 @@ ProcRRScreenChangeSelectInput (ClientPtr client)
pNewRREvent->next = 0;
pNewRREvent->client = client;
pNewRREvent->window = pWin;
+ pNewRREvent->mask = stuff->enable;
/*
* add a resource that will be deleted when
* the client goes away
@@ -976,8 +792,8 @@ ProcRRScreenChangeSelectInput (ClientPtr client)
}
pNewRREvent->next = *pHead;
*pHead = pNewRREvent;
- break;
- case xFalse:
+ }
+ else if (stuff->enable == xFalse) {
/* delete the interest */
if (pHead) {
pNewRREvent = 0;
@@ -995,14 +811,15 @@ ProcRRScreenChangeSelectInput (ClientPtr client)
xfree (pRREvent);
}
}
- break;
- default:
+ }
+ else {
client->errorValue = stuff->enable;
return BadValue;
- }
+ }
return Success;
}
+
static int
ProcRRDispatch (ClientPtr client)
{
@@ -1011,12 +828,12 @@ ProcRRDispatch (ClientPtr client)
{
case X_RRQueryVersion:
return ProcRRQueryVersion(client);
- case X_RRGetScreenInfo:
- return ProcRRGetScreenInfo(client);
case X_RRSetScreenConfig:
return ProcRRSetScreenConfig(client);
- case X_RRScreenChangeSelectInput:
- return ProcRRScreenChangeSelectInput(client);
+ case X_RRSelectInput:
+ return ProcRRSelectInput(client);
+ case X_RRGetScreenInfo:
+ return ProcRRGetScreenInfo(client);
default:
return BadRequest;
}
@@ -1055,22 +872,22 @@ SProcRRSetScreenConfig (ClientPtr client)
swapl(&stuff->drawable, n);
swapl(&stuff->timestamp, n);
swaps(&stuff->sizeID, n);
- swaps(&stuff->visualGroupID, n);
swaps(&stuff->rotation, n);
return ProcRRSetScreenConfig(client);
}
static int
-SProcRRScreenChangeSelectInput (ClientPtr client)
+SProcRRSelectInput (ClientPtr client)
{
register int n;
- REQUEST(xRRScreenChangeSelectInputReq);
+ REQUEST(xRRSelectInputReq);
swaps(&stuff->length, n);
swapl(&stuff->window, n);
- return ProcRRScreenChangeSelectInput(client);
+ return ProcRRSelectInput(client);
}
+
static int
SProcRRDispatch (ClientPtr client)
{
@@ -1079,250 +896,17 @@ SProcRRDispatch (ClientPtr client)
{
case X_RRQueryVersion:
return SProcRRQueryVersion(client);
- case X_RRGetScreenInfo:
- return SProcRRGetScreenInfo(client);
case X_RRSetScreenConfig:
return SProcRRSetScreenConfig(client);
- case X_RRScreenChangeSelectInput:
- return SProcRRScreenChangeSelectInput(client);
+ case X_RRSelectInput:
+ return SProcRRSelectInput(client);
+ case X_RRGetScreenInfo:
+ return SProcRRGetScreenInfo(client);
default:
return BadRequest;
}
}
-/*
- * Utility functions for creating the group of possible
- * configurations
- */
-
-RRVisualGroupPtr
-RRCreateVisualGroup (ScreenPtr pScreen)
-{
- RRVisualGroupPtr pVisualGroup;
-
- pVisualGroup = (RRVisualGroupPtr) xalloc (sizeof (RRVisualGroup));
- pVisualGroup->nvisuals = 0;
- pVisualGroup->visuals = 0;
- pVisualGroup->referenced = TRUE;
- pVisualGroup->oldReferenced = FALSE;
- return pVisualGroup;
-}
-
-void
-RRDestroyVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup)
-{
-#ifdef RR_VALIDATE
- int i;
- rrScrPriv(pScreen);
-
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- if (pVisualGroup == &pScrPriv->pVisualGroups[i])
- FatalError ("Freeing registered visual group");
-#endif
- xfree (pVisualGroup->visuals);
- xfree (pVisualGroup);
-}
-
-Bool
-RRAddVisualToVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup,
- VisualPtr pVisual)
-{
- VisualPtr *new;
-
- new = xrealloc (pVisualGroup->visuals,
- (pVisualGroup->nvisuals + 1) * sizeof (VisualPtr));
- if (!new)
- return FALSE;
- (pVisualGroup->visuals = new)[pVisualGroup->nvisuals++] = pVisual;
- return TRUE;
-}
-
-Bool
-RRAddDepthToVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup,
- DepthPtr pDepth)
-{
- int i;
- int v;
-
- for (i = 0; i < pDepth->numVids; i++)
- for (v = 0; v < pScreen->numVisuals; v++)
- if (pScreen->visuals[v].vid == pDepth->vids[i])
- if (!RRAddVisualToVisualGroup (pScreen, pVisualGroup,
- &pScreen->visuals[v]))
- return FALSE;
- return TRUE;
-}
-
-/*
- * Return true if a and b reference the same group of visuals
- */
-
-static Bool
-RRVisualGroupMatches (RRVisualGroupPtr a,
- RRVisualGroupPtr b)
-{
- int ai, bi;
-
- if (a->nvisuals != b->nvisuals)
- return FALSE;
- for (ai = 0; ai < a->nvisuals; ai++)
- {
- for (bi = 0; bi < b->nvisuals; bi++)
- if (a->visuals[ai] == b->visuals[bi])
- break;
- if (bi == b->nvisuals)
- return FALSE;
- }
- return TRUE;
-}
-
-RRVisualGroupPtr
-RRRegisterVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup)
-{
- rrScrPriv (pScreen);
- int i;
- RRVisualGroupPtr pNew;
-
- if (!pScrPriv)
- {
- RRDestroyVisualGroup (pScreen, pVisualGroup);
- return 0;
- }
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- if (RRVisualGroupMatches (pVisualGroup,
- &pScrPriv->pVisualGroups[i]))
- {
- RRDestroyVisualGroup (pScreen, pVisualGroup);
- pScrPriv->pVisualGroups[i].referenced = TRUE;
- return &pScrPriv->pVisualGroups[i];
- }
- pNew = xrealloc (pScrPriv->pVisualGroups,
- (pScrPriv->nVisualGroups + 1) * sizeof (RRVisualGroup));
- if (!pNew)
- {
- RRDestroyVisualGroup (pScreen, pVisualGroup);
- return 0;
- }
- pNew[pScrPriv->nVisualGroups++] = *pVisualGroup;
- xfree (pVisualGroup);
- pScrPriv->pVisualGroups = pNew;
- return &pNew[pScrPriv->nVisualGroups-1];
-}
-
-RRGroupOfVisualGroupPtr
-RRCreateGroupOfVisualGroup (ScreenPtr pScreen)
-{
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
-
- pGroupOfVisualGroup = (RRGroupOfVisualGroupPtr) xalloc (sizeof (RRGroupOfVisualGroup));
- pGroupOfVisualGroup->ngroups = 0;
- pGroupOfVisualGroup->groups = 0;
- pGroupOfVisualGroup->referenced = TRUE;
- pGroupOfVisualGroup->oldReferenced = FALSE;
- return pGroupOfVisualGroup;
-}
-
-void
-RRDestroyGroupOfVisualGroup (ScreenPtr pScreen,
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup)
-{
-#ifdef RR_VALIDATE
- int i;
- rrScrPriv(pScreen);
-
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- if (pGroupOfVisualGroup == &pScrPriv->pGroupsOfVisualGroups[i])
- FatalError ("Freeing registered visual group");
-#endif
- xfree (pGroupOfVisualGroup->groups);
- xfree (pGroupOfVisualGroup);
-}
-
-Bool
-RRAddVisualGroupToGroupOfVisualGroup (ScreenPtr pScreen,
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup,
- RRVisualGroupPtr pVisualGroup)
-{
- rrScrPriv(pScreen);
- int *new;
-
-#ifdef RR_VALIDATE
- int i;
- for (i = 0; i < pScrPriv->nVisualGroups; i++)
- if (pVisualGroup == &pScrPriv->pVisualGroups[i])
- break;
-
- if (i == pScrPriv->nVisualGroups)
- FatalError ("Adding unregistered visual group");
-#endif
- new = (int*) xrealloc (pGroupOfVisualGroup->groups,
- (pGroupOfVisualGroup->ngroups + 1) * sizeof (int *));
- if (!new)
- return FALSE;
- (pGroupOfVisualGroup->groups = new)[pGroupOfVisualGroup->ngroups++] = pVisualGroup - pScrPriv->pVisualGroups;
- return TRUE;
-}
-
-/*
- * Return true if a and b reference the same group of groups
- */
-
-static Bool
-RRGroupOfVisualGroupMatches (RRGroupOfVisualGroupPtr a,
- RRGroupOfVisualGroupPtr b)
-{
- int ai, bi;
-
- if (a->ngroups != b->ngroups)
- return FALSE;
- for (ai = 0; ai < a->ngroups; ai++)
- {
- for (bi = 0; bi < b->ngroups; bi++)
- if (a->groups[ai] == b->groups[bi])
- break;
- if (bi == b->ngroups)
- return FALSE;
- }
- return TRUE;
-}
-
-RRGroupOfVisualGroupPtr
-RRRegisterGroupOfVisualGroup (ScreenPtr pScreen,
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup)
-{
- rrScrPriv (pScreen);
- int i;
- RRGroupOfVisualGroupPtr pNew;
-
- if (!pScrPriv)
- {
- RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- return 0;
- }
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- if (RRGroupOfVisualGroupMatches (pGroupOfVisualGroup,
- &pScrPriv->pGroupsOfVisualGroups[i]))
- {
- RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- pScrPriv->pGroupsOfVisualGroups[i].referenced = TRUE;
- return &pScrPriv->pGroupsOfVisualGroups[i];
- }
- pNew = xrealloc (pScrPriv->pGroupsOfVisualGroups,
- (pScrPriv->nGroupsOfVisualGroups + 1) * sizeof (RRGroupOfVisualGroup));
- if (!pNew)
- {
- RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
- return 0;
- }
- pNew[pScrPriv->nGroupsOfVisualGroups++] = *pGroupOfVisualGroup;
- xfree (pGroupOfVisualGroup);
- pScrPriv->pGroupsOfVisualGroups = pNew;
- return &pNew[pScrPriv->nGroupsOfVisualGroups-1];
-}
static Bool
RRScreenSizeMatches (RRScreenSizePtr a,
@@ -1336,8 +920,6 @@ RRScreenSizeMatches (RRScreenSizePtr a,
return FALSE;
if (a->mmHeight != b->mmHeight)
return FALSE;
- if (a->groupOfVisualGroups != b->groupOfVisualGroups)
- return FALSE;
return TRUE;
}
@@ -1346,8 +928,7 @@ RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
- short mmHeight,
- RRGroupOfVisualGroup *pGroupsOfVisualGroups)
+ short mmHeight)
{
rrScrPriv (pScreen);
int i;
@@ -1357,20 +938,10 @@ RRRegisterSize (ScreenPtr pScreen,
if (!pScrPriv)
return 0;
-#ifdef RR_VALIDATE
- for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++)
- if (pGroupsOfVisualGroups == &pScrPriv->pGroupsOfVisualGroups[i])
- break;
-
- if (i == pScrPriv->nGroupsOfVisualGroups)
- FatalError ("Adding unregistered group of visual groups");
-#endif
-
tmp.width = width;
tmp.height= height;
tmp.mmWidth = mmWidth;
tmp.mmHeight = mmHeight;
- tmp.groupOfVisualGroups = pGroupsOfVisualGroups - pScrPriv->pGroupsOfVisualGroups;
tmp.referenced = TRUE;
tmp.oldReferenced = FALSE;
for (i = 0; i < pScrPriv->nSizes; i++)
@@ -1391,8 +962,7 @@ RRRegisterSize (ScreenPtr pScreen,
void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup)
+ RRScreenSizePtr pSize)
{
rrScrPriv (pScreen);
@@ -1401,5 +971,4 @@ RRSetCurrentConfig (ScreenPtr pScreen,
pScrPriv->rotation = rotation;
pScrPriv->pSize = pSize;
- pScrPriv->pVisualGroup = pVisualGroup;
}
diff --git a/programs/Xserver/randr/randrstr.h b/programs/Xserver/randr/randrstr.h
index 317894c28..51a7e295f 100644
--- a/programs/Xserver/randr/randrstr.h
+++ b/programs/Xserver/randr/randrstr.h
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/randr/randrstr.h,v 1.3 2001/05/26 01:25:42 keithp Exp $
+ * $XFree86: xc/programs/Xserver/randr/randrstr.h,v 1.4 2001/06/03 21:52:44 keithp Exp $
*
* Copyright © 2000 Compaq Computer Corporation
*
@@ -27,35 +27,18 @@
#include "randr.h"
-typedef struct _rrVisualGroup {
- int id;
- int nvisuals;
- VisualPtr *visuals;
- Bool referenced;
- Bool oldReferenced;
-} RRVisualGroup, *RRVisualGroupPtr;
-
-typedef struct _rrGroupOfVisualGroup {
- int id;
- int ngroups;
- int *groups;
- Bool referenced;
- Bool oldReferenced;
-} RRGroupOfVisualGroup, *RRGroupOfVisualGroupPtr;
typedef struct _rrScreenSize {
int id;
short width, height;
short mmWidth, mmHeight;
- int groupOfVisualGroups;
Bool referenced;
Bool oldReferenced;
} RRScreenSize, *RRScreenSizePtr;
typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup);
+ RRScreenSizePtr pSize);
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
@@ -74,12 +57,6 @@ typedef struct _rrScrPriv {
Rotation rotations;
int swaps;
- int nVisualGroups;
- int nVisualGroupsInUse;
- RRVisualGroupPtr pVisualGroups;
- int nGroupsOfVisualGroups;
- int nGroupsOfVisualGroupsInUse;
- RRGroupOfVisualGroupPtr pGroupsOfVisualGroups;
int nSizes;
int nSizesInUse;
RRScreenSizePtr pSizes;
@@ -89,8 +66,6 @@ typedef struct _rrScrPriv {
*/
Rotation rotation;
RRScreenSizePtr pSize;
- RRVisualGroupPtr pVisualGroup;
-
} rrScrPrivRec, *rrScrPrivPtr;
extern int rrPrivIndex;
@@ -99,50 +74,9 @@ extern int rrPrivIndex;
#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p))
-/*
- * First, create the visual groups and register them with the screen
- */
-RRVisualGroupPtr
-RRCreateVisualGroup (ScreenPtr pScreen);
-
+/* Initialize the extension */
void
-RRDestroyVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup);
-
-Bool
-RRAddVisualToVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup,
- VisualPtr pVisual);
-
-Bool
-RRAddDepthToVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup,
- DepthPtr pDepth);
-
-RRVisualGroupPtr
-RRRegisterVisualGroup (ScreenPtr pScreen,
- RRVisualGroupPtr pVisualGroup);
-
-/*
- * Next, create the group of visual groups and register that with the screen
- */
-RRGroupOfVisualGroupPtr
-RRCreateGroupOfVisualGroup (ScreenPtr pScreen);
-
-void
-RRDestroyGroupOfVisualGroup (ScreenPtr pScreen,
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup);
-
-Bool
-RRAddVisualGroupToGroupOfVisualGroup (ScreenPtr pScreen,
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup,
- RRVisualGroupPtr pVisualGroup);
-
-
-RRGroupOfVisualGroupPtr
-RRRegisterGroupOfVisualGroup (ScreenPtr pScreen,
- RRGroupOfVisualGroupPtr pGroupOfVisualGroup);
-
+RRExtensionInit (void);
/*
* Then, register the specific size with the screen
@@ -153,8 +87,7 @@ RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
- short mmHeight,
- RRGroupOfVisualGroup *visualgroups);
+ short mmHeight);
/*
* Finally, set the current configuration of the screen
@@ -163,17 +96,20 @@ RRRegisterSize (ScreenPtr pScreen,
void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr pSize,
- RRVisualGroupPtr pVisualGroup);
+ RRScreenSizePtr pSize);
+Bool RRScreenInit(ScreenPtr pScreen);
+
Bool
miRandRInit (ScreenPtr pScreen);
Bool
+miRRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+
+Bool
miRRSetConfig (ScreenPtr pScreen,
Rotation rotation,
- RRScreenSizePtr size,
- RRVisualGroupPtr pVisualGroup);
+ RRScreenSizePtr size);
Bool
miRRGetScreenInfo (ScreenPtr pScreen);
diff --git a/programs/Xserver/render/picture.c b/programs/Xserver/render/picture.c
index 99dece9c7..3cf3408fe 100644
--- a/programs/Xserver/render/picture.c
+++ b/programs/Xserver/render/picture.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/render/picture.c,v 1.23 2002/08/22 08:03:10 keithp Exp $
+ * $XFree86: xc/programs/Xserver/render/picture.c,v 1.25 2002/09/26 02:56:52 keithp Exp $
*
* Copyright © 2000 SuSE, Inc.
*
@@ -431,6 +431,17 @@ PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
return TRUE;
}
+
+int
+PictureGetSubpixelOrder (ScreenPtr pScreen)
+{
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ if (!ps)
+ return SubPixelUnknown;
+ return ps->subpixel;
+}
+
PictFormatPtr
PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
{
diff --git a/programs/Xserver/render/picturestr.h b/programs/Xserver/render/picturestr.h
index c6d831366..4cb597414 100644
--- a/programs/Xserver/render/picturestr.h
+++ b/programs/Xserver/render/picturestr.h
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.17 2002/05/13 05:25:11 keithp Exp $
+ * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.18 2002/09/26 02:56:52 keithp Exp $
*
* Copyright © 2000 SuSE, Inc.
*
@@ -309,6 +309,9 @@ PictureInitIndexedFormats (ScreenPtr pScreen);
Bool
PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
+int
+PictureGetSubpixelOrder (ScreenPtr pScreen);
+
PictFormatPtr
PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
diff --git a/programs/xrandr/Imakefile b/programs/xrandr/Imakefile
index 39165fc71..ce6825dbf 100644
--- a/programs/xrandr/Imakefile
+++ b/programs/xrandr/Imakefile
@@ -1,8 +1,8 @@
-XCOMM $XFree86: xc/programs/xrandr/Imakefile,v 1.2 2001/06/07 15:33:44 keithp Exp $
+XCOMM $XFree86: xc/programs/xrandr/Imakefile,v 1.3 2001/06/11 01:40:14 keithp Exp $
DEFINES=$(RANDRDEFINES)
DEPLIBS=$(DEPXRANDRLIB) $(DEPXLIB)
-LOCAL_LIBRARIES=$(XRANDRLIB) $(XLIB)
+LOCAL_LIBRARIES=$(XRANDRLIB) $(XRENDERLIB) $(XLIB)
SRCS=xrandr.c
OBJS=xrandr.o
diff --git a/programs/xrandr/xrandr.c b/programs/xrandr/xrandr.c
index 667272941..98ce1fa93 100644
--- a/programs/xrandr/xrandr.c
+++ b/programs/xrandr/xrandr.c
@@ -1,33 +1,37 @@
/*
- * $XFree86: xc/programs/xrandr/xrandr.c,v 1.7 2001/06/17 15:18:39 herrb Exp $
+ * $XFree86: xc/programs/xrandr/xrandr.c,v 1.8 2001/07/11 16:40:32 keithp Exp $
*
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
- * Copyright © 2001 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett Pacard Company, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard or Compaq not be used in
+ * documentation, and that the name of Keith Packard or HP not be used in
* advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
+ * specific, written prior permission. Keith Packard and HP makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
- * KEITH PACKARD and COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * KEITH PACKARD and HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
- * Blame Jim Gettys for any bugs...
+ *
+ * Blame Jim Gettys for any bugs; he wrote most of the client side code,
+ * and part of the server code for randr.
*/
#include <stdio.h>
#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xrandr.h>
+#include <X11/extensions/Xrender.h> /* we share subpixel information */
#include <string.h>
#include <stdlib.h>
@@ -40,6 +44,15 @@ static char *direction[5] = {
"right",
"\n"};
+/* subpixel order */
+static char *order[6] = {
+ "unknown",
+ "horizontal rgb",
+ "horizontal bgr",
+ "vertical rgb",
+ "vertical bgr",
+ "no subpixels"};
+
static void
usage(void)
@@ -49,11 +62,14 @@ usage(void)
fprintf(stderr, " -display <display> or -d <display>\n");
fprintf(stderr, " -help\n");
fprintf(stderr, " -o <normal,inverted,left,right,0,1,2,3>\n");
- fprintf(stderr, " or --orientation <normal,inverted,left,right,0,1,2,3>\n");
- fprintf(stderr, " -q or --query\n");
- fprintf(stderr, " -s <size> or --size <size>\n");
- fprintf(stderr, " -v or --verbose\n");
- fprintf(stderr, " or --screen <screen>\n");
+ fprintf(stderr, " or --orientation <normal,inverted,left,right,0,1,2,3>\n");
+ fprintf(stderr, " -q or --query\n");
+ fprintf(stderr, " -s <size> or --size <size>\n");
+ fprintf(stderr, " -v or --version\n");
+ fprintf(stderr, " -x (reflect in x)\n");
+ fprintf(stderr, " -y (reflect in y)\n");
+ fprintf(stderr, " --screen <screen>\n");
+ fprintf(stderr, " --verbose\n");
exit(1);
/*NOTREACHED*/
@@ -71,15 +87,18 @@ main (int argc, char **argv)
int rot = -1;
int verbose = 0, query = 0;
Rotation rotation, current_rotation, rotations;
- XRRScreenChangeNotifyEvent event;
+ XEvent event;
+ XRRScreenChangeNotifyEvent *sce;
char *display_name = NULL;
int i;
SizeID current_size;
- VisualGroupID current_visual_group;
int size = -1;
int dirind = 0;
int setit = 0;
int screen = -1;
+ int version = 0;
+ int event_base, error_base;
+ int reflection = 0;
program_name = argv[0];
if (argc == 1) query = 1;
@@ -92,10 +111,11 @@ main (int argc, char **argv)
if (!strcmp("-help", argv[i])) {
usage();
}
- if (!strcmp ("-v", argv[i]) || !strcmp ("--verbose", argv[i])) {
+ if (!strcmp ("--verbose", argv[i])) {
verbose = 1;
continue;
}
+
if (!strcmp ("-s", argv[i]) || !strcmp ("--size", argv[i])) {
if (++i>=argc) usage ();
size = atoi (argv[i]);
@@ -103,6 +123,22 @@ main (int argc, char **argv)
setit = 1;
continue;
}
+
+ if (!strcmp ("-v", argv[i]) || !strcmp ("--version", argv[i])) {
+ version = 1;
+ continue;
+ }
+
+ if (!strcmp ("-x", argv[i])) {
+ reflection |= RR_Reflect_X;
+ setit = 1;
+ continue;
+ }
+ if (!strcmp ("-y", argv[i])) {
+ reflection |= RR_Reflect_Y;
+ setit = 1;
+ continue;
+ }
if (!strcmp ("--screen", argv[i])) {
if (++i>=argc) usage ();
screen = atoi (argv[i]);
@@ -132,6 +168,7 @@ main (int argc, char **argv)
if (verbose) query = 1;
dpy = XOpenDisplay (display_name);
+
if (dpy == NULL) {
fprintf (stderr, "Can't open display %s\n", display_name);
exit (1);
@@ -151,9 +188,10 @@ main (int argc, char **argv)
if (sc == NULL)
exit (1);
- current_size = XRRCurrentConfig (sc, &current_visual_group, &current_rotation);
- if (size < 0)
- size = current_size;
+ current_size = XRRConfigCurrentConfiguration (sc, &current_rotation);
+
+ if (size < 0) size = current_size;
+
if (rot < 0)
{
for (rot = 0; rot < 4; rot++)
@@ -161,51 +199,120 @@ main (int argc, char **argv)
break;
}
- sizes = XRRSizes(sc, &nsize);
- for (i = 0; i < nsize; i++) {
- if (query)
- printf ("SZ: Pixels Physical\n%d: %4d x%4d (%4dmm x%4dmm)\n",
- i, sizes[i].width, sizes[i].height,
- sizes[i].mwidth, sizes[i].mheight);
+ if (version) {
+ int major_version, minor_version;
+ XRRQueryVersion (dpy, &major_version, &minor_version);
+ printf("Server reports RandR version %d.%d\n",
+ major_version, minor_version);
+ }
+
+ sizes = XRRConfigSizes(sc, &nsize);
+
+ if (query) {
+ printf("SZ: Pixels Physical\n");
+ for (i = 0; i < nsize; i++) {
+ printf ("%-2d %5d x %-5d (%4dmm x%4dmm )\n",
+ i, sizes[i].width, sizes[i].height,
+ sizes[i].mwidth, sizes[i].mheight);
+ }
}
if (size >= nsize) usage();
- rotations = XRRRotations(sc, &current_rotation);
+
+ rotations = XRRConfigRotations(sc, &current_rotation);
+
rotation = 1 << rot ;
if (query) {
for (i = 0; i < 4; i ++) {
if ((current_rotation >> i) & 1)
printf("Current rotation - %s\n", direction[i]);
}
+
+ printf("Current reflection - ");
+ if (current_rotation & RR_Reflect_X) printf ("X Axis ");
+ else if (current_rotation & RR_Reflect_Y) printf ("Y Axis");
+ else printf ("none");
+ printf ("\n");
+
+
printf ("Rotations possible - ");
for (i = 0; i < 4; i ++) {
if ((rotations >> i) & 1) printf("%s ", direction[i]);
}
printf ("\n");
+
+ printf ("Reflections possible - ");
+ if (rotations & RR_Reflect_X) printf ("X Axis ");
+ else if (rotations & RR_Reflect_Y) printf ("Y Axis");
+ else printf ("none");
+ printf ("\n");
+
+ }
+
+ if (verbose) {
+ printf("Setting size to %d, rotation to %s\n", size, direction[rot]);
+
+ printf ("Setting reflection on ");
+ if (reflection & RR_Reflect_X) printf ("X Axis ");
+ else if (reflection & RR_Reflect_Y) printf ("Y Axis");
+ else printf ("neither axis");
+ printf ("\n");
+
+ if (reflection & RR_Reflect_X) printf("Setting reflection on X axis\n");
+
+ if (reflection & RR_Reflect_Y) printf("Setting reflection on Y axis\n");
}
- if (verbose) printf("Setting size to %d, rotation to %s\n",
- size, direction[rot]);
+ /* we should test configureNotify on the root window */
+ XSelectInput (dpy, root, StructureNotifyMask);
- if (setit) XRRScreenChangeSelectInput (dpy, root, True);
+ if (setit) XRRSelectInput (dpy, root,
+ RRScreenChangeNotifyMask);
if (setit) status = XRRSetScreenConfig (dpy, sc, DefaultRootWindow (dpy),
- (SizeID) size, current_visual_group, (Rotation) rotation, CurrentTime);
+ (SizeID) size, (Rotation) (rotation | reflection), CurrentTime);
+ XRRQueryExtension(dpy, &event_base, &error_base);
if (verbose && setit) {
if (status == RRSetConfigSuccess)
{
+ while (1) {
+ int spo;
XNextEvent(dpy, (XEvent *) &event);
- printf("Got an event!\n");
- printf(" window = %d\n root = %d\n size_index = %d\n visual_group_index %d\n rotation %d\n",
- (int) event.window, (int) event.root,
- event.size_index, event.visual_group_index, event.rotation);
- printf(" timestamp = %ld, config_timestamp = %ld\n",
- event.timestamp, event.config_timestamp);
- printf(" %dX%d pixels, %dX%d mm\n",
- event.width, event.height,
- event.mwidth, event.mheight);
+
+ printf ("Event received, type = %d\n", event.type);
+ /* update Xlib's knowledge of the event */
+ XRRUpdateConfiguration (&event);
+ if (event.type == ConfigureNotify)
+ printf("Received ConfigureNotify Event!\n");
+
+ switch (event.type - event_base) {
+ case RRScreenChangeNotify:
+ sce = (XRRScreenChangeNotifyEvent *) &event;
+
+ printf("Got a screen change notify event!\n");
+ printf(" window = %d\n root = %d\n size_index = %d\n rotation %d\n",
+ (int) sce->window, (int) sce->root,
+ sce->size_index, sce->rotation);
+ printf(" timestamp = %ld, config_timestamp = %ld\n",
+ sce->timestamp, sce->config_timestamp);
+ printf(" Rotation = %x\n", sce->rotation);
+ printf(" %d X %d pixels, %d X %d mm\n",
+ sce->width, sce->height, sce->mwidth, sce->mheight);
+ printf("Display width %d, height %d\n",
+ DisplayWidth(dpy, screen), DisplayHeight(dpy, screen));
+ printf("Display widthmm %d, heightmm %d\n",
+ DisplayWidthMM(dpy, screen), DisplayHeightMM(dpy, screen));
+ spo = sce->subpixel_order;
+ if ((spo < 0) || (spo > 5))
+ printf ("Unknown subpixel order, value = %d\n", spo);
+ else printf ("new Subpixel rendering model is %s\n", order[spo]);
+ break;
+ default:
+ if (event.type != ConfigureNotify)
+ printf("unknown event received, type = %d!\n", event.type);
+ }
+ }
}
}
- XRRFreeScreenInfo(sc);
+ XRRFreeScreenConfigInfo(sc);
return(0);
}
-