Commit 9997e13b authored by Reinhard Tartler's avatar Reinhard Tartler

Merge branch 'nx-X11'

parents 5b4ca0f9 15cee47a
ChangeLog: ChangeLog:
nx-X11-3.5.0-2
- Fixed TR0202420. XKB utility functions wrote out of bounds.
- Upgraded RandR server extension to version 1.2.
nx-X11-3.5.0-1 nx-X11-3.5.0-1
- Opened the 3.5.0 branch based on nx-X11-3.4.0-4. - Opened the 3.5.0 branch based on nx-X11-3.4.0-4.
......
ChangeLog: ChangeLog:
nx-X11-3.5.0-2
- Fixed TR0202420. XKB utility functions wrote out of bounds.
- Upgraded RandR server extension to version 1.2.
nx-X11-3.5.0-1
- Opened the 3.5.0 branch based on nx-X11-3.4.0-4.
- Updated copyright to year 2011.
nx-X11-3.4.0-4 nx-X11-3.4.0-4
- Fixed TR06H02359. Removed compiler warnings. - Fixed TR06H02359. Removed compiler warnings.
......
...@@ -738,8 +738,13 @@ int tmp; ...@@ -738,8 +738,13 @@ int tmp;
_XkbFree(prev_key_sym_map); _XkbFree(prev_key_sym_map);
return BadAlloc; return BadAlloc;
} }
#ifdef NXAGENT_SERVER
bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code+1],
tmp*sizeof(XkbSymMapRec));
#else
bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code], bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code],
tmp*sizeof(XkbSymMapRec)); tmp*sizeof(XkbSymMapRec));
#endif
if (changes) { if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed, changes->map.changed= _ExtendRange(changes->map.changed,
XkbKeySymsMask,maxKC, XkbKeySymsMask,maxKC,
...@@ -756,7 +761,11 @@ int tmp; ...@@ -756,7 +761,11 @@ int tmp;
_XkbFree(prev_modmap); _XkbFree(prev_modmap);
return BadAlloc; return BadAlloc;
} }
#ifdef NXAGENT_SERVER
bzero((char *)&xkb->map->modmap[xkb->max_key_code+1],tmp);
#else
bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp); bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp);
#endif
if (changes) { if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed, changes->map.changed= _ExtendRange(changes->map.changed,
XkbModifierMapMask,maxKC, XkbModifierMapMask,maxKC,
...@@ -775,8 +784,13 @@ int tmp; ...@@ -775,8 +784,13 @@ int tmp;
_XkbFree(prev_behaviors); _XkbFree(prev_behaviors);
return BadAlloc; return BadAlloc;
} }
#ifdef NXAGENT_SERVER
bzero((char *)&xkb->server->behaviors[xkb->max_key_code+1],
tmp*sizeof(XkbBehavior));
#else
bzero((char *)&xkb->server->behaviors[xkb->max_key_code], bzero((char *)&xkb->server->behaviors[xkb->max_key_code],
tmp*sizeof(XkbBehavior)); tmp*sizeof(XkbBehavior));
#endif
if (changes) { if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed, changes->map.changed= _ExtendRange(changes->map.changed,
XkbKeyBehaviorsMask,maxKC, XkbKeyBehaviorsMask,maxKC,
...@@ -793,8 +807,13 @@ int tmp; ...@@ -793,8 +807,13 @@ int tmp;
_XkbFree(prev_key_acts); _XkbFree(prev_key_acts);
return BadAlloc; return BadAlloc;
} }
#ifdef NXAGENT_SERVER
bzero((char *)&xkb->server->key_acts[xkb->max_key_code+1],
tmp*sizeof(unsigned short));
#else
bzero((char *)&xkb->server->key_acts[xkb->max_key_code], bzero((char *)&xkb->server->key_acts[xkb->max_key_code],
tmp*sizeof(unsigned short)); tmp*sizeof(unsigned short));
#endif
if (changes) { if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed, changes->map.changed= _ExtendRange(changes->map.changed,
XkbKeyActionsMask,maxKC, XkbKeyActionsMask,maxKC,
...@@ -811,8 +830,13 @@ int tmp; ...@@ -811,8 +830,13 @@ int tmp;
_XkbFree(prev_vmodmap); _XkbFree(prev_vmodmap);
return BadAlloc; return BadAlloc;
} }
#ifdef NXAGENT_SERVER
bzero((char *)&xkb->server->vmodmap[xkb->max_key_code+1],
tmp*sizeof(unsigned short));
#else
bzero((char *)&xkb->server->vmodmap[xkb->max_key_code], bzero((char *)&xkb->server->vmodmap[xkb->max_key_code],
tmp*sizeof(unsigned short)); tmp*sizeof(unsigned short));
#endif
if (changes) { if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed, changes->map.changed= _ExtendRange(changes->map.changed,
XkbVirtualModMapMask,maxKC, XkbVirtualModMapMask,maxKC,
...@@ -830,8 +854,13 @@ int tmp; ...@@ -830,8 +854,13 @@ int tmp;
_XkbFree(prev_keys); _XkbFree(prev_keys);
return BadAlloc; return BadAlloc;
} }
#ifdef NXAGENT_SERVER
bzero((char *)&xkb->names->keys[xkb->max_key_code+1],
tmp*sizeof(XkbKeyNameRec));
#else
bzero((char *)&xkb->names->keys[xkb->max_key_code], bzero((char *)&xkb->names->keys[xkb->max_key_code],
tmp*sizeof(XkbKeyNameRec)); tmp*sizeof(XkbKeyNameRec));
#endif
if (changes) { if (changes) {
changes->names.changed= _ExtendRange(changes->names.changed, changes->names.changed= _ExtendRange(changes->names.changed,
XkbKeyNamesMask,maxKC, XkbKeyNamesMask,maxKC,
......
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
OBJS = randr.o mirandr.o
INCLUDES = -I../include -I../mi -I../../../include/fonts \
-I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I$(FONTINCSRC) -I../render
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
NormalLibraryTarget(randr,$(OBJS))
NormalLibraryObjectRule()
LintLibraryTarget(randr,$(SRCS))
NormalLintTarget($(SRCS))
DependTarget()
/*
* $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.5 2001/06/04 09:45:40 keithp Exp $
*
* 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 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.
*
* 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, HP Labs, Hewlett-Packard, Inc.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "scrnintstr.h"
#include "mi.h"
#include <X11/extensions/randr.h>
#include "randrstr.h"
#include <stdio.h>
/*
* This function assumes that only a single depth can be
* displayed at a time, but that all visuals of that depth
* 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
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
int i;
Bool setConfig = FALSE;
*rotations = RR_Rotate_0;
for (i = 0; i < pScreen->numDepths; i++)
{
if (pScreen->allowedDepths[i].numVids)
{
RRScreenSizePtr pSize;
pSize = RRRegisterSize (pScreen,
pScreen->width,
pScreen->height,
pScreen->mmWidth,
pScreen->mmHeight);
if (!pSize)
return FALSE;
if (!setConfig)
{
RRSetCurrentConfig (pScreen, RR_Rotate_0, 0, pSize);
setConfig = TRUE;
}
}
}
return TRUE;
}
/*
* Any hardware that can actually change anything will need something
* different here
*/
Bool
miRRSetConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize)
{
return TRUE;
}
Bool
miRandRInit (ScreenPtr pScreen)
{
rrScrPrivPtr rp;
if (!RRScreenInit (pScreen))
return FALSE;
rp = rrGetScrPriv(pScreen);
rp->rrGetInfo = miRRGetInfo;
rp->rrSetConfig = miRRSetConfig;
return TRUE;
}
/*
* $XFree86: xc/programs/Xserver/randr/randrstr.h,v 1.5 2002/09/29 23:39:45 keithp Exp $
*
* Copyright © 2000 Compaq Computer Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of 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.
*
* COMPAQ 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _RANDRSTR_H_
#define _RANDRSTR_H_
#include <X11/extensions/randr.h>
typedef struct _rrScreenRate {
int rate;
Bool referenced;
Bool oldReferenced;
} RRScreenRate, *RRScreenRatePtr;
typedef struct _rrScreenSize {
int id;
short width, height;
short mmWidth, mmHeight;
RRScreenRatePtr pRates;
int nRates;
int nRatesInUse;
Bool referenced;
Bool oldReferenced;
} RRScreenSize, *RRScreenSizePtr;
typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
typedef struct _rrScrPriv {
RRSetConfigProcPtr rrSetConfig;
RRGetInfoProcPtr rrGetInfo;
TimeStamp lastSetTime; /* last changed by client */
TimeStamp lastConfigTime; /* possible configs changed */
RRCloseScreenProcPtr CloseScreen;
/*
* Configuration information
*/
Rotation rotations;
int nSizes;
int nSizesInUse;
RRScreenSizePtr pSizes;
/*
* Current state
*/
Rotation rotation;
int size;
int rate;
} rrScrPrivRec, *rrScrPrivPtr;
extern int rrPrivIndex;
#define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr)
#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p))
/* Initialize the extension */
void
RRExtensionInit (void);
/*
* Then, register the specific size with the screen
*/
RRScreenSizePtr
RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
short mmHeight);
Bool RRRegisterRate (ScreenPtr pScreen,
RRScreenSizePtr pSize,
int rate);
/*
* Finally, set the current configuration of the screen
*/
void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
Bool RRScreenInit(ScreenPtr pScreen);
int
RRSetScreenConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
Bool
miRandRInit (ScreenPtr pScreen);
Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations);
Bool
miRRSetConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr size);
Bool
miRRGetScreenInfo (ScreenPtr pScreen);
#endif /* _RANDRSTR_H_ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NX-X11, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $ XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $
#include <Server.tmpl> #include <Server.tmpl>
SRCS = randr.c mirandr.c SRCS = mirandr.c randr.c rrcrtc.c rrdispatch.c rrinfo.c rrmode.c rroutput.c rrpointer.c rrproperty.c rrscreen.c rrsdispatch.c rrxinerama.c
OBJS = randr.o mirandr.o OBJS = mirandr.o randr.o rrcrtc.o rrdispatch.o rrinfo.o rrmode.o rroutput.o rrpointer.o rrproperty.o rrscreen.o rrsdispatch.o rrxinerama.o
INCLUDES = -I../include -I../mi -I../../../include/fonts \ INCLUDES = -I../include -I../mi -I../../../include/fonts \
-I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I$(FONTINCSRC) -I../render -I$(FONTINCSRC) -I../render
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
DEFINES = -DNXAGENT_SERVER
NormalLibraryTarget(randr,$(OBJS)) NormalLibraryTarget(randr,$(OBJS))
NormalLibraryObjectRule() NormalLibraryObjectRule()
LintLibraryTarget(randr,$(SRCS)) LintLibraryTarget(randr,$(SRCS))
......
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NX-X11, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $
#include <Server.tmpl>
SRCS = mirandr.c randr.c rrcrtc.c rrdispatch.c rrinfo.c rrmode.c rroutput.c rrpointer.c rrproperty.c rrscreen.c rrsdispatch.c rrxinerama.c
OBJS = mirandr.o randr.o rrcrtc.o rrdispatch.o rrinfo.o rrmode.o rroutput.o rrpointer.o rrproperty.o rrscreen.o rrsdispatch.o rrxinerama.o
INCLUDES = -I../include -I../mi -I../../../include/fonts \
-I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I$(FONTINCSRC) -I../render
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
DEFINES = -DNXAGENT_SERVER
NormalLibraryTarget(randr,$(OBJS))
NormalLibraryObjectRule()
LintLibraryTarget(randr,$(SRCS))
NormalLintTarget($(SRCS))
DependTarget()
noinst_LTLIBRARIES = librandr.la
AM_CFLAGS = $(DIX_CFLAGS)
XINERAMA_SRCS = rrxinerama.c
if XORG
sdk_HEADERS = randrstr.h
endif
librandr_la_SOURCES = \
mirandr.c \
randr.c \
randrstr.h \
rrcrtc.c \
rrdispatch.c \
rrinfo.c \
rrmode.c \
rroutput.c \
rrpointer.c \
rrproperty.c \
rrscreen.c \
rrsdispatch.c
if XINERAMA
librandr_la_SOURCES += ${XINERAMA_SRCS}
endif
/* /*
* $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.5 2001/06/04 09:45:40 keithp Exp $ * Copyright © 2000 Compaq Computer Corporation
* * Copyright © 2002 Hewlett-Packard Company
* Copyright © 2000, Compaq Computer Corporation, * Copyright © 2006 Intel Corporation
* Copyright © 2002, Hewlett Packard, Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that * documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that * the above copyright notice appear in all copies and that both that copyright
* copyright notice and this permission notice appear in supporting * notice and this permission notice appear in supporting documentation, and
* documentation, and that the name of Compaq or HP not be used in advertising * that the name of the copyright holders not be used in advertising or
* or publicity pertaining to distribution of the software without specific, * publicity pertaining to distribution of the software without specific,
* written prior permission. HP makes no representations about the * written prior permission. The copyright holders make no representations
* suitability of this software for any purpose. It is provided "as is" * about the suitability of this software for any purpose. It is provided "as
* without express or implied warranty. * is" without express or implied warranty.
* *
* HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
* *
* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. * Author: Jim Gettys, Hewlett-Packard Company, Inc.
* Keith Packard, Intel Corporation
*/ */
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include "scrnintstr.h" #include "scrnintstr.h"
#include "mi.h" #include "mi.h"
#include <X11/extensions/randr.h>
#include "randrstr.h" #include "randrstr.h"
#include <stdio.h> #include <stdio.h>
/*
* This function assumes that only a single depth can be
* displayed at a time, but that all visuals of that depth
* 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 Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations) miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{ {
int i;
Bool setConfig = FALSE;
*rotations = RR_Rotate_0;
for (i = 0; i < pScreen->numDepths; i++)
{
if (pScreen->allowedDepths[i].numVids)
{
RRScreenSizePtr pSize;
pSize = RRRegisterSize (pScreen,
pScreen->width,
pScreen->height,
pScreen->mmWidth,
pScreen->mmHeight);
if (!pSize)
return FALSE;
if (!setConfig)
{
RRSetCurrentConfig (pScreen, RR_Rotate_0, 0, pSize);
setConfig = TRUE;
}
}
}
return TRUE; return TRUE;
} }
...@@ -79,24 +45,110 @@ miRRGetInfo (ScreenPtr pScreen, Rotation *rotations) ...@@ -79,24 +45,110 @@ miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
* different here * different here
*/ */
Bool Bool
miRRSetConfig (ScreenPtr pScreen, miRRCrtcSet (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation, Rotation rotation,
int rate, int numOutput,
RRScreenSizePtr pSize) RROutputPtr *outputs)
{
return TRUE;
}
static Bool
miRRCrtcSetGamma (ScreenPtr pScreen,
RRCrtcPtr crtc)
{ {
return TRUE; return TRUE;
} }
Bool
miRROutputSetProperty (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
RRPropertyValuePtr value)
{
return TRUE;
}
Bool
miRROutputValidateMode (ScreenPtr pScreen,
RROutputPtr output,
RRModePtr mode)
{
return FALSE;
}
void
miRRModeDestroy (ScreenPtr pScreen,
RRModePtr mode)
{
}
/*
* This function assumes that only a single depth can be
* displayed at a time, but that all visuals of that depth
* 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 Bool
miRandRInit (ScreenPtr pScreen) miRandRInit (ScreenPtr pScreen)
{ {
rrScrPrivPtr rp; rrScrPrivPtr pScrPriv;
#if RANDR_12_INTERFACE
RRModePtr mode;
RRCrtcPtr crtc;
RROutputPtr output;
xRRModeInfo modeInfo;
char name[64];
#endif
if (!RRScreenInit (pScreen)) if (!RRScreenInit (pScreen))
return FALSE; return FALSE;
rp = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
rp->rrGetInfo = miRRGetInfo; pScrPriv->rrGetInfo = miRRGetInfo;
rp->rrSetConfig = miRRSetConfig; #if RANDR_12_INTERFACE
pScrPriv->rrCrtcSet = miRRCrtcSet;
pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma;
pScrPriv->rrOutputSetProperty = miRROutputSetProperty;
pScrPriv->rrOutputValidateMode = miRROutputValidateMode;
pScrPriv->rrModeDestroy = miRRModeDestroy;
RRScreenSetSizeRange (pScreen,
pScreen->width, pScreen->height,
pScreen->width, pScreen->height);
sprintf (name, "%dx%d", pScreen->width, pScreen->height);
memset (&modeInfo, '\0', sizeof (modeInfo));
modeInfo.width = pScreen->width;
modeInfo.height = pScreen->height;
modeInfo.nameLength = strlen (name);
mode = RRModeGet (&modeInfo, name);
if (!mode)
return FALSE;
crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return FALSE;
output = RROutputCreate (pScreen, "screen", 6, NULL);
if (!output)
return FALSE;
if (!RROutputSetClones (output, NULL, 0))
return FALSE;
if (!RROutputSetModes (output, &mode, 1, 0))
return FALSE;
if (!RROutputSetCrtcs (output, &crtc, 1))
return FALSE;
if (!RROutputSetConnection (output, RR_Connected))
return FALSE;
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, 1, &output);
#endif
return TRUE; return TRUE;
} }
/* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.5 2000/03/01 01:04:21 dawes Exp $ */
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
#ifndef _PANORAMIXPROTO_H_
#define _PANORAMIXPROTO_H_
#define PANORAMIX_PROTOCOL_NAME "XINERAMA"
#define X_PanoramiXQueryVersion 0
#define X_PanoramiXGetState 1
#define X_PanoramiXGetScreenCount 2
#define X_PanoramiXGetScreenSize 3
#define X_XineramaIsActive 4
#define X_XineramaQueryScreens 5
typedef struct _PanoramiXQueryVersion {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */
CARD16 length B16;
CARD8 clientMajor;
CARD8 clientMinor;
CARD16 unused B16;
} xPanoramiXQueryVersionReq;
#define sz_xPanoramiXQueryVersionReq 8
typedef struct {
CARD8 type; /* must be X_Reply */
CARD8 pad1; /* unused */
CARD16 sequenceNumber B16; /* last sequence number */
CARD32 length B32; /* 0 */
CARD16 majorVersion B16;
CARD16 minorVersion B16;
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
CARD32 pad6 B32; /* unused */
} xPanoramiXQueryVersionReply;
#define sz_xPanoramiXQueryVersionReply 32
typedef struct _PanoramiXGetState {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length B16;
CARD32 window B32;
} xPanoramiXGetStateReq;
#define sz_xPanoramiXGetStateReq 8
typedef struct {
BYTE type;
BYTE state;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 window B32;
CARD32 pad1 B32; /* unused */
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
} xPanoramiXGetStateReply;
#define sz_panoramiXGetStateReply 32
typedef struct _PanoramiXGetScreenCount {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */
CARD16 length B16;
CARD32 window B32;
} xPanoramiXGetScreenCountReq;
#define sz_xPanoramiXGetScreenCountReq 8
typedef struct {
BYTE type;
BYTE ScreenCount;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 window B32;
CARD32 pad1 B32; /* unused */
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
} xPanoramiXGetScreenCountReply;
#define sz_panoramiXGetScreenCountReply 32
typedef struct _PanoramiXGetScreenSize {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length B16;
CARD32 window B32;
CARD32 screen B32;
} xPanoramiXGetScreenSizeReq;
#define sz_xPanoramiXGetScreenSizeReq 12
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 width B32;
CARD32 height B32;
CARD32 window B32;
CARD32 screen B32;
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
} xPanoramiXGetScreenSizeReply;
#define sz_panoramiXGetScreenSizeReply 32
/************ Alternate protocol ******************/
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length B16;
} xXineramaIsActiveReq;
#define sz_xXineramaIsActiveReq 4
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 state B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXineramaIsActiveReply;
#define sz_XineramaIsActiveReply 32
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length B16;
} xXineramaQueryScreensReq;
#define sz_xXineramaQueryScreensReq 4
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 number B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXineramaQueryScreensReply;
#define sz_XineramaQueryScreensReply 32
typedef struct {
INT16 x_org B16;
INT16 y_org B16;
CARD16 width B16;
CARD16 height B16;
} xXineramaScreenInfo;
#define sz_XineramaScreenInfo 8
#endif
/* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.5 2000/03/01 01:04:21 dawes Exp $ */
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
#ifndef _PANORAMIXPROTO_H_
#define _PANORAMIXPROTO_H_
#define PANORAMIX_PROTOCOL_NAME "XINERAMA"
#define X_PanoramiXQueryVersion 0
#define X_PanoramiXGetState 1
#define X_PanoramiXGetScreenCount 2
#define X_PanoramiXGetScreenSize 3
#define X_XineramaIsActive 4
#define X_XineramaQueryScreens 5
typedef struct _PanoramiXQueryVersion {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */
CARD16 length B16;
CARD8 clientMajor;
CARD8 clientMinor;
CARD16 unused B16;
} xPanoramiXQueryVersionReq;
#define sz_xPanoramiXQueryVersionReq 8
typedef struct {
CARD8 type; /* must be X_Reply */
CARD8 pad1; /* unused */
CARD16 sequenceNumber B16; /* last sequence number */
CARD32 length B32; /* 0 */
CARD16 majorVersion B16;
CARD16 minorVersion B16;
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
CARD32 pad6 B32; /* unused */
} xPanoramiXQueryVersionReply;
#define sz_xPanoramiXQueryVersionReply 32
typedef struct _PanoramiXGetState {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length B16;
CARD32 window B32;
} xPanoramiXGetStateReq;
#define sz_xPanoramiXGetStateReq 8
typedef struct {
BYTE type;
BYTE state;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 window B32;
CARD32 pad1 B32; /* unused */
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
} xPanoramiXGetStateReply;
#define sz_panoramiXGetStateReply 32
typedef struct _PanoramiXGetScreenCount {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */
CARD16 length B16;
CARD32 window B32;
} xPanoramiXGetScreenCountReq;
#define sz_xPanoramiXGetScreenCountReq 8
typedef struct {
BYTE type;
BYTE ScreenCount;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 window B32;
CARD32 pad1 B32; /* unused */
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
} xPanoramiXGetScreenCountReply;
#define sz_panoramiXGetScreenCountReply 32
typedef struct _PanoramiXGetScreenSize {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length B16;
CARD32 window B32;
CARD32 screen B32;
} xPanoramiXGetScreenSizeReq;
#define sz_xPanoramiXGetScreenSizeReq 12
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 width B32;
CARD32 height B32;
CARD32 window B32;
CARD32 screen B32;
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
} xPanoramiXGetScreenSizeReply;
#define sz_panoramiXGetScreenSizeReply 32
/************ Alternate protocol ******************/
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length B16;
} xXineramaIsActiveReq;
#define sz_xXineramaIsActiveReq 4
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 state B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXineramaIsActiveReply;
#define sz_XineramaIsActiveReply 32
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length B16;
} xXineramaQueryScreensReq;
#define sz_xXineramaQueryScreensReq 4
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 number B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXineramaQueryScreensReply;
#define sz_XineramaQueryScreensReply 32
typedef struct {
INT16 x_org B16;
INT16 y_org B16;
CARD16 width B16;
CARD16 height B16;
} xXineramaScreenInfo;
#define sz_XineramaScreenInfo 8
#endif
/*
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett Packard Company
* Copyright © 2006 Intel Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
* Keith Packard, Intel Corporation
*/
#ifndef _RANDR_H_
#define _RANDR_H_
typedef unsigned short Rotation;
typedef unsigned short SizeID;
typedef unsigned short SubpixelOrder;
typedef unsigned short Connection;
typedef unsigned short XRandrRotation;
typedef unsigned short XRandrSizeID;
typedef unsigned short XRandrSubpixelOrder;
typedef unsigned long XRandrModeFlags;
#define RANDR_NAME "RANDR"
#define RANDR_MAJOR 1
#define RANDR_MINOR 2
#define RRNumberErrors 3
#define RRNumberEvents 2
#define RRNumberRequests 25
#define X_RRQueryVersion 0
/* we skip 1 to make old clients fail pretty immediately */
#define X_RROldGetScreenInfo 1
#define X_RR1_0SetScreenConfig 2
/* V1.0 apps share the same set screen config request id */
#define X_RRSetScreenConfig 2
#define X_RROldScreenChangeSelectInput 3
/* 3 used to be ScreenChangeSelectInput; deprecated */
#define X_RRSelectInput 4
#define X_RRGetScreenInfo 5
/* V1.2 additions */
#define X_RRGetScreenSizeRange 6
#define X_RRSetScreenSize 7
#define X_RRGetScreenResources 8
#define X_RRGetOutputInfo 9
#define X_RRListOutputProperties 10
#define X_RRQueryOutputProperty 11
#define X_RRConfigureOutputProperty 12
#define X_RRChangeOutputProperty 13
#define X_RRDeleteOutputProperty 14
#define X_RRGetOutputProperty 15
#define X_RRCreateMode 16
#define X_RRDestroyMode 17
#define X_RRAddOutputMode 18
#define X_RRDeleteOutputMode 19
#define X_RRGetCrtcInfo 20
#define X_RRSetCrtcConfig 21
#define X_RRGetCrtcGammaSize 22
#define X_RRGetCrtcGamma 23
#define X_RRSetCrtcGamma 24
/* Event selection bits */
#define RRScreenChangeNotifyMask (1L << 0)
/* V1.2 additions */
#define RRCrtcChangeNotifyMask (1L << 1)
#define RROutputChangeNotifyMask (1L << 2)
#define RROutputPropertyNotifyMask (1L << 3)
/* Event codes */
#define RRScreenChangeNotify 0
/* V1.2 additions */
#define RRNotify 1
/* RRNotify Subcodes */
#define RRNotify_CrtcChange 0
#define RRNotify_OutputChange 1
#define RRNotify_OutputProperty 2
/* used in the rotation field; rotation and reflection in 0.1 proto. */
#define RR_Rotate_0 1
#define RR_Rotate_90 2
#define RR_Rotate_180 4
#define RR_Rotate_270 8
/* new in 1.0 protocol, to allow reflection of screen */
#define RR_Reflect_X 16
#define RR_Reflect_Y 32
#define RRSetConfigSuccess 0
#define RRSetConfigInvalidConfigTime 1
#define RRSetConfigInvalidTime 2
#define RRSetConfigFailed 3
/* new in 1.2 protocol */
#define RR_HSyncPositive 0x00000001
#define RR_HSyncNegative 0x00000002
#define RR_VSyncPositive 0x00000004
#define RR_VSyncNegative 0x00000008
#define RR_Interlace 0x00000010
#define RR_DoubleScan 0x00000020
#define RR_CSync 0x00000040
#define RR_CSyncPositive 0x00000080
#define RR_CSyncNegative 0x00000100
#define RR_HSkewPresent 0x00000200
#define RR_BCast 0x00000400
#define RR_PixelMultiplex 0x00000800
#define RR_DoubleClock 0x00001000
#define RR_ClockDivideBy2 0x00002000
#define RR_Connected 0
#define RR_Disconnected 1
#define RR_UnknownConnection 2
#define BadRROutput 0
#define BadRRCrtc 1
#define BadRRMode 2
/* Conventional RandR output properties */
#define RR_PROPERTY_RANDR_EDID "RANDR_EDID"
#endif /* _RANDR_H_ */
/*
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett Packard Company
* Copyright © 2006 Intel Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
* Keith Packard, Intel Corporation
*/
#ifndef _RANDR_H_
#define _RANDR_H_
typedef unsigned short Rotation;
typedef unsigned short SizeID;
typedef unsigned short SubpixelOrder;
typedef unsigned short Connection;
typedef unsigned short XRandrRotation;
typedef unsigned short XRandrSizeID;
typedef unsigned short XRandrSubpixelOrder;
typedef unsigned long XRandrModeFlags;
#define RANDR_NAME "RANDR"
#define RANDR_MAJOR 1
#define RANDR_MINOR 2
#define RRNumberErrors 3
#define RRNumberEvents 2
#define RRNumberRequests 25
#define X_RRQueryVersion 0
/* we skip 1 to make old clients fail pretty immediately */
#define X_RROldGetScreenInfo 1
#define X_RR1_0SetScreenConfig 2
/* V1.0 apps share the same set screen config request id */
#define X_RRSetScreenConfig 2
#define X_RROldScreenChangeSelectInput 3
/* 3 used to be ScreenChangeSelectInput; deprecated */
#define X_RRSelectInput 4
#define X_RRGetScreenInfo 5
/* V1.2 additions */
#define X_RRGetScreenSizeRange 6
#define X_RRSetScreenSize 7
#define X_RRGetScreenResources 8
#define X_RRGetOutputInfo 9
#define X_RRListOutputProperties 10
#define X_RRQueryOutputProperty 11
#define X_RRConfigureOutputProperty 12
#define X_RRChangeOutputProperty 13
#define X_RRDeleteOutputProperty 14
#define X_RRGetOutputProperty 15
#define X_RRCreateMode 16
#define X_RRDestroyMode 17
#define X_RRAddOutputMode 18
#define X_RRDeleteOutputMode 19
#define X_RRGetCrtcInfo 20
#define X_RRSetCrtcConfig 21
#define X_RRGetCrtcGammaSize 22
#define X_RRGetCrtcGamma 23
#define X_RRSetCrtcGamma 24
/* Event selection bits */
#define RRScreenChangeNotifyMask (1L << 0)
/* V1.2 additions */
#define RRCrtcChangeNotifyMask (1L << 1)
#define RROutputChangeNotifyMask (1L << 2)
#define RROutputPropertyNotifyMask (1L << 3)
/* Event codes */
#define RRScreenChangeNotify 0
/* V1.2 additions */
#define RRNotify 1
/* RRNotify Subcodes */
#define RRNotify_CrtcChange 0
#define RRNotify_OutputChange 1
#define RRNotify_OutputProperty 2
/* used in the rotation field; rotation and reflection in 0.1 proto. */
#define RR_Rotate_0 1
#define RR_Rotate_90 2
#define RR_Rotate_180 4
#define RR_Rotate_270 8
/* new in 1.0 protocol, to allow reflection of screen */
#define RR_Reflect_X 16
#define RR_Reflect_Y 32
#define RRSetConfigSuccess 0
#define RRSetConfigInvalidConfigTime 1
#define RRSetConfigInvalidTime 2
#define RRSetConfigFailed 3
/* new in 1.2 protocol */
#define RR_HSyncPositive 0x00000001
#define RR_HSyncNegative 0x00000002
#define RR_VSyncPositive 0x00000004
#define RR_VSyncNegative 0x00000008
#define RR_Interlace 0x00000010
#define RR_DoubleScan 0x00000020
#define RR_CSync 0x00000040
#define RR_CSyncPositive 0x00000080
#define RR_CSyncNegative 0x00000100
#define RR_HSkewPresent 0x00000200
#define RR_BCast 0x00000400
#define RR_PixelMultiplex 0x00000800
#define RR_DoubleClock 0x00001000
#define RR_ClockDivideBy2 0x00002000
#define RR_Connected 0
#define RR_Disconnected 1
#define RR_UnknownConnection 2
#define BadRROutput 0
#define BadRRCrtc 1
#define BadRRMode 2
/* Conventional RandR output properties */
#define RR_PROPERTY_RANDR_EDID "RANDR_EDID"
#endif /* _RANDR_H_ */
/***********************************************************
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef DIX_REGISTRY_H
#define DIX_REGISTRY_H
/*
* Result returned from any unsuccessful lookup
*/
#define XREGISTRY_UNKNOWN "<unknown>"
#ifdef XREGISTRY
#include "resource.h"
#include "extnsionst.h"
/* Internal string registry - for auditing, debugging, security, etc. */
/*
* Registration functions. The name string is not copied, so it must
* not be a stack variable.
*/
void RegisterResourceName(RESTYPE type, char *name);
void RegisterExtensionNames(ExtensionEntry *ext);
/*
* Lookup functions. The returned string must not be modified or freed.
*/
const char *LookupMajorName(int major);
const char *LookupRequestName(int major, int minor);
const char *LookupEventName(int event);
const char *LookupErrorName(int error);
const char *LookupResourceName(RESTYPE rtype);
/*
* Setup and teardown
*/
void dixResetRegistry(void);
#else /* XREGISTRY */
/* Define calls away when the registry is not being built. */
#define RegisterResourceName(a, b) { ; }
#define RegisterExtensionNames(a) { ; }
#define LookupMajorName(a) XREGISTRY_UNKNOWN
#define LookupRequestName(a, b) XREGISTRY_UNKNOWN
#define LookupEventName(a) XREGISTRY_UNKNOWN
#define LookupErrorName(a) XREGISTRY_UNKNOWN
#define LookupResourceName(a) XREGISTRY_UNKNOWN
#define dixResetRegistry() { ; }
#endif /* XREGISTRY */
#endif /* DIX_REGISTRY_H */
/***********************************************************
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef DIX_REGISTRY_H
#define DIX_REGISTRY_H
/*
* Result returned from any unsuccessful lookup
*/
#define XREGISTRY_UNKNOWN "<unknown>"
#ifdef XREGISTRY
#include "resource.h"
#include "extnsionst.h"
/* Internal string registry - for auditing, debugging, security, etc. */
/*
* Registration functions. The name string is not copied, so it must
* not be a stack variable.
*/
void RegisterResourceName(RESTYPE type, char *name);
void RegisterExtensionNames(ExtensionEntry *ext);
/*
* Lookup functions. The returned string must not be modified or freed.
*/
const char *LookupMajorName(int major);
const char *LookupRequestName(int major, int minor);
const char *LookupEventName(int event);
const char *LookupErrorName(int error);
const char *LookupResourceName(RESTYPE rtype);
/*
* Setup and teardown
*/
void dixResetRegistry(void);
#else /* XREGISTRY */
/* Define calls away when the registry is not being built. */
#define RegisterResourceName(a, b) { ; }
#define RegisterExtensionNames(a) { ; }
#define LookupMajorName(a) XREGISTRY_UNKNOWN
#define LookupRequestName(a, b) XREGISTRY_UNKNOWN
#define LookupEventName(a) XREGISTRY_UNKNOWN
#define LookupErrorName(a) XREGISTRY_UNKNOWN
#define LookupResourceName(a) XREGISTRY_UNKNOWN
#define dixResetRegistry() { ; }
#endif /* XREGISTRY */
#endif /* DIX_REGISTRY_H */
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
#define SERVER_RANDR_MAJOR 1
#define SERVER_RANDR_MINOR 2
Bool
RRClientKnowsRates (ClientPtr pClient)
{
rrClientPriv(pClient);
return (pRRClient->major_version > 1 ||
(pRRClient->major_version == 1 && pRRClient->minor_version >= 1));
}
static int
ProcRRQueryVersion (ClientPtr client)
{
xRRQueryVersionReply rep;
register int n;
REQUEST(xRRQueryVersionReq);
rrClientPriv(client);
REQUEST_SIZE_MATCH(xRRQueryVersionReq);
pRRClient->major_version = stuff->majorVersion;
pRRClient->minor_version = stuff->minorVersion;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/*
* Report the current version; the current
* spec says they're all compatible after 1.0
*/
rep.majorVersion = SERVER_RANDR_MAJOR;
rep.minorVersion = SERVER_RANDR_MINOR;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.majorVersion, n);
swapl(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcRRSelectInput (ClientPtr client)
{
REQUEST(xRRSelectInputReq);
rrClientPriv(client);
RRTimesPtr pTimes;
WindowPtr pWin;
RREventPtr pRREvent, *pHead;
XID clientResource;
int rc;
REQUEST_SIZE_MATCH(xRRSelectInputReq);
#ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
#else
pWin = SecurityLookupWindow(stuff->window, client, SecurityWriteAccess);
rc = pWin ? Success : BadWindow;
#endif
if (rc != Success)
return rc;
pHead = (RREventPtr *)SecurityLookupIDByType(client,
pWin->drawable.id, RREventType,
DixWriteAccess);
if (stuff->enable & (RRScreenChangeNotifyMask|
RRCrtcChangeNotifyMask|
RROutputChangeNotifyMask))
{
ScreenPtr pScreen = pWin->drawable.pScreen;
rrScrPriv (pScreen);
pRREvent = NULL;
if (pHead)
{
/* check for existing entry. */
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
if (pRREvent->client == client)
break;
}
if (!pRREvent)
{
/* build the entry */
pRREvent = (RREventPtr) xalloc (sizeof (RREventRec));
if (!pRREvent)
return BadAlloc;
pRREvent->next = 0;
pRREvent->client = client;
pRREvent->window = pWin;
pRREvent->mask = stuff->enable;
/*
* add a resource that will be deleted when
* the client goes away
*/
clientResource = FakeClientID (client->index);
pRREvent->clientResource = clientResource;
if (!AddResource (clientResource, RRClientType, (pointer)pRREvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
* of clients selecting input. This must be indirect as
* the list may be arbitrarily rearranged which cannot be
* done through the resource database.
*/
if (!pHead)
{
pHead = (RREventPtr *) xalloc (sizeof (RREventPtr));
if (!pHead ||
!AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
{
FreeResource (clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
}
pRREvent->next = *pHead;
*pHead = pRREvent;
}
/*
* Now see if the client needs an event
*/
if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask))
{
pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
if (CompareTimeStamps (pTimes->setTime,
pScrPriv->lastSetTime) != 0 ||
CompareTimeStamps (pTimes->configTime,
pScrPriv->lastConfigTime) != 0)
{
RRDeliverScreenEvent (client, pWin, pScreen);
}
}
}
else if (stuff->enable == 0)
{
/* delete the interest */
if (pHead) {
RREventPtr pNewRREvent = 0;
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
if (pRREvent->client == client)
break;
pNewRREvent = pRREvent;
}
if (pRREvent) {
FreeResource (pRREvent->clientResource, RRClientType);
if (pNewRREvent)
pNewRREvent->next = pRREvent->next;
else
*pHead = pRREvent->next;
xfree (pRREvent);
}
}
}
else
{
client->errorValue = stuff->enable;
return BadValue;
}
return Success;
}
int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
ProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
NULL, /* 1 ProcRandrOldGetScreenInfo */
/* V1.0 apps share the same set screen config request id */
ProcRRSetScreenConfig, /* 2 */
NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
/* 3 used to be ScreenChangeSelectInput; deprecated */
ProcRRSelectInput, /* 4 */
ProcRRGetScreenInfo, /* 5 */
/* V1.2 additions */
ProcRRGetScreenSizeRange, /* 6 */
ProcRRSetScreenSize, /* 7 */
ProcRRGetScreenResources, /* 8 */
ProcRRGetOutputInfo, /* 9 */
ProcRRListOutputProperties, /* 10 */
ProcRRQueryOutputProperty, /* 11 */
ProcRRConfigureOutputProperty, /* 12 */
ProcRRChangeOutputProperty, /* 13 */
ProcRRDeleteOutputProperty, /* 14 */
ProcRRGetOutputProperty, /* 15 */
ProcRRCreateMode, /* 16 */
ProcRRDestroyMode, /* 17 */
ProcRRAddOutputMode, /* 18 */
ProcRRDeleteOutputMode, /* 19 */
ProcRRGetCrtcInfo, /* 20 */
ProcRRSetCrtcConfig, /* 21 */
ProcRRGetCrtcGammaSize, /* 22 */
ProcRRGetCrtcGamma, /* 23 */
ProcRRSetCrtcGamma, /* 24 */
};
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
#define SERVER_RANDR_MAJOR 1
#define SERVER_RANDR_MINOR 2
Bool
RRClientKnowsRates (ClientPtr pClient)
{
rrClientPriv(pClient);
return (pRRClient->major_version > 1 ||
(pRRClient->major_version == 1 && pRRClient->minor_version >= 1));
}
static int
ProcRRQueryVersion (ClientPtr client)
{
xRRQueryVersionReply rep;
register int n;
REQUEST(xRRQueryVersionReq);
rrClientPriv(client);
REQUEST_SIZE_MATCH(xRRQueryVersionReq);
pRRClient->major_version = stuff->majorVersion;
pRRClient->minor_version = stuff->minorVersion;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/*
* Report the current version; the current
* spec says they're all compatible after 1.0
*/
rep.majorVersion = SERVER_RANDR_MAJOR;
rep.minorVersion = SERVER_RANDR_MINOR;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.majorVersion, n);
swapl(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcRRSelectInput (ClientPtr client)
{
REQUEST(xRRSelectInputReq);
rrClientPriv(client);
RRTimesPtr pTimes;
WindowPtr pWin;
RREventPtr pRREvent, *pHead;
XID clientResource;
int rc;
REQUEST_SIZE_MATCH(xRRSelectInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (rc != Success)
return rc;
pHead = (RREventPtr *)SecurityLookupIDByType(client,
pWin->drawable.id, RREventType,
DixWriteAccess);
if (stuff->enable & (RRScreenChangeNotifyMask|
RRCrtcChangeNotifyMask|
RROutputChangeNotifyMask))
{
ScreenPtr pScreen = pWin->drawable.pScreen;
rrScrPriv (pScreen);
pRREvent = NULL;
if (pHead)
{
/* check for existing entry. */
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
if (pRREvent->client == client)
break;
}
if (!pRREvent)
{
/* build the entry */
pRREvent = (RREventPtr) xalloc (sizeof (RREventRec));
if (!pRREvent)
return BadAlloc;
pRREvent->next = 0;
pRREvent->client = client;
pRREvent->window = pWin;
pRREvent->mask = stuff->enable;
/*
* add a resource that will be deleted when
* the client goes away
*/
clientResource = FakeClientID (client->index);
pRREvent->clientResource = clientResource;
if (!AddResource (clientResource, RRClientType, (pointer)pRREvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
* of clients selecting input. This must be indirect as
* the list may be arbitrarily rearranged which cannot be
* done through the resource database.
*/
if (!pHead)
{
pHead = (RREventPtr *) xalloc (sizeof (RREventPtr));
if (!pHead ||
!AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
{
FreeResource (clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
}
pRREvent->next = *pHead;
*pHead = pRREvent;
}
/*
* Now see if the client needs an event
*/
if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask))
{
pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
if (CompareTimeStamps (pTimes->setTime,
pScrPriv->lastSetTime) != 0 ||
CompareTimeStamps (pTimes->configTime,
pScrPriv->lastConfigTime) != 0)
{
RRDeliverScreenEvent (client, pWin, pScreen);
}
}
}
else if (stuff->enable == 0)
{
/* delete the interest */
if (pHead) {
RREventPtr pNewRREvent = 0;
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
if (pRREvent->client == client)
break;
pNewRREvent = pRREvent;
}
if (pRREvent) {
FreeResource (pRREvent->clientResource, RRClientType);
if (pNewRREvent)
pNewRREvent->next = pRREvent->next;
else
*pHead = pRREvent->next;
xfree (pRREvent);
}
}
}
else
{
client->errorValue = stuff->enable;
return BadValue;
}
return Success;
}
int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
ProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
NULL, /* 1 ProcRandrOldGetScreenInfo */
/* V1.0 apps share the same set screen config request id */
ProcRRSetScreenConfig, /* 2 */
NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
/* 3 used to be ScreenChangeSelectInput; deprecated */
ProcRRSelectInput, /* 4 */
ProcRRGetScreenInfo, /* 5 */
/* V1.2 additions */
ProcRRGetScreenSizeRange, /* 6 */
ProcRRSetScreenSize, /* 7 */
ProcRRGetScreenResources, /* 8 */
ProcRRGetOutputInfo, /* 9 */
ProcRRListOutputProperties, /* 10 */
ProcRRQueryOutputProperty, /* 11 */
ProcRRConfigureOutputProperty, /* 12 */
ProcRRChangeOutputProperty, /* 13 */
ProcRRDeleteOutputProperty, /* 14 */
ProcRRGetOutputProperty, /* 15 */
ProcRRCreateMode, /* 16 */
ProcRRDestroyMode, /* 17 */
ProcRRAddOutputMode, /* 18 */
ProcRRDeleteOutputMode, /* 19 */
ProcRRGetCrtcInfo, /* 20 */
ProcRRSetCrtcConfig, /* 21 */
ProcRRGetCrtcGammaSize, /* 22 */
ProcRRGetCrtcGamma, /* 23 */
ProcRRSetCrtcGamma, /* 24 */
};
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
#ifdef RANDR_10_INTERFACE
static RRModePtr
RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
{
ScreenPtr pScreen = output->pScreen;
rrScrPriv(pScreen);
xRRModeInfo modeInfo;
char name[100];
RRModePtr mode;
int i;
RRModePtr *modes;
memset (&modeInfo, '\0', sizeof (modeInfo));
sprintf (name, "%dx%d", size->width, size->height);
modeInfo.width = size->width;
modeInfo.height = size->height;
modeInfo.hTotal = size->width;
modeInfo.vTotal = size->height;
modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
(CARD32) refresh);
modeInfo.nameLength = strlen (name);
mode = RRModeGet (&modeInfo, name);
if (!mode)
return NULL;
for (i = 0; i < output->numModes; i++)
if (output->modes[i] == mode)
{
RRModeDestroy (mode);
return mode;
}
if (output->numModes)
modes = xrealloc (output->modes,
(output->numModes + 1) * sizeof (RRModePtr));
else
modes = xalloc (sizeof (RRModePtr));
if (!modes)
{
RRModeDestroy (mode);
FreeResource (mode->mode.id, 0);
return NULL;
}
modes[output->numModes++] = mode;
output->modes = modes;
output->changed = TRUE;
pScrPriv->changed = TRUE;
pScrPriv->configChanged = TRUE;
return mode;
}
static void
RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
{
rrScrPriv(pScreen);
RROutputPtr output;
RRCrtcPtr crtc;
RRModePtr mode, newMode = NULL;
int i;
CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
CARD16 maxWidth = 0, maxHeight = 0;
/*
* First time through, create a crtc and output and hook
* them together
*/
if (pScrPriv->numOutputs == 0 &&
pScrPriv->numCrtcs == 0)
{
crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return;
output = RROutputCreate (pScreen, "default", 7, NULL);
if (!output)
return;
RROutputSetCrtcs (output, &crtc, 1);
RROutputSetConnection (output, RR_Connected);
#ifdef RENDER
RROutputSetSubpixelOrder (output, PictureGetSubpixelOrder (pScreen));
#endif
}
output = pScrPriv->outputs[0];
if (!output)
return;
crtc = pScrPriv->crtcs[0];
if (!crtc)
return;
/* check rotations */
if (rotations != crtc->rotations)
{
crtc->rotations = rotations;
crtc->changed = TRUE;
pScrPriv->changed = TRUE;
}
/* regenerate mode list */
for (i = 0; i < pScrPriv->nSizes; i++)
{
RRScreenSizePtr size = &pScrPriv->pSizes[i];
int r;
if (size->nRates)
{
for (r = 0; r < size->nRates; r++)
{
mode = RROldModeAdd (output, size, size->pRates[r].rate);
if (i == pScrPriv->size &&
size->pRates[r].rate == pScrPriv->rate)
{
newMode = mode;
}
}
xfree (size->pRates);
}
else
{
mode = RROldModeAdd (output, size, 0);
if (i == pScrPriv->size)
newMode = mode;
}
}
if (pScrPriv->nSizes)
xfree (pScrPriv->pSizes);
pScrPriv->pSizes = NULL;
pScrPriv->nSizes = 0;
/* find size bounds */
for (i = 0; i < output->numModes + output->numUserModes; i++)
{
RRModePtr mode = (i < output->numModes ?
output->modes[i] :
output->userModes[i-output->numModes]);
CARD16 width = mode->mode.width;
CARD16 height = mode->mode.height;
if (width < minWidth) minWidth = width;
if (width > maxWidth) maxWidth = width;
if (height < minHeight) minHeight = height;
if (height > maxHeight) maxHeight = height;
}
RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight);
/* notice current mode */
if (newMode)
RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
1, &output);
}
#endif
/*
* Poll the driver for changed information
*/
Bool
RRGetInfo (ScreenPtr pScreen)
{
rrScrPriv (pScreen);
Rotation rotations;
int i;
for (i = 0; i < pScrPriv->numOutputs; i++)
pScrPriv->outputs[i]->changed = FALSE;
for (i = 0; i < pScrPriv->numCrtcs; i++)
pScrPriv->crtcs[i]->changed = FALSE;
rotations = 0;
pScrPriv->changed = FALSE;
pScrPriv->configChanged = FALSE;
if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations))
return FALSE;
#if RANDR_10_INTERFACE
if (pScrPriv->nSizes)
RRScanOldConfig (pScreen, rotations);
#endif
RRTellChanged (pScreen);
return TRUE;
}
/*
* Register the range of sizes for the screen
*/
void
RRScreenSetSizeRange (ScreenPtr pScreen,
CARD16 minWidth,
CARD16 minHeight,
CARD16 maxWidth,
CARD16 maxHeight)
{
rrScrPriv (pScreen);
if (!pScrPriv)
return;
if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight &&
pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight)
{
return;
}
pScrPriv->minWidth = minWidth;
pScrPriv->minHeight = minHeight;
pScrPriv->maxWidth = maxWidth;
pScrPriv->maxHeight = maxHeight;
pScrPriv->changed = TRUE;
pScrPriv->configChanged = TRUE;
}
#ifdef RANDR_10_INTERFACE
static Bool
RRScreenSizeMatches (RRScreenSizePtr a,
RRScreenSizePtr b)
{
if (a->width != b->width)
return FALSE;
if (a->height != b->height)
return FALSE;
if (a->mmWidth != b->mmWidth)
return FALSE;
if (a->mmHeight != b->mmHeight)
return FALSE;
return TRUE;
}
RRScreenSizePtr
RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
short mmHeight)
{
rrScrPriv (pScreen);
int i;
RRScreenSize tmp;
RRScreenSizePtr pNew;
if (!pScrPriv)
return 0;
tmp.id = 0;
tmp.width = width;
tmp.height= height;
tmp.mmWidth = mmWidth;
tmp.mmHeight = mmHeight;
tmp.pRates = 0;
tmp.nRates = 0;
for (i = 0; i < pScrPriv->nSizes; i++)
if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
return &pScrPriv->pSizes[i];
pNew = xrealloc (pScrPriv->pSizes,
(pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
if (!pNew)
return 0;
pNew[pScrPriv->nSizes++] = tmp;
pScrPriv->pSizes = pNew;
return &pNew[pScrPriv->nSizes-1];
}
Bool RRRegisterRate (ScreenPtr pScreen,
RRScreenSizePtr pSize,
int rate)
{
rrScrPriv(pScreen);
int i;
RRScreenRatePtr pNew, pRate;
if (!pScrPriv)
return FALSE;
for (i = 0; i < pSize->nRates; i++)
if (pSize->pRates[i].rate == rate)
return TRUE;
pNew = xrealloc (pSize->pRates,
(pSize->nRates + 1) * sizeof (RRScreenRate));
if (!pNew)
return FALSE;
pRate = &pNew[pSize->nRates++];
pRate->rate = rate;
pSize->pRates = pNew;
return TRUE;
}
Rotation
RRGetRotation(ScreenPtr pScreen)
{
RROutputPtr output = RRFirstOutput (pScreen);
if (!output)
return RR_Rotate_0;
return output->crtc->rotation;
}
void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize)
{
rrScrPriv (pScreen);
if (!pScrPriv)
return;
pScrPriv->size = pSize - pScrPriv->pSizes;
pScrPriv->rotation = rotation;
pScrPriv->rate = rate;
}
#endif
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
#include "registry.h"
RESTYPE RRModeType;
static Bool
RRModeEqual (xRRModeInfo *a, xRRModeInfo *b)
{
if (a->width != b->width) return FALSE;
if (a->height != b->height) return FALSE;
if (a->dotClock != b->dotClock) return FALSE;
if (a->hSyncStart != b->hSyncStart) return FALSE;
if (a->hSyncEnd != b->hSyncEnd) return FALSE;
if (a->hTotal != b->hTotal) return FALSE;
if (a->hSkew != b->hSkew) return FALSE;
if (a->vSyncStart != b->vSyncStart) return FALSE;
if (a->vSyncEnd != b->vSyncEnd) return FALSE;
if (a->vTotal != b->vTotal) return FALSE;
if (a->nameLength != b->nameLength) return FALSE;
if (a->modeFlags != b->modeFlags) return FALSE;
return TRUE;
}
/*
* Keep a list so it's easy to find modes in the resource database.
*/
static int num_modes;
static RRModePtr *modes;
static RRModePtr
RRModeCreate (xRRModeInfo *modeInfo,
const char *name,
ScreenPtr userScreen)
{
RRModePtr mode, *newModes;
if (!RRInit ())
return NULL;
mode = xalloc (sizeof (RRModeRec) + modeInfo->nameLength + 1);
if (!mode)
return NULL;
mode->refcnt = 1;
mode->mode = *modeInfo;
mode->name = (char *) (mode + 1);
memcpy (mode->name, name, modeInfo->nameLength);
mode->name[modeInfo->nameLength] = '\0';
mode->userScreen = userScreen;
if (num_modes)
newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr));
else
newModes = xalloc (sizeof (RRModePtr));
if (!newModes)
{
xfree (mode);
return NULL;
}
mode->mode.id = FakeClientID(0);
if (!AddResource (mode->mode.id, RRModeType, (pointer) mode))
return NULL;
modes = newModes;
modes[num_modes++] = mode;
/*
* give the caller a reference to this mode
*/
++mode->refcnt;
return mode;
}
static RRModePtr
RRModeFindByName (const char *name,
CARD16 nameLength)
{
int i;
RRModePtr mode;
for (i = 0; i < num_modes; i++)
{
mode = modes[i];
if (mode->mode.nameLength == nameLength &&
!memcmp (name, mode->name, nameLength))
{
return mode;
}
}
return NULL;
}
RRModePtr
RRModeGet (xRRModeInfo *modeInfo,
const char *name)
{
int i;
for (i = 0; i < num_modes; i++)
{
RRModePtr mode = modes[i];
if (RRModeEqual (&mode->mode, modeInfo) &&
!memcmp (name, mode->name, modeInfo->nameLength))
{
++mode->refcnt;
return mode;
}
}
return RRModeCreate (modeInfo, name, NULL);
}
static RRModePtr
RRModeCreateUser (ScreenPtr pScreen,
xRRModeInfo *modeInfo,
const char *name,
int *error)
{
RRModePtr mode;
mode = RRModeFindByName (name, modeInfo->nameLength);
if (mode)
{
*error = BadName;
return NULL;
}
mode = RRModeCreate (modeInfo, name, pScreen);
if (!mode)
{
*error = BadAlloc;
return NULL;
}
*error = Success;
return mode;
}
RRModePtr *
RRModesForScreen (ScreenPtr pScreen, int *num_ret)
{
rrScrPriv(pScreen);
int o, c, m;
RRModePtr *screen_modes;
int num_screen_modes = 0;
screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr));
if (!screen_modes)
return NULL;
/*
* Add modes from all outputs
*/
for (o = 0; o < pScrPriv->numOutputs; o++)
{
RROutputPtr output = pScrPriv->outputs[o];
int m, n;
for (m = 0; m < output->numModes + output->numUserModes; m++)
{
RRModePtr mode = (m < output->numModes ?
output->modes[m] :
output->userModes[m-output->numModes]);
for (n = 0; n < num_screen_modes; n++)
if (screen_modes[n] == mode)
break;
if (n == num_screen_modes)
screen_modes[num_screen_modes++] = mode;
}
}
/*
* Add modes from all crtcs. The goal is to
* make sure all available and active modes
* are visible to the client
*/
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
RRCrtcPtr crtc = pScrPriv->crtcs[c];
RRModePtr mode = crtc->mode;
int n;
if (!mode) continue;
for (n = 0; n < num_screen_modes; n++)
if (screen_modes[n] == mode)
break;
if (n == num_screen_modes)
screen_modes[num_screen_modes++] = mode;
}
/*
* Add all user modes for this screen
*/
for (m = 0; m < num_modes; m++)
{
RRModePtr mode = modes[m];
int n;
if (mode->userScreen != pScreen)
continue;
for (n = 0; n < num_screen_modes; n++)
if (screen_modes[n] == mode)
break;
if (n == num_screen_modes)
screen_modes[num_screen_modes++] = mode;
}
*num_ret = num_screen_modes;
return screen_modes;
}
void
RRModeDestroy (RRModePtr mode)
{
int m;
if (--mode->refcnt > 0)
return;
for (m = 0; m < num_modes; m++)
{
if (modes[m] == mode)
{
memmove (modes + m, modes + m + 1,
(num_modes - m - 1) * sizeof (RRModePtr));
num_modes--;
if (!num_modes)
{
xfree (modes);
modes = NULL;
}
break;
}
}
xfree (mode);
}
static int
RRModeDestroyResource (pointer value, XID pid)
{
RRModeDestroy ((RRModePtr) value);
return 1;
}
Bool
RRModeInit (void)
{
assert (num_modes == 0);
assert (modes == NULL);
RRModeType = CreateNewResourceType (RRModeDestroyResource);
if (!RRModeType)
return FALSE;
RegisterResourceName (RRModeType, "MODE");
return TRUE;
}
int
ProcRRCreateMode (ClientPtr client)
{
REQUEST(xRRCreateModeReq);
xRRCreateModeReply rep;
WindowPtr pWin;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
xRRModeInfo *modeInfo;
long units_after;
char *name;
int error, rc;
RRModePtr mode;
REQUEST_AT_LEAST_SIZE (xRRCreateModeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
modeInfo = &stuff->modeInfo;
name = (char *) (stuff + 1);
units_after = (stuff->length - (sizeof (xRRCreateModeReq) >> 2));
/* check to make sure requested name fits within the data provided */
if ((int) (modeInfo->nameLength + 3) >> 2 > units_after)
return BadLength;
mode = RRModeCreateUser (pScreen, modeInfo, name, &error);
if (!mode)
return error;
rep.type = X_Reply;
rep.pad0 = 0;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.mode = mode->mode.id;
if (client->swapped)
{
int n;
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.mode, n);
}
WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
return client->noClientException;
}
int
ProcRRDestroyMode (ClientPtr client)
{
REQUEST(xRRDestroyModeReq);
RRModePtr mode;
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
mode = LookupIDByType (stuff->mode, RRModeType);
if (!mode)
{
client->errorValue = stuff->mode;
return RRErrorBase + BadRRMode;
}
if (!mode->userScreen)
return BadMatch;
if (mode->refcnt > 1)
return BadAccess;
FreeResource (stuff->mode, 0);
return Success;
}
int
ProcRRAddOutputMode (ClientPtr client)
{
REQUEST(xRRAddOutputModeReq);
RRModePtr mode;
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
output = LookupOutput(client, stuff->output, DixReadAccess);
if (!output)
{
client->errorValue = stuff->output;
return RRErrorBase + BadRROutput;
}
mode = LookupIDByType (stuff->mode, RRModeType);
if (!mode)
{
client->errorValue = stuff->mode;
return RRErrorBase + BadRRMode;
}
return RROutputAddUserMode (output, mode);
}
int
ProcRRDeleteOutputMode (ClientPtr client)
{
REQUEST(xRRDeleteOutputModeReq);
RRModePtr mode;
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
output = LookupOutput(client, stuff->output, DixReadAccess);
if (!output)
{
client->errorValue = stuff->output;
return RRErrorBase + BadRROutput;
}
mode = LookupIDByType (stuff->mode, RRModeType);
if (!mode)
{
client->errorValue = stuff->mode;
return RRErrorBase + BadRRMode;
}
return RROutputDeleteUserMode (output, mode);
}
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
/*
* When the pointer moves, check to see if the specified position is outside
* any of theavailable CRTCs and move it to a 'sensible' place if so, where
* sensible is the closest monitor to the departing edge.
*
* Returns whether the position was adjusted
*/
static Bool
RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
{
RRModePtr mode = crtc->mode;
int scan_width, scan_height;
if (!mode)
return FALSE;
RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
if (crtc->x <= x && x < crtc->x + scan_width &&
crtc->y <= y && y < crtc->y + scan_height)
return TRUE;
return FALSE;
}
/*
* Find the CRTC nearest the specified position, ignoring 'skip'
*/
static void
RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
{
rrScrPriv (pScreen);
int c;
RRCrtcPtr nearest = NULL;
int best = 0;
int best_dx = 0, best_dy = 0;
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
RRCrtcPtr crtc = pScrPriv->crtcs[c];
RRModePtr mode = crtc->mode;
int dx, dy;
int dist;
int scan_width, scan_height;
if (!mode)
continue;
if (crtc == skip)
continue;
RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
if (x < crtc->x)
dx = crtc->x - x;
else if (x > crtc->x + scan_width)
dx = x - (crtc->x + scan_width);
else
dx = 0;
if (y < crtc->y)
dy = crtc->y - x;
else if (y > crtc->y + scan_height)
dy = y - (crtc->y + scan_height);
else
dy = 0;
dist = dx + dy;
if (!nearest || dist < best)
{
nearest = crtc;
best_dx = dx;
best_dy = dy;
}
}
if (best_dx || best_dy)
(*pScreen->SetCursorPosition) (pScreen, x + best_dx, y + best_dy, TRUE);
pScrPriv->pointerCrtc = nearest;
}
void
RRPointerMoved (ScreenPtr pScreen, int x, int y)
{
rrScrPriv (pScreen);
RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
int c;
/* Check last known CRTC */
if (pointerCrtc && RRCrtcContainsPosition (pointerCrtc, x, y))
return;
/* Check all CRTCs */
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
RRCrtcPtr crtc = pScrPriv->crtcs[c];
if (RRCrtcContainsPosition (crtc, x, y))
{
/* Remember containing CRTC */
pScrPriv->pointerCrtc = crtc;
return;
}
}
/* None contain pointer, find nearest */
RRPointerToNearestCrtc (pScreen, x, y, pointerCrtc);
}
/*
* When the screen is reconfigured, move the pointer to the nearest
* CRTC
*/
void
RRPointerScreenConfigured (ScreenPtr pScreen)
{
WindowPtr pRoot = GetCurrentRootWindow ();
ScreenPtr pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL;
int x, y;
if (pScreen != pCurrentScreen)
return;
GetSpritePosition (&x, &y);
RRPointerToNearestCrtc (pScreen, x, y, NULL);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment