summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac33
-rw-r--r--dix/dispatch.c2458
-rw-r--r--dix/globals.c40
-rw-r--r--dix/main.c313
-rw-r--r--glx/Makefile.am3
-rw-r--r--glx/extension_string.c2
-rw-r--r--glx/glapi.c504
-rw-r--r--glx/glprocs.h3534
-rw-r--r--glx/glthread.c204
-rw-r--r--glx/glxcmds.c1851
-rw-r--r--glx/glxdriswrast.c37
-rw-r--r--glx/glxext.c284
-rw-r--r--glx/glxscreens.c14
-rw-r--r--glx/rensize.c397
-rw-r--r--hw/dmx/dmxinit.c570
-rw-r--r--hw/vfb/InitOutput.c553
-rw-r--r--hw/xfree86/Makefile.am20
-rw-r--r--hw/xfree86/common/xf86Config.c1901
-rw-r--r--hw/xfree86/common/xf86Init.c1845
-rw-r--r--hw/xfree86/dixmods/Makefile.am24
-rw-r--r--hw/xfree86/dixmods/extmod/Makefile.am2
-rw-r--r--hw/xfree86/dri/Makefile.am3
-rw-r--r--hw/xfree86/dri2/Makefile.am3
-rw-r--r--hw/xfree86/exa/Makefile.am4
-rw-r--r--hw/xfree86/fbdevhw/Makefile.am2
-rw-r--r--hw/xfree86/i2c/Makefile.am17
-rw-r--r--hw/xfree86/loader/loadmod.c1064
-rw-r--r--hw/xfree86/man/xorg.conf.man2
-rw-r--r--hw/xfree86/modes/xf86Crtc.c2964
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h412
-rw-r--r--hw/xfree86/shadowfb/Makefile.am3
-rw-r--r--hw/xfree86/vbe/Makefile.am5
-rw-r--r--hw/xfree86/xaa/Makefile.am2
-rw-r--r--hw/xnest/Init.c93
-rw-r--r--hw/xquartz/Makefile.am1
-rw-r--r--hw/xwin/InitOutput.c981
-rw-r--r--hw/xwin/Makefile.am9
-rw-r--r--hw/xwin/README141
-rwxr-xr-xhw/xwin/glx/gen_gl_wrappers.py14
-rw-r--r--hw/xwin/glx/indirect.c1791
-rw-r--r--hw/xwin/glx/winpriv.c57
-rw-r--r--hw/xwin/man/XWin.man47
-rw-r--r--hw/xwin/man/XWinrc.man29
-rw-r--r--hw/xwin/system.XWinrc10
-rw-r--r--hw/xwin/taskbar.h72
-rw-r--r--hw/xwin/win.h838
-rw-r--r--hw/xwin/winblock.c73
-rw-r--r--hw/xwin/winclipboard.h26
-rw-r--r--hw/xwin/winclipboardinit.c120
-rw-r--r--hw/xwin/winclipboardtextconv.c138
-rw-r--r--hw/xwin/winclipboardthread.c559
-rw-r--r--hw/xwin/winclipboardunicode.c65
-rw-r--r--hw/xwin/winclipboardwndproc.c739
-rw-r--r--hw/xwin/winclipboardwrappers.c452
-rw-r--r--hw/xwin/winclipboardxevents.c1089
-rw-r--r--hw/xwin/winconfig.c1
-rw-r--r--hw/xwin/winconfig.h1
-rw-r--r--hw/xwin/wincreatewnd.c779
-rw-r--r--hw/xwin/windialogs.c822
-rw-r--r--hw/xwin/windisplay.c56
-rw-r--r--hw/xwin/winengine.c307
-rw-r--r--hw/xwin/winerror.c158
-rw-r--r--hw/xwin/winglobals.c92
-rw-r--r--hw/xwin/winglobals.h59
-rw-r--r--hw/xwin/winkeybd.c527
-rw-r--r--hw/xwin/winkeyhook.c126
-rw-r--r--hw/xwin/winmonitors.c27
-rw-r--r--hw/xwin/winmonitors.h41
-rw-r--r--hw/xwin/winmsgwindow.c184
-rw-r--r--hw/xwin/winmultiwindowicons.c943
-rw-r--r--hw/xwin/winmultiwindowicons.h42
-rw-r--r--hw/xwin/winmultiwindowwindow.c1273
-rw-r--r--hw/xwin/winmultiwindowwm.c2216
-rw-r--r--hw/xwin/winmultiwindowwndproc.c1479
-rw-r--r--hw/xwin/winprefs.c1030
-rw-r--r--hw/xwin/winprefs.h121
-rw-r--r--hw/xwin/winprefslex.l6
-rw-r--r--hw/xwin/winprefsyacc.y91
-rw-r--r--hw/xwin/winprocarg.c1465
-rw-r--r--hw/xwin/winscrinit.c865
-rw-r--r--hw/xwin/winshadddnl.c1508
-rw-r--r--hw/xwin/wintaskbar.c87
-rw-r--r--hw/xwin/winwakeup.c17
-rw-r--r--hw/xwin/winwin32rootless.c1134
-rw-r--r--hw/xwin/winwin32rootlesswindow.c443
-rw-r--r--hw/xwin/winwindow.h77
-rw-r--r--hw/xwin/winwindowswm.c670
-rw-r--r--hw/xwin/winwndproc.c1779
-rw-r--r--include/ddxhooks.h37
-rw-r--r--include/dix-config.h.in4
-rw-r--r--include/opaque.h5
-rw-r--r--include/os.h224
-rw-r--r--man/Xserver.man10
-rw-r--r--mi/miinitext.c170
-rw-r--r--os/Makefile.am2
-rw-r--r--os/backtrace.c47
-rw-r--r--os/connection.c872
-rw-r--r--os/log.c223
-rw-r--r--os/osinit.c238
-rw-r--r--os/utils.c1427
-rw-r--r--pseudoramiX/Makefile.am7
-rw-r--r--pseudoramiX/pseudoramiX.c (renamed from hw/xquartz/pseudoramiX.c)290
-rw-r--r--pseudoramiX/pseudoramiX.h (renamed from hw/xquartz/pseudoramiX.h)0
-rw-r--r--randr/rrxinerama.c5
-rw-r--r--xkb/ddxList.c324
-rw-r--r--xkb/ddxLoad.c317
-rw-r--r--xorg-server.pc.in2
108 files changed, 23356 insertions, 25690 deletions
diff --git a/Makefile.am b/Makefile.am
index 9a628537d..7be4271d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,7 @@ SUBDIRS = \
Xext \
miext \
os \
+ pseudoramiX \
randr \
render \
Xi \
@@ -77,6 +78,7 @@ DIST_SUBDIRS = \
Xext \
miext \
os \
+ pseudoramiX \
randr \
render \
Xi \
diff --git a/configure.ac b/configure.ac
index 7c7e69e78..2f13040fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -699,11 +699,21 @@ dnl DDX Detection... Yes, it's ugly to have it here... but we need to
dnl handle this early on so that we don't require unsupported extensions
case $host_os in
cygwin*)
+ CONFIG_DBUS_API=no
+ CONFIG_HAL=no
+ CONFIG_UDEV=no
DGA=no
DRI2=no
+ INT10MODULE=no
+ PCI=no
+ VGAHW=no
+ VBE=no
+ XAA=no
+ XF86UTILS=no
XF86VIDMODE=no
XSELINUX=no
XV=no
+ SYMBOL_VISIBILITY=no
;;
darwin*)
PCI=no
@@ -1040,7 +1050,7 @@ if test "x$GLX" = xyes; then
AC_SUBST(XLIB_CFLAGS)
AC_DEFINE(GLXEXT, 1, [Build GLX extension])
GLX_LIBS='$(top_builddir)/glx/libglx.la'
- GLX_SYS_LIBS="$GLX_SYS_LIBS"
+ GLX_SYS_LIBS="$GLX_SYS_LIBS -lglapi"
else
GLX=no
fi
@@ -1060,6 +1070,7 @@ if test "x$GLX_USE_TLS" = xyes ; then
GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
fi
AC_SUBST([GLX_DEFINES])
+AC_SUBST([GLX_SYS_LIBS])
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
@@ -1461,7 +1472,21 @@ AC_SUBST([UTILS_SYS_LIBS])
# Some platforms require extra flags to do this. libtool should set the
# necessary flags for each platform when -export-dynamic is passed to it.
LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
+LD_NO_UNDEFINED_FLAG=
+XORG_DRIVER_LIBS=
+case "$host_os" in
+ cygwin*)
+ LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-all,--out-implib,lib\$@.a"
+ LD_NO_UNDEFINED_FLAG="-no-undefined -Wl,\$(top_builddir)/hw/xfree86/libXorg.exe.a"
+ XORG_DRIVER_LIBS="-lXorg.exe -L\${moduledir} -lshadow -lfb -no-undefined"
+ CYGWIN=yes
+ ;;
+esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
+AC_SUBST([LD_NO_UNDEFINED_FLAG])
+AC_SUBST([XORG_DRIVER_LIBS])
+AM_CONDITIONAL([CYGWIN], [test x"$CYGWIN" = xyes])
+AM_CONDITIONAL([NO_UNDEFINED], [test x"$LD_NO_UNDEFINED_FLAG" != x])
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed
@@ -1835,8 +1860,9 @@ if test "x$XWIN" = xyes; then
XWIN_SYS_LIBS=-lwinsock2
;;
esac
+
XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
- XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
+ XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST(XWIN_LIBS)
AC_SUBST(XWIN_SERVER_NAME)
AC_SUBST(XWIN_SYS_LIBS)
@@ -1848,7 +1874,7 @@ if test "x$XWIN" = xyes; then
fi
AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
- AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
+ AC_DEFINE(DDXMAIN, 1, [Use ddxMain])
dnl XWin with AIGLX requires OpenGL spec files in order to generate wrapper code for native GL functions
if [test "x$XWIN" = xyes && test "x$AIGLX" = xyes] ; then
@@ -2152,6 +2178,7 @@ miext/shadow/Makefile
miext/cw/Makefile
miext/rootless/Makefile
os/Makefile
+pseudoramiX/Makefile
randr/Makefile
render/Makefile
xkb/Makefile
diff --git a/dix/dispatch.c b/dix/dispatch.c
index d97180548..c1464487a 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -128,6 +128,7 @@ int ProcInitialConnection();
#include "xkbsrv.h"
#include "site.h"
#include "client.h"
+#include "ddxhooks.h"
#ifdef XSERVER_DTRACE
#include "registry.h"
@@ -162,9 +163,9 @@ int connBlockScreenStart;
static void KillAllClients(void);
-static int nextFreeClientID; /* always MIN free client ID */
+static int nextFreeClientID; /* always MIN free client ID */
-static int nClients; /* number of authorized clients */
+static int nClients; /* number of authorized clients */
CallbackListPtr ClientStateCallback;
@@ -197,11 +198,11 @@ UpdateCurrentTime(void)
systime.months = currentTime.months;
systime.milliseconds = GetTimeInMillis();
if (systime.milliseconds < currentTime.milliseconds)
- systime.months++;
+ systime.months++;
if (*checkForInput[0] != *checkForInput[1])
- ProcessInputEvents();
+ ProcessInputEvents();
if (CompareTimeStamps(systime, currentTime) == LATER)
- currentTime = systime;
+ currentTime = systime;
}
/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
@@ -220,95 +221,99 @@ UpdateCurrentTimeIf(void)
#undef SMART_DEBUG
-#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
-#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
+#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+#ifdef __CYGWIN__
+Bool SmartScheduleDisable = TRUE;
+#else
Bool SmartScheduleDisable = FALSE;
+#endif
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
long SmartScheduleTime;
int SmartScheduleLatencyLimited = 0;
-static ClientPtr SmartLastClient;
-static int SmartLastIndex[SMART_MAX_PRIORITY - SMART_MIN_PRIORITY + 1];
+static ClientPtr SmartLastClient;
+static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
#ifdef SMART_DEBUG
-long SmartLastPrint;
+long SmartLastPrint;
#endif
-void Dispatch(void);
+void Dispatch(void);
static int
-SmartScheduleClient(int *clientReady, int nready)
+SmartScheduleClient (int *clientReady, int nready)
{
- ClientPtr pClient;
- int i;
- int client;
- int bestPrio, best = 0;
- int bestRobin, robin;
- long now = SmartScheduleTime;
- long idle;
+ ClientPtr pClient;
+ int i;
+ int client;
+ int bestPrio, best = 0;
+ int bestRobin, robin;
+ long now = SmartScheduleTime;
+ long idle;
bestPrio = -0x7fffffff;
bestRobin = 0;
idle = 2 * SmartScheduleSlice;
for (i = 0; i < nready; i++) {
- client = clientReady[i];
- pClient = clients[client];
- /* Praise clients which are idle */
+ client = clientReady[i];
+ pClient = clients[client];
+ /* Praise clients which are idle */
if ((now - pClient->smart_check_tick) >= idle) {
- if (pClient->smart_priority < 0)
- pClient->smart_priority++;
- }
- pClient->smart_check_tick = now;
-
- /* check priority to select best client */
+ if (pClient->smart_priority < 0)
+ pClient->smart_priority++;
+ }
+ pClient->smart_check_tick = now;
+
+ /* check priority to select best client */
robin =
(pClient->index -
SmartLastIndex[pClient->smart_priority -
SMART_MIN_PRIORITY]) & 0xff;
- if (pClient->smart_priority > bestPrio ||
+ if (pClient->smart_priority > bestPrio ||
(pClient->smart_priority == bestPrio && robin > bestRobin)) {
- bestPrio = pClient->smart_priority;
- bestRobin = robin;
- best = client;
- }
+ bestPrio = pClient->smart_priority;
+ bestRobin = robin;
+ best = client;
+ }
#ifdef SMART_DEBUG
- if ((now - SmartLastPrint) >= 5000)
- fprintf(stderr, " %2d: %3d", client, pClient->smart_priority);
+ if ((now - SmartLastPrint) >= 5000)
+ fprintf (stderr, " %2d: %3d", client, pClient->smart_priority);
#endif
}
#ifdef SMART_DEBUG
if ((now - SmartLastPrint) >= 5000) {
- fprintf(stderr, " use %2d\n", best);
- SmartLastPrint = now;
+ fprintf (stderr, " use %2d\n", best);
+ SmartLastPrint = now;
}
#endif
pClient = clients[best];
- SmartLastIndex[bestPrio - SMART_MIN_PRIORITY] = pClient->index;
+ SmartLastIndex[bestPrio-SMART_MIN_PRIORITY] = pClient->index;
/*
* Set current client pointer
*/
if (SmartLastClient != pClient) {
- pClient->smart_start_tick = now;
- SmartLastClient = pClient;
+ pClient->smart_start_tick = now;
+ SmartLastClient = pClient;
}
/*
* Adjust slice
*/
if (nready == 1 && SmartScheduleLatencyLimited == 0) {
- /*
- * If it's been a long time since another client
- * has run, bump the slice up to get maximal
- * performance from a single client
- */
- if ((now - pClient->smart_start_tick) > 1000 &&
+ /*
+ * If it's been a long time since another client
+ * has run, bump the slice up to get maximal
+ * performance from a single client
+ */
+ if ((now - pClient->smart_start_tick) > 1000 &&
SmartScheduleSlice < SmartScheduleMaxSlice) {
- SmartScheduleSlice += SmartScheduleInterval;
- }
+ SmartScheduleSlice += SmartScheduleInterval;
+ }
}
else {
- SmartScheduleSlice = SmartScheduleInterval;
+ SmartScheduleSlice = SmartScheduleInterval;
}
return best;
}
@@ -327,64 +332,64 @@ DisableLimitedSchedulingLatency(void)
/* protect against bugs */
if (SmartScheduleLatencyLimited < 0)
- SmartScheduleLatencyLimited = 0;
+ SmartScheduleLatencyLimited = 0;
}
void
Dispatch(void)
{
- int *clientReady; /* array of request ready clients */
- int result;
- ClientPtr client;
- int nready;
- HWEventQueuePtr *icheck = checkForInput;
- long start_tick;
+ int *clientReady; /* array of request ready clients */
+ int result;
+ ClientPtr client;
+ int nready;
+ HWEventQueuePtr* icheck = checkForInput;
+ long start_tick;
nextFreeClientID = 1;
nClients = 0;
clientReady = malloc(sizeof(int) * MaxClients);
if (!clientReady)
- return;
+ return;
SmartScheduleSlice = SmartScheduleInterval;
while (!dispatchException) {
if (*icheck[0] != *icheck[1]) {
- ProcessInputEvents();
- FlushIfCriticalOutputPending();
- }
+ ProcessInputEvents();
+ FlushIfCriticalOutputPending();
+ }
- nready = WaitForSomething(clientReady);
+ nready = WaitForSomething(clientReady);
if (nready && !SmartScheduleDisable) {
- clientReady[0] = SmartScheduleClient(clientReady, nready);
- nready = 1;
- }
+ clientReady[0] = SmartScheduleClient (clientReady, nready);
+ nready = 1;
+ }
/*****************
* Handle events in round robin fashion, doing input between
* each round
*****************/
while (!dispatchException && (--nready >= 0)) {
- client = clients[clientReady[nready]];
+ client = clients[clientReady[nready]];
if (!client) {
- /* KillClient can cause this to happen */
- continue;
- }
- /* GrabServer activation can cause this to be true */
+ /* KillClient can cause this to happen */
+ continue;
+ }
+ /* GrabServer activation can cause this to be true */
if (grabState == GrabKickout) {
- grabState = GrabActive;
- break;
- }
- isItTimeToYield = FALSE;
-
- start_tick = SmartScheduleTime;
+ grabState = GrabActive;
+ break;
+ }
+ isItTimeToYield = FALSE;
+
+ start_tick = SmartScheduleTime;
while (!isItTimeToYield) {
- if (*icheck[0] != *icheck[1])
- ProcessInputEvents();
-
- FlushIfCriticalOutputPending();
- if (!SmartScheduleDisable &&
+ if (*icheck[0] != *icheck[1])
+ ProcessInputEvents();
+
+ FlushIfCriticalOutputPending();
+ if (!SmartScheduleDisable &&
(SmartScheduleTime - start_tick) >= SmartScheduleSlice) {
/* Penalize clients which consume ticks */
if (client->smart_priority > SMART_MIN_PRIORITY)
@@ -398,20 +403,20 @@ Dispatch(void)
UpdateCurrentTimeIf();
result = ReadRequestFromClient(client);
if (result <= 0) {
- if (result < 0)
- CloseDownClient(client);
- break;
- }
-
- client->sequence++;
- client->majorOp = ((xReq *) client->requestBuffer)->reqType;
- client->minorOp = 0;
- if (client->majorOp >= EXTENSION_BASE) {
- ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
-
- if (ext)
- client->minorOp = ext->MinorOpcode(client);
- }
+ if (result < 0)
+ CloseDownClient(client);
+ break;
+ }
+
+ client->sequence++;
+ client->majorOp = ((xReq *)client->requestBuffer)->reqType;
+ client->minorOp = 0;
+ if (client->majorOp >= EXTENSION_BASE) {
+ ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
+
+ if (ext)
+ client->minorOp = ext->MinorOpcode(client);
+ }
#ifdef XSERVER_DTRACE
if (XSERVER_REQUEST_START_ENABLED())
XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
@@ -420,53 +425,54 @@ Dispatch(void)
client->index,
client->requestBuffer);
#endif
- if (result > (maxBigRequestSize << 2))
- result = BadLength;
- else {
- result = XaceHookDispatch(client, client->majorOp);
- if (result == Success)
+ if (result > (maxBigRequestSize << 2))
+ result = BadLength;
+ else {
+ result = XaceHookDispatch(client, client->majorOp);
+ if (result == Success)
result =
(*client->requestVector[client->majorOp]) (client);
- XaceHookAuditEnd(client, result);
- }
+ XaceHookAuditEnd(client, result);
+ }
#ifdef XSERVER_DTRACE
- if (XSERVER_REQUEST_DONE_ENABLED())
- XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
- client->majorOp, client->sequence,
- client->index, result);
+ if (XSERVER_REQUEST_DONE_ENABLED())
+ XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
+ client->majorOp, client->sequence,
+ client->index, result);
#endif
if (client->noClientException != Success) {
- CloseDownClient(client);
- break;
- }
+ CloseDownClient(client);
+ break;
+ }
else if (result != Success) {
- SendErrorToClient(client, client->majorOp,
- client->minorOp,
- client->errorValue, result);
- break;
- }
- }
- FlushAllOutput();
- client = clients[clientReady[nready]];
- if (client)
- client->smart_stop_tick = SmartScheduleTime;
- }
- dispatchException &= ~DE_PRIORITYCHANGE;
- }
-#if defined(DDXBEFORERESET)
- ddxBeforeReset();
-#endif
+ SendErrorToClient(client, client->majorOp,
+ client->minorOp,
+ client->errorValue, result);
+ break;
+ }
+ }
+ FlushAllOutput();
+ client = clients[clientReady[nready]];
+ if (client)
+ client->smart_stop_tick = SmartScheduleTime;
+ }
+ dispatchException &= ~DE_PRIORITYCHANGE;
+ }
+
+ if (ddxHooks.ddxBeforeReset)
+ ddxHooks.ddxBeforeReset();
+
KillAllClients();
free(clientReady);
dispatchException &= ~DE_RESET;
SmartScheduleLatencyLimited = 0;
}
-static int VendorRelease = VENDOR_RELEASE;
+static int VendorRelease = VENDOR_RELEASE;
static char *VendorString = VENDOR_NAME;
-static const int padlength[4] = { 0, 3, 2, 1 };
+static const int padlength[4] = {0, 3, 2, 1};
void
SetVendorRelease(int release)
@@ -485,7 +491,7 @@ CreateConnectionBlock(void)
{
xConnSetup setup;
xWindowRoot root;
- xDepth depth;
+ xDepth depth;
xVisualType visual;
xPixmapFormat format;
unsigned long vid;
@@ -514,99 +520,99 @@ CreateConnectionBlock(void)
QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode);
lenofblock = sizeof(xConnSetup) +
- pad_to_int32(setup.nbytesVendor) +
- (setup.numFormats * sizeof(xPixmapFormat)) +
- (setup.numRoots * sizeof(xWindowRoot));
+ pad_to_int32(setup.nbytesVendor) +
+ (setup.numFormats * sizeof(xPixmapFormat)) +
+ (setup.numRoots * sizeof(xWindowRoot));
ConnectionInfo = malloc(lenofblock);
if (!ConnectionInfo)
- return FALSE;
+ return FALSE;
- memmove(ConnectionInfo, (char *) &setup, sizeof(xConnSetup));
+ memmove(ConnectionInfo, (char *)&setup, sizeof(xConnSetup));
sizesofar = sizeof(xConnSetup);
pBuf = ConnectionInfo + sizeof(xConnSetup);
- memmove(pBuf, VendorString, (int) setup.nbytesVendor);
+ memmove(pBuf, VendorString, (int)setup.nbytesVendor);
sizesofar += setup.nbytesVendor;
pBuf += setup.nbytesVendor;
i = padlength[setup.nbytesVendor & 3];
sizesofar += i;
while (--i >= 0)
- *pBuf++ = 0;
+ *pBuf++ = 0;
memset(&format, 0, sizeof(xPixmapFormat));
for (i = 0; i < screenInfo.numPixmapFormats; i++) {
- format.depth = screenInfo.formats[i].depth;
- format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
- format.scanLinePad = screenInfo.formats[i].scanlinePad;
- memmove(pBuf, (char *) &format, sizeof(xPixmapFormat));
- pBuf += sizeof(xPixmapFormat);
- sizesofar += sizeof(xPixmapFormat);
+ format.depth = screenInfo.formats[i].depth;
+ format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
+ format.scanLinePad = screenInfo.formats[i].scanlinePad;
+ memmove(pBuf, (char *)&format, sizeof(xPixmapFormat));
+ pBuf += sizeof(xPixmapFormat);
+ sizesofar += sizeof(xPixmapFormat);
}
connBlockScreenStart = sizesofar;
memset(&depth, 0, sizeof(xDepth));
memset(&visual, 0, sizeof(xVisualType));
for (i = 0; i < screenInfo.numScreens; i++) {
- ScreenPtr pScreen;
- DepthPtr pDepth;
- VisualPtr pVisual;
-
- pScreen = screenInfo.screens[i];
- root.windowId = pScreen->root->drawable.id;
- root.defaultColormap = pScreen->defColormap;
- root.whitePixel = pScreen->whitePixel;
- root.blackPixel = pScreen->blackPixel;
- root.currentInputMask = 0; /* filled in when sent */
- root.pixWidth = pScreen->width;
- root.pixHeight = pScreen->height;
- root.mmWidth = pScreen->mmWidth;
- root.mmHeight = pScreen->mmHeight;
- root.minInstalledMaps = pScreen->minInstalledCmaps;
- root.maxInstalledMaps = pScreen->maxInstalledCmaps;
- root.rootVisualID = pScreen->rootVisual;
- root.backingStore = pScreen->backingStoreSupport;
- root.saveUnders = FALSE;
- root.rootDepth = pScreen->rootDepth;
- root.nDepths = pScreen->numDepths;
- memmove(pBuf, (char *) &root, sizeof(xWindowRoot));
- sizesofar += sizeof(xWindowRoot);
- pBuf += sizeof(xWindowRoot);
-
- pDepth = pScreen->allowedDepths;
+ ScreenPtr pScreen;
+ DepthPtr pDepth;
+ VisualPtr pVisual;
+
+ pScreen = screenInfo.screens[i];
+ root.windowId = pScreen->root->drawable.id;
+ root.defaultColormap = pScreen->defColormap;
+ root.whitePixel = pScreen->whitePixel;
+ root.blackPixel = pScreen->blackPixel;
+ root.currentInputMask = 0; /* filled in when sent */
+ root.pixWidth = pScreen->width;
+ root.pixHeight = pScreen->height;
+ root.mmWidth = pScreen->mmWidth;
+ root.mmHeight = pScreen->mmHeight;
+ root.minInstalledMaps = pScreen->minInstalledCmaps;
+ root.maxInstalledMaps = pScreen->maxInstalledCmaps;
+ root.rootVisualID = pScreen->rootVisual;
+ root.backingStore = pScreen->backingStoreSupport;
+ root.saveUnders = FALSE;
+ root.rootDepth = pScreen->rootDepth;
+ root.nDepths = pScreen->numDepths;
+ memmove(pBuf, (char *)&root, sizeof(xWindowRoot));
+ sizesofar += sizeof(xWindowRoot);
+ pBuf += sizeof(xWindowRoot);
+
+ pDepth = pScreen->allowedDepths;
for (j = 0; j < pScreen->numDepths; j++, pDepth++) {
- lenofblock += sizeof(xDepth) +
- (pDepth->numVids * sizeof(xVisualType));
- pBuf = (char *) realloc(ConnectionInfo, lenofblock);
+ lenofblock += sizeof(xDepth) +
+ (pDepth->numVids * sizeof(xVisualType));
+ pBuf = (char *)realloc(ConnectionInfo, lenofblock);
if (!pBuf) {
- free(ConnectionInfo);
- return FALSE;
- }
- ConnectionInfo = pBuf;
- pBuf += sizesofar;
- depth.depth = pDepth->depth;
- depth.nVisuals = pDepth->numVids;
- memmove(pBuf, (char *) &depth, sizeof(xDepth));
- pBuf += sizeof(xDepth);
- sizesofar += sizeof(xDepth);
+ free(ConnectionInfo);
+ return FALSE;
+ }
+ ConnectionInfo = pBuf;
+ pBuf += sizesofar;
+ depth.depth = pDepth->depth;
+ depth.nVisuals = pDepth->numVids;
+ memmove(pBuf, (char *)&depth, sizeof(xDepth));
+ pBuf += sizeof(xDepth);
+ sizesofar += sizeof(xDepth);
for (k = 0; k < pDepth->numVids; k++) {
- vid = pDepth->vids[k];
- for (pVisual = pScreen->visuals;
+ vid = pDepth->vids[k];
+ for (pVisual = pScreen->visuals;
pVisual->vid != vid; pVisual++);
- visual.visualID = vid;
- visual.class = pVisual->class;
- visual.bitsPerRGB = pVisual->bitsPerRGBValue;
- visual.colormapEntries = pVisual->ColormapEntries;
- visual.redMask = pVisual->redMask;
- visual.greenMask = pVisual->greenMask;
- visual.blueMask = pVisual->blueMask;
- memmove(pBuf, (char *) &visual, sizeof(xVisualType));
- pBuf += sizeof(xVisualType);
- sizesofar += sizeof(xVisualType);
- }
- }
+ visual.visualID = vid;
+ visual.class = pVisual->class;
+ visual.bitsPerRGB = pVisual->bitsPerRGBValue;
+ visual.colormapEntries = pVisual->ColormapEntries;
+ visual.redMask = pVisual->redMask;
+ visual.greenMask = pVisual->greenMask;
+ visual.blueMask = pVisual->blueMask;
+ memmove(pBuf, (char *)&visual, sizeof(xVisualType));
+ pBuf += sizeof(xVisualType);
+ sizesofar += sizeof(xVisualType);
+ }
+ }
}
connSetupPrefix.success = xTrue;
- connSetupPrefix.length = lenofblock / 4;
+ connSetupPrefix.length = lenofblock/4;
connSetupPrefix.majorVersion = X_PROTOCOL;
connSetupPrefix.minorVersion = X_PROTOCOL_REVISION;
return TRUE;
@@ -627,7 +633,7 @@ ProcCreateWindow(ClientPtr client)
int len, rc;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
-
+
LEGAL_NEW_RESOURCE(stuff->wid, client);
rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
if (rc != Success)
@@ -636,21 +642,21 @@ ProcCreateWindow(ClientPtr client)
if (Ones(stuff->mask) != len)
return BadLength;
if (!stuff->width || !stuff->height) {
- client->errorValue = 0;
+ client->errorValue = 0;
return BadValue;
}
pWin = CreateWindow(stuff->wid, pParent, stuff->x,
- stuff->y, stuff->width, stuff->height,
- stuff->borderWidth, stuff->class,
- stuff->mask, (XID *) &stuff[1],
+ stuff->y, stuff->width, stuff->height,
+ stuff->borderWidth, stuff->class,
+ stuff->mask, (XID *) &stuff[1],
(int) stuff->depth, client, stuff->visual, &rc);
if (pWin) {
- Mask mask = pWin->eventMask;
+ Mask mask = pWin->eventMask;
- pWin->eventMask = 0; /* subterfuge in case AddResource fails */
- if (!AddResource(stuff->wid, RT_WINDOW, (pointer) pWin))
- return BadAlloc;
- pWin->eventMask = mask;
+ pWin->eventMask = 0; /* subterfuge in case AddResource fails */
+ if (!AddResource(stuff->wid, RT_WINDOW, (pointer)pWin))
+ return BadAlloc;
+ pWin->eventMask = mask;
}
return rc;
}
@@ -689,7 +695,7 @@ ProcGetWindowAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
@@ -707,13 +713,13 @@ ProcDestroyWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
if (pWin->parent) {
- rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client,
- DixRemoveAccess);
- if (rc != Success)
- return rc;
- FreeResource(stuff->id, RT_NONE);
+ rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client,
+ DixRemoveAccess);
+ if (rc != Success)
+ return rc;
+ FreeResource(stuff->id, RT_NONE);
}
return Success;
}
@@ -729,7 +735,7 @@ ProcDestroySubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixRemoveAccess);
if (rc != Success)
- return rc;
+ return rc;
DestroySubwindows(pWin, client);
return Success;
}
@@ -741,7 +747,7 @@ ProcChangeSaveSet(ClientPtr client)
REQUEST(xChangeSaveSetReq);
int rc;
-
+
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (rc != Success)
@@ -770,15 +776,15 @@ ProcReparentWindow(ClientPtr client)
if (rc != Success)
return rc;
if (!SAME_SCREENS(pWin->drawable, pParent->drawable))
- return BadMatch;
+ return BadMatch;
if ((pWin->backgroundState == ParentRelative) &&
- (pParent->drawable.depth != pWin->drawable.depth))
- return BadMatch;
+ (pParent->drawable.depth != pWin->drawable.depth))
+ return BadMatch;
if ((pWin->drawable.class != InputOnly) &&
- (pParent->drawable.class == InputOnly))
- return BadMatch;
+ (pParent->drawable.class == InputOnly))
+ return BadMatch;
return ReparentWindow(pWin, pParent,
- (short) stuff->x, (short) stuff->y, client);
+ (short)stuff->x, (short)stuff->y, client);
}
int
@@ -794,7 +800,7 @@ ProcMapWindow(ClientPtr client)
if (rc != Success)
return rc;
MapWindow(pWin, client);
- /* update cache to say it is mapped */
+ /* update cache to say it is mapped */
return Success;
}
@@ -811,7 +817,7 @@ ProcMapSubwindows(ClientPtr client)
if (rc != Success)
return rc;
MapSubwindows(pWin, client);
- /* update cache to say it is mapped */
+ /* update cache to say it is mapped */
return Success;
}
@@ -828,7 +834,7 @@ ProcUnmapWindow(ClientPtr client)
if (rc != Success)
return rc;
UnmapWindow(pWin, FALSE);
- /* update cache to say it is mapped */
+ /* update cache to say it is mapped */
return Success;
}
@@ -858,13 +864,13 @@ ProcConfigureWindow(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
rc = dixLookupWindow(&pWin, stuff->window, client,
- DixManageAccess | DixSetAttrAccess);
+ DixManageAccess|DixSetAttrAccess);
if (rc != Success)
return rc;
len = client->req_len - bytes_to_int32(sizeof(xConfigureWindowReq));
- if (Ones((Mask) stuff->mask) != len)
+ if (Ones((Mask)stuff->mask) != len)
return BadLength;
- return ConfigureWindow(pWin, (Mask) stuff->mask, (XID *) &stuff[1], client);
+ return ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1], client);
}
int
@@ -877,18 +883,18 @@ ProcCirculateWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xCirculateWindowReq);
if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) {
- client->errorValue = stuff->direction;
+ client->errorValue = stuff->direction;
return BadValue;
}
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (rc != Success)
return rc;
- CirculateWindow(pWin, (int) stuff->direction, client);
+ CirculateWindow(pWin, (int)stuff->direction, client);
return Success;
}
static int
-GetGeometry(ClientPtr client, xGetGeometryReply * rep)
+GetGeometry(ClientPtr client, xGetGeometryReply *rep)
{
DrawablePtr pDraw;
int rc;
@@ -898,7 +904,7 @@ GetGeometry(ClientPtr client, xGetGeometryReply * rep)
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep->type = X_Reply;
rep->length = 0;
@@ -909,15 +915,15 @@ GetGeometry(ClientPtr client, xGetGeometryReply * rep)
rep->height = pDraw->height;
if (WindowDrawable(pDraw->type)) {
- WindowPtr pWin = (WindowPtr) pDraw;
+ WindowPtr pWin = (WindowPtr)pDraw;
- rep->x = pWin->origin.x - wBorderWidth(pWin);
- rep->y = pWin->origin.y - wBorderWidth(pWin);
- rep->borderWidth = pWin->borderWidth;
+ rep->x = pWin->origin.x - wBorderWidth (pWin);
+ rep->y = pWin->origin.y - wBorderWidth (pWin);
+ rep->borderWidth = pWin->borderWidth;
}
else { /* DRAWABLE_PIXMAP */
- rep->x = rep->y = rep->borderWidth = 0;
+ rep->x = rep->y = rep->borderWidth = 0;
}
return Success;
@@ -931,7 +937,7 @@ ProcGetGeometry(ClientPtr client)
memset(&rep, 0, sizeof(xGetGeometryReply));
if ((status = GetGeometry(client, &rep)) != Success)
- return status;
+ return status;
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
return Success;
@@ -943,7 +949,7 @@ ProcQueryTree(ClientPtr client)
xQueryTreeReply reply;
int rc, numChildren = 0;
WindowPtr pChild, pWin, pHead;
- Window *childIDs = (Window *) NULL;
+ Window *childIDs = (Window *)NULL;
REQUEST(xResourceReq);
@@ -956,32 +962,32 @@ ProcQueryTree(ClientPtr client)
reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence;
if (pWin->parent)
- reply.parent = pWin->parent->drawable.id;
+ reply.parent = pWin->parent->drawable.id;
else
- reply.parent = (Window) None;
+ reply.parent = (Window)None;
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- numChildren++;
+ numChildren++;
if (numChildren) {
- int curChild = 0;
+ int curChild = 0;
- childIDs = malloc(numChildren * sizeof(Window));
- if (!childIDs)
- return BadAlloc;
+ childIDs = malloc(numChildren * sizeof(Window));
+ if (!childIDs)
+ return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead;
pChild = pChild->prevSib)
- childIDs[curChild++] = pChild->drawable.id;
+ childIDs[curChild++] = pChild->drawable.id;
}
-
+
reply.nChildren = numChildren;
reply.length = bytes_to_int32(numChildren * sizeof(Window));
-
+
WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
if (numChildren) {
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window),
childIDs);
- free(childIDs);
+ free(childIDs);
}
return Success;
@@ -997,24 +1003,24 @@ ProcInternAtom(ClientPtr client)
REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes);
if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) {
- client->errorValue = stuff->onlyIfExists;
+ client->errorValue = stuff->onlyIfExists;
return BadValue;
}
tchar = (char *) &stuff[1];
atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
if (atom != BAD_RESOURCE) {
- xInternAtomReply reply;
-
- memset(&reply, 0, sizeof(xInternAtomReply));
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.atom = atom;
- WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
- return Success;
+ xInternAtomReply reply;
+
+ memset(&reply, 0, sizeof(xInternAtomReply));
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ reply.atom = atom;
+ WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
+ return Success;
}
else
- return BadAlloc;
+ return BadAlloc;
}
int
@@ -1028,19 +1034,19 @@ ProcGetAtomName(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if ((str = NameForAtom(stuff->id))) {
- len = strlen(str);
- memset(&reply, 0, sizeof(xGetAtomNameReply));
- reply.type = X_Reply;
- reply.length = bytes_to_int32(len);
- reply.sequenceNumber = client->sequence;
- reply.nameLength = len;
- WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
- (void) WriteToClient(client, len, str);
- return Success;
+ len = strlen(str);
+ memset(&reply, 0, sizeof(xGetAtomNameReply));
+ reply.type = X_Reply;
+ reply.length = bytes_to_int32(len);
+ reply.sequenceNumber = client->sequence;
+ reply.nameLength = len;
+ WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
+ (void)WriteToClient(client, len, str);
+ return Success;
}
else {
- client->errorValue = stuff->id;
- return BadAtom;
+ client->errorValue = stuff->id;
+ return BadAtom;
}
}
@@ -1051,24 +1057,24 @@ ProcGrabServer(ClientPtr client)
REQUEST_SIZE_MATCH(xReq);
if (grabState != GrabNone && client != grabClient) {
- ResetCurrentRequest(client);
- client->sequence--;
- BITSET(grabWaiters, client->index);
- IgnoreClient(client);
- return Success;
+ ResetCurrentRequest(client);
+ client->sequence--;
+ BITSET(grabWaiters, client->index);
+ IgnoreClient(client);
+ return Success;
}
rc = OnlyListenToOneClient(client);
if (rc != Success)
- return rc;
+ return rc;
grabState = GrabKickout;
grabClient = client;
if (ServerGrabCallback) {
- ServerGrabInfoRec grabinfo;
+ ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = SERVER_GRABBED;
- CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo);
+ grabinfo.client = client;
+ grabinfo.grabstate = SERVER_GRABBED;
+ CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
}
return Success;
@@ -1083,19 +1089,19 @@ UngrabServer(ClientPtr client)
ListenToAllClients();
for (i = mskcnt; --i >= 0 && !grabWaiters[i];);
if (i >= 0) {
- i <<= 5;
- while (!GETBIT(grabWaiters, i))
- i++;
- BITCLEAR(grabWaiters, i);
- AttendClient(clients[i]);
+ i <<= 5;
+ while (!GETBIT(grabWaiters, i))
+ i++;
+ BITCLEAR(grabWaiters, i);
+ AttendClient(clients[i]);
}
if (ServerGrabCallback) {
- ServerGrabInfoRec grabinfo;
+ ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = SERVER_UNGRABBED;
- CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo);
+ grabinfo.client = client;
+ grabinfo.grabstate = SERVER_UNGRABBED;
+ CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
}
}
@@ -1128,50 +1134,50 @@ ProcTranslateCoords(ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
- rep.sameScreen = xFalse;
+ rep.sameScreen = xFalse;
rep.child = None;
- rep.dstX = rep.dstY = 0;
+ rep.dstX = rep.dstY = 0;
}
else {
- INT16 x, y;
-
- rep.sameScreen = xTrue;
- rep.child = None;
- /* computing absolute coordinates -- adjust to destination later */
- x = pWin->drawable.x + stuff->srcX;
- y = pWin->drawable.y + stuff->srcY;
- pWin = pDst->firstChild;
+ INT16 x, y;
+
+ rep.sameScreen = xTrue;
+ rep.child = None;
+ /* computing absolute coordinates -- adjust to destination later */
+ x = pWin->drawable.x + stuff->srcX;
+ y = pWin->drawable.y + stuff->srcY;
+ pWin = pDst->firstChild;
while (pWin) {
- BoxRec box;
-
- if ((pWin->mapped) &&
- (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
- (x < pWin->drawable.x + (int) pWin->drawable.width +
- wBorderWidth(pWin)) &&
- (y >= pWin->drawable.y - wBorderWidth(pWin)) &&
- (y < pWin->drawable.y + (int) pWin->drawable.height +
- wBorderWidth(pWin))
- /* When a window is shaped, a further check
- * is made to see if the point is inside
- * borderSize
- */
- && (!wBoundingShape(pWin) ||
- RegionContainsPoint(&pWin->borderSize, x, y, &box))
-
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
+ BoxRec box;
+
+ if ((pWin->mapped) &&
+ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
+ (x < pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth (pWin)) &&
+ (y >= pWin->drawable.y - wBorderWidth (pWin)) &&
+ (y < pWin->drawable.y + (int)pWin->drawable.height +
+ wBorderWidth (pWin))
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ RegionContainsPoint(&pWin->borderSize, x, y, &box))
+
+ && (!wInputShape(pWin) ||
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
) {
- rep.child = pWin->drawable.id;
- pWin = (WindowPtr) NULL;
- }
- else
- pWin = pWin->nextSib;
- }
- /* adjust to destination coordinates */
- rep.dstX = x - pDst->drawable.x;
- rep.dstY = y - pDst->drawable.y;
+ rep.child = pWin->drawable.id;
+ pWin = (WindowPtr) NULL;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ /* adjust to destination coordinates */
+ rep.dstX = x - pDst->drawable.x;
+ rep.dstY = y - pDst->drawable.y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
return Success;
@@ -1180,7 +1186,7 @@ ProcTranslateCoords(ClientPtr client)
int
ProcOpenFont(ClientPtr client)
{
- int err;
+ int err;
REQUEST(xOpenFontReq);
@@ -1188,12 +1194,12 @@ ProcOpenFont(ClientPtr client)
client->errorValue = stuff->fid;
LEGAL_NEW_RESOURCE(stuff->fid, client);
err = OpenFont(client, stuff->fid, (Mask) 0,
- stuff->nbytes, (char *) &stuff[1]);
+ stuff->nbytes, (char *)&stuff[1]);
if (err == Success) {
- return Success;
+ return Success;
}
else
- return err;
+ return err;
}
int
@@ -1205,14 +1211,14 @@ ProcCloseFont(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *) &pFont, stuff->id, RT_FONT,
- client, DixDestroyAccess);
+ rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
+ client, DixDestroyAccess);
if (rc == Success) {
FreeResource(stuff->id, RT_NONE);
- return Success;
+ return Success;
}
else {
- client->errorValue = stuff->id;
+ client->errorValue = stuff->id;
return rc;
}
}
@@ -1220,7 +1226,7 @@ ProcCloseFont(ClientPtr client)
int
ProcQueryFont(ClientPtr client)
{
- xQueryFontReply *reply;
+ xQueryFontReply *reply;
FontPtr pFont;
int rc;
@@ -1229,37 +1235,37 @@ ProcQueryFont(ClientPtr client)
rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
{
- xCharInfo *pmax = FONTINKMAX(pFont);
- xCharInfo *pmin = FONTINKMIN(pFont);
- int nprotoxcistructs;
- int rlength;
+ xCharInfo *pmax = FONTINKMAX(pFont);
+ xCharInfo *pmin = FONTINKMIN(pFont);
+ int nprotoxcistructs;
+ int rlength;
nprotoxcistructs = (pmax->rightSideBearing == pmin->rightSideBearing &&
- pmax->leftSideBearing == pmin->leftSideBearing &&
- pmax->descent == pmin->descent &&
- pmax->ascent == pmin->ascent &&
- pmax->characterWidth == pmin->characterWidth) ?
- 0 : N2dChars(pFont);
-
- rlength = sizeof(xQueryFontReply) +
- FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
- nprotoxcistructs * sizeof(xCharInfo);
- reply = calloc(1, rlength);
+ pmax->leftSideBearing == pmin->leftSideBearing &&
+ pmax->descent == pmin->descent &&
+ pmax->ascent == pmin->ascent &&
+ pmax->characterWidth == pmin->characterWidth) ?
+ 0 : N2dChars(pFont);
+
+ rlength = sizeof(xQueryFontReply) +
+ FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
+ nprotoxcistructs * sizeof(xCharInfo);
+ reply = calloc(1, rlength);
if (!reply) {
- return BadAlloc;
- }
+ return BadAlloc;
+ }
- reply->type = X_Reply;
- reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
- reply->sequenceNumber = client->sequence;
- QueryFont(pFont, reply, nprotoxcistructs);
+ reply->type = X_Reply;
+ reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
+ reply->sequenceNumber = client->sequence;
+ QueryFont( pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply);
- free(reply);
- return Success;
+ free(reply);
+ return Success;
}
}
@@ -1274,20 +1280,20 @@ ProcQueryTextExtents(ClientPtr client)
REQUEST(xQueryTextExtentsReq);
REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
-
+
rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq));
length = length << 1;
if (stuff->oddLength) {
- if (length == 0)
- return BadLength;
+ if (length == 0)
+ return BadLength;
length--;
}
- if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
- return BadAlloc;
+ if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info))
+ return BadAlloc;
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
@@ -1310,8 +1316,8 @@ ProcListFonts(ClientPtr client)
REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes);
- return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
- stuff->maxNames);
+ return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
+ stuff->maxNames);
}
int
@@ -1322,7 +1328,7 @@ ProcListFontsWithInfo(ClientPtr client)
REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes);
return StartListFontsWithInfo(client, stuff->nbytes,
- (unsigned char *) &stuff[1], stuff->maxNames);
+ (unsigned char *) &stuff[1], stuff->maxNames);
}
/**
@@ -1332,9 +1338,9 @@ ProcListFontsWithInfo(ClientPtr client)
int
dixDestroyPixmap(pointer value, XID pid)
{
- PixmapPtr pPixmap = (PixmapPtr) value;
+ PixmapPtr pPixmap = (PixmapPtr)value;
- return (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
+ return (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
}
int
@@ -1350,55 +1356,55 @@ ProcCreatePixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
LEGAL_NEW_RESOURCE(stuff->pid, client);
-
+
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (!stuff->width || !stuff->height) {
- client->errorValue = 0;
+ client->errorValue = 0;
return BadValue;
}
if (stuff->width > 32767 || stuff->height > 32767) {
- /* It is allowed to try and allocate a pixmap which is larger than
- * 32767 in either dimension. However, all of the framebuffer code
- * is buggy and does not reliably draw to such big pixmaps, basically
- * because the Region data structure operates with signed shorts
- * for the rectangles in it.
- *
- * Furthermore, several places in the X server computes the
- * size in bytes of the pixmap and tries to store it in an
- * integer. This integer can overflow and cause the allocated size
- * to be much smaller.
- *
- * So, such big pixmaps are rejected here with a BadAlloc
- */
- return BadAlloc;
+ /* It is allowed to try and allocate a pixmap which is larger than
+ * 32767 in either dimension. However, all of the framebuffer code
+ * is buggy and does not reliably draw to such big pixmaps, basically
+ * because the Region data structure operates with signed shorts
+ * for the rectangles in it.
+ *
+ * Furthermore, several places in the X server computes the
+ * size in bytes of the pixmap and tries to store it in an
+ * integer. This integer can overflow and cause the allocated size
+ * to be much smaller.
+ *
+ * So, such big pixmaps are rejected here with a BadAlloc
+ */
+ return BadAlloc;
}
if (stuff->depth != 1) {
pDepth = pDraw->pScreen->allowedDepths;
- for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
- if (pDepth->depth == stuff->depth)
- goto CreatePmap;
- client->errorValue = stuff->depth;
+ for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
return BadValue;
}
- CreatePmap:
- pMap = (PixmapPtr) (*pDraw->pScreen->CreatePixmap)
+CreatePmap:
+ pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap)
(pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0);
if (pMap) {
- pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pMap->drawable.id = stuff->pid;
- /* security creation/labeling check */
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
- pMap, RT_NONE, NULL, DixCreateAccess);
- if (rc != Success) {
- (*pDraw->pScreen->DestroyPixmap) (pMap);
- return rc;
- }
- if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap))
- return Success;
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = stuff->pid;
+ /* security creation/labeling check */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
+ pMap, RT_NONE, NULL, DixCreateAccess);
+ if (rc != Success) {
+ (*pDraw->pScreen->DestroyPixmap)(pMap);
+ return rc;
+ }
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
+ return Success;
}
return BadAlloc;
}
@@ -1415,12 +1421,12 @@ ProcFreePixmap(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pMap, stuff->id, RT_PIXMAP,
client, DixDestroyAccess);
if (rc == Success) {
- FreeResource(stuff->id, RT_NONE);
- return Success;
+ FreeResource(stuff->id, RT_NONE);
+ return Success;
}
else {
- client->errorValue = stuff->id;
- return rc;
+ client->errorValue = stuff->id;
+ return rc;
}
}
@@ -1438,19 +1444,19 @@ ProcCreateGC(ClientPtr client)
client->errorValue = stuff->gc;
LEGAL_NEW_RESOURCE(stuff->gc, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
+ len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
if (len != Ones(stuff->mask))
return BadLength;
- pGC = (GC *) CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
- stuff->gc, client);
+ pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
+ stuff->gc, client);
if (error != Success)
return error;
- if (!AddResource(stuff->gc, RT_GC, (pointer) pGC))
- return BadAlloc;
+ if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
+ return BadAlloc;
return Success;
}
@@ -1466,9 +1472,9 @@ ProcChangeGC(ClientPtr client)
result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (result != Success)
- return result;
+ return result;
- len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
+ len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
if (len != Ones(stuff->mask))
return BadLength;
@@ -1487,15 +1493,15 @@ ProcCopyGC(ClientPtr client)
result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess);
if (result != Success)
- return result;
+ return result;
result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess);
if (result != Success)
- return result;
+ return result;
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
return BadMatch;
if (stuff->mask & ~GCAllBits) {
- client->errorValue = stuff->mask;
- return BadValue;
+ client->errorValue = stuff->mask;
+ return BadValue;
}
return CopyGC(pGC, dstGC, stuff->mask);
}
@@ -1510,25 +1516,25 @@ ProcSetDashes(ClientPtr client)
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
if (stuff->nDashes == 0) {
- client->errorValue = 0;
- return BadValue;
+ client->errorValue = 0;
+ return BadValue;
}
- result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
+ result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess);
if (result != Success)
- return result;
+ return result;
/* If there's an error, either there's no sensible errorValue,
* or there was a dash segment of 0. */
client->errorValue = 0;
return SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
- (unsigned char *) &stuff[1]);
+ (unsigned char *)&stuff[1]);
}
int
ProcSetClipRectangles(ClientPtr client)
{
- int nr, result;
+ int nr, result;
GC *pGC;
REQUEST(xSetClipRectanglesReq);
@@ -1536,19 +1542,19 @@ ProcSetClipRectangles(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
- client->errorValue = stuff->ordering;
+ client->errorValue = stuff->ordering;
return BadValue;
}
- result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
+ result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess);
if (result != Success)
- return result;
-
+ return result;
+
nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
if (nr & 4)
- return BadLength;
+ return BadLength;
nr >>= 3;
return SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
- nr, (xRectangle *) &stuff[1], (int) stuff->ordering);
+ nr, (xRectangle *)&stuff[1], (int)stuff->ordering);
}
int
@@ -1562,7 +1568,7 @@ ProcFreeGC(ClientPtr client)
rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
FreeResource(stuff->id, RT_NONE);
return Success;
@@ -1580,16 +1586,16 @@ ProcClearToBackground(ClientPtr client)
if (rc != Success)
return rc;
if (pWin->drawable.class == InputOnly) {
- client->errorValue = stuff->window;
- return BadMatch;
- }
+ client->errorValue = stuff->window;
+ return BadMatch;
+ }
if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) {
- client->errorValue = stuff->exposures;
+ client->errorValue = stuff->exposures;
return BadValue;
}
- (*pWin->drawable.pScreen->ClearToBackground) (pWin, stuff->x, stuff->y,
- stuff->width, stuff->height,
- (Bool) stuff->exposures);
+ (*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ (Bool)stuff->exposures);
return Success;
}
@@ -1606,28 +1612,28 @@ ProcCopyArea(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyAreaReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable) {
- rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
- client->errorValue = stuff->dstDrawable;
- return BadMatch;
- }
+ client->errorValue = stuff->dstDrawable;
+ return BadMatch;
+ }
}
else
pSrc = pDst;
- pRgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
- stuff->width, stuff->height,
- stuff->dstX, stuff->dstY);
+ pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY);
if (pGC->graphicsExposures) {
- (*pDst->pScreen->SendGraphicsExpose)
- (client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
- if (pRgn)
- RegionDestroy(pRgn);
+ (*pDst->pScreen->SendGraphicsExpose)
+ (client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
+ if (pRgn)
+ RegionDestroy(pRgn);
}
return Success;
@@ -1647,35 +1653,35 @@ ProcCopyPlane(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable) {
- rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
if (pdstDraw->pScreen != psrcDraw->pScreen) {
- client->errorValue = stuff->dstDrawable;
- return BadMatch;
- }
+ client->errorValue = stuff->dstDrawable;
+ return BadMatch;
+ }
}
else
psrcDraw = pdstDraw;
/* Check to see if stuff->bitPlane has exactly ONE good bit set */
- if (stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
+ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
(stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
- client->errorValue = stuff->bitPlane;
- return BadValue;
+ client->errorValue = stuff->bitPlane;
+ return BadValue;
}
pRgn =
(*pGC->ops->CopyPlane) (psrcDraw, pdstDraw, pGC, stuff->srcX,
stuff->srcY, stuff->width, stuff->height,
- stuff->dstX, stuff->dstY, stuff->bitPlane);
+ stuff->dstX, stuff->dstY, stuff->bitPlane);
if (pGC->graphicsExposures) {
- (*pdstDraw->pScreen->SendGraphicsExpose)
- (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
- if (pRgn)
- RegionDestroy(pRgn);
+ (*pdstDraw->pScreen->SendGraphicsExpose)
+ (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
+ if (pRgn)
+ RegionDestroy(pRgn);
}
return Success;
}
@@ -1690,16 +1696,16 @@ ProcPolyPoint(ClientPtr client)
REQUEST(xPolyPointReq);
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
- if ((stuff->coordMode != CoordModeOrigin) &&
+ if ((stuff->coordMode != CoordModeOrigin) &&
(stuff->coordMode != CoordModePrevious)) {
- client->errorValue = stuff->coordMode;
+ client->errorValue = stuff->coordMode;
return BadValue;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
if (npoint)
- (*pGC->ops->PolyPoint) (pDraw, pGC, stuff->coordMode, npoint,
- (xPoint *) &stuff[1]);
+ (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,
+ (xPoint *) &stuff[1]);
return Success;
}
@@ -1713,16 +1719,16 @@ ProcPolyLine(ClientPtr client)
REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
- if ((stuff->coordMode != CoordModeOrigin) &&
+ if ((stuff->coordMode != CoordModeOrigin) &&
(stuff->coordMode != CoordModePrevious)) {
- client->errorValue = stuff->coordMode;
+ client->errorValue = stuff->coordMode;
return BadValue;
}
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 1)
- (*pGC->ops->Polylines) (pDraw, pGC, stuff->coordMode, npoint,
- (DDXPointPtr) &stuff[1]);
+ (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint,
+ (DDXPointPtr) &stuff[1]);
return Success;
}
@@ -1739,15 +1745,15 @@ ProcPolySegment(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
if (nsegs & 4)
- return BadLength;
+ return BadLength;
nsegs >>= 3;
if (nsegs)
- (*pGC->ops->PolySegment) (pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
+ (*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
return Success;
}
int
-ProcPolyRectangle(ClientPtr client)
+ProcPolyRectangle (ClientPtr client)
{
int nrects;
GC *pGC;
@@ -1759,18 +1765,18 @@ ProcPolyRectangle(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
if (nrects & 4)
- return BadLength;
+ return BadLength;
nrects >>= 3;
if (nrects)
- (*pGC->ops->PolyRectangle) (pDraw, pGC,
- nrects, (xRectangle *) &stuff[1]);
+ (*pGC->ops->PolyRectangle)(pDraw, pGC,
+ nrects, (xRectangle *) &stuff[1]);
return Success;
}
int
ProcPolyArc(ClientPtr client)
{
- int narcs;
+ int narcs;
GC *pGC;
DrawablePtr pDraw;
@@ -1780,31 +1786,31 @@ ProcPolyArc(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
if (narcs % sizeof(xArc))
- return BadLength;
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs)
- (*pGC->ops->PolyArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);
return Success;
}
int
ProcFillPoly(ClientPtr client)
{
- int things;
+ int things;
GC *pGC;
DrawablePtr pDraw;
REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
- if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
+ if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
(stuff->shape != Convex)) {
- client->errorValue = stuff->shape;
+ client->errorValue = stuff->shape;
return BadValue;
}
- if ((stuff->coordMode != CoordModeOrigin) &&
+ if ((stuff->coordMode != CoordModeOrigin) &&
(stuff->coordMode != CoordModePrevious)) {
- client->errorValue = stuff->coordMode;
+ client->errorValue = stuff->coordMode;
return BadValue;
}
@@ -1812,15 +1818,15 @@ ProcFillPoly(ClientPtr client)
things = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (things)
(*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
- stuff->coordMode, things,
- (DDXPointPtr) &stuff[1]);
+ stuff->coordMode, things,
+ (DDXPointPtr) &stuff[1]);
return Success;
}
int
ProcPolyFillRectangle(ClientPtr client)
{
- int things;
+ int things;
GC *pGC;
DrawablePtr pDraw;
@@ -1830,19 +1836,19 @@ ProcPolyFillRectangle(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
- (xRectangle *) &stuff[1]);
+ (xRectangle *) &stuff[1]);
return Success;
}
int
ProcPolyFillArc(ClientPtr client)
{
- int narcs;
+ int narcs;
GC *pGC;
DrawablePtr pDraw;
@@ -1852,7 +1858,7 @@ ProcPolyFillArc(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
if (narcs % sizeof(xArc))
- return BadLength;
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
@@ -1862,40 +1868,40 @@ ProcPolyFillArc(ClientPtr client)
#ifdef MATCH_CLIENT_ENDIAN
int
-ServerOrder(void)
+ServerOrder (void)
{
- int whichbyte = 1;
+ int whichbyte = 1;
if (*((char *) &whichbyte))
- return LSBFirst;
+ return LSBFirst;
return MSBFirst;
}
#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
void
-ReformatImage(char *base, int nbytes, int bpp, int order)
+ReformatImage (char *base, int nbytes, int bpp, int order)
{
switch (bpp) {
- case 1: /* yuck */
- if (BITMAP_BIT_ORDER != order)
- BitOrderInvert((unsigned char *) base, nbytes);
+ case 1: /* yuck */
+ if (BITMAP_BIT_ORDER != order)
+ BitOrderInvert ((unsigned char *) base, nbytes);
#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
- ReformatImage(base, nbytes, BITMAP_SCANLINE_UNIT, order);
+ ReformatImage (base, nbytes, BITMAP_SCANLINE_UNIT, order);
#endif
- break;
+ break;
case 4:
- break; /* yuck */
+ break; /* yuck */
case 8:
- break;
+ break;
case 16:
- if (IMAGE_BYTE_ORDER != order)
- TwoByteSwap((unsigned char *) base, nbytes);
- break;
+ if (IMAGE_BYTE_ORDER != order)
+ TwoByteSwap ((unsigned char *) base, nbytes);
+ break;
case 32:
- if (IMAGE_BYTE_ORDER != order)
- FourByteSwap((unsigned char *) base, nbytes);
- break;
+ if (IMAGE_BYTE_ORDER != order)
+ FourByteSwap ((unsigned char *) base, nbytes);
+ break;
}
}
#else
@@ -1918,9 +1924,9 @@ ProcPutImage(ClientPtr client)
{
GC *pGC;
DrawablePtr pDraw;
- long length; /* length of scanline server padded */
- long lengthProto; /* length of scanline protocol padded */
- char *tmpImage;
+ long length; /* length of scanline server padded */
+ long lengthProto; /* length of scanline protocol padded */
+ char *tmpImage;
REQUEST(xPutImageReq);
@@ -1928,69 +1934,69 @@ ProcPutImage(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
if (stuff->format == XYBitmap) {
if ((stuff->depth != 1) ||
- (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
+ (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
return BadMatch;
- length = BitmapBytePad(stuff->width + stuff->leftPad);
+ length = BitmapBytePad(stuff->width + stuff->leftPad);
}
else if (stuff->format == XYPixmap) {
- if ((pDraw->depth != stuff->depth) ||
- (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
+ if ((pDraw->depth != stuff->depth) ||
+ (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
return BadMatch;
- length = BitmapBytePad(stuff->width + stuff->leftPad);
- length *= stuff->depth;
+ length = BitmapBytePad(stuff->width + stuff->leftPad);
+ length *= stuff->depth;
}
else if (stuff->format == ZPixmap) {
if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
return BadMatch;
- length = PixmapBytePad(stuff->width, stuff->depth);
+ length = PixmapBytePad(stuff->width, stuff->depth);
}
else {
- client->errorValue = stuff->format;
+ client->errorValue = stuff->format;
return BadValue;
}
- tmpImage = (char *) &stuff[1];
+ tmpImage = (char *)&stuff[1];
lengthProto = length;
-
+
if ((bytes_to_int32(lengthProto * stuff->height) +
- bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
- return BadLength;
-
- ReformatImage(tmpImage, lengthProto * stuff->height,
- stuff->format == ZPixmap ? BitsPerPixel(stuff->depth) : 1,
- ClientOrder(client));
+ bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
+ return BadLength;
+ ReformatImage (tmpImage, lengthProto * stuff->height,
+ stuff->format == ZPixmap ? BitsPerPixel (stuff->depth) : 1,
+ ClientOrder(client));
+
(*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
- stuff->width, stuff->height,
- stuff->leftPad, stuff->format, tmpImage);
+ stuff->width, stuff->height,
+ stuff->leftPad, stuff->format, tmpImage);
- return Success;
+ return Success;
}
static int
-DoGetImage(ClientPtr client, int format, Drawable drawable,
- int x, int y, int width, int height,
- Mask planemask, xGetImageReply ** im_return)
+DoGetImage(ClientPtr client, int format, Drawable drawable,
+ int x, int y, int width, int height,
+ Mask planemask, xGetImageReply **im_return)
{
- DrawablePtr pDraw, pBoundingDraw;
- int nlines, linesPerBuf, rc;
- int linesDone;
+ DrawablePtr pDraw, pBoundingDraw;
+ int nlines, linesPerBuf, rc;
+ int linesDone;
/* coordinates relative to the bounding drawable */
- int relx, rely;
- long widthBytesLine, length;
- Mask plane = 0;
- char *pBuf;
- xGetImageReply xgi;
+ int relx, rely;
+ long widthBytesLine, length;
+ Mask plane = 0;
+ char *pBuf;
+ xGetImageReply xgi;
RegionPtr pVisibleRegion = NULL;
if ((format != XYPixmap) && (format != ZPixmap)) {
- client->errorValue = format;
+ client->errorValue = format;
return BadValue;
}
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&xgi, 0, sizeof(xGetImageReply));
@@ -1998,42 +2004,42 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
rely = y;
if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr) pDraw;
+ WindowPtr pWin = (WindowPtr)pDraw;
- /* "If the drawable is a window, the window must be viewable ... or a
- * BadMatch error results" */
- if (!pWin->viewable)
- return BadMatch;
+ /* "If the drawable is a window, the window must be viewable ... or a
+ * BadMatch error results" */
+ if (!pWin->viewable)
+ return BadMatch;
- /* If the drawable is a window, the rectangle must be contained within
- * its bounds (including the border). */
- if (x < -wBorderWidth(pWin) ||
- x + width > wBorderWidth(pWin) + (int) pDraw->width ||
- y < -wBorderWidth(pWin) ||
- y + height > wBorderWidth(pWin) + (int) pDraw->height)
- return BadMatch;
+ /* If the drawable is a window, the rectangle must be contained within
+ * its bounds (including the border). */
+ if (x < -wBorderWidth(pWin) ||
+ x + width > wBorderWidth(pWin) + (int)pDraw->width ||
+ y < -wBorderWidth(pWin) ||
+ y + height > wBorderWidth(pWin) + (int)pDraw->height)
+ return BadMatch;
- relx += pDraw->x;
- rely += pDraw->y;
+ relx += pDraw->x;
+ rely += pDraw->y;
- if (pDraw->pScreen->GetWindowPixmap) {
- PixmapPtr pPix = (*pDraw->pScreen->GetWindowPixmap) (pWin);
+ if (pDraw->pScreen->GetWindowPixmap) {
+ PixmapPtr pPix = (*pDraw->pScreen->GetWindowPixmap) (pWin);
- pBoundingDraw = &pPix->drawable;
+ pBoundingDraw = &pPix->drawable;
#ifdef COMPOSITE
- relx -= pPix->screen_x;
- rely -= pPix->screen_y;
+ relx -= pPix->screen_x;
+ rely -= pPix->screen_y;
#endif
- }
+ }
else {
- pBoundingDraw = (DrawablePtr) pDraw->pScreen->root;
- }
+ pBoundingDraw = (DrawablePtr)pDraw->pScreen->root;
+ }
- xgi.visual = wVisual(pWin);
+ xgi.visual = wVisual (pWin);
}
else {
- pBoundingDraw = pDraw;
- xgi.visual = None;
+ pBoundingDraw = pDraw;
+ xgi.visual = None;
}
/* "If the drawable is a pixmap, the given rectangle must be wholly
@@ -2047,151 +2053,151 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
* within the bounds of the window's backing pixmap. In particular, this
* means that a GetImage request may succeed or fail with BadMatch depending
* on whether any of its ancestor windows are redirected. */
- if (relx < 0 || relx + width > (int) pBoundingDraw->width ||
- rely < 0 || rely + height > (int) pBoundingDraw->height)
- return BadMatch;
+ if(relx < 0 || relx + width > (int)pBoundingDraw->width ||
+ rely < 0 || rely + height > (int)pBoundingDraw->height)
+ return BadMatch;
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
if (format == ZPixmap) {
- widthBytesLine = PixmapBytePad(width, pDraw->depth);
- length = widthBytesLine * height;
+ widthBytesLine = PixmapBytePad(width, pDraw->depth);
+ length = widthBytesLine * height;
}
else {
- widthBytesLine = BitmapBytePad(width);
- plane = ((Mask) 1) << (pDraw->depth - 1);
- /* only planes asked for */
- length = widthBytesLine * height *
- Ones(planemask & (plane | (plane - 1)));
+ widthBytesLine = BitmapBytePad(width);
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = widthBytesLine * height *
+ Ones(planemask & (plane | (plane - 1)));
}
xgi.length = length;
if (im_return) {
- pBuf = calloc(1, sz_xGetImageReply + length);
- if (!pBuf)
- return BadAlloc;
- if (widthBytesLine == 0)
- linesPerBuf = 0;
- else
- linesPerBuf = height;
- *im_return = (xGetImageReply *) pBuf;
- *(xGetImageReply *) pBuf = xgi;
- pBuf += sz_xGetImageReply;
+ pBuf = calloc(1, sz_xGetImageReply + length);
+ if (!pBuf)
+ return BadAlloc;
+ if (widthBytesLine == 0)
+ linesPerBuf = 0;
+ else
+ linesPerBuf = height;
+ *im_return = (xGetImageReply *)pBuf;
+ *(xGetImageReply *)pBuf = xgi;
+ pBuf += sz_xGetImageReply;
}
else {
- xgi.length = bytes_to_int32(xgi.length);
- if (widthBytesLine == 0 || height == 0)
- linesPerBuf = 0;
- else if (widthBytesLine >= IMAGE_BUFSIZE)
- linesPerBuf = 1;
+ xgi.length = bytes_to_int32(xgi.length);
+ if (widthBytesLine == 0 || height == 0)
+ linesPerBuf = 0;
+ else if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
else {
- linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > height)
- linesPerBuf = height;
- }
- length = linesPerBuf * widthBytesLine;
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
+ linesPerBuf = height;
+ }
+ length = linesPerBuf * widthBytesLine;
if (linesPerBuf < height) {
- /* we have to make sure intermediate buffers don't need padding */
- while ((linesPerBuf > 1) &&
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) &&
(length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
- linesPerBuf--;
- length -= widthBytesLine;
- }
+ linesPerBuf--;
+ length -= widthBytesLine;
+ }
while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
- linesPerBuf++;
- length += widthBytesLine;
- }
- }
- if (!(pBuf = calloc(1, length)))
- return BadAlloc;
- WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
+ linesPerBuf++;
+ length += widthBytesLine;
+ }
+ }
+ if(!(pBuf = calloc(1, length)))
+ return BadAlloc;
+ WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
}
if (pDraw->type == DRAWABLE_WINDOW) {
- pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
+ pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw);
if (pVisibleRegion) {
- RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
- }
+ RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
+ }
}
if (linesPerBuf == 0) {
- /* nothing to do */
+ /* nothing to do */
}
else if (format == ZPixmap) {
linesDone = 0;
while (height - linesDone > 0) {
- nlines = min(linesPerBuf, height - linesDone);
- (*pDraw->pScreen->GetImage) (pDraw,
- x,
- y + linesDone,
- width,
- nlines,
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ x,
+ y + linesDone,
+ width,
+ nlines,
format, planemask, (pointer) pBuf);
- if (pVisibleRegion)
- XaceCensorImage(client, pVisibleRegion, widthBytesLine,
- pDraw, x, y + linesDone, width,
- nlines, format, pBuf);
+ if (pVisibleRegion)
+ XaceCensorImage(client, pVisibleRegion, widthBytesLine,
+ pDraw, x, y + linesDone, width,
+ nlines, format, pBuf);
- /* Note that this is NOT a call to WriteSwappedDataToClient,
+ /* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (!im_return) {
- ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+ ReformatImage (pBuf, (int)(nlines * widthBytesLine),
BitsPerPixel(pDraw->depth), ClientOrder(client));
/* Don't split me, gcc pukes when you do */
- (void) WriteToClient(client,
+ (void)WriteToClient(client,
(int) (nlines * widthBytesLine), pBuf);
- }
- linesDone += nlines;
+ }
+ linesDone += nlines;
}
}
else { /* XYPixmap */
for (; plane; plane >>= 1) {
if (planemask & plane) {
- linesDone = 0;
+ linesDone = 0;
while (height - linesDone > 0) {
- nlines = min(linesPerBuf, height - linesDone);
- (*pDraw->pScreen->GetImage) (pDraw,
- x,
- y + linesDone,
- width,
- nlines,
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ x,
+ y + linesDone,
+ width,
+ nlines,
format, plane, (pointer) pBuf);
- if (pVisibleRegion)
- XaceCensorImage(client, pVisibleRegion,
- widthBytesLine,
- pDraw, x, y + linesDone, width,
- nlines, format, pBuf);
-
- /* Note: NOT a call to WriteSwappedDataToClient,
- as we do NOT byte swap */
- if (im_return) {
- pBuf += nlines * widthBytesLine;
+ if (pVisibleRegion)
+ XaceCensorImage(client, pVisibleRegion,
+ widthBytesLine,
+ pDraw, x, y + linesDone, width,
+ nlines, format, pBuf);
+
+ /* Note: NOT a call to WriteSwappedDataToClient,
+ as we do NOT byte swap */
+ if (im_return) {
+ pBuf += nlines * widthBytesLine;
}
else {
- ReformatImage(pBuf,
- (int) (nlines * widthBytesLine),
+ ReformatImage (pBuf,
+ (int)(nlines * widthBytesLine),
1, ClientOrder(client));
/* Don't split me, gcc pukes when you do */
- (void) WriteToClient(client,
- (int) (nlines * widthBytesLine),
- pBuf);
- }
- linesDone += nlines;
- }
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
+ }
+ linesDone += nlines;
+ }
}
- }
+ }
}
if (pVisibleRegion)
- RegionDestroy(pVisibleRegion);
+ RegionDestroy(pVisibleRegion);
if (!im_return)
- free(pBuf);
+ free(pBuf);
return Success;
}
@@ -2203,15 +2209,15 @@ ProcGetImage(ClientPtr client)
REQUEST_SIZE_MATCH(xGetImageReq);
return DoGetImage(client, stuff->format, stuff->drawable,
- stuff->x, stuff->y,
- (int) stuff->width, (int) stuff->height,
- stuff->planeMask, (xGetImageReply **) NULL);
+ stuff->x, stuff->y,
+ (int)stuff->width, (int)stuff->height,
+ stuff->planeMask, (xGetImageReply **)NULL);
}
int
ProcPolyText(ClientPtr client)
{
- int err;
+ int err;
REQUEST(xPolyTextReq);
DrawablePtr pDraw;
@@ -2221,23 +2227,23 @@ ProcPolyText(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = PolyText(client,
- pDraw,
- pGC,
- (unsigned char *) &stuff[1],
- ((unsigned char *) stuff) + (client->req_len << 2),
+ pDraw,
+ pGC,
+ (unsigned char *)&stuff[1],
+ ((unsigned char *) stuff) + (client->req_len << 2),
stuff->x, stuff->y, stuff->reqType, stuff->drawable);
if (err == Success) {
- return Success;
+ return Success;
}
else
- return err;
+ return err;
}
int
ProcImageText8(ClientPtr client)
{
- int err;
+ int err;
DrawablePtr pDraw;
GC *pGC;
@@ -2247,23 +2253,23 @@ ProcImageText8(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = ImageText(client,
- pDraw,
- pGC,
- stuff->nChars,
- (unsigned char *) &stuff[1],
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *)&stuff[1],
stuff->x, stuff->y, stuff->reqType, stuff->drawable);
if (err == Success) {
- return Success;
+ return Success;
}
else
- return err;
+ return err;
}
int
ProcImageText16(ClientPtr client)
{
- int err;
+ int err;
DrawablePtr pDraw;
GC *pGC;
@@ -2273,26 +2279,26 @@ ProcImageText16(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = ImageText(client,
- pDraw,
- pGC,
- stuff->nChars,
- (unsigned char *) &stuff[1],
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *)&stuff[1],
stuff->x, stuff->y, stuff->reqType, stuff->drawable);
if (err == Success) {
- return Success;
+ return Success;
}
else
- return err;
+ return err;
}
int
ProcCreateColormap(ClientPtr client)
{
- VisualPtr pVisual;
- ColormapPtr pmap;
- Colormap mid;
- WindowPtr pWin;
+ VisualPtr pVisual;
+ ColormapPtr pmap;
+ Colormap mid;
+ WindowPtr pWin;
ScreenPtr pScreen;
REQUEST(xCreateColormapReq);
@@ -2301,7 +2307,7 @@ ProcCreateColormap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreateColormapReq);
if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll)) {
- client->errorValue = stuff->alloc;
+ client->errorValue = stuff->alloc;
return BadValue;
}
mid = stuff->mid;
@@ -2313,10 +2319,10 @@ ProcCreateColormap(ClientPtr client)
pScreen = pWin->drawable.pScreen;
for (i = 0, pVisual = pScreen->visuals;
i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid != stuff->visual)
- continue;
- return CreateColormap(mid, pScreen, pVisual, &pmap,
- (int) stuff->alloc, client->index);
+ if (pVisual->vid != stuff->visual)
+ continue;
+ return CreateColormap(mid, pScreen, pVisual, &pmap,
+ (int)stuff->alloc, client->index);
}
client->errorValue = stuff->visual;
return BadMatch;
@@ -2334,22 +2340,22 @@ ProcFreeColormap(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pmap, stuff->id, RT_COLORMAP,
client, DixDestroyAccess);
if (rc == Success) {
- /* Freeing a default colormap is a no-op */
- if (!(pmap->flags & IsDefault))
- FreeResource(stuff->id, RT_NONE);
- return Success;
+ /* Freeing a default colormap is a no-op */
+ if (!(pmap->flags & IsDefault))
+ FreeResource(stuff->id, RT_NONE);
+ return Success;
}
else {
- client->errorValue = stuff->id;
- return rc;
+ client->errorValue = stuff->id;
+ return rc;
}
}
int
ProcCopyColormapAndFree(ClientPtr client)
{
- Colormap mid;
- ColormapPtr pSrcMap;
+ Colormap mid;
+ ColormapPtr pSrcMap;
REQUEST(xCopyColormapAndFreeReq);
int rc;
@@ -2361,7 +2367,7 @@ ProcCopyColormapAndFree(ClientPtr client)
RT_COLORMAP, client,
DixReadAccess | DixRemoveAccess);
if (rc == Success)
- return CopyColormapAndFree(mid, pSrcMap, client->index);
+ return CopyColormapAndFree(mid, pSrcMap, client->index);
client->errorValue = stuff->srcCmap;
return rc;
}
@@ -2378,19 +2384,19 @@ ProcInstallColormap(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
client, DixInstallAccess);
if (rc != Success)
- goto out;
+ goto out;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
if (rc != Success) {
- if (rc == BadValue)
- rc = BadColor;
- goto out;
+ if (rc == BadValue)
+ rc = BadColor;
+ goto out;
}
(*(pcmp->pScreen->InstallColormap)) (pcmp);
return Success;
- out:
+out:
client->errorValue = stuff->id;
return rc;
}
@@ -2407,20 +2413,20 @@ ProcUninstallColormap(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
client, DixUninstallAccess);
if (rc != Success)
- goto out;
+ goto out;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
if (rc != Success) {
- if (rc == BadValue)
- rc = BadColor;
- goto out;
+ if (rc == BadValue)
+ rc = BadColor;
+ goto out;
}
- if (pcmp->mid != pcmp->pScreen->defColormap)
- (*(pcmp->pScreen->UninstallColormap)) (pcmp);
+ if(pcmp->mid != pcmp->pScreen->defColormap)
+ (*(pcmp->pScreen->UninstallColormap)) (pcmp);
return Success;
- out:
+out:
client->errorValue = stuff->id;
return rc;
}
@@ -2428,7 +2434,7 @@ ProcUninstallColormap(ClientPtr client)
int
ProcListInstalledColormaps(ClientPtr client)
{
- xListInstalledColormapsReply *preply;
+ xListInstalledColormapsReply *preply;
int nummaps, rc;
WindowPtr pWin;
@@ -2437,26 +2443,26 @@ ProcListInstalledColormaps(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
preply = malloc(sizeof(xListInstalledColormapsReply) +
- pWin->drawable.pScreen->maxInstalledCmaps *
- sizeof(Colormap));
- if (!preply)
+ pWin->drawable.pScreen->maxInstalledCmaps *
+ sizeof(Colormap));
+ if(!preply)
return BadAlloc;
preply->type = X_Reply;
preply->sequenceNumber = client->sequence;
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
- (pWin->drawable.pScreen, (Colormap *) & preply[1]);
+ (pWin->drawable.pScreen, (Colormap *)&preply[1]);
preply->nColormaps = nummaps;
preply->length = nummaps;
- WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
+ WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
free(preply);
@@ -2464,7 +2470,7 @@ ProcListInstalledColormaps(ClientPtr client)
}
int
-ProcAllocColor(ClientPtr client)
+ProcAllocColor (ClientPtr client)
{
ColormapPtr pmap;
int rc;
@@ -2476,21 +2482,21 @@ ProcAllocColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- acr.type = X_Reply;
- acr.length = 0;
- acr.sequenceNumber = client->sequence;
- acr.red = stuff->red;
- acr.green = stuff->green;
- acr.blue = stuff->blue;
- acr.pixel = 0;
- if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
- &acr.pixel, client->index)))
- return rc;
+ acr.type = X_Reply;
+ acr.length = 0;
+ acr.sequenceNumber = client->sequence;
+ acr.red = stuff->red;
+ acr.green = stuff->green;
+ acr.blue = stuff->blue;
+ acr.pixel = 0;
+ if( (rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
+ &acr.pixel, client->index)) )
+ return rc;
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pmap->pScreen->myNum)
+ if (noPanoramiXExtension || !pmap->pScreen->myNum)
#endif
- WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
- return Success;
+ WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
+ return Success;
}
else {
@@ -2500,7 +2506,7 @@ ProcAllocColor(ClientPtr client)
}
int
-ProcAllocNamedColor(ClientPtr client)
+ProcAllocNamedColor (ClientPtr client)
{
ColormapPtr pcmp;
int rc;
@@ -2511,33 +2517,33 @@ ProcAllocNamedColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- xAllocNamedColorReply ancr;
+ xAllocNamedColorReply ancr;
- ancr.type = X_Reply;
- ancr.length = 0;
- ancr.sequenceNumber = client->sequence;
+ ancr.type = X_Reply;
+ ancr.length = 0;
+ ancr.sequenceNumber = client->sequence;
if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
- ancr.screenRed = ancr.exactRed;
- ancr.screenGreen = ancr.exactGreen;
- ancr.screenBlue = ancr.exactBlue;
- ancr.pixel = 0;
- if ((rc = AllocColor(pcmp,
+ ancr.screenRed = ancr.exactRed;
+ ancr.screenGreen = ancr.exactGreen;
+ ancr.screenBlue = ancr.exactBlue;
+ ancr.pixel = 0;
+ if( (rc = AllocColor(pcmp,
&ancr.screenRed, &ancr.screenGreen,
&ancr.screenBlue, &ancr.pixel, client->index)))
- return rc;
+ return rc;
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
WriteReplyToClient(client, sizeof(xAllocNamedColorReply),
&ancr);
- return Success;
- }
- else
- return BadName;
-
+ return Success;
+ }
+ else
+ return BadName;
+
}
else {
client->errorValue = stuff->cmap;
@@ -2546,7 +2552,7 @@ ProcAllocNamedColor(ClientPtr client)
}
int
-ProcAllocColorCells(ClientPtr client)
+ProcAllocColorCells (ClientPtr client)
{
ColormapPtr pcmp;
int rc;
@@ -2557,46 +2563,46 @@ ProcAllocColorCells(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- xAllocColorCellsReply accr;
- int npixels, nmasks;
- long length;
- Pixel *ppixels, *pmasks;
+ xAllocColorCellsReply accr;
+ int npixels, nmasks;
+ long length;
+ Pixel *ppixels, *pmasks;
- npixels = stuff->colors;
+ npixels = stuff->colors;
if (!npixels) {
- client->errorValue = npixels;
- return BadValue;
- }
+ client->errorValue = npixels;
+ return BadValue;
+ }
if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
- client->errorValue = stuff->contiguous;
- return BadValue;
- }
- nmasks = stuff->planes;
- length = ((long) npixels + (long) nmasks) * sizeof(Pixel);
- ppixels = malloc(length);
- if (!ppixels)
+ client->errorValue = stuff->contiguous;
+ return BadValue;
+ }
+ nmasks = stuff->planes;
+ length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
+ ppixels = malloc(length);
+ if(!ppixels)
return BadAlloc;
- pmasks = ppixels + npixels;
+ pmasks = ppixels + npixels;
- if ((rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
+ if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
(Bool) stuff->contiguous, ppixels, pmasks))) {
- free(ppixels);
- return rc;
- }
+ free(ppixels);
+ return rc;
+ }
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
- {
- accr.type = X_Reply;
- accr.length = bytes_to_int32(length);
- accr.sequenceNumber = client->sequence;
- accr.nPixels = npixels;
- accr.nMasks = nmasks;
- WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
- }
- free(ppixels);
+ {
+ accr.type = X_Reply;
+ accr.length = bytes_to_int32(length);
+ accr.sequenceNumber = client->sequence;
+ accr.nPixels = npixels;
+ accr.nMasks = nmasks;
+ WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
+ free(ppixels);
return Success;
}
else {
@@ -2617,46 +2623,46 @@ ProcAllocColorPlanes(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- xAllocColorPlanesReply acpr;
- int npixels;
- long length;
- Pixel *ppixels;
+ xAllocColorPlanesReply acpr;
+ int npixels;
+ long length;
+ Pixel *ppixels;
- npixels = stuff->colors;
+ npixels = stuff->colors;
if (!npixels) {
- client->errorValue = npixels;
- return BadValue;
- }
+ client->errorValue = npixels;
+ return BadValue;
+ }
if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
- client->errorValue = stuff->contiguous;
- return BadValue;
- }
- acpr.type = X_Reply;
- acpr.sequenceNumber = client->sequence;
- acpr.nPixels = npixels;
- length = (long) npixels *sizeof(Pixel);
-
- ppixels = malloc(length);
- if (!ppixels)
+ client->errorValue = stuff->contiguous;
+ return BadValue;
+ }
+ acpr.type = X_Reply;
+ acpr.sequenceNumber = client->sequence;
+ acpr.nPixels = npixels;
+ length = (long)npixels * sizeof(Pixel);
+
+ ppixels = malloc(length);
+ if(!ppixels)
return BadAlloc;
- if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
+ if( (rc = AllocColorPlanes(client->index, pcmp, npixels,
(int) stuff->red, (int) stuff->green,
(int) stuff->blue, (Bool) stuff->contiguous,
ppixels, &acpr.redMask, &acpr.greenMask,
&acpr.blueMask))) {
free(ppixels);
- return rc;
- }
- acpr.length = bytes_to_int32(length);
+ return rc;
+ }
+ acpr.length = bytes_to_int32(length);
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
- {
- WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
- }
- free(ppixels);
+ {
+ WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
+ free(ppixels);
return Success;
}
else {
@@ -2677,13 +2683,13 @@ ProcFreeColors(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixRemoveAccess);
if (rc == Success) {
- int count;
+ int count;
- if (pcmp->flags & AllAllocated)
- return BadAccess;
- count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
- return FreeColors(pcmp, client->index, count,
- (Pixel *) &stuff[1], (Pixel) stuff->planeMask);
+ if(pcmp->flags & AllAllocated)
+ return BadAccess;
+ count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
+ return FreeColors(pcmp, client->index, count,
+ (Pixel *)&stuff[1], (Pixel)stuff->planeMask);
}
else {
client->errorValue = stuff->cmap;
@@ -2692,7 +2698,7 @@ ProcFreeColors(ClientPtr client)
}
int
-ProcStoreColors(ClientPtr client)
+ProcStoreColors (ClientPtr client)
{
ColormapPtr pcmp;
int rc;
@@ -2703,13 +2709,13 @@ ProcStoreColors(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixWriteAccess);
if (rc == Success) {
- int count;
+ int count;
count = (client->req_len << 2) - sizeof(xStoreColorsReq);
- if (count % sizeof(xColorItem))
- return BadLength;
- count /= sizeof(xColorItem);
- return StoreColors(pcmp, count, (xColorItem *) &stuff[1], client);
+ if (count % sizeof(xColorItem))
+ return BadLength;
+ count /= sizeof(xColorItem);
+ return StoreColors(pcmp, count, (xColorItem *)&stuff[1], client);
}
else {
client->errorValue = stuff->cmap;
@@ -2718,7 +2724,7 @@ ProcStoreColors(ClientPtr client)
}
int
-ProcStoreNamedColor(ClientPtr client)
+ProcStoreNamedColor (ClientPtr client)
{
ColormapPtr pcmp;
int rc;
@@ -2729,14 +2735,14 @@ ProcStoreNamedColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixWriteAccess);
if (rc == Success) {
- xColorItem def;
+ xColorItem def;
- if (OsLookupColor(pcmp->pScreen->myNum, (char *) &stuff[1],
+ if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1],
stuff->nbytes, &def.red, &def.green, &def.blue)) {
- def.flags = stuff->flags;
- def.pixel = stuff->pixel;
- return StoreColors(pcmp, 1, &def, client);
- }
+ def.flags = stuff->flags;
+ def.pixel = stuff->pixel;
+ return StoreColors(pcmp, 1, &def, client);
+ }
return BadName;
}
else {
@@ -2757,39 +2763,39 @@ ProcQueryColors(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixReadAccess);
if (rc == Success) {
- int count;
- xrgb *prgbs;
- xQueryColorsReply qcr;
+ int count;
+ xrgb *prgbs;
+ xQueryColorsReply qcr;
count =
bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
- prgbs = calloc(1, count * sizeof(xrgb));
- if (!prgbs && count)
+ prgbs = calloc(1, count * sizeof(xrgb));
+ if(!prgbs && count)
return BadAlloc;
if ((rc =
QueryColors(pcmp, count, (Pixel *) &stuff[1], prgbs, client))) {
- free(prgbs);
- return rc;
- }
- memset(&qcr, 0, sizeof(xQueryColorsReply));
- qcr.type = X_Reply;
- qcr.length = bytes_to_int32(count * sizeof(xrgb));
- qcr.sequenceNumber = client->sequence;
- qcr.nColors = count;
- WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
+ free(prgbs);
+ return rc;
+ }
+ memset(&qcr, 0, sizeof(xQueryColorsReply));
+ qcr.type = X_Reply;
+ qcr.length = bytes_to_int32(count * sizeof(xrgb));
+ qcr.sequenceNumber = client->sequence;
+ qcr.nColors = count;
+ WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count) {
- client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
- WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
- }
- free(prgbs);
- return Success;
-
+ client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
+ WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
+ }
+ free(prgbs);
+ return Success;
+
}
else {
client->errorValue = stuff->cmap;
return rc;
}
-}
+}
int
ProcLookupColor(ClientPtr client)
@@ -2803,23 +2809,23 @@ ProcLookupColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixReadAccess);
if (rc == Success) {
- xLookupColorReply lcr;
+ xLookupColorReply lcr;
if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) {
- lcr.type = X_Reply;
- lcr.length = 0;
- lcr.sequenceNumber = client->sequence;
- lcr.screenRed = lcr.exactRed;
- lcr.screenGreen = lcr.exactGreen;
- lcr.screenBlue = lcr.exactBlue;
- (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
- &lcr.screenGreen,
+ lcr.type = X_Reply;
+ lcr.length = 0;
+ lcr.sequenceNumber = client->sequence;
+ lcr.screenRed = lcr.exactRed;
+ lcr.screenGreen = lcr.exactGreen;
+ lcr.screenBlue = lcr.exactBlue;
+ (*pcmp->pScreen->ResolveColor)(&lcr.screenRed,
+ &lcr.screenGreen,
&lcr.screenBlue, pcmp->pVisual);
- WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
- return Success;
- }
+ WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
+ return Success;
+ }
return BadName;
}
else {
@@ -2829,16 +2835,16 @@ ProcLookupColor(ClientPtr client)
}
int
-ProcCreateCursor(ClientPtr client)
+ProcCreateCursor (ClientPtr client)
{
- CursorPtr pCursor;
- PixmapPtr src;
- PixmapPtr msk;
- unsigned char *srcbits;
- unsigned char *mskbits;
- unsigned short width, height;
- long n;
- CursorMetricRec cm;
+ CursorPtr pCursor;
+ PixmapPtr src;
+ PixmapPtr msk;
+ unsigned char * srcbits;
+ unsigned char * mskbits;
+ unsigned short width, height;
+ long n;
+ CursorMetricRec cm;
int rc;
REQUEST(xCreateCursorReq);
@@ -2849,51 +2855,51 @@ ProcCreateCursor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &src, stuff->source, RT_PIXMAP,
client, DixReadAccess);
if (rc != Success) {
- client->errorValue = stuff->source;
- return rc;
+ client->errorValue = stuff->source;
+ return rc;
}
rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP,
client, DixReadAccess);
if (rc != Success) {
if (stuff->mask != None) {
- client->errorValue = stuff->mask;
- return rc;
- }
+ client->errorValue = stuff->mask;
+ return rc;
+ }
}
- else if (src->drawable.width != msk->drawable.width
- || src->drawable.height != msk->drawable.height
+ else if ( src->drawable.width != msk->drawable.width
+ || src->drawable.height != msk->drawable.height
|| src->drawable.depth != 1 || msk->drawable.depth != 1)
- return BadMatch;
+ return BadMatch;
width = src->drawable.width;
height = src->drawable.height;
if (stuff->x > width || stuff->y > height)
- return BadMatch;
+ return BadMatch;
- n = BitmapBytePad(width) * height;
+ n = BitmapBytePad(width)*height;
srcbits = calloc(1, n);
if (!srcbits)
- return BadAlloc;
+ return BadAlloc;
mskbits = malloc(n);
if (!mskbits) {
- free(srcbits);
- return BadAlloc;
+ free(srcbits);
+ return BadAlloc;
}
- (*src->drawable.pScreen->GetImage) ((DrawablePtr) src, 0, 0, width, height,
- XYPixmap, 1, (pointer) srcbits);
+ (* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height,
+ XYPixmap, 1, (pointer)srcbits);
if (msk == (PixmapPtr) NULL) {
- unsigned char *bits = mskbits;
+ unsigned char *bits = mskbits;
- while (--n >= 0)
- *bits++ = ~0;
+ while (--n >= 0)
+ *bits++ = ~0;
}
else {
- /* zeroing the (pad) bits helps some ddx cursor handling */
- memset((char *) mskbits, 0, n);
- (*msk->drawable.pScreen->GetImage) ((DrawablePtr) msk, 0, 0, width,
+ /* zeroing the (pad) bits helps some ddx cursor handling */
+ memset((char *)mskbits, 0, n);
+ (* msk->drawable.pScreen->GetImage)( (DrawablePtr)msk, 0, 0, width,
height, XYPixmap, 1,
(pointer) mskbits);
}
@@ -2902,26 +2908,26 @@ ProcCreateCursor(ClientPtr client)
cm.xhot = stuff->x;
cm.yhot = stuff->y;
rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm,
- stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
- stuff->backRed, stuff->backGreen, stuff->backBlue,
- &pCursor, client, stuff->cid);
+ stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
+ stuff->backRed, stuff->backGreen, stuff->backBlue,
+ &pCursor, client, stuff->cid);
if (rc != Success)
- goto bail;
- if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) {
- rc = BadAlloc;
- goto bail;
+ goto bail;
+ if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) {
+ rc = BadAlloc;
+ goto bail;
}
return Success;
- bail:
+bail:
free(srcbits);
free(mskbits);
return rc;
}
int
-ProcCreateGlyphCursor(ClientPtr client)
+ProcCreateGlyphCursor (ClientPtr client)
{
CursorPtr pCursor;
int res;
@@ -2932,19 +2938,19 @@ ProcCreateGlyphCursor(ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->cid, client);
res = AllocGlyphCursor(stuff->source, stuff->sourceChar,
- stuff->mask, stuff->maskChar,
- stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
- stuff->backRed, stuff->backGreen, stuff->backBlue,
- &pCursor, client, stuff->cid);
+ stuff->mask, stuff->maskChar,
+ stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
+ stuff->backRed, stuff->backGreen, stuff->backBlue,
+ &pCursor, client, stuff->cid);
if (res != Success)
- return res;
- if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor))
- return Success;
+ return res;
+ if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
+ return Success;
return BadAlloc;
}
int
-ProcFreeCursor(ClientPtr client)
+ProcFreeCursor (ClientPtr client)
{
CursorPtr pCursor;
int rc;
@@ -2955,19 +2961,19 @@ ProcFreeCursor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->id, RT_CURSOR,
client, DixDestroyAccess);
if (rc == Success) {
- FreeResource(stuff->id, RT_NONE);
- return Success;
+ FreeResource(stuff->id, RT_NONE);
+ return Success;
}
else {
- client->errorValue = stuff->id;
- return rc;
+ client->errorValue = stuff->id;
+ return rc;
}
}
int
-ProcQueryBestSize(ClientPtr client)
+ProcQueryBestSize (ClientPtr client)
{
- xQueryBestSizeReply reply;
+ xQueryBestSizeReply reply;
DrawablePtr pDraw;
ScreenPtr pScreen;
int rc;
@@ -2975,24 +2981,24 @@ ProcQueryBestSize(ClientPtr client)
REQUEST(xQueryBestSizeReq);
REQUEST_SIZE_MATCH(xQueryBestSizeReq);
- if ((stuff->class != CursorShape) &&
+ if ((stuff->class != CursorShape) &&
(stuff->class != TileShape) && (stuff->class != StippleShape)) {
- client->errorValue = stuff->class;
+ client->errorValue = stuff->class;
return BadValue;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
- return BadMatch;
+ return BadMatch;
pScreen = pDraw->pScreen;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
if (rc != Success)
- return rc;
- (*pScreen->QueryBestSize) (stuff->class, &stuff->width,
- &stuff->height, pScreen);
+ return rc;
+ (* pScreen->QueryBestSize)(stuff->class, &stuff->width,
+ &stuff->height, pScreen);
memset(&reply, 0, sizeof(xQueryBestSizeReply));
reply.type = X_Reply;
reply.length = 0;
@@ -3004,7 +3010,7 @@ ProcQueryBestSize(ClientPtr client)
}
int
-ProcSetScreenSaver(ClientPtr client)
+ProcSetScreenSaver (ClientPtr client)
{
int rc, i, blankingOption, exposureOption;
@@ -3012,52 +3018,52 @@ ProcSetScreenSaver(ClientPtr client)
REQUEST_SIZE_MATCH(xSetScreenSaverReq);
for (i = 0; i < screenInfo.numScreens; i++) {
- rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
- DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
blankingOption = stuff->preferBlank;
if ((blankingOption != DontPreferBlanking) &&
(blankingOption != PreferBlanking) &&
(blankingOption != DefaultBlanking)) {
- client->errorValue = blankingOption;
+ client->errorValue = blankingOption;
return BadValue;
}
exposureOption = stuff->allowExpose;
if ((exposureOption != DontAllowExposures) &&
(exposureOption != AllowExposures) &&
(exposureOption != DefaultExposures)) {
- client->errorValue = exposureOption;
+ client->errorValue = exposureOption;
return BadValue;
}
if (stuff->timeout < -1) {
- client->errorValue = stuff->timeout;
+ client->errorValue = stuff->timeout;
return BadValue;
}
if (stuff->interval < -1) {
- client->errorValue = stuff->interval;
+ client->errorValue = stuff->interval;
return BadValue;
}
if (blankingOption == DefaultBlanking)
- ScreenSaverBlanking = defaultScreenSaverBlanking;
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
else
- ScreenSaverBlanking = blankingOption;
+ ScreenSaverBlanking = blankingOption;
if (exposureOption == DefaultExposures)
- ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
else
- ScreenSaverAllowExposures = exposureOption;
+ ScreenSaverAllowExposures = exposureOption;
if (stuff->timeout >= 0)
- ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
- else
- ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
+ else
+ ScreenSaverTime = defaultScreenSaverTime;
if (stuff->interval >= 0)
- ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
+ ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
else
- ScreenSaverInterval = defaultScreenSaverInterval;
+ ScreenSaverInterval = defaultScreenSaverInterval;
SetScreenSaverTimer();
return Success;
@@ -3072,10 +3078,10 @@ ProcGetScreenSaver(ClientPtr client)
REQUEST_SIZE_MATCH(xReq);
for (i = 0; i < screenInfo.numScreens; i++) {
- rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
- DixGetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
}
rep.type = X_Reply;
@@ -3096,12 +3102,12 @@ ProcChangeHosts(ClientPtr client)
REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength);
- if (stuff->mode == HostInsert)
- return AddHost(client, (int) stuff->hostFamily,
- stuff->hostLength, (pointer) &stuff[1]);
+ if(stuff->mode == HostInsert)
+ return AddHost(client, (int)stuff->hostFamily,
+ stuff->hostLength, (pointer)&stuff[1]);
if (stuff->mode == HostDelete)
- return RemoveHost(client, (int) stuff->hostFamily,
- stuff->hostLength, (pointer) &stuff[1]);
+ return RemoveHost(client, (int)stuff->hostFamily,
+ stuff->hostLength, (pointer)&stuff[1]);
client->errorValue = stuff->mode;
return BadValue;
}
@@ -3110,8 +3116,8 @@ int
ProcListHosts(ClientPtr client)
{
xListHostsReply reply;
- int len, nHosts, result;
- pointer pdata;
+ int len, nHosts, result;
+ pointer pdata;
/* REQUEST(xListHostsReq); */
@@ -3120,19 +3126,19 @@ ProcListHosts(ClientPtr client)
/* untrusted clients can't list hosts */
result = XaceHook(XACE_SERVER_ACCESS, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
if (result != Success)
- return result;
+ return result;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.nHosts = nHosts;
reply.length = bytes_to_int32(len);
WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
if (nHosts) {
- client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
- WriteSwappedDataToClient(client, len, pdata);
+ client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
+ WriteSwappedDataToClient(client, len, pdata);
}
free(pdata);
return Success;
@@ -3145,7 +3151,7 @@ ProcChangeAccessControl(ClientPtr client)
REQUEST_SIZE_MATCH(xSetAccessControlReq);
if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess)) {
- client->errorValue = stuff->mode;
+ client->errorValue = stuff->mode;
return BadValue;
}
return ChangeAccessControl(client, stuff->mode == EnableAccess);
@@ -3167,8 +3173,8 @@ CloseDownRetainedResources(void)
for (i = 1; i < currentMaxClients; i++) {
client = clients[i];
if (client && (client->closeDownMode == RetainTemporary)
- && (client->clientGone))
- CloseDownClient(client);
+ && (client->clientGone))
+ CloseDownClient(client);
}
}
@@ -3181,25 +3187,25 @@ ProcKillClient(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if (stuff->id == AllTemporary) {
- CloseDownRetainedResources();
+ CloseDownRetainedResources();
return Success;
}
rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
if (rc == Success) {
- CloseDownClient(killclient);
- /* if an LBX proxy gets killed, isItTimeToYield will be set */
+ CloseDownClient(killclient);
+ /* if an LBX proxy gets killed, isItTimeToYield will be set */
if (isItTimeToYield || (client == killclient)) {
- /* force yield and return Success, so that Dispatch()
- * doesn't try to touch client
- */
- isItTimeToYield = TRUE;
- return Success;
- }
- return Success;
+ /* force yield and return Success, so that Dispatch()
+ * doesn't try to touch client
+ */
+ isItTimeToYield = TRUE;
+ return Success;
+ }
+ return Success;
}
else
- return rc;
+ return rc;
}
int
@@ -3211,22 +3217,22 @@ ProcSetFontPath(ClientPtr client)
int n;
REQUEST(xSetFontPathReq);
-
+
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
-
+
nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
total = nbytes;
- ptr = (unsigned char *) &stuff[1];
+ ptr = (unsigned char *)&stuff[1];
nfonts = stuff->nFonts;
while (--nfonts >= 0) {
- if ((total == 0) || (total < (n = (*ptr + 1))))
- return BadLength;
- total -= n;
- ptr += n;
+ if ((total == 0) || (total < (n = (*ptr + 1))))
+ return BadLength;
+ total -= n;
+ ptr += n;
}
if (total >= 4)
- return BadLength;
- return SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
+ return BadLength;
+ return SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
}
int
@@ -3241,7 +3247,7 @@ ProcGetFontPath(ClientPtr client)
REQUEST_SIZE_MATCH(xReq);
rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart);
if (rc != Success)
- return rc;
+ return rc;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
@@ -3265,35 +3271,35 @@ ProcChangeCloseDownMode(ClientPtr client)
rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess);
if (rc != Success)
- return rc;
+ return rc;
if ((stuff->mode == AllTemporary) ||
(stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) {
- client->closeDownMode = stuff->mode;
- return Success;
+ client->closeDownMode = stuff->mode;
+ return Success;
}
else {
- client->errorValue = stuff->mode;
- return BadValue;
+ client->errorValue = stuff->mode;
+ return BadValue;
}
}
int
ProcForceScreenSaver(ClientPtr client)
-{
+{
int rc;
REQUEST(xForceScreenSaverReq);
REQUEST_SIZE_MATCH(xForceScreenSaverReq);
-
+
if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) {
- client->errorValue = stuff->mode;
+ client->errorValue = stuff->mode;
return BadValue;
}
- rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int) stuff->mode);
+ rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int)stuff->mode);
if (rc != Success)
- return rc;
+ return rc;
return Success;
}
@@ -3301,7 +3307,7 @@ int
ProcNoOperation(ClientPtr client)
{
REQUEST_AT_LEAST_SIZE(xReq);
-
+
/* noop -- don't do anything */
return Success;
}
@@ -3319,81 +3325,81 @@ void
CloseDownClient(ClientPtr client)
{
Bool really_close_down = client->clientGone ||
- client->closeDownMode == DestroyAll;
+ client->closeDownMode == DestroyAll;
if (!client->clientGone) {
- /* ungrab server if grabbing client dies */
+ /* ungrab server if grabbing client dies */
if (grabState != GrabNone && grabClient == client) {
- UngrabServer(client);
- }
- BITCLEAR(grabWaiters, client->index);
- DeleteClientFromAnySelections(client);
- ReleaseActiveGrabs(client);
- DeleteClientFontStuff(client);
+ UngrabServer(client);
+ }
+ BITCLEAR(grabWaiters, client->index);
+ DeleteClientFromAnySelections(client);
+ ReleaseActiveGrabs(client);
+ DeleteClientFontStuff(client);
if (!really_close_down) {
- /* This frees resources that should never be retained
- * no matter what the close down mode is. Actually we
- * could do this unconditionally, but it's probably
- * better not to traverse all the client's resources
- * twice (once here, once a few lines down in
- * FreeClientResources) in the common case of
- * really_close_down == TRUE.
- */
- FreeClientNeverRetainResources(client);
- client->clientState = ClientStateRetained;
+ /* This frees resources that should never be retained
+ * no matter what the close down mode is. Actually we
+ * could do this unconditionally, but it's probably
+ * better not to traverse all the client's resources
+ * twice (once here, once a few lines down in
+ * FreeClientResources) in the common case of
+ * really_close_down == TRUE.
+ */
+ FreeClientNeverRetainResources(client);
+ client->clientState = ClientStateRetained;
if (ClientStateCallback) {
- NewClientInfoRec clientinfo;
-
- clientinfo.client = client;
- clientinfo.prefix = (xConnSetupPrefix *) NULL;
- clientinfo.setup = (xConnSetup *) NULL;
- CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
- }
- }
- client->clientGone = TRUE; /* so events aren't sent to client */
- if (ClientIsAsleep(client))
- ClientSignal(client);
- ProcessWorkQueueZombies();
- CloseDownConnection(client);
-
- /* If the client made it to the Running stage, nClients has
- * been incremented on its behalf, so we need to decrement it
- * now. If it hasn't gotten to Running, nClients has *not*
- * been incremented, so *don't* decrement it.
- */
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
+ }
+ client->clientGone = TRUE; /* so events aren't sent to client */
+ if (ClientIsAsleep(client))
+ ClientSignal (client);
+ ProcessWorkQueueZombies();
+ CloseDownConnection(client);
+
+ /* If the client made it to the Running stage, nClients has
+ * been incremented on its behalf, so we need to decrement it
+ * now. If it hasn't gotten to Running, nClients has *not*
+ * been incremented, so *don't* decrement it.
+ */
if (client->clientState != ClientStateInitial) {
- --nClients;
- }
+ --nClients;
+ }
}
if (really_close_down) {
- if (client->clientState == ClientStateRunning && nClients == 0)
- dispatchException |= dispatchExceptionAtReset;
+ if (client->clientState == ClientStateRunning && nClients == 0)
+ dispatchException |= dispatchExceptionAtReset;
- client->clientState = ClientStateGone;
+ client->clientState = ClientStateGone;
if (ClientStateCallback) {
- NewClientInfoRec clientinfo;
-
- clientinfo.client = client;
- clientinfo.prefix = (xConnSetupPrefix *) NULL;
- clientinfo.setup = (xConnSetup *) NULL;
- CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
- }
- FreeClientResources(client);
- /* Disable client ID tracking. This must be done after
- * ClientStateCallback. */
- ReleaseClientIds(client);
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
+ FreeClientResources(client);
+ /* Disable client ID tracking. This must be done after
+ * ClientStateCallback. */
+ ReleaseClientIds(client);
#ifdef XSERVER_DTRACE
- XSERVER_CLIENT_DISCONNECT(client->index);
-#endif
- if (client->index < nextFreeClientID)
- nextFreeClientID = client->index;
- clients[client->index] = NullClient;
- SmartLastClient = NullClient;
- dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
+ XSERVER_CLIENT_DISCONNECT(client->index);
+#endif
+ if (client->index < nextFreeClientID)
+ nextFreeClientID = client->index;
+ clients[client->index] = NullClient;
+ SmartLastClient = NullClient;
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
- while (!clients[currentMaxClients - 1])
- currentMaxClients--;
+ while (!clients[currentMaxClients-1])
+ currentMaxClients--;
}
}
@@ -3402,11 +3408,11 @@ KillAllClients(void)
{
int i;
- for (i = 1; i < currentMaxClients; i++)
+ for (i=1; i<currentMaxClients; i++)
if (clients[i]) {
/* Make sure Retained clients are released. */
clients[i]->closeDownMode = DestroyAll;
- CloseDownClient(clients[i]);
+ CloseDownClient(clients[i]);
}
}
@@ -3414,11 +3420,11 @@ void
InitClient(ClientPtr client, int i, pointer ospriv)
{
client->index = i;
- client->clientAsMask = ((Mask) i) << CLIENTOFFSET;
+ client->clientAsMask = ((Mask)i) << CLIENTOFFSET;
client->closeDownMode = i ? DestroyAll : RetainPermanent;
client->requestVector = InitialVector;
client->osPrivate = ospriv;
- QueryMinMaxKeyCodes(&client->minKC, &client->maxKC);
+ QueryMinMaxKeyCodes(&client->minKC,&client->maxKC);
client->smart_start_tick = SmartScheduleTime;
client->smart_stop_tick = SmartScheduleTime;
client->smart_check_tick = SmartScheduleTime;
@@ -3441,40 +3447,40 @@ NextAvailableClient(pointer ospriv)
i = nextFreeClientID;
if (i == MAXCLIENTS)
- return (ClientPtr) NULL;
+ return (ClientPtr)NULL;
clients[i] = client =
dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
if (!client)
- return (ClientPtr) NULL;
+ return (ClientPtr)NULL;
InitClient(client, i, ospriv);
if (!InitClientResources(client)) {
- dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
- return (ClientPtr) NULL;
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
+ return (ClientPtr)NULL;
}
data.reqType = 1;
data.length = bytes_to_int32(sz_xReq + sz_xConnClientPrefix);
if (!InsertFakeRequest(client, (char *) &data, sz_xReq)) {
- FreeClientResources(client);
- dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
- return (ClientPtr) NULL;
+ FreeClientResources(client);
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
+ return (ClientPtr)NULL;
}
if (i == currentMaxClients)
- currentMaxClients++;
+ currentMaxClients++;
while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
- nextFreeClientID++;
+ nextFreeClientID++;
/* Enable client ID tracking. This must be done before
* ClientStateCallback. */
ReserveClientIds(client);
if (ClientStateCallback) {
- NewClientInfoRec clientinfo;
+ NewClientInfoRec clientinfo;
- clientinfo.client = client;
- clientinfo.prefix = (xConnSetupPrefix *) NULL;
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
clientinfo.setup = (xConnSetup *) NULL;
- CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
- }
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
return client;
}
@@ -3485,19 +3491,19 @@ ProcInitialConnection(ClientPtr client)
xConnClientPrefix *prefix;
int whichbyte = 1;
- prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
+ prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
- return client->noClientException = -1;
+ return client->noClientException = -1;
if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
(!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) {
- client->swapped = TRUE;
- SwapConnClientPrefix(prefix);
+ client->swapped = TRUE;
+ SwapConnClientPrefix(prefix);
}
stuff->reqType = 2;
stuff->length += bytes_to_int32(prefix->nbytesAuthProto) +
- bytes_to_int32(prefix->nbytesAuthString);
+ bytes_to_int32(prefix->nbytesAuthString);
if (client->swapped) {
- swaps(&stuff->length);
+ swaps(&stuff->length);
}
ResetCurrentRequest(client);
return Success;
@@ -3509,23 +3515,23 @@ SendConnSetup(ClientPtr client, const char *reason)
xWindowRoot *root;
int i;
int numScreens;
- char *lConnectionInfo;
- xConnSetupPrefix *lconnSetupPrefix;
+ char* lConnectionInfo;
+ xConnSetupPrefix* lconnSetupPrefix;
if (reason) {
- xConnSetupPrefix csp;
+ xConnSetupPrefix csp;
- csp.success = xFalse;
- csp.lengthReason = strlen(reason);
- csp.length = bytes_to_int32(csp.lengthReason);
- csp.majorVersion = X_PROTOCOL;
- csp.minorVersion = X_PROTOCOL_REVISION;
- if (client->swapped)
- WriteSConnSetupPrefix(client, &csp);
- else
- (void) WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
- (void) WriteToClient(client, (int) csp.lengthReason, reason);
- return client->noClientException = -1;
+ csp.success = xFalse;
+ csp.lengthReason = strlen(reason);
+ csp.length = bytes_to_int32(csp.lengthReason);
+ csp.majorVersion = X_PROTOCOL;
+ csp.minorVersion = X_PROTOCOL_REVISION;
+ if (client->swapped)
+ WriteSConnSetupPrefix(client, &csp);
+ else
+ (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
+ (void)WriteToClient(client, (int)csp.lengthReason, reason);
+ return client->noClientException = -1;
}
numScreens = screenInfo.numScreens;
@@ -3541,56 +3547,56 @@ SendConnSetup(ClientPtr client, const char *reason)
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
client->sequence = 0;
- ((xConnSetup *) lConnectionInfo)->ridBase = client->clientAsMask;
- ((xConnSetup *) lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
+ ((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
+ ((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
#ifdef MATCH_CLIENT_ENDIAN
- ((xConnSetup *) lConnectionInfo)->imageByteOrder = ClientOrder(client);
- ((xConnSetup *) lConnectionInfo)->bitmapBitOrder = ClientOrder(client);
+ ((xConnSetup *)lConnectionInfo)->imageByteOrder = ClientOrder (client);
+ ((xConnSetup *)lConnectionInfo)->bitmapBitOrder = ClientOrder (client);
#endif
/* fill in the "currentInputMask" */
- root = (xWindowRoot *) (lConnectionInfo + connBlockScreenStart);
+ root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart);
#ifdef PANORAMIX
if (noPanoramiXExtension)
- numScreens = screenInfo.numScreens;
- else
- numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
#endif
for (i = 0; i < numScreens; i++) {
- unsigned int j;
- xDepth *pDepth;
- WindowPtr pRoot = screenInfo.screens[i]->root;
+ unsigned int j;
+ xDepth *pDepth;
+ WindowPtr pRoot = screenInfo.screens[i]->root;
root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot);
- pDepth = (xDepth *) (root + 1);
+ pDepth = (xDepth *)(root + 1);
for (j = 0; j < root->nDepths; j++) {
- pDepth = (xDepth *) (((char *) (pDepth + 1)) +
- pDepth->nVisuals * sizeof(xVisualType));
- }
- root = (xWindowRoot *) pDepth;
+ pDepth = (xDepth *)(((char *)(pDepth + 1)) +
+ pDepth->nVisuals * sizeof(xVisualType));
+ }
+ root = (xWindowRoot *)pDepth;
}
if (client->swapped) {
- WriteSConnSetupPrefix(client, lconnSetupPrefix);
- WriteSConnectionInfo(client,
- (unsigned long) (lconnSetupPrefix->length << 2),
- lConnectionInfo);
+ WriteSConnSetupPrefix(client, lconnSetupPrefix);
+ WriteSConnectionInfo(client,
+ (unsigned long)(lconnSetupPrefix->length << 2),
+ lConnectionInfo);
}
else {
- (void) WriteToClient(client, sizeof(xConnSetupPrefix),
- (char *) lconnSetupPrefix);
- (void) WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
- lConnectionInfo);
+ (void)WriteToClient(client, sizeof(xConnSetupPrefix),
+ (char *) lconnSetupPrefix);
+ (void)WriteToClient(client, (int)(lconnSetupPrefix->length << 2),
+ lConnectionInfo);
}
client->clientState = ClientStateRunning;
if (ClientStateCallback) {
- NewClientInfoRec clientinfo;
+ NewClientInfoRec clientinfo;
- clientinfo.client = client;
- clientinfo.prefix = lconnSetupPrefix;
- clientinfo.setup = (xConnSetup *) lConnectionInfo;
- CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
- }
+ clientinfo.client = client;
+ clientinfo.prefix = lconnSetupPrefix;
+ clientinfo.setup = (xConnSetup *)lConnectionInfo;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
return Success;
}
@@ -3603,24 +3609,24 @@ ProcEstablishConnection(ClientPtr client)
REQUEST(xReq);
- prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
- auth_proto = (char *) prefix + sz_xConnClientPrefix;
+ prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
+ auth_proto = (char *)prefix + sz_xConnClientPrefix;
auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto);
if ((prefix->majorVersion != X_PROTOCOL) ||
- (prefix->minorVersion != X_PROTOCOL_REVISION))
- reason = "Protocol version mismatch";
+ (prefix->minorVersion != X_PROTOCOL_REVISION))
+ reason = "Protocol version mismatch";
else
- reason = ClientAuthorized(client,
- (unsigned short) prefix->nbytesAuthProto,
- auth_proto,
- (unsigned short) prefix->nbytesAuthString,
- auth_string);
+ reason = ClientAuthorized(client,
+ (unsigned short)prefix->nbytesAuthProto,
+ auth_proto,
+ (unsigned short)prefix->nbytesAuthString,
+ auth_string);
- return (SendConnSetup(client, reason));
+ return(SendConnSetup(client, reason));
}
void
-SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
+SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
XID resId, int errorCode)
{
xError rep;
@@ -3632,7 +3638,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
rep.minorCode = minorCode;
rep.resourceID = resId;
- WriteEventsToClient(client, 1, (xEvent *) &rep);
+ WriteEventsToClient (client, 1, (xEvent *)&rep);
}
void
@@ -3647,15 +3653,15 @@ MarkClientException(ClientPtr client)
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
*/
static int answer[6][4] = {
- /* pad pad pad pad */
- /* 8 16 32 64 */
-
- {3, 4, 5, 6}, /* 1 bit per pixel */
- {1, 2, 3, 4}, /* 4 bits per pixel */
- {0, 1, 2, 3}, /* 8 bits per pixel */
- {~0, 0, 1, 2}, /* 16 bits per pixel */
- {~0, ~0, 0, 1}, /* 24 bits per pixel */
- {~0, ~0, 0, 1} /* 32 bits per pixel */
+ /* pad pad pad pad*/
+ /* 8 16 32 64 */
+
+ { 3, 4, 5 , 6 }, /* 1 bit per pixel */
+ { 1, 2, 3 , 4 }, /* 4 bits per pixel */
+ { 0, 1, 2 , 3 }, /* 8 bits per pixel */
+ { ~0, 0, 1 , 2 }, /* 16 bits per pixel */
+ { ~0, ~0, 0 , 1 }, /* 24 bits per pixel */
+ { ~0, ~0, 0 , 1 } /* 32 bits per pixel */
};
/*
@@ -3663,32 +3669,32 @@ static int answer[6][4] = {
* the answer array above given the number of bits per pixel?"
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
*/
-static int indexForBitsPerPixel[33] = {
- ~0, 0, ~0, ~0, /* 1 bit per pixel */
- 1, ~0, ~0, ~0, /* 4 bits per pixel */
- 2, ~0, ~0, ~0, /* 8 bits per pixel */
- ~0, ~0, ~0, ~0,
- 3, ~0, ~0, ~0, /* 16 bits per pixel */
- ~0, ~0, ~0, ~0,
- 4, ~0, ~0, ~0, /* 24 bits per pixel */
- ~0, ~0, ~0, ~0,
- 5 /* 32 bits per pixel */
+static int indexForBitsPerPixel[ 33 ] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 1, ~0, ~0, ~0, /* 4 bits per pixel */
+ 2, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 4, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 5 /* 32 bits per pixel */
};
/*
* This array gives the bytesperPixel value for cases where the number
* of bits per pixel is a multiple of 8 but not a power of 2.
*/
-static int answerBytesPerPixel[33] = {
- ~0, 0, ~0, ~0, /* 1 bit per pixel */
- 0, ~0, ~0, ~0, /* 4 bits per pixel */
- 0, ~0, ~0, ~0, /* 8 bits per pixel */
- ~0, ~0, ~0, ~0,
- 0, ~0, ~0, ~0, /* 16 bits per pixel */
- ~0, ~0, ~0, ~0,
- 3, ~0, ~0, ~0, /* 24 bits per pixel */
- ~0, ~0, ~0, ~0,
- 0 /* 32 bits per pixel */
+static int answerBytesPerPixel[ 33 ] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 0, ~0, ~0, ~0, /* 4 bits per pixel */
+ 0, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0 /* 32 bits per pixel */
};
/*
@@ -3696,24 +3702,24 @@ static int answerBytesPerPixel[33] = {
* the answer array above given the number of bits per scanline pad unit?"
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
*/
-static int indexForScanlinePad[65] = {
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */
- ~0, ~0, ~0, ~0,
- 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- 3 /* 64 bits per scanline pad unit */
+static int indexForScanlinePad[ 65 ] = {
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 3 /* 64 bits per scanline pad unit */
};
/*
@@ -3726,9 +3732,9 @@ with its screen number, a pointer to its ScreenRec, argc, and argv.
int
AddScreen(Bool (*pfnInit) (int /*index */ ,
- ScreenPtr /*pScreen */ ,
- int /*argc */ ,
- char ** /*argv */
+ ScreenPtr /*pScreen*/,
+ int /*argc*/,
+ char ** /*argv*/
), int argc, char **argv)
{
@@ -3738,19 +3744,19 @@ AddScreen(Bool (*pfnInit) (int /*index */ ,
i = screenInfo.numScreens;
if (i == MAXSCREENS)
- return -1;
+ return -1;
pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
if (!pScreen)
- return -1;
+ return -1;
if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
- free(pScreen);
- return -1;
+ free (pScreen);
+ return -1;
}
pScreen->myNum = i;
- pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */
- pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
+ pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */
+ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
/*
@@ -3763,25 +3769,25 @@ AddScreen(Bool (*pfnInit) (int /*index */ ,
* screen init routine is called.
*/
for (format = 0; format < screenInfo.numPixmapFormats; format++) {
- depth = screenInfo.formats[format].depth;
- bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
- scanlinepad = screenInfo.formats[format].scanlinePad;
- j = indexForBitsPerPixel[bitsPerPixel];
- k = indexForScanlinePad[scanlinepad];
- PixmapWidthPaddingInfo[depth].padPixelsLog2 = answer[j][k];
- PixmapWidthPaddingInfo[depth].padRoundUp =
- (scanlinepad / bitsPerPixel) - 1;
- j = indexForBitsPerPixel[8]; /* bits per byte */
- PixmapWidthPaddingInfo[depth].padBytesLog2 = answer[j][k];
- PixmapWidthPaddingInfo[depth].bitsPerPixel = bitsPerPixel;
+ depth = screenInfo.formats[format].depth;
+ bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
+ scanlinepad = screenInfo.formats[format].scanlinePad;
+ j = indexForBitsPerPixel[ bitsPerPixel ];
+ k = indexForScanlinePad[ scanlinepad ];
+ PixmapWidthPaddingInfo[ depth ].padPixelsLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[ depth ].padRoundUp =
+ (scanlinepad/bitsPerPixel) - 1;
+ j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
+ PixmapWidthPaddingInfo[ depth ].padBytesLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[ depth ].bitsPerPixel = bitsPerPixel;
if (answerBytesPerPixel[bitsPerPixel]) {
- PixmapWidthPaddingInfo[depth].notPower2 = 1;
- PixmapWidthPaddingInfo[depth].bytesPerPixel =
- answerBytesPerPixel[bitsPerPixel];
- }
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 1;
+ PixmapWidthPaddingInfo[ depth ].bytesPerPixel =
+ answerBytesPerPixel[bitsPerPixel];
+ }
else {
- PixmapWidthPaddingInfo[depth].notPower2 = 0;
- }
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 0;
+ }
}
/* This is where screen specific stuff gets initialized. Load the
@@ -3791,14 +3797,14 @@ AddScreen(Bool (*pfnInit) (int /*index */ ,
Note that InitScreen is NOT allowed to modify argc, argv, or
any of the strings pointed to by argv. They may be passed to
multiple screens.
- */
+ */
screenInfo.screens[i] = pScreen;
screenInfo.numScreens++;
if (!(*pfnInit) (i, pScreen, argc, argv)) {
- dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
- free(pScreen);
- screenInfo.numScreens--;
- return -1;
+ dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
+ free(pScreen);
+ screenInfo.numScreens--;
+ return -1;
}
update_desktop_dimensions();
diff --git a/dix/globals.c b/dix/globals.c
index c0cae159a..2ca939dda 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -58,30 +58,31 @@ SOFTWARE.
#include "site.h"
#include "dixstruct.h"
#include "os.h"
+#include "ddxhooks.h"
ScreenInfo screenInfo;
KeybdCtrl defaultKeyboardControl = {
- DEFAULT_KEYBOARD_CLICK,
- DEFAULT_BELL,
- DEFAULT_BELL_PITCH,
- DEFAULT_BELL_DURATION,
- DEFAULT_AUTOREPEAT,
- DEFAULT_AUTOREPEATS,
- DEFAULT_LEDS,
+ DEFAULT_KEYBOARD_CLICK,
+ DEFAULT_BELL,
+ DEFAULT_BELL_PITCH,
+ DEFAULT_BELL_DURATION,
+ DEFAULT_AUTOREPEAT,
+ DEFAULT_AUTOREPEATS,
+ DEFAULT_LEDS,
0
};
PtrCtrl defaultPointerControl = {
- DEFAULT_PTR_NUMERATOR,
- DEFAULT_PTR_DENOMINATOR,
- DEFAULT_PTR_THRESHOLD,
+ DEFAULT_PTR_NUMERATOR,
+ DEFAULT_PTR_DENOMINATOR,
+ DEFAULT_PTR_THRESHOLD,
0
};
-ClientPtr clients[MAXCLIENTS];
-ClientPtr serverClient;
-int currentMaxClients; /* current size of clients array */
+ClientPtr clients[MAXCLIENTS];
+ClientPtr serverClient;
+int currentMaxClients; /* current size of clients array */
long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
unsigned long globalSerialNumber = 0;
@@ -91,7 +92,7 @@ unsigned long serverGeneration = 0;
CARD32 ScreenSaverTime;
CARD32 ScreenSaverInterval;
int ScreenSaverBlanking;
-int ScreenSaverAllowExposures;
+int ScreenSaverAllowExposures;
#ifdef DPMSExtension
CARD16 DPMSPowerLevel = 0;
@@ -105,8 +106,8 @@ Bool DPMSEnabled;
CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
-int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
-int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
+int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
+int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
#ifdef SCREENSAVER
Bool screenSaverSuspended = FALSE;
@@ -115,8 +116,8 @@ Bool screenSaverSuspended = FALSE;
char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
char *defaultTextFont = COMPILEDDEFAULTFONT;
char *defaultCursorFont = COMPILEDCURSORFONT;
-FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
- every compilation of dix code */
+FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
+ every compilation of dix code */
CursorPtr rootCursor;
Bool party_like_its_1989 = FALSE;
Bool whiteRoot = FALSE;
@@ -128,6 +129,9 @@ int defaultColorVisualClass = -1;
int monitorResolution = 0;
char *display;
+int displayfd;
char *ConnectionInfo;
CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
+
+DdxHooks ddxHooks;
diff --git a/dix/main.c b/dix/main.c
index 70dcc946e..88b5ee4f5 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -79,7 +79,7 @@ Equipment Corporation.
#endif
#include <X11/X.h>
-#include <X11/Xos.h> /* for unistd.h */
+#include <X11/Xos.h> /* for unistd.h */
#include <X11/Xproto.h>
#include <pixman.h>
#include "scrnintstr.h"
@@ -107,7 +107,7 @@ Equipment Corporation.
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
-#include "dixevents.h" /* InitEvents() */
+#include "dixevents.h" /* InitEvents() */
#endif
#ifdef DPMSExtension
@@ -133,11 +133,15 @@ int
main(int argc, char *argv[], char *envp[])
#endif
{
- int i;
- HWEventQueueType alwaysCheckForInput[2];
+ int i;
+ HWEventQueueType alwaysCheckForInput[2];
display = "0";
+#ifdef DDXMAIN
+ ddxMain();
+#endif
+
InitRegions();
CheckUserParameters(argc, argv, envp);
@@ -151,207 +155,210 @@ main(int argc, char *argv[], char *envp[])
alwaysCheckForInput[0] = 0;
alwaysCheckForInput[1] = 1;
while (1) {
- serverGeneration++;
- ScreenSaverTime = defaultScreenSaverTime;
- ScreenSaverInterval = defaultScreenSaverInterval;
- ScreenSaverBlanking = defaultScreenSaverBlanking;
- ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+ serverGeneration++;
+ ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverInterval = defaultScreenSaverInterval;
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
#ifdef DPMSExtension
- DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
- DPMSEnabled = TRUE;
- DPMSPowerLevel = 0;
+ DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
+ DPMSEnabled = TRUE;
+ DPMSPowerLevel = 0;
#endif
- InitBlockAndWakeupHandlers();
+ InitBlockAndWakeupHandlers();
/* Perform any operating system dependent initializations you'd like */
OsInit();
- if (serverGeneration == 1) {
- CreateWellKnownSockets();
- for (i = 1; i < MAXCLIENTS; i++)
- clients[i] = NullClient;
- serverClient = calloc(sizeof(ClientRec), 1);
- if (!serverClient)
- FatalError("couldn't create server client");
- InitClient(serverClient, 0, (pointer) NULL);
- }
- else
- ResetWellKnownSockets();
- clients[0] = serverClient;
- currentMaxClients = 1;
-
- /* Initialize privates before first allocation */
- dixResetPrivates();
-
- /* Initialize server client devPrivates, to be reallocated as
- * more client privates are registered
- */
- if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
- FatalError("failed to create server client privates");
-
- if (!InitClientResources(serverClient)) /* for root resources */
- FatalError("couldn't init server resources");
-
- SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
- screenInfo.numScreens = 0;
-
- InitAtoms();
- InitEvents();
- InitSelections();
- InitGlyphCaching();
- dixResetRegistry();
- ResetFontPrivateIndex();
- InitCallbackManager();
- InitOutput(&screenInfo, argc, argv);
-
- if (screenInfo.numScreens < 1)
- FatalError("no screens found");
- InitExtensions(argc, argv);
- for (i = 0; i < screenInfo.numScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
-
- if (!CreateScratchPixmapsForScreen(i))
- FatalError("failed to create scratch pixmaps");
- if (pScreen->CreateScreenResources &&
- !(*pScreen->CreateScreenResources) (pScreen))
- FatalError("failed to create screen resources");
- if (!CreateGCperDepth(i))
- FatalError("failed to create scratch GCs");
- if (!CreateDefaultStipple(i))
- FatalError("failed to create default stipple");
- if (!CreateRootWindow(pScreen))
- FatalError("failed to create root window");
- }
+ if(serverGeneration == 1)
+ {
+ CreateWellKnownSockets();
+ for (i=1; i<MAXCLIENTS; i++)
+ clients[i] = NullClient;
+ serverClient = calloc(sizeof(ClientRec), 1);
+ if (!serverClient)
+ FatalError("couldn't create server client");
+ InitClient(serverClient, 0, (pointer)NULL);
+ }
+ else
+ ResetWellKnownSockets ();
+
+ clients[0] = serverClient;
+ currentMaxClients = 1;
+
+ /* Initialize privates before first allocation */
+ dixResetPrivates();
+
+ /* Initialize server client devPrivates, to be reallocated as
+ * more client privates are registered
+ */
+ if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
+ FatalError("failed to create server client privates");
+
+ if (!InitClientResources(serverClient)) /* for root resources */
+ FatalError("couldn't init server resources");
+
+ SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
+ screenInfo.numScreens = 0;
+
+ InitAtoms();
+ InitEvents();
+ InitSelections();
+ InitGlyphCaching();
+ dixResetRegistry();
+ ResetFontPrivateIndex();
+ InitCallbackManager();
+ InitOutput(&screenInfo, argc, argv);
+
+ if (screenInfo.numScreens < 1)
+ FatalError("no screens found");
+ InitExtensions(argc, argv);
- InitFonts();
- if (SetDefaultFontPath(defaultFontPath) != Success) {
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (!CreateScratchPixmapsForScreen(i))
+ FatalError("failed to create scratch pixmaps");
+ if (pScreen->CreateScreenResources &&
+ !(*pScreen->CreateScreenResources)(pScreen))
+ FatalError("failed to create screen resources");
+ if (!CreateGCperDepth(i))
+ FatalError("failed to create scratch GCs");
+ if (!CreateDefaultStipple(i))
+ FatalError("failed to create default stipple");
+ if (!CreateRootWindow(pScreen))
+ FatalError("failed to create root window");
+ }
+
+ InitFonts();
+ if (SetDefaultFontPath(defaultFontPath) != Success) {
ErrorF("[dix] failed to set default font path '%s'",
defaultFontPath);
- }
- if (!SetDefaultFont(defaultTextFont)) {
- FatalError("could not open default font '%s'", defaultTextFont);
- }
+ }
+ if (!SetDefaultFont(defaultTextFont)) {
+ FatalError("could not open default font '%s'", defaultTextFont);
+ }
- if (!(rootCursor = CreateRootCursor(NULL, 0))) {
- FatalError("could not open default cursor font '%s'",
- defaultCursorFont);
- }
+ if (!(rootCursor = CreateRootCursor(NULL, 0))) {
+ FatalError("could not open default cursor font '%s'",
+ defaultCursorFont);
+ }
#ifdef DPMSExtension
- /* check all screens, looking for DPMS Capabilities */
- DPMSCapableFlag = DPMSSupported();
- if (!DPMSCapableFlag)
- DPMSEnabled = FALSE;
+ /* check all screens, looking for DPMS Capabilities */
+ DPMSCapableFlag = DPMSSupported();
+ if (!DPMSCapableFlag)
+ DPMSEnabled = FALSE;
#endif
#ifdef PANORAMIX
- /*
- * Consolidate window and colourmap information for each screen
- */
- if (!noPanoramiXExtension)
- PanoramiXConsolidate();
+ /*
+ * Consolidate window and colourmap information for each screen
+ */
+ if (!noPanoramiXExtension)
+ PanoramiXConsolidate();
#endif
- for (i = 0; i < screenInfo.numScreens; i++)
- InitRootWindow(screenInfo.screens[i]->root);
+ for (i = 0; i < screenInfo.numScreens; i++)
+ InitRootWindow(screenInfo.screens[i]->root);
InitCoreDevices();
- InitInput(argc, argv);
- InitAndStartDevices();
- ReserveClientIds(serverClient);
+ InitInput(argc, argv);
+ InitAndStartDevices();
+ ReserveClientIds(serverClient);
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- if (!PanoramiXCreateConnectionBlock()) {
- FatalError("could not create connection block info");
- }
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXCreateConnectionBlock()) {
+ FatalError("could not create connection block info");
+ }
}
else
#endif
- {
- if (!CreateConnectionBlock()) {
- FatalError("could not create connection block info");
- }
- }
+ {
+ if (!CreateConnectionBlock()) {
+ FatalError("could not create connection block info");
+ }
+ }
#ifdef XQUARTZ
- /* Let the other threads know the server is done with its init */
- pthread_mutex_lock(&serverRunningMutex);
- serverRunning = TRUE;
- pthread_cond_broadcast(&serverRunningCond);
- pthread_mutex_unlock(&serverRunningMutex);
+ /* Let the other threads know the server is done with its init */
+ pthread_mutex_lock(&serverRunningMutex);
+ serverRunning = TRUE;
+ pthread_cond_broadcast(&serverRunningCond);
+ pthread_mutex_unlock(&serverRunningMutex);
#endif
+
+ NotifyParentProcess();
- NotifyParentProcess();
-
- Dispatch();
+ Dispatch();
#ifdef XQUARTZ
- /* Let the other threads know the server is no longer running */
- pthread_mutex_lock(&serverRunningMutex);
- serverRunning = FALSE;
- pthread_mutex_unlock(&serverRunningMutex);
+ /* Let the other threads know the server is no longer running */
+ pthread_mutex_lock(&serverRunningMutex);
+ serverRunning = FALSE;
+ pthread_mutex_unlock(&serverRunningMutex);
#endif
- UndisplayDevices();
+ UndisplayDevices();
- /* Now free up whatever must be freed */
- if (screenIsSaved == SCREEN_SAVER_ON)
- dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
- FreeScreenSaverTimer();
- CloseDownExtensions();
+ /* Now free up whatever must be freed */
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
+ FreeScreenSaverTimer();
+ CloseDownExtensions();
#ifdef PANORAMIX
- {
- Bool remember_it = noPanoramiXExtension;
+ {
+ Bool remember_it = noPanoramiXExtension;
- noPanoramiXExtension = TRUE;
- FreeAllResources();
- noPanoramiXExtension = remember_it;
- }
+ noPanoramiXExtension = TRUE;
+ FreeAllResources();
+ noPanoramiXExtension = remember_it;
+ }
#else
- FreeAllResources();
+ FreeAllResources();
#endif
CloseInput();
- for (i = 0; i < screenInfo.numScreens; i++)
- screenInfo.screens[i]->root = NullWindow;
- CloseDownDevices();
- CloseDownEvents();
+ for (i = 0; i < screenInfo.numScreens; i++)
+ screenInfo.screens[i]->root = NullWindow;
+ CloseDownDevices();
+ CloseDownEvents();
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
- FreeScratchPixmapsForScreen(i);
- FreeGCperDepth(i);
- FreeDefaultStipple(i);
- (*screenInfo.screens[i]->CloseScreen) (i, screenInfo.screens[i]);
- dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
- free(screenInfo.screens[i]);
- screenInfo.numScreens = i;
- }
+ FreeScratchPixmapsForScreen(i);
+ FreeGCperDepth(i);
+ FreeDefaultStipple(i);
+ (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
+ dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
+ free(screenInfo.screens[i]);
+ screenInfo.numScreens = i;
+ }
- ReleaseClientIds(serverClient);
- dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
- serverClient->devPrivates = NULL;
+ ReleaseClientIds(serverClient);
+ dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
+ serverClient->devPrivates = NULL;
- FreeFonts();
+ FreeFonts();
- FreeAuditTimer();
+ FreeAuditTimer();
if (dispatchException & DE_TERMINATE) {
- CloseWellKnownConnections();
- }
+ CloseWellKnownConnections();
+ }
- OsCleanup((dispatchException & DE_TERMINATE) != 0);
+ OsCleanup((dispatchException & DE_TERMINATE) != 0);
if (dispatchException & DE_TERMINATE) {
- ddxGiveUp(EXIT_NO_ERROR);
- break;
- }
+ ddxGiveUp(EXIT_NO_ERROR);
+ break;
+ }
- free(ConnectionInfo);
- ConnectionInfo = NULL;
+ free(ConnectionInfo);
+ ConnectionInfo = NULL;
}
return 0;
}
diff --git a/glx/Makefile.am b/glx/Makefile.am
index ced78b76a..15b7adc93 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -40,11 +40,8 @@ glapi_sources = \
indirect_table.c \
dispatch.h \
glapitable.h \
- glapi.c \
glapi.h \
glapi_gentable.c \
- glprocs.h \
- glthread.c \
glthread.h
libglxdri_la_SOURCES =
diff --git a/glx/extension_string.c b/glx/extension_string.c
index 866f8bf45..26c69fea5 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -82,7 +82,7 @@ static const struct extension_info known_glx_extensions[] = {
{GLX(SGIX_fbconfig), VER(1, 3), Y,},
{GLX(SGIX_pbuffer), VER(1, 3), Y,},
{GLX(SGIX_visual_select_group), VER(0, 0), Y,},
- {GLX(INTEL_swap_event), VER(1, 4), N,},
+ {GLX(INTEL_swap_event), VER(0, 0), N,},
{NULL}
};
diff --git a/glx/glapi.c b/glx/glapi.c
deleted file mode 100644
index 02e06ac1e..000000000
--- a/glx/glapi.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL 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.
- */
-
-/*
- * This file manages the OpenGL API dispatch layer. There are functions
- * to set/get the current dispatch table for the current thread and to
- * manage registration/dispatch of dynamically added extension functions.
- *
- * This code was originally general enough to be shared with Mesa, but
- * they diverged long ago, so this is now just enough support to make
- * indirect GLX work.
- */
-
-#include <dix-config.h>
-#include <X11/Xfuncproto.h>
-#include <os.h>
-#define PUBLIC _X_EXPORT
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef DEBUG
-#include <assert.h>
-#endif
-
-#include "glapi.h"
-#include "dispatch.h"
-#include "glapitable.h"
-
-#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
-
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
-static void init_glapi_relocs(void);
-#endif
-
-/**
- * \name Current dispatch and current context control variables
- *
- * Depending on whether or not multithreading is support, and the type of
- * support available, several variables are used to store the current context
- * pointer and the current dispatch table pointer. In the non-threaded case,
- * the variables \c _glapi_Dispatch and \c _glapi_Context are used for this
- * purpose.
- *
- * In the "normal" threaded case, the variables \c _glapi_Dispatch and
- * \c _glapi_Context will be \c NULL if an application is detected as being
- * multithreaded. Single-threaded applications will use \c _glapi_Dispatch
- * and \c _glapi_Context just like the case without any threading support.
- * When \c _glapi_Dispatch and \c _glapi_Context are \c NULL, the thread state
- * data \c _gl_DispatchTSD and \c ContextTSD are used. Drivers and the
- * static dispatch functions access these variables via \c _glapi_get_dispatch
- * and \c _glapi_get_context.
- *
- * In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are
- * hardcoded to \c NULL. Instead the TLS variables \c _glapi_tls_Dispatch and
- * \c _glapi_tls_Context are used. Having \c _glapi_Dispatch and
- * \c _glapi_Context be hardcoded to \c NULL maintains binary compatability
- * between TLS enabled loaders and non-TLS DRI drivers.
- */
-/*@{*/
-#if defined(GLX_USE_TLS)
-
-PUBLIC TLS struct _glapi_table *_glapi_tls_Dispatch = NULL;
-
-PUBLIC TLS void *_glapi_tls_Context;
-
-PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
-PUBLIC const void *_glapi_Context = NULL;
-
-#else
-
-#if defined(THREADS)
-
-_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
-static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
-
-#if defined(WIN32_THREADS)
-void FreeTSD(_glthread_TSD * p);
-void
-FreeAllTSD(void)
-{
- FreeTSD(&_gl_DispatchTSD);
- FreeTSD(&ContextTSD);
-}
-#endif /* defined(WIN32_THREADS) */
-
-#endif /* defined(THREADS) */
-
-PUBLIC struct _glapi_table *_glapi_Dispatch = NULL;
-PUBLIC void *_glapi_Context = NULL;
-
-#endif /* defined(GLX_USE_TLS) */
-/*@}*/
-
-/*
- * xserver's gl is not multithreaded, we promise.
- */
-PUBLIC void
-_glapi_check_multithread(void)
-{
-}
-
-/**
- * Set the current context pointer for this thread.
- * The context pointer is an opaque type which should be cast to
- * void from the real context pointer type.
- */
-PUBLIC void
-_glapi_set_context(void *context)
-{
-#if defined(GLX_USE_TLS)
- _glapi_tls_Context = context;
-#elif defined(THREADS)
- _glthread_SetTSD(&ContextTSD, context);
- _glapi_Context = context;
-#else
- _glapi_Context = context;
-#endif
-}
-
-/**
- * Get the current context pointer for this thread.
- * The context pointer is an opaque type which should be cast from
- * void to the real context pointer type.
- */
-PUBLIC void *
-_glapi_get_context(void)
-{
-#if defined(GLX_USE_TLS)
- return _glapi_tls_Context;
-#else
- return _glapi_Context;
-#endif
-}
-
-/**
- * Set the global or per-thread dispatch table pointer.
- */
-PUBLIC void
-_glapi_set_dispatch(struct _glapi_table *dispatch)
-{
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
- static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
- pthread_once(&once_control, init_glapi_relocs);
-#endif
-
-#if defined(GLX_USE_TLS)
- _glapi_tls_Dispatch = dispatch;
-#elif defined(THREADS)
- _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
- _glapi_Dispatch = dispatch;
-#else /*THREADS*/
- _glapi_Dispatch = dispatch;
-#endif /*THREADS*/
-}
-
-/**
- * Return pointer to current dispatch table for calling thread.
- */
-PUBLIC struct _glapi_table *
-_glapi_get_dispatch(void)
-{
- struct _glapi_table *api;
-
-#if defined(GLX_USE_TLS)
- api = _glapi_tls_Dispatch;
-#else
- api = _glapi_Dispatch;
-#endif
- return api;
-}
-
-/***
- *** The rest of this file is pretty much concerned with GetProcAddress
- *** functionality.
- ***/
-
-#if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS)
-#define DISPATCH_FUNCTION_SIZE 16
-#elif defined(USE_X86_ASM)
-#if defined(THREADS) && !defined(GLX_USE_TLS)
-#define DISPATCH_FUNCTION_SIZE 32
-#else
-#define DISPATCH_FUNCTION_SIZE 16
-#endif
-#endif
-
-/* The code in this file is auto-generated with Python */
-#include "glprocs.h"
-
-/**
- * Search the table of static entrypoint functions for the named function
- * and return the corresponding glprocs_table_t entry.
- */
-static const glprocs_table_t *
-find_entry(const char *n)
-{
- GLuint i;
-
- for (i = 0; static_functions[i].Name_offset >= 0; i++) {
- const char *testName =
- gl_string_table + static_functions[i].Name_offset;
- if (strcmp(testName, n) == 0) {
- return &static_functions[i];
- }
- }
- return NULL;
-}
-
-/**
- * Return dispatch table offset of the named static (built-in) function.
- * Return -1 if function not found.
- */
-static GLint
-get_static_proc_offset(const char *funcName)
-{
- const glprocs_table_t *const f = find_entry(funcName);
-
- if (f) {
- return f->Offset;
- }
- return -1;
-}
-
-/**********************************************************************
- * Extension function management.
- */
-
-/*
- * Number of extension functions which we can dynamically add at runtime.
- */
-#define MAX_EXTENSION_FUNCS 300
-
-/*
- * The dispatch table size (number of entries) is the size of the
- * _glapi_table struct plus the number of dynamic entries we can add.
- * The extra slots can be filled in by DRI drivers that register new extension
- * functions.
- */
-#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
-
-/**
- * Track information about a function added to the GL API.
- */
-struct _glapi_function {
- /**
- * Name of the function.
- */
- const char *name;
-
- /**
- * Text string that describes the types of the parameters passed to the
- * named function. Parameter types are converted to characters using the
- * following rules:
- * - 'i' for \c GLint, \c GLuint, and \c GLenum
- * - 'p' for any pointer type
- * - 'f' for \c GLfloat and \c GLclampf
- * - 'd' for \c GLdouble and \c GLclampd
- */
- const char *parameter_signature;
-
- /**
- * Offset in the dispatch table where the pointer to the real function is
- * located. If the driver has not requested that the named function be
- * added to the dispatch table, this will have the value ~0.
- */
- unsigned dispatch_offset;
-};
-
-static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
-static GLuint NumExtEntryPoints = 0;
-
-/**
- * Generate new entrypoint
- *
- * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver
- * calls \c _glapi_add_dispatch we'll put in the proper offset. If that
- * never happens, and the user calls this function, he'll segfault. That's
- * what you get when you try calling a GL function that doesn't really exist.
- *
- * \param funcName Name of the function to create an entry-point for.
- *
- * \sa _glapi_add_entrypoint
- */
-
-static struct _glapi_function *
-add_function_name(const char *funcName)
-{
- struct _glapi_function *entry = NULL;
-
- if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
- entry = &ExtEntryTable[NumExtEntryPoints];
-
- ExtEntryTable[NumExtEntryPoints].name = strdup(funcName);
- ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
- ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
- NumExtEntryPoints++;
- }
-
- return entry;
-}
-
-/**
- * Fill-in the dispatch stub for the named function.
- *
- * This function is intended to be called by a hardware driver. When called,
- * a dispatch stub may be created created for the function. A pointer to this
- * dispatch function will be returned by glXGetProcAddress.
- *
- * \param function_names Array of pointers to function names that should
- * share a common dispatch offset.
- * \param parameter_signature String representing the types of the parameters
- * passed to the named function. Parameter types
- * are converted to characters using the following
- * rules:
- * - 'i' for \c GLint, \c GLuint, and \c GLenum
- * - 'p' for any pointer type
- * - 'f' for \c GLfloat and \c GLclampf
- * - 'd' for \c GLdouble and \c GLclampd
- *
- * \returns
- * The offset in the dispatch table of the named function. A pointer to the
- * driver's implementation of the named function should be stored at
- * \c dispatch_table[\c offset].
- *
- * \sa glXGetProcAddress
- *
- * \warning
- * This function can only handle up to 8 names at a time. As far as I know,
- * the maximum number of names ever associated with an existing GL function is
- * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT,
- * \c glPointParameterfARB, and \c glPointParameterf), so this should not be
- * too painful of a limitation.
- *
- * \todo
- * Determine whether or not \c parameter_signature should be allowed to be
- * \c NULL. It doesn't seem like much of a hardship for drivers to have to
- * pass in an empty string.
- *
- * \todo
- * Determine if code should be added to reject function names that start with
- * 'glX'.
- *
- * \bug
- * Add code to compare \c parameter_signature with the parameter signature of
- * a static function. In order to do that, we need to find a way to \b get
- * the parameter signature of a static function.
- */
-
-PUBLIC int
-_glapi_add_dispatch(const char *const *function_names,
- const char *parameter_signature)
-{
- static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
- const char *const real_sig = (parameter_signature != NULL)
- ? parameter_signature : "";
- struct _glapi_function *entry[8];
- GLboolean is_static[8];
- unsigned i;
- unsigned j;
- int offset = ~0;
- int new_offset;
-
- (void) memset(is_static, 0, sizeof(is_static));
- (void) memset(entry, 0, sizeof(entry));
-
- for (i = 0; function_names[i] != NULL; i++) {
- /* Do some trivial validation on the name of the function. */
-
- if (function_names[i][0] != 'g' || function_names[i][1] != 'l')
- return GL_FALSE;
-
- /* Determine if the named function already exists. If the function does
- * exist, it must have the same parameter signature as the function
- * being added.
- */
-
- new_offset = get_static_proc_offset(function_names[i]);
- if (new_offset >= 0) {
- /* FIXME: Make sure the parameter signatures match! How do we get
- * FIXME: the parameter signature for static functions?
- */
-
- if ((offset != ~0) && (new_offset != offset)) {
- return -1;
- }
-
- is_static[i] = GL_TRUE;
- offset = new_offset;
- }
-
- for (j = 0; j < NumExtEntryPoints; j++) {
- if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) {
- /* The offset may be ~0 if the function name was added by
- * glXGetProcAddress but never filled in by the driver.
- */
-
- if (ExtEntryTable[j].dispatch_offset != ~0) {
- if (strcmp(real_sig, ExtEntryTable[j].parameter_signature)
- != 0)
- return -1;
-
- if ((offset != ~0) &&
- (ExtEntryTable[j].dispatch_offset != offset)) {
- return -1;
- }
-
- offset = ExtEntryTable[j].dispatch_offset;
- }
-
- entry[i] = &ExtEntryTable[j];
- break;
- }
- }
- }
-
- if (offset == ~0) {
- offset = next_dynamic_offset;
- next_dynamic_offset++;
- }
-
- for (i = 0; function_names[i] != NULL; i++) {
- if (!is_static[i]) {
- if (entry[i] == NULL) {
- entry[i] = add_function_name(function_names[i]);
- if (entry[i] == NULL)
- return -1;
- }
-
- entry[i]->parameter_signature = strdup(real_sig);
- entry[i]->dispatch_offset = offset;
- }
- }
-
- return offset;
-}
-
-/*
- * glXGetProcAddress doesn't exist in the protocol, the drivers never call
- * this themselves, and neither does the server. warn if it happens though.
- */
-PUBLIC _glapi_proc
-_glapi_get_proc_address(const char *funcName)
-{
- ErrorF("_glapi_get_proc_address called!\n");
- return NULL;
-}
-
-/**
- * Return size of dispatch table struct as number of functions (or
- * slots).
- */
-PUBLIC GLuint
-_glapi_get_dispatch_table_size(void)
-{
- return DISPATCH_TABLE_SIZE;
-}
-
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
-/**
- * Perform platform-specific GL API entry-point fixups.
- */
-static void
-init_glapi_relocs(void)
-{
-#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
- extern unsigned long _x86_get_dispatch(void);
-
- char run_time_patch[] = {
- 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
- };
- GLuint *offset = (GLuint *) & run_time_patch[2]; /* 32-bits for x86/32 */
- const GLubyte *const get_disp = (const GLubyte *) run_time_patch;
- GLubyte *curr_func = (GLubyte *) gl_dispatch_functions_start;
-
- *offset = _x86_get_dispatch();
- while (curr_func != (GLubyte *) gl_dispatch_functions_end) {
- (void) memcpy(curr_func, get_disp, sizeof(run_time_patch));
- curr_func += DISPATCH_FUNCTION_SIZE;
- }
-#endif
-}
-#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
diff --git a/glx/glprocs.h b/glx/glprocs.h
deleted file mode 100644
index 87063642c..000000000
--- a/glx/glprocs.h
+++ /dev/null
@@ -1,3534 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- * (C) Copyright IBM Corporation 2004, 2006
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* This file is only included by glapi.c and is used for
- * the GetProcAddress() function
- */
-
-typedef struct {
- GLint Name_offset;
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
- _glapi_proc Address;
-#endif
- GLuint Offset;
-} glprocs_table_t;
-
-#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
-#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
-#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
-#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
-#endif
-
-static const char gl_string_table[] =
- "glNewList\0"
- "glEndList\0"
- "glCallList\0"
- "glCallLists\0"
- "glDeleteLists\0"
- "glGenLists\0"
- "glListBase\0"
- "glBegin\0"
- "glBitmap\0"
- "glColor3b\0"
- "glColor3bv\0"
- "glColor3d\0"
- "glColor3dv\0"
- "glColor3f\0"
- "glColor3fv\0"
- "glColor3i\0"
- "glColor3iv\0"
- "glColor3s\0"
- "glColor3sv\0"
- "glColor3ub\0"
- "glColor3ubv\0"
- "glColor3ui\0"
- "glColor3uiv\0"
- "glColor3us\0"
- "glColor3usv\0"
- "glColor4b\0"
- "glColor4bv\0"
- "glColor4d\0"
- "glColor4dv\0"
- "glColor4f\0"
- "glColor4fv\0"
- "glColor4i\0"
- "glColor4iv\0"
- "glColor4s\0"
- "glColor4sv\0"
- "glColor4ub\0"
- "glColor4ubv\0"
- "glColor4ui\0"
- "glColor4uiv\0"
- "glColor4us\0"
- "glColor4usv\0"
- "glEdgeFlag\0"
- "glEdgeFlagv\0"
- "glEnd\0"
- "glIndexd\0"
- "glIndexdv\0"
- "glIndexf\0"
- "glIndexfv\0"
- "glIndexi\0"
- "glIndexiv\0"
- "glIndexs\0"
- "glIndexsv\0"
- "glNormal3b\0"
- "glNormal3bv\0"
- "glNormal3d\0"
- "glNormal3dv\0"
- "glNormal3f\0"
- "glNormal3fv\0"
- "glNormal3i\0"
- "glNormal3iv\0"
- "glNormal3s\0"
- "glNormal3sv\0"
- "glRasterPos2d\0"
- "glRasterPos2dv\0"
- "glRasterPos2f\0"
- "glRasterPos2fv\0"
- "glRasterPos2i\0"
- "glRasterPos2iv\0"
- "glRasterPos2s\0"
- "glRasterPos2sv\0"
- "glRasterPos3d\0"
- "glRasterPos3dv\0"
- "glRasterPos3f\0"
- "glRasterPos3fv\0"
- "glRasterPos3i\0"
- "glRasterPos3iv\0"
- "glRasterPos3s\0"
- "glRasterPos3sv\0"
- "glRasterPos4d\0"
- "glRasterPos4dv\0"
- "glRasterPos4f\0"
- "glRasterPos4fv\0"
- "glRasterPos4i\0"
- "glRasterPos4iv\0"
- "glRasterPos4s\0"
- "glRasterPos4sv\0"
- "glRectd\0"
- "glRectdv\0"
- "glRectf\0"
- "glRectfv\0"
- "glRecti\0"
- "glRectiv\0"
- "glRects\0"
- "glRectsv\0"
- "glTexCoord1d\0"
- "glTexCoord1dv\0"
- "glTexCoord1f\0"
- "glTexCoord1fv\0"
- "glTexCoord1i\0"
- "glTexCoord1iv\0"
- "glTexCoord1s\0"
- "glTexCoord1sv\0"
- "glTexCoord2d\0"
- "glTexCoord2dv\0"
- "glTexCoord2f\0"
- "glTexCoord2fv\0"
- "glTexCoord2i\0"
- "glTexCoord2iv\0"
- "glTexCoord2s\0"
- "glTexCoord2sv\0"
- "glTexCoord3d\0"
- "glTexCoord3dv\0"
- "glTexCoord3f\0"
- "glTexCoord3fv\0"
- "glTexCoord3i\0"
- "glTexCoord3iv\0"
- "glTexCoord3s\0"
- "glTexCoord3sv\0"
- "glTexCoord4d\0"
- "glTexCoord4dv\0"
- "glTexCoord4f\0"
- "glTexCoord4fv\0"
- "glTexCoord4i\0"
- "glTexCoord4iv\0"
- "glTexCoord4s\0"
- "glTexCoord4sv\0"
- "glVertex2d\0"
- "glVertex2dv\0"
- "glVertex2f\0"
- "glVertex2fv\0"
- "glVertex2i\0"
- "glVertex2iv\0"
- "glVertex2s\0"
- "glVertex2sv\0"
- "glVertex3d\0"
- "glVertex3dv\0"
- "glVertex3f\0"
- "glVertex3fv\0"
- "glVertex3i\0"
- "glVertex3iv\0"
- "glVertex3s\0"
- "glVertex3sv\0"
- "glVertex4d\0"
- "glVertex4dv\0"
- "glVertex4f\0"
- "glVertex4fv\0"
- "glVertex4i\0"
- "glVertex4iv\0"
- "glVertex4s\0"
- "glVertex4sv\0"
- "glClipPlane\0"
- "glColorMaterial\0"
- "glCullFace\0"
- "glFogf\0"
- "glFogfv\0"
- "glFogi\0"
- "glFogiv\0"
- "glFrontFace\0"
- "glHint\0"
- "glLightf\0"
- "glLightfv\0"
- "glLighti\0"
- "glLightiv\0"
- "glLightModelf\0"
- "glLightModelfv\0"
- "glLightModeli\0"
- "glLightModeliv\0"
- "glLineStipple\0"
- "glLineWidth\0"
- "glMaterialf\0"
- "glMaterialfv\0"
- "glMateriali\0"
- "glMaterialiv\0"
- "glPointSize\0"
- "glPolygonMode\0"
- "glPolygonStipple\0"
- "glScissor\0"
- "glShadeModel\0"
- "glTexParameterf\0"
- "glTexParameterfv\0"
- "glTexParameteri\0"
- "glTexParameteriv\0"
- "glTexImage1D\0"
- "glTexImage2D\0"
- "glTexEnvf\0"
- "glTexEnvfv\0"
- "glTexEnvi\0"
- "glTexEnviv\0"
- "glTexGend\0"
- "glTexGendv\0"
- "glTexGenf\0"
- "glTexGenfv\0"
- "glTexGeni\0"
- "glTexGeniv\0"
- "glFeedbackBuffer\0"
- "glSelectBuffer\0"
- "glRenderMode\0"
- "glInitNames\0"
- "glLoadName\0"
- "glPassThrough\0"
- "glPopName\0"
- "glPushName\0"
- "glDrawBuffer\0"
- "glClear\0"
- "glClearAccum\0"
- "glClearIndex\0"
- "glClearColor\0"
- "glClearStencil\0"
- "glClearDepth\0"
- "glStencilMask\0"
- "glColorMask\0"
- "glDepthMask\0"
- "glIndexMask\0"
- "glAccum\0"
- "glDisable\0"
- "glEnable\0"
- "glFinish\0"
- "glFlush\0"
- "glPopAttrib\0"
- "glPushAttrib\0"
- "glMap1d\0"
- "glMap1f\0"
- "glMap2d\0"
- "glMap2f\0"
- "glMapGrid1d\0"
- "glMapGrid1f\0"
- "glMapGrid2d\0"
- "glMapGrid2f\0"
- "glEvalCoord1d\0"
- "glEvalCoord1dv\0"
- "glEvalCoord1f\0"
- "glEvalCoord1fv\0"
- "glEvalCoord2d\0"
- "glEvalCoord2dv\0"
- "glEvalCoord2f\0"
- "glEvalCoord2fv\0"
- "glEvalMesh1\0"
- "glEvalPoint1\0"
- "glEvalMesh2\0"
- "glEvalPoint2\0"
- "glAlphaFunc\0"
- "glBlendFunc\0"
- "glLogicOp\0"
- "glStencilFunc\0"
- "glStencilOp\0"
- "glDepthFunc\0"
- "glPixelZoom\0"
- "glPixelTransferf\0"
- "glPixelTransferi\0"
- "glPixelStoref\0"
- "glPixelStorei\0"
- "glPixelMapfv\0"
- "glPixelMapuiv\0"
- "glPixelMapusv\0"
- "glReadBuffer\0"
- "glCopyPixels\0"
- "glReadPixels\0"
- "glDrawPixels\0"
- "glGetBooleanv\0"
- "glGetClipPlane\0"
- "glGetDoublev\0"
- "glGetError\0"
- "glGetFloatv\0"
- "glGetIntegerv\0"
- "glGetLightfv\0"
- "glGetLightiv\0"
- "glGetMapdv\0"
- "glGetMapfv\0"
- "glGetMapiv\0"
- "glGetMaterialfv\0"
- "glGetMaterialiv\0"
- "glGetPixelMapfv\0"
- "glGetPixelMapuiv\0"
- "glGetPixelMapusv\0"
- "glGetPolygonStipple\0"
- "glGetString\0"
- "glGetTexEnvfv\0"
- "glGetTexEnviv\0"
- "glGetTexGendv\0"
- "glGetTexGenfv\0"
- "glGetTexGeniv\0"
- "glGetTexImage\0"
- "glGetTexParameterfv\0"
- "glGetTexParameteriv\0"
- "glGetTexLevelParameterfv\0"
- "glGetTexLevelParameteriv\0"
- "glIsEnabled\0"
- "glIsList\0"
- "glDepthRange\0"
- "glFrustum\0"
- "glLoadIdentity\0"
- "glLoadMatrixf\0"
- "glLoadMatrixd\0"
- "glMatrixMode\0"
- "glMultMatrixf\0"
- "glMultMatrixd\0"
- "glOrtho\0"
- "glPopMatrix\0"
- "glPushMatrix\0"
- "glRotated\0"
- "glRotatef\0"
- "glScaled\0"
- "glScalef\0"
- "glTranslated\0"
- "glTranslatef\0"
- "glViewport\0"
- "glArrayElement\0"
- "glBindTexture\0"
- "glColorPointer\0"
- "glDisableClientState\0"
- "glDrawArrays\0"
- "glDrawElements\0"
- "glEdgeFlagPointer\0"
- "glEnableClientState\0"
- "glIndexPointer\0"
- "glIndexub\0"
- "glIndexubv\0"
- "glInterleavedArrays\0"
- "glNormalPointer\0"
- "glPolygonOffset\0"
- "glTexCoordPointer\0"
- "glVertexPointer\0"
- "glAreTexturesResident\0"
- "glCopyTexImage1D\0"
- "glCopyTexImage2D\0"
- "glCopyTexSubImage1D\0"
- "glCopyTexSubImage2D\0"
- "glDeleteTextures\0"
- "glGenTextures\0"
- "glGetPointerv\0"
- "glIsTexture\0"
- "glPrioritizeTextures\0"
- "glTexSubImage1D\0"
- "glTexSubImage2D\0"
- "glPopClientAttrib\0"
- "glPushClientAttrib\0"
- "glBlendColor\0"
- "glBlendEquation\0"
- "glDrawRangeElements\0"
- "glColorTable\0"
- "glColorTableParameterfv\0"
- "glColorTableParameteriv\0"
- "glCopyColorTable\0"
- "glGetColorTable\0"
- "glGetColorTableParameterfv\0"
- "glGetColorTableParameteriv\0"
- "glColorSubTable\0"
- "glCopyColorSubTable\0"
- "glConvolutionFilter1D\0"
- "glConvolutionFilter2D\0"
- "glConvolutionParameterf\0"
- "glConvolutionParameterfv\0"
- "glConvolutionParameteri\0"
- "glConvolutionParameteriv\0"
- "glCopyConvolutionFilter1D\0"
- "glCopyConvolutionFilter2D\0"
- "glGetConvolutionFilter\0"
- "glGetConvolutionParameterfv\0"
- "glGetConvolutionParameteriv\0"
- "glGetSeparableFilter\0"
- "glSeparableFilter2D\0"
- "glGetHistogram\0"
- "glGetHistogramParameterfv\0"
- "glGetHistogramParameteriv\0"
- "glGetMinmax\0"
- "glGetMinmaxParameterfv\0"
- "glGetMinmaxParameteriv\0"
- "glHistogram\0"
- "glMinmax\0"
- "glResetHistogram\0"
- "glResetMinmax\0"
- "glTexImage3D\0"
- "glTexSubImage3D\0"
- "glCopyTexSubImage3D\0"
- "glActiveTextureARB\0"
- "glClientActiveTextureARB\0"
- "glMultiTexCoord1dARB\0"
- "glMultiTexCoord1dvARB\0"
- "glMultiTexCoord1fARB\0"
- "glMultiTexCoord1fvARB\0"
- "glMultiTexCoord1iARB\0"
- "glMultiTexCoord1ivARB\0"
- "glMultiTexCoord1sARB\0"
- "glMultiTexCoord1svARB\0"
- "glMultiTexCoord2dARB\0"
- "glMultiTexCoord2dvARB\0"
- "glMultiTexCoord2fARB\0"
- "glMultiTexCoord2fvARB\0"
- "glMultiTexCoord2iARB\0"
- "glMultiTexCoord2ivARB\0"
- "glMultiTexCoord2sARB\0"
- "glMultiTexCoord2svARB\0"
- "glMultiTexCoord3dARB\0"
- "glMultiTexCoord3dvARB\0"
- "glMultiTexCoord3fARB\0"
- "glMultiTexCoord3fvARB\0"
- "glMultiTexCoord3iARB\0"
- "glMultiTexCoord3ivARB\0"
- "glMultiTexCoord3sARB\0"
- "glMultiTexCoord3svARB\0"
- "glMultiTexCoord4dARB\0"
- "glMultiTexCoord4dvARB\0"
- "glMultiTexCoord4fARB\0"
- "glMultiTexCoord4fvARB\0"
- "glMultiTexCoord4iARB\0"
- "glMultiTexCoord4ivARB\0"
- "glMultiTexCoord4sARB\0"
- "glMultiTexCoord4svARB\0"
- "glAttachShader\0"
- "glCreateProgram\0"
- "glCreateShader\0"
- "glDeleteProgram\0"
- "glDeleteShader\0"
- "glDetachShader\0"
- "glGetAttachedShaders\0"
- "glGetProgramInfoLog\0"
- "glGetProgramiv\0"
- "glGetShaderInfoLog\0"
- "glGetShaderiv\0"
- "glIsProgram\0"
- "glIsShader\0"
- "glStencilFuncSeparate\0"
- "glStencilMaskSeparate\0"
- "glStencilOpSeparate\0"
- "glUniformMatrix2x3fv\0"
- "glUniformMatrix2x4fv\0"
- "glUniformMatrix3x2fv\0"
- "glUniformMatrix3x4fv\0"
- "glUniformMatrix4x2fv\0"
- "glUniformMatrix4x3fv\0"
- "glClampColor\0"
- "glClearBufferfi\0"
- "glClearBufferfv\0"
- "glClearBufferiv\0"
- "glClearBufferuiv\0"
- "glGetStringi\0"
- "glTexBuffer\0"
- "glFramebufferTexture\0"
- "glGetBufferParameteri64v\0"
- "glGetInteger64i_v\0"
- "glVertexAttribDivisor\0"
- "glLoadTransposeMatrixdARB\0"
- "glLoadTransposeMatrixfARB\0"
- "glMultTransposeMatrixdARB\0"
- "glMultTransposeMatrixfARB\0"
- "glSampleCoverageARB\0"
- "glCompressedTexImage1DARB\0"
- "glCompressedTexImage2DARB\0"
- "glCompressedTexImage3DARB\0"
- "glCompressedTexSubImage1DARB\0"
- "glCompressedTexSubImage2DARB\0"
- "glCompressedTexSubImage3DARB\0"
- "glGetCompressedTexImageARB\0"
- "glDisableVertexAttribArrayARB\0"
- "glEnableVertexAttribArrayARB\0"
- "glGetProgramEnvParameterdvARB\0"
- "glGetProgramEnvParameterfvARB\0"
- "glGetProgramLocalParameterdvARB\0"
- "glGetProgramLocalParameterfvARB\0"
- "glGetProgramStringARB\0"
- "glGetProgramivARB\0"
- "glGetVertexAttribdvARB\0"
- "glGetVertexAttribfvARB\0"
- "glGetVertexAttribivARB\0"
- "glProgramEnvParameter4dARB\0"
- "glProgramEnvParameter4dvARB\0"
- "glProgramEnvParameter4fARB\0"
- "glProgramEnvParameter4fvARB\0"
- "glProgramLocalParameter4dARB\0"
- "glProgramLocalParameter4dvARB\0"
- "glProgramLocalParameter4fARB\0"
- "glProgramLocalParameter4fvARB\0"
- "glProgramStringARB\0"
- "glVertexAttrib1dARB\0"
- "glVertexAttrib1dvARB\0"
- "glVertexAttrib1fARB\0"
- "glVertexAttrib1fvARB\0"
- "glVertexAttrib1sARB\0"
- "glVertexAttrib1svARB\0"
- "glVertexAttrib2dARB\0"
- "glVertexAttrib2dvARB\0"
- "glVertexAttrib2fARB\0"
- "glVertexAttrib2fvARB\0"
- "glVertexAttrib2sARB\0"
- "glVertexAttrib2svARB\0"
- "glVertexAttrib3dARB\0"
- "glVertexAttrib3dvARB\0"
- "glVertexAttrib3fARB\0"
- "glVertexAttrib3fvARB\0"
- "glVertexAttrib3sARB\0"
- "glVertexAttrib3svARB\0"
- "glVertexAttrib4NbvARB\0"
- "glVertexAttrib4NivARB\0"
- "glVertexAttrib4NsvARB\0"
- "glVertexAttrib4NubARB\0"
- "glVertexAttrib4NubvARB\0"
- "glVertexAttrib4NuivARB\0"
- "glVertexAttrib4NusvARB\0"
- "glVertexAttrib4bvARB\0"
- "glVertexAttrib4dARB\0"
- "glVertexAttrib4dvARB\0"
- "glVertexAttrib4fARB\0"
- "glVertexAttrib4fvARB\0"
- "glVertexAttrib4ivARB\0"
- "glVertexAttrib4sARB\0"
- "glVertexAttrib4svARB\0"
- "glVertexAttrib4ubvARB\0"
- "glVertexAttrib4uivARB\0"
- "glVertexAttrib4usvARB\0"
- "glVertexAttribPointerARB\0"
- "glBindBufferARB\0"
- "glBufferDataARB\0"
- "glBufferSubDataARB\0"
- "glDeleteBuffersARB\0"
- "glGenBuffersARB\0"
- "glGetBufferParameterivARB\0"
- "glGetBufferPointervARB\0"
- "glGetBufferSubDataARB\0"
- "glIsBufferARB\0"
- "glMapBufferARB\0"
- "glUnmapBufferARB\0"
- "glBeginQueryARB\0"
- "glDeleteQueriesARB\0"
- "glEndQueryARB\0"
- "glGenQueriesARB\0"
- "glGetQueryObjectivARB\0"
- "glGetQueryObjectuivARB\0"
- "glGetQueryivARB\0"
- "glIsQueryARB\0"
- "glAttachObjectARB\0"
- "glCompileShaderARB\0"
- "glCreateProgramObjectARB\0"
- "glCreateShaderObjectARB\0"
- "glDeleteObjectARB\0"
- "glDetachObjectARB\0"
- "glGetActiveUniformARB\0"
- "glGetAttachedObjectsARB\0"
- "glGetHandleARB\0"
- "glGetInfoLogARB\0"
- "glGetObjectParameterfvARB\0"
- "glGetObjectParameterivARB\0"
- "glGetShaderSourceARB\0"
- "glGetUniformLocationARB\0"
- "glGetUniformfvARB\0"
- "glGetUniformivARB\0"
- "glLinkProgramARB\0"
- "glShaderSourceARB\0"
- "glUniform1fARB\0"
- "glUniform1fvARB\0"
- "glUniform1iARB\0"
- "glUniform1ivARB\0"
- "glUniform2fARB\0"
- "glUniform2fvARB\0"
- "glUniform2iARB\0"
- "glUniform2ivARB\0"
- "glUniform3fARB\0"
- "glUniform3fvARB\0"
- "glUniform3iARB\0"
- "glUniform3ivARB\0"
- "glUniform4fARB\0"
- "glUniform4fvARB\0"
- "glUniform4iARB\0"
- "glUniform4ivARB\0"
- "glUniformMatrix2fvARB\0"
- "glUniformMatrix3fvARB\0"
- "glUniformMatrix4fvARB\0"
- "glUseProgramObjectARB\0"
- "glValidateProgramARB\0"
- "glBindAttribLocationARB\0"
- "glGetActiveAttribARB\0"
- "glGetAttribLocationARB\0"
- "glDrawBuffersARB\0"
- "glClampColorARB\0"
- "glDrawArraysInstancedARB\0"
- "glDrawElementsInstancedARB\0"
- "glRenderbufferStorageMultisample\0"
- "glFramebufferTextureARB\0"
- "glFramebufferTextureFaceARB\0"
- "glProgramParameteriARB\0"
- "glVertexAttribDivisorARB\0"
- "glFlushMappedBufferRange\0"
- "glMapBufferRange\0"
- "glTexBufferARB\0"
- "glBindVertexArray\0"
- "glGenVertexArrays\0"
- "glCopyBufferSubData\0"
- "glClientWaitSync\0"
- "glDeleteSync\0"
- "glFenceSync\0"
- "glGetInteger64v\0"
- "glGetSynciv\0"
- "glIsSync\0"
- "glWaitSync\0"
- "glDrawElementsBaseVertex\0"
- "glDrawElementsInstancedBaseVertex\0"
- "glDrawRangeElementsBaseVertex\0"
- "glMultiDrawElementsBaseVertex\0"
- "glBlendEquationSeparateiARB\0"
- "glBlendEquationiARB\0"
- "glBlendFuncSeparateiARB\0"
- "glBlendFunciARB\0"
- "glBindSampler\0"
- "glDeleteSamplers\0"
- "glGenSamplers\0"
- "glGetSamplerParameterIiv\0"
- "glGetSamplerParameterIuiv\0"
- "glGetSamplerParameterfv\0"
- "glGetSamplerParameteriv\0"
- "glIsSampler\0"
- "glSamplerParameterIiv\0"
- "glSamplerParameterIuiv\0"
- "glSamplerParameterf\0"
- "glSamplerParameterfv\0"
- "glSamplerParameteri\0"
- "glSamplerParameteriv\0"
- "glColorP3ui\0"
- "glColorP3uiv\0"
- "glColorP4ui\0"
- "glColorP4uiv\0"
- "glMultiTexCoordP1ui\0"
- "glMultiTexCoordP1uiv\0"
- "glMultiTexCoordP2ui\0"
- "glMultiTexCoordP2uiv\0"
- "glMultiTexCoordP3ui\0"
- "glMultiTexCoordP3uiv\0"
- "glMultiTexCoordP4ui\0"
- "glMultiTexCoordP4uiv\0"
- "glNormalP3ui\0"
- "glNormalP3uiv\0"
- "glSecondaryColorP3ui\0"
- "glSecondaryColorP3uiv\0"
- "glTexCoordP1ui\0"
- "glTexCoordP1uiv\0"
- "glTexCoordP2ui\0"
- "glTexCoordP2uiv\0"
- "glTexCoordP3ui\0"
- "glTexCoordP3uiv\0"
- "glTexCoordP4ui\0"
- "glTexCoordP4uiv\0"
- "glVertexAttribP1ui\0"
- "glVertexAttribP1uiv\0"
- "glVertexAttribP2ui\0"
- "glVertexAttribP2uiv\0"
- "glVertexAttribP3ui\0"
- "glVertexAttribP3uiv\0"
- "glVertexAttribP4ui\0"
- "glVertexAttribP4uiv\0"
- "glVertexP2ui\0"
- "glVertexP2uiv\0"
- "glVertexP3ui\0"
- "glVertexP3uiv\0"
- "glVertexP4ui\0"
- "glVertexP4uiv\0"
- "glBindTransformFeedback\0"
- "glDeleteTransformFeedbacks\0"
- "glDrawTransformFeedback\0"
- "glGenTransformFeedbacks\0"
- "glIsTransformFeedback\0"
- "glPauseTransformFeedback\0"
- "glResumeTransformFeedback\0"
- "glClearDepthf\0"
- "glDepthRangef\0"
- "glGetShaderPrecisionFormat\0"
- "glReleaseShaderCompiler\0"
- "glShaderBinary\0"
- "glGetGraphicsResetStatusARB\0"
- "glGetnColorTableARB\0"
- "glGetnCompressedTexImageARB\0"
- "glGetnConvolutionFilterARB\0"
- "glGetnHistogramARB\0"
- "glGetnMapdvARB\0"
- "glGetnMapfvARB\0"
- "glGetnMapivARB\0"
- "glGetnMinmaxARB\0"
- "glGetnPixelMapfvARB\0"
- "glGetnPixelMapuivARB\0"
- "glGetnPixelMapusvARB\0"
- "glGetnPolygonStippleARB\0"
- "glGetnSeparableFilterARB\0"
- "glGetnTexImageARB\0"
- "glGetnUniformdvARB\0"
- "glGetnUniformfvARB\0"
- "glGetnUniformivARB\0"
- "glGetnUniformuivARB\0"
- "glReadnPixelsARB\0"
- "glTexStorage1D\0"
- "glTexStorage2D\0"
- "glTexStorage3D\0"
- "glTextureStorage1DEXT\0"
- "glTextureStorage2DEXT\0"
- "glTextureStorage3DEXT\0"
- "glPolygonOffsetEXT\0"
- "glGetPixelTexGenParameterfvSGIS\0"
- "glGetPixelTexGenParameterivSGIS\0"
- "glPixelTexGenParameterfSGIS\0"
- "glPixelTexGenParameterfvSGIS\0"
- "glPixelTexGenParameteriSGIS\0"
- "glPixelTexGenParameterivSGIS\0"
- "glSampleMaskSGIS\0"
- "glSamplePatternSGIS\0"
- "glColorPointerEXT\0"
- "glEdgeFlagPointerEXT\0"
- "glIndexPointerEXT\0"
- "glNormalPointerEXT\0"
- "glTexCoordPointerEXT\0"
- "glVertexPointerEXT\0"
- "glPointParameterfEXT\0"
- "glPointParameterfvEXT\0"
- "glLockArraysEXT\0"
- "glUnlockArraysEXT\0"
- "glSecondaryColor3bEXT\0"
- "glSecondaryColor3bvEXT\0"
- "glSecondaryColor3dEXT\0"
- "glSecondaryColor3dvEXT\0"
- "glSecondaryColor3fEXT\0"
- "glSecondaryColor3fvEXT\0"
- "glSecondaryColor3iEXT\0"
- "glSecondaryColor3ivEXT\0"
- "glSecondaryColor3sEXT\0"
- "glSecondaryColor3svEXT\0"
- "glSecondaryColor3ubEXT\0"
- "glSecondaryColor3ubvEXT\0"
- "glSecondaryColor3uiEXT\0"
- "glSecondaryColor3uivEXT\0"
- "glSecondaryColor3usEXT\0"
- "glSecondaryColor3usvEXT\0"
- "glSecondaryColorPointerEXT\0"
- "glMultiDrawArraysEXT\0"
- "glMultiDrawElementsEXT\0"
- "glFogCoordPointerEXT\0"
- "glFogCoorddEXT\0"
- "glFogCoorddvEXT\0"
- "glFogCoordfEXT\0"
- "glFogCoordfvEXT\0"
- "glPixelTexGenSGIX\0"
- "glBlendFuncSeparateEXT\0"
- "glFlushVertexArrayRangeNV\0"
- "glVertexArrayRangeNV\0"
- "glCombinerInputNV\0"
- "glCombinerOutputNV\0"
- "glCombinerParameterfNV\0"
- "glCombinerParameterfvNV\0"
- "glCombinerParameteriNV\0"
- "glCombinerParameterivNV\0"
- "glFinalCombinerInputNV\0"
- "glGetCombinerInputParameterfvNV\0"
- "glGetCombinerInputParameterivNV\0"
- "glGetCombinerOutputParameterfvNV\0"
- "glGetCombinerOutputParameterivNV\0"
- "glGetFinalCombinerInputParameterfvNV\0"
- "glGetFinalCombinerInputParameterivNV\0"
- "glResizeBuffersMESA\0"
- "glWindowPos2dMESA\0"
- "glWindowPos2dvMESA\0"
- "glWindowPos2fMESA\0"
- "glWindowPos2fvMESA\0"
- "glWindowPos2iMESA\0"
- "glWindowPos2ivMESA\0"
- "glWindowPos2sMESA\0"
- "glWindowPos2svMESA\0"
- "glWindowPos3dMESA\0"
- "glWindowPos3dvMESA\0"
- "glWindowPos3fMESA\0"
- "glWindowPos3fvMESA\0"
- "glWindowPos3iMESA\0"
- "glWindowPos3ivMESA\0"
- "glWindowPos3sMESA\0"
- "glWindowPos3svMESA\0"
- "glWindowPos4dMESA\0"
- "glWindowPos4dvMESA\0"
- "glWindowPos4fMESA\0"
- "glWindowPos4fvMESA\0"
- "glWindowPos4iMESA\0"
- "glWindowPos4ivMESA\0"
- "glWindowPos4sMESA\0"
- "glWindowPos4svMESA\0"
- "glMultiModeDrawArraysIBM\0"
- "glMultiModeDrawElementsIBM\0"
- "glDeleteFencesNV\0"
- "glFinishFenceNV\0"
- "glGenFencesNV\0"
- "glGetFenceivNV\0"
- "glIsFenceNV\0"
- "glSetFenceNV\0"
- "glTestFenceNV\0"
- "glAreProgramsResidentNV\0"
- "glBindProgramNV\0"
- "glDeleteProgramsNV\0"
- "glExecuteProgramNV\0"
- "glGenProgramsNV\0"
- "glGetProgramParameterdvNV\0"
- "glGetProgramParameterfvNV\0"
- "glGetProgramStringNV\0"
- "glGetProgramivNV\0"
- "glGetTrackMatrixivNV\0"
- "glGetVertexAttribPointervNV\0"
- "glGetVertexAttribdvNV\0"
- "glGetVertexAttribfvNV\0"
- "glGetVertexAttribivNV\0"
- "glIsProgramNV\0"
- "glLoadProgramNV\0"
- "glProgramParameters4dvNV\0"
- "glProgramParameters4fvNV\0"
- "glRequestResidentProgramsNV\0"
- "glTrackMatrixNV\0"
- "glVertexAttrib1dNV\0"
- "glVertexAttrib1dvNV\0"
- "glVertexAttrib1fNV\0"
- "glVertexAttrib1fvNV\0"
- "glVertexAttrib1sNV\0"
- "glVertexAttrib1svNV\0"
- "glVertexAttrib2dNV\0"
- "glVertexAttrib2dvNV\0"
- "glVertexAttrib2fNV\0"
- "glVertexAttrib2fvNV\0"
- "glVertexAttrib2sNV\0"
- "glVertexAttrib2svNV\0"
- "glVertexAttrib3dNV\0"
- "glVertexAttrib3dvNV\0"
- "glVertexAttrib3fNV\0"
- "glVertexAttrib3fvNV\0"
- "glVertexAttrib3sNV\0"
- "glVertexAttrib3svNV\0"
- "glVertexAttrib4dNV\0"
- "glVertexAttrib4dvNV\0"
- "glVertexAttrib4fNV\0"
- "glVertexAttrib4fvNV\0"
- "glVertexAttrib4sNV\0"
- "glVertexAttrib4svNV\0"
- "glVertexAttrib4ubNV\0"
- "glVertexAttrib4ubvNV\0"
- "glVertexAttribPointerNV\0"
- "glVertexAttribs1dvNV\0"
- "glVertexAttribs1fvNV\0"
- "glVertexAttribs1svNV\0"
- "glVertexAttribs2dvNV\0"
- "glVertexAttribs2fvNV\0"
- "glVertexAttribs2svNV\0"
- "glVertexAttribs3dvNV\0"
- "glVertexAttribs3fvNV\0"
- "glVertexAttribs3svNV\0"
- "glVertexAttribs4dvNV\0"
- "glVertexAttribs4fvNV\0"
- "glVertexAttribs4svNV\0"
- "glVertexAttribs4ubvNV\0"
- "glGetTexBumpParameterfvATI\0"
- "glGetTexBumpParameterivATI\0"
- "glTexBumpParameterfvATI\0"
- "glTexBumpParameterivATI\0"
- "glAlphaFragmentOp1ATI\0"
- "glAlphaFragmentOp2ATI\0"
- "glAlphaFragmentOp3ATI\0"
- "glBeginFragmentShaderATI\0"
- "glBindFragmentShaderATI\0"
- "glColorFragmentOp1ATI\0"
- "glColorFragmentOp2ATI\0"
- "glColorFragmentOp3ATI\0"
- "glDeleteFragmentShaderATI\0"
- "glEndFragmentShaderATI\0"
- "glGenFragmentShadersATI\0"
- "glPassTexCoordATI\0"
- "glSampleMapATI\0"
- "glSetFragmentShaderConstantATI\0"
- "glPointParameteriNV\0"
- "glPointParameterivNV\0"
- "glActiveStencilFaceEXT\0"
- "glBindVertexArrayAPPLE\0"
- "glDeleteVertexArraysAPPLE\0"
- "glGenVertexArraysAPPLE\0"
- "glIsVertexArrayAPPLE\0"
- "glGetProgramNamedParameterdvNV\0"
- "glGetProgramNamedParameterfvNV\0"
- "glProgramNamedParameter4dNV\0"
- "glProgramNamedParameter4dvNV\0"
- "glProgramNamedParameter4fNV\0"
- "glProgramNamedParameter4fvNV\0"
- "glPrimitiveRestartIndexNV\0"
- "glPrimitiveRestartNV\0"
- "glDepthBoundsEXT\0"
- "glBlendEquationSeparateEXT\0"
- "glBindFramebufferEXT\0"
- "glBindRenderbufferEXT\0"
- "glCheckFramebufferStatusEXT\0"
- "glDeleteFramebuffersEXT\0"
- "glDeleteRenderbuffersEXT\0"
- "glFramebufferRenderbufferEXT\0"
- "glFramebufferTexture1DEXT\0"
- "glFramebufferTexture2DEXT\0"
- "glFramebufferTexture3DEXT\0"
- "glGenFramebuffersEXT\0"
- "glGenRenderbuffersEXT\0"
- "glGenerateMipmapEXT\0"
- "glGetFramebufferAttachmentParameterivEXT\0"
- "glGetRenderbufferParameterivEXT\0"
- "glIsFramebufferEXT\0"
- "glIsRenderbufferEXT\0"
- "glRenderbufferStorageEXT\0"
- "glBlitFramebufferEXT\0"
- "glBufferParameteriAPPLE\0"
- "glFlushMappedBufferRangeAPPLE\0"
- "glBindFragDataLocationEXT\0"
- "glGetFragDataLocationEXT\0"
- "glGetUniformuivEXT\0"
- "glGetVertexAttribIivEXT\0"
- "glGetVertexAttribIuivEXT\0"
- "glUniform1uiEXT\0"
- "glUniform1uivEXT\0"
- "glUniform2uiEXT\0"
- "glUniform2uivEXT\0"
- "glUniform3uiEXT\0"
- "glUniform3uivEXT\0"
- "glUniform4uiEXT\0"
- "glUniform4uivEXT\0"
- "glVertexAttribI1iEXT\0"
- "glVertexAttribI1ivEXT\0"
- "glVertexAttribI1uiEXT\0"
- "glVertexAttribI1uivEXT\0"
- "glVertexAttribI2iEXT\0"
- "glVertexAttribI2ivEXT\0"
- "glVertexAttribI2uiEXT\0"
- "glVertexAttribI2uivEXT\0"
- "glVertexAttribI3iEXT\0"
- "glVertexAttribI3ivEXT\0"
- "glVertexAttribI3uiEXT\0"
- "glVertexAttribI3uivEXT\0"
- "glVertexAttribI4bvEXT\0"
- "glVertexAttribI4iEXT\0"
- "glVertexAttribI4ivEXT\0"
- "glVertexAttribI4svEXT\0"
- "glVertexAttribI4ubvEXT\0"
- "glVertexAttribI4uiEXT\0"
- "glVertexAttribI4uivEXT\0"
- "glVertexAttribI4usvEXT\0"
- "glVertexAttribIPointerEXT\0"
- "glFramebufferTextureLayerEXT\0"
- "glColorMaskIndexedEXT\0"
- "glDisableIndexedEXT\0"
- "glEnableIndexedEXT\0"
- "glGetBooleanIndexedvEXT\0"
- "glGetIntegerIndexedvEXT\0"
- "glIsEnabledIndexedEXT\0"
- "glClearColorIiEXT\0"
- "glClearColorIuiEXT\0"
- "glGetTexParameterIivEXT\0"
- "glGetTexParameterIuivEXT\0"
- "glTexParameterIivEXT\0"
- "glTexParameterIuivEXT\0"
- "glBeginConditionalRenderNV\0"
- "glEndConditionalRenderNV\0"
- "glBeginTransformFeedbackEXT\0"
- "glBindBufferBaseEXT\0"
- "glBindBufferOffsetEXT\0"
- "glBindBufferRangeEXT\0"
- "glEndTransformFeedbackEXT\0"
- "glGetTransformFeedbackVaryingEXT\0"
- "glTransformFeedbackVaryingsEXT\0"
- "glProvokingVertexEXT\0"
- "glGetTexParameterPointervAPPLE\0"
- "glTextureRangeAPPLE\0"
- "glGetObjectParameterivAPPLE\0"
- "glObjectPurgeableAPPLE\0"
- "glObjectUnpurgeableAPPLE\0"
- "glActiveProgramEXT\0"
- "glCreateShaderProgramEXT\0"
- "glUseShaderProgramEXT\0"
- "glTextureBarrierNV\0"
- "glStencilFuncSeparateATI\0"
- "glProgramEnvParameters4fvEXT\0"
- "glProgramLocalParameters4fvEXT\0"
- "glGetQueryObjecti64vEXT\0"
- "glGetQueryObjectui64vEXT\0"
- "glEGLImageTargetRenderbufferStorageOES\0"
- "glEGLImageTargetTexture2DOES\0"
- "glArrayElementEXT\0"
- "glBindTextureEXT\0"
- "glDrawArraysEXT\0"
- "glAreTexturesResidentEXT\0"
- "glCopyTexImage1DEXT\0"
- "glCopyTexImage2DEXT\0"
- "glCopyTexSubImage1DEXT\0"
- "glCopyTexSubImage2DEXT\0"
- "glDeleteTexturesEXT\0"
- "glGenTexturesEXT\0"
- "glGetPointervEXT\0"
- "glIsTextureEXT\0"
- "glPrioritizeTexturesEXT\0"
- "glTexSubImage1DEXT\0"
- "glTexSubImage2DEXT\0"
- "glBlendColorEXT\0"
- "glBlendEquationEXT\0"
- "glDrawRangeElementsEXT\0"
- "glColorTableSGI\0"
- "glColorTableEXT\0"
- "glColorTableParameterfvSGI\0"
- "glColorTableParameterivSGI\0"
- "glCopyColorTableSGI\0"
- "glGetColorTableSGI\0"
- "glGetColorTableEXT\0"
- "glGetColorTableParameterfvSGI\0"
- "glGetColorTableParameterfvEXT\0"
- "glGetColorTableParameterivSGI\0"
- "glGetColorTableParameterivEXT\0"
- "glColorSubTableEXT\0"
- "glCopyColorSubTableEXT\0"
- "glConvolutionFilter1DEXT\0"
- "glConvolutionFilter2DEXT\0"
- "glConvolutionParameterfEXT\0"
- "glConvolutionParameterfvEXT\0"
- "glConvolutionParameteriEXT\0"
- "glConvolutionParameterivEXT\0"
- "glCopyConvolutionFilter1DEXT\0"
- "glCopyConvolutionFilter2DEXT\0"
- "glGetConvolutionFilterEXT\0"
- "glGetConvolutionParameterfvEXT\0"
- "glGetConvolutionParameterivEXT\0"
- "glGetSeparableFilterEXT\0"
- "glSeparableFilter2DEXT\0"
- "glGetHistogramEXT\0"
- "glGetHistogramParameterfvEXT\0"
- "glGetHistogramParameterivEXT\0"
- "glGetMinmaxEXT\0"
- "glGetMinmaxParameterfvEXT\0"
- "glGetMinmaxParameterivEXT\0"
- "glHistogramEXT\0"
- "glMinmaxEXT\0"
- "glResetHistogramEXT\0"
- "glResetMinmaxEXT\0"
- "glTexImage3DEXT\0"
- "glTexSubImage3DEXT\0"
- "glCopyTexSubImage3DEXT\0"
- "glActiveTexture\0"
- "glClientActiveTexture\0"
- "glMultiTexCoord1d\0"
- "glMultiTexCoord1dv\0"
- "glMultiTexCoord1f\0"
- "glMultiTexCoord1fv\0"
- "glMultiTexCoord1i\0"
- "glMultiTexCoord1iv\0"
- "glMultiTexCoord1s\0"
- "glMultiTexCoord1sv\0"
- "glMultiTexCoord2d\0"
- "glMultiTexCoord2dv\0"
- "glMultiTexCoord2f\0"
- "glMultiTexCoord2fv\0"
- "glMultiTexCoord2i\0"
- "glMultiTexCoord2iv\0"
- "glMultiTexCoord2s\0"
- "glMultiTexCoord2sv\0"
- "glMultiTexCoord3d\0"
- "glMultiTexCoord3dv\0"
- "glMultiTexCoord3f\0"
- "glMultiTexCoord3fv\0"
- "glMultiTexCoord3i\0"
- "glMultiTexCoord3iv\0"
- "glMultiTexCoord3s\0"
- "glMultiTexCoord3sv\0"
- "glMultiTexCoord4d\0"
- "glMultiTexCoord4dv\0"
- "glMultiTexCoord4f\0"
- "glMultiTexCoord4fv\0"
- "glMultiTexCoord4i\0"
- "glMultiTexCoord4iv\0"
- "glMultiTexCoord4s\0"
- "glMultiTexCoord4sv\0"
- "glStencilOpSeparateATI\0"
- "glLoadTransposeMatrixd\0"
- "glLoadTransposeMatrixf\0"
- "glMultTransposeMatrixd\0"
- "glMultTransposeMatrixf\0"
- "glSampleCoverage\0"
- "glCompressedTexImage1D\0"
- "glCompressedTexImage2D\0"
- "glCompressedTexImage3D\0"
- "glCompressedTexSubImage1D\0"
- "glCompressedTexSubImage2D\0"
- "glCompressedTexSubImage3D\0"
- "glGetCompressedTexImage\0"
- "glDisableVertexAttribArray\0"
- "glEnableVertexAttribArray\0"
- "glGetVertexAttribdv\0"
- "glGetVertexAttribfv\0"
- "glGetVertexAttribiv\0"
- "glProgramParameter4dNV\0"
- "glProgramParameter4dvNV\0"
- "glProgramParameter4fNV\0"
- "glProgramParameter4fvNV\0"
- "glVertexAttrib1d\0"
- "glVertexAttrib1dv\0"
- "glVertexAttrib1f\0"
- "glVertexAttrib1fv\0"
- "glVertexAttrib1s\0"
- "glVertexAttrib1sv\0"
- "glVertexAttrib2d\0"
- "glVertexAttrib2dv\0"
- "glVertexAttrib2f\0"
- "glVertexAttrib2fv\0"
- "glVertexAttrib2s\0"
- "glVertexAttrib2sv\0"
- "glVertexAttrib3d\0"
- "glVertexAttrib3dv\0"
- "glVertexAttrib3f\0"
- "glVertexAttrib3fv\0"
- "glVertexAttrib3s\0"
- "glVertexAttrib3sv\0"
- "glVertexAttrib4Nbv\0"
- "glVertexAttrib4Niv\0"
- "glVertexAttrib4Nsv\0"
- "glVertexAttrib4Nub\0"
- "glVertexAttrib4Nubv\0"
- "glVertexAttrib4Nuiv\0"
- "glVertexAttrib4Nusv\0"
- "glVertexAttrib4bv\0"
- "glVertexAttrib4d\0"
- "glVertexAttrib4dv\0"
- "glVertexAttrib4f\0"
- "glVertexAttrib4fv\0"
- "glVertexAttrib4iv\0"
- "glVertexAttrib4s\0"
- "glVertexAttrib4sv\0"
- "glVertexAttrib4ubv\0"
- "glVertexAttrib4uiv\0"
- "glVertexAttrib4usv\0"
- "glVertexAttribPointer\0"
- "glBindBuffer\0"
- "glBufferData\0"
- "glBufferSubData\0"
- "glDeleteBuffers\0"
- "glGenBuffers\0"
- "glGetBufferParameteriv\0"
- "glGetBufferPointerv\0"
- "glGetBufferSubData\0"
- "glIsBuffer\0"
- "glMapBuffer\0"
- "glUnmapBuffer\0"
- "glBeginQuery\0"
- "glDeleteQueries\0"
- "glEndQuery\0"
- "glGenQueries\0"
- "glGetQueryObjectiv\0"
- "glGetQueryObjectuiv\0"
- "glGetQueryiv\0"
- "glIsQuery\0"
- "glCompileShader\0"
- "glGetActiveUniform\0"
- "glGetShaderSource\0"
- "glGetUniformLocation\0"
- "glGetUniformfv\0"
- "glGetUniformiv\0"
- "glLinkProgram\0"
- "glShaderSource\0"
- "glUniform1f\0"
- "glUniform1fv\0"
- "glUniform1i\0"
- "glUniform1iv\0"
- "glUniform2f\0"
- "glUniform2fv\0"
- "glUniform2i\0"
- "glUniform2iv\0"
- "glUniform3f\0"
- "glUniform3fv\0"
- "glUniform3i\0"
- "glUniform3iv\0"
- "glUniform4f\0"
- "glUniform4fv\0"
- "glUniform4i\0"
- "glUniform4iv\0"
- "glUniformMatrix2fv\0"
- "glUniformMatrix3fv\0"
- "glUniformMatrix4fv\0"
- "glUseProgram\0"
- "glValidateProgram\0"
- "glBindAttribLocation\0"
- "glGetActiveAttrib\0"
- "glGetAttribLocation\0"
- "glDrawBuffers\0"
- "glDrawBuffersATI\0"
- "glDrawBuffersNV\0"
- "glDrawArraysInstancedEXT\0"
- "glDrawArraysInstanced\0"
- "glDrawElementsInstancedEXT\0"
- "glDrawElementsInstanced\0"
- "glRenderbufferStorageMultisampleEXT\0"
- "glBlendEquationSeparateIndexedAMD\0"
- "glBlendEquationIndexedAMD\0"
- "glBlendFuncSeparateIndexedAMD\0"
- "glBlendFuncIndexedAMD\0"
- "glSampleMaskEXT\0"
- "glSamplePatternEXT\0"
- "glPointParameterf\0"
- "glPointParameterfARB\0"
- "glPointParameterfSGIS\0"
- "glPointParameterfv\0"
- "glPointParameterfvARB\0"
- "glPointParameterfvSGIS\0"
- "glSecondaryColor3b\0"
- "glSecondaryColor3bv\0"
- "glSecondaryColor3d\0"
- "glSecondaryColor3dv\0"
- "glSecondaryColor3f\0"
- "glSecondaryColor3fv\0"
- "glSecondaryColor3i\0"
- "glSecondaryColor3iv\0"
- "glSecondaryColor3s\0"
- "glSecondaryColor3sv\0"
- "glSecondaryColor3ub\0"
- "glSecondaryColor3ubv\0"
- "glSecondaryColor3ui\0"
- "glSecondaryColor3uiv\0"
- "glSecondaryColor3us\0"
- "glSecondaryColor3usv\0"
- "glSecondaryColorPointer\0"
- "glMultiDrawArrays\0"
- "glMultiDrawElements\0"
- "glFogCoordPointer\0"
- "glFogCoordd\0"
- "glFogCoorddv\0"
- "glFogCoordf\0"
- "glFogCoordfv\0"
- "glBlendFuncSeparate\0"
- "glBlendFuncSeparateINGR\0"
- "glWindowPos2d\0"
- "glWindowPos2dARB\0"
- "glWindowPos2dv\0"
- "glWindowPos2dvARB\0"
- "glWindowPos2f\0"
- "glWindowPos2fARB\0"
- "glWindowPos2fv\0"
- "glWindowPos2fvARB\0"
- "glWindowPos2i\0"
- "glWindowPos2iARB\0"
- "glWindowPos2iv\0"
- "glWindowPos2ivARB\0"
- "glWindowPos2s\0"
- "glWindowPos2sARB\0"
- "glWindowPos2sv\0"
- "glWindowPos2svARB\0"
- "glWindowPos3d\0"
- "glWindowPos3dARB\0"
- "glWindowPos3dv\0"
- "glWindowPos3dvARB\0"
- "glWindowPos3f\0"
- "glWindowPos3fARB\0"
- "glWindowPos3fv\0"
- "glWindowPos3fvARB\0"
- "glWindowPos3i\0"
- "glWindowPos3iARB\0"
- "glWindowPos3iv\0"
- "glWindowPos3ivARB\0"
- "glWindowPos3s\0"
- "glWindowPos3sARB\0"
- "glWindowPos3sv\0"
- "glWindowPos3svARB\0"
- "glBindProgramARB\0"
- "glDeleteProgramsARB\0"
- "glGenProgramsARB\0"
- "glGetVertexAttribPointerv\0"
- "glGetVertexAttribPointervARB\0"
- "glIsProgramARB\0"
- "glPointParameteri\0"
- "glPointParameteriv\0"
- "glDeleteVertexArrays\0"
- "glIsVertexArray\0"
- "glPrimitiveRestartIndex\0"
- "glBlendEquationSeparate\0"
- "glBlendEquationSeparateATI\0"
- "glBindFramebuffer\0"
- "glBindRenderbuffer\0"
- "glCheckFramebufferStatus\0"
- "glDeleteFramebuffers\0"
- "glDeleteRenderbuffers\0"
- "glFramebufferRenderbuffer\0"
- "glFramebufferTexture1D\0"
- "glFramebufferTexture2D\0"
- "glFramebufferTexture3D\0"
- "glGenFramebuffers\0"
- "glGenRenderbuffers\0"
- "glGenerateMipmap\0"
- "glGetFramebufferAttachmentParameteriv\0"
- "glGetRenderbufferParameteriv\0"
- "glIsFramebuffer\0"
- "glIsRenderbuffer\0"
- "glRenderbufferStorage\0"
- "glBlitFramebuffer\0"
- "glBindFragDataLocation\0"
- "glGetFragDataLocation\0"
- "glGetUniformuiv\0"
- "glGetVertexAttribIiv\0"
- "glGetVertexAttribIuiv\0"
- "glUniform1ui\0"
- "glUniform1uiv\0"
- "glUniform2ui\0"
- "glUniform2uiv\0"
- "glUniform3ui\0"
- "glUniform3uiv\0"
- "glUniform4ui\0"
- "glUniform4uiv\0"
- "glVertexAttribI1i\0"
- "glVertexAttribI1iv\0"
- "glVertexAttribI1ui\0"
- "glVertexAttribI1uiv\0"
- "glVertexAttribI2i\0"
- "glVertexAttribI2iv\0"
- "glVertexAttribI2ui\0"
- "glVertexAttribI2uiv\0"
- "glVertexAttribI3i\0"
- "glVertexAttribI3iv\0"
- "glVertexAttribI3ui\0"
- "glVertexAttribI3uiv\0"
- "glVertexAttribI4bv\0"
- "glVertexAttribI4i\0"
- "glVertexAttribI4iv\0"
- "glVertexAttribI4sv\0"
- "glVertexAttribI4ubv\0"
- "glVertexAttribI4ui\0"
- "glVertexAttribI4uiv\0"
- "glVertexAttribI4usv\0"
- "glVertexAttribIPointer\0"
- "glFramebufferTextureLayer\0"
- "glFramebufferTextureLayerARB\0"
- "glColorMaski\0"
- "glDisablei\0"
- "glEnablei\0"
- "glGetBooleani_v\0"
- "glGetIntegeri_v\0"
- "glIsEnabledi\0"
- "glGetTexParameterIiv\0"
- "glGetTexParameterIuiv\0"
- "glTexParameterIiv\0"
- "glTexParameterIuiv\0"
- "glBeginConditionalRender\0"
- "glEndConditionalRender\0"
- "glBeginTransformFeedback\0"
- "glBindBufferBase\0"
- "glBindBufferRange\0"
- "glEndTransformFeedback\0"
- "glGetTransformFeedbackVarying\0"
- "glTransformFeedbackVaryings\0" "glProvokingVertex\0";
-
-#ifdef USE_MGL_NAMESPACE
-#define gl_dispatch_stub_343 mgl_dispatch_stub_343
-#define gl_dispatch_stub_344 mgl_dispatch_stub_344
-#define gl_dispatch_stub_345 mgl_dispatch_stub_345
-#define gl_dispatch_stub_356 mgl_dispatch_stub_356
-#define gl_dispatch_stub_357 mgl_dispatch_stub_357
-#define gl_dispatch_stub_358 mgl_dispatch_stub_358
-#define gl_dispatch_stub_359 mgl_dispatch_stub_359
-#define gl_dispatch_stub_361 mgl_dispatch_stub_361
-#define gl_dispatch_stub_362 mgl_dispatch_stub_362
-#define gl_dispatch_stub_363 mgl_dispatch_stub_363
-#define gl_dispatch_stub_364 mgl_dispatch_stub_364
-#define gl_dispatch_stub_365 mgl_dispatch_stub_365
-#define gl_dispatch_stub_366 mgl_dispatch_stub_366
-#define gl_dispatch_stub_692 mgl_dispatch_stub_692
-#define gl_dispatch_stub_693 mgl_dispatch_stub_693
-#define gl_dispatch_stub_694 mgl_dispatch_stub_694
-#define gl_dispatch_stub_695 mgl_dispatch_stub_695
-#define gl_dispatch_stub_696 mgl_dispatch_stub_696
-#define gl_dispatch_stub_697 mgl_dispatch_stub_697
-#define gl_dispatch_stub_698 mgl_dispatch_stub_698
-#define gl_dispatch_stub_699 mgl_dispatch_stub_699
-#define gl_dispatch_stub_734 mgl_dispatch_stub_734
-#define gl_dispatch_stub_776 mgl_dispatch_stub_776
-#define gl_dispatch_stub_777 mgl_dispatch_stub_777
-#define gl_dispatch_stub_778 mgl_dispatch_stub_778
-#define gl_dispatch_stub_779 mgl_dispatch_stub_779
-#define gl_dispatch_stub_780 mgl_dispatch_stub_780
-#define gl_dispatch_stub_781 mgl_dispatch_stub_781
-#define gl_dispatch_stub_782 mgl_dispatch_stub_782
-#define gl_dispatch_stub_783 mgl_dispatch_stub_783
-#define gl_dispatch_stub_784 mgl_dispatch_stub_784
-#define gl_dispatch_stub_865 mgl_dispatch_stub_865
-#define gl_dispatch_stub_866 mgl_dispatch_stub_866
-#define gl_dispatch_stub_867 mgl_dispatch_stub_867
-#define gl_dispatch_stub_868 mgl_dispatch_stub_868
-#define gl_dispatch_stub_869 mgl_dispatch_stub_869
-#define gl_dispatch_stub_878 mgl_dispatch_stub_878
-#define gl_dispatch_stub_879 mgl_dispatch_stub_879
-#define gl_dispatch_stub_897 mgl_dispatch_stub_897
-#define gl_dispatch_stub_898 mgl_dispatch_stub_898
-#define gl_dispatch_stub_899 mgl_dispatch_stub_899
-#define gl_dispatch_stub_957 mgl_dispatch_stub_957
-#define gl_dispatch_stub_958 mgl_dispatch_stub_958
-#define gl_dispatch_stub_966 mgl_dispatch_stub_966
-#define gl_dispatch_stub_967 mgl_dispatch_stub_967
-#define gl_dispatch_stub_968 mgl_dispatch_stub_968
-#define gl_dispatch_stub_969 mgl_dispatch_stub_969
-#define gl_dispatch_stub_970 mgl_dispatch_stub_970
-#endif /* USE_MGL_NAMESPACE */
-
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
-void GLAPIENTRY gl_dispatch_stub_343(GLenum target, GLenum format, GLenum type,
- GLvoid * table);
-void GLAPIENTRY gl_dispatch_stub_344(GLenum target, GLenum pname,
- GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_345(GLenum target, GLenum pname,
- GLint * params);
-void GLAPIENTRY gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
- GLvoid * image);
-void GLAPIENTRY gl_dispatch_stub_357(GLenum target, GLenum pname,
- GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_358(GLenum target, GLenum pname,
- GLint * params);
-void GLAPIENTRY gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type,
- GLvoid * row, GLvoid * column,
- GLvoid * span);
-void GLAPIENTRY gl_dispatch_stub_361(GLenum target, GLboolean reset,
- GLenum format, GLenum type,
- GLvoid * values);
-void GLAPIENTRY gl_dispatch_stub_362(GLenum target, GLenum pname,
- GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname,
- GLint * params);
-void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset,
- GLenum format, GLenum type,
- GLvoid * values);
-void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname,
- GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname,
- GLint * params);
-void GLAPIENTRY gl_dispatch_stub_692(GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_693(GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_694(GLenum pname, GLfloat param);
-void GLAPIENTRY gl_dispatch_stub_695(GLenum pname, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_696(GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_697(GLenum pname, const GLint * params);
-void GLAPIENTRY gl_dispatch_stub_698(GLclampf value, GLboolean invert);
-void GLAPIENTRY gl_dispatch_stub_699(GLenum pattern);
-void GLAPIENTRY gl_dispatch_stub_734(GLenum mode);
-void GLAPIENTRY gl_dispatch_stub_776(const GLenum * mode, const GLint * first,
- const GLsizei * count, GLsizei primcount,
- GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_777(const GLenum * mode, const GLsizei * count,
- GLenum type, const GLvoid * const *indices,
- GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_778(GLsizei n, const GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_779(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_780(GLsizei n, GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_781(GLuint fence, GLenum pname,
- GLint * params);
-GLboolean GLAPIENTRY gl_dispatch_stub_782(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_783(GLuint fence, GLenum condition);
-GLboolean GLAPIENTRY gl_dispatch_stub_784(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_865(GLenum face);
-void GLAPIENTRY gl_dispatch_stub_866(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_867(GLsizei n, const GLuint * arrays);
-void GLAPIENTRY gl_dispatch_stub_868(GLsizei n, GLuint * arrays);
-GLboolean GLAPIENTRY gl_dispatch_stub_869(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_878(GLclampd zmin, GLclampd zmax);
-void GLAPIENTRY gl_dispatch_stub_879(GLenum modeRGB, GLenum modeA);
-void GLAPIENTRY gl_dispatch_stub_897(GLint srcX0, GLint srcY0, GLint srcX1,
- GLint srcY1, GLint dstX0, GLint dstY0,
- GLint dstX1, GLint dstY1, GLbitfield mask,
- GLenum filter);
-void GLAPIENTRY gl_dispatch_stub_898(GLenum target, GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_899(GLenum target, GLintptr offset,
- GLsizeiptr size);
-void GLAPIENTRY gl_dispatch_stub_957(GLenum target, GLenum pname,
- GLvoid ** params);
-void GLAPIENTRY gl_dispatch_stub_958(GLenum target, GLsizei length,
- GLvoid * pointer);
-void GLAPIENTRY gl_dispatch_stub_966(GLenum frontfunc, GLenum backfunc,
- GLint ref, GLuint mask);
-void GLAPIENTRY gl_dispatch_stub_967(GLenum target, GLuint index, GLsizei count,
- const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_968(GLenum target, GLuint index, GLsizei count,
- const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_969(GLuint id, GLenum pname,
- GLint64EXT * params);
-void GLAPIENTRY gl_dispatch_stub_970(GLuint id, GLenum pname,
- GLuint64EXT * params);
-#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
-
-static const glprocs_table_t static_functions[] = {
- NAME_FUNC_OFFSET(0, glNewList, glNewList, NULL, 0),
- NAME_FUNC_OFFSET(10, glEndList, glEndList, NULL, 1),
- NAME_FUNC_OFFSET(20, glCallList, glCallList, NULL, 2),
- NAME_FUNC_OFFSET(31, glCallLists, glCallLists, NULL, 3),
- NAME_FUNC_OFFSET(43, glDeleteLists, glDeleteLists, NULL, 4),
- NAME_FUNC_OFFSET(57, glGenLists, glGenLists, NULL, 5),
- NAME_FUNC_OFFSET(68, glListBase, glListBase, NULL, 6),
- NAME_FUNC_OFFSET(79, glBegin, glBegin, NULL, 7),
- NAME_FUNC_OFFSET(87, glBitmap, glBitmap, NULL, 8),
- NAME_FUNC_OFFSET(96, glColor3b, glColor3b, NULL, 9),
- NAME_FUNC_OFFSET(106, glColor3bv, glColor3bv, NULL, 10),
- NAME_FUNC_OFFSET(117, glColor3d, glColor3d, NULL, 11),
- NAME_FUNC_OFFSET(127, glColor3dv, glColor3dv, NULL, 12),
- NAME_FUNC_OFFSET(138, glColor3f, glColor3f, NULL, 13),
- NAME_FUNC_OFFSET(148, glColor3fv, glColor3fv, NULL, 14),
- NAME_FUNC_OFFSET(159, glColor3i, glColor3i, NULL, 15),
- NAME_FUNC_OFFSET(169, glColor3iv, glColor3iv, NULL, 16),
- NAME_FUNC_OFFSET(180, glColor3s, glColor3s, NULL, 17),
- NAME_FUNC_OFFSET(190, glColor3sv, glColor3sv, NULL, 18),
- NAME_FUNC_OFFSET(201, glColor3ub, glColor3ub, NULL, 19),
- NAME_FUNC_OFFSET(212, glColor3ubv, glColor3ubv, NULL, 20),
- NAME_FUNC_OFFSET(224, glColor3ui, glColor3ui, NULL, 21),
- NAME_FUNC_OFFSET(235, glColor3uiv, glColor3uiv, NULL, 22),
- NAME_FUNC_OFFSET(247, glColor3us, glColor3us, NULL, 23),
- NAME_FUNC_OFFSET(258, glColor3usv, glColor3usv, NULL, 24),
- NAME_FUNC_OFFSET(270, glColor4b, glColor4b, NULL, 25),
- NAME_FUNC_OFFSET(280, glColor4bv, glColor4bv, NULL, 26),
- NAME_FUNC_OFFSET(291, glColor4d, glColor4d, NULL, 27),
- NAME_FUNC_OFFSET(301, glColor4dv, glColor4dv, NULL, 28),
- NAME_FUNC_OFFSET(312, glColor4f, glColor4f, NULL, 29),
- NAME_FUNC_OFFSET(322, glColor4fv, glColor4fv, NULL, 30),
- NAME_FUNC_OFFSET(333, glColor4i, glColor4i, NULL, 31),
- NAME_FUNC_OFFSET(343, glColor4iv, glColor4iv, NULL, 32),
- NAME_FUNC_OFFSET(354, glColor4s, glColor4s, NULL, 33),
- NAME_FUNC_OFFSET(364, glColor4sv, glColor4sv, NULL, 34),
- NAME_FUNC_OFFSET(375, glColor4ub, glColor4ub, NULL, 35),
- NAME_FUNC_OFFSET(386, glColor4ubv, glColor4ubv, NULL, 36),
- NAME_FUNC_OFFSET(398, glColor4ui, glColor4ui, NULL, 37),
- NAME_FUNC_OFFSET(409, glColor4uiv, glColor4uiv, NULL, 38),
- NAME_FUNC_OFFSET(421, glColor4us, glColor4us, NULL, 39),
- NAME_FUNC_OFFSET(432, glColor4usv, glColor4usv, NULL, 40),
- NAME_FUNC_OFFSET(444, glEdgeFlag, glEdgeFlag, NULL, 41),
- NAME_FUNC_OFFSET(455, glEdgeFlagv, glEdgeFlagv, NULL, 42),
- NAME_FUNC_OFFSET(467, glEnd, glEnd, NULL, 43),
- NAME_FUNC_OFFSET(473, glIndexd, glIndexd, NULL, 44),
- NAME_FUNC_OFFSET(482, glIndexdv, glIndexdv, NULL, 45),
- NAME_FUNC_OFFSET(492, glIndexf, glIndexf, NULL, 46),
- NAME_FUNC_OFFSET(501, glIndexfv, glIndexfv, NULL, 47),
- NAME_FUNC_OFFSET(511, glIndexi, glIndexi, NULL, 48),
- NAME_FUNC_OFFSET(520, glIndexiv, glIndexiv, NULL, 49),
- NAME_FUNC_OFFSET(530, glIndexs, glIndexs, NULL, 50),
- NAME_FUNC_OFFSET(539, glIndexsv, glIndexsv, NULL, 51),
- NAME_FUNC_OFFSET(549, glNormal3b, glNormal3b, NULL, 52),
- NAME_FUNC_OFFSET(560, glNormal3bv, glNormal3bv, NULL, 53),
- NAME_FUNC_OFFSET(572, glNormal3d, glNormal3d, NULL, 54),
- NAME_FUNC_OFFSET(583, glNormal3dv, glNormal3dv, NULL, 55),
- NAME_FUNC_OFFSET(595, glNormal3f, glNormal3f, NULL, 56),
- NAME_FUNC_OFFSET(606, glNormal3fv, glNormal3fv, NULL, 57),
- NAME_FUNC_OFFSET(618, glNormal3i, glNormal3i, NULL, 58),
- NAME_FUNC_OFFSET(629, glNormal3iv, glNormal3iv, NULL, 59),
- NAME_FUNC_OFFSET(641, glNormal3s, glNormal3s, NULL, 60),
- NAME_FUNC_OFFSET(652, glNormal3sv, glNormal3sv, NULL, 61),
- NAME_FUNC_OFFSET(664, glRasterPos2d, glRasterPos2d, NULL, 62),
- NAME_FUNC_OFFSET(678, glRasterPos2dv, glRasterPos2dv, NULL, 63),
- NAME_FUNC_OFFSET(693, glRasterPos2f, glRasterPos2f, NULL, 64),
- NAME_FUNC_OFFSET(707, glRasterPos2fv, glRasterPos2fv, NULL, 65),
- NAME_FUNC_OFFSET(722, glRasterPos2i, glRasterPos2i, NULL, 66),
- NAME_FUNC_OFFSET(736, glRasterPos2iv, glRasterPos2iv, NULL, 67),
- NAME_FUNC_OFFSET(751, glRasterPos2s, glRasterPos2s, NULL, 68),
- NAME_FUNC_OFFSET(765, glRasterPos2sv, glRasterPos2sv, NULL, 69),
- NAME_FUNC_OFFSET(780, glRasterPos3d, glRasterPos3d, NULL, 70),
- NAME_FUNC_OFFSET(794, glRasterPos3dv, glRasterPos3dv, NULL, 71),
- NAME_FUNC_OFFSET(809, glRasterPos3f, glRasterPos3f, NULL, 72),
- NAME_FUNC_OFFSET(823, glRasterPos3fv, glRasterPos3fv, NULL, 73),
- NAME_FUNC_OFFSET(838, glRasterPos3i, glRasterPos3i, NULL, 74),
- NAME_FUNC_OFFSET(852, glRasterPos3iv, glRasterPos3iv, NULL, 75),
- NAME_FUNC_OFFSET(867, glRasterPos3s, glRasterPos3s, NULL, 76),
- NAME_FUNC_OFFSET(881, glRasterPos3sv, glRasterPos3sv, NULL, 77),
- NAME_FUNC_OFFSET(896, glRasterPos4d, glRasterPos4d, NULL, 78),
- NAME_FUNC_OFFSET(910, glRasterPos4dv, glRasterPos4dv, NULL, 79),
- NAME_FUNC_OFFSET(925, glRasterPos4f, glRasterPos4f, NULL, 80),
- NAME_FUNC_OFFSET(939, glRasterPos4fv, glRasterPos4fv, NULL, 81),
- NAME_FUNC_OFFSET(954, glRasterPos4i, glRasterPos4i, NULL, 82),
- NAME_FUNC_OFFSET(968, glRasterPos4iv, glRasterPos4iv, NULL, 83),
- NAME_FUNC_OFFSET(983, glRasterPos4s, glRasterPos4s, NULL, 84),
- NAME_FUNC_OFFSET(997, glRasterPos4sv, glRasterPos4sv, NULL, 85),
- NAME_FUNC_OFFSET(1012, glRectd, glRectd, NULL, 86),
- NAME_FUNC_OFFSET(1020, glRectdv, glRectdv, NULL, 87),
- NAME_FUNC_OFFSET(1029, glRectf, glRectf, NULL, 88),
- NAME_FUNC_OFFSET(1037, glRectfv, glRectfv, NULL, 89),
- NAME_FUNC_OFFSET(1046, glRecti, glRecti, NULL, 90),
- NAME_FUNC_OFFSET(1054, glRectiv, glRectiv, NULL, 91),
- NAME_FUNC_OFFSET(1063, glRects, glRects, NULL, 92),
- NAME_FUNC_OFFSET(1071, glRectsv, glRectsv, NULL, 93),
- NAME_FUNC_OFFSET(1080, glTexCoord1d, glTexCoord1d, NULL, 94),
- NAME_FUNC_OFFSET(1093, glTexCoord1dv, glTexCoord1dv, NULL, 95),
- NAME_FUNC_OFFSET(1107, glTexCoord1f, glTexCoord1f, NULL, 96),
- NAME_FUNC_OFFSET(1120, glTexCoord1fv, glTexCoord1fv, NULL, 97),
- NAME_FUNC_OFFSET(1134, glTexCoord1i, glTexCoord1i, NULL, 98),
- NAME_FUNC_OFFSET(1147, glTexCoord1iv, glTexCoord1iv, NULL, 99),
- NAME_FUNC_OFFSET(1161, glTexCoord1s, glTexCoord1s, NULL, 100),
- NAME_FUNC_OFFSET(1174, glTexCoord1sv, glTexCoord1sv, NULL, 101),
- NAME_FUNC_OFFSET(1188, glTexCoord2d, glTexCoord2d, NULL, 102),
- NAME_FUNC_OFFSET(1201, glTexCoord2dv, glTexCoord2dv, NULL, 103),
- NAME_FUNC_OFFSET(1215, glTexCoord2f, glTexCoord2f, NULL, 104),
- NAME_FUNC_OFFSET(1228, glTexCoord2fv, glTexCoord2fv, NULL, 105),
- NAME_FUNC_OFFSET(1242, glTexCoord2i, glTexCoord2i, NULL, 106),
- NAME_FUNC_OFFSET(1255, glTexCoord2iv, glTexCoord2iv, NULL, 107),
- NAME_FUNC_OFFSET(1269, glTexCoord2s, glTexCoord2s, NULL, 108),
- NAME_FUNC_OFFSET(1282, glTexCoord2sv, glTexCoord2sv, NULL, 109),
- NAME_FUNC_OFFSET(1296, glTexCoord3d, glTexCoord3d, NULL, 110),
- NAME_FUNC_OFFSET(1309, glTexCoord3dv, glTexCoord3dv, NULL, 111),
- NAME_FUNC_OFFSET(1323, glTexCoord3f, glTexCoord3f, NULL, 112),
- NAME_FUNC_OFFSET(1336, glTexCoord3fv, glTexCoord3fv, NULL, 113),
- NAME_FUNC_OFFSET(1350, glTexCoord3i, glTexCoord3i, NULL, 114),
- NAME_FUNC_OFFSET(1363, glTexCoord3iv, glTexCoord3iv, NULL, 115),
- NAME_FUNC_OFFSET(1377, glTexCoord3s, glTexCoord3s, NULL, 116),
- NAME_FUNC_OFFSET(1390, glTexCoord3sv, glTexCoord3sv, NULL, 117),
- NAME_FUNC_OFFSET(1404, glTexCoord4d, glTexCoord4d, NULL, 118),
- NAME_FUNC_OFFSET(1417, glTexCoord4dv, glTexCoord4dv, NULL, 119),
- NAME_FUNC_OFFSET(1431, glTexCoord4f, glTexCoord4f, NULL, 120),
- NAME_FUNC_OFFSET(1444, glTexCoord4fv, glTexCoord4fv, NULL, 121),
- NAME_FUNC_OFFSET(1458, glTexCoord4i, glTexCoord4i, NULL, 122),
- NAME_FUNC_OFFSET(1471, glTexCoord4iv, glTexCoord4iv, NULL, 123),
- NAME_FUNC_OFFSET(1485, glTexCoord4s, glTexCoord4s, NULL, 124),
- NAME_FUNC_OFFSET(1498, glTexCoord4sv, glTexCoord4sv, NULL, 125),
- NAME_FUNC_OFFSET(1512, glVertex2d, glVertex2d, NULL, 126),
- NAME_FUNC_OFFSET(1523, glVertex2dv, glVertex2dv, NULL, 127),
- NAME_FUNC_OFFSET(1535, glVertex2f, glVertex2f, NULL, 128),
- NAME_FUNC_OFFSET(1546, glVertex2fv, glVertex2fv, NULL, 129),
- NAME_FUNC_OFFSET(1558, glVertex2i, glVertex2i, NULL, 130),
- NAME_FUNC_OFFSET(1569, glVertex2iv, glVertex2iv, NULL, 131),
- NAME_FUNC_OFFSET(1581, glVertex2s, glVertex2s, NULL, 132),
- NAME_FUNC_OFFSET(1592, glVertex2sv, glVertex2sv, NULL, 133),
- NAME_FUNC_OFFSET(1604, glVertex3d, glVertex3d, NULL, 134),
- NAME_FUNC_OFFSET(1615, glVertex3dv, glVertex3dv, NULL, 135),
- NAME_FUNC_OFFSET(1627, glVertex3f, glVertex3f, NULL, 136),
- NAME_FUNC_OFFSET(1638, glVertex3fv, glVertex3fv, NULL, 137),
- NAME_FUNC_OFFSET(1650, glVertex3i, glVertex3i, NULL, 138),
- NAME_FUNC_OFFSET(1661, glVertex3iv, glVertex3iv, NULL, 139),
- NAME_FUNC_OFFSET(1673, glVertex3s, glVertex3s, NULL, 140),
- NAME_FUNC_OFFSET(1684, glVertex3sv, glVertex3sv, NULL, 141),
- NAME_FUNC_OFFSET(1696, glVertex4d, glVertex4d, NULL, 142),
- NAME_FUNC_OFFSET(1707, glVertex4dv, glVertex4dv, NULL, 143),
- NAME_FUNC_OFFSET(1719, glVertex4f, glVertex4f, NULL, 144),
- NAME_FUNC_OFFSET(1730, glVertex4fv, glVertex4fv, NULL, 145),
- NAME_FUNC_OFFSET(1742, glVertex4i, glVertex4i, NULL, 146),
- NAME_FUNC_OFFSET(1753, glVertex4iv, glVertex4iv, NULL, 147),
- NAME_FUNC_OFFSET(1765, glVertex4s, glVertex4s, NULL, 148),
- NAME_FUNC_OFFSET(1776, glVertex4sv, glVertex4sv, NULL, 149),
- NAME_FUNC_OFFSET(1788, glClipPlane, glClipPlane, NULL, 150),
- NAME_FUNC_OFFSET(1800, glColorMaterial, glColorMaterial, NULL, 151),
- NAME_FUNC_OFFSET(1816, glCullFace, glCullFace, NULL, 152),
- NAME_FUNC_OFFSET(1827, glFogf, glFogf, NULL, 153),
- NAME_FUNC_OFFSET(1834, glFogfv, glFogfv, NULL, 154),
- NAME_FUNC_OFFSET(1842, glFogi, glFogi, NULL, 155),
- NAME_FUNC_OFFSET(1849, glFogiv, glFogiv, NULL, 156),
- NAME_FUNC_OFFSET(1857, glFrontFace, glFrontFace, NULL, 157),
- NAME_FUNC_OFFSET(1869, glHint, glHint, NULL, 158),
- NAME_FUNC_OFFSET(1876, glLightf, glLightf, NULL, 159),
- NAME_FUNC_OFFSET(1885, glLightfv, glLightfv, NULL, 160),
- NAME_FUNC_OFFSET(1895, glLighti, glLighti, NULL, 161),
- NAME_FUNC_OFFSET(1904, glLightiv, glLightiv, NULL, 162),
- NAME_FUNC_OFFSET(1914, glLightModelf, glLightModelf, NULL, 163),
- NAME_FUNC_OFFSET(1928, glLightModelfv, glLightModelfv, NULL, 164),
- NAME_FUNC_OFFSET(1943, glLightModeli, glLightModeli, NULL, 165),
- NAME_FUNC_OFFSET(1957, glLightModeliv, glLightModeliv, NULL, 166),
- NAME_FUNC_OFFSET(1972, glLineStipple, glLineStipple, NULL, 167),
- NAME_FUNC_OFFSET(1986, glLineWidth, glLineWidth, NULL, 168),
- NAME_FUNC_OFFSET(1998, glMaterialf, glMaterialf, NULL, 169),
- NAME_FUNC_OFFSET(2010, glMaterialfv, glMaterialfv, NULL, 170),
- NAME_FUNC_OFFSET(2023, glMateriali, glMateriali, NULL, 171),
- NAME_FUNC_OFFSET(2035, glMaterialiv, glMaterialiv, NULL, 172),
- NAME_FUNC_OFFSET(2048, glPointSize, glPointSize, NULL, 173),
- NAME_FUNC_OFFSET(2060, glPolygonMode, glPolygonMode, NULL, 174),
- NAME_FUNC_OFFSET(2074, glPolygonStipple, glPolygonStipple, NULL, 175),
- NAME_FUNC_OFFSET(2091, glScissor, glScissor, NULL, 176),
- NAME_FUNC_OFFSET(2101, glShadeModel, glShadeModel, NULL, 177),
- NAME_FUNC_OFFSET(2114, glTexParameterf, glTexParameterf, NULL, 178),
- NAME_FUNC_OFFSET(2130, glTexParameterfv, glTexParameterfv, NULL, 179),
- NAME_FUNC_OFFSET(2147, glTexParameteri, glTexParameteri, NULL, 180),
- NAME_FUNC_OFFSET(2163, glTexParameteriv, glTexParameteriv, NULL, 181),
- NAME_FUNC_OFFSET(2180, glTexImage1D, glTexImage1D, NULL, 182),
- NAME_FUNC_OFFSET(2193, glTexImage2D, glTexImage2D, NULL, 183),
- NAME_FUNC_OFFSET(2206, glTexEnvf, glTexEnvf, NULL, 184),
- NAME_FUNC_OFFSET(2216, glTexEnvfv, glTexEnvfv, NULL, 185),
- NAME_FUNC_OFFSET(2227, glTexEnvi, glTexEnvi, NULL, 186),
- NAME_FUNC_OFFSET(2237, glTexEnviv, glTexEnviv, NULL, 187),
- NAME_FUNC_OFFSET(2248, glTexGend, glTexGend, NULL, 188),
- NAME_FUNC_OFFSET(2258, glTexGendv, glTexGendv, NULL, 189),
- NAME_FUNC_OFFSET(2269, glTexGenf, glTexGenf, NULL, 190),
- NAME_FUNC_OFFSET(2279, glTexGenfv, glTexGenfv, NULL, 191),
- NAME_FUNC_OFFSET(2290, glTexGeni, glTexGeni, NULL, 192),
- NAME_FUNC_OFFSET(2300, glTexGeniv, glTexGeniv, NULL, 193),
- NAME_FUNC_OFFSET(2311, glFeedbackBuffer, glFeedbackBuffer, NULL, 194),
- NAME_FUNC_OFFSET(2328, glSelectBuffer, glSelectBuffer, NULL, 195),
- NAME_FUNC_OFFSET(2343, glRenderMode, glRenderMode, NULL, 196),
- NAME_FUNC_OFFSET(2356, glInitNames, glInitNames, NULL, 197),
- NAME_FUNC_OFFSET(2368, glLoadName, glLoadName, NULL, 198),
- NAME_FUNC_OFFSET(2379, glPassThrough, glPassThrough, NULL, 199),
- NAME_FUNC_OFFSET(2393, glPopName, glPopName, NULL, 200),
- NAME_FUNC_OFFSET(2403, glPushName, glPushName, NULL, 201),
- NAME_FUNC_OFFSET(2414, glDrawBuffer, glDrawBuffer, NULL, 202),
- NAME_FUNC_OFFSET(2427, glClear, glClear, NULL, 203),
- NAME_FUNC_OFFSET(2435, glClearAccum, glClearAccum, NULL, 204),
- NAME_FUNC_OFFSET(2448, glClearIndex, glClearIndex, NULL, 205),
- NAME_FUNC_OFFSET(2461, glClearColor, glClearColor, NULL, 206),
- NAME_FUNC_OFFSET(2474, glClearStencil, glClearStencil, NULL, 207),
- NAME_FUNC_OFFSET(2489, glClearDepth, glClearDepth, NULL, 208),
- NAME_FUNC_OFFSET(2502, glStencilMask, glStencilMask, NULL, 209),
- NAME_FUNC_OFFSET(2516, glColorMask, glColorMask, NULL, 210),
- NAME_FUNC_OFFSET(2528, glDepthMask, glDepthMask, NULL, 211),
- NAME_FUNC_OFFSET(2540, glIndexMask, glIndexMask, NULL, 212),
- NAME_FUNC_OFFSET(2552, glAccum, glAccum, NULL, 213),
- NAME_FUNC_OFFSET(2560, glDisable, glDisable, NULL, 214),
- NAME_FUNC_OFFSET(2570, glEnable, glEnable, NULL, 215),
- NAME_FUNC_OFFSET(2579, glFinish, glFinish, NULL, 216),
- NAME_FUNC_OFFSET(2588, glFlush, glFlush, NULL, 217),
- NAME_FUNC_OFFSET(2596, glPopAttrib, glPopAttrib, NULL, 218),
- NAME_FUNC_OFFSET(2608, glPushAttrib, glPushAttrib, NULL, 219),
- NAME_FUNC_OFFSET(2621, glMap1d, glMap1d, NULL, 220),
- NAME_FUNC_OFFSET(2629, glMap1f, glMap1f, NULL, 221),
- NAME_FUNC_OFFSET(2637, glMap2d, glMap2d, NULL, 222),
- NAME_FUNC_OFFSET(2645, glMap2f, glMap2f, NULL, 223),
- NAME_FUNC_OFFSET(2653, glMapGrid1d, glMapGrid1d, NULL, 224),
- NAME_FUNC_OFFSET(2665, glMapGrid1f, glMapGrid1f, NULL, 225),
- NAME_FUNC_OFFSET(2677, glMapGrid2d, glMapGrid2d, NULL, 226),
- NAME_FUNC_OFFSET(2689, glMapGrid2f, glMapGrid2f, NULL, 227),
- NAME_FUNC_OFFSET(2701, glEvalCoord1d, glEvalCoord1d, NULL, 228),
- NAME_FUNC_OFFSET(2715, glEvalCoord1dv, glEvalCoord1dv, NULL, 229),
- NAME_FUNC_OFFSET(2730, glEvalCoord1f, glEvalCoord1f, NULL, 230),
- NAME_FUNC_OFFSET(2744, glEvalCoord1fv, glEvalCoord1fv, NULL, 231),
- NAME_FUNC_OFFSET(2759, glEvalCoord2d, glEvalCoord2d, NULL, 232),
- NAME_FUNC_OFFSET(2773, glEvalCoord2dv, glEvalCoord2dv, NULL, 233),
- NAME_FUNC_OFFSET(2788, glEvalCoord2f, glEvalCoord2f, NULL, 234),
- NAME_FUNC_OFFSET(2802, glEvalCoord2fv, glEvalCoord2fv, NULL, 235),
- NAME_FUNC_OFFSET(2817, glEvalMesh1, glEvalMesh1, NULL, 236),
- NAME_FUNC_OFFSET(2829, glEvalPoint1, glEvalPoint1, NULL, 237),
- NAME_FUNC_OFFSET(2842, glEvalMesh2, glEvalMesh2, NULL, 238),
- NAME_FUNC_OFFSET(2854, glEvalPoint2, glEvalPoint2, NULL, 239),
- NAME_FUNC_OFFSET(2867, glAlphaFunc, glAlphaFunc, NULL, 240),
- NAME_FUNC_OFFSET(2879, glBlendFunc, glBlendFunc, NULL, 241),
- NAME_FUNC_OFFSET(2891, glLogicOp, glLogicOp, NULL, 242),
- NAME_FUNC_OFFSET(2901, glStencilFunc, glStencilFunc, NULL, 243),
- NAME_FUNC_OFFSET(2915, glStencilOp, glStencilOp, NULL, 244),
- NAME_FUNC_OFFSET(2927, glDepthFunc, glDepthFunc, NULL, 245),
- NAME_FUNC_OFFSET(2939, glPixelZoom, glPixelZoom, NULL, 246),
- NAME_FUNC_OFFSET(2951, glPixelTransferf, glPixelTransferf, NULL, 247),
- NAME_FUNC_OFFSET(2968, glPixelTransferi, glPixelTransferi, NULL, 248),
- NAME_FUNC_OFFSET(2985, glPixelStoref, glPixelStoref, NULL, 249),
- NAME_FUNC_OFFSET(2999, glPixelStorei, glPixelStorei, NULL, 250),
- NAME_FUNC_OFFSET(3013, glPixelMapfv, glPixelMapfv, NULL, 251),
- NAME_FUNC_OFFSET(3026, glPixelMapuiv, glPixelMapuiv, NULL, 252),
- NAME_FUNC_OFFSET(3040, glPixelMapusv, glPixelMapusv, NULL, 253),
- NAME_FUNC_OFFSET(3054, glReadBuffer, glReadBuffer, NULL, 254),
- NAME_FUNC_OFFSET(3067, glCopyPixels, glCopyPixels, NULL, 255),
- NAME_FUNC_OFFSET(3080, glReadPixels, glReadPixels, NULL, 256),
- NAME_FUNC_OFFSET(3093, glDrawPixels, glDrawPixels, NULL, 257),
- NAME_FUNC_OFFSET(3106, glGetBooleanv, glGetBooleanv, NULL, 258),
- NAME_FUNC_OFFSET(3120, glGetClipPlane, glGetClipPlane, NULL, 259),
- NAME_FUNC_OFFSET(3135, glGetDoublev, glGetDoublev, NULL, 260),
- NAME_FUNC_OFFSET(3148, glGetError, glGetError, NULL, 261),
- NAME_FUNC_OFFSET(3159, glGetFloatv, glGetFloatv, NULL, 262),
- NAME_FUNC_OFFSET(3171, glGetIntegerv, glGetIntegerv, NULL, 263),
- NAME_FUNC_OFFSET(3185, glGetLightfv, glGetLightfv, NULL, 264),
- NAME_FUNC_OFFSET(3198, glGetLightiv, glGetLightiv, NULL, 265),
- NAME_FUNC_OFFSET(3211, glGetMapdv, glGetMapdv, NULL, 266),
- NAME_FUNC_OFFSET(3222, glGetMapfv, glGetMapfv, NULL, 267),
- NAME_FUNC_OFFSET(3233, glGetMapiv, glGetMapiv, NULL, 268),
- NAME_FUNC_OFFSET(3244, glGetMaterialfv, glGetMaterialfv, NULL, 269),
- NAME_FUNC_OFFSET(3260, glGetMaterialiv, glGetMaterialiv, NULL, 270),
- NAME_FUNC_OFFSET(3276, glGetPixelMapfv, glGetPixelMapfv, NULL, 271),
- NAME_FUNC_OFFSET(3292, glGetPixelMapuiv, glGetPixelMapuiv, NULL, 272),
- NAME_FUNC_OFFSET(3309, glGetPixelMapusv, glGetPixelMapusv, NULL, 273),
- NAME_FUNC_OFFSET(3326, glGetPolygonStipple, glGetPolygonStipple, NULL, 274),
- NAME_FUNC_OFFSET(3346, glGetString, glGetString, NULL, 275),
- NAME_FUNC_OFFSET(3358, glGetTexEnvfv, glGetTexEnvfv, NULL, 276),
- NAME_FUNC_OFFSET(3372, glGetTexEnviv, glGetTexEnviv, NULL, 277),
- NAME_FUNC_OFFSET(3386, glGetTexGendv, glGetTexGendv, NULL, 278),
- NAME_FUNC_OFFSET(3400, glGetTexGenfv, glGetTexGenfv, NULL, 279),
- NAME_FUNC_OFFSET(3414, glGetTexGeniv, glGetTexGeniv, NULL, 280),
- NAME_FUNC_OFFSET(3428, glGetTexImage, glGetTexImage, NULL, 281),
- NAME_FUNC_OFFSET(3442, glGetTexParameterfv, glGetTexParameterfv, NULL, 282),
- NAME_FUNC_OFFSET(3462, glGetTexParameteriv, glGetTexParameteriv, NULL, 283),
- NAME_FUNC_OFFSET(3482, glGetTexLevelParameterfv, glGetTexLevelParameterfv,
- NULL, 284),
- NAME_FUNC_OFFSET(3507, glGetTexLevelParameteriv, glGetTexLevelParameteriv,
- NULL, 285),
- NAME_FUNC_OFFSET(3532, glIsEnabled, glIsEnabled, NULL, 286),
- NAME_FUNC_OFFSET(3544, glIsList, glIsList, NULL, 287),
- NAME_FUNC_OFFSET(3553, glDepthRange, glDepthRange, NULL, 288),
- NAME_FUNC_OFFSET(3566, glFrustum, glFrustum, NULL, 289),
- NAME_FUNC_OFFSET(3576, glLoadIdentity, glLoadIdentity, NULL, 290),
- NAME_FUNC_OFFSET(3591, glLoadMatrixf, glLoadMatrixf, NULL, 291),
- NAME_FUNC_OFFSET(3605, glLoadMatrixd, glLoadMatrixd, NULL, 292),
- NAME_FUNC_OFFSET(3619, glMatrixMode, glMatrixMode, NULL, 293),
- NAME_FUNC_OFFSET(3632, glMultMatrixf, glMultMatrixf, NULL, 294),
- NAME_FUNC_OFFSET(3646, glMultMatrixd, glMultMatrixd, NULL, 295),
- NAME_FUNC_OFFSET(3660, glOrtho, glOrtho, NULL, 296),
- NAME_FUNC_OFFSET(3668, glPopMatrix, glPopMatrix, NULL, 297),
- NAME_FUNC_OFFSET(3680, glPushMatrix, glPushMatrix, NULL, 298),
- NAME_FUNC_OFFSET(3693, glRotated, glRotated, NULL, 299),
- NAME_FUNC_OFFSET(3703, glRotatef, glRotatef, NULL, 300),
- NAME_FUNC_OFFSET(3713, glScaled, glScaled, NULL, 301),
- NAME_FUNC_OFFSET(3722, glScalef, glScalef, NULL, 302),
- NAME_FUNC_OFFSET(3731, glTranslated, glTranslated, NULL, 303),
- NAME_FUNC_OFFSET(3744, glTranslatef, glTranslatef, NULL, 304),
- NAME_FUNC_OFFSET(3757, glViewport, glViewport, NULL, 305),
- NAME_FUNC_OFFSET(3768, glArrayElement, glArrayElement, NULL, 306),
- NAME_FUNC_OFFSET(3783, glBindTexture, glBindTexture, NULL, 307),
- NAME_FUNC_OFFSET(3797, glColorPointer, glColorPointer, NULL, 308),
- NAME_FUNC_OFFSET(3812, glDisableClientState, glDisableClientState, NULL,
- 309),
- NAME_FUNC_OFFSET(3833, glDrawArrays, glDrawArrays, NULL, 310),
- NAME_FUNC_OFFSET(3846, glDrawElements, glDrawElements, NULL, 311),
- NAME_FUNC_OFFSET(3861, glEdgeFlagPointer, glEdgeFlagPointer, NULL, 312),
- NAME_FUNC_OFFSET(3879, glEnableClientState, glEnableClientState, NULL, 313),
- NAME_FUNC_OFFSET(3899, glIndexPointer, glIndexPointer, NULL, 314),
- NAME_FUNC_OFFSET(3914, glIndexub, glIndexub, NULL, 315),
- NAME_FUNC_OFFSET(3924, glIndexubv, glIndexubv, NULL, 316),
- NAME_FUNC_OFFSET(3935, glInterleavedArrays, glInterleavedArrays, NULL, 317),
- NAME_FUNC_OFFSET(3955, glNormalPointer, glNormalPointer, NULL, 318),
- NAME_FUNC_OFFSET(3971, glPolygonOffset, glPolygonOffset, NULL, 319),
- NAME_FUNC_OFFSET(3987, glTexCoordPointer, glTexCoordPointer, NULL, 320),
- NAME_FUNC_OFFSET(4005, glVertexPointer, glVertexPointer, NULL, 321),
- NAME_FUNC_OFFSET(4021, glAreTexturesResident, glAreTexturesResident, NULL,
- 322),
- NAME_FUNC_OFFSET(4043, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
- NAME_FUNC_OFFSET(4060, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
- NAME_FUNC_OFFSET(4077, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
- NAME_FUNC_OFFSET(4097, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
- NAME_FUNC_OFFSET(4117, glDeleteTextures, glDeleteTextures, NULL, 327),
- NAME_FUNC_OFFSET(4134, glGenTextures, glGenTextures, NULL, 328),
- NAME_FUNC_OFFSET(4148, glGetPointerv, glGetPointerv, NULL, 329),
- NAME_FUNC_OFFSET(4162, glIsTexture, glIsTexture, NULL, 330),
- NAME_FUNC_OFFSET(4174, glPrioritizeTextures, glPrioritizeTextures, NULL,
- 331),
- NAME_FUNC_OFFSET(4195, glTexSubImage1D, glTexSubImage1D, NULL, 332),
- NAME_FUNC_OFFSET(4211, glTexSubImage2D, glTexSubImage2D, NULL, 333),
- NAME_FUNC_OFFSET(4227, glPopClientAttrib, glPopClientAttrib, NULL, 334),
- NAME_FUNC_OFFSET(4245, glPushClientAttrib, glPushClientAttrib, NULL, 335),
- NAME_FUNC_OFFSET(4264, glBlendColor, glBlendColor, NULL, 336),
- NAME_FUNC_OFFSET(4277, glBlendEquation, glBlendEquation, NULL, 337),
- NAME_FUNC_OFFSET(4293, glDrawRangeElements, glDrawRangeElements, NULL, 338),
- NAME_FUNC_OFFSET(4313, glColorTable, glColorTable, NULL, 339),
- NAME_FUNC_OFFSET(4326, glColorTableParameterfv, glColorTableParameterfv,
- NULL, 340),
- NAME_FUNC_OFFSET(4350, glColorTableParameteriv, glColorTableParameteriv,
- NULL, 341),
- NAME_FUNC_OFFSET(4374, glCopyColorTable, glCopyColorTable, NULL, 342),
- NAME_FUNC_OFFSET(4391, glGetColorTable, glGetColorTable, NULL, 343),
- NAME_FUNC_OFFSET(4407, glGetColorTableParameterfv,
- glGetColorTableParameterfv, NULL, 344),
- NAME_FUNC_OFFSET(4434, glGetColorTableParameteriv,
- glGetColorTableParameteriv, NULL, 345),
- NAME_FUNC_OFFSET(4461, glColorSubTable, glColorSubTable, NULL, 346),
- NAME_FUNC_OFFSET(4477, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
- NAME_FUNC_OFFSET(4497, glConvolutionFilter1D, glConvolutionFilter1D, NULL,
- 348),
- NAME_FUNC_OFFSET(4519, glConvolutionFilter2D, glConvolutionFilter2D, NULL,
- 349),
- NAME_FUNC_OFFSET(4541, glConvolutionParameterf, glConvolutionParameterf,
- NULL, 350),
- NAME_FUNC_OFFSET(4565, glConvolutionParameterfv, glConvolutionParameterfv,
- NULL, 351),
- NAME_FUNC_OFFSET(4590, glConvolutionParameteri, glConvolutionParameteri,
- NULL, 352),
- NAME_FUNC_OFFSET(4614, glConvolutionParameteriv, glConvolutionParameteriv,
- NULL, 353),
- NAME_FUNC_OFFSET(4639, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D,
- NULL, 354),
- NAME_FUNC_OFFSET(4665, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D,
- NULL, 355),
- NAME_FUNC_OFFSET(4691, glGetConvolutionFilter, glGetConvolutionFilter, NULL,
- 356),
- NAME_FUNC_OFFSET(4714, glGetConvolutionParameterfv,
- glGetConvolutionParameterfv, NULL, 357),
- NAME_FUNC_OFFSET(4742, glGetConvolutionParameteriv,
- glGetConvolutionParameteriv, NULL, 358),
- NAME_FUNC_OFFSET(4770, glGetSeparableFilter, glGetSeparableFilter, NULL,
- 359),
- NAME_FUNC_OFFSET(4791, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
- NAME_FUNC_OFFSET(4811, glGetHistogram, glGetHistogram, NULL, 361),
- NAME_FUNC_OFFSET(4826, glGetHistogramParameterfv, glGetHistogramParameterfv,
- NULL, 362),
- NAME_FUNC_OFFSET(4852, glGetHistogramParameteriv, glGetHistogramParameteriv,
- NULL, 363),
- NAME_FUNC_OFFSET(4878, glGetMinmax, glGetMinmax, NULL, 364),
- NAME_FUNC_OFFSET(4890, glGetMinmaxParameterfv, glGetMinmaxParameterfv, NULL,
- 365),
- NAME_FUNC_OFFSET(4913, glGetMinmaxParameteriv, glGetMinmaxParameteriv, NULL,
- 366),
- NAME_FUNC_OFFSET(4936, glHistogram, glHistogram, NULL, 367),
- NAME_FUNC_OFFSET(4948, glMinmax, glMinmax, NULL, 368),
- NAME_FUNC_OFFSET(4957, glResetHistogram, glResetHistogram, NULL, 369),
- NAME_FUNC_OFFSET(4974, glResetMinmax, glResetMinmax, NULL, 370),
- NAME_FUNC_OFFSET(4988, glTexImage3D, glTexImage3D, NULL, 371),
- NAME_FUNC_OFFSET(5001, glTexSubImage3D, glTexSubImage3D, NULL, 372),
- NAME_FUNC_OFFSET(5017, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
- NAME_FUNC_OFFSET(5037, glActiveTextureARB, glActiveTextureARB, NULL, 374),
- NAME_FUNC_OFFSET(5056, glClientActiveTextureARB, glClientActiveTextureARB,
- NULL, 375),
- NAME_FUNC_OFFSET(5081, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL,
- 376),
- NAME_FUNC_OFFSET(5102, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL,
- 377),
- NAME_FUNC_OFFSET(5124, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL,
- 378),
- NAME_FUNC_OFFSET(5145, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL,
- 379),
- NAME_FUNC_OFFSET(5167, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL,
- 380),
- NAME_FUNC_OFFSET(5188, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL,
- 381),
- NAME_FUNC_OFFSET(5210, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL,
- 382),
- NAME_FUNC_OFFSET(5231, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL,
- 383),
- NAME_FUNC_OFFSET(5253, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL,
- 384),
- NAME_FUNC_OFFSET(5274, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL,
- 385),
- NAME_FUNC_OFFSET(5296, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL,
- 386),
- NAME_FUNC_OFFSET(5317, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL,
- 387),
- NAME_FUNC_OFFSET(5339, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL,
- 388),
- NAME_FUNC_OFFSET(5360, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL,
- 389),
- NAME_FUNC_OFFSET(5382, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL,
- 390),
- NAME_FUNC_OFFSET(5403, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL,
- 391),
- NAME_FUNC_OFFSET(5425, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL,
- 392),
- NAME_FUNC_OFFSET(5446, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL,
- 393),
- NAME_FUNC_OFFSET(5468, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL,
- 394),
- NAME_FUNC_OFFSET(5489, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL,
- 395),
- NAME_FUNC_OFFSET(5511, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL,
- 396),
- NAME_FUNC_OFFSET(5532, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL,
- 397),
- NAME_FUNC_OFFSET(5554, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL,
- 398),
- NAME_FUNC_OFFSET(5575, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL,
- 399),
- NAME_FUNC_OFFSET(5597, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL,
- 400),
- NAME_FUNC_OFFSET(5618, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL,
- 401),
- NAME_FUNC_OFFSET(5640, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL,
- 402),
- NAME_FUNC_OFFSET(5661, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL,
- 403),
- NAME_FUNC_OFFSET(5683, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL,
- 404),
- NAME_FUNC_OFFSET(5704, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL,
- 405),
- NAME_FUNC_OFFSET(5726, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL,
- 406),
- NAME_FUNC_OFFSET(5747, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL,
- 407),
- NAME_FUNC_OFFSET(5769, glAttachShader, glAttachShader, NULL, 408),
- NAME_FUNC_OFFSET(5784, glCreateProgram, glCreateProgram, NULL, 409),
- NAME_FUNC_OFFSET(5800, glCreateShader, glCreateShader, NULL, 410),
- NAME_FUNC_OFFSET(5815, glDeleteProgram, glDeleteProgram, NULL, 411),
- NAME_FUNC_OFFSET(5831, glDeleteShader, glDeleteShader, NULL, 412),
- NAME_FUNC_OFFSET(5846, glDetachShader, glDetachShader, NULL, 413),
- NAME_FUNC_OFFSET(5861, glGetAttachedShaders, glGetAttachedShaders, NULL,
- 414),
- NAME_FUNC_OFFSET(5882, glGetProgramInfoLog, glGetProgramInfoLog, NULL, 415),
- NAME_FUNC_OFFSET(5902, glGetProgramiv, glGetProgramiv, NULL, 416),
- NAME_FUNC_OFFSET(5917, glGetShaderInfoLog, glGetShaderInfoLog, NULL, 417),
- NAME_FUNC_OFFSET(5936, glGetShaderiv, glGetShaderiv, NULL, 418),
- NAME_FUNC_OFFSET(5950, glIsProgram, glIsProgram, NULL, 419),
- NAME_FUNC_OFFSET(5962, glIsShader, glIsShader, NULL, 420),
- NAME_FUNC_OFFSET(5973, glStencilFuncSeparate, glStencilFuncSeparate, NULL,
- 421),
- NAME_FUNC_OFFSET(5995, glStencilMaskSeparate, glStencilMaskSeparate, NULL,
- 422),
- NAME_FUNC_OFFSET(6017, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
- NAME_FUNC_OFFSET(6037, glUniformMatrix2x3fv, glUniformMatrix2x3fv, NULL,
- 424),
- NAME_FUNC_OFFSET(6058, glUniformMatrix2x4fv, glUniformMatrix2x4fv, NULL,
- 425),
- NAME_FUNC_OFFSET(6079, glUniformMatrix3x2fv, glUniformMatrix3x2fv, NULL,
- 426),
- NAME_FUNC_OFFSET(6100, glUniformMatrix3x4fv, glUniformMatrix3x4fv, NULL,
- 427),
- NAME_FUNC_OFFSET(6121, glUniformMatrix4x2fv, glUniformMatrix4x2fv, NULL,
- 428),
- NAME_FUNC_OFFSET(6142, glUniformMatrix4x3fv, glUniformMatrix4x3fv, NULL,
- 429),
- NAME_FUNC_OFFSET(6163, glClampColor, glClampColor, NULL, 430),
- NAME_FUNC_OFFSET(6176, glClearBufferfi, glClearBufferfi, NULL, 431),
- NAME_FUNC_OFFSET(6192, glClearBufferfv, glClearBufferfv, NULL, 432),
- NAME_FUNC_OFFSET(6208, glClearBufferiv, glClearBufferiv, NULL, 433),
- NAME_FUNC_OFFSET(6224, glClearBufferuiv, glClearBufferuiv, NULL, 434),
- NAME_FUNC_OFFSET(6241, glGetStringi, glGetStringi, NULL, 435),
- NAME_FUNC_OFFSET(6254, glTexBuffer, glTexBuffer, NULL, 436),
- NAME_FUNC_OFFSET(6266, glFramebufferTexture, glFramebufferTexture, NULL,
- 437),
- NAME_FUNC_OFFSET(6287, glGetBufferParameteri64v, glGetBufferParameteri64v,
- NULL, 438),
- NAME_FUNC_OFFSET(6312, glGetInteger64i_v, glGetInteger64i_v, NULL, 439),
- NAME_FUNC_OFFSET(6330, glVertexAttribDivisor, glVertexAttribDivisor, NULL,
- 440),
- NAME_FUNC_OFFSET(6352, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB,
- NULL, 441),
- NAME_FUNC_OFFSET(6378, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB,
- NULL, 442),
- NAME_FUNC_OFFSET(6404, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB,
- NULL, 443),
- NAME_FUNC_OFFSET(6430, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB,
- NULL, 444),
- NAME_FUNC_OFFSET(6456, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
- NAME_FUNC_OFFSET(6476, glCompressedTexImage1DARB, glCompressedTexImage1DARB,
- NULL, 446),
- NAME_FUNC_OFFSET(6502, glCompressedTexImage2DARB, glCompressedTexImage2DARB,
- NULL, 447),
- NAME_FUNC_OFFSET(6528, glCompressedTexImage3DARB, glCompressedTexImage3DARB,
- NULL, 448),
- NAME_FUNC_OFFSET(6554, glCompressedTexSubImage1DARB,
- glCompressedTexSubImage1DARB, NULL, 449),
- NAME_FUNC_OFFSET(6583, glCompressedTexSubImage2DARB,
- glCompressedTexSubImage2DARB, NULL, 450),
- NAME_FUNC_OFFSET(6612, glCompressedTexSubImage3DARB,
- glCompressedTexSubImage3DARB, NULL, 451),
- NAME_FUNC_OFFSET(6641, glGetCompressedTexImageARB,
- glGetCompressedTexImageARB, NULL, 452),
- NAME_FUNC_OFFSET(6668, glDisableVertexAttribArrayARB,
- glDisableVertexAttribArrayARB, NULL, 453),
- NAME_FUNC_OFFSET(6698, glEnableVertexAttribArrayARB,
- glEnableVertexAttribArrayARB, NULL, 454),
- NAME_FUNC_OFFSET(6727, glGetProgramEnvParameterdvARB,
- glGetProgramEnvParameterdvARB, NULL, 455),
- NAME_FUNC_OFFSET(6757, glGetProgramEnvParameterfvARB,
- glGetProgramEnvParameterfvARB, NULL, 456),
- NAME_FUNC_OFFSET(6787, glGetProgramLocalParameterdvARB,
- glGetProgramLocalParameterdvARB, NULL, 457),
- NAME_FUNC_OFFSET(6819, glGetProgramLocalParameterfvARB,
- glGetProgramLocalParameterfvARB, NULL, 458),
- NAME_FUNC_OFFSET(6851, glGetProgramStringARB, glGetProgramStringARB, NULL,
- 459),
- NAME_FUNC_OFFSET(6873, glGetProgramivARB, glGetProgramivARB, NULL, 460),
- NAME_FUNC_OFFSET(6891, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL,
- 461),
- NAME_FUNC_OFFSET(6914, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL,
- 462),
- NAME_FUNC_OFFSET(6937, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL,
- 463),
- NAME_FUNC_OFFSET(6960, glProgramEnvParameter4dARB,
- glProgramEnvParameter4dARB, NULL, 464),
- NAME_FUNC_OFFSET(6987, glProgramEnvParameter4dvARB,
- glProgramEnvParameter4dvARB, NULL, 465),
- NAME_FUNC_OFFSET(7015, glProgramEnvParameter4fARB,
- glProgramEnvParameter4fARB, NULL, 466),
- NAME_FUNC_OFFSET(7042, glProgramEnvParameter4fvARB,
- glProgramEnvParameter4fvARB, NULL, 467),
- NAME_FUNC_OFFSET(7070, glProgramLocalParameter4dARB,
- glProgramLocalParameter4dARB, NULL, 468),
- NAME_FUNC_OFFSET(7099, glProgramLocalParameter4dvARB,
- glProgramLocalParameter4dvARB, NULL, 469),
- NAME_FUNC_OFFSET(7129, glProgramLocalParameter4fARB,
- glProgramLocalParameter4fARB, NULL, 470),
- NAME_FUNC_OFFSET(7158, glProgramLocalParameter4fvARB,
- glProgramLocalParameter4fvARB, NULL, 471),
- NAME_FUNC_OFFSET(7188, glProgramStringARB, glProgramStringARB, NULL, 472),
- NAME_FUNC_OFFSET(7207, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
- NAME_FUNC_OFFSET(7227, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL,
- 474),
- NAME_FUNC_OFFSET(7248, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
- NAME_FUNC_OFFSET(7268, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL,
- 476),
- NAME_FUNC_OFFSET(7289, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
- NAME_FUNC_OFFSET(7309, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL,
- 478),
- NAME_FUNC_OFFSET(7330, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
- NAME_FUNC_OFFSET(7350, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL,
- 480),
- NAME_FUNC_OFFSET(7371, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
- NAME_FUNC_OFFSET(7391, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL,
- 482),
- NAME_FUNC_OFFSET(7412, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
- NAME_FUNC_OFFSET(7432, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL,
- 484),
- NAME_FUNC_OFFSET(7453, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
- NAME_FUNC_OFFSET(7473, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL,
- 486),
- NAME_FUNC_OFFSET(7494, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
- NAME_FUNC_OFFSET(7514, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL,
- 488),
- NAME_FUNC_OFFSET(7535, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
- NAME_FUNC_OFFSET(7555, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL,
- 490),
- NAME_FUNC_OFFSET(7576, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL,
- 491),
- NAME_FUNC_OFFSET(7598, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL,
- 492),
- NAME_FUNC_OFFSET(7620, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL,
- 493),
- NAME_FUNC_OFFSET(7642, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL,
- 494),
- NAME_FUNC_OFFSET(7664, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL,
- 495),
- NAME_FUNC_OFFSET(7687, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL,
- 496),
- NAME_FUNC_OFFSET(7710, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL,
- 497),
- NAME_FUNC_OFFSET(7733, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL,
- 498),
- NAME_FUNC_OFFSET(7754, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
- NAME_FUNC_OFFSET(7774, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL,
- 500),
- NAME_FUNC_OFFSET(7795, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
- NAME_FUNC_OFFSET(7815, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL,
- 502),
- NAME_FUNC_OFFSET(7836, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL,
- 503),
- NAME_FUNC_OFFSET(7857, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
- NAME_FUNC_OFFSET(7877, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL,
- 505),
- NAME_FUNC_OFFSET(7898, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL,
- 506),
- NAME_FUNC_OFFSET(7920, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL,
- 507),
- NAME_FUNC_OFFSET(7942, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL,
- 508),
- NAME_FUNC_OFFSET(7964, glVertexAttribPointerARB, glVertexAttribPointerARB,
- NULL, 509),
- NAME_FUNC_OFFSET(7989, glBindBufferARB, glBindBufferARB, NULL, 510),
- NAME_FUNC_OFFSET(8005, glBufferDataARB, glBufferDataARB, NULL, 511),
- NAME_FUNC_OFFSET(8021, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
- NAME_FUNC_OFFSET(8040, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
- NAME_FUNC_OFFSET(8059, glGenBuffersARB, glGenBuffersARB, NULL, 514),
- NAME_FUNC_OFFSET(8075, glGetBufferParameterivARB, glGetBufferParameterivARB,
- NULL, 515),
- NAME_FUNC_OFFSET(8101, glGetBufferPointervARB, glGetBufferPointervARB, NULL,
- 516),
- NAME_FUNC_OFFSET(8124, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL,
- 517),
- NAME_FUNC_OFFSET(8146, glIsBufferARB, glIsBufferARB, NULL, 518),
- NAME_FUNC_OFFSET(8160, glMapBufferARB, glMapBufferARB, NULL, 519),
- NAME_FUNC_OFFSET(8175, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
- NAME_FUNC_OFFSET(8192, glBeginQueryARB, glBeginQueryARB, NULL, 521),
- NAME_FUNC_OFFSET(8208, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
- NAME_FUNC_OFFSET(8227, glEndQueryARB, glEndQueryARB, NULL, 523),
- NAME_FUNC_OFFSET(8241, glGenQueriesARB, glGenQueriesARB, NULL, 524),
- NAME_FUNC_OFFSET(8257, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL,
- 525),
- NAME_FUNC_OFFSET(8279, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL,
- 526),
- NAME_FUNC_OFFSET(8302, glGetQueryivARB, glGetQueryivARB, NULL, 527),
- NAME_FUNC_OFFSET(8318, glIsQueryARB, glIsQueryARB, NULL, 528),
- NAME_FUNC_OFFSET(8331, glAttachObjectARB, glAttachObjectARB, NULL, 529),
- NAME_FUNC_OFFSET(8349, glCompileShaderARB, glCompileShaderARB, NULL, 530),
- NAME_FUNC_OFFSET(8368, glCreateProgramObjectARB, glCreateProgramObjectARB,
- NULL, 531),
- NAME_FUNC_OFFSET(8393, glCreateShaderObjectARB, glCreateShaderObjectARB,
- NULL, 532),
- NAME_FUNC_OFFSET(8417, glDeleteObjectARB, glDeleteObjectARB, NULL, 533),
- NAME_FUNC_OFFSET(8435, glDetachObjectARB, glDetachObjectARB, NULL, 534),
- NAME_FUNC_OFFSET(8453, glGetActiveUniformARB, glGetActiveUniformARB, NULL,
- 535),
- NAME_FUNC_OFFSET(8475, glGetAttachedObjectsARB, glGetAttachedObjectsARB,
- NULL, 536),
- NAME_FUNC_OFFSET(8499, glGetHandleARB, glGetHandleARB, NULL, 537),
- NAME_FUNC_OFFSET(8514, glGetInfoLogARB, glGetInfoLogARB, NULL, 538),
- NAME_FUNC_OFFSET(8530, glGetObjectParameterfvARB, glGetObjectParameterfvARB,
- NULL, 539),
- NAME_FUNC_OFFSET(8556, glGetObjectParameterivARB, glGetObjectParameterivARB,
- NULL, 540),
- NAME_FUNC_OFFSET(8582, glGetShaderSourceARB, glGetShaderSourceARB, NULL,
- 541),
- NAME_FUNC_OFFSET(8603, glGetUniformLocationARB, glGetUniformLocationARB,
- NULL, 542),
- NAME_FUNC_OFFSET(8627, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
- NAME_FUNC_OFFSET(8645, glGetUniformivARB, glGetUniformivARB, NULL, 544),
- NAME_FUNC_OFFSET(8663, glLinkProgramARB, glLinkProgramARB, NULL, 545),
- NAME_FUNC_OFFSET(8680, glShaderSourceARB, glShaderSourceARB, NULL, 546),
- NAME_FUNC_OFFSET(8698, glUniform1fARB, glUniform1fARB, NULL, 547),
- NAME_FUNC_OFFSET(8713, glUniform1fvARB, glUniform1fvARB, NULL, 548),
- NAME_FUNC_OFFSET(8729, glUniform1iARB, glUniform1iARB, NULL, 549),
- NAME_FUNC_OFFSET(8744, glUniform1ivARB, glUniform1ivARB, NULL, 550),
- NAME_FUNC_OFFSET(8760, glUniform2fARB, glUniform2fARB, NULL, 551),
- NAME_FUNC_OFFSET(8775, glUniform2fvARB, glUniform2fvARB, NULL, 552),
- NAME_FUNC_OFFSET(8791, glUniform2iARB, glUniform2iARB, NULL, 553),
- NAME_FUNC_OFFSET(8806, glUniform2ivARB, glUniform2ivARB, NULL, 554),
- NAME_FUNC_OFFSET(8822, glUniform3fARB, glUniform3fARB, NULL, 555),
- NAME_FUNC_OFFSET(8837, glUniform3fvARB, glUniform3fvARB, NULL, 556),
- NAME_FUNC_OFFSET(8853, glUniform3iARB, glUniform3iARB, NULL, 557),
- NAME_FUNC_OFFSET(8868, glUniform3ivARB, glUniform3ivARB, NULL, 558),
- NAME_FUNC_OFFSET(8884, glUniform4fARB, glUniform4fARB, NULL, 559),
- NAME_FUNC_OFFSET(8899, glUniform4fvARB, glUniform4fvARB, NULL, 560),
- NAME_FUNC_OFFSET(8915, glUniform4iARB, glUniform4iARB, NULL, 561),
- NAME_FUNC_OFFSET(8930, glUniform4ivARB, glUniform4ivARB, NULL, 562),
- NAME_FUNC_OFFSET(8946, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL,
- 563),
- NAME_FUNC_OFFSET(8968, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL,
- 564),
- NAME_FUNC_OFFSET(8990, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL,
- 565),
- NAME_FUNC_OFFSET(9012, glUseProgramObjectARB, glUseProgramObjectARB, NULL,
- 566),
- NAME_FUNC_OFFSET(9034, glValidateProgramARB, glValidateProgramARB, NULL,
- 567),
- NAME_FUNC_OFFSET(9055, glBindAttribLocationARB, glBindAttribLocationARB,
- NULL, 568),
- NAME_FUNC_OFFSET(9079, glGetActiveAttribARB, glGetActiveAttribARB, NULL,
- 569),
- NAME_FUNC_OFFSET(9100, glGetAttribLocationARB, glGetAttribLocationARB, NULL,
- 570),
- NAME_FUNC_OFFSET(9123, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(9140, glClampColorARB, glClampColorARB, NULL, 572),
- NAME_FUNC_OFFSET(9156, glDrawArraysInstancedARB, glDrawArraysInstancedARB,
- NULL, 573),
- NAME_FUNC_OFFSET(9181, glDrawElementsInstancedARB,
- glDrawElementsInstancedARB, NULL, 574),
- NAME_FUNC_OFFSET(9208, glRenderbufferStorageMultisample,
- glRenderbufferStorageMultisample, NULL, 575),
- NAME_FUNC_OFFSET(9241, glFramebufferTextureARB, glFramebufferTextureARB,
- NULL, 576),
- NAME_FUNC_OFFSET(9265, glFramebufferTextureFaceARB,
- glFramebufferTextureFaceARB, NULL, 577),
- NAME_FUNC_OFFSET(9293, glProgramParameteriARB, glProgramParameteriARB, NULL,
- 578),
- NAME_FUNC_OFFSET(9316, glVertexAttribDivisorARB, glVertexAttribDivisorARB,
- NULL, 579),
- NAME_FUNC_OFFSET(9341, glFlushMappedBufferRange, glFlushMappedBufferRange,
- NULL, 580),
- NAME_FUNC_OFFSET(9366, glMapBufferRange, glMapBufferRange, NULL, 581),
- NAME_FUNC_OFFSET(9383, glTexBufferARB, glTexBufferARB, NULL, 582),
- NAME_FUNC_OFFSET(9398, glBindVertexArray, glBindVertexArray, NULL, 583),
- NAME_FUNC_OFFSET(9416, glGenVertexArrays, glGenVertexArrays, NULL, 584),
- NAME_FUNC_OFFSET(9434, glCopyBufferSubData, glCopyBufferSubData, NULL, 585),
- NAME_FUNC_OFFSET(9454, glClientWaitSync, glClientWaitSync, NULL, 586),
- NAME_FUNC_OFFSET(9471, glDeleteSync, glDeleteSync, NULL, 587),
- NAME_FUNC_OFFSET(9484, glFenceSync, glFenceSync, NULL, 588),
- NAME_FUNC_OFFSET(9496, glGetInteger64v, glGetInteger64v, NULL, 589),
- NAME_FUNC_OFFSET(9512, glGetSynciv, glGetSynciv, NULL, 590),
- NAME_FUNC_OFFSET(9524, glIsSync, glIsSync, NULL, 591),
- NAME_FUNC_OFFSET(9533, glWaitSync, glWaitSync, NULL, 592),
- NAME_FUNC_OFFSET(9544, glDrawElementsBaseVertex, glDrawElementsBaseVertex,
- NULL, 593),
- NAME_FUNC_OFFSET(9569, glDrawElementsInstancedBaseVertex,
- glDrawElementsInstancedBaseVertex, NULL, 594),
- NAME_FUNC_OFFSET(9603, glDrawRangeElementsBaseVertex,
- glDrawRangeElementsBaseVertex, NULL, 595),
- NAME_FUNC_OFFSET(9633, glMultiDrawElementsBaseVertex,
- glMultiDrawElementsBaseVertex, NULL, 596),
- NAME_FUNC_OFFSET(9663, glBlendEquationSeparateiARB,
- glBlendEquationSeparateiARB, NULL, 597),
- NAME_FUNC_OFFSET(9691, glBlendEquationiARB, glBlendEquationiARB, NULL, 598),
- NAME_FUNC_OFFSET(9711, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB,
- NULL, 599),
- NAME_FUNC_OFFSET(9735, glBlendFunciARB, glBlendFunciARB, NULL, 600),
- NAME_FUNC_OFFSET(9751, glBindSampler, glBindSampler, NULL, 601),
- NAME_FUNC_OFFSET(9765, glDeleteSamplers, glDeleteSamplers, NULL, 602),
- NAME_FUNC_OFFSET(9782, glGenSamplers, glGenSamplers, NULL, 603),
- NAME_FUNC_OFFSET(9796, glGetSamplerParameterIiv, glGetSamplerParameterIiv,
- NULL, 604),
- NAME_FUNC_OFFSET(9821, glGetSamplerParameterIuiv, glGetSamplerParameterIuiv,
- NULL, 605),
- NAME_FUNC_OFFSET(9847, glGetSamplerParameterfv, glGetSamplerParameterfv,
- NULL, 606),
- NAME_FUNC_OFFSET(9871, glGetSamplerParameteriv, glGetSamplerParameteriv,
- NULL, 607),
- NAME_FUNC_OFFSET(9895, glIsSampler, glIsSampler, NULL, 608),
- NAME_FUNC_OFFSET(9907, glSamplerParameterIiv, glSamplerParameterIiv, NULL,
- 609),
- NAME_FUNC_OFFSET(9929, glSamplerParameterIuiv, glSamplerParameterIuiv, NULL,
- 610),
- NAME_FUNC_OFFSET(9952, glSamplerParameterf, glSamplerParameterf, NULL, 611),
- NAME_FUNC_OFFSET(9972, glSamplerParameterfv, glSamplerParameterfv, NULL,
- 612),
- NAME_FUNC_OFFSET(9993, glSamplerParameteri, glSamplerParameteri, NULL, 613),
- NAME_FUNC_OFFSET(10013, glSamplerParameteriv, glSamplerParameteriv, NULL,
- 614),
- NAME_FUNC_OFFSET(10034, glColorP3ui, glColorP3ui, NULL, 615),
- NAME_FUNC_OFFSET(10046, glColorP3uiv, glColorP3uiv, NULL, 616),
- NAME_FUNC_OFFSET(10059, glColorP4ui, glColorP4ui, NULL, 617),
- NAME_FUNC_OFFSET(10071, glColorP4uiv, glColorP4uiv, NULL, 618),
- NAME_FUNC_OFFSET(10084, glMultiTexCoordP1ui, glMultiTexCoordP1ui, NULL,
- 619),
- NAME_FUNC_OFFSET(10104, glMultiTexCoordP1uiv, glMultiTexCoordP1uiv, NULL,
- 620),
- NAME_FUNC_OFFSET(10125, glMultiTexCoordP2ui, glMultiTexCoordP2ui, NULL,
- 621),
- NAME_FUNC_OFFSET(10145, glMultiTexCoordP2uiv, glMultiTexCoordP2uiv, NULL,
- 622),
- NAME_FUNC_OFFSET(10166, glMultiTexCoordP3ui, glMultiTexCoordP3ui, NULL,
- 623),
- NAME_FUNC_OFFSET(10186, glMultiTexCoordP3uiv, glMultiTexCoordP3uiv, NULL,
- 624),
- NAME_FUNC_OFFSET(10207, glMultiTexCoordP4ui, glMultiTexCoordP4ui, NULL,
- 625),
- NAME_FUNC_OFFSET(10227, glMultiTexCoordP4uiv, glMultiTexCoordP4uiv, NULL,
- 626),
- NAME_FUNC_OFFSET(10248, glNormalP3ui, glNormalP3ui, NULL, 627),
- NAME_FUNC_OFFSET(10261, glNormalP3uiv, glNormalP3uiv, NULL, 628),
- NAME_FUNC_OFFSET(10275, glSecondaryColorP3ui, glSecondaryColorP3ui, NULL,
- 629),
- NAME_FUNC_OFFSET(10296, glSecondaryColorP3uiv, glSecondaryColorP3uiv, NULL,
- 630),
- NAME_FUNC_OFFSET(10318, glTexCoordP1ui, glTexCoordP1ui, NULL, 631),
- NAME_FUNC_OFFSET(10333, glTexCoordP1uiv, glTexCoordP1uiv, NULL, 632),
- NAME_FUNC_OFFSET(10349, glTexCoordP2ui, glTexCoordP2ui, NULL, 633),
- NAME_FUNC_OFFSET(10364, glTexCoordP2uiv, glTexCoordP2uiv, NULL, 634),
- NAME_FUNC_OFFSET(10380, glTexCoordP3ui, glTexCoordP3ui, NULL, 635),
- NAME_FUNC_OFFSET(10395, glTexCoordP3uiv, glTexCoordP3uiv, NULL, 636),
- NAME_FUNC_OFFSET(10411, glTexCoordP4ui, glTexCoordP4ui, NULL, 637),
- NAME_FUNC_OFFSET(10426, glTexCoordP4uiv, glTexCoordP4uiv, NULL, 638),
- NAME_FUNC_OFFSET(10442, glVertexAttribP1ui, glVertexAttribP1ui, NULL, 639),
- NAME_FUNC_OFFSET(10461, glVertexAttribP1uiv, glVertexAttribP1uiv, NULL,
- 640),
- NAME_FUNC_OFFSET(10481, glVertexAttribP2ui, glVertexAttribP2ui, NULL, 641),
- NAME_FUNC_OFFSET(10500, glVertexAttribP2uiv, glVertexAttribP2uiv, NULL,
- 642),
- NAME_FUNC_OFFSET(10520, glVertexAttribP3ui, glVertexAttribP3ui, NULL, 643),
- NAME_FUNC_OFFSET(10539, glVertexAttribP3uiv, glVertexAttribP3uiv, NULL,
- 644),
- NAME_FUNC_OFFSET(10559, glVertexAttribP4ui, glVertexAttribP4ui, NULL, 645),
- NAME_FUNC_OFFSET(10578, glVertexAttribP4uiv, glVertexAttribP4uiv, NULL,
- 646),
- NAME_FUNC_OFFSET(10598, glVertexP2ui, glVertexP2ui, NULL, 647),
- NAME_FUNC_OFFSET(10611, glVertexP2uiv, glVertexP2uiv, NULL, 648),
- NAME_FUNC_OFFSET(10625, glVertexP3ui, glVertexP3ui, NULL, 649),
- NAME_FUNC_OFFSET(10638, glVertexP3uiv, glVertexP3uiv, NULL, 650),
- NAME_FUNC_OFFSET(10652, glVertexP4ui, glVertexP4ui, NULL, 651),
- NAME_FUNC_OFFSET(10665, glVertexP4uiv, glVertexP4uiv, NULL, 652),
- NAME_FUNC_OFFSET(10679, glBindTransformFeedback, glBindTransformFeedback,
- NULL, 653),
- NAME_FUNC_OFFSET(10703, glDeleteTransformFeedbacks,
- glDeleteTransformFeedbacks, NULL, 654),
- NAME_FUNC_OFFSET(10730, glDrawTransformFeedback, glDrawTransformFeedback,
- NULL, 655),
- NAME_FUNC_OFFSET(10754, glGenTransformFeedbacks, glGenTransformFeedbacks,
- NULL, 656),
- NAME_FUNC_OFFSET(10778, glIsTransformFeedback, glIsTransformFeedback, NULL,
- 657),
- NAME_FUNC_OFFSET(10800, glPauseTransformFeedback, glPauseTransformFeedback,
- NULL, 658),
- NAME_FUNC_OFFSET(10825, glResumeTransformFeedback,
- glResumeTransformFeedback, NULL, 659),
- NAME_FUNC_OFFSET(10851, glClearDepthf, glClearDepthf, NULL, 660),
- NAME_FUNC_OFFSET(10865, glDepthRangef, glDepthRangef, NULL, 661),
- NAME_FUNC_OFFSET(10879, glGetShaderPrecisionFormat,
- glGetShaderPrecisionFormat, NULL, 662),
- NAME_FUNC_OFFSET(10906, glReleaseShaderCompiler, glReleaseShaderCompiler,
- NULL, 663),
- NAME_FUNC_OFFSET(10930, glShaderBinary, glShaderBinary, NULL, 664),
- NAME_FUNC_OFFSET(10945, glGetGraphicsResetStatusARB,
- glGetGraphicsResetStatusARB, NULL, 665),
- NAME_FUNC_OFFSET(10973, glGetnColorTableARB, glGetnColorTableARB, NULL,
- 666),
- NAME_FUNC_OFFSET(10993, glGetnCompressedTexImageARB,
- glGetnCompressedTexImageARB, NULL, 667),
- NAME_FUNC_OFFSET(11021, glGetnConvolutionFilterARB,
- glGetnConvolutionFilterARB, NULL, 668),
- NAME_FUNC_OFFSET(11048, glGetnHistogramARB, glGetnHistogramARB, NULL, 669),
- NAME_FUNC_OFFSET(11067, glGetnMapdvARB, glGetnMapdvARB, NULL, 670),
- NAME_FUNC_OFFSET(11082, glGetnMapfvARB, glGetnMapfvARB, NULL, 671),
- NAME_FUNC_OFFSET(11097, glGetnMapivARB, glGetnMapivARB, NULL, 672),
- NAME_FUNC_OFFSET(11112, glGetnMinmaxARB, glGetnMinmaxARB, NULL, 673),
- NAME_FUNC_OFFSET(11128, glGetnPixelMapfvARB, glGetnPixelMapfvARB, NULL,
- 674),
- NAME_FUNC_OFFSET(11148, glGetnPixelMapuivARB, glGetnPixelMapuivARB, NULL,
- 675),
- NAME_FUNC_OFFSET(11169, glGetnPixelMapusvARB, glGetnPixelMapusvARB, NULL,
- 676),
- NAME_FUNC_OFFSET(11190, glGetnPolygonStippleARB, glGetnPolygonStippleARB,
- NULL, 677),
- NAME_FUNC_OFFSET(11214, glGetnSeparableFilterARB, glGetnSeparableFilterARB,
- NULL, 678),
- NAME_FUNC_OFFSET(11239, glGetnTexImageARB, glGetnTexImageARB, NULL, 679),
- NAME_FUNC_OFFSET(11257, glGetnUniformdvARB, glGetnUniformdvARB, NULL, 680),
- NAME_FUNC_OFFSET(11276, glGetnUniformfvARB, glGetnUniformfvARB, NULL, 681),
- NAME_FUNC_OFFSET(11295, glGetnUniformivARB, glGetnUniformivARB, NULL, 682),
- NAME_FUNC_OFFSET(11314, glGetnUniformuivARB, glGetnUniformuivARB, NULL,
- 683),
- NAME_FUNC_OFFSET(11334, glReadnPixelsARB, glReadnPixelsARB, NULL, 684),
- NAME_FUNC_OFFSET(11351, glTexStorage1D, glTexStorage1D, NULL, 685),
- NAME_FUNC_OFFSET(11366, glTexStorage2D, glTexStorage2D, NULL, 686),
- NAME_FUNC_OFFSET(11381, glTexStorage3D, glTexStorage3D, NULL, 687),
- NAME_FUNC_OFFSET(11396, glTextureStorage1DEXT, glTextureStorage1DEXT, NULL,
- 688),
- NAME_FUNC_OFFSET(11418, glTextureStorage2DEXT, glTextureStorage2DEXT, NULL,
- 689),
- NAME_FUNC_OFFSET(11440, glTextureStorage3DEXT, glTextureStorage3DEXT, NULL,
- 690),
- NAME_FUNC_OFFSET(11462, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 691),
- NAME_FUNC_OFFSET(11481, gl_dispatch_stub_692, gl_dispatch_stub_692, NULL,
- 692),
- NAME_FUNC_OFFSET(11513, gl_dispatch_stub_693, gl_dispatch_stub_693, NULL,
- 693),
- NAME_FUNC_OFFSET(11545, gl_dispatch_stub_694, gl_dispatch_stub_694, NULL,
- 694),
- NAME_FUNC_OFFSET(11573, gl_dispatch_stub_695, gl_dispatch_stub_695, NULL,
- 695),
- NAME_FUNC_OFFSET(11602, gl_dispatch_stub_696, gl_dispatch_stub_696, NULL,
- 696),
- NAME_FUNC_OFFSET(11630, gl_dispatch_stub_697, gl_dispatch_stub_697, NULL,
- 697),
- NAME_FUNC_OFFSET(11659, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL,
- 698),
- NAME_FUNC_OFFSET(11676, gl_dispatch_stub_699, gl_dispatch_stub_699, NULL,
- 699),
- NAME_FUNC_OFFSET(11696, glColorPointerEXT, glColorPointerEXT, NULL, 700),
- NAME_FUNC_OFFSET(11714, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL,
- 701),
- NAME_FUNC_OFFSET(11735, glIndexPointerEXT, glIndexPointerEXT, NULL, 702),
- NAME_FUNC_OFFSET(11753, glNormalPointerEXT, glNormalPointerEXT, NULL, 703),
- NAME_FUNC_OFFSET(11772, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL,
- 704),
- NAME_FUNC_OFFSET(11793, glVertexPointerEXT, glVertexPointerEXT, NULL, 705),
- NAME_FUNC_OFFSET(11812, glPointParameterfEXT, glPointParameterfEXT, NULL,
- 706),
- NAME_FUNC_OFFSET(11833, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
- 707),
- NAME_FUNC_OFFSET(11855, glLockArraysEXT, glLockArraysEXT, NULL, 708),
- NAME_FUNC_OFFSET(11871, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 709),
- NAME_FUNC_OFFSET(11889, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL,
- 710),
- NAME_FUNC_OFFSET(11911, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT,
- NULL, 711),
- NAME_FUNC_OFFSET(11934, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL,
- 712),
- NAME_FUNC_OFFSET(11956, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT,
- NULL, 713),
- NAME_FUNC_OFFSET(11979, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL,
- 714),
- NAME_FUNC_OFFSET(12001, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT,
- NULL, 715),
- NAME_FUNC_OFFSET(12024, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL,
- 716),
- NAME_FUNC_OFFSET(12046, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT,
- NULL, 717),
- NAME_FUNC_OFFSET(12069, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL,
- 718),
- NAME_FUNC_OFFSET(12091, glSecondaryColor3svEXT, glSecondaryColor3svEXT,
- NULL, 719),
- NAME_FUNC_OFFSET(12114, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT,
- NULL, 720),
- NAME_FUNC_OFFSET(12137, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT,
- NULL, 721),
- NAME_FUNC_OFFSET(12161, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT,
- NULL, 722),
- NAME_FUNC_OFFSET(12184, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT,
- NULL, 723),
- NAME_FUNC_OFFSET(12208, glSecondaryColor3usEXT, glSecondaryColor3usEXT,
- NULL, 724),
- NAME_FUNC_OFFSET(12231, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT,
- NULL, 725),
- NAME_FUNC_OFFSET(12255, glSecondaryColorPointerEXT,
- glSecondaryColorPointerEXT, NULL, 726),
- NAME_FUNC_OFFSET(12282, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL,
- 727),
- NAME_FUNC_OFFSET(12303, glMultiDrawElementsEXT, glMultiDrawElementsEXT,
- NULL, 728),
- NAME_FUNC_OFFSET(12326, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL,
- 729),
- NAME_FUNC_OFFSET(12347, glFogCoorddEXT, glFogCoorddEXT, NULL, 730),
- NAME_FUNC_OFFSET(12362, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 731),
- NAME_FUNC_OFFSET(12378, glFogCoordfEXT, glFogCoordfEXT, NULL, 732),
- NAME_FUNC_OFFSET(12393, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 733),
- NAME_FUNC_OFFSET(12409, gl_dispatch_stub_734, gl_dispatch_stub_734, NULL,
- 734),
- NAME_FUNC_OFFSET(12427, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT,
- NULL, 735),
- NAME_FUNC_OFFSET(12450, glFlushVertexArrayRangeNV,
- glFlushVertexArrayRangeNV, NULL, 736),
- NAME_FUNC_OFFSET(12476, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL,
- 737),
- NAME_FUNC_OFFSET(12497, glCombinerInputNV, glCombinerInputNV, NULL, 738),
- NAME_FUNC_OFFSET(12515, glCombinerOutputNV, glCombinerOutputNV, NULL, 739),
- NAME_FUNC_OFFSET(12534, glCombinerParameterfNV, glCombinerParameterfNV,
- NULL, 740),
- NAME_FUNC_OFFSET(12557, glCombinerParameterfvNV, glCombinerParameterfvNV,
- NULL, 741),
- NAME_FUNC_OFFSET(12581, glCombinerParameteriNV, glCombinerParameteriNV,
- NULL, 742),
- NAME_FUNC_OFFSET(12604, glCombinerParameterivNV, glCombinerParameterivNV,
- NULL, 743),
- NAME_FUNC_OFFSET(12628, glFinalCombinerInputNV, glFinalCombinerInputNV,
- NULL, 744),
- NAME_FUNC_OFFSET(12651, glGetCombinerInputParameterfvNV,
- glGetCombinerInputParameterfvNV, NULL, 745),
- NAME_FUNC_OFFSET(12683, glGetCombinerInputParameterivNV,
- glGetCombinerInputParameterivNV, NULL, 746),
- NAME_FUNC_OFFSET(12715, glGetCombinerOutputParameterfvNV,
- glGetCombinerOutputParameterfvNV, NULL, 747),
- NAME_FUNC_OFFSET(12748, glGetCombinerOutputParameterivNV,
- glGetCombinerOutputParameterivNV, NULL, 748),
- NAME_FUNC_OFFSET(12781, glGetFinalCombinerInputParameterfvNV,
- glGetFinalCombinerInputParameterfvNV, NULL, 749),
- NAME_FUNC_OFFSET(12818, glGetFinalCombinerInputParameterivNV,
- glGetFinalCombinerInputParameterivNV, NULL, 750),
- NAME_FUNC_OFFSET(12855, glResizeBuffersMESA, glResizeBuffersMESA, NULL,
- 751),
- NAME_FUNC_OFFSET(12875, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 752),
- NAME_FUNC_OFFSET(12893, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 753),
- NAME_FUNC_OFFSET(12912, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 754),
- NAME_FUNC_OFFSET(12930, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 755),
- NAME_FUNC_OFFSET(12949, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 756),
- NAME_FUNC_OFFSET(12967, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 757),
- NAME_FUNC_OFFSET(12986, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 758),
- NAME_FUNC_OFFSET(13004, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 759),
- NAME_FUNC_OFFSET(13023, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 760),
- NAME_FUNC_OFFSET(13041, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 761),
- NAME_FUNC_OFFSET(13060, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 762),
- NAME_FUNC_OFFSET(13078, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 763),
- NAME_FUNC_OFFSET(13097, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 764),
- NAME_FUNC_OFFSET(13115, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 765),
- NAME_FUNC_OFFSET(13134, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 766),
- NAME_FUNC_OFFSET(13152, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 767),
- NAME_FUNC_OFFSET(13171, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 768),
- NAME_FUNC_OFFSET(13189, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 769),
- NAME_FUNC_OFFSET(13208, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 770),
- NAME_FUNC_OFFSET(13226, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 771),
- NAME_FUNC_OFFSET(13245, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 772),
- NAME_FUNC_OFFSET(13263, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 773),
- NAME_FUNC_OFFSET(13282, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 774),
- NAME_FUNC_OFFSET(13300, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 775),
- NAME_FUNC_OFFSET(13319, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL,
- 776),
- NAME_FUNC_OFFSET(13344, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL,
- 777),
- NAME_FUNC_OFFSET(13371, gl_dispatch_stub_778, gl_dispatch_stub_778, NULL,
- 778),
- NAME_FUNC_OFFSET(13388, gl_dispatch_stub_779, gl_dispatch_stub_779, NULL,
- 779),
- NAME_FUNC_OFFSET(13404, gl_dispatch_stub_780, gl_dispatch_stub_780, NULL,
- 780),
- NAME_FUNC_OFFSET(13418, gl_dispatch_stub_781, gl_dispatch_stub_781, NULL,
- 781),
- NAME_FUNC_OFFSET(13433, gl_dispatch_stub_782, gl_dispatch_stub_782, NULL,
- 782),
- NAME_FUNC_OFFSET(13445, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL,
- 783),
- NAME_FUNC_OFFSET(13458, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL,
- 784),
- NAME_FUNC_OFFSET(13472, glAreProgramsResidentNV, glAreProgramsResidentNV,
- NULL, 785),
- NAME_FUNC_OFFSET(13496, glBindProgramNV, glBindProgramNV, NULL, 786),
- NAME_FUNC_OFFSET(13512, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 787),
- NAME_FUNC_OFFSET(13531, glExecuteProgramNV, glExecuteProgramNV, NULL, 788),
- NAME_FUNC_OFFSET(13550, glGenProgramsNV, glGenProgramsNV, NULL, 789),
- NAME_FUNC_OFFSET(13566, glGetProgramParameterdvNV,
- glGetProgramParameterdvNV, NULL, 790),
- NAME_FUNC_OFFSET(13592, glGetProgramParameterfvNV,
- glGetProgramParameterfvNV, NULL, 791),
- NAME_FUNC_OFFSET(13618, glGetProgramStringNV, glGetProgramStringNV, NULL,
- 792),
- NAME_FUNC_OFFSET(13639, glGetProgramivNV, glGetProgramivNV, NULL, 793),
- NAME_FUNC_OFFSET(13656, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL,
- 794),
- NAME_FUNC_OFFSET(13677, glGetVertexAttribPointervNV,
- glGetVertexAttribPointervNV, NULL, 795),
- NAME_FUNC_OFFSET(13705, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL,
- 796),
- NAME_FUNC_OFFSET(13727, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL,
- 797),
- NAME_FUNC_OFFSET(13749, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL,
- 798),
- NAME_FUNC_OFFSET(13771, glIsProgramNV, glIsProgramNV, NULL, 799),
- NAME_FUNC_OFFSET(13785, glLoadProgramNV, glLoadProgramNV, NULL, 800),
- NAME_FUNC_OFFSET(13801, glProgramParameters4dvNV, glProgramParameters4dvNV,
- NULL, 801),
- NAME_FUNC_OFFSET(13826, glProgramParameters4fvNV, glProgramParameters4fvNV,
- NULL, 802),
- NAME_FUNC_OFFSET(13851, glRequestResidentProgramsNV,
- glRequestResidentProgramsNV, NULL, 803),
- NAME_FUNC_OFFSET(13879, glTrackMatrixNV, glTrackMatrixNV, NULL, 804),
- NAME_FUNC_OFFSET(13895, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 805),
- NAME_FUNC_OFFSET(13914, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL,
- 806),
- NAME_FUNC_OFFSET(13934, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 807),
- NAME_FUNC_OFFSET(13953, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL,
- 808),
- NAME_FUNC_OFFSET(13973, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 809),
- NAME_FUNC_OFFSET(13992, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL,
- 810),
- NAME_FUNC_OFFSET(14012, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 811),
- NAME_FUNC_OFFSET(14031, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL,
- 812),
- NAME_FUNC_OFFSET(14051, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 813),
- NAME_FUNC_OFFSET(14070, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL,
- 814),
- NAME_FUNC_OFFSET(14090, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 815),
- NAME_FUNC_OFFSET(14109, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL,
- 816),
- NAME_FUNC_OFFSET(14129, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 817),
- NAME_FUNC_OFFSET(14148, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL,
- 818),
- NAME_FUNC_OFFSET(14168, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 819),
- NAME_FUNC_OFFSET(14187, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL,
- 820),
- NAME_FUNC_OFFSET(14207, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 821),
- NAME_FUNC_OFFSET(14226, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL,
- 822),
- NAME_FUNC_OFFSET(14246, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 823),
- NAME_FUNC_OFFSET(14265, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL,
- 824),
- NAME_FUNC_OFFSET(14285, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 825),
- NAME_FUNC_OFFSET(14304, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL,
- 826),
- NAME_FUNC_OFFSET(14324, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 827),
- NAME_FUNC_OFFSET(14343, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL,
- 828),
- NAME_FUNC_OFFSET(14363, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL,
- 829),
- NAME_FUNC_OFFSET(14383, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL,
- 830),
- NAME_FUNC_OFFSET(14404, glVertexAttribPointerNV, glVertexAttribPointerNV,
- NULL, 831),
- NAME_FUNC_OFFSET(14428, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL,
- 832),
- NAME_FUNC_OFFSET(14449, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL,
- 833),
- NAME_FUNC_OFFSET(14470, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL,
- 834),
- NAME_FUNC_OFFSET(14491, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL,
- 835),
- NAME_FUNC_OFFSET(14512, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL,
- 836),
- NAME_FUNC_OFFSET(14533, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL,
- 837),
- NAME_FUNC_OFFSET(14554, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL,
- 838),
- NAME_FUNC_OFFSET(14575, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL,
- 839),
- NAME_FUNC_OFFSET(14596, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL,
- 840),
- NAME_FUNC_OFFSET(14617, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL,
- 841),
- NAME_FUNC_OFFSET(14638, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL,
- 842),
- NAME_FUNC_OFFSET(14659, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL,
- 843),
- NAME_FUNC_OFFSET(14680, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL,
- 844),
- NAME_FUNC_OFFSET(14702, glGetTexBumpParameterfvATI,
- glGetTexBumpParameterfvATI, NULL, 845),
- NAME_FUNC_OFFSET(14729, glGetTexBumpParameterivATI,
- glGetTexBumpParameterivATI, NULL, 846),
- NAME_FUNC_OFFSET(14756, glTexBumpParameterfvATI, glTexBumpParameterfvATI,
- NULL, 847),
- NAME_FUNC_OFFSET(14780, glTexBumpParameterivATI, glTexBumpParameterivATI,
- NULL, 848),
- NAME_FUNC_OFFSET(14804, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL,
- 849),
- NAME_FUNC_OFFSET(14826, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL,
- 850),
- NAME_FUNC_OFFSET(14848, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL,
- 851),
- NAME_FUNC_OFFSET(14870, glBeginFragmentShaderATI, glBeginFragmentShaderATI,
- NULL, 852),
- NAME_FUNC_OFFSET(14895, glBindFragmentShaderATI, glBindFragmentShaderATI,
- NULL, 853),
- NAME_FUNC_OFFSET(14919, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL,
- 854),
- NAME_FUNC_OFFSET(14941, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL,
- 855),
- NAME_FUNC_OFFSET(14963, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL,
- 856),
- NAME_FUNC_OFFSET(14985, glDeleteFragmentShaderATI,
- glDeleteFragmentShaderATI, NULL, 857),
- NAME_FUNC_OFFSET(15011, glEndFragmentShaderATI, glEndFragmentShaderATI,
- NULL, 858),
- NAME_FUNC_OFFSET(15034, glGenFragmentShadersATI, glGenFragmentShadersATI,
- NULL, 859),
- NAME_FUNC_OFFSET(15058, glPassTexCoordATI, glPassTexCoordATI, NULL, 860),
- NAME_FUNC_OFFSET(15076, glSampleMapATI, glSampleMapATI, NULL, 861),
- NAME_FUNC_OFFSET(15091, glSetFragmentShaderConstantATI,
- glSetFragmentShaderConstantATI, NULL, 862),
- NAME_FUNC_OFFSET(15122, glPointParameteriNV, glPointParameteriNV, NULL,
- 863),
- NAME_FUNC_OFFSET(15142, glPointParameterivNV, glPointParameterivNV, NULL,
- 864),
- NAME_FUNC_OFFSET(15163, gl_dispatch_stub_865, gl_dispatch_stub_865, NULL,
- 865),
- NAME_FUNC_OFFSET(15186, gl_dispatch_stub_866, gl_dispatch_stub_866, NULL,
- 866),
- NAME_FUNC_OFFSET(15209, gl_dispatch_stub_867, gl_dispatch_stub_867, NULL,
- 867),
- NAME_FUNC_OFFSET(15235, gl_dispatch_stub_868, gl_dispatch_stub_868, NULL,
- 868),
- NAME_FUNC_OFFSET(15258, gl_dispatch_stub_869, gl_dispatch_stub_869, NULL,
- 869),
- NAME_FUNC_OFFSET(15279, glGetProgramNamedParameterdvNV,
- glGetProgramNamedParameterdvNV, NULL, 870),
- NAME_FUNC_OFFSET(15310, glGetProgramNamedParameterfvNV,
- glGetProgramNamedParameterfvNV, NULL, 871),
- NAME_FUNC_OFFSET(15341, glProgramNamedParameter4dNV,
- glProgramNamedParameter4dNV, NULL, 872),
- NAME_FUNC_OFFSET(15369, glProgramNamedParameter4dvNV,
- glProgramNamedParameter4dvNV, NULL, 873),
- NAME_FUNC_OFFSET(15398, glProgramNamedParameter4fNV,
- glProgramNamedParameter4fNV, NULL, 874),
- NAME_FUNC_OFFSET(15426, glProgramNamedParameter4fvNV,
- glProgramNamedParameter4fvNV, NULL, 875),
- NAME_FUNC_OFFSET(15455, glPrimitiveRestartIndexNV,
- glPrimitiveRestartIndexNV, NULL, 876),
- NAME_FUNC_OFFSET(15481, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL,
- 877),
- NAME_FUNC_OFFSET(15502, gl_dispatch_stub_878, gl_dispatch_stub_878, NULL,
- 878),
- NAME_FUNC_OFFSET(15519, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL,
- 879),
- NAME_FUNC_OFFSET(15546, glBindFramebufferEXT, glBindFramebufferEXT, NULL,
- 880),
- NAME_FUNC_OFFSET(15567, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL,
- 881),
- NAME_FUNC_OFFSET(15589, glCheckFramebufferStatusEXT,
- glCheckFramebufferStatusEXT, NULL, 882),
- NAME_FUNC_OFFSET(15617, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT,
- NULL, 883),
- NAME_FUNC_OFFSET(15641, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT,
- NULL, 884),
- NAME_FUNC_OFFSET(15666, glFramebufferRenderbufferEXT,
- glFramebufferRenderbufferEXT, NULL, 885),
- NAME_FUNC_OFFSET(15695, glFramebufferTexture1DEXT,
- glFramebufferTexture1DEXT, NULL, 886),
- NAME_FUNC_OFFSET(15721, glFramebufferTexture2DEXT,
- glFramebufferTexture2DEXT, NULL, 887),
- NAME_FUNC_OFFSET(15747, glFramebufferTexture3DEXT,
- glFramebufferTexture3DEXT, NULL, 888),
- NAME_FUNC_OFFSET(15773, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL,
- 889),
- NAME_FUNC_OFFSET(15794, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL,
- 890),
- NAME_FUNC_OFFSET(15816, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL,
- 891),
- NAME_FUNC_OFFSET(15836, glGetFramebufferAttachmentParameterivEXT,
- glGetFramebufferAttachmentParameterivEXT, NULL, 892),
- NAME_FUNC_OFFSET(15877, glGetRenderbufferParameterivEXT,
- glGetRenderbufferParameterivEXT, NULL, 893),
- NAME_FUNC_OFFSET(15909, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 894),
- NAME_FUNC_OFFSET(15928, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL,
- 895),
- NAME_FUNC_OFFSET(15948, glRenderbufferStorageEXT, glRenderbufferStorageEXT,
- NULL, 896),
- NAME_FUNC_OFFSET(15973, gl_dispatch_stub_897, gl_dispatch_stub_897, NULL,
- 897),
- NAME_FUNC_OFFSET(15994, gl_dispatch_stub_898, gl_dispatch_stub_898, NULL,
- 898),
- NAME_FUNC_OFFSET(16018, gl_dispatch_stub_899, gl_dispatch_stub_899, NULL,
- 899),
- NAME_FUNC_OFFSET(16048, glBindFragDataLocationEXT,
- glBindFragDataLocationEXT, NULL, 900),
- NAME_FUNC_OFFSET(16074, glGetFragDataLocationEXT, glGetFragDataLocationEXT,
- NULL, 901),
- NAME_FUNC_OFFSET(16099, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 902),
- NAME_FUNC_OFFSET(16118, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT,
- NULL, 903),
- NAME_FUNC_OFFSET(16142, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT,
- NULL, 904),
- NAME_FUNC_OFFSET(16167, glUniform1uiEXT, glUniform1uiEXT, NULL, 905),
- NAME_FUNC_OFFSET(16183, glUniform1uivEXT, glUniform1uivEXT, NULL, 906),
- NAME_FUNC_OFFSET(16200, glUniform2uiEXT, glUniform2uiEXT, NULL, 907),
- NAME_FUNC_OFFSET(16216, glUniform2uivEXT, glUniform2uivEXT, NULL, 908),
- NAME_FUNC_OFFSET(16233, glUniform3uiEXT, glUniform3uiEXT, NULL, 909),
- NAME_FUNC_OFFSET(16249, glUniform3uivEXT, glUniform3uivEXT, NULL, 910),
- NAME_FUNC_OFFSET(16266, glUniform4uiEXT, glUniform4uiEXT, NULL, 911),
- NAME_FUNC_OFFSET(16282, glUniform4uivEXT, glUniform4uivEXT, NULL, 912),
- NAME_FUNC_OFFSET(16299, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL,
- 913),
- NAME_FUNC_OFFSET(16320, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL,
- 914),
- NAME_FUNC_OFFSET(16342, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL,
- 915),
- NAME_FUNC_OFFSET(16364, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT,
- NULL, 916),
- NAME_FUNC_OFFSET(16387, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL,
- 917),
- NAME_FUNC_OFFSET(16408, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL,
- 918),
- NAME_FUNC_OFFSET(16430, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL,
- 919),
- NAME_FUNC_OFFSET(16452, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT,
- NULL, 920),
- NAME_FUNC_OFFSET(16475, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL,
- 921),
- NAME_FUNC_OFFSET(16496, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL,
- 922),
- NAME_FUNC_OFFSET(16518, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL,
- 923),
- NAME_FUNC_OFFSET(16540, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT,
- NULL, 924),
- NAME_FUNC_OFFSET(16563, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL,
- 925),
- NAME_FUNC_OFFSET(16585, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL,
- 926),
- NAME_FUNC_OFFSET(16606, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL,
- 927),
- NAME_FUNC_OFFSET(16628, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL,
- 928),
- NAME_FUNC_OFFSET(16650, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT,
- NULL, 929),
- NAME_FUNC_OFFSET(16673, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL,
- 930),
- NAME_FUNC_OFFSET(16695, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT,
- NULL, 931),
- NAME_FUNC_OFFSET(16718, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT,
- NULL, 932),
- NAME_FUNC_OFFSET(16741, glVertexAttribIPointerEXT,
- glVertexAttribIPointerEXT, NULL, 933),
- NAME_FUNC_OFFSET(16767, glFramebufferTextureLayerEXT,
- glFramebufferTextureLayerEXT, NULL, 934),
- NAME_FUNC_OFFSET(16796, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL,
- 935),
- NAME_FUNC_OFFSET(16818, glDisableIndexedEXT, glDisableIndexedEXT, NULL,
- 936),
- NAME_FUNC_OFFSET(16838, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 937),
- NAME_FUNC_OFFSET(16857, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT,
- NULL, 938),
- NAME_FUNC_OFFSET(16881, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT,
- NULL, 939),
- NAME_FUNC_OFFSET(16905, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL,
- 940),
- NAME_FUNC_OFFSET(16927, glClearColorIiEXT, glClearColorIiEXT, NULL, 941),
- NAME_FUNC_OFFSET(16945, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 942),
- NAME_FUNC_OFFSET(16964, glGetTexParameterIivEXT, glGetTexParameterIivEXT,
- NULL, 943),
- NAME_FUNC_OFFSET(16988, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT,
- NULL, 944),
- NAME_FUNC_OFFSET(17013, glTexParameterIivEXT, glTexParameterIivEXT, NULL,
- 945),
- NAME_FUNC_OFFSET(17034, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL,
- 946),
- NAME_FUNC_OFFSET(17056, glBeginConditionalRenderNV,
- glBeginConditionalRenderNV, NULL, 947),
- NAME_FUNC_OFFSET(17083, glEndConditionalRenderNV, glEndConditionalRenderNV,
- NULL, 948),
- NAME_FUNC_OFFSET(17108, glBeginTransformFeedbackEXT,
- glBeginTransformFeedbackEXT, NULL, 949),
- NAME_FUNC_OFFSET(17136, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL,
- 950),
- NAME_FUNC_OFFSET(17156, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL,
- 951),
- NAME_FUNC_OFFSET(17178, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL,
- 952),
- NAME_FUNC_OFFSET(17199, glEndTransformFeedbackEXT,
- glEndTransformFeedbackEXT, NULL, 953),
- NAME_FUNC_OFFSET(17225, glGetTransformFeedbackVaryingEXT,
- glGetTransformFeedbackVaryingEXT, NULL, 954),
- NAME_FUNC_OFFSET(17258, glTransformFeedbackVaryingsEXT,
- glTransformFeedbackVaryingsEXT, NULL, 955),
- NAME_FUNC_OFFSET(17289, glProvokingVertexEXT, glProvokingVertexEXT, NULL,
- 956),
- NAME_FUNC_OFFSET(17310, gl_dispatch_stub_957, gl_dispatch_stub_957, NULL,
- 957),
- NAME_FUNC_OFFSET(17341, gl_dispatch_stub_958, gl_dispatch_stub_958, NULL,
- 958),
- NAME_FUNC_OFFSET(17361, glGetObjectParameterivAPPLE,
- glGetObjectParameterivAPPLE, NULL, 959),
- NAME_FUNC_OFFSET(17389, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE,
- NULL, 960),
- NAME_FUNC_OFFSET(17412, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE,
- NULL, 961),
- NAME_FUNC_OFFSET(17437, glActiveProgramEXT, glActiveProgramEXT, NULL, 962),
- NAME_FUNC_OFFSET(17456, glCreateShaderProgramEXT, glCreateShaderProgramEXT,
- NULL, 963),
- NAME_FUNC_OFFSET(17481, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL,
- 964),
- NAME_FUNC_OFFSET(17503, glTextureBarrierNV, glTextureBarrierNV, NULL, 965),
- NAME_FUNC_OFFSET(17522, gl_dispatch_stub_966, gl_dispatch_stub_966, NULL,
- 966),
- NAME_FUNC_OFFSET(17547, gl_dispatch_stub_967, gl_dispatch_stub_967, NULL,
- 967),
- NAME_FUNC_OFFSET(17576, gl_dispatch_stub_968, gl_dispatch_stub_968, NULL,
- 968),
- NAME_FUNC_OFFSET(17607, gl_dispatch_stub_969, gl_dispatch_stub_969, NULL,
- 969),
- NAME_FUNC_OFFSET(17631, gl_dispatch_stub_970, gl_dispatch_stub_970, NULL,
- 970),
- NAME_FUNC_OFFSET(17656, glEGLImageTargetRenderbufferStorageOES,
- glEGLImageTargetRenderbufferStorageOES, NULL, 971),
- NAME_FUNC_OFFSET(17695, glEGLImageTargetTexture2DOES,
- glEGLImageTargetTexture2DOES, NULL, 972),
- NAME_FUNC_OFFSET(17724, glArrayElement, glArrayElement, NULL, 306),
- NAME_FUNC_OFFSET(17742, glBindTexture, glBindTexture, NULL, 307),
- NAME_FUNC_OFFSET(17759, glDrawArrays, glDrawArrays, NULL, 310),
- NAME_FUNC_OFFSET(17775, glAreTexturesResident, glAreTexturesResidentEXT,
- glAreTexturesResidentEXT, 322),
- NAME_FUNC_OFFSET(17800, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
- NAME_FUNC_OFFSET(17820, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
- NAME_FUNC_OFFSET(17840, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL,
- 325),
- NAME_FUNC_OFFSET(17863, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL,
- 326),
- NAME_FUNC_OFFSET(17886, glDeleteTextures, glDeleteTexturesEXT,
- glDeleteTexturesEXT, 327),
- NAME_FUNC_OFFSET(17906, glGenTextures, glGenTexturesEXT, glGenTexturesEXT,
- 328),
- NAME_FUNC_OFFSET(17923, glGetPointerv, glGetPointerv, NULL, 329),
- NAME_FUNC_OFFSET(17940, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
- NAME_FUNC_OFFSET(17955, glPrioritizeTextures, glPrioritizeTextures, NULL,
- 331),
- NAME_FUNC_OFFSET(17979, glTexSubImage1D, glTexSubImage1D, NULL, 332),
- NAME_FUNC_OFFSET(17998, glTexSubImage2D, glTexSubImage2D, NULL, 333),
- NAME_FUNC_OFFSET(18017, glBlendColor, glBlendColor, NULL, 336),
- NAME_FUNC_OFFSET(18033, glBlendEquation, glBlendEquation, NULL, 337),
- NAME_FUNC_OFFSET(18052, glDrawRangeElements, glDrawRangeElements, NULL,
- 338),
- NAME_FUNC_OFFSET(18075, glColorTable, glColorTable, NULL, 339),
- NAME_FUNC_OFFSET(18091, glColorTable, glColorTable, NULL, 339),
- NAME_FUNC_OFFSET(18107, glColorTableParameterfv, glColorTableParameterfv,
- NULL, 340),
- NAME_FUNC_OFFSET(18134, glColorTableParameteriv, glColorTableParameteriv,
- NULL, 341),
- NAME_FUNC_OFFSET(18161, glCopyColorTable, glCopyColorTable, NULL, 342),
- NAME_FUNC_OFFSET(18181, glGetColorTable, glGetColorTableEXT,
- glGetColorTableEXT, 343),
- NAME_FUNC_OFFSET(18200, glGetColorTable, glGetColorTableEXT,
- glGetColorTableEXT, 343),
- NAME_FUNC_OFFSET(18219, glGetColorTableParameterfv,
- glGetColorTableParameterfvEXT,
- glGetColorTableParameterfvEXT, 344),
- NAME_FUNC_OFFSET(18249, glGetColorTableParameterfv,
- glGetColorTableParameterfvEXT,
- glGetColorTableParameterfvEXT, 344),
- NAME_FUNC_OFFSET(18279, glGetColorTableParameteriv,
- glGetColorTableParameterivEXT,
- glGetColorTableParameterivEXT, 345),
- NAME_FUNC_OFFSET(18309, glGetColorTableParameteriv,
- glGetColorTableParameterivEXT,
- glGetColorTableParameterivEXT, 345),
- NAME_FUNC_OFFSET(18339, glColorSubTable, glColorSubTable, NULL, 346),
- NAME_FUNC_OFFSET(18358, glCopyColorSubTable, glCopyColorSubTable, NULL,
- 347),
- NAME_FUNC_OFFSET(18381, glConvolutionFilter1D, glConvolutionFilter1D, NULL,
- 348),
- NAME_FUNC_OFFSET(18406, glConvolutionFilter2D, glConvolutionFilter2D, NULL,
- 349),
- NAME_FUNC_OFFSET(18431, glConvolutionParameterf, glConvolutionParameterf,
- NULL, 350),
- NAME_FUNC_OFFSET(18458, glConvolutionParameterfv, glConvolutionParameterfv,
- NULL, 351),
- NAME_FUNC_OFFSET(18486, glConvolutionParameteri, glConvolutionParameteri,
- NULL, 352),
- NAME_FUNC_OFFSET(18513, glConvolutionParameteriv, glConvolutionParameteriv,
- NULL, 353),
- NAME_FUNC_OFFSET(18541, glCopyConvolutionFilter1D,
- glCopyConvolutionFilter1D, NULL, 354),
- NAME_FUNC_OFFSET(18570, glCopyConvolutionFilter2D,
- glCopyConvolutionFilter2D, NULL, 355),
- NAME_FUNC_OFFSET(18599, glGetConvolutionFilter, gl_dispatch_stub_356,
- gl_dispatch_stub_356, 356),
- NAME_FUNC_OFFSET(18625, glGetConvolutionParameterfv, gl_dispatch_stub_357,
- gl_dispatch_stub_357, 357),
- NAME_FUNC_OFFSET(18656, glGetConvolutionParameteriv, gl_dispatch_stub_358,
- gl_dispatch_stub_358, 358),
- NAME_FUNC_OFFSET(18687, glGetSeparableFilter, gl_dispatch_stub_359,
- gl_dispatch_stub_359, 359),
- NAME_FUNC_OFFSET(18711, glSeparableFilter2D, glSeparableFilter2D, NULL,
- 360),
- NAME_FUNC_OFFSET(18734, glGetHistogram, gl_dispatch_stub_361,
- gl_dispatch_stub_361, 361),
- NAME_FUNC_OFFSET(18752, glGetHistogramParameterfv, gl_dispatch_stub_362,
- gl_dispatch_stub_362, 362),
- NAME_FUNC_OFFSET(18781, glGetHistogramParameteriv, gl_dispatch_stub_363,
- gl_dispatch_stub_363, 363),
- NAME_FUNC_OFFSET(18810, glGetMinmax, gl_dispatch_stub_364,
- gl_dispatch_stub_364, 364),
- NAME_FUNC_OFFSET(18825, glGetMinmaxParameterfv, gl_dispatch_stub_365,
- gl_dispatch_stub_365, 365),
- NAME_FUNC_OFFSET(18851, glGetMinmaxParameteriv, gl_dispatch_stub_366,
- gl_dispatch_stub_366, 366),
- NAME_FUNC_OFFSET(18877, glHistogram, glHistogram, NULL, 367),
- NAME_FUNC_OFFSET(18892, glMinmax, glMinmax, NULL, 368),
- NAME_FUNC_OFFSET(18904, glResetHistogram, glResetHistogram, NULL, 369),
- NAME_FUNC_OFFSET(18924, glResetMinmax, glResetMinmax, NULL, 370),
- NAME_FUNC_OFFSET(18941, glTexImage3D, glTexImage3D, NULL, 371),
- NAME_FUNC_OFFSET(18957, glTexSubImage3D, glTexSubImage3D, NULL, 372),
- NAME_FUNC_OFFSET(18976, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL,
- 373),
- NAME_FUNC_OFFSET(18999, glActiveTextureARB, glActiveTextureARB, NULL, 374),
- NAME_FUNC_OFFSET(19015, glClientActiveTextureARB, glClientActiveTextureARB,
- NULL, 375),
- NAME_FUNC_OFFSET(19037, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL,
- 376),
- NAME_FUNC_OFFSET(19055, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL,
- 377),
- NAME_FUNC_OFFSET(19074, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL,
- 378),
- NAME_FUNC_OFFSET(19092, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL,
- 379),
- NAME_FUNC_OFFSET(19111, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL,
- 380),
- NAME_FUNC_OFFSET(19129, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL,
- 381),
- NAME_FUNC_OFFSET(19148, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL,
- 382),
- NAME_FUNC_OFFSET(19166, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL,
- 383),
- NAME_FUNC_OFFSET(19185, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL,
- 384),
- NAME_FUNC_OFFSET(19203, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL,
- 385),
- NAME_FUNC_OFFSET(19222, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL,
- 386),
- NAME_FUNC_OFFSET(19240, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL,
- 387),
- NAME_FUNC_OFFSET(19259, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL,
- 388),
- NAME_FUNC_OFFSET(19277, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL,
- 389),
- NAME_FUNC_OFFSET(19296, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL,
- 390),
- NAME_FUNC_OFFSET(19314, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL,
- 391),
- NAME_FUNC_OFFSET(19333, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL,
- 392),
- NAME_FUNC_OFFSET(19351, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL,
- 393),
- NAME_FUNC_OFFSET(19370, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL,
- 394),
- NAME_FUNC_OFFSET(19388, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL,
- 395),
- NAME_FUNC_OFFSET(19407, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL,
- 396),
- NAME_FUNC_OFFSET(19425, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL,
- 397),
- NAME_FUNC_OFFSET(19444, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL,
- 398),
- NAME_FUNC_OFFSET(19462, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL,
- 399),
- NAME_FUNC_OFFSET(19481, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL,
- 400),
- NAME_FUNC_OFFSET(19499, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL,
- 401),
- NAME_FUNC_OFFSET(19518, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL,
- 402),
- NAME_FUNC_OFFSET(19536, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL,
- 403),
- NAME_FUNC_OFFSET(19555, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL,
- 404),
- NAME_FUNC_OFFSET(19573, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL,
- 405),
- NAME_FUNC_OFFSET(19592, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL,
- 406),
- NAME_FUNC_OFFSET(19610, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL,
- 407),
- NAME_FUNC_OFFSET(19629, glStencilOpSeparate, glStencilOpSeparate, NULL,
- 423),
- NAME_FUNC_OFFSET(19652, glLoadTransposeMatrixdARB,
- glLoadTransposeMatrixdARB, NULL, 441),
- NAME_FUNC_OFFSET(19675, glLoadTransposeMatrixfARB,
- glLoadTransposeMatrixfARB, NULL, 442),
- NAME_FUNC_OFFSET(19698, glMultTransposeMatrixdARB,
- glMultTransposeMatrixdARB, NULL, 443),
- NAME_FUNC_OFFSET(19721, glMultTransposeMatrixfARB,
- glMultTransposeMatrixfARB, NULL, 444),
- NAME_FUNC_OFFSET(19744, glSampleCoverageARB, glSampleCoverageARB, NULL,
- 445),
- NAME_FUNC_OFFSET(19761, glCompressedTexImage1DARB,
- glCompressedTexImage1DARB, NULL, 446),
- NAME_FUNC_OFFSET(19784, glCompressedTexImage2DARB,
- glCompressedTexImage2DARB, NULL, 447),
- NAME_FUNC_OFFSET(19807, glCompressedTexImage3DARB,
- glCompressedTexImage3DARB, NULL, 448),
- NAME_FUNC_OFFSET(19830, glCompressedTexSubImage1DARB,
- glCompressedTexSubImage1DARB, NULL, 449),
- NAME_FUNC_OFFSET(19856, glCompressedTexSubImage2DARB,
- glCompressedTexSubImage2DARB, NULL, 450),
- NAME_FUNC_OFFSET(19882, glCompressedTexSubImage3DARB,
- glCompressedTexSubImage3DARB, NULL, 451),
- NAME_FUNC_OFFSET(19908, glGetCompressedTexImageARB,
- glGetCompressedTexImageARB, NULL, 452),
- NAME_FUNC_OFFSET(19932, glDisableVertexAttribArrayARB,
- glDisableVertexAttribArrayARB, NULL, 453),
- NAME_FUNC_OFFSET(19959, glEnableVertexAttribArrayARB,
- glEnableVertexAttribArrayARB, NULL, 454),
- NAME_FUNC_OFFSET(19985, glGetVertexAttribdvARB, glGetVertexAttribdvARB,
- NULL, 461),
- NAME_FUNC_OFFSET(20005, glGetVertexAttribfvARB, glGetVertexAttribfvARB,
- NULL, 462),
- NAME_FUNC_OFFSET(20025, glGetVertexAttribivARB, glGetVertexAttribivARB,
- NULL, 463),
- NAME_FUNC_OFFSET(20045, glProgramEnvParameter4dARB,
- glProgramEnvParameter4dARB, NULL, 464),
- NAME_FUNC_OFFSET(20068, glProgramEnvParameter4dvARB,
- glProgramEnvParameter4dvARB, NULL, 465),
- NAME_FUNC_OFFSET(20092, glProgramEnvParameter4fARB,
- glProgramEnvParameter4fARB, NULL, 466),
- NAME_FUNC_OFFSET(20115, glProgramEnvParameter4fvARB,
- glProgramEnvParameter4fvARB, NULL, 467),
- NAME_FUNC_OFFSET(20139, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL,
- 473),
- NAME_FUNC_OFFSET(20156, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL,
- 474),
- NAME_FUNC_OFFSET(20174, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL,
- 475),
- NAME_FUNC_OFFSET(20191, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL,
- 476),
- NAME_FUNC_OFFSET(20209, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL,
- 477),
- NAME_FUNC_OFFSET(20226, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL,
- 478),
- NAME_FUNC_OFFSET(20244, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL,
- 479),
- NAME_FUNC_OFFSET(20261, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL,
- 480),
- NAME_FUNC_OFFSET(20279, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL,
- 481),
- NAME_FUNC_OFFSET(20296, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL,
- 482),
- NAME_FUNC_OFFSET(20314, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL,
- 483),
- NAME_FUNC_OFFSET(20331, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL,
- 484),
- NAME_FUNC_OFFSET(20349, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL,
- 485),
- NAME_FUNC_OFFSET(20366, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL,
- 486),
- NAME_FUNC_OFFSET(20384, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL,
- 487),
- NAME_FUNC_OFFSET(20401, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL,
- 488),
- NAME_FUNC_OFFSET(20419, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL,
- 489),
- NAME_FUNC_OFFSET(20436, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL,
- 490),
- NAME_FUNC_OFFSET(20454, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL,
- 491),
- NAME_FUNC_OFFSET(20473, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL,
- 492),
- NAME_FUNC_OFFSET(20492, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL,
- 493),
- NAME_FUNC_OFFSET(20511, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL,
- 494),
- NAME_FUNC_OFFSET(20530, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB,
- NULL, 495),
- NAME_FUNC_OFFSET(20550, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB,
- NULL, 496),
- NAME_FUNC_OFFSET(20570, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB,
- NULL, 497),
- NAME_FUNC_OFFSET(20590, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL,
- 498),
- NAME_FUNC_OFFSET(20608, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL,
- 499),
- NAME_FUNC_OFFSET(20625, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL,
- 500),
- NAME_FUNC_OFFSET(20643, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL,
- 501),
- NAME_FUNC_OFFSET(20660, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL,
- 502),
- NAME_FUNC_OFFSET(20678, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL,
- 503),
- NAME_FUNC_OFFSET(20696, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL,
- 504),
- NAME_FUNC_OFFSET(20713, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL,
- 505),
- NAME_FUNC_OFFSET(20731, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL,
- 506),
- NAME_FUNC_OFFSET(20750, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL,
- 507),
- NAME_FUNC_OFFSET(20769, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL,
- 508),
- NAME_FUNC_OFFSET(20788, glVertexAttribPointerARB, glVertexAttribPointerARB,
- NULL, 509),
- NAME_FUNC_OFFSET(20810, glBindBufferARB, glBindBufferARB, NULL, 510),
- NAME_FUNC_OFFSET(20823, glBufferDataARB, glBufferDataARB, NULL, 511),
- NAME_FUNC_OFFSET(20836, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
- NAME_FUNC_OFFSET(20852, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
- NAME_FUNC_OFFSET(20868, glGenBuffersARB, glGenBuffersARB, NULL, 514),
- NAME_FUNC_OFFSET(20881, glGetBufferParameterivARB,
- glGetBufferParameterivARB, NULL, 515),
- NAME_FUNC_OFFSET(20904, glGetBufferPointervARB, glGetBufferPointervARB,
- NULL, 516),
- NAME_FUNC_OFFSET(20924, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL,
- 517),
- NAME_FUNC_OFFSET(20943, glIsBufferARB, glIsBufferARB, NULL, 518),
- NAME_FUNC_OFFSET(20954, glMapBufferARB, glMapBufferARB, NULL, 519),
- NAME_FUNC_OFFSET(20966, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
- NAME_FUNC_OFFSET(20980, glBeginQueryARB, glBeginQueryARB, NULL, 521),
- NAME_FUNC_OFFSET(20993, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
- NAME_FUNC_OFFSET(21009, glEndQueryARB, glEndQueryARB, NULL, 523),
- NAME_FUNC_OFFSET(21020, glGenQueriesARB, glGenQueriesARB, NULL, 524),
- NAME_FUNC_OFFSET(21033, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL,
- 525),
- NAME_FUNC_OFFSET(21052, glGetQueryObjectuivARB, glGetQueryObjectuivARB,
- NULL, 526),
- NAME_FUNC_OFFSET(21072, glGetQueryivARB, glGetQueryivARB, NULL, 527),
- NAME_FUNC_OFFSET(21085, glIsQueryARB, glIsQueryARB, NULL, 528),
- NAME_FUNC_OFFSET(21095, glCompileShaderARB, glCompileShaderARB, NULL, 530),
- NAME_FUNC_OFFSET(21111, glGetActiveUniformARB, glGetActiveUniformARB, NULL,
- 535),
- NAME_FUNC_OFFSET(21130, glGetShaderSourceARB, glGetShaderSourceARB, NULL,
- 541),
- NAME_FUNC_OFFSET(21148, glGetUniformLocationARB, glGetUniformLocationARB,
- NULL, 542),
- NAME_FUNC_OFFSET(21169, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
- NAME_FUNC_OFFSET(21184, glGetUniformivARB, glGetUniformivARB, NULL, 544),
- NAME_FUNC_OFFSET(21199, glLinkProgramARB, glLinkProgramARB, NULL, 545),
- NAME_FUNC_OFFSET(21213, glShaderSourceARB, glShaderSourceARB, NULL, 546),
- NAME_FUNC_OFFSET(21228, glUniform1fARB, glUniform1fARB, NULL, 547),
- NAME_FUNC_OFFSET(21240, glUniform1fvARB, glUniform1fvARB, NULL, 548),
- NAME_FUNC_OFFSET(21253, glUniform1iARB, glUniform1iARB, NULL, 549),
- NAME_FUNC_OFFSET(21265, glUniform1ivARB, glUniform1ivARB, NULL, 550),
- NAME_FUNC_OFFSET(21278, glUniform2fARB, glUniform2fARB, NULL, 551),
- NAME_FUNC_OFFSET(21290, glUniform2fvARB, glUniform2fvARB, NULL, 552),
- NAME_FUNC_OFFSET(21303, glUniform2iARB, glUniform2iARB, NULL, 553),
- NAME_FUNC_OFFSET(21315, glUniform2ivARB, glUniform2ivARB, NULL, 554),
- NAME_FUNC_OFFSET(21328, glUniform3fARB, glUniform3fARB, NULL, 555),
- NAME_FUNC_OFFSET(21340, glUniform3fvARB, glUniform3fvARB, NULL, 556),
- NAME_FUNC_OFFSET(21353, glUniform3iARB, glUniform3iARB, NULL, 557),
- NAME_FUNC_OFFSET(21365, glUniform3ivARB, glUniform3ivARB, NULL, 558),
- NAME_FUNC_OFFSET(21378, glUniform4fARB, glUniform4fARB, NULL, 559),
- NAME_FUNC_OFFSET(21390, glUniform4fvARB, glUniform4fvARB, NULL, 560),
- NAME_FUNC_OFFSET(21403, glUniform4iARB, glUniform4iARB, NULL, 561),
- NAME_FUNC_OFFSET(21415, glUniform4ivARB, glUniform4ivARB, NULL, 562),
- NAME_FUNC_OFFSET(21428, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL,
- 563),
- NAME_FUNC_OFFSET(21447, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL,
- 564),
- NAME_FUNC_OFFSET(21466, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL,
- 565),
- NAME_FUNC_OFFSET(21485, glUseProgramObjectARB, glUseProgramObjectARB, NULL,
- 566),
- NAME_FUNC_OFFSET(21498, glValidateProgramARB, glValidateProgramARB, NULL,
- 567),
- NAME_FUNC_OFFSET(21516, glBindAttribLocationARB, glBindAttribLocationARB,
- NULL, 568),
- NAME_FUNC_OFFSET(21537, glGetActiveAttribARB, glGetActiveAttribARB, NULL,
- 569),
- NAME_FUNC_OFFSET(21555, glGetAttribLocationARB, glGetAttribLocationARB,
- NULL, 570),
- NAME_FUNC_OFFSET(21575, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(21589, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(21606, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(21622, glDrawArraysInstancedARB, glDrawArraysInstancedARB,
- NULL, 573),
- NAME_FUNC_OFFSET(21647, glDrawArraysInstancedARB, glDrawArraysInstancedARB,
- NULL, 573),
- NAME_FUNC_OFFSET(21669, glDrawElementsInstancedARB,
- glDrawElementsInstancedARB, NULL, 574),
- NAME_FUNC_OFFSET(21696, glDrawElementsInstancedARB,
- glDrawElementsInstancedARB, NULL, 574),
- NAME_FUNC_OFFSET(21720, glRenderbufferStorageMultisample,
- glRenderbufferStorageMultisample, NULL, 575),
- NAME_FUNC_OFFSET(21756, glBlendEquationSeparateiARB,
- glBlendEquationSeparateiARB, NULL, 597),
- NAME_FUNC_OFFSET(21790, glBlendEquationiARB, glBlendEquationiARB, NULL,
- 598),
- NAME_FUNC_OFFSET(21816, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB,
- NULL, 599),
- NAME_FUNC_OFFSET(21846, glBlendFunciARB, glBlendFunciARB, NULL, 600),
- NAME_FUNC_OFFSET(21868, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL,
- 698),
- NAME_FUNC_OFFSET(21884, gl_dispatch_stub_699, gl_dispatch_stub_699, NULL,
- 699),
- NAME_FUNC_OFFSET(21903, glPointParameterfEXT, glPointParameterfEXT, NULL,
- 706),
- NAME_FUNC_OFFSET(21921, glPointParameterfEXT, glPointParameterfEXT, NULL,
- 706),
- NAME_FUNC_OFFSET(21942, glPointParameterfEXT, glPointParameterfEXT, NULL,
- 706),
- NAME_FUNC_OFFSET(21964, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
- 707),
- NAME_FUNC_OFFSET(21983, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
- 707),
- NAME_FUNC_OFFSET(22005, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
- 707),
- NAME_FUNC_OFFSET(22028, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL,
- 710),
- NAME_FUNC_OFFSET(22047, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT,
- NULL, 711),
- NAME_FUNC_OFFSET(22067, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL,
- 712),
- NAME_FUNC_OFFSET(22086, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT,
- NULL, 713),
- NAME_FUNC_OFFSET(22106, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL,
- 714),
- NAME_FUNC_OFFSET(22125, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT,
- NULL, 715),
- NAME_FUNC_OFFSET(22145, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL,
- 716),
- NAME_FUNC_OFFSET(22164, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT,
- NULL, 717),
- NAME_FUNC_OFFSET(22184, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL,
- 718),
- NAME_FUNC_OFFSET(22203, glSecondaryColor3svEXT, glSecondaryColor3svEXT,
- NULL, 719),
- NAME_FUNC_OFFSET(22223, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT,
- NULL, 720),
- NAME_FUNC_OFFSET(22243, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT,
- NULL, 721),
- NAME_FUNC_OFFSET(22264, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT,
- NULL, 722),
- NAME_FUNC_OFFSET(22284, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT,
- NULL, 723),
- NAME_FUNC_OFFSET(22305, glSecondaryColor3usEXT, glSecondaryColor3usEXT,
- NULL, 724),
- NAME_FUNC_OFFSET(22325, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT,
- NULL, 725),
- NAME_FUNC_OFFSET(22346, glSecondaryColorPointerEXT,
- glSecondaryColorPointerEXT, NULL, 726),
- NAME_FUNC_OFFSET(22370, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL,
- 727),
- NAME_FUNC_OFFSET(22388, glMultiDrawElementsEXT, glMultiDrawElementsEXT,
- NULL, 728),
- NAME_FUNC_OFFSET(22408, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL,
- 729),
- NAME_FUNC_OFFSET(22426, glFogCoorddEXT, glFogCoorddEXT, NULL, 730),
- NAME_FUNC_OFFSET(22438, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 731),
- NAME_FUNC_OFFSET(22451, glFogCoordfEXT, glFogCoordfEXT, NULL, 732),
- NAME_FUNC_OFFSET(22463, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 733),
- NAME_FUNC_OFFSET(22476, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT,
- NULL, 735),
- NAME_FUNC_OFFSET(22496, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT,
- NULL, 735),
- NAME_FUNC_OFFSET(22520, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 752),
- NAME_FUNC_OFFSET(22534, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 752),
- NAME_FUNC_OFFSET(22551, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 753),
- NAME_FUNC_OFFSET(22566, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 753),
- NAME_FUNC_OFFSET(22584, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 754),
- NAME_FUNC_OFFSET(22598, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 754),
- NAME_FUNC_OFFSET(22615, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 755),
- NAME_FUNC_OFFSET(22630, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 755),
- NAME_FUNC_OFFSET(22648, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 756),
- NAME_FUNC_OFFSET(22662, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 756),
- NAME_FUNC_OFFSET(22679, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 757),
- NAME_FUNC_OFFSET(22694, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 757),
- NAME_FUNC_OFFSET(22712, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 758),
- NAME_FUNC_OFFSET(22726, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 758),
- NAME_FUNC_OFFSET(22743, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 759),
- NAME_FUNC_OFFSET(22758, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 759),
- NAME_FUNC_OFFSET(22776, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 760),
- NAME_FUNC_OFFSET(22790, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 760),
- NAME_FUNC_OFFSET(22807, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 761),
- NAME_FUNC_OFFSET(22822, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 761),
- NAME_FUNC_OFFSET(22840, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 762),
- NAME_FUNC_OFFSET(22854, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 762),
- NAME_FUNC_OFFSET(22871, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 763),
- NAME_FUNC_OFFSET(22886, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 763),
- NAME_FUNC_OFFSET(22904, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 764),
- NAME_FUNC_OFFSET(22918, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 764),
- NAME_FUNC_OFFSET(22935, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 765),
- NAME_FUNC_OFFSET(22950, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 765),
- NAME_FUNC_OFFSET(22968, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 766),
- NAME_FUNC_OFFSET(22982, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 766),
- NAME_FUNC_OFFSET(22999, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 767),
- NAME_FUNC_OFFSET(23014, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 767),
- NAME_FUNC_OFFSET(23032, glBindProgramNV, glBindProgramNV, NULL, 786),
- NAME_FUNC_OFFSET(23049, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 787),
- NAME_FUNC_OFFSET(23069, glGenProgramsNV, glGenProgramsNV, NULL, 789),
- NAME_FUNC_OFFSET(23086, glGetVertexAttribPointervNV,
- glGetVertexAttribPointervNV, NULL, 795),
- NAME_FUNC_OFFSET(23112, glGetVertexAttribPointervNV,
- glGetVertexAttribPointervNV, NULL, 795),
- NAME_FUNC_OFFSET(23141, glIsProgramNV, glIsProgramNV, NULL, 799),
- NAME_FUNC_OFFSET(23156, glPointParameteriNV, glPointParameteriNV, NULL,
- 863),
- NAME_FUNC_OFFSET(23174, glPointParameterivNV, glPointParameterivNV, NULL,
- 864),
- NAME_FUNC_OFFSET(23193, gl_dispatch_stub_867, gl_dispatch_stub_867, NULL,
- 867),
- NAME_FUNC_OFFSET(23214, gl_dispatch_stub_869, gl_dispatch_stub_869, NULL,
- 869),
- NAME_FUNC_OFFSET(23230, glPrimitiveRestartIndexNV,
- glPrimitiveRestartIndexNV, NULL, 876),
- NAME_FUNC_OFFSET(23254, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL,
- 879),
- NAME_FUNC_OFFSET(23278, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL,
- 879),
- NAME_FUNC_OFFSET(23305, glBindFramebufferEXT, glBindFramebufferEXT, NULL,
- 880),
- NAME_FUNC_OFFSET(23323, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL,
- 881),
- NAME_FUNC_OFFSET(23342, glCheckFramebufferStatusEXT,
- glCheckFramebufferStatusEXT, NULL, 882),
- NAME_FUNC_OFFSET(23367, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT,
- NULL, 883),
- NAME_FUNC_OFFSET(23388, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT,
- NULL, 884),
- NAME_FUNC_OFFSET(23410, glFramebufferRenderbufferEXT,
- glFramebufferRenderbufferEXT, NULL, 885),
- NAME_FUNC_OFFSET(23436, glFramebufferTexture1DEXT,
- glFramebufferTexture1DEXT, NULL, 886),
- NAME_FUNC_OFFSET(23459, glFramebufferTexture2DEXT,
- glFramebufferTexture2DEXT, NULL, 887),
- NAME_FUNC_OFFSET(23482, glFramebufferTexture3DEXT,
- glFramebufferTexture3DEXT, NULL, 888),
- NAME_FUNC_OFFSET(23505, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL,
- 889),
- NAME_FUNC_OFFSET(23523, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL,
- 890),
- NAME_FUNC_OFFSET(23542, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL,
- 891),
- NAME_FUNC_OFFSET(23559, glGetFramebufferAttachmentParameterivEXT,
- glGetFramebufferAttachmentParameterivEXT, NULL, 892),
- NAME_FUNC_OFFSET(23597, glGetRenderbufferParameterivEXT,
- glGetRenderbufferParameterivEXT, NULL, 893),
- NAME_FUNC_OFFSET(23626, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 894),
- NAME_FUNC_OFFSET(23642, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL,
- 895),
- NAME_FUNC_OFFSET(23659, glRenderbufferStorageEXT, glRenderbufferStorageEXT,
- NULL, 896),
- NAME_FUNC_OFFSET(23681, gl_dispatch_stub_897, gl_dispatch_stub_897, NULL,
- 897),
- NAME_FUNC_OFFSET(23699, glBindFragDataLocationEXT,
- glBindFragDataLocationEXT, NULL, 900),
- NAME_FUNC_OFFSET(23722, glGetFragDataLocationEXT, glGetFragDataLocationEXT,
- NULL, 901),
- NAME_FUNC_OFFSET(23744, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 902),
- NAME_FUNC_OFFSET(23760, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT,
- NULL, 903),
- NAME_FUNC_OFFSET(23781, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT,
- NULL, 904),
- NAME_FUNC_OFFSET(23803, glUniform1uiEXT, glUniform1uiEXT, NULL, 905),
- NAME_FUNC_OFFSET(23816, glUniform1uivEXT, glUniform1uivEXT, NULL, 906),
- NAME_FUNC_OFFSET(23830, glUniform2uiEXT, glUniform2uiEXT, NULL, 907),
- NAME_FUNC_OFFSET(23843, glUniform2uivEXT, glUniform2uivEXT, NULL, 908),
- NAME_FUNC_OFFSET(23857, glUniform3uiEXT, glUniform3uiEXT, NULL, 909),
- NAME_FUNC_OFFSET(23870, glUniform3uivEXT, glUniform3uivEXT, NULL, 910),
- NAME_FUNC_OFFSET(23884, glUniform4uiEXT, glUniform4uiEXT, NULL, 911),
- NAME_FUNC_OFFSET(23897, glUniform4uivEXT, glUniform4uivEXT, NULL, 912),
- NAME_FUNC_OFFSET(23911, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL,
- 913),
- NAME_FUNC_OFFSET(23929, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL,
- 914),
- NAME_FUNC_OFFSET(23948, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL,
- 915),
- NAME_FUNC_OFFSET(23967, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT,
- NULL, 916),
- NAME_FUNC_OFFSET(23987, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL,
- 917),
- NAME_FUNC_OFFSET(24005, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL,
- 918),
- NAME_FUNC_OFFSET(24024, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL,
- 919),
- NAME_FUNC_OFFSET(24043, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT,
- NULL, 920),
- NAME_FUNC_OFFSET(24063, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL,
- 921),
- NAME_FUNC_OFFSET(24081, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL,
- 922),
- NAME_FUNC_OFFSET(24100, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL,
- 923),
- NAME_FUNC_OFFSET(24119, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT,
- NULL, 924),
- NAME_FUNC_OFFSET(24139, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL,
- 925),
- NAME_FUNC_OFFSET(24158, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL,
- 926),
- NAME_FUNC_OFFSET(24176, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL,
- 927),
- NAME_FUNC_OFFSET(24195, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL,
- 928),
- NAME_FUNC_OFFSET(24214, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT,
- NULL, 929),
- NAME_FUNC_OFFSET(24234, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL,
- 930),
- NAME_FUNC_OFFSET(24253, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT,
- NULL, 931),
- NAME_FUNC_OFFSET(24273, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT,
- NULL, 932),
- NAME_FUNC_OFFSET(24293, glVertexAttribIPointerEXT,
- glVertexAttribIPointerEXT, NULL, 933),
- NAME_FUNC_OFFSET(24316, glFramebufferTextureLayerEXT,
- glFramebufferTextureLayerEXT, NULL, 934),
- NAME_FUNC_OFFSET(24342, glFramebufferTextureLayerEXT,
- glFramebufferTextureLayerEXT, NULL, 934),
- NAME_FUNC_OFFSET(24371, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL,
- 935),
- NAME_FUNC_OFFSET(24384, glDisableIndexedEXT, glDisableIndexedEXT, NULL,
- 936),
- NAME_FUNC_OFFSET(24395, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 937),
- NAME_FUNC_OFFSET(24405, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT,
- NULL, 938),
- NAME_FUNC_OFFSET(24421, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT,
- NULL, 939),
- NAME_FUNC_OFFSET(24437, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL,
- 940),
- NAME_FUNC_OFFSET(24450, glGetTexParameterIivEXT, glGetTexParameterIivEXT,
- NULL, 943),
- NAME_FUNC_OFFSET(24471, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT,
- NULL, 944),
- NAME_FUNC_OFFSET(24493, glTexParameterIivEXT, glTexParameterIivEXT, NULL,
- 945),
- NAME_FUNC_OFFSET(24511, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL,
- 946),
- NAME_FUNC_OFFSET(24530, glBeginConditionalRenderNV,
- glBeginConditionalRenderNV, NULL, 947),
- NAME_FUNC_OFFSET(24555, glEndConditionalRenderNV, glEndConditionalRenderNV,
- NULL, 948),
- NAME_FUNC_OFFSET(24578, glBeginTransformFeedbackEXT,
- glBeginTransformFeedbackEXT, NULL, 949),
- NAME_FUNC_OFFSET(24603, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL,
- 950),
- NAME_FUNC_OFFSET(24620, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL,
- 952),
- NAME_FUNC_OFFSET(24638, glEndTransformFeedbackEXT,
- glEndTransformFeedbackEXT, NULL, 953),
- NAME_FUNC_OFFSET(24661, glGetTransformFeedbackVaryingEXT,
- glGetTransformFeedbackVaryingEXT, NULL, 954),
- NAME_FUNC_OFFSET(24691, glTransformFeedbackVaryingsEXT,
- glTransformFeedbackVaryingsEXT, NULL, 955),
- NAME_FUNC_OFFSET(24719, glProvokingVertexEXT, glProvokingVertexEXT, NULL,
- 956),
- NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
-};
-
-#undef NAME_FUNC_OFFSET
diff --git a/glx/glthread.c b/glx/glthread.c
deleted file mode 100644
index fd4c6cc09..000000000
--- a/glx/glthread.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL 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.
- */
-
-/*
- * XXX There's probably some work to do in order to make this file
- * truly reusable outside of Mesa.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include <X11/Xfuncproto.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "glthread.h"
-
-/*
- * This file should still compile even when THREADS is not defined.
- * This is to make things easier to deal with on the makefile scene..
- */
-#ifdef THREADS
-#include <errno.h>
-
-/*
- * Error messages
- */
-#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data"
-#define GET_TSD_ERROR "_glthread_: failed to get thread specific data"
-#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data"
-
-/*
- * Magic number to determine if a TSD object has been initialized.
- * Kind of a hack but there doesn't appear to be a better cross-platform
- * solution.
- */
-#define INIT_MAGIC 0xff8adc98
-
-/*
- * POSIX Threads -- The best way to go if your platform supports them.
- * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly
- * has them, and many of the free Unixes now have them.
- * Be sure to use appropriate -mt or -D_REENTRANT type
- * compile flags when building.
- */
-#ifdef PTHREADS
-
-_X_EXPORT unsigned long
-_glthread_GetID(void)
-{
- return (unsigned long) pthread_self();
-}
-
-void
-_glthread_InitTSD(_glthread_TSD * tsd)
-{
- if (pthread_key_create(&tsd->key, NULL /*free */ ) != 0) {
- perror(INIT_TSD_ERROR);
- exit(-1);
- }
- tsd->initMagic = INIT_MAGIC;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD * tsd)
-{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- return pthread_getspecific(tsd->key);
-}
-
-void
-_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
-{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- if (pthread_setspecific(tsd->key, ptr) != 0) {
- perror(SET_TSD_ERROR);
- exit(-1);
- }
-}
-
-#endif /* PTHREADS */
-
-/*
- * Win32 Threads. The only available option for Windows 95/NT.
- * Be sure that you compile using the Multithreaded runtime, otherwise
- * bad things will happen.
- */
-#ifdef WIN32_THREADS
-
-void
-FreeTSD(_glthread_TSD * p)
-{
- if (p->initMagic == INIT_MAGIC) {
- TlsFree(p->key);
- p->initMagic = 0;
- }
-}
-
-void
-InsteadOf_exit(int nCode)
-{
- DWORD dwErr = GetLastError();
-}
-
-unsigned long
-_glthread_GetID(void)
-{
- return GetCurrentThreadId();
-}
-
-void
-_glthread_InitTSD(_glthread_TSD * tsd)
-{
- tsd->key = TlsAlloc();
- if (tsd->key == TLS_OUT_OF_INDEXES) {
- perror("Mesa:_glthread_InitTSD");
- InsteadOf_exit(-1);
- }
- tsd->initMagic = INIT_MAGIC;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD * tsd)
-{
- if (tsd->initMagic != INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- return TlsGetValue(tsd->key);
-}
-
-void
-_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
-{
- /* the following code assumes that the _glthread_TSD has been initialized
- to zero at creation */
- if (tsd->initMagic != INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- if (TlsSetValue(tsd->key, ptr) == 0) {
- perror("Mesa:_glthread_SetTSD");
- InsteadOf_exit(-1);
- }
-}
-
-#endif /* WIN32_THREADS */
-
-#else /* THREADS */
-
-/*
- * no-op functions
- */
-
-_X_EXPORT unsigned long
-_glthread_GetID(void)
-{
- return 0;
-}
-
-void
-_glthread_InitTSD(_glthread_TSD * tsd)
-{
- (void) tsd;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD * tsd)
-{
- (void) tsd;
- return NULL;
-}
-
-void
-_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
-{
- (void) tsd;
- (void) ptr;
-}
-
-#endif /* THREADS */
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index f62fd7962..cb92081c7 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -55,12 +55,12 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
int *err)
{
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if (screen < 0 || screen >= screenInfo.numScreens) {
- client->errorValue = screen;
- *err = BadValue;
- return FALSE;
+ client->errorValue = screen;
+ *err = BadValue;
+ return FALSE;
}
*pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
@@ -68,16 +68,16 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
}
static int
-validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
- __GLXconfig ** config, int *err)
+validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
+ __GLXconfig **config, int *err)
{
__GLXconfig *m;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
- if (m->fbconfigID == id) {
- *config = m;
- return TRUE;
- }
+ if (m->fbconfigID == id) {
+ *config = m;
+ return TRUE;
+ }
client->errorValue = id;
*err = __glXError(GLXBadFBConfig);
@@ -86,16 +86,16 @@ validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
}
static int
-validGlxVisual(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
- __GLXconfig ** config, int *err)
+validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
+ __GLXconfig **config, int *err)
{
int i;
for (i = 0; i < pGlxScreen->numVisuals; i++)
- if (pGlxScreen->visuals[i]->visualID == id) {
- *config = pGlxScreen->visuals[i];
- return TRUE;
- }
+ if (pGlxScreen->visuals[i]->visualID == id) {
+ *config = pGlxScreen->visuals[i];
+ return TRUE;
+ }
client->errorValue = id;
*err = BadValue;
@@ -104,28 +104,28 @@ validGlxVisual(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
}
static int
-validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
- DrawablePtr pDraw, int *err)
+validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
+ DrawablePtr pDraw, int *err)
{
ScreenPtr pScreen = pDraw->pScreen;
VisualPtr pVisual = NULL;
XID vid;
int i;
- vid = wVisual((WindowPtr) pDraw);
+ vid = wVisual((WindowPtr)pDraw);
for (i = 0; i < pScreen->numVisuals; i++) {
- if (pScreen->visuals[i].vid == vid) {
- pVisual = &pScreen->visuals[i];
- break;
- }
+ if (pScreen->visuals[i].vid == vid) {
+ pVisual = &pScreen->visuals[i];
+ break;
+ }
}
/* FIXME: What exactly should we check here... */
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
- !(config->drawableType & GLX_WINDOW_BIT)) {
- client->errorValue = pDraw->id;
- *err = BadMatch;
- return FALSE;
+ !(config->drawableType & GLX_WINDOW_BIT)) {
+ client->errorValue = pDraw->id;
+ *err = BadMatch;
+ return FALSE;
}
return TRUE;
@@ -133,15 +133,15 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
static int
validGlxContext(ClientPtr client, XID id, int access_mode,
- __GLXcontext ** context, int *err)
+ __GLXcontext **context, int *err)
{
*err = dixLookupResourceByType((pointer *) context, id,
- __glXContextRes, client, access_mode);
+ __glXContextRes, client, access_mode);
if (*err != Success || (*context)->idExists == GL_FALSE) {
- client->errorValue = id;
- if (*err == BadValue || *err == Success)
- *err = __glXError(GLXBadContext);
- return FALSE;
+ client->errorValue = id;
+ if (*err == BadValue || *err == Success)
+ *err = __glXError(GLXBadContext);
+ return FALSE;
}
return TRUE;
@@ -149,46 +149,46 @@ validGlxContext(ClientPtr client, XID id, int access_mode,
static int
validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
- __GLXdrawable ** drawable, int *err)
+ __GLXdrawable **drawable, int *err)
{
int rc;
rc = dixLookupResourceByType((pointer *) drawable, id,
- __glXDrawableRes, client, access_mode);
+ __glXDrawableRes, client, access_mode);
if (rc != Success && rc != BadValue) {
- *err = rc;
- client->errorValue = id;
- return FALSE;
+ *err = rc;
+ client->errorValue = id;
+ return FALSE;
}
/* If the ID of the glx drawable we looked up doesn't match the id
* we looked for, it's because we looked it up under the X
* drawable ID (see DoCreateGLXDrawable). */
if (rc == BadValue ||
- (*drawable)->drawId != id ||
- (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
- client->errorValue = id;
- switch (type) {
- case GLX_DRAWABLE_WINDOW:
- *err = __glXError(GLXBadWindow);
- return FALSE;
- case GLX_DRAWABLE_PIXMAP:
- *err = __glXError(GLXBadPixmap);
- return FALSE;
- case GLX_DRAWABLE_PBUFFER:
- *err = __glXError(GLXBadPbuffer);
- return FALSE;
- case GLX_DRAWABLE_ANY:
- *err = __glXError(GLXBadDrawable);
- return FALSE;
- }
+ (*drawable)->drawId != id ||
+ (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
+ client->errorValue = id;
+ switch (type) {
+ case GLX_DRAWABLE_WINDOW:
+ *err = __glXError(GLXBadWindow);
+ return FALSE;
+ case GLX_DRAWABLE_PIXMAP:
+ *err = __glXError(GLXBadPixmap);
+ return FALSE;
+ case GLX_DRAWABLE_PBUFFER:
+ *err = __glXError(GLXBadPbuffer);
+ return FALSE;
+ case GLX_DRAWABLE_ANY:
+ *err = __glXError(GLXBadDrawable);
+ return FALSE;
+ }
}
return TRUE;
}
void
-__glXContextDestroy(__GLXcontext * context)
+__glXContextDestroy(__GLXcontext *context)
{
__glXFlushContextCache();
}
@@ -206,15 +206,22 @@ __glXdirectContextCreate(__GLXscreen * screen,
{
__GLXcontext *context;
- context = calloc(1, sizeof(__GLXcontext));
+ context = calloc(1, sizeof (__GLXcontext));
if (context == NULL)
- return NULL;
+ return NULL;
context->destroy = __glXdirectContextDestroy;
return context;
}
+void
+FlushContext(__GLXcontext *cx)
+{
+ CALL_Flush( GET_DISPATCH(), () );
+ cx->hasUnflushedCommands = GL_FALSE;
+}
+
/**
* Create a GL context with the given properties. This routine is used
* to implement \c glXCreateContext, \c glXCreateNewContext, and
@@ -224,86 +231,86 @@ __glXdirectContextCreate(__GLXscreen * screen,
*/
static int
-DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
- GLXContextID shareList, __GLXconfig * config,
- __GLXscreen * pGlxScreen, GLboolean isDirect)
+DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
+ GLXContextID shareList, __GLXconfig *config,
+ __GLXscreen *pGlxScreen, GLboolean isDirect)
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
int err;
-
+
LEGAL_NEW_RESOURCE(gcId, client);
/*
- ** Find the display list space that we want to share.
- **
- ** NOTE: In a multithreaded X server, we would need to keep a reference
- ** count for each display list so that if one client detroyed a list that
- ** another client was using, the list would not really be freed until it
- ** was no longer in use. Since this sample implementation has no support
- ** for multithreaded servers, we don't do this.
- */
+ ** Find the display list space that we want to share.
+ **
+ ** NOTE: In a multithreaded X server, we would need to keep a reference
+ ** count for each display list so that if one client detroyed a list that
+ ** another client was using, the list would not really be freed until it
+ ** was no longer in use. Since this sample implementation has no support
+ ** for multithreaded servers, we don't do this.
+ */
if (shareList == None) {
- shareglxc = 0;
+ shareglxc = 0;
}
else {
- if (!validGlxContext(client, shareList, DixReadAccess,
- &shareglxc, &err))
- return err;
-
- if (shareglxc->isDirect) {
- /*
- ** NOTE: no support for sharing display lists between direct
- ** contexts, even if they are in the same address space.
- */
+ if (!validGlxContext(client, shareList, DixReadAccess,
+ &shareglxc, &err))
+ return err;
+
+ if (shareglxc->isDirect) {
+ /*
+ ** NOTE: no support for sharing display lists between direct
+ ** contexts, even if they are in the same address space.
+ */
#if 0
/* Disabling this code seems to allow shared display lists
* and texture objects to work. We'll leave it disabled for now.
*/
- client->errorValue = shareList;
- return BadMatch;
+ client->errorValue = shareList;
+ return BadMatch;
#endif
}
else {
- /*
- ** Create an indirect context regardless of what the client asked
- ** for; this way we can share display list space with shareList.
- */
- isDirect = GL_FALSE;
- }
+ /*
+ ** Create an indirect context regardless of what the client asked
+ ** for; this way we can share display list space with shareList.
+ */
+ isDirect = GL_FALSE;
+ }
}
/*
- ** Allocate memory for the new context
- */
+ ** Allocate memory for the new context
+ */
if (!isDirect)
- glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+ glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
else
- glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
+ glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
- return BadAlloc;
+ return BadAlloc;
}
/*
- ** Initially, setup the part of the context that could be used by
- ** a GL core that needs windowing information (e.g., Mesa).
- */
+ ** Initially, setup the part of the context that could be used by
+ ** a GL core that needs windowing information (e.g., Mesa).
+ */
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
/*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
- (*glxc->destroy) (glxc);
- client->errorValue = gcId;
- return BadAlloc;
- }
-
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+ (*glxc->destroy)(glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
/*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
@@ -328,12 +335,12 @@ __glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXCreateContextReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
- return err;
+ return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect);
}
int
@@ -348,20 +355,20 @@ __glXDisp_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect);
}
int
__glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreateContextWithConfigSGIXReq *req =
- (xGLXCreateContextWithConfigSGIXReq *) pc;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@@ -369,12 +376,12 @@ __glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect);
}
int
@@ -388,8 +395,8 @@ __glXDisp_DestroyContext(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
- &glxc, &err))
- return err;
+ &glxc, &err))
+ return err;
glxc->idExists = GL_FALSE;
if (!glxc->isCurrent)
@@ -412,7 +419,7 @@ __glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag)
{
__GLXcontext *ret;
- if (dixLookupResourceByType((void **) &ret, tag, __glXContextRes,
+ if (dixLookupResourceByType((void **)&ret, tag, __glXContextRes,
cl->client, DixUseAccess) == Success)
return ret;
@@ -425,14 +432,14 @@ static void
StopUsingContext(__GLXcontext * glxc)
{
if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
- }
- glxc->isCurrent = GL_FALSE;
- if (!glxc->idExists) {
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
FreeResourceByType(glxc->id, __glXContextRes, FALSE);
- }
+ }
}
}
@@ -440,7 +447,7 @@ static void
StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
{
glxc->isCurrent = GL_TRUE;
- __glXLastContext = glxc;
+ __glXLastContext = glxc;
}
/**
@@ -450,29 +457,29 @@ StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
* sure it's an X window and create a GLX drawable one the fly.
*/
static __GLXdrawable *
-__glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
- int *error)
+__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
+ int *error)
{
DrawablePtr pDraw;
__GLXdrawable *pGlxDraw;
int rc;
if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
- DixWriteAccess, &pGlxDraw, &rc)) {
- if (glxc != NULL && pGlxDraw->config != glxc->config) {
- client->errorValue = drawId;
- *error = BadMatch;
- return NULL;
- }
+ DixWriteAccess, &pGlxDraw, &rc)) {
+ if (glxc != NULL && pGlxDraw->config != glxc->config) {
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
+ }
- return pGlxDraw;
+ return pGlxDraw;
}
/* No active context and an unknown drawable, bail. */
if (glxc == NULL) {
- client->errorValue = drawId;
- *error = BadMatch;
- return NULL;
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
}
/* The drawId wasn't a GLX drawable. Make sure it's a window and
@@ -482,30 +489,30 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
- client->errorValue = drawId;
- *error = __glXError(GLXBadDrawable);
- return NULL;
+ client->errorValue = drawId;
+ *error = __glXError(GLXBadDrawable);
+ return NULL;
}
if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
- client->errorValue = pDraw->pScreen->myNum;
- *error = BadMatch;
- return NULL;
+ client->errorValue = pDraw->pScreen->myNum;
+ *error = BadMatch;
+ return NULL;
}
if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
- return NULL;
+ return NULL;
pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
- pDraw, drawId,
- GLX_DRAWABLE_WINDOW,
- drawId, glxc->config);
+ pDraw, drawId,
+ GLX_DRAWABLE_WINDOW,
+ drawId, glxc->config);
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy(pGlxDraw);
- *error = BadAlloc;
- return NULL;
+ pGlxDraw->destroy (pGlxDraw);
+ *error = BadAlloc;
+ return NULL;
}
return pGlxDraw;
@@ -517,9 +524,9 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
*/
static int
-DoMakeCurrent(__GLXclientState * cl,
- GLXDrawable drawId, GLXDrawable readId,
- GLXContextID contextId, GLXContextTag tag)
+DoMakeCurrent(__GLXclientState *cl,
+ GLXDrawable drawId, GLXDrawable readId,
+ GLXContextID contextId, GLXContextTag tag)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReply reply;
@@ -527,123 +534,123 @@ DoMakeCurrent(__GLXclientState * cl,
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
int error;
- GLuint mask;
+ GLuint mask;
/*
- ** If one is None and the other isn't, it's a bad match.
- */
+ ** If one is None and the other isn't, it's a bad match.
+ */
- mask = (drawId == None) ? (1 << 0) : 0;
- mask |= (readId == None) ? (1 << 1) : 0;
+ mask = (drawId == None) ? (1 << 0) : 0;
+ mask |= (readId == None) ? (1 << 1) : 0;
mask |= (contextId == None) ? (1 << 2) : 0;
- if ((mask != 0x00) && (mask != 0x07)) {
- return BadMatch;
+ if ( (mask != 0x00) && (mask != 0x07) ) {
+ return BadMatch;
}
-
+
/*
- ** Lookup old context. If we have one, it must be in a usable state.
- */
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
if (tag != 0) {
- prevglxc = __glXLookupContextByTag(cl, tag);
- if (!prevglxc) {
- /*
- ** Tag for previous context is invalid.
- */
- return __glXError(GLXBadContextTag);
- }
- if (prevglxc->renderMode != GL_RENDER) {
- /* Oops. Not in render mode render. */
- client->errorValue = prevglxc->id;
- return __glXError(GLXBadContextState);
- }
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXError(GLXBadContextTag);
+ }
+ if (prevglxc->renderMode != GL_RENDER) {
+ /* Oops. Not in render mode render. */
+ client->errorValue = prevglxc->id;
+ return __glXError(GLXBadContextState);
+ }
}
else {
- prevglxc = 0;
+ prevglxc = 0;
}
/*
- ** Lookup new context. It must not be current for someone else.
- */
+ ** Lookup new context. It must not be current for someone else.
+ */
if (contextId != None) {
- int status;
+ int status;
- if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
- return error;
- if ((glxc != prevglxc) && glxc->isCurrent) {
- /* Context is current to somebody else */
- return BadAccess;
- }
+ if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
+ return error;
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
- assert(drawId != None);
- assert(readId != None);
+ assert( drawId != None );
+ assert( readId != None );
- drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
- if (drawPriv == NULL)
- return status;
+ drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
+ if (drawPriv == NULL)
+ return status;
- readPriv = __glXGetDrawable(glxc, readId, client, &status);
- if (readPriv == NULL)
- return status;
+ readPriv = __glXGetDrawable(glxc, readId, client, &status);
+ if (readPriv == NULL)
+ return status;
}
else {
- /* Switching to no context. Ignore new drawable. */
- glxc = 0;
- drawPriv = 0;
- readPriv = 0;
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
+ drawPriv = 0;
+ readPriv = 0;
}
if (prevglxc) {
- /*
- ** Flush the previous context if needed.
- */
- if (prevglxc->hasUnflushedCommands) {
- if (__glXForceCurrent(cl, tag, (int *) &error)) {
- CALL_Flush(GET_DISPATCH(), ());
- prevglxc->hasUnflushedCommands = GL_FALSE;
+ /*
+ ** Flush the previous context if needed.
+ */
+ if (prevglxc->hasUnflushedCommands) {
+ if (__glXForceCurrent(cl, tag, (int *)&error)) {
+ CALL_Flush( GET_DISPATCH(), () );
+ prevglxc->hasUnflushedCommands = GL_FALSE;
}
else {
- return error;
- }
- }
-
- /*
- ** Make the previous context not current.
- */
- if (!(*prevglxc->loseCurrent) (prevglxc)) {
- return __glXError(GLXBadContext);
- }
- __glXFlushContextCache();
- if (!prevglxc->isDirect) {
- prevglxc->drawPriv = NULL;
- prevglxc->readPriv = NULL;
- }
- }
-
+ return error;
+ }
+ }
+
+ /*
+ ** Make the previous context not current.
+ */
+ if (!(*prevglxc->loseCurrent)(prevglxc)) {
+ return __glXError(GLXBadContext);
+ }
+ __glXFlushContextCache();
+ if (!prevglxc->isDirect) {
+ prevglxc->drawPriv = NULL;
+ prevglxc->readPriv = NULL;
+ }
+ }
+
if ((glxc != 0) && !glxc->isDirect) {
- glxc->drawPriv = drawPriv;
- glxc->readPriv = readPriv;
+ glxc->drawPriv = drawPriv;
+ glxc->readPriv = readPriv;
- /* make the context current */
- if (!(*glxc->makeCurrent) (glxc)) {
- glxc->drawPriv = NULL;
- glxc->readPriv = NULL;
- return __glXError(GLXBadContext);
- }
+ /* make the context current */
+ if (!(*glxc->makeCurrent)(glxc)) {
+ glxc->drawPriv = NULL;
+ glxc->readPriv = NULL;
+ return __glXError(GLXBadContext);
+ }
- glxc->isCurrent = GL_TRUE;
+ glxc->isCurrent = GL_TRUE;
}
StopUsingContext(prevglxc);
if (glxc) {
- StartUsingContext(cl, glxc);
- reply.contextTag = glxc->id;
+ StartUsingContext(cl, glxc);
+ reply.contextTag = glxc->id;
}
else {
- reply.contextTag = 0;
+ reply.contextTag = 0;
}
reply.length = 0;
@@ -651,10 +658,10 @@ DoMakeCurrent(__GLXclientState * cl,
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapMakeCurrentReply(client, &reply);
+ __glXSwapMakeCurrentReply(client, &reply);
}
else {
- WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
}
return Success;
}
@@ -667,8 +674,8 @@ __glXDisp_MakeCurrent(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
- return DoMakeCurrent(cl, req->drawable, req->drawable,
- req->context, req->oldContextTag);
+ return DoMakeCurrent( cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag );
}
int
@@ -679,8 +686,8 @@ __glXDisp_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
- return DoMakeCurrent(cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag);
+ return DoMakeCurrent( cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag );
}
int
@@ -691,8 +698,8 @@ __glXDisp_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
- return DoMakeCurrent(cl, req->drawable, req->readable,
- req->context, req->oldContextTag);
+ return DoMakeCurrent( cl, req->drawable, req->readable,
+ req->context, req->oldContextTag );
}
int
@@ -707,7 +714,7 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXIsDirectReq);
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
- return err;
+ return err;
reply.isDirect = glxc->isDirect;
reply.length = 0;
@@ -715,10 +722,10 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapIsDirectReply(client, &reply);
+ __glXSwapIsDirectReply(client, &reply);
}
else {
- WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
}
return Success;
@@ -736,14 +743,14 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
major = req->majorVersion;
minor = req->minorVersion;
- (void) major;
- (void) minor;
+ (void)major;
+ (void)minor;
/*
- ** Server should take into consideration the version numbers sent by the
- ** client if it wants to work with older clients; however, in this
- ** implementation the server just returns its version number.
- */
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
reply.majorVersion = glxMajorVersion;
reply.minorVersion = glxMinorVersion;
reply.length = 0;
@@ -751,10 +758,10 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
+ __glXSwapQueryVersionReply(client, &reply);
}
else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
}
return Success;
}
@@ -763,7 +770,7 @@ int
__glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
GLXContextTag tag;
__GLXcontext *glxc = NULL;
int error;
@@ -772,18 +779,18 @@ __glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
tag = req->contextTag;
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc)
- return __glXError(GLXBadContextTag);
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc)
+ return __glXError(GLXBadContextTag);
+
+ if (!__glXForceCurrent(cl, req->contextTag, &error))
+ return error;
- if (!__glXForceCurrent(cl, req->contextTag, &error))
- return error;
-
- CALL_Finish(GET_DISPATCH(), ());
+ CALL_Finish( GET_DISPATCH(), () );
}
if (glxc && glxc->drawPriv->waitGL)
- (*glxc->drawPriv->waitGL) (glxc->drawPriv);
+ (*glxc->drawPriv->waitGL)(glxc->drawPriv);
return Success;
}
@@ -792,7 +799,7 @@ int
__glXDisp_WaitX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
+ xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
GLXContextTag tag;
__GLXcontext *glxc = NULL;
int error;
@@ -801,16 +808,16 @@ __glXDisp_WaitX(__GLXclientState * cl, GLbyte * pc)
tag = req->contextTag;
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc)
- return __glXError(GLXBadContextTag);
-
- if (!__glXForceCurrent(cl, req->contextTag, &error))
- return error;
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc)
+ return __glXError(GLXBadContextTag);
+
+ if (!__glXForceCurrent(cl, req->contextTag, &error))
+ return error;
}
if (glxc && glxc->drawPriv->waitX)
- (*glxc->drawPriv->waitX) (glxc->drawPriv);
+ (*glxc->drawPriv->waitX)(glxc->drawPriv);
return Success;
}
@@ -834,62 +841,62 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
tag = req->contextTag;
mask = req->mask;
if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
- return error;
+ return error;
if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
- return error;
+ return error;
/*
- ** They must be in the same address space, and same screen.
- ** NOTE: no support for direct rendering contexts here.
- */
+ ** They must be in the same address space, and same screen.
+ ** NOTE: no support for direct rendering contexts here.
+ */
if (src->isDirect || dst->isDirect || (src->pGlxScreen != dst->pGlxScreen)) {
- client->errorValue = source;
- return BadMatch;
+ client->errorValue = source;
+ return BadMatch;
}
/*
- ** The destination context must not be current for any client.
- */
+ ** The destination context must not be current for any client.
+ */
if (dst->isCurrent) {
- client->errorValue = dest;
- return BadAccess;
+ client->errorValue = dest;
+ return BadAccess;
}
if (tag) {
- __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
-
- if (!tagcx) {
- return __glXError(GLXBadContextTag);
- }
- if (tagcx != src) {
- /*
- ** This would be caused by a faulty implementation of the client
- ** library.
- */
- return BadMatch;
- }
- /*
- ** In this case, glXCopyContext is in both GL and X streams, in terms
- ** of sequentiality.
- */
- if (__glXForceCurrent(cl, tag, &error)) {
- /*
- ** Do whatever is needed to make sure that all preceding requests
- ** in both streams are completed before the copy is executed.
- */
- CALL_Finish(GET_DISPATCH(), ());
- tagcx->hasUnflushedCommands = GL_FALSE;
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXError(GLXBadContextTag);
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
+ /*
+ ** In this case, glXCopyContext is in both GL and X streams, in terms
+ ** of sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the copy is executed.
+ */
+ CALL_Finish( GET_DISPATCH(), () );
+ tagcx->hasUnflushedCommands = GL_FALSE;
}
else {
- return error;
- }
+ return error;
+ }
}
/*
- ** Issue copy. The only reason for failure is a bad mask.
- */
- if (!(*dst->copy) (dst, src, mask)) {
- client->errorValue = mask;
- return BadValue;
+ ** Issue copy. The only reason for failure is a bad mask.
+ */
+ if (!(*dst->copy)(dst, src, mask)) {
+ client->errorValue = mask;
+ return BadValue;
}
return Success;
}
@@ -920,7 +927,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
reply.numVisuals = pGlxScreen->numVisuals;
reply.numProps = GLX_VIS_CONFIG_TOTAL;
@@ -930,70 +937,70 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
}
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
for (i = 0; i < pGlxScreen->numVisuals; i++) {
- modes = pGlxScreen->visuals[i];
-
- p = 0;
- buf[p++] = modes->visualID;
- buf[p++] = glxConvertToXVisualType(modes->visualType);
- buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
-
- buf[p++] = modes->redBits;
- buf[p++] = modes->greenBits;
- buf[p++] = modes->blueBits;
- buf[p++] = modes->alphaBits;
- buf[p++] = modes->accumRedBits;
- buf[p++] = modes->accumGreenBits;
- buf[p++] = modes->accumBlueBits;
- buf[p++] = modes->accumAlphaBits;
-
- buf[p++] = modes->doubleBufferMode;
- buf[p++] = modes->stereoMode;
-
- buf[p++] = modes->rgbBits;
- buf[p++] = modes->depthBits;
- buf[p++] = modes->stencilBits;
- buf[p++] = modes->numAuxBuffers;
- buf[p++] = modes->level;
-
- assert(p == GLX_VIS_CONFIG_UNPAIRED);
- /*
- ** Add token/value pairs for extensions.
- */
- buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = modes->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE;
- buf[p++] = modes->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE;
- buf[p++] = modes->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
- buf[p++] = modes->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
- buf[p++] = modes->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
- buf[p++] = modes->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
- buf[p++] = modes->transparentIndex;
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = modes->samples;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = modes->sampleBuffers;
- buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
- buf[p++] = 0;
-
- assert(p == GLX_VIS_CONFIG_TOTAL);
- if (client->swapped) {
- __GLX_SWAP_INT_ARRAY(buf, p);
- }
- WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *) buf);
+ modes = pGlxScreen->visuals[i];
+
+ p = 0;
+ buf[p++] = modes->visualID;
+ buf[p++] = glxConvertToXVisualType( modes->visualType );
+ buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
+
+ buf[p++] = modes->redBits;
+ buf[p++] = modes->greenBits;
+ buf[p++] = modes->blueBits;
+ buf[p++] = modes->alphaBits;
+ buf[p++] = modes->accumRedBits;
+ buf[p++] = modes->accumGreenBits;
+ buf[p++] = modes->accumBlueBits;
+ buf[p++] = modes->accumAlphaBits;
+
+ buf[p++] = modes->doubleBufferMode;
+ buf[p++] = modes->stereoMode;
+
+ buf[p++] = modes->rgbBits;
+ buf[p++] = modes->depthBits;
+ buf[p++] = modes->stencilBits;
+ buf[p++] = modes->numAuxBuffers;
+ buf[p++] = modes->level;
+
+ assert(p == GLX_VIS_CONFIG_UNPAIRED);
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = modes->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = modes->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = modes->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = modes->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = modes->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = modes->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = modes->transparentIndex;
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = modes->samples;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = modes->sampleBuffers;
+ buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
+ buf[p++] = 0;
+
+ assert(p == GLX_VIS_CONFIG_TOTAL);
+ if (client->swapped) {
+ __GLX_SWAP_INT_ARRAY(buf, p);
+ }
+ WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf);
}
return Success;
}
@@ -1011,7 +1018,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
*/
static int
-DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
+DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReply reply;
@@ -1024,7 +1031,7 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
- return err;
+ return err;
reply.numFBConfigs = pGlxScreen->numFBConfigs;
reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
@@ -1033,67 +1040,67 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numFBConfigs);
- __GLX_SWAP_INT(&reply.numAttribs);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
}
- WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
- p = 0;
+ p = 0;
#define WRITE_PAIR(tag,value) \
do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
- WRITE_PAIR(GLX_VISUAL_ID, modes->visualID);
- WRITE_PAIR(GLX_FBCONFIG_ID, modes->fbconfigID);
- WRITE_PAIR(GLX_X_RENDERABLE, GL_TRUE);
-
- WRITE_PAIR(GLX_RGBA,
- (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE);
- WRITE_PAIR(GLX_RENDER_TYPE, modes->renderType);
- WRITE_PAIR(GLX_DOUBLEBUFFER, modes->doubleBufferMode);
- WRITE_PAIR(GLX_STEREO, modes->stereoMode);
-
- WRITE_PAIR(GLX_BUFFER_SIZE, modes->rgbBits);
- WRITE_PAIR(GLX_LEVEL, modes->level);
- WRITE_PAIR(GLX_AUX_BUFFERS, modes->numAuxBuffers);
- WRITE_PAIR(GLX_RED_SIZE, modes->redBits);
- WRITE_PAIR(GLX_GREEN_SIZE, modes->greenBits);
- WRITE_PAIR(GLX_BLUE_SIZE, modes->blueBits);
- WRITE_PAIR(GLX_ALPHA_SIZE, modes->alphaBits);
- WRITE_PAIR(GLX_ACCUM_RED_SIZE, modes->accumRedBits);
- WRITE_PAIR(GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits);
- WRITE_PAIR(GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits);
- WRITE_PAIR(GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits);
- WRITE_PAIR(GLX_DEPTH_SIZE, modes->depthBits);
- WRITE_PAIR(GLX_STENCIL_SIZE, modes->stencilBits);
- WRITE_PAIR(GLX_X_VISUAL_TYPE, modes->visualType);
- WRITE_PAIR(GLX_CONFIG_CAVEAT, modes->visualRating);
- WRITE_PAIR(GLX_TRANSPARENT_TYPE, modes->transparentPixel);
- WRITE_PAIR(GLX_TRANSPARENT_RED_VALUE, modes->transparentRed);
- WRITE_PAIR(GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen);
- WRITE_PAIR(GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue);
- WRITE_PAIR(GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha);
- WRITE_PAIR(GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex);
- WRITE_PAIR(GLX_SWAP_METHOD_OML, modes->swapMethod);
- WRITE_PAIR(GLX_SAMPLES_SGIS, modes->samples);
- WRITE_PAIR(GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers);
- /* GLX_VISUAL_SELECT_GROUP_SGIX ? */
- WRITE_PAIR(GLX_DRAWABLE_TYPE, modes->drawableType);
- WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb);
- WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba);
- WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture);
+ WRITE_PAIR( GLX_VISUAL_ID, modes->visualID );
+ WRITE_PAIR( GLX_FBCONFIG_ID, modes->fbconfigID );
+ WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE );
+
+ WRITE_PAIR( GLX_RGBA,
+ (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
+ WRITE_PAIR( GLX_RENDER_TYPE, modes->renderType );
+ WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode );
+ WRITE_PAIR( GLX_STEREO, modes->stereoMode );
+
+ WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits );
+ WRITE_PAIR( GLX_LEVEL, modes->level );
+ WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers );
+ WRITE_PAIR( GLX_RED_SIZE, modes->redBits );
+ WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits );
+ WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits );
+ WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits );
+ WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits );
+ WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
+ WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits );
+ WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
+ WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits );
+ WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits );
+ WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType );
+ WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
+ WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
+ WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
+ WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
+ WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
+ WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
+ WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
+ WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
+ WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
+ WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
+ /* GLX_VISUAL_SELECT_GROUP_SGIX ? */
+ WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
+ WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
+ WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
+ WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT,
modes->bindToTextureTargets);
- if (client->swapped) {
- __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
- }
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
- (char *) buf);
+ if (client->swapped) {
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
+ }
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
+ (char *)buf);
}
return Success;
}
@@ -1120,9 +1127,9 @@ __glXDisp_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
}
GLboolean
-__glXDrawableInit(__GLXdrawable * drawable,
- __GLXscreen * screen, DrawablePtr pDraw, int type,
- XID drawId, __GLXconfig * config)
+__glXDrawableInit(__GLXdrawable *drawable,
+ __GLXscreen *screen, DrawablePtr pDraw, int type,
+ XID drawId, __GLXconfig *config)
{
drawable->pDraw = pDraw;
drawable->type = type;
@@ -1134,29 +1141,29 @@ __glXDrawableInit(__GLXdrawable * drawable,
}
void
-__glXDrawableRelease(__GLXdrawable * drawable)
+__glXDrawableRelease(__GLXdrawable *drawable)
{
}
-static int
-DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen,
- __GLXconfig * config, DrawablePtr pDraw, XID drawableId,
- XID glxDrawableId, int type)
+static int
+DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
+ __GLXconfig *config, DrawablePtr pDraw, XID drawableId,
+ XID glxDrawableId, int type)
{
__GLXdrawable *pGlxDraw;
if (pGlxScreen->pScreen != pDraw->pScreen)
- return BadMatch;
+ return BadMatch;
pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw,
- drawableId, type,
- glxDrawableId, config);
+ drawableId, type,
+ glxDrawableId, config);
if (pGlxDraw == NULL)
- return BadAlloc;
+ return BadAlloc;
if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy(pGlxDraw);
- return BadAlloc;
+ pGlxDraw->destroy (pGlxDraw);
+ return BadAlloc;
}
/*
@@ -1164,9 +1171,9 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen,
* so we get called regardless of destruction order.
*/
if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
- !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy(pGlxDraw);
- return BadAlloc;
+ !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
+ pGlxDraw->destroy (pGlxDraw);
+ return BadAlloc;
}
return Success;
@@ -1183,25 +1190,25 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen * pGlxScreen,
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
if (err != Success) {
- client->errorValue = drawableId;
- return err;
+ client->errorValue = drawableId;
+ return err;
}
if (pDraw->type != DRAWABLE_PIXMAP) {
- client->errorValue = drawableId;
- return BadPixmap;
+ client->errorValue = drawableId;
+ return BadPixmap;
}
err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
- glxDrawableId, GLX_DRAWABLE_PIXMAP);
+ glxDrawableId, GLX_DRAWABLE_PIXMAP);
- ((PixmapPtr) pDraw)->refcnt++;
+ ((PixmapPtr)pDraw)->refcnt++;
return err;
}
static void
determineTextureTarget(ClientPtr client, XID glxDrawableID,
- CARD32 *attribs, CARD32 numAttribs)
+ CARD32 *attribs, CARD32 numAttribs)
{
GLenum target = 0;
GLenum format = 0;
@@ -1209,33 +1216,33 @@ determineTextureTarget(ClientPtr client, XID glxDrawableID,
__GLXdrawable *pGlxDraw;
if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
- DixWriteAccess, &pGlxDraw, &err))
- /* We just added it in CreatePixmap, so we should never get here. */
- return;
+ DixWriteAccess, &pGlxDraw, &err))
+ /* We just added it in CreatePixmap, so we should never get here. */
+ return;
for (i = 0; i < numAttribs; i++) {
- if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
- switch (attribs[2 * i + 1]) {
- case GLX_TEXTURE_2D_EXT:
- target = GL_TEXTURE_2D;
- break;
- case GLX_TEXTURE_RECTANGLE_EXT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- }
- }
-
- if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
- format = attribs[2 * i + 1];
- }
-
+ if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
+ switch (attribs[2 * i + 1]) {
+ case GLX_TEXTURE_2D_EXT:
+ target = GL_TEXTURE_2D;
+ break;
+ case GLX_TEXTURE_RECTANGLE_EXT:
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ break;
+ }
+ }
+
+ if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+ format = attribs[2 * i + 1];
+ }
+
if (!target) {
- int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
-
- if (h & (h - 1) || w & (w - 1))
- target = GL_TEXTURE_RECTANGLE_ARB;
- else
- target = GL_TEXTURE_2D;
+ int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
+
+ if (h & (h - 1) || w & (w - 1))
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ else
+ target = GL_TEXTURE_2D;
}
pGlxDraw->target = target;
@@ -1254,12 +1261,12 @@ __glXDisp_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
- return err;
+ return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen, config,
- req->pixmap, req->glxpixmap);
+ req->pixmap, req->glxpixmap);
}
int
@@ -1273,23 +1280,23 @@ __glXDisp_CreatePixmap(__GLXclientState * cl, GLbyte * pc)
REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
err = DoCreateGLXPixmap(cl->client, pGlxScreen, config,
- req->pixmap, req->glxpixmap);
+ req->pixmap, req->glxpixmap);
if (err != Success)
- return err;
+ return err;
determineTextureTarget(cl->client, req->glxpixmap,
- (CARD32 *) (req + 1), req->numAttribs);
+ (CARD32*) (req + 1), req->numAttribs);
return Success;
}
@@ -1298,8 +1305,8 @@ int
__glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreateGLXPixmapWithConfigSGIXReq *req =
- (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
+ xGLXCreateGLXPixmapWithConfigSGIXReq *req =
+ (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@@ -1307,12 +1314,12 @@ __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen,
- config, req->pixmap, req->glxpixmap);
+ config, req->pixmap, req->glxpixmap);
}
static int
@@ -1322,8 +1329,8 @@ DoDestroyDrawable(__GLXclientState * cl, XID glxdrawable, int type)
int err;
if (!validGlxDrawable(cl->client, glxdrawable, type,
- DixDestroyAccess, &pGlxDraw, &err))
- return err;
+ DixDestroyAccess, &pGlxDraw, &err))
+ return err;
FreeResource(glxdrawable, FALSE);
@@ -1356,19 +1363,19 @@ __glXDisp_DestroyPixmap(__GLXclientState * cl, GLbyte * pc)
static int
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
- int width, int height, XID glxDrawableId)
+ int width, int height, XID glxDrawableId)
{
- __GLXconfig *config;
- __GLXscreen *pGlxScreen;
- PixmapPtr pPixmap;
- int err;
+ __GLXconfig *config;
+ __GLXscreen *pGlxScreen;
+ PixmapPtr pPixmap;
+ int err;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
- return err;
+ return err;
__glXenterServer(GL_FALSE);
pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
@@ -1381,25 +1388,25 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
* pbuffer is destroyed. */
pPixmap->drawable.id = glxDrawableId;
if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
- return BadAlloc;
+ return BadAlloc;
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
- glxDrawableId, glxDrawableId,
- GLX_DRAWABLE_PBUFFER);
+ glxDrawableId, glxDrawableId,
+ GLX_DRAWABLE_PBUFFER);
}
int
__glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
- CARD32 *attrs;
- int width, height, i;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+ CARD32 *attrs;
+ int width, height, i;
REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
@@ -1408,22 +1415,22 @@ __glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc)
height = 0;
for (i = 0; i < req->numAttribs; i++) {
- switch (attrs[i * 2]) {
- case GLX_PBUFFER_WIDTH:
- width = attrs[i * 2 + 1];
- break;
- case GLX_PBUFFER_HEIGHT:
- height = attrs[i * 2 + 1];
- break;
- case GLX_LARGEST_PBUFFER:
- case GLX_PRESERVED_CONTENTS:
- /* FIXME: huh... */
- break;
- }
+ switch (attrs[i * 2]) {
+ case GLX_PBUFFER_WIDTH:
+ width = attrs[i * 2 + 1];
+ break;
+ case GLX_PBUFFER_HEIGHT:
+ height = attrs[i * 2 + 1];
+ break;
+ case GLX_LARGEST_PBUFFER:
+ case GLX_PRESERVED_CONTENTS:
+ /* FIXME: huh... */
+ break;
+ }
}
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
- width, height, req->pbuffer);
+ width, height, req->pbuffer);
}
int
@@ -1435,7 +1442,7 @@ __glXDisp_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
- req->width, req->height, req->pbuffer);
+ req->width, req->height, req->pbuffer);
}
int
@@ -1462,24 +1469,24 @@ __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
static int
DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
- int numAttribs, CARD32 *attribs)
+ int numAttribs, CARD32 *attribs)
{
__GLXdrawable *pGlxDraw;
int i, err;
if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY,
- DixSetAttrAccess, &pGlxDraw, &err))
- return err;
+ DixSetAttrAccess, &pGlxDraw, &err))
+ return err;
for (i = 0; i < numAttribs; i++) {
- switch (attribs[i * 2]) {
- case GLX_EVENT_MASK:
- /* All we do is to record the event mask so we can send it
- * back when queried. We never actually clobber the
- * pbuffers, so we never need to send out the event. */
- pGlxDraw->eventMask = attribs[i * 2 + 1];
- break;
- }
+ switch(attribs[i * 2]) {
+ case GLX_EVENT_MASK:
+ /* All we do is to record the event mask so we can send it
+ * back when queried. We never actually clobber the
+ * pbuffers, so we never need to send out the event. */
+ pGlxDraw->eventMask = attribs[i * 2 + 1];
+ break;
+ }
}
return Success;
@@ -1490,12 +1497,12 @@ __glXDisp_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXChangeDrawableAttributesReq *req =
- (xGLXChangeDrawableAttributesReq *) pc;
+ (xGLXChangeDrawableAttributesReq *) pc;
REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
#if 0
/* mesa sends an additional 8 bytes */
@@ -1503,11 +1510,11 @@ __glXDisp_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
#else
if (((sizeof(xGLXChangeDrawableAttributesReq) +
(req->numAttribs << 3)) >> 2) < client->req_len)
- return BadLength;
+ return BadLength;
#endif
return DoChangeDrawableAttributes(cl->client, req->drawable,
- req->numAttribs, (CARD32 *) (req + 1));
+ req->numAttribs, (CARD32 *) (req + 1));
}
int
@@ -1515,56 +1522,56 @@ __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXChangeDrawableAttributesSGIXReq *req =
- (xGLXChangeDrawableAttributesSGIXReq *) pc;
+ (xGLXChangeDrawableAttributesSGIXReq *)pc;
REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq,
req->numAttribs << 3);
return DoChangeDrawableAttributes(cl->client, req->drawable,
- req->numAttribs, (CARD32 *) (req + 1));
+ req->numAttribs, (CARD32 *) (req + 1));
}
int
__glXDisp_CreateWindow(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
- __GLXconfig *config;
- __GLXscreen *pGlxScreen;
- ClientPtr client = cl->client;
- DrawablePtr pDraw;
- int err;
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ __GLXconfig *config;
+ __GLXscreen *pGlxScreen;
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ int err;
REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
LEGAL_NEW_RESOURCE(req->glxwindow, client);
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
- client->errorValue = req->window;
- return BadWindow;
+ client->errorValue = req->window;
+ return BadWindow;
}
if (!validGlxFBConfigForWindow(client, config, pDraw, &err))
- return err;
+ return err;
return DoCreateGLXDrawable(client, pGlxScreen, config,
- pDraw, req->window,
- req->glxwindow, GLX_DRAWABLE_WINDOW);
+ pDraw, req->window,
+ req->glxwindow, GLX_DRAWABLE_WINDOW);
}
int
@@ -1602,41 +1609,41 @@ __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
tag = req->contextTag;
drawId = req->drawable;
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXError(GLXBadContextTag);
- }
- /*
- ** The calling thread is swapping its current drawable. In this case,
- ** glxSwapBuffers is in both GL and X streams, in terms of
- ** sequentiality.
- */
- if (__glXForceCurrent(cl, tag, &error)) {
- /*
- ** Do whatever is needed to make sure that all preceding requests
- ** in both streams are completed before the swap is executed.
- */
- CALL_Finish(GET_DISPATCH(), ());
- glxc->hasUnflushedCommands = GL_FALSE;
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXError(GLXBadContextTag);
+ }
+ /*
+ ** The calling thread is swapping its current drawable. In this case,
+ ** glxSwapBuffers is in both GL and X streams, in terms of
+ ** sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the swap is executed.
+ */
+ CALL_Finish( GET_DISPATCH(), () );
+ glxc->hasUnflushedCommands = GL_FALSE;
}
else {
- return error;
- }
+ return error;
+ }
}
pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
if (pGlxDraw == NULL)
- return error;
+ return error;
if (pGlxDraw->type == DRAWABLE_WINDOW &&
- (*pGlxDraw->swapBuffers) (cl->client, pGlxDraw) == GL_FALSE)
- return __glXError(GLXBadDrawable);
+ (*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE)
+ return __glXError(GLXBadDrawable);
return Success;
}
static int
-DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
+DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -1647,7 +1654,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
- return err;
+ return err;
nProps = 3;
reply.length = nProps << 1;
@@ -1656,26 +1663,26 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *) malloc((size_t) nReplyBytes);
+ sendBuf = (int *)malloc((size_t)nReplyBytes);
if (sendBuf == NULL) {
- return __glXError(GLXBadContext); /* XXX: Is this correct? */
+ return __glXError(GLXBadContext); /* XXX: Is this correct? */
}
pSendBuf = sendBuf;
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
- *pSendBuf++ = (int) (ctx->share_id);
+ *pSendBuf++ = (int)(ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
- *pSendBuf++ = (int) (ctx->config->visualID);
+ *pSendBuf++ = (int)(ctx->config->visualID);
*pSendBuf++ = GLX_SCREEN_EXT;
- *pSendBuf++ = (int) (ctx->pGlxScreen->pScreen->myNum);
+ *pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
if (client->swapped) {
- __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+ __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
}
else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
- WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
+ WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
- free((char *) sendBuf);
+ free((char *)sendBuf);
return Success;
}
@@ -1706,41 +1713,41 @@ int
__glXDisp_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- ClientPtr client = cl->client;
- __GLXcontext *context;
- __GLXdrawable *pGlxDraw;
- GLXDrawable drawId;
- int buffer;
- int error;
- CARD32 num_attribs;
+ ClientPtr client = cl->client;
+ __GLXcontext *context;
+ __GLXdrawable *pGlxDraw;
+ GLXDrawable drawId;
+ int buffer;
+ int error;
+ CARD32 num_attribs;
if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
- return BadLength;
+ return BadLength;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
- buffer = *((INT32 *) (pc + 4));
+ buffer = *((INT32 *) (pc + 4));
num_attribs = *((CARD32 *) (pc + 8));
if (num_attribs > (UINT32_MAX >> 3)) {
- client->errorValue = num_attribs;
- return BadValue;
+ client->errorValue = num_attribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3));
if (buffer != GLX_FRONT_LEFT_EXT)
- return __glXError(GLXBadPixmap);
+ return __glXError(GLXBadPixmap);
- context = __glXForceCurrent(cl, req->contextTag, &error);
+ context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
- return error;
+ return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
- DixReadAccess, &pGlxDraw, &error))
- return error;
+ DixReadAccess, &pGlxDraw, &error))
+ return error;
if (!context->textureFromPixmap)
- return __glXError(GLXUnsupportedPrivateRequest);
+ return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->bindTexImage(context, buffer, pGlxDraw);
}
@@ -1749,30 +1756,30 @@ int
__glXDisp_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- ClientPtr client = cl->client;
- __GLXdrawable *pGlxDraw;
- __GLXcontext *context;
- GLXDrawable drawId;
- int buffer;
- int error;
+ ClientPtr client = cl->client;
+ __GLXdrawable *pGlxDraw;
+ __GLXcontext *context;
+ GLXDrawable drawId;
+ int buffer;
+ int error;
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
- buffer = *((INT32 *) (pc + 4));
-
- context = __glXForceCurrent(cl, req->contextTag, &error);
+ buffer = *((INT32 *) (pc + 4));
+
+ context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
- return error;
+ return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
- DixReadAccess, &pGlxDraw, &error))
- return error;
+ DixReadAccess, &pGlxDraw, &error))
+ return error;
if (!context->textureFromPixmap)
- return __glXError(GLXUnsupportedPrivateRequest);
+ return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->releaseTexImage(context,
buffer, pGlxDraw);
@@ -1782,13 +1789,13 @@ int
__glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- GLXContextTag tag = req->contextTag;
- __GLXcontext *glxc = NULL;
- __GLXdrawable *pGlxDraw;
- ClientPtr client = cl->client;
- GLXDrawable drawId;
- int error;
- int x, y, width, height;
+ GLXContextTag tag = req->contextTag;
+ __GLXcontext *glxc = NULL;
+ __GLXdrawable *pGlxDraw;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId;
+ int error;
+ int x, y, width, height;
(void) client;
(void) req;
@@ -1798,44 +1805,44 @@ __glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
- x = *((INT32 *) (pc + 4));
- y = *((INT32 *) (pc + 8));
- width = *((INT32 *) (pc + 12));
- height = *((INT32 *) (pc + 16));
+ x = *((INT32 *) (pc + 4));
+ y = *((INT32 *) (pc + 8));
+ width = *((INT32 *) (pc + 12));
+ height = *((INT32 *) (pc + 16));
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXError(GLXBadContextTag);
- }
- /*
- ** The calling thread is swapping its current drawable. In this case,
- ** glxSwapBuffers is in both GL and X streams, in terms of
- ** sequentiality.
- */
- if (__glXForceCurrent(cl, tag, &error)) {
- /*
- ** Do whatever is needed to make sure that all preceding requests
- ** in both streams are completed before the swap is executed.
- */
- CALL_Finish(GET_DISPATCH(), ());
- glxc->hasUnflushedCommands = GL_FALSE;
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXError(GLXBadContextTag);
+ }
+ /*
+ ** The calling thread is swapping its current drawable. In this case,
+ ** glxSwapBuffers is in both GL and X streams, in terms of
+ ** sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the swap is executed.
+ */
+ CALL_Finish( GET_DISPATCH(), () );
+ glxc->hasUnflushedCommands = GL_FALSE;
}
else {
- return error;
- }
+ return error;
+ }
}
pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
if (!pGlxDraw)
- return error;
+ return error;
if (pGlxDraw == NULL ||
- pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
- pGlxDraw->copySubBuffer == NULL)
- return __glXError(GLXBadDrawable);
+ pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
+ pGlxDraw->copySubBuffer == NULL)
+ return __glXError(GLXBadDrawable);
- (*pGlxDraw->copySubBuffer) (pGlxDraw, x, y, width, height);
+ (*pGlxDraw->copySubBuffer)(pGlxDraw, x, y, width, height);
return Success;
}
@@ -1844,7 +1851,7 @@ __glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
** Get drawable attributes
*/
static int
-DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
+DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesReply reply;
@@ -1853,8 +1860,8 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
int numAttribs, error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
- DixGetAttrAccess, &pGlxDraw, &error))
- return error;
+ DixGetAttrAccess, &pGlxDraw, &error))
+ return error;
numAttribs = 3;
reply.length = numAttribs << 1;
@@ -1864,20 +1871,20 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
- GLX_TEXTURE_RECTANGLE_EXT;
+ GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT;
attributes[3] = GL_FALSE;
attributes[4] = GLX_EVENT_MASK;
attributes[5] = pGlxDraw->eventMask;
if (client->swapped) {
- __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
+ __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
}
else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
- (char *) &reply);
- WriteToClient(client, reply.length * sizeof(CARD32),
- (char *) attributes);
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
+ (char *)&reply);
+ WriteToClient(client, reply.length * sizeof (CARD32),
+ (char *)attributes);
}
return Success;
@@ -1887,7 +1894,7 @@ int
__glXDisp_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
/* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */
REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
@@ -1900,8 +1907,8 @@ __glXDisp_GetDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesSGIXReq *req =
- (xGLXGetDrawableAttributesSGIXReq *) pc;
-
+ (xGLXGetDrawableAttributesSGIXReq *)pc;
+
REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
return DoGetDrawableAttributes(cl, req->drawable);
@@ -1921,7 +1928,7 @@ int
__glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderReq *req;
- ClientPtr client = cl->client;
+ ClientPtr client= cl->client;
int left, cmdlen, error;
int commandsDone;
CARD16 opcode;
@@ -1934,13 +1941,13 @@ __glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
req = (xGLXRenderReq *) pc;
if (client->swapped) {
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
}
glxc = __glXForceCurrent(cl, req->contextTag, &error);
if (!glxc) {
- return error;
+ return error;
}
commandsDone = 0;
@@ -1949,41 +1956,41 @@ __glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
while (left > 0) {
__GLXrenderSizeData entry;
int extra;
- __GLXdispatchRenderProcPtr proc;
- int err;
-
- if (left < sizeof(__GLXrenderHeader))
- return BadLength;
-
- /*
- ** Verify that the header length and the overall length agree.
- ** Also, each command must be word aligned.
- */
- hdr = (__GLXrenderHeader *) pc;
- if (client->swapped) {
- __GLX_SWAP_SHORT(&hdr->length);
- __GLX_SWAP_SHORT(&hdr->opcode);
- }
- cmdlen = hdr->length;
- opcode = hdr->opcode;
-
- /*
- ** Check for core opcodes and grab entry data.
- */
- err = __glXGetProtocolSizeData(&Render_dispatch_info, opcode, &entry);
- proc = (__GLXdispatchRenderProcPtr)
- __glXGetProtocolDecodeFunction(&Render_dispatch_info,
- opcode, client->swapped);
-
- if ((err < 0) || (proc == NULL)) {
- client->errorValue = commandsDone;
- return __glXError(GLXBadRenderRequest);
- }
+ __GLXdispatchRenderProcPtr proc;
+ int err;
+
+ if (left < sizeof(__GLXrenderHeader))
+ return BadLength;
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ if (client->swapped) {
+ __GLX_SWAP_SHORT(&hdr->length);
+ __GLX_SWAP_SHORT(&hdr->opcode);
+ }
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ /*
+ ** Check for core opcodes and grab entry data.
+ */
+ err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
+ proc = (__GLXdispatchRenderProcPtr)
+ __glXGetProtocolDecodeFunction(& Render_dispatch_info,
+ opcode, client->swapped);
+
+ if ((err < 0) || (proc == NULL)) {
+ client->errorValue = commandsDone;
+ return __glXError(GLXBadRenderRequest);
+ }
if (entry.varsize) {
/* variable size command */
- extra = (*entry.varsize) (pc + __GLX_RENDER_HDR_SIZE,
- client->swapped);
+ extra = (*entry.varsize)(pc + __GLX_RENDER_HDR_SIZE,
+ client->swapped);
if (extra < 0) {
extra = 0;
}
@@ -1997,21 +2004,21 @@ __glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
return BadLength;
}
}
- if (left < cmdlen) {
- return BadLength;
- }
-
- /*
- ** Skip over the header and execute the command. We allow the
- ** caller to trash the command memory. This is useful especially
- ** for things that require double alignment - they can just shift
- ** the data towards lower memory (trashing the header) by 4 bytes
- ** and achieve the required alignment.
- */
- (*proc) (pc + __GLX_RENDER_HDR_SIZE);
- pc += cmdlen;
- left -= cmdlen;
- commandsDone++;
+ if (left < cmdlen) {
+ return BadLength;
+ }
+
+ /*
+ ** Skip over the header and execute the command. We allow the
+ ** caller to trash the command memory. This is useful especially
+ ** for things that require double alignment - they can just shift
+ ** the data towards lower memory (trashing the header) by 4 bytes
+ ** and achieve the required alignment.
+ */
+ (*proc)(pc + __GLX_RENDER_HDR_SIZE);
+ pc += cmdlen;
+ left -= cmdlen;
+ commandsDone++;
}
glxc->hasUnflushedCommands = GL_TRUE;
return Success;
@@ -2024,7 +2031,7 @@ int
__glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderLargeReq *req;
- ClientPtr client = cl->client;
+ ClientPtr client= cl->client;
size_t dataBytes;
__GLXrenderLargeHeader *hdr;
__GLXcontext *glxc;
@@ -2032,201 +2039,201 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
CARD16 opcode;
__GLX_DECLARE_SWAP_VARIABLES;
-
+
req = (xGLXRenderLargeReq *) pc;
if (client->swapped) {
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(&req->dataBytes);
- __GLX_SWAP_SHORT(&req->requestNumber);
- __GLX_SWAP_SHORT(&req->requestTotal);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->dataBytes);
+ __GLX_SWAP_SHORT(&req->requestNumber);
+ __GLX_SWAP_SHORT(&req->requestTotal);
}
glxc = __glXForceCurrent(cl, req->contextTag, &error);
if (!glxc) {
- /* Reset in case this isn't 1st request. */
- __glXResetLargeCommandStatus(cl);
- return error;
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return error;
}
dataBytes = req->dataBytes;
/*
- ** Check the request length.
- */
+ ** Check the request length.
+ */
if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
- client->errorValue = req->length;
- /* Reset in case this isn't 1st request. */
- __glXResetLargeCommandStatus(cl);
- return BadLength;
+ client->errorValue = req->length;
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return BadLength;
}
pc += sz_xGLXRenderLargeReq;
-
+
if (cl->largeCmdRequestsSoFar == 0) {
- __GLXrenderSizeData entry;
- int extra;
- size_t cmdlen;
- int err;
-
- /*
- ** This is the first request of a multi request command.
- ** Make enough space in the buffer, then copy the entire request.
- */
- if (req->requestNumber != 1) {
- client->errorValue = req->requestNumber;
- return __glXError(GLXBadLargeRequest);
- }
-
- hdr = (__GLXrenderLargeHeader *) pc;
- if (client->swapped) {
- __GLX_SWAP_INT(&hdr->length);
- __GLX_SWAP_INT(&hdr->opcode);
- }
- cmdlen = hdr->length;
- opcode = hdr->opcode;
-
- /*
- ** Check for core opcodes and grab entry data.
- */
- err = __glXGetProtocolSizeData(&Render_dispatch_info, opcode, &entry);
- if (err < 0) {
- client->errorValue = opcode;
- return __glXError(GLXBadLargeRequest);
- }
-
- if (entry.varsize) {
- /*
- ** If it's a variable-size command (a command whose length must
- ** be computed from its parameters), all the parameters needed
- ** will be in the 1st request, so it's okay to do this.
- */
- extra = (*entry.varsize) (pc + __GLX_RENDER_LARGE_HDR_SIZE,
- client->swapped);
- if (extra < 0) {
- extra = 0;
- }
- /* large command's header is 4 bytes longer, so add 4 */
- if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
- return BadLength;
- }
+ __GLXrenderSizeData entry;
+ int extra;
+ size_t cmdlen;
+ int err;
+
+ /*
+ ** This is the first request of a multi request command.
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (req->requestNumber != 1) {
+ client->errorValue = req->requestNumber;
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ hdr = (__GLXrenderLargeHeader *) pc;
+ if (client->swapped) {
+ __GLX_SWAP_INT(&hdr->length);
+ __GLX_SWAP_INT(&hdr->opcode);
+ }
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ /*
+ ** Check for core opcodes and grab entry data.
+ */
+ err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
+ if (err < 0) {
+ client->errorValue = opcode;
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ if (entry.varsize) {
+ /*
+ ** If it's a variable-size command (a command whose length must
+ ** be computed from its parameters), all the parameters needed
+ ** will be in the 1st request, so it's okay to do this.
+ */
+ extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
+ client->swapped);
+ if (extra < 0) {
+ extra = 0;
+ }
+ /* large command's header is 4 bytes longer, so add 4 */
+ if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
+ return BadLength;
+ }
}
else {
- /* constant size command */
- if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
- return BadLength;
- }
- }
- /*
- ** Make enough space in the buffer, then copy the entire request.
- */
- if (cl->largeCmdBufSize < cmdlen) {
- if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
+ /* constant size command */
+ if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
+ return BadLength;
+ }
+ }
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < cmdlen) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
}
else {
- cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
- }
- if (!cl->largeCmdBuf) {
- return BadAlloc;
- }
- cl->largeCmdBufSize = cmdlen;
- }
- memcpy(cl->largeCmdBuf, pc, dataBytes);
-
- cl->largeCmdBytesSoFar = dataBytes;
- cl->largeCmdBytesTotal = cmdlen;
- cl->largeCmdRequestsSoFar = 1;
- cl->largeCmdRequestsTotal = req->requestTotal;
- return Success;
-
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
+ }
+ if (!cl->largeCmdBuf) {
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = cmdlen;
+ }
+ memcpy(cl->largeCmdBuf, pc, dataBytes);
+
+ cl->largeCmdBytesSoFar = dataBytes;
+ cl->largeCmdBytesTotal = cmdlen;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ return Success;
+
}
else {
- /*
- ** We are receiving subsequent (i.e. not the first) requests of a
- ** multi request command.
- */
-
- /*
- ** Check the request number and the total request count.
- */
- if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
- client->errorValue = req->requestNumber;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
- if (req->requestTotal != cl->largeCmdRequestsTotal) {
- client->errorValue = req->requestTotal;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
-
- /*
- ** Check that we didn't get too much data.
- */
- if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
- client->errorValue = dataBytes;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
- memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
- cl->largeCmdBytesSoFar += dataBytes;
- cl->largeCmdRequestsSoFar++;
-
- if (req->requestNumber == cl->largeCmdRequestsTotal) {
- __GLXdispatchRenderProcPtr proc;
-
- /*
- ** This is the last request; it must have enough bytes to complete
- ** the command.
- */
- /* NOTE: the two pad macros have been added below; they are needed
- ** because the client library pads the total byte count, but not
- ** the per-request byte counts. The Protocol Encoding says the
- ** total byte count should not be padded, so a proposal will be
- ** made to the ARB to relax the padding constraint on the total
- ** byte count, thus preserving backward compatibility. Meanwhile,
- ** the padding done below fixes a bug that did not allow
- ** large commands of odd sizes to be accepted by the server.
- */
- if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
- __GLX_PAD(cl->largeCmdBytesTotal)) {
- client->errorValue = dataBytes;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
- hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
- /*
- ** The opcode and length field in the header had already been
- ** swapped when the first request was received.
- **
- ** Use the opcode to index into the procedure table.
- */
- opcode = hdr->opcode;
-
- proc = (__GLXdispatchRenderProcPtr)
- __glXGetProtocolDecodeFunction(&Render_dispatch_info, opcode,
- client->swapped);
- if (proc == NULL) {
- client->errorValue = opcode;
- return __glXError(GLXBadLargeRequest);
- }
-
- /*
- ** Skip over the header and execute the command.
- */
- (*proc) (cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
- glxc->hasUnflushedCommands = GL_TRUE;
-
- /*
- ** Reset for the next RenderLarge series.
- */
- __glXResetLargeCommandStatus(cl);
+ /*
+ ** We are receiving subsequent (i.e. not the first) requests of a
+ ** multi request command.
+ */
+
+ /*
+ ** Check the request number and the total request count.
+ */
+ if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
+ client->errorValue = req->requestNumber;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+ if (req->requestTotal != cl->largeCmdRequestsTotal) {
+ client->errorValue = req->requestTotal;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ /*
+ ** Check that we didn't get too much data.
+ */
+ if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ cl->largeCmdBytesSoFar += dataBytes;
+ cl->largeCmdRequestsSoFar++;
+
+ if (req->requestNumber == cl->largeCmdRequestsTotal) {
+ __GLXdispatchRenderProcPtr proc;
+
+ /*
+ ** This is the last request; it must have enough bytes to complete
+ ** the command.
+ */
+ /* NOTE: the two pad macros have been added below; they are needed
+ ** because the client library pads the total byte count, but not
+ ** the per-request byte counts. The Protocol Encoding says the
+ ** total byte count should not be padded, so a proposal will be
+ ** made to the ARB to relax the padding constraint on the total
+ ** byte count, thus preserving backward compatibility. Meanwhile,
+ ** the padding done below fixes a bug that did not allow
+ ** large commands of odd sizes to be accepted by the server.
+ */
+ if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
+ __GLX_PAD(cl->largeCmdBytesTotal)) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+ hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
+ /*
+ ** The opcode and length field in the header had already been
+ ** swapped when the first request was received.
+ **
+ ** Use the opcode to index into the procedure table.
+ */
+ opcode = hdr->opcode;
+
+ proc = (__GLXdispatchRenderProcPtr)
+ __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
+ client->swapped);
+ if (proc == NULL) {
+ client->errorValue = opcode;
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ /*
+ ** Skip over the header and execute the command.
+ */
+ (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
+ glxc->hasUnflushedCommands = GL_TRUE;
+
+ /*
+ ** Reset for the next RenderLarge series.
+ */
+ __glXResetLargeCommandStatus(cl);
}
else {
- /*
- ** This is neither the first nor the last request.
- */
- }
- return Success;
+ /*
+ ** This is neither the first nor the last request.
+ */
+ }
+ return Success;
}
}
@@ -2248,11 +2255,11 @@ __glXDisp_VendorPrivate(__GLXclientState * cl, GLbyte * pc)
REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
proc = (__GLXdispatchVendorPrivProcPtr)
- __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info,
- vendorcode, 0);
+ __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
+ vendorcode, 0);
if (proc != NULL) {
- (*proc) (cl, (GLbyte *) req);
- return Success;
+ (*proc)(cl, (GLbyte*)req);
+ return Success;
}
cl->client->errorValue = req->vendorCode;
@@ -2270,10 +2277,10 @@ __glXDisp_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
proc = (__GLXdispatchVendorPrivProcPtr)
- __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info,
- vendorcode, 0);
+ __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
+ vendorcode, 0);
if (proc != NULL) {
- return (*proc) (cl, (GLbyte *) req);
+ return (*proc)(cl, (GLbyte*)req);
}
cl->client->errorValue = vendorcode;
@@ -2294,7 +2301,7 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
@@ -2315,7 +2322,7 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
else {
WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
(char *) &reply);
- WriteToClient(client, (int) (length << 2), (char *) buf);
+ WriteToClient(client, (int)(length << 2), (char *)buf);
}
free(buf);
@@ -2338,24 +2345,24 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
- return err;
-
- switch (req->name) {
- case GLX_VENDOR:
- ptr = pGlxScreen->GLXvendor;
- break;
- case GLX_VERSION:
- /* Return to the server version rather than the screen version
- * to prevent confusion when they do not match.
- */
- snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
- ptr = ver_str;
- break;
- case GLX_EXTENSIONS:
- ptr = pGlxScreen->GLXextensions;
- break;
- default:
- return BadValue;
+ return err;
+
+ switch(req->name) {
+ case GLX_VENDOR:
+ ptr = pGlxScreen->GLXvendor;
+ break;
+ case GLX_VERSION:
+ /* Return to the server version rather than the screen version
+ * to prevent confusion when they do not match.
+ */
+ snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
+ ptr = ver_str;
+ break;
+ case GLX_EXTENSIONS:
+ ptr = pGlxScreen->GLXextensions;
+ break;
+ default:
+ return BadValue;
}
n = strlen(ptr) + 1;
@@ -2375,8 +2382,8 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
glxSwapQueryServerStringReply(client, &reply, buf);
}
else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
- WriteToClient(client, (int) (length << 2), buf);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
+ WriteToClient(client, (int)(length << 2), buf);
}
free(buf);
@@ -2389,12 +2396,12 @@ __glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
const char *buf;
-
+
REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
- buf = (const char *) (req + 1);
+ buf = (const char *)(req+1);
if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
- return BadLength;
+ return BadLength;
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index c69b4d258..9e8381762 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -75,6 +75,8 @@ struct __GLXDRIscreen {
const __DRIcopySubBufferExtension *copySubBuffer;
const __DRItexBufferExtension *texBuffer;
const __DRIconfig **driConfigs;
+
+ unsigned char glx_enable_bits[__GLX_EXT_BYTES];
};
struct __GLXDRIcontext {
@@ -400,12 +402,27 @@ initializeExtensions(__GLXDRIscreen * screen)
extensions = screen->core->getExtensions(screen->driScreen);
+ /* GLX_MESA_copy_sub_buffer is always enabled. */
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
+
for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_READ_DRAWABLE
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ }
+#endif
+
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
screen->copySubBuffer =
(const __DRIcopySubBufferExtension *) extensions[i];
- /* GLX_MESA_copy_sub_buffer is always enabled. */
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_copy_sub_buffer");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
}
#endif
@@ -413,6 +430,8 @@ initializeExtensions(__GLXDRIscreen * screen)
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
/* GLX_EXT_texture_from_pixmap is always enabled. */
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_EXT_texture_from_pixmapo\n");
}
#endif
/* Ignore unknown extensions */
@@ -424,6 +443,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
{
const char *driverName = "swrast";
__GLXDRIscreen *screen;
+ size_t buffer_size;
screen = calloc(1, sizeof *screen);
if (screen == NULL)
@@ -435,6 +455,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->base.swapInterval = NULL;
screen->base.pScreen = pScreen;
+ __glXInitExtensionEnableBits(screen->glx_enable_bits);
+
screen->driver = glxProbeDriver(driverName,
(void **) &screen->core,
__DRI_CORE, __DRI_CORE_VERSION,
@@ -463,6 +485,19 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__glXScreenInit(&screen->base, pScreen);
+ /* The first call simply determines the length of the extension string.
+ * This allows us to allocate some memory to hold the extension string,
+ * but it requires that we call __glXGetExtensionString a second time.
+ */
+ buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ if (buffer_size > 0) {
+ free(screen->base.GLXextensions);
+
+ screen->base.GLXextensions = xnfalloc(buffer_size);
+ (void) __glXGetExtensionString(screen->glx_enable_bits,
+ screen->base.GLXextensions);
+ }
+
screen->base.GLXmajor = 1;
screen->base.GLXminor = 4;
diff --git a/glx/glxext.c b/glx/glxext.c
index acd696ef0..7ccd4ff33 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -103,7 +103,7 @@ ContextGone(__GLXcontext * cx, XID id)
{
cx->idExists = GL_FALSE;
if (!cx->isCurrent) {
- __glXFreeContext(cx);
+ __glXFreeContext(cx);
}
return True;
@@ -135,22 +135,24 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
}
for (c = glxAllContexts; c; c = next) {
- next = c->next;
- if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
- (*c->loseCurrent) (c);
- c->isCurrent = GL_FALSE;
- if (c == __glXLastContext)
- __glXFlushContextCache();
- }
- if (c->drawPriv == glxPriv)
- c->drawPriv = NULL;
- if (c->readPriv == glxPriv)
- c->readPriv = NULL;
+ next = c->next;
+ if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+ FlushContext(c);
+
+ (*c->loseCurrent)(c);
+ c->isCurrent = GL_FALSE;
+ if (c == __glXLastContext)
+ __glXFlushContextCache();
+ }
+ if (c->drawPriv == glxPriv)
+ c->drawPriv = NULL;
+ if (c->readPriv == glxPriv)
+ c->readPriv = NULL;
}
/* drop our reference to any backing pixmap */
if (glxPriv->type == GLX_DRAWABLE_PIXMAP)
- glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr) glxPriv->pDraw);
+ glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->pDraw);
glxPriv->destroy(glxPriv);
@@ -170,14 +172,14 @@ __glXRemoveFromContextList(__GLXcontext * cx)
__GLXcontext *c, *prev;
if (cx == glxAllContexts)
- glxAllContexts = cx->next;
+ glxAllContexts = cx->next;
else {
- prev = glxAllContexts;
- for (c = glxAllContexts; c; c = c->next) {
- if (c == cx)
- prev->next = c->next;
- prev = c;
- }
+ prev = glxAllContexts;
+ for (c = glxAllContexts; c; c = c->next) {
+ if (c == cx)
+ prev->next = c->next;
+ prev = c;
+ }
}
}
@@ -189,11 +191,11 @@ __glXFreeContext(__GLXcontext * cx)
{
if (cx->idExists || cx->isCurrent)
return GL_FALSE;
-
+
free(cx->feedbackBuf);
free(cx->selectBuf);
if (cx == __glXLastContext) {
- __glXFlushContextCache();
+ __glXFlushContextCache();
}
__glXRemoveFromContextList(cx);
@@ -203,13 +205,13 @@ __glXFreeContext(__GLXcontext * cx)
* the latter case we need to lift the DRI lock manually. */
if (!glxBlockClients) {
- __glXleaveServer(GL_FALSE);
- cx->destroy(cx);
- __glXenterServer(GL_FALSE);
+ __glXleaveServer(GL_FALSE);
+ cx->destroy(cx);
+ __glXenterServer(GL_FALSE);
}
else {
- cx->next = glxPendingDestroyContexts;
- glxPendingDestroyContexts = cx;
+ cx->next = glxPendingDestroyContexts;
+ glxPendingDestroyContexts = cx;
}
return GL_TRUE;
@@ -271,29 +273,29 @@ glxGetClient(ClientPtr pClient)
static void
glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- __GLXclientState *cl = glxGetClient(pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ __GLXclientState *cl = glxGetClient(pClient);
switch (pClient->clientState) {
case ClientStateRunning:
- /*
- ** By default, assume that the client supports
- ** GLX major version 1 minor version 0 protocol.
- */
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
- cl->client = pClient;
- break;
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ cl->client = pClient;
+ break;
case ClientStateGone:
- free(cl->returnBuf);
- free(cl->largeCmdBuf);
- free(cl->GLClientextensions);
- break;
+ free(cl->returnBuf);
+ free(cl->largeCmdBuf);
+ free(cl->GLClientextensions);
+ break;
default:
- break;
+ break;
}
}
@@ -320,61 +322,61 @@ GlxExtensionInit(void)
__GLXprovider *p;
Bool glx_provided = False;
- __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
- "GLXContext");
- __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
- "GLXDrawable");
+ __glXContextRes = CreateNewResourceType((DeleteType)ContextGone,
+ "GLXContext");
+ __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone,
+ "GLXDrawable");
if (!__glXContextRes || !__glXDrawableRes)
- return;
+ return;
if (!dixRegisterPrivateKey
(&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(__GLXclientState)))
- return;
- if (!AddCallback(&ClientStateCallback, glxClientCallback, 0))
- return;
+ return;
+ if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
+ return;
for (i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
-
- for (p = __glXProviderStack; p != NULL; p = p->next) {
- __GLXscreen *glxScreen;
-
- glxScreen = p->screenProbe(pScreen);
- if (glxScreen != NULL) {
- if (glxScreen->GLXminor < glxMinorVersion)
- glxMinorVersion = glxScreen->GLXminor;
- LogMessage(X_INFO,
- "GLX: Initialized %s GL provider for screen %d\n",
- p->name, i);
- break;
- }
-
- }
-
- if (!p)
- LogMessage(X_INFO,
- "GLX: no usable GL providers found for screen %d\n", i);
- else
- glx_provided = True;
+ pScreen = screenInfo.screens[i];
+
+ for (p = __glXProviderStack; p != NULL; p = p->next) {
+ __GLXscreen *glxScreen;
+
+ glxScreen = p->screenProbe(pScreen);
+ if (glxScreen != NULL) {
+ if (glxScreen->GLXminor < glxMinorVersion)
+ glxMinorVersion = glxScreen->GLXminor;
+ LogMessage(X_INFO,
+ "GLX: Initialized %s GL provider for screen %d\n",
+ p->name, i);
+ break;
+ }
+
+ }
+
+ if (!p)
+ LogMessage(X_INFO,
+ "GLX: no usable GL providers found for screen %d\n", i);
+ else
+ glx_provided = True;
}
/* don't register extension if GL is not provided on any screen */
if (!glx_provided)
- return;
+ return;
/*
- ** Add extension to server extensions.
- */
+ ** Add extension to server extensions.
+ */
extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
- __GLX_NUMBER_ERRORS, __glXDispatch,
+ __GLX_NUMBER_ERRORS, __glXDispatch,
__glXDispatch, ResetExtension, StandardMinorOpcode);
if (!extEntry) {
- FatalError("__glXExtensionInit: AddExtensions failed\n");
- return;
+ FatalError("__glXExtensionInit: AddExtensions failed\n");
+ return;
}
if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
- ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
- return;
+ ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+ return;
}
__glXErrorBase = extEntry->errorBase;
@@ -401,44 +403,44 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
__GLXcontext *cx;
/*
- ** See if the context tag is legal; it is managed by the extension,
- ** so if it's invalid, we have an implementation error.
- */
+ ** See if the context tag is legal; it is managed by the extension,
+ ** so if it's invalid, we have an implementation error.
+ */
cx = __glXLookupContextByTag(cl, tag);
if (!cx) {
- cl->client->errorValue = tag;
- *error = __glXError(GLXBadContextTag);
- return 0;
+ cl->client->errorValue = tag;
+ *error = __glXError(GLXBadContextTag);
+ return 0;
}
if (!cx->isDirect) {
- if (cx->drawPriv == NULL) {
- /*
- ** The drawable has vanished. It must be a window, because only
- ** windows can be destroyed from under us; GLX pixmaps are
- ** refcounted and don't go away until no one is using them.
- */
- *error = __glXError(GLXBadCurrentWindow);
- return 0;
- }
+ if (cx->drawPriv == NULL) {
+ /*
+ ** The drawable has vanished. It must be a window, because only
+ ** windows can be destroyed from under us; GLX pixmaps are
+ ** refcounted and don't go away until no one is using them.
+ */
+ *error = __glXError(GLXBadCurrentWindow);
+ return 0;
+ }
}
-
- if (cx->wait && (*cx->wait) (cx, cl, error))
- return NULL;
+
+ if (cx->wait && (*cx->wait)(cx, cl, error))
+ return NULL;
if (cx == __glXLastContext) {
- /* No need to re-bind */
- return cx;
+ /* No need to re-bind */
+ return cx;
}
/* Make this context the current one for the GL. */
if (!cx->isDirect) {
- if (!(*cx->makeCurrent) (cx)) {
- /* Bind failed, and set the error code. Bummer */
- cl->client->errorValue = cx->id;
- *error = __glXError(GLXBadContextState);
- return 0;
- }
+ if (!(*cx->makeCurrent)(cx)) {
+ /* Bind failed, and set the error code. Bummer */
+ cl->client->errorValue = cx->id;
+ *error = __glXError(GLXBadContextState);
+ return 0;
+ }
}
__glXLastContext = cx;
return cx;
@@ -452,8 +454,8 @@ glxSuspendClients(void)
int i;
for (i = 1; i < currentMaxClients; i++) {
- if (clients[i] && glxGetClient(clients[i])->inUse)
- IgnoreClient(clients[i]);
+ if (clients[i] && glxGetClient(clients[i])->inUse)
+ IgnoreClient(clients[i]);
}
glxBlockClients = TRUE;
@@ -468,15 +470,15 @@ glxResumeClients(void)
glxBlockClients = FALSE;
for (i = 1; i < currentMaxClients; i++) {
- if (clients[i] && glxGetClient(clients[i])->inUse)
- AttendClient(clients[i]);
+ if (clients[i] && glxGetClient(clients[i])->inUse)
+ AttendClient(clients[i]);
}
__glXleaveServer(GL_FALSE);
for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
- next = cx->next;
+ next = cx->next;
- cx->destroy(cx);
+ cx->destroy(cx);
}
glxPendingDestroyContexts = NULL;
__glXenterServer(GL_FALSE);
@@ -486,39 +488,39 @@ static void
__glXnopEnterServer(GLboolean rendering)
{
}
-
+
static void
__glXnopLeaveServer(GLboolean rendering)
{
}
-static void (*__glXenterServerFunc) (GLboolean) = __glXnopEnterServer;
-static void (*__glXleaveServerFunc) (GLboolean) = __glXnopLeaveServer;
+static void (*__glXenterServerFunc)(GLboolean) = __glXnopEnterServer;
+static void (*__glXleaveServerFunc)(GLboolean) = __glXnopLeaveServer;
void
__glXsetEnterLeaveServerFuncs(void (*enter) (GLboolean),
- void (*leave) (GLboolean))
+ void (*leave)(GLboolean))
{
- __glXenterServerFunc = enter;
- __glXleaveServerFunc = leave;
+ __glXenterServerFunc = enter;
+ __glXleaveServerFunc = leave;
}
void
__glXenterServer(GLboolean rendering)
{
- glxServerLeaveCount--;
+ glxServerLeaveCount--;
- if (glxServerLeaveCount == 0)
- (*__glXenterServerFunc) (rendering);
+ if (glxServerLeaveCount == 0)
+ (*__glXenterServerFunc)(rendering);
}
void
__glXleaveServer(GLboolean rendering)
{
- if (glxServerLeaveCount == 0)
- (*__glXleaveServerFunc) (rendering);
+ if (glxServerLeaveCount == 0)
+ (*__glXleaveServerFunc)(rendering);
- glxServerLeaveCount++;
+ glxServerLeaveCount++;
}
/*
@@ -539,38 +541,38 @@ __glXDispatch(ClientPtr client)
cl->inUse = TRUE;
/*
- ** If we're expecting a glXRenderLarge request, this better be one.
- */
+ ** If we're expecting a glXRenderLarge request, this better be one.
+ */
if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
- client->errorValue = stuff->glxCode;
- return __glXError(GLXBadLargeRequest);
+ client->errorValue = stuff->glxCode;
+ return __glXError(GLXBadLargeRequest);
}
/* If we're currently blocking GLX clients, just put this guy to
* sleep, reset the request and return. */
if (glxBlockClients) {
- ResetCurrentRequest(client);
- client->sequence--;
- IgnoreClient(client);
- return Success;
+ ResetCurrentRequest(client);
+ client->sequence--;
+ IgnoreClient(client);
+ return Success;
}
/*
- ** Use the opcode to index into the procedure table.
- */
- proc = __glXGetProtocolDecodeFunction(&Single_dispatch_info, opcode,
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXGetProtocolDecodeFunction(& Single_dispatch_info, opcode,
client->swapped);
if (proc != NULL) {
- GLboolean rendering = opcode <= X_GLXRenderLarge;
+ GLboolean rendering = opcode <= X_GLXRenderLarge;
- __glXleaveServer(rendering);
+ __glXleaveServer(rendering);
- retval = (*proc) (cl, (GLbyte *) stuff);
+ retval = (*proc)(cl, (GLbyte *) stuff);
- __glXenterServer(rendering);
+ __glXenterServer(rendering);
}
else {
- retval = BadRequest;
+ retval = BadRequest;
}
return retval;
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 74b4c421b..12672cbd1 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -163,18 +163,6 @@ static const char GLServerExtensions[] =
static char GLXServerVendorName[] = "SGI";
unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION;
unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION;
-static char GLXServerExtensions[] =
- "GLX_ARB_multisample "
- "GLX_EXT_visual_info "
- "GLX_EXT_visual_rating "
- "GLX_EXT_import_context "
- "GLX_EXT_texture_from_pixmap "
- "GLX_OML_swap_method " "GLX_SGI_make_current_read "
-#ifndef __APPLE__
- "GLX_SGIS_multisample "
-#endif
- "GLX_SGIX_fbconfig "
- "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer " "GLX_INTEL_swap_event";
static Bool
glxCloseScreen(int index, ScreenPtr pScreen)
@@ -328,7 +316,7 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
pGlxScreen->pScreen = pScreen;
pGlxScreen->GLextensions = strdup(GLServerExtensions);
pGlxScreen->GLXvendor = strdup(GLXServerVendorName);
- pGlxScreen->GLXextensions = strdup(GLXServerExtensions);
+ pGlxScreen->GLXextensions = strdup("");
/* All GLX providers must support all of the functionality required for at
* least GLX 1.2. If the provider supports a higher version, the GLXminor
diff --git a/glx/rensize.c b/glx/rensize.c
index bcc3a53ad..aec63ac02 100644
--- a/glx/rensize.c
+++ b/glx/rensize.c
@@ -57,14 +57,14 @@ __glXMap1dReqSize(const GLbyte * pc, Bool swap)
GLenum target;
GLint order, k;
- target = *(GLenum *) (pc + 16);
- order = *(GLint *) (pc + 20);
+ target = *(GLenum*) (pc + 16);
+ order = *(GLint*) (pc + 20);
if (swap) {
- target = SWAPL(target);
- order = SWAPL(order);
+ target = SWAPL( target );
+ order = SWAPL( order );
}
- k = __glMap1d_size(target);
- return 8 * Map1Size(k, order);
+ k = __glMap1d_size( target );
+ return 8 * Map1Size( k, order );
}
int
@@ -73,11 +73,11 @@ __glXMap1fReqSize(const GLbyte * pc, Bool swap)
GLenum target;
GLint order, k;
- target = *(GLenum *) (pc + 0);
- order = *(GLint *) (pc + 12);
+ target = *(GLenum *)(pc + 0);
+ order = *(GLint *)(pc + 12);
if (swap) {
- target = SWAPL(target);
- order = SWAPL(order);
+ target = SWAPL( target );
+ order = SWAPL( order );
}
k = __glMap1f_size(target);
return 4 * Map1Size(k, order);
@@ -97,16 +97,16 @@ __glXMap2dReqSize(const GLbyte * pc, Bool swap)
GLenum target;
GLint uorder, vorder, k;
- target = *(GLenum *) (pc + 32);
- uorder = *(GLint *) (pc + 36);
- vorder = *(GLint *) (pc + 40);
+ target = *(GLenum *)(pc + 32);
+ uorder = *(GLint *)(pc + 36);
+ vorder = *(GLint *)(pc + 40);
if (swap) {
- target = SWAPL(target);
- uorder = SWAPL(uorder);
- vorder = SWAPL(vorder);
+ target = SWAPL( target );
+ uorder = SWAPL( uorder );
+ vorder = SWAPL( vorder );
}
- k = __glMap2d_size(target);
- return 8 * Map2Size(k, uorder, vorder);
+ k = __glMap2d_size( target );
+ return 8 * Map2Size( k, uorder, vorder );
}
int
@@ -115,16 +115,16 @@ __glXMap2fReqSize(const GLbyte * pc, Bool swap)
GLenum target;
GLint uorder, vorder, k;
- target = *(GLenum *) (pc + 0);
- uorder = *(GLint *) (pc + 12);
- vorder = *(GLint *) (pc + 24);
+ target = *(GLenum *)(pc + 0);
+ uorder = *(GLint *)(pc + 12);
+ vorder = *(GLint *)(pc + 24);
if (swap) {
- target = SWAPL(target);
- uorder = SWAPL(uorder);
- vorder = SWAPL(vorder);
+ target = SWAPL( target );
+ uorder = SWAPL( uorder );
+ vorder = SWAPL( vorder );
}
- k = __glMap2f_size(target);
- return 4 * Map2Size(k, uorder, vorder);
+ k = __glMap2f_size( target );
+ return 4 * Map2Size( k, uorder, vorder );
}
/**
@@ -168,22 +168,22 @@ __glXMap2fReqSize(const GLbyte * pc, Bool swap)
*/
int
__glXImageSize(GLenum format, GLenum type, GLenum target,
- GLsizei w, GLsizei h, GLsizei d,
- GLint imageHeight, GLint rowLength,
- GLint skipImages, GLint skipRows, GLint alignment)
+ GLsizei w, GLsizei h, GLsizei d,
+ GLint imageHeight, GLint rowLength,
+ GLint skipImages, GLint skipRows, GLint alignment )
{
GLint bytesPerElement, elementsPerGroup, groupsPerRow;
GLint groupSize, rowSize, padding, imageSize;
if (w < 0 || h < 0 || d < 0 ||
- (type == GL_BITMAP &&
- (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) {
- return -1;
+ (type == GL_BITMAP &&
+ (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) {
+ return -1;
}
if (w == 0 || h == 0 || d == 0)
return 0;
- switch (target) {
+ switch( target ) {
case GL_PROXY_TEXTURE_1D:
case GL_PROXY_TEXTURE_2D:
case GL_PROXY_TEXTURE_3D:
@@ -196,122 +196,123 @@ __glXImageSize(GLenum format, GLenum type, GLenum target,
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
- return 0;
+ return 0;
}
if (type == GL_BITMAP) {
- if (rowLength > 0) {
- groupsPerRow = rowLength;
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
}
else {
- groupsPerRow = w;
- }
- rowSize = bits_to_bytes(groupsPerRow);
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- return ((h + skipRows) * rowSize);
+ groupsPerRow = w;
+ }
+ rowSize = bits_to_bytes(groupsPerRow);
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ return ((h + skipRows) * rowSize);
}
else {
- switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_INTENSITY:
- elementsPerGroup = 1;
- break;
- case GL_422_EXT:
- case GL_422_REV_EXT:
- case GL_422_AVERAGE_EXT:
- case GL_422_REV_AVERAGE_EXT:
- case GL_DEPTH_STENCIL_NV:
- case GL_DEPTH_STENCIL_MESA:
- case GL_YCBCR_MESA:
- case GL_LUMINANCE_ALPHA:
- elementsPerGroup = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- elementsPerGroup = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- elementsPerGroup = 4;
- break;
- default:
- return -1;
- }
- switch (type) {
- case GL_UNSIGNED_BYTE:
- case GL_BYTE:
- bytesPerElement = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- bytesPerElement = 1;
- elementsPerGroup = 1;
- break;
- case GL_UNSIGNED_SHORT:
- case GL_SHORT:
- bytesPerElement = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- case GL_UNSIGNED_SHORT_8_8_APPLE:
- case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
- case GL_UNSIGNED_SHORT_15_1_MESA:
- case GL_UNSIGNED_SHORT_1_15_REV_MESA:
- bytesPerElement = 2;
- elementsPerGroup = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- bytesPerElement = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_24_8_NV:
- case GL_UNSIGNED_INT_24_8_MESA:
- case GL_UNSIGNED_INT_8_24_REV_MESA:
- bytesPerElement = 4;
- elementsPerGroup = 1;
- break;
- default:
- return -1;
- }
- groupSize = bytesPerElement * elementsPerGroup;
- if (rowLength > 0) {
- groupsPerRow = rowLength;
+ switch(format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_INTENSITY:
+ elementsPerGroup = 1;
+ break;
+ case GL_422_EXT:
+ case GL_422_REV_EXT:
+ case GL_422_AVERAGE_EXT:
+ case GL_422_REV_AVERAGE_EXT:
+ case GL_DEPTH_STENCIL_NV:
+ case GL_DEPTH_STENCIL_MESA:
+ case GL_YCBCR_422_APPLE:
+ case GL_YCBCR_MESA:
+ case GL_LUMINANCE_ALPHA:
+ elementsPerGroup = 2;
+ break;
+ case GL_RGB:
+ case GL_BGR:
+ elementsPerGroup = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ elementsPerGroup = 4;
+ break;
+ default:
+ return -1;
+ }
+ switch(type) {
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ bytesPerElement = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ bytesPerElement = 1;
+ elementsPerGroup = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ bytesPerElement = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+ case GL_UNSIGNED_SHORT_15_1_MESA:
+ case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+ bytesPerElement = 2;
+ elementsPerGroup = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ bytesPerElement = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_24_8_NV:
+ case GL_UNSIGNED_INT_24_8_MESA:
+ case GL_UNSIGNED_INT_8_24_REV_MESA:
+ bytesPerElement = 4;
+ elementsPerGroup = 1;
+ break;
+ default:
+ return -1;
+ }
+ groupSize = bytesPerElement * elementsPerGroup;
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
}
else {
- groupsPerRow = w;
- }
- rowSize = groupsPerRow * groupSize;
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- if (imageHeight > 0) {
- imageSize = (imageHeight + skipRows) * rowSize;
+ groupsPerRow = w;
+ }
+ rowSize = groupsPerRow * groupSize;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ if (imageHeight > 0) {
+ imageSize = (imageHeight + skipRows) * rowSize;
}
else {
- imageSize = (h + skipRows) * rowSize;
- }
- return ((d + skipImages) * imageSize);
+ imageSize = (h + skipRows) * rowSize;
+ }
+ return ((d + skipImages) * imageSize);
}
}
@@ -319,7 +320,7 @@ __glXImageSize(GLenum format, GLenum type, GLenum target,
int
__glXTypeSize(GLenum enm)
{
- switch (enm) {
+ switch(enm) {
case GL_BYTE:
return sizeof(GLbyte);
case GL_UNSIGNED_BYTE:
@@ -338,7 +339,7 @@ __glXTypeSize(GLenum enm)
return sizeof(GLdouble);
default:
return -1;
- }
+ }
}
int
@@ -352,68 +353,68 @@ __glXDrawArraysReqSize(const GLbyte * pc, Bool swap)
int i;
if (swap) {
- numVertexes = SWAPL(numVertexes);
- numComponents = SWAPL(numComponents);
+ numVertexes = SWAPL( numVertexes );
+ numComponents = SWAPL( numComponents );
}
pc += sizeof(__GLXdispatchDrawArraysHeader);
compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
- for (i = 0; i < numComponents; i++) {
- GLenum datatype = compHeader[i].datatype;
- GLint numVals = compHeader[i].numVals;
- GLint component = compHeader[i].component;
-
- if (swap) {
- datatype = SWAPL(datatype);
- numVals = SWAPL(numVals);
- component = SWAPL(component);
- }
-
- switch (component) {
- case GL_VERTEX_ARRAY:
- case GL_COLOR_ARRAY:
- case GL_TEXTURE_COORD_ARRAY:
- break;
- case GL_SECONDARY_COLOR_ARRAY:
- case GL_NORMAL_ARRAY:
- if (numVals != 3) {
- /* bad size */
- return -1;
- }
- break;
- case GL_FOG_COORD_ARRAY:
- case GL_INDEX_ARRAY:
- if (numVals != 1) {
- /* bad size */
- return -1;
- }
- break;
- case GL_EDGE_FLAG_ARRAY:
- if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) {
- /* bad size or bad type */
- return -1;
- }
- break;
- default:
- /* unknown component type */
- return -1;
- }
-
- arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype));
-
- pc += sizeof(__GLXdispatchDrawArraysComponentHeader);
+ for (i=0; i<numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLint component = compHeader[i].component;
+
+ if (swap) {
+ datatype = SWAPL( datatype );
+ numVals = SWAPL( numVals );
+ component = SWAPL( component );
+ }
+
+ switch (component) {
+ case GL_VERTEX_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ break;
+ case GL_SECONDARY_COLOR_ARRAY:
+ case GL_NORMAL_ARRAY:
+ if (numVals != 3) {
+ /* bad size */
+ return -1;
+ }
+ break;
+ case GL_FOG_COORD_ARRAY:
+ case GL_INDEX_ARRAY:
+ if (numVals != 1) {
+ /* bad size */
+ return -1;
+ }
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) {
+ /* bad size or bad type */
+ return -1;
+ }
+ break;
+ default:
+ /* unknown component type */
+ return -1;
+ }
+
+ arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype));
+
+ pc += sizeof(__GLXdispatchDrawArraysComponentHeader);
}
return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) +
- (numVertexes * arrayElementSize));
+ (numVertexes * arrayElementSize));
}
int
__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap)
{
__GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
+ (__GLXdispatchConvolutionFilterHeader *) pc;
GLint image1size, image2size;
GLenum format = hdr->format;
@@ -424,20 +425,20 @@ __glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap)
GLint alignment = hdr->alignment;
if (swap) {
- format = SWAPL(format);
- type = SWAPL(type);
- w = SWAPL(w);
- h = SWAPL(h);
- rowLength = SWAPL(rowLength);
- alignment = SWAPL(alignment);
+ format = SWAPL( format );
+ type = SWAPL( type );
+ w = SWAPL( w );
+ h = SWAPL( h );
+ rowLength = SWAPL( rowLength );
+ alignment = SWAPL( alignment );
}
/* XXX Should rowLength be used for either or both image? */
- image1size = __glXImageSize(format, type, 0, w, 1, 1,
- 0, rowLength, 0, 0, alignment);
+ image1size = __glXImageSize( format, type, 0, w, 1, 1,
+ 0, rowLength, 0, 0, alignment );
image1size = __GLX_PAD(image1size);
- image2size = __glXImageSize(format, type, 0, h, 1, 1,
- 0, rowLength, 0, 0, alignment);
+ image2size = __glXImageSize( format, type, 0, h, 1, 1,
+ 0, rowLength, 0, 0, alignment );
return image1size + image2size;
}
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 09e3d74ea..6f9fcc749 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -55,8 +55,8 @@
#include "dmxstat.h"
#include "dmxpict.h"
-#include <X11/Xos.h> /* For gettimeofday */
-#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
+#include <X11/Xos.h> /* For gettimeofday */
+#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
#include "dixstruct.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
@@ -70,47 +70,47 @@
#include "dmx_glxvisuals.h"
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
-#endif /* GLXEXT */
+#endif /* GLXEXT */
/* Global variables available to all Xserver/hw/dmx routines. */
-int dmxNumScreens;
-DMXScreenInfo *dmxScreens;
+int dmxNumScreens;
+DMXScreenInfo *dmxScreens;
-int dmxNumInputs;
-DMXInputInfo *dmxInputs;
+int dmxNumInputs;
+DMXInputInfo *dmxInputs;
-int dmxShadowFB = FALSE;
+int dmxShadowFB = FALSE;
-XErrorEvent dmxLastErrorEvent;
-Bool dmxErrorOccurred = FALSE;
+XErrorEvent dmxLastErrorEvent;
+Bool dmxErrorOccurred = FALSE;
-char *dmxFontPath = NULL;
+char *dmxFontPath = NULL;
-Bool dmxOffScreenOpt = TRUE;
+Bool dmxOffScreenOpt = TRUE;
-Bool dmxSubdividePrimitives = TRUE;
+Bool dmxSubdividePrimitives = TRUE;
-Bool dmxLazyWindowCreation = TRUE;
+Bool dmxLazyWindowCreation = TRUE;
-Bool dmxUseXKB = TRUE;
+Bool dmxUseXKB = TRUE;
-int dmxDepth = 0;
+int dmxDepth = 0;
#ifndef GLXEXT
-static Bool dmxGLXProxy = FALSE;
+static Bool dmxGLXProxy = FALSE;
#else
-Bool dmxGLXProxy = TRUE;
+Bool dmxGLXProxy = TRUE;
-Bool dmxGLXSwapGroupSupport = TRUE;
+Bool dmxGLXSwapGroupSupport = TRUE;
-Bool dmxGLXSyncSwap = FALSE;
+Bool dmxGLXSyncSwap = FALSE;
-Bool dmxGLXFinishSwap = FALSE;
+Bool dmxGLXFinishSwap = FALSE;
#endif
-Bool dmxIgnoreBadFontPaths = FALSE;
+Bool dmxIgnoreBadFontPaths = FALSE;
-Bool dmxAddRemoveScreens = FALSE;
+Bool dmxAddRemoveScreens = FALSE;
/* dmxErrorHandler catches errors that occur when calling one of the
* back-end servers. Some of this code is based on _XPrintDefaultError
@@ -119,19 +119,19 @@ static int
dmxErrorHandler(Display * dpy, XErrorEvent * ev)
{
#define DMX_ERROR_BUF_SIZE 256
- /* RATS: these buffers are only used in
- * length-limited calls. */
- char buf[DMX_ERROR_BUF_SIZE];
- char request[DMX_ERROR_BUF_SIZE];
+ /* RATS: these buffers are only used in
+ * length-limited calls. */
+ char buf[DMX_ERROR_BUF_SIZE];
+ char request[DMX_ERROR_BUF_SIZE];
_XExtension *ext = NULL;
- dmxErrorOccurred = TRUE;
+ dmxErrorOccurred = TRUE;
dmxLastErrorEvent = *ev;
XGetErrorText(dpy, ev->error_code, buf, sizeof(buf));
dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf);
- /* Find major opcode name */
+ /* Find major opcode name */
if (ev->request_code < 128) {
snprintf(request, sizeof(request), "%d", ev->request_code);
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
@@ -148,7 +148,7 @@ dmxErrorHandler(Display * dpy, XErrorEvent * ev)
dmxLog(dmxWarning, " Major opcode: %d (%s)\n",
ev->request_code, buf);
- /* Find minor opcode name */
+ /* Find minor opcode name */
if (ev->request_code >= 128 && ext) {
snprintf(request, sizeof(request), "%d", ev->request_code);
snprintf(request, sizeof(request), "%s.%d", ext->name, ev->minor_code);
@@ -157,7 +157,7 @@ dmxErrorHandler(Display * dpy, XErrorEvent * ev)
ev->minor_code, buf);
}
- /* Provide value information */
+ /* Provide value information */
switch (ev->error_code) {
case BadValue:
dmxLog(dmxWarning, " Value: 0x%x\n",
@@ -173,7 +173,7 @@ dmxErrorHandler(Display * dpy, XErrorEvent * ev)
break;
}
- /* Provide serial number information */
+ /* Provide serial number information */
dmxLog(dmxWarning, " Failed serial number: %d\n",
ev->serial);
dmxLog(dmxWarning, " Current serial number: %d\n",
@@ -193,7 +193,7 @@ Bool
dmxOpenDisplay(DMXScreenInfo * dmxScreen)
{
if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name)))
- return FALSE;
+ return FALSE;
dmxPropertyDisplay(dmxScreen);
return TRUE;
@@ -209,16 +209,16 @@ static void
dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
{
XWindowAttributes attribs;
- int ndepths = 0, *depths = NULL;
- int i;
- Display *dpy = dmxScreen->beDisplay;
- Screen *s = DefaultScreenOfDisplay(dpy);
- int scr = DefaultScreen(dpy);
+ int ndepths = 0, *depths = NULL;
+ int i;
+ Display *dpy = dmxScreen->beDisplay;
+ Screen *s = DefaultScreenOfDisplay(dpy);
+ int scr = DefaultScreen(dpy);
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
if (!(depths = XListDepths(dpy, scr, &ndepths)))
ndepths = 0;
-
+
dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy));
dmxLogOutput(dmxScreen, "Version number: %d.%d\n",
ProtocolVersion(dpy), ProtocolRevision(dpy));
@@ -227,8 +227,8 @@ dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy));
}
else {
- /* This code based on xdpyinfo.c */
- int v = VendorRelease(dpy);
+ /* This code based on xdpyinfo.c */
+ int v = VendorRelease(dpy);
int major = -1, minor = -1, patch = -1, subpatch = -1;
if (v < 336)
@@ -254,7 +254,7 @@ dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
patch = (v / 1000) % 100;
if (v % 1000)
subpatch = v % 1000;
- }
+ }
dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d",
v, major, minor);
if (patch > 0)
@@ -264,7 +264,7 @@ dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
dmxLogOutputCont(dmxScreen, ")\n");
}
- dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
+ dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
attribs.width, attribs.height);
dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr);
for (i = 0; i < ndepths; i++)
@@ -276,16 +276,16 @@ dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n",
MinCmapsOfScreen(s), MaxCmapsOfScreen(s));
dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n",
- (DoesBackingStore(s) == NotUseful) ? "no" :
- ((DoesBackingStore(s) == Always) ? "yes" : "when mapped"),
- DoesSaveUnders(s) ? "yes" : "no");
+ (DoesBackingStore (s) == NotUseful) ? "no" :
+ ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"),
+ DoesSaveUnders (s) ? "yes" : "no");
dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
- (dmxScreen->WMRunningOnBE) ? "yes" : "no");
+ (dmxScreen->WMRunningOnBE) ? "yes" : "no");
if (dmxScreen->WMRunningOnBE) {
- dmxLogOutputWarning(dmxScreen,
- "Window manager running "
- "-- colormaps not supported\n");
+ dmxLogOutputWarning(dmxScreen,
+ "Window manager running "
+ "-- colormaps not supported\n");
}
XFree(depths);
}
@@ -294,40 +294,40 @@ void
dmxGetScreenAttribs(DMXScreenInfo * dmxScreen)
{
XWindowAttributes attribs;
- Display *dpy = dmxScreen->beDisplay;
+ Display *dpy = dmxScreen->beDisplay;
#ifdef GLXEXT
- int dummy;
+ int dummy;
#endif
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
- dmxScreen->beWidth = attribs.width;
+ dmxScreen->beWidth = attribs.width;
dmxScreen->beHeight = attribs.height;
-
- /* Fill in missing geometry information */
+
+ /* Fill in missing geometry information */
if (dmxScreen->scrnXSign < 0) {
if (dmxScreen->scrnWidth) {
- dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
- - dmxScreen->scrnX);
+ dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
+ - dmxScreen->scrnX);
}
else {
- dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
- dmxScreen->scrnX = 0;
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnX = 0;
}
}
if (dmxScreen->scrnYSign < 0) {
if (dmxScreen->scrnHeight) {
- dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
- - dmxScreen->scrnY);
+ dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
+ - dmxScreen->scrnY);
}
else {
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
- dmxScreen->scrnY = 0;
+ dmxScreen->scrnY = 0;
}
}
if (!dmxScreen->scrnWidth)
- dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
if (!dmxScreen->scrnHeight)
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
@@ -344,13 +344,13 @@ dmxGetScreenAttribs(DMXScreenInfo * dmxScreen)
dmxScreen->beXDPI = 75;
dmxScreen->beYDPI = 75;
- dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
- * works always. In
- * particular, this will work
- * well for depth=16, will fail
- * because of colormap issues
- * at depth 8. More work needs
- * to be done here. */
+ dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
+ * works always. In
+ * particular, this will work
+ * well for depth=16, will fail
+ * because of colormap issues
+ * at depth 8. More work needs
+ * to be done here. */
if (dmxScreen->beDepth <= 8)
dmxScreen->beBPP = 8;
@@ -362,7 +362,7 @@ dmxGetScreenAttribs(DMXScreenInfo * dmxScreen)
#ifdef GLXEXT
/* get the majorOpcode for the back-end GLX extension */
XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
- &dummy, &dmxScreen->glxErrorBase);
+ &dummy, &dmxScreen->glxErrorBase);
#endif
dmxPrintScreenInfo(dmxScreen);
@@ -384,42 +384,42 @@ dmxGetVisualInfo(DMXScreenInfo * dmxScreen)
visinfo.screen = DefaultScreen(dmxScreen->beDisplay);
dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay,
- VisualScreenMask,
+ VisualScreenMask,
&visinfo, &dmxScreen->beNumVisuals);
dmxScreen->beDefVisualIndex = -1;
if (defaultColorVisualClass >= 0 || dmxDepth > 0) {
- for (i = 0; i < dmxScreen->beNumVisuals; i++)
- if (defaultColorVisualClass >= 0) {
- if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
- if (dmxDepth > 0) {
- if (dmxScreen->beVisuals[i].depth == dmxDepth) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (defaultColorVisualClass >= 0) {
+ if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
+ if (dmxDepth > 0) {
+ if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
}
else {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- }
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
}
else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
}
else {
- visinfo.visualid =
- XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
- visinfo.screen));
-
- for (i = 0; i < dmxScreen->beNumVisuals; i++)
- if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
+ visinfo.visualid =
+ XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
+ visinfo.screen));
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
}
for (i = 0; i < dmxScreen->beNumVisuals; i++)
@@ -436,38 +436,38 @@ dmxGetColormaps(DMXScreenInfo * dmxScreen)
dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
dmxScreen->beDefColormaps = malloc(dmxScreen->beNumDefColormaps *
- sizeof(*dmxScreen->beDefColormaps));
+ sizeof(*dmxScreen->beDefColormaps));
for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- dmxScreen->beDefColormaps[i] =
- XCreateColormap(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->beDefColormaps[i] =
+ XCreateColormap(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
dmxScreen->beVisuals[i].visual, AllocNone);
dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
+ DefaultScreen(dmxScreen->beDisplay));
dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
+ DefaultScreen(dmxScreen->beDisplay));
}
void
dmxGetPixmapFormats(DMXScreenInfo * dmxScreen)
{
dmxScreen->beDepths =
- XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
- &dmxScreen->beNumDepths);
+ XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->beNumDepths);
dmxScreen->bePixmapFormats =
- XListPixmapFormats(dmxScreen->beDisplay,
- &dmxScreen->beNumPixmapFormats);
+ XListPixmapFormats(dmxScreen->beDisplay,
+ &dmxScreen->beNumPixmapFormats);
}
static Bool
dmxSetPixmapFormats(ScreenInfo * pScreenInfo, DMXScreenInfo * dmxScreen)
{
XPixmapFormatValues *bePixmapFormat;
- PixmapFormatRec *format;
- int i, j;
+ PixmapFormatRec *format;
+ int i, j;
pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay);
pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay);
@@ -476,19 +476,19 @@ dmxSetPixmapFormats(ScreenInfo * pScreenInfo, DMXScreenInfo * dmxScreen)
pScreenInfo->numPixmapFormats = 0;
for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- bePixmapFormat = &dmxScreen->bePixmapFormats[i];
- for (j = 0; j < dmxScreen->beNumDepths; j++)
- if ((bePixmapFormat->depth == 1) ||
- (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
-
- format->depth = bePixmapFormat->depth;
- format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
- format->scanlinePad = bePixmapFormat->scanline_pad;
-
- pScreenInfo->numPixmapFormats++;
- break;
- }
+ bePixmapFormat = &dmxScreen->bePixmapFormats[i];
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((bePixmapFormat->depth == 1) ||
+ (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
+
+ format->depth = bePixmapFormat->depth;
+ format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
+ format->scanlinePad = bePixmapFormat->scanline_pad;
+
+ pScreenInfo->numPixmapFormats++;
+ break;
+ }
}
return TRUE;
@@ -501,12 +501,12 @@ dmxCheckForWM(DMXScreenInfo * dmxScreen)
XWindowAttributes xwa;
status = XGetWindowAttributes(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- &xwa);
+ DefaultRootWindow(dmxScreen->beDisplay),
+ &xwa);
dmxScreen->WMRunningOnBE =
- (status &&
- ((xwa.all_event_masks & SubstructureRedirectMask) ||
- (xwa.all_event_masks & SubstructureNotifyMask)));
+ (status &&
+ ((xwa.all_event_masks & SubstructureRedirectMask) ||
+ (xwa.all_event_masks & SubstructureNotifyMask)));
}
/** Initialize the display and collect relevant information about the
@@ -515,7 +515,7 @@ static void
dmxDisplayInit(DMXScreenInfo * dmxScreen)
{
if (!dmxOpenDisplay(dmxScreen))
- dmxLog(dmxFatal,
+ dmxLog(dmxFatal,
"dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name);
dmxSetErrorHandler(dmxScreen);
@@ -523,7 +523,7 @@ dmxDisplayInit(DMXScreenInfo * dmxScreen)
dmxGetScreenAttribs(dmxScreen);
if (!dmxGetVisualInfo(dmxScreen))
- dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
+ dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
dmxGetColormaps(dmxScreen);
dmxGetPixmapFormats(dmxScreen);
@@ -532,7 +532,7 @@ dmxDisplayInit(DMXScreenInfo * dmxScreen)
/* If this doesn't compile, just add || defined(yoursystem) to the line
* below. This information is to help with bug reports and is not
* critical. */
-#if !defined(_POSIX_SOURCE)
+#if !defined(_POSIX_SOURCE)
static const char *
dmxExecOS(void)
{
@@ -544,14 +544,14 @@ static const char *
dmxExecOS(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
struct utsname u;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
uname(&u);
- snprintf(buffer, sizeof(buffer) - 1, "%s %s %s",
- u.sysname, u.release, u.version);
+ snprintf(buffer, sizeof(buffer)-1, "%s %s %s",
+ u.sysname, u.release, u.version);
}
return buffer;
}
@@ -561,13 +561,13 @@ static const char *
dmxBuildCompiler(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__)
- snprintf(buffer, sizeof(buffer) - 1, "gcc %d.%d.%d",
- __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+ snprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
}
return buffer;
@@ -577,7 +577,7 @@ static const char *
dmxExecHost(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
@@ -590,30 +590,30 @@ dmxExecHost(void)
void
InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
{
- int i;
+ int i;
static unsigned long dmxGeneration = 0;
#ifdef GLXEXT
- Bool glxSupported = TRUE;
+ Bool glxSupported = TRUE;
#endif
if (dmxGeneration != serverGeneration) {
- int vendrel = VENDOR_RELEASE;
+ int vendrel = VENDOR_RELEASE;
int major, minor, year, month, day;
-
+
dmxGeneration = serverGeneration;
- major = vendrel / 100000000;
- vendrel -= major * 100000000;
- minor = vendrel / 1000000;
- vendrel -= minor * 1000000;
- year = vendrel / 10000;
- vendrel -= year * 10000;
- month = vendrel / 100;
- vendrel -= month * 100;
- day = vendrel;
-
- /* Add other epoch tests here */
+ major = vendrel / 100000000;
+ vendrel -= major * 100000000;
+ minor = vendrel / 1000000;
+ vendrel -= minor * 1000000;
+ year = vendrel / 10000;
+ vendrel -= year * 10000;
+ month = vendrel / 100;
+ vendrel -= month * 100;
+ day = vendrel;
+
+ /* Add other epoch tests here */
if (major > 0 && minor > 0)
year += 2000;
@@ -643,29 +643,29 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
dmxInputFree(&dmxInputs[i]);
free(dmxScreens);
free(dmxInputs);
- dmxScreens = NULL;
- dmxInputs = NULL;
+ dmxScreens = NULL;
+ dmxInputs = NULL;
dmxNumScreens = 0;
- dmxNumInputs = 0;
+ dmxNumInputs = 0;
}
/* Make sure that the command-line arguments are sane. */
if (dmxAddRemoveScreens && dmxGLXProxy) {
- /* Currently it is not possible to support GLX and Render
- * extensions with dynamic screen addition/removal due to the
- * state that each extension keeps, which cannot be restored. */
+ /* Currently it is not possible to support GLX and Render
+ * extensions with dynamic screen addition/removal due to the
+ * state that each extension keeps, which cannot be restored. */
dmxLog(dmxWarning,
- "GLX Proxy and Render extensions do not yet support dynamic\n");
+ "GLX Proxy and Render extensions do not yet support dynamic\n");
dmxLog(dmxWarning,
- "screen addition and removal. Please specify -noglxproxy\n");
+ "screen addition and removal. Please specify -noglxproxy\n");
dmxLog(dmxWarning,
- "and -norender on the command line or in the configuration\n");
+ "and -norender on the command line or in the configuration\n");
dmxLog(dmxWarning,
- "file to disable these two extensions if you wish to use\n");
+ "file to disable these two extensions if you wish to use\n");
dmxLog(dmxWarning,
- "the dynamic addition and removal of screens support.\n");
+ "the dynamic addition and removal of screens support.\n");
dmxLog(dmxFatal,
- "Dynamic screen addition/removal error (see above).\n");
+ "Dynamic screen addition/removal error (see above).\n");
}
/* ddxProcessArgument has been called at this point, but any data
@@ -676,16 +676,16 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
dmxLog(dmxFatal, "InitOutput: no back-end displays found\n");
if (!dmxNumInputs)
dmxLog(dmxInfo, "InitOutput: no inputs found\n");
-
+
/* Disable lazy window creation optimization if offscreen
* optimization is disabled */
if (!dmxOffScreenOpt && dmxLazyWindowCreation) {
dmxLog(dmxInfo,
- "InitOutput: Disabling lazy window creation optimization\n");
+ "InitOutput: Disabling lazy window creation optimization\n");
dmxLog(dmxInfo,
- " since it requires the offscreen optimization\n");
+ " since it requires the offscreen optimization\n");
dmxLog(dmxInfo, " to function properly.\n");
- dmxLazyWindowCreation = FALSE;
+ dmxLazyWindowCreation = FALSE;
}
/* Open each display and gather information about it. */
@@ -701,7 +701,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
#endif
/* Since we only have a single screen thus far, we only need to set
- the pixmap formats to match that screen. FIXME: this isn't true. */
+ the pixmap formats to match that screen. FIXME: this isn't true.*/
if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0]))
return;
@@ -722,95 +722,95 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
#ifdef GLXEXT
/* Check if GLX extension exists on all back-end servers */
for (i = 0; i < dmxNumScreens; i++)
- glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
#endif
/* Tell dix layer about the backend displays */
for (i = 0; i < dmxNumScreens; i++) {
#ifdef GLXEXT
- if (glxSupported) {
- /*
- * Builds GLX configurations from the list of visuals
- * supported by the back-end server, and give that
- * configuration list to the glx layer - so that he will
- * build the visuals accordingly.
- */
-
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- __GLXvisualConfig *configs = NULL;
- dmxGlxVisualPrivate **configprivs = NULL;
- int nconfigs = 0;
- int (*oldErrorHandler) (Display *, XErrorEvent *);
- int i;
-
- /* Catch errors if when using an older GLX w/o FBconfigs */
- oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
-
- /* Get FBConfigs of the back-end server */
- dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
- dmxScreen->glxMajorOpcode,
- &dmxScreen->numFBConfigs);
-
- XSetErrorHandler(oldErrorHandler);
-
- dmxScreen->glxVisuals =
- GetGLXVisualConfigs(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay),
- &dmxScreen->numGlxVisuals);
-
- if (dmxScreen->fbconfigs) {
- configs =
- GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
- dmxScreen->numFBConfigs,
- dmxScreen->beVisuals,
- dmxScreen->beNumVisuals,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals,
- &nconfigs);
+ if (glxSupported) {
+ /*
+ * Builds GLX configurations from the list of visuals
+ * supported by the back-end server, and give that
+ * configuration list to the glx layer - so that he will
+ * build the visuals accordingly.
+ */
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ __GLXvisualConfig *configs = NULL;
+ dmxGlxVisualPrivate **configprivs = NULL;
+ int nconfigs = 0;
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+ int i;
+
+ /* Catch errors if when using an older GLX w/o FBconfigs */
+ oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
+
+ /* Get FBConfigs of the back-end server */
+ dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
+ dmxScreen->glxMajorOpcode,
+ &dmxScreen->numFBConfigs);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ dmxScreen->glxVisuals =
+ GetGLXVisualConfigs(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->numGlxVisuals);
+
+ if (dmxScreen->fbconfigs) {
+ configs =
+ GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs,
+ dmxScreen->beVisuals,
+ dmxScreen->beNumVisuals,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals,
+ &nconfigs);
}
else {
- configs = dmxScreen->glxVisuals;
- nconfigs = dmxScreen->numGlxVisuals;
- }
-
- configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate *));
-
- if (configs != NULL && configprivs != NULL) {
-
- /* Initialize our private info for each visual
- * (currently only x_visual_depth and x_visual_class)
- */
- for (i = 0; i < nconfigs; i++) {
-
- configprivs[i] = (dmxGlxVisualPrivate *)
- malloc(sizeof(dmxGlxVisualPrivate));
- configprivs[i]->x_visual_depth = 0;
- configprivs[i]->x_visual_class = 0;
-
- /* Find the visual depth */
- if (configs[i].vid > 0) {
- int j;
-
- for (j = 0; j < dmxScreen->beNumVisuals; j++) {
- if (dmxScreen->beVisuals[j].visualid ==
- configs[i].vid) {
- configprivs[i]->x_visual_depth =
- dmxScreen->beVisuals[j].depth;
- configprivs[i]->x_visual_class =
- dmxScreen->beVisuals[j].class;
- break;
- }
- }
- }
- }
+ configs = dmxScreen->glxVisuals;
+ nconfigs = dmxScreen->numGlxVisuals;
+ }
+
+ configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
+
+ if (configs != NULL && configprivs != NULL) {
+
+ /* Initialize our private info for each visual
+ * (currently only x_visual_depth and x_visual_class)
+ */
+ for (i = 0; i < nconfigs; i++) {
+
+ configprivs[i] = (dmxGlxVisualPrivate *)
+ malloc(sizeof(dmxGlxVisualPrivate));
+ configprivs[i]->x_visual_depth = 0;
+ configprivs[i]->x_visual_class = 0;
+
+ /* Find the visual depth */
+ if (configs[i].vid > 0) {
+ int j;
+
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ if (dmxScreen->beVisuals[j].visualid ==
+ configs[i].vid) {
+ configprivs[i]->x_visual_depth =
+ dmxScreen->beVisuals[j].depth;
+ configprivs[i]->x_visual_class =
+ dmxScreen->beVisuals[j].class;
+ break;
+ }
+ }
+ }
+ }
XFlush(dmxScreen->beDisplay);
- }
- }
-#endif /* GLXEXT */
+ }
+ }
+#endif /* GLXEXT */
- AddScreen(dmxScreenInit, argc, argv);
+ AddScreen(dmxScreenInit, argc, argv);
}
/* Compute origin information. */
@@ -829,32 +829,32 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
/* Initialize the render extension */
if (!noRenderExtension)
- dmxInitRender();
+ dmxInitRender();
/* Initialized things that need timer hooks */
dmxStatInit();
dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */
dmxLog(dmxInfo, "Shadow framebuffer support %s\n",
- dmxShadowFB ? "enabled" : "disabled");
+ dmxShadowFB ? "enabled" : "disabled");
}
/* RATS: Assuming the fp string (which comes from the command-line argv
vector) is NULL-terminated, the buffer is large enough for the
- strcpy. */
+ strcpy. */
static void
dmxSetDefaultFontPath(const char *fp)
{
if (dmxFontPath) {
- int fplen = strlen(fp) + 1;
- int len = strlen(dmxFontPath);
+ int fplen = strlen(fp) + 1;
+ int len = strlen(dmxFontPath);
- dmxFontPath = realloc(dmxFontPath, len + fplen + 1);
- dmxFontPath[len] = ',';
- strncpy(&dmxFontPath[len + 1], fp, fplen);
+ dmxFontPath = realloc(dmxFontPath, len+fplen+1);
+ dmxFontPath[len] = ',';
+ strncpy(&dmxFontPath[len+1], fp, fplen);
}
else {
- dmxFontPath = strdup(fp);
+ dmxFontPath = strdup(fp);
}
defaultFontPath = dmxFontPath;
@@ -868,18 +868,18 @@ AbortDDX(enum ExitCode error)
{
int i;
- for (i = 0; i < dmxNumScreens; i++) {
+ for (i=0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
+
if (dmxScreen->beDisplay)
XCloseDisplay(dmxScreen->beDisplay);
dmxScreen->beDisplay = NULL;
}
}
-#ifdef DDXBEFORERESET
+#ifdef DDXMAIN
void
-ddxBeforeReset(void)
+ddxMain(void)
{
}
#endif
@@ -914,7 +914,7 @@ int
ddxProcessArgument(int argc, char *argv[], int i)
{
int retval = 0;
-
+
if (!strcmp(argv[i], "-display")) {
if (++i < argc)
dmxConfigStoreDisplay(argv[i]);
@@ -933,17 +933,17 @@ ddxProcessArgument(int argc, char *argv[], int i)
else if (!strcmp(argv[i], "-noshadowfb")) {
dmxLog(dmxWarning,
"-noshadowfb has been deprecated "
- "since it is now the default\n");
- dmxShadowFB = FALSE;
- retval = 1;
+ "since it is now the default\n");
+ dmxShadowFB = FALSE;
+ retval = 1;
}
else if (!strcmp(argv[i], "-nomulticursor")) {
dmxCursorNoMulti();
- retval = 1;
+ retval = 1;
}
else if (!strcmp(argv[i], "-shadowfb")) {
- dmxShadowFB = TRUE;
- retval = 1;
+ dmxShadowFB = TRUE;
+ retval = 1;
}
else if (!strcmp(argv[i], "-configfile")) {
if (++i < argc)
@@ -971,19 +971,19 @@ ddxProcessArgument(int argc, char *argv[], int i)
retval = 2;
}
else if (!strcmp(argv[i], "-nooffscreenopt")) {
- dmxOffScreenOpt = FALSE;
+ dmxOffScreenOpt = FALSE;
retval = 1;
}
else if (!strcmp(argv[i], "-nosubdivprims")) {
- dmxSubdividePrimitives = FALSE;
+ dmxSubdividePrimitives = FALSE;
retval = 1;
}
else if (!strcmp(argv[i], "-nowindowopt")) {
- dmxLazyWindowCreation = FALSE;
+ dmxLazyWindowCreation = FALSE;
retval = 1;
}
else if (!strcmp(argv[i], "-noxkb")) {
- dmxUseXKB = FALSE;
+ dmxUseXKB = FALSE;
retval = 1;
}
else if (!strcmp(argv[i], "-depth")) {
@@ -992,46 +992,46 @@ ddxProcessArgument(int argc, char *argv[], int i)
retval = 2;
}
else if (!strcmp(argv[i], "-norender")) {
- noRenderExtension = TRUE;
+ noRenderExtension = TRUE;
retval = 1;
#ifdef GLXEXT
}
else if (!strcmp(argv[i], "-noglxproxy")) {
- dmxGLXProxy = FALSE;
+ dmxGLXProxy = FALSE;
retval = 1;
}
else if (!strcmp(argv[i], "-noglxswapgroup")) {
- dmxGLXSwapGroupSupport = FALSE;
+ dmxGLXSwapGroupSupport = FALSE;
retval = 1;
}
else if (!strcmp(argv[i], "-glxsyncswap")) {
- dmxGLXSyncSwap = TRUE;
+ dmxGLXSyncSwap = TRUE;
retval = 1;
}
else if (!strcmp(argv[i], "-glxfinishswap")) {
- dmxGLXFinishSwap = TRUE;
+ dmxGLXFinishSwap = TRUE;
retval = 1;
#endif
}
else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
- dmxIgnoreBadFontPaths = TRUE;
+ dmxIgnoreBadFontPaths = TRUE;
retval = 1;
}
else if (!strcmp(argv[i], "-addremovescreens")) {
- dmxAddRemoveScreens = TRUE;
+ dmxAddRemoveScreens = TRUE;
retval = 1;
}
else if (!strcmp(argv[i], "-param")) {
if ((i += 2) < argc) {
- if (!strcasecmp(argv[i - 1], "xkbrules"))
+ if (!strcasecmp(argv[i-1], "xkbrules"))
dmxConfigSetXkbRules(argv[i]);
- else if (!strcasecmp(argv[i - 1], "xkbmodel"))
+ else if (!strcasecmp(argv[i-1], "xkbmodel"))
dmxConfigSetXkbModel(argv[i]);
- else if (!strcasecmp(argv[i - 1], "xkblayout"))
+ else if (!strcasecmp(argv[i-1], "xkblayout"))
dmxConfigSetXkbLayout(argv[i]);
- else if (!strcasecmp(argv[i - 1], "xkbvariant"))
+ else if (!strcasecmp(argv[i-1], "xkbvariant"))
dmxConfigSetXkbVariant(argv[i]);
- else if (!strcasecmp(argv[i - 1], "xkboptions"))
+ else if (!strcasecmp(argv[i-1], "xkboptions"))
dmxConfigSetXkbOptions(argv[i]);
else
dmxLog(dmxWarning,
@@ -1088,13 +1088,13 @@ ddxUseMsg(void)
" that display in addition to the backend input. This is\n"
" useful if the backend window does not cover the whole\n"
" physical display.\n\n");
-
+
ErrorF(" Otherwise, if the -input or -xinput string specifies another\n"
" X display, then a console window will be created on that\n"
" display. Placing \",windows\" or \",nowindows\" after the\n"
" display name will control the display of window outlines in\n"
" the console.\n\n");
-
+
ErrorF(" -input or -xinput dummy specifies no input.\n");
ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n"
" mouse, or other (extension) device:\n"
@@ -1103,7 +1103,7 @@ ddxUseMsg(void)
" -input local,usb-kbd,usb-mou will use USB devices \n"
" -xinput local,usb-oth will use a non-mouse and\n"
" non-keyboard USB device with XInput\n\n");
-
+
ErrorF(" Special Keys:\n");
ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n");
ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n");
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 2d679a559..f781ae6b9 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -53,7 +53,7 @@ from The Open Group.
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
-#endif /* HAVE_MMAP */
+#endif /* HAVE_MMAP */
#include <sys/stat.h>
#include <errno.h>
#ifndef WIN32
@@ -63,7 +63,7 @@ from The Open Group.
#ifdef HAS_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
-#endif /* HAS_SHM */
+#endif /* HAS_SHM */
#include "dix.h"
#include "miline.h"
@@ -106,9 +106,9 @@ static int vfbNumScreens;
static vfbScreenInfo *vfbScreens;
static vfbScreenInfo defaultScreenInfo = {
- .width = VFB_DEFAULT_WIDTH,
+ .width = VFB_DEFAULT_WIDTH,
.height = VFB_DEFAULT_HEIGHT,
- .depth = VFB_DEFAULT_DEPTH,
+ .depth = VFB_DEFAULT_DEPTH,
.blackPixel = VFB_DEFAULT_BLACKPIXEL,
.whitePixel = VFB_DEFAULT_WHITEPIXEL,
.lineBias = VFB_DEFAULT_LINEBIAS,
@@ -137,9 +137,9 @@ vfbInitializePixmapDepths(void)
{
int i;
- vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
+ vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
for (i = 2; i <= 32; i++)
- vfbPixmapDepths[i] = FALSE;
+ vfbPixmapDepths[i] = FALSE;
}
static int
@@ -164,39 +164,39 @@ ddxGiveUp(enum ExitCode error)
switch (fbmemtype) {
#ifdef HAVE_MMAP
- case MMAPPED_FILE_FB:
+ case MMAPPED_FILE_FB:
for (i = 0; i < vfbNumScreens; i++) {
if (-1 == unlink(vfbScreens[i].mmap_file)) {
- perror("unlink");
- ErrorF("unlink %s failed, %s",
- vfbScreens[i].mmap_file, strerror(errno));
- }
- }
- break;
-#else /* HAVE_MMAP */
+ perror("unlink");
+ ErrorF("unlink %s failed, %s",
+ vfbScreens[i].mmap_file, strerror(errno));
+ }
+ }
+ break;
+#else /* HAVE_MMAP */
case MMAPPED_FILE_FB:
break;
-#endif /* HAVE_MMAP */
-
+#endif /* HAVE_MMAP */
+
#ifdef HAS_SHM
case SHARED_MEMORY_FB:
for (i = 0; i < vfbNumScreens; i++) {
if (-1 == shmdt((char *) vfbScreens[i].pXWDHeader)) {
- perror("shmdt");
- ErrorF("shmdt failed, %s", strerror(errno));
- }
- }
- break;
-#else /* HAS_SHM */
+ perror("shmdt");
+ ErrorF("shmdt failed, %s", strerror(errno));
+ }
+ }
+ break;
+#else /* HAS_SHM */
case SHARED_MEMORY_FB:
break;
-#endif /* HAS_SHM */
-
+#endif /* HAS_SHM */
+
case NORMAL_MEMORY_FB:
for (i = 0; i < vfbNumScreens; i++) {
- free(vfbScreens[i].pXWDHeader);
- }
- break;
+ free(vfbScreens[i].pXWDHeader);
+ }
+ break;
}
}
@@ -223,11 +223,10 @@ OsVendorFatalError(void)
{
}
-#if defined(DDXBEFORERESET)
+#ifdef DDXMAIN
void
-ddxBeforeReset(void)
+ddxMain(void)
{
- return;
}
#endif
@@ -237,7 +236,7 @@ ddxUseMsg(void)
ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
ErrorF("-pixdepths list-of-int support given pixmap depths\n");
ErrorF("+/-render turn on/off RENDER extension support"
- "(default on)\n");
+ "(default on)\n");
ErrorF("-linebias n adjust thin line pixelization\n");
ErrorF("-blackpixel n pixel value for black\n");
ErrorF("-whitepixel n pixel value for white\n");
@@ -260,14 +259,14 @@ ddxProcessArgument(int argc, char *argv[], int i)
vfbScreenInfo *currentScreen;
if (firstTime) {
- vfbInitializePixmapDepths();
+ vfbInitializePixmapDepths();
firstTime = FALSE;
}
if (lastScreen == -1)
- currentScreen = &defaultScreenInfo;
+ currentScreen = &defaultScreenInfo;
else
- currentScreen = &vfbScreens[lastScreen];
+ currentScreen = &vfbScreens[lastScreen];
#define CHECK_FOR_REQUIRED_ARGUMENTS(num) \
if (((i + num) >= argc) || (!argv[i + num])) { \
@@ -275,105 +274,105 @@ ddxProcessArgument(int argc, char *argv[], int i)
UseMsg(); \
FatalError("Required argument to %s not specified\n", argv[i]); \
}
-
+
if (strcmp(argv[i], "-screen") == 0) { /* -screen n WxHxD */
- int screenNum;
+ int screenNum;
- CHECK_FOR_REQUIRED_ARGUMENTS(2);
- screenNum = atoi(argv[i + 1]);
- /* The protocol only has a CARD8 for number of screens in the
- connection setup block, so don't allow more than that. */
+ CHECK_FOR_REQUIRED_ARGUMENTS(2);
+ screenNum = atoi(argv[i+1]);
+ /* The protocol only has a CARD8 for number of screens in the
+ connection setup block, so don't allow more than that. */
if ((screenNum < 0) || (screenNum >= 255)) {
- ErrorF("Invalid screen number %d\n", screenNum);
- UseMsg();
- FatalError("Invalid screen number %d passed to -screen\n",
- screenNum);
- }
+ ErrorF("Invalid screen number %d\n", screenNum);
+ UseMsg();
+ FatalError("Invalid screen number %d passed to -screen\n",
+ screenNum);
+ }
if (vfbNumScreens <= screenNum) {
vfbScreens =
realloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
- if (!vfbScreens)
- FatalError("Not enough memory for screen %d\n", screenNum);
- for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
- vfbScreens[vfbNumScreens] = defaultScreenInfo;
- }
-
- if (3 != sscanf(argv[i + 2], "%dx%dx%d",
- &vfbScreens[screenNum].width,
- &vfbScreens[screenNum].height,
+ if (!vfbScreens)
+ FatalError("Not enough memory for screen %d\n", screenNum);
+ for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
+ vfbScreens[vfbNumScreens] = defaultScreenInfo;
+ }
+
+ if (3 != sscanf(argv[i+2], "%dx%dx%d",
+ &vfbScreens[screenNum].width,
+ &vfbScreens[screenNum].height,
&vfbScreens[screenNum].depth)) {
- ErrorF("Invalid screen configuration %s\n", argv[i + 2]);
- UseMsg();
- FatalError("Invalid screen configuration %s for -screen %d\n",
- argv[i + 2], screenNum);
- }
+ ErrorF("Invalid screen configuration %s\n", argv[i+2]);
+ UseMsg();
+ FatalError("Invalid screen configuration %s for -screen %d\n",
+ argv[i+2], screenNum);
+ }
- lastScreen = screenNum;
- return 3;
+ lastScreen = screenNum;
+ return 3;
}
if (strcmp(argv[i], "-pixdepths") == 0) { /* -pixdepths list-of-depth */
- int depth, ret = 1;
+ int depth, ret = 1;
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
while ((++i < argc) && (depth = atoi(argv[i])) != 0) {
if (depth < 0 || depth > 32) {
- ErrorF("Invalid pixmap depth %d\n", depth);
- UseMsg();
- FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
- depth);
- }
- vfbPixmapDepths[depth] = TRUE;
- ret++;
- }
- return ret;
+ ErrorF("Invalid pixmap depth %d\n", depth);
+ UseMsg();
+ FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
+ depth);
+ }
+ vfbPixmapDepths[depth] = TRUE;
+ ret++;
+ }
+ return ret;
}
if (strcmp(argv[i], "+render") == 0) { /* +render */
- Render = TRUE;
- return 1;
+ Render = TRUE;
+ return 1;
}
if (strcmp(argv[i], "-render") == 0) { /* -render */
- Render = FALSE;
+ Render = FALSE;
#ifdef COMPOSITE
- noCompositeExtension = TRUE;
+ noCompositeExtension = TRUE;
#endif
- return 1;
+ return 1;
}
if (strcmp(argv[i], "-blackpixel") == 0) { /* -blackpixel n */
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- currentScreen->blackPixel = atoi(argv[++i]);
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ currentScreen->blackPixel = atoi(argv[++i]);
+ return 2;
}
if (strcmp(argv[i], "-whitepixel") == 0) { /* -whitepixel n */
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- currentScreen->whitePixel = atoi(argv[++i]);
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ currentScreen->whitePixel = atoi(argv[++i]);
+ return 2;
}
if (strcmp(argv[i], "-linebias") == 0) { /* -linebias n */
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- currentScreen->lineBias = atoi(argv[++i]);
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ currentScreen->lineBias = atoi(argv[++i]);
+ return 2;
}
#ifdef HAVE_MMAP
if (strcmp(argv[i], "-fbdir") == 0) { /* -fbdir directory */
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- pfbdir = argv[++i];
- fbmemtype = MMAPPED_FILE_FB;
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ pfbdir = argv[++i];
+ fbmemtype = MMAPPED_FILE_FB;
+ return 2;
}
-#endif /* HAVE_MMAP */
+#endif /* HAVE_MMAP */
#ifdef HAS_SHM
if (strcmp(argv[i], "-shmem") == 0) { /* -shmem */
- fbmemtype = SHARED_MEMORY_FB;
- return 1;
+ fbmemtype = SHARED_MEMORY_FB;
+ return 1;
}
#endif
@@ -388,7 +387,7 @@ static DevPrivateKeyRec cmapScrPrivateKeyRec;
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
static int
-vfbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
+vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
/* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */
@@ -402,54 +401,54 @@ vfbInstallColormap(ColormapPtr pmap)
ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);
if (pmap != oldpmap) {
- int entries;
- XWDFileHeader *pXWDHeader;
- XWDColor *pXWDCmap;
- VisualPtr pVisual;
- Pixel *ppix;
- xrgb *prgb;
- xColorItem *defs;
- int i;
-
- if (oldpmap != (ColormapPtr) None)
- WalkTree(pmap->pScreen, TellLostMap, (char *) &oldpmap->mid);
- /* Install pmap */
- SetInstalledColormap(pmap->pScreen, pmap);
- WalkTree(pmap->pScreen, TellGainedMap, (char *) &pmap->mid);
-
- entries = pmap->pVisual->ColormapEntries;
- pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
- pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
- pVisual = pmap->pVisual;
-
- swapcopy32(pXWDHeader->visual_class, pVisual->class);
- swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
- swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
- swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
- swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
- swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
-
- ppix = (Pixel *) malloc(entries * sizeof(Pixel));
- prgb = (xrgb *) malloc(entries * sizeof(xrgb));
- defs = (xColorItem *) malloc(entries * sizeof(xColorItem));
+ int entries;
+ XWDFileHeader *pXWDHeader;
+ XWDColor *pXWDCmap;
+ VisualPtr pVisual;
+ Pixel * ppix;
+ xrgb * prgb;
+ xColorItem *defs;
+ int i;
+
+ if(oldpmap != (ColormapPtr)None)
+ WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
+ /* Install pmap */
+ SetInstalledColormap(pmap->pScreen, pmap);
+ WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
+
+ entries = pmap->pVisual->ColormapEntries;
+ pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
+ pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
+ pVisual = pmap->pVisual;
+
+ swapcopy32(pXWDHeader->visual_class, pVisual->class);
+ swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
+ swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
+ swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
+ swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
+ swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
+
+ ppix = (Pixel *)malloc(entries * sizeof(Pixel));
+ prgb = (xrgb *)malloc(entries * sizeof(xrgb));
+ defs = (xColorItem *)malloc(entries * sizeof(xColorItem));
for (i = 0; i < entries; i++)
ppix[i] = i;
- /* XXX truecolor */
- QueryColors(pmap, entries, ppix, prgb, serverClient);
-
- for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
- defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
- defs[i].red = prgb[i].red;
- defs[i].green = prgb[i].green;
- defs[i].blue = prgb[i].blue;
- defs[i].flags = DoRed | DoGreen | DoBlue;
- }
- (*pmap->pScreen->StoreColors) (pmap, entries, defs);
-
- free(ppix);
- free(prgb);
- free(defs);
+ /* XXX truecolor */
+ QueryColors(pmap, entries, ppix, prgb, serverClient);
+
+ for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
+ defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+ (*pmap->pScreen->StoreColors)(pmap, entries, defs);
+
+ free(ppix);
+ free(prgb);
+ free(defs);
}
}
@@ -460,41 +459,41 @@ vfbUninstallColormap(ColormapPtr pmap)
if (pmap == curpmap) {
if (pmap->mid != pmap->pScreen->defColormap) {
- dixLookupResourceByType((pointer *) &curpmap,
- pmap->pScreen->defColormap,
- RT_COLORMAP, serverClient,
- DixInstallAccess);
- (*pmap->pScreen->InstallColormap) (curpmap);
- }
+ dixLookupResourceByType((pointer *)&curpmap,
+ pmap->pScreen->defColormap,
+ RT_COLORMAP, serverClient,
+ DixInstallAccess);
+ (*pmap->pScreen->InstallColormap)(curpmap);
+ }
}
}
static void
-vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs)
+vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
{
XWDColor *pXWDCmap;
int i;
if (pmap != GetInstalledColormap(pmap->pScreen)) {
- return;
+ return;
}
pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
- return;
+ return;
}
for (i = 0; i < ndef; i++) {
if (pdefs[i].flags & DoRed) {
- swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
- }
+ swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
+ }
if (pdefs[i].flags & DoGreen) {
- swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
- }
+ swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
+ }
if (pdefs[i].flags & DoBlue) {
- swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
- }
+ swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
+ }
}
}
@@ -514,17 +513,17 @@ vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
for (i = 0; i < vfbNumScreens; i++) {
#ifdef MS_ASYNC
- if (-1 == msync((caddr_t) vfbScreens[i].pXWDHeader,
- (size_t) vfbScreens[i].sizeInBytes, MS_ASYNC))
+ if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
+ (size_t)vfbScreens[i].sizeInBytes, MS_ASYNC))
#else
- /* silly NetBSD and who else? */
- if (-1 == msync((caddr_t) vfbScreens[i].pXWDHeader,
- (size_t) vfbScreens[i].sizeInBytes))
+ /* silly NetBSD and who else? */
+ if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
+ (size_t)vfbScreens[i].sizeInBytes))
#endif
- {
- perror("msync");
- ErrorF("msync failed, %s", strerror(errno));
- }
+ {
+ perror("msync");
+ ErrorF("msync failed, %s", strerror(errno));
+ }
}
}
@@ -541,47 +540,47 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
int currentFileSize, writeThisTime;
snprintf(pvfb->mmap_file, sizeof(pvfb->mmap_file), "%s/Xvfb_screen%d",
- pfbdir, (int) (pvfb - vfbScreens));
+ pfbdir, (int) (pvfb - vfbScreens));
if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT | O_RDWR, 0666))) {
- perror("open");
- ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno));
- return;
+ perror("open");
+ ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno));
+ return;
}
/* Extend the file to be the proper size */
memset(dummyBuffer, 0, DUMMY_BUFFER_SIZE);
for (currentFileSize = 0;
- currentFileSize < pvfb->sizeInBytes;
+ currentFileSize < pvfb->sizeInBytes;
currentFileSize += writeThisTime) {
- writeThisTime = min(DUMMY_BUFFER_SIZE,
- pvfb->sizeInBytes - currentFileSize);
+ writeThisTime = min(DUMMY_BUFFER_SIZE,
+ pvfb->sizeInBytes - currentFileSize);
if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime)) {
- perror("write");
- ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno));
- return;
- }
+ perror("write");
+ ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno));
+ return;
+ }
}
/* try to mmap the file */
- pvfb->pXWDHeader = (XWDFileHeader *) mmap((caddr_t) NULL, pvfb->sizeInBytes,
- PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED,
- pvfb->mmap_fd, 0);
+ pvfb->pXWDHeader = (XWDFileHeader *)mmap((caddr_t)NULL, pvfb->sizeInBytes,
+ PROT_READ|PROT_WRITE,
+ MAP_FILE|MAP_SHARED,
+ pvfb->mmap_fd, 0);
if (-1 == (long) pvfb->pXWDHeader) {
- perror("mmap");
- ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno));
- pvfb->pXWDHeader = NULL;
- return;
+ perror("mmap");
+ ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno));
+ pvfb->pXWDHeader = NULL;
+ return;
}
if (!RegisterBlockAndWakeupHandlers(vfbBlockHandler, vfbWakeupHandler,
NULL)) {
- pvfb->pXWDHeader = NULL;
+ pvfb->pXWDHeader = NULL;
}
}
-#endif /* HAVE_MMAP */
+#endif /* HAVE_MMAP */
#ifdef HAS_SHM
static void
@@ -589,27 +588,27 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
{
/* create the shared memory segment */
- pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT | 0777);
+ pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT|0777);
if (pvfb->shmid < 0) {
- perror("shmget");
+ perror("shmget");
ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes,
strerror(errno));
- return;
+ return;
}
/* try to attach it */
- pvfb->pXWDHeader = (XWDFileHeader *) shmat(pvfb->shmid, 0, 0);
+ pvfb->pXWDHeader = (XWDFileHeader *)shmat(pvfb->shmid, 0, 0);
if (-1 == (long) pvfb->pXWDHeader) {
- perror("shmat");
- ErrorF("shmat failed, %s", strerror(errno));
- pvfb->pXWDHeader = NULL;
- return;
+ perror("shmat");
+ ErrorF("shmat failed, %s", strerror(errno));
+ pvfb->pXWDHeader = NULL;
+ return;
}
ErrorF("screen %d shmid %d\n", (int) (pvfb - vfbScreens), pvfb->shmid);
}
-#endif /* HAS_SHM */
+#endif /* HAS_SHM */
static char *
vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
@@ -626,22 +625,22 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
*/
if (pvfb->depth <= 10) { /* single index colormaps */
- pvfb->ncolors = 1 << pvfb->depth;
+ pvfb->ncolors = 1 << pvfb->depth;
}
else { /* decomposed colormaps */
- int nplanes_per_color_component = pvfb->depth / 3;
+ int nplanes_per_color_component = pvfb->depth / 3;
if (pvfb->depth % 3)
nplanes_per_color_component++;
- pvfb->ncolors = 1 << nplanes_per_color_component;
+ pvfb->ncolors = 1 << nplanes_per_color_component;
}
/* add extra bytes for XWDFileHeader, window name, and colormap */
pvfb->sizeInBytes += SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN +
- pvfb->ncolors * SIZEOF(XWDColor);
+ pvfb->ncolors * SIZEOF(XWDColor);
- pvfb->pXWDHeader = NULL;
+ pvfb->pXWDHeader = NULL;
switch (fbmemtype) {
#ifdef HAVE_MMAP
case MMAPPED_FILE_FB:
@@ -662,20 +661,20 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
#endif
case NORMAL_MEMORY_FB:
- pvfb->pXWDHeader = (XWDFileHeader *) malloc(pvfb->sizeInBytes);
- break;
+ pvfb->pXWDHeader = (XWDFileHeader *)malloc(pvfb->sizeInBytes);
+ break;
}
if (pvfb->pXWDHeader) {
- pvfb->pXWDCmap = (XWDColor *) ((char *) pvfb->pXWDHeader
+ pvfb->pXWDCmap = (XWDColor *)((char *)pvfb->pXWDHeader
+ SIZEOF(XWDheader) +
XWD_WINDOW_NAME_LEN);
- pvfb->pfbMemory = (char *) (pvfb->pXWDCmap + pvfb->ncolors);
+ pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors);
- return pvfb->pfbMemory;
+ return pvfb->pfbMemory;
}
else
- return NULL;
+ return NULL;
}
static void
@@ -720,36 +719,36 @@ vfbWriteXWDFileHeader(ScreenPtr pScreen)
/* write xwd "window" name: Xvfb hostname:server.screen */
if (-1 == gethostname(hostname, sizeof(hostname)))
- hostname[0] = 0;
+ hostname[0] = 0;
else
- hostname[XWD_WINDOW_NAME_LEN - 1] = 0;
- sprintf((char *) (pXWDHeader + 1), "Xvfb %s:%s.%d", hostname, display,
- pScreen->myNum);
+ hostname[XWD_WINDOW_NAME_LEN-1] = 0;
+ sprintf((char *)(pXWDHeader+1), "Xvfb %s:%s.%d", hostname, display,
+ pScreen->myNum);
/* write colormap pixel slot values */
for (i = 0; i < pvfb->ncolors; i++) {
- pvfb->pXWDCmap[i].pixel = i;
+ pvfb->pXWDCmap[i].pixel = i;
}
/* byte swap to most significant byte first */
if (needswap) {
- SwapLongs((CARD32 *) pXWDHeader, SIZEOF(XWDheader) / 4);
+ SwapLongs((CARD32 *)pXWDHeader, SIZEOF(XWDheader)/4);
for (i = 0; i < pvfb->ncolors; i++) {
- swapl(&pvfb->pXWDCmap[i].pixel);
- }
+ swapl(&pvfb->pXWDCmap[i].pixel);
+ }
}
}
static Bool
-vfbCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+vfbCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
{
return FALSE;
}
static void
-vfbCrossScreen(ScreenPtr pScreen, Bool entering)
+vfbCrossScreen (ScreenPtr pScreen, Bool entering)
{
}
@@ -764,7 +763,7 @@ vfbCloseScreen(int index, ScreenPtr pScreen)
{
vfbScreenInfoPtr pvfb = &vfbScreens[index];
int i;
-
+
pScreen->CloseScreen = pvfb->closeScreen;
/*
@@ -772,7 +771,7 @@ vfbCloseScreen(int index, ScreenPtr pScreen)
* clear installed colormaps so that server reset works correctly.
*/
for (i = 0; i < screenInfo.numScreens; i++)
- SetInstalledColormap(screenInfo.screens[i], NULL);
+ SetInstalledColormap(screenInfo.screens[i], NULL);
return pScreen->CloseScreen(index, pScreen);
}
@@ -784,71 +783,71 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
int dpix = monitorResolution, dpiy = monitorResolution;
int ret;
char *pbits;
-
+
if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (dpix == 0)
- dpix = 100;
+ dpix = 100;
if (dpiy == 0)
- dpiy = 100;
+ dpiy = 100;
pvfb->paddedBytesWidth = PixmapBytePad(pvfb->width, pvfb->depth);
pvfb->bitsPerPixel = vfbBitsPerPixel(pvfb->depth);
- if (pvfb->bitsPerPixel >= 8)
- pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8);
+ if (pvfb->bitsPerPixel >= 8 )
+ pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8);
else
- pvfb->paddedWidth = pvfb->paddedBytesWidth * 8;
+ pvfb->paddedWidth = pvfb->paddedBytesWidth * 8;
pbits = vfbAllocateFramebufferMemory(pvfb);
if (!pbits)
return FALSE;
switch (pvfb->depth) {
case 8:
- miSetVisualTypesAndMasks(8,
- ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
+ miSetVisualTypesAndMasks (8,
+ ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
(1 << DirectColor)), 8, PseudoColor, 0, 0, 0);
- break;
+ break;
case 15:
- miSetVisualTypesAndMasks(15,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 8, TrueColor, 0x7c00, 0x03e0, 0x001f);
- break;
+ miSetVisualTypesAndMasks (15,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0x7c00, 0x03e0, 0x001f);
+ break;
case 16:
- miSetVisualTypesAndMasks(16,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 8, TrueColor, 0xf800, 0x07e0, 0x001f);
- break;
+ miSetVisualTypesAndMasks (16,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0xf800, 0x07e0, 0x001f);
+ break;
case 24:
- miSetVisualTypesAndMasks(24,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
- break;
+ miSetVisualTypesAndMasks (24,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
+ break;
case 30:
- miSetVisualTypesAndMasks(30,
- ((1 << TrueColor) |
- (1 << DirectColor)),
+ miSetVisualTypesAndMasks (30,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
10, TrueColor, 0x3ff00000, 0x000ffc00,
0x000003ff);
- break;
+ break;
default:
- return FALSE;
+ return FALSE;
}
- miSetPixmapDepths();
+ miSetPixmapDepths ();
ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
- dpix, dpiy, pvfb->paddedWidth, pvfb->bitsPerPixel);
- if (ret && Render)
- fbPictureInit(pScreen, 0, 0);
+ dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
+ if (ret && Render)
+ fbPictureInit (pScreen, 0, 0);
if (!ret)
return FALSE;
@@ -876,10 +875,10 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
return ret;
-} /* end vfbScreenInit */
+} /* end vfbScreenInit */
void
-InitOutput(ScreenInfo * screenInfo, int argc, char **argv)
+InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
{
int i;
int NumFormats = 0;
@@ -888,35 +887,35 @@ InitOutput(ScreenInfo * screenInfo, int argc, char **argv)
/* must have a pixmap depth to match every screen depth */
for (i = 0; i < vfbNumScreens; i++) {
- vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
+ vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
}
/* RENDER needs a good set of pixmaps. */
if (Render) {
- vfbPixmapDepths[1] = TRUE;
- vfbPixmapDepths[4] = TRUE;
- vfbPixmapDepths[8] = TRUE;
+ vfbPixmapDepths[1] = TRUE;
+ vfbPixmapDepths[4] = TRUE;
+ vfbPixmapDepths[8] = TRUE;
#if 0
- vfbPixmapDepths[12] = TRUE;
+ vfbPixmapDepths[12] = TRUE;
#endif
/* vfbPixmapDepths[15] = TRUE; */
- vfbPixmapDepths[16] = TRUE;
- vfbPixmapDepths[24] = TRUE;
+ vfbPixmapDepths[16] = TRUE;
+ vfbPixmapDepths[24] = TRUE;
#if 0
- vfbPixmapDepths[30] = TRUE;
+ vfbPixmapDepths[30] = TRUE;
#endif
- vfbPixmapDepths[32] = TRUE;
+ vfbPixmapDepths[32] = TRUE;
}
for (i = 1; i <= 32; i++) {
if (vfbPixmapDepths[i]) {
- if (NumFormats >= MAXFORMATS)
- FatalError("MAXFORMATS is too small for this server\n");
- screenInfo->formats[NumFormats].depth = i;
- screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
- screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
- NumFormats++;
- }
+ if (NumFormats >= MAXFORMATS)
+ FatalError ("MAXFORMATS is too small for this server\n");
+ screenInfo->formats[NumFormats].depth = i;
+ screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
+ screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
+ NumFormats++;
+ }
}
screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
@@ -928,13 +927,13 @@ InitOutput(ScreenInfo * screenInfo, int argc, char **argv)
/* initialize screens */
if (vfbNumScreens < 1) {
- vfbScreens = &defaultScreenInfo;
- vfbNumScreens = 1;
+ vfbScreens = &defaultScreenInfo;
+ vfbNumScreens = 1;
}
for (i = 0; i < vfbNumScreens; i++) {
if (-1 == AddScreen(vfbScreenInit, argc, argv)) {
- FatalError("Couldn't add screen %d", i);
- }
+ FatalError("Couldn't add screen %d", i);
+ }
}
-} /* end InitOutput */
+} /* end InitOutput */
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 391b26eb8..045f1eb97 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -25,9 +25,9 @@ if INT10MODULE
INT10_SUBDIR = int10
endif
-SUBDIRS = common ddc i2c x86emu $(INT10_SUBDIR) fbdevhw os-support parser \
- ramdac shadowfb $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \
- loader dixmods exa modes \
+SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
+ ramdac $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \
+ loader modes . i2c dixmods fbdevhw shadowfb exa \
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) doc man
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
@@ -92,6 +92,9 @@ if INSTALL_SETUID
chown root $(DESTDIR)$(bindir)/Xorg
chmod u+s $(DESTDIR)$(bindir)/Xorg
endif
+if CYGWIN
+ $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
+endif
# Use variables from XORG_MANPAGE_SECTIONS and X Server configuration
# Do not include manpages.am as values are not appropriate for rc files
@@ -109,7 +112,16 @@ CLEANFILES = sdksyms.c sdksyms.dep
EXTRA_DIST += sdksyms.sh
sdksyms.dep sdksyms.c: sdksyms.sh
- CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
+ $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
SDKSYMS_DEP = sdksyms.dep
include $(SDKSYMS_DEP)
+
+i2c/libi2c.la:
+ $(AM_V_at)cd i2c && $(MAKE) libi2c.la
+
+dixmods/libdixmods.la:
+ $(AM_V_at)cd dixmods && $(MAKE) libdixmods.la
+
+dixmods/libxorgxkb.la:
+ $(AM_V_at)cd dixmods && $(MAKE) libxorgxkb.la
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 7491f720d..6c67d8c5a 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -109,33 +109,38 @@
#endif
static ModuleDefault ModuleDefaults[] = {
- {.name = "extmod",.toLoad = TRUE,.load_opt = NULL},
+ {.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
#ifdef DBE
- {.name = "dbe",.toLoad = TRUE,.load_opt = NULL},
+ {.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
#endif
#ifdef GLXEXT
- {.name = "glx",.toLoad = TRUE,.load_opt = NULL},
+ {.name = "glx", .toLoad = TRUE, .load_opt=NULL},
#endif
#ifdef XRECORD
- {.name = "record",.toLoad = TRUE,.load_opt = NULL},
+ {.name = "record", .toLoad = TRUE, .load_opt=NULL},
#endif
#ifdef XF86DRI
- {.name = "dri",.toLoad = TRUE,.load_opt = NULL},
+ {.name = "dri", .toLoad = TRUE, .load_opt=NULL},
#endif
#ifdef DRI2
- {.name = "dri2",.toLoad = TRUE,.load_opt = NULL},
+ {.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
#endif
- {.name = NULL,.toLoad = FALSE,.load_opt = NULL}
+#ifdef __CYGWIN__
+ /* load DIX modules used by drivers first */
+ {.name = "fb", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "shadow", .toLoad = TRUE, .load_opt=NULL},
+#endif
+ {.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
/* Forward declarations */
static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
- int scrnum, MessageType from);
+ int scrnum, MessageType from);
static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
- Bool active);
+ Bool active);
static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input,
- MessageType from);
+ MessageType from);
static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
static Bool addDefaultModes(MonPtr monitorp);
@@ -154,15 +159,15 @@ static void configExtensions(XF86ConfExtensionsPtr conf_ext);
static char *
xf86GetPathElem(char **pnt)
{
- char *p1;
-
- p1 = *pnt;
- *pnt = index(*pnt, ',');
- if (*pnt != NULL) {
- **pnt = '\0';
- *pnt += 1;
- }
- return p1;
+ char *p1;
+
+ p1 = *pnt;
+ *pnt = index(*pnt, ',');
+ if (*pnt != NULL) {
+ **pnt = '\0';
+ *pnt += 1;
+ }
+ return p1;
}
/*
@@ -178,65 +183,65 @@ xf86GetPathElem(char **pnt)
static char *
xf86ValidateFontPath(char *path)
{
- char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
- struct stat stat_buf;
- int flag;
- int dirlen;
-
- tmp_path = calloc(1, strlen(path) + 1);
- out_pnt = tmp_path;
- path_elem = NULL;
- next = path;
- while (next != NULL) {
- path_elem = xf86GetPathElem(&next);
- if (*path_elem == '/') {
- dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
- if ((p1 = strchr(path_elem, ':')) != 0)
- dirlen = p1 - path_elem;
- else
- dirlen = strlen(path_elem);
- strlcpy(dir_elem, path_elem, dirlen + 1);
- flag = stat(dir_elem, &stat_buf);
- if (flag == 0)
- if (!S_ISDIR(stat_buf.st_mode))
- flag = -1;
- if (flag != 0) {
+ char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
+ struct stat stat_buf;
+ int flag;
+ int dirlen;
+
+ tmp_path = calloc(1,strlen(path)+1);
+ out_pnt = tmp_path;
+ path_elem = NULL;
+ next = path;
+ while (next != NULL) {
+ path_elem = xf86GetPathElem(&next);
+ if (*path_elem == '/') {
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
+ if ((p1 = strchr(path_elem, ':')) != 0)
+ dirlen = p1 - path_elem;
+ else
+ dirlen = strlen(path_elem);
+ strlcpy(dir_elem, path_elem, dirlen + 1);
+ flag = stat(dir_elem, &stat_buf);
+ if (flag == 0)
+ if (!S_ISDIR(stat_buf.st_mode))
+ flag = -1;
+ if (flag != 0) {
xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n",
dir_elem);
- xf86ErrorF("\tEntry deleted from font path.\n");
- free(dir_elem);
- continue;
- }
- else {
- XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
- flag = stat(p1, &stat_buf);
- if (flag == 0)
- if (!S_ISREG(stat_buf.st_mode))
- flag = -1;
- free(p1);
- if (flag != 0) {
- xf86Msg(X_WARNING,
- "`fonts.dir' not found (or not valid) in \"%s\".\n",
- dir_elem);
- xf86ErrorF("\tEntry deleted from font path.\n");
- xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
- free(dir_elem);
- continue;
- }
- }
- free(dir_elem);
- }
-
- /*
- * Either an OK directory, or a font server name. So add it to
- * the path.
- */
- if (out_pnt != tmp_path)
- *out_pnt++ = ',';
- strcat(out_pnt, path_elem);
- out_pnt += strlen(path_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ free(dir_elem);
+ continue;
+ }
+ else {
+ XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
+ flag = stat(p1, &stat_buf);
+ if (flag == 0)
+ if (!S_ISREG(stat_buf.st_mode))
+ flag = -1;
+ free(p1);
+ if (flag != 0) {
+ xf86Msg(X_WARNING,
+ "`fonts.dir' not found (or not valid) in \"%s\".\n",
+ dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ free(dir_elem);
+ continue;
+ }
+ }
+ free(dir_elem);
}
- return tmp_path;
+
+ /*
+ * Either an OK directory, or a font server name. So add it to
+ * the path.
+ */
+ if (out_pnt != tmp_path)
+ *out_pnt++ = ',';
+ strcat(out_pnt, path_elem);
+ out_pnt += strlen(path_elem);
+ }
+ return tmp_path;
}
/*
@@ -250,13 +255,13 @@ xf86ModulelistFromConfig(pointer **optlist)
char **modulearray;
const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
- "freetype", "type1",
+ "freetype", "type1",
NULL
};
pointer *optarray;
XF86LoadPtr modp;
Bool found;
-
+
/*
* make sure the config file has been parsed and that we have a
* ModulePath set; if no ModulePath was given, use the default
@@ -266,7 +271,7 @@ xf86ModulelistFromConfig(pointer **optlist)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
-
+
if (xf86configptr->conf_modules) {
/* Walk the disable list and let people know what we've parsed to
* not be loaded
@@ -276,7 +281,7 @@ xf86ModulelistFromConfig(pointer **optlist)
xf86Msg(X_WARNING,
"\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n",
modp->load_name);
- modp = (XF86LoadPtr) modp->list.next;
+ modp = (XF86LoadPtr) modp->list.next;
}
/*
* Walk the default settings table. For each module listed to be
@@ -284,7 +289,7 @@ xf86ModulelistFromConfig(pointer **optlist)
* sure it's not in the mod_no_load_lst. If it's not disabled,
* append it to mod_load_lst
*/
- for (i = 0; ModuleDefaults[i].name != NULL; i++) {
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
if (ModuleDefaults[i].toLoad == FALSE) {
xf86Msg(X_WARNING,
"\"%s\" is not to be loaded by default. Skipping.\n",
@@ -301,7 +306,7 @@ xf86ModulelistFromConfig(pointer **optlist)
found = TRUE;
break;
}
- modp = (XF86LoadPtr) modp->list.next;
+ modp = (XF86LoadPtr) modp->list.next;
}
if (found == FALSE) {
modp = xf86configptr->conf_modules->mod_disable_lst;
@@ -313,11 +318,11 @@ xf86ModulelistFromConfig(pointer **optlist)
found = TRUE;
break;
}
- modp = (XF86LoadPtr) modp->list.next;
+ modp = (XF86LoadPtr) modp->list.next;
}
}
if (found == FALSE) {
- XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules;
+ XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
xf86addNewLoadDirective(ptr, ModuleDefaults[i].name,
XF86_LOAD_MODULE,
@@ -325,59 +330,59 @@ xf86ModulelistFromConfig(pointer **optlist)
xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n",
ModuleDefaults[i].name);
}
- }
+ }
}
else {
- xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
- for (i = 0; ModuleDefaults[i].name != NULL; i++) {
- if (ModuleDefaults[i].toLoad == TRUE) {
- XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules;
+ xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ if (ModuleDefaults[i].toLoad == TRUE) {
+ XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
xf86addNewLoadDirective(ptr, ModuleDefaults[i].name,
XF86_LOAD_MODULE,
ModuleDefaults[i].load_opt);
- }
- }
- }
-
- /*
- * Walk the list of modules in the "Module" section to determine how
- * many we have.
- */
- modp = xf86configptr->conf_modules->mod_load_lst;
- while (modp) {
- for (i = 0; ignore[i]; i++) {
- if (strcmp(modp->load_name, ignore[i]) == 0)
- modp->ignore = 1;
- }
- if (!modp->ignore)
- count++;
- modp = (XF86LoadPtr) modp->list.next;
- }
+ }
+ }
+ }
+
+ /*
+ * Walk the list of modules in the "Module" section to determine how
+ * many we have.
+ */
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ for (i = 0; ignore[i]; i++) {
+ if (strcmp(modp->load_name, ignore[i]) == 0)
+ modp->ignore = 1;
+ }
+ if (!modp->ignore)
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
+ }
/*
* allocate the memory and walk the list again to fill in the pointers
*/
- modulearray = xnfalloc((count + 1) * sizeof(char *));
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
optarray = xnfalloc((count + 1) * sizeof(pointer));
count = 0;
if (xf86configptr->conf_modules) {
- modp = xf86configptr->conf_modules->mod_load_lst;
- while (modp) {
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
if (!modp->ignore) {
- modulearray[count] = modp->load_name;
- optarray[count] = modp->load_opt;
- count++;
+ modulearray[count] = modp->load_name;
+ optarray[count] = modp->load_opt;
+ count++;
}
- modp = (XF86LoadPtr) modp->list.next;
- }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
}
modulearray[count] = NULL;
optarray[count] = NULL;
if (optlist)
- *optlist = optarray;
+ *optlist = optarray;
else
- free(optarray);
+ free(optarray);
return modulearray;
}
@@ -388,7 +393,7 @@ xf86DriverlistFromConfig(void)
int j;
char **modulearray;
screenLayoutPtr slp;
-
+
/*
* make sure the config file has been parsed and that we have a
* ModulePath set; if no ModulePath was given, use the default
@@ -398,7 +403,7 @@ xf86DriverlistFromConfig(void)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
-
+
/*
* Walk the list of driver lines in active "Device" sections to
* determine now many implicitly loaded modules there are.
@@ -407,7 +412,7 @@ xf86DriverlistFromConfig(void)
if (xf86ConfigLayout.screens) {
slp = xf86ConfigLayout.screens;
while ((slp++)->screen) {
- count++;
+ count++;
}
}
@@ -416,39 +421,39 @@ xf86DriverlistFromConfig(void)
*/
j = 0;
while (xf86ConfigLayout.inactives[j++].identifier)
- count++;
+ count++;
if (count == 0)
- return NULL;
+ return NULL;
/*
* allocate the memory and walk the list again to fill in the pointers
*/
- modulearray = xnfalloc((count + 1) * sizeof(char *));
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
count = 0;
slp = xf86ConfigLayout.screens;
while (slp->screen) {
- modulearray[count] = slp->screen->device->driver;
- count++;
- slp++;
+ modulearray[count] = slp->screen->device->driver;
+ count++;
+ slp++;
}
j = 0;
- while (xf86ConfigLayout.inactives[j].identifier)
- modulearray[count++] = xf86ConfigLayout.inactives[j++].driver;
+ while (xf86ConfigLayout.inactives[j].identifier)
+ modulearray[count++] = xf86ConfigLayout.inactives[j++].driver;
modulearray[count] = NULL;
/* Remove duplicates */
for (count = 0; modulearray[count] != NULL; count++) {
- int i;
+ int i;
- for (i = 0; i < count; i++)
- if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
- modulearray[count] = "";
- break;
- }
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
}
return modulearray;
}
@@ -469,7 +474,7 @@ xf86InputDriverlistFromConfig(void)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
-
+
/*
* Walk the list of driver lines in active "InputDevice" sections to
* determine now many implicitly loaded modules there are.
@@ -477,36 +482,36 @@ xf86InputDriverlistFromConfig(void)
if (xf86ConfigLayout.inputs) {
idp = xf86ConfigLayout.inputs;
while (*idp) {
- count++;
- idp++;
+ count++;
+ idp++;
}
}
if (count == 0)
- return NULL;
+ return NULL;
/*
* allocate the memory and walk the list again to fill in the pointers
*/
- modulearray = xnfalloc((count + 1) * sizeof(char *));
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
count = 0;
idp = xf86ConfigLayout.inputs;
while (idp && *idp) {
modulearray[count] = (*idp)->driver;
- count++;
- idp++;
+ count++;
+ idp++;
}
modulearray[count] = NULL;
/* Remove duplicates */
for (count = 0; modulearray[count] != NULL; count++) {
- int i;
+ int i;
- for (i = 0; i < count; i++)
- if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
- modulearray[count] = "";
- break;
- }
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
}
return modulearray;
}
@@ -520,7 +525,7 @@ fixup_video_driver_list(char **drivers)
int i;
/* walk to the end of the list */
- for (end = drivers; *end && **end; end++);
+ for (end = drivers; *end && **end; end++) ;
end--;
/*
@@ -541,13 +546,13 @@ fixup_video_driver_list(char **drivers)
}
static char **
-GenerateDriverlist(const char *dirname)
+GenerateDriverlist(const char * dirname)
{
char **ret;
const char *subdirs[] = { dirname, NULL };
- static const char *patlist[] = { "(.*)_drv\\.so", NULL };
+ static const char *patlist[] = {"(.*)_drv\\.so", NULL};
ret = LoaderListDirs(subdirs, patlist);
-
+
/* fix up the probe order for video drivers */
if (strstr(dirname, "drivers") && ret != NULL)
fixup_video_driver_list(ret);
@@ -588,31 +593,31 @@ xf86ConfigError(const char *msg, ...)
static void
configFiles(XF86ConfFilesPtr fileconf)
{
- MessageType pathFrom;
- Bool must_copy;
- int size, countDirs;
- char *temp_path, *log_buf, *start, *end;
+ MessageType pathFrom;
+ Bool must_copy;
+ int size, countDirs;
+ char *temp_path, *log_buf, *start, *end;
/* FontPath */
must_copy = TRUE;
temp_path = defaultFontPath ? defaultFontPath : "";
if (xf86fpFlag)
- pathFrom = X_CMDLINE;
+ pathFrom = X_CMDLINE;
else if (fileconf && fileconf->file_fontpath) {
- pathFrom = X_CONFIG;
- if (xf86Info.useDefaultFontPath) {
- if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
- *temp_path ? "," : "", temp_path) == -1)
- defaultFontPath = NULL;
- else
- must_copy = FALSE;
- }
- else
- defaultFontPath = fileconf->file_fontpath;
+ pathFrom = X_CONFIG;
+ if (xf86Info.useDefaultFontPath) {
+ if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
+ *temp_path ? "," : "", temp_path) == -1)
+ defaultFontPath = NULL;
+ else
+ must_copy = FALSE;
+ }
+ else
+ defaultFontPath = fileconf->file_fontpath;
}
else
- pathFrom = X_DEFAULT;
+ pathFrom = X_DEFAULT;
temp_path = defaultFontPath ? defaultFontPath : "";
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
@@ -624,61 +629,61 @@ configFiles(XF86ConfFilesPtr fileconf)
countDirs = 1;
temp_path = defaultFontPath;
while ((temp_path = index(temp_path, ',')) != NULL) {
- countDirs++;
- temp_path++;
+ countDirs++;
+ temp_path++;
}
log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
temp_path = log_buf;
start = defaultFontPath;
- while ((end = index(start, ',')) != NULL) {
- size = (end - start) + 1;
- *(temp_path++) = '\t';
- strncpy(temp_path, start, size);
- temp_path += size;
- *(temp_path++) = '\n';
- start += size;
+ while((end = index(start, ',')) != NULL) {
+ size = (end - start) + 1;
+ *(temp_path++) = '\t';
+ strncpy(temp_path, start, size);
+ temp_path += size;
+ *(temp_path++) = '\n';
+ start += size;
}
/* copy last entry */
*(temp_path++) = '\t';
strcpy(temp_path, start);
xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
free(log_buf);
+
+ /* ModulePath */
- /* ModulePath */
-
- if (fileconf) {
- if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
- xf86ModulePath = fileconf->file_modulepath;
- xf86ModPathFrom = X_CONFIG;
- }
+ if (fileconf) {
+ if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+ xf86ModulePath = fileconf->file_modulepath;
+ xf86ModPathFrom = X_CONFIG;
}
+ }
- xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
+ xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
- if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) {
- XkbBaseDirectory = fileconf->file_xkbdir;
- xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n",
- XkbBaseDirectory);
- }
+ if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) {
+ XkbBaseDirectory = fileconf->file_xkbdir;
+ xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n",
+ XkbBaseDirectory);
+ }
#if 0
- /* LogFile */
- /*
- * XXX The problem with this is that the log file is already open.
- * One option might be to copy the exiting contents to the new location.
- * and re-open it. The down side is that the default location would
- * already have been overwritten. Another option would be to start with
- * unique temporary location, then copy it once the correct name is known.
- * A problem with this is what happens if the server exits before that
- * happens.
- */
- if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
- xf86LogFile = fileconf->file_logfile;
- xf86LogFileFrom = X_CONFIG;
- }
+ /* LogFile */
+ /*
+ * XXX The problem with this is that the log file is already open.
+ * One option might be to copy the exiting contents to the new location.
+ * and re-open it. The down side is that the default location would
+ * already have been overwritten. Another option would be to start with
+ * unique temporary location, then copy it once the correct name is known.
+ * A problem with this is what happens if the server exits before that
+ * happens.
+ */
+ if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
+ xf86LogFile = fileconf->file_logfile;
+ xf86LogFileFrom = X_CONFIG;
+ }
#endif
- return;
+ return;
}
typedef enum {
@@ -715,58 +720,58 @@ typedef enum {
* if the parser found the option in the config file.
*/
static OptionInfoRec FlagOptions[] = {
- {FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_SAVER_BLANKTIME, "BlankTime", OPTV_INTEGER,
- {0}, FALSE},
- {FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
- {0}, FALSE},
- {FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
- {0}, FALSE},
- {FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
- {0}, FALSE},
- {FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
- {0}, FALSE},
- {FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_LOG, "Log", OPTV_STRING,
- {0}, FALSE},
- {FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
- {0}, FALSE},
- {FLAG_RANDR, "RandR", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
- {0}, FALSE},
- {FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
- {0}, FALSE},
- {FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN,
- {0}, FALSE},
- {-1, NULL, OPTV_NONE,
- {0}, FALSE},
+ { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_LOG, "Log", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_RANDR, "RandR", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
};
static Bool
@@ -793,13 +798,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
*/
optp = NULL;
if (flagsconf && flagsconf->flg_option_lst)
- optp = xf86optionListDup(flagsconf->flg_option_lst);
+ optp = xf86optionListDup(flagsconf->flg_option_lst);
if (layoutopts) {
- tmp = xf86optionListDup(layoutopts);
- if (optp)
- optp = xf86optionListMerge(optp, tmp);
- else
- optp = tmp;
+ tmp = xf86optionListDup(layoutopts);
+ if (optp)
+ optp = xf86optionListMerge(optp, tmp);
+ else
+ optp = tmp;
}
xf86ProcessOptions(-1, optp, FlagOptions);
@@ -811,28 +816,28 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
if (xf86Info.ignoreABI) {
- xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
+ xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
}
if (xf86SIGIOSupported()) {
xf86Info.useSIGIO =
xf86ReturnOptValBool(FlagOptions, FLAG_USE_SIGIO,
USE_SIGIO_BY_DEFAULT);
- if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) {
- from = X_CONFIG;
+ if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) {
+ from = X_CONFIG;
}
else {
- from = X_DEFAULT;
- }
- if (!xf86Info.useSIGIO) {
- xf86Msg(from, "Disabling SIGIO handlers for input devices\n");
+ from = X_DEFAULT;
+ }
+ if (!xf86Info.useSIGIO) {
+ xf86Msg(from, "Disabling SIGIO handlers for input devices\n");
}
else if (from == X_CONFIG) {
- xf86Msg(from, "Enabling SIGIO handlers for input devices\n");
- }
+ xf86Msg(from, "Enabling SIGIO handlers for input devices\n");
+ }
}
else {
- xf86Info.useSIGIO = FALSE;
+ xf86Info.useSIGIO = FALSE;
}
if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
@@ -864,86 +869,86 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
*/
#ifdef XF86VIDMODE
if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value))
- xf86Info.vidModeEnabled = !value;
+ xf86Info.vidModeEnabled = !value;
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value))
- xf86Info.vidModeAllowNonLocal = value;
+ xf86Info.vidModeAllowNonLocal = value;
#endif
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
- xf86Info.allowMouseOpenFail = value;
+ xf86Info.allowMouseOpenFail = value;
xf86Info.pmFlag = TRUE;
- if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
- xf86Info.pmFlag = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
+ xf86Info.pmFlag = !value;
{
- if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
- if (!xf86NameCmp(s, "flush")) {
- xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
- xf86Info.log = LogFlush;
- LogSetParameter(XLOG_FLUSH, TRUE);
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
+ if (!xf86NameCmp(s,"flush")) {
+ xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
+ xf86Info.log = LogFlush;
+ LogSetParameter(XLOG_FLUSH, TRUE);
}
else if (!xf86NameCmp(s, "sync")) {
- xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
- xf86Info.log = LogSync;
- LogSetParameter(XLOG_FLUSH, TRUE);
- LogSetParameter(XLOG_SYNC, TRUE);
+ xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
+ xf86Info.log = LogSync;
+ LogSetParameter(XLOG_FLUSH, TRUE);
+ LogSetParameter(XLOG_SYNC, TRUE);
}
else {
- xf86Msg(X_WARNING, "Unknown Log option\n");
- }
+ xf86Msg(X_WARNING,"Unknown Log option\n");
+ }
}
}
-
+
{
- if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))) {
- int policy = PictureParseCmapPolicy(s);
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){
+ int policy = PictureParseCmapPolicy (s);
- if (policy == PictureCmapPolicyInvalid)
- xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
+ if (policy == PictureCmapPolicyInvalid)
+ xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
else {
- xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
- PictureCmapPolicy = policy;
- }
- }
+ xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
+ PictureCmapPolicy = policy;
+ }
+ }
}
#ifdef RANDR
xf86Info.disableRandR = FALSE;
xf86Info.randRFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) {
- xf86Info.disableRandR = !value;
- xf86Info.randRFrom = X_CONFIG;
+ xf86Info.disableRandR = !value;
+ xf86Info.randRFrom = X_CONFIG;
}
#endif
xf86Info.aiglx = TRUE;
xf86Info.aiglxFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
- xf86Info.aiglx = value;
- xf86Info.aiglxFrom = X_CONFIG;
+ xf86Info.aiglx = value;
+ xf86Info.aiglxFrom = X_CONFIG;
}
#ifdef GLXEXT
xf86Info.glxVisuals = XF86_GlxVisualsTypical;
xf86Info.glxVisualsFrom = X_DEFAULT;
if ((s = xf86GetOptValString(FlagOptions, FLAG_GLX_VISUALS))) {
- if (!xf86NameCmp(s, "minimal")) {
- xf86Info.glxVisuals = XF86_GlxVisualsMinimal;
+ if (!xf86NameCmp(s, "minimal")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsMinimal;
}
else if (!xf86NameCmp(s, "typical")) {
- xf86Info.glxVisuals = XF86_GlxVisualsTypical;
+ xf86Info.glxVisuals = XF86_GlxVisualsTypical;
}
else if (!xf86NameCmp(s, "all")) {
- xf86Info.glxVisuals = XF86_GlxVisualsAll;
+ xf86Info.glxVisuals = XF86_GlxVisualsAll;
}
else {
- xf86Msg(X_WARNING, "Unknown GlxVisuals option\n");
- }
+ xf86Msg(X_WARNING,"Unknown GlxVisuals option\n");
+ }
}
if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
- xf86Info.aiglx = value;
- xf86Info.aiglxFrom = X_CONFIG;
+ xf86Info.aiglx = value;
+ xf86Info.aiglxFrom = X_CONFIG;
}
#endif
@@ -962,8 +967,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.useDefaultFontPath = TRUE;
xf86Info.useDefaultFontPathFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) {
- xf86Info.useDefaultFontPath = value;
- xf86Info.useDefaultFontPathFrom = X_CONFIG;
+ xf86Info.useDefaultFontPath = value;
+ xf86Info.useDefaultFontPathFrom = X_CONFIG;
}
/* Make sure that timers don't overflow CARD32's after multiplying */
@@ -972,7 +977,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
+ ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("BlankTime value %d outside legal range of 0 - %d minutes", i,
@@ -982,7 +987,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSStandbyTime = i * MILLI_PER_MIN;
+ DPMSStandbyTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("StandbyTime value %d outside legal range of 0 - %d minutes", i,
@@ -990,7 +995,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSSuspendTime = i * MILLI_PER_MIN;
+ DPMSSuspendTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("SuspendTime value %d outside legal range of 0 - %d minutes", i,
@@ -998,7 +1003,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSOffTime = i * MILLI_PER_MIN;
+ DPMSOffTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("OffTime value %d outside legal range of 0 - %d minutes", i,
@@ -1009,48 +1014,48 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i);
switch (i) {
case 24:
- pix24 = Pix24Use24;
- break;
+ pix24 = Pix24Use24;
+ break;
case 32:
- pix24 = Pix24Use32;
- break;
+ pix24 = Pix24Use32;
+ break;
case -1:
- break;
+ break;
default:
- xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
- return FALSE;
+ xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
+ return FALSE;
}
if (xf86Pix24 != Pix24DontCare) {
- xf86Info.pixmap24 = xf86Pix24;
- xf86Info.pix24From = X_CMDLINE;
+ xf86Info.pixmap24 = xf86Pix24;
+ xf86Info.pix24From = X_CMDLINE;
}
else if (pix24 != Pix24DontCare) {
- xf86Info.pixmap24 = pix24;
- xf86Info.pix24From = X_CONFIG;
+ xf86Info.pixmap24 = pix24;
+ xf86Info.pix24From = X_CONFIG;
}
else {
- xf86Info.pixmap24 = Pix24DontCare;
- xf86Info.pix24From = X_DEFAULT;
+ xf86Info.pixmap24 = Pix24DontCare;
+ xf86Info.pix24From = X_DEFAULT;
}
#ifdef PANORAMIX
from = X_DEFAULT;
if (!noPanoramiXExtension)
- from = X_CMDLINE;
+ from = X_CMDLINE;
else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) {
- noPanoramiXExtension = !value;
- from = X_CONFIG;
+ noPanoramiXExtension = !value;
+ from = X_CONFIG;
}
if (!noPanoramiXExtension)
- xf86Msg(from, "Xinerama: enabled\n");
+ xf86Msg(from, "Xinerama: enabled\n");
#endif
#ifdef DRI2
xf86Info.dri2 = FALSE;
xf86Info.dri2From = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) {
- xf86Info.dri2 = value;
- xf86Info.dri2From = X_CONFIG;
+ xf86Info.dri2 = value;
+ xf86Info.dri2From = X_CONFIG;
}
#endif
@@ -1068,17 +1073,17 @@ xf86DRI2Enabled(void)
* free) it if present. All other devices are moved forward.
*/
static void
-freeDevice(InputInfoPtr * list, InputInfoPtr pInfo)
+freeDevice(InputInfoPtr *list, InputInfoPtr pInfo)
{
InputInfoPtr *devs;
for (devs = list; devs && *devs; devs++) {
- if (*devs == pInfo) {
- free(*devs);
- for (; devs && *devs; devs++)
- devs[0] = devs[1];
- break;
- }
+ if (*devs == pInfo) {
+ free(*devs);
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
+ break;
+ }
}
}
@@ -1086,14 +1091,14 @@ freeDevice(InputInfoPtr * list, InputInfoPtr pInfo)
* Append pInfo to the null-terminated list, allocating space as necessary.
* pInfo is used as the last element.
*/
-static InputInfoPtr *
-addDevice(InputInfoPtr * list, InputInfoPtr pInfo)
+static InputInfoPtr*
+addDevice(InputInfoPtr *list, InputInfoPtr pInfo)
{
InputInfoPtr *devs;
int count = 1;
for (devs = list; devs && *devs; devs++)
- count++;
+ count++;
list = xnfrealloc(list, (count + 1) * sizeof(InputInfoPtr));
list[count] = NULL;
@@ -1123,8 +1128,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
InputInfoPtr corePointer = NULL, coreKeyboard = NULL;
Bool foundPointer = FALSE, foundKeyboard = FALSE;
const char *pointerMsg = NULL, *keyboardMsg = NULL;
- InputInfoPtr *devs, /* iterator */
- indp;
+ InputInfoPtr *devs, /* iterator */
+ indp;
InputInfoPtr Pointer, Keyboard;
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
@@ -1141,255 +1146,255 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
indp = *devs;
- if (indp->options &&
- xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
- if (!corePointer) {
- corePointer = indp;
- }
- }
- if (indp->options &&
- xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
- if (!coreKeyboard) {
- coreKeyboard = indp;
- }
- }
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
+ if (!corePointer) {
+ corePointer = indp;
+ }
+ }
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
+ if (!coreKeyboard) {
+ coreKeyboard = indp;
+ }
+ }
}
confInput = NULL;
/* 1. Check for the -pointer command line option. */
if (xf86PointerName) {
- confInput = xf86findInput(xf86PointerName,
- xf86configptr->conf_input_lst);
- if (!confInput) {
- xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
- xf86PointerName);
- return FALSE;
- }
- from = X_CMDLINE;
- /*
- * If one was already specified in the ServerLayout, it needs to be
- * removed.
- */
- if (corePointer) {
- freeDevice(servlayoutp->inputs, corePointer);
- corePointer = NULL;
- }
- foundPointer = TRUE;
+ confInput = xf86findInput(xf86PointerName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86PointerName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ /*
+ * If one was already specified in the ServerLayout, it needs to be
+ * removed.
+ */
+ if (corePointer) {
+ freeDevice(servlayoutp->inputs, corePointer);
+ corePointer = NULL;
+ }
+ foundPointer = TRUE;
}
/* 2. ServerLayout-specified core pointer. */
if (corePointer) {
- foundPointer = TRUE;
- from = X_CONFIG;
+ foundPointer = TRUE;
+ from = X_CONFIG;
}
/* 3. First core pointer device. */
if (!foundPointer && (xf86Info.forceInputDevices || implicitLayout)) {
- XF86ConfInputPtr p;
-
- for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
- if (p->inp_option_lst &&
- xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) {
- confInput = p;
- foundPointer = TRUE;
- from = X_DEFAULT;
- pointerMsg = "first core pointer device";
- break;
- }
- }
+ XF86ConfInputPtr p;
+
+ for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
+ if (p->inp_option_lst &&
+ xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) {
+ confInput = p;
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "first core pointer device";
+ break;
+ }
+ }
}
/* 4. First pointer with an allowed mouse driver. */
if (!foundPointer && xf86Info.forceInputDevices) {
- const char **driver = mousedrivers;
-
- confInput = xf86findInput(CONF_IMPLICIT_POINTER,
- xf86configptr->conf_input_lst);
- while (*driver && !confInput) {
- confInput = xf86findInputByDriver(*driver,
- xf86configptr->conf_input_lst);
- driver++;
- }
- if (confInput) {
- foundPointer = TRUE;
- from = X_DEFAULT;
- pointerMsg = "first mouse device";
- }
+ const char **driver = mousedrivers;
+
+ confInput = xf86findInput(CONF_IMPLICIT_POINTER,
+ xf86configptr->conf_input_lst);
+ while (*driver && !confInput) {
+ confInput = xf86findInputByDriver(*driver,
+ xf86configptr->conf_input_lst);
+ driver++;
+ }
+ if (confInput) {
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "first mouse device";
+ }
}
/* 5. Built-in default. */
if (!foundPointer && xf86Info.forceInputDevices) {
- memset(&defPtr, 0, sizeof(defPtr));
- defPtr.inp_identifier = strdup("<default pointer>");
- defPtr.inp_driver = strdup("mouse");
- confInput = &defPtr;
- foundPointer = TRUE;
- from = X_DEFAULT;
- pointerMsg = "default mouse configuration";
+ memset(&defPtr, 0, sizeof(defPtr));
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
+ confInput = &defPtr;
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "default mouse configuration";
}
/* Add the core pointer device to the layout, and set it to Core. */
if (foundPointer && confInput) {
- Pointer = xf86AllocateInput();
- if (Pointer)
- foundPointer = configInput(Pointer, confInput, from);
- if (foundPointer) {
- Pointer->options = xf86AddNewOption(Pointer->options,
- "CorePointer", "on");
- Pointer->options = xf86AddNewOption(Pointer->options,
+ Pointer = xf86AllocateInput();
+ if (Pointer)
+ foundPointer = configInput(Pointer, confInput, from);
+ if (foundPointer) {
+ Pointer->options = xf86AddNewOption(Pointer->options,
+ "CorePointer", "on");
+ Pointer->options = xf86AddNewOption(Pointer->options,
"driver",
confInput->inp_driver);
Pointer->options =
xf86AddNewOption(Pointer->options, "identifier",
confInput->inp_identifier);
- servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
- }
+ servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
+ }
}
if (!foundPointer && xf86Info.forceInputDevices) {
- /* This shouldn't happen. */
- xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
- xf86DeleteInput(Pointer, 0);
- return FALSE;
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
+ xf86DeleteInput(Pointer, 0);
+ return FALSE;
}
confInput = NULL;
/* 1. Check for the -keyboard command line option. */
if (xf86KeyboardName) {
- confInput = xf86findInput(xf86KeyboardName,
- xf86configptr->conf_input_lst);
- if (!confInput) {
- xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
- xf86KeyboardName);
- return FALSE;
- }
- from = X_CMDLINE;
- /*
- * If one was already specified in the ServerLayout, it needs to be
- * removed.
- */
- if (coreKeyboard) {
- freeDevice(servlayoutp->inputs, coreKeyboard);
- coreKeyboard = NULL;
- }
- foundKeyboard = TRUE;
+ confInput = xf86findInput(xf86KeyboardName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86KeyboardName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ /*
+ * If one was already specified in the ServerLayout, it needs to be
+ * removed.
+ */
+ if (coreKeyboard) {
+ freeDevice(servlayoutp->inputs, coreKeyboard);
+ coreKeyboard = NULL;
+ }
+ foundKeyboard = TRUE;
}
/* 2. ServerLayout-specified core keyboard. */
if (coreKeyboard) {
- foundKeyboard = TRUE;
- from = X_CONFIG;
+ foundKeyboard = TRUE;
+ from = X_CONFIG;
}
/* 3. First core keyboard device. */
if (!foundKeyboard && (xf86Info.forceInputDevices || implicitLayout)) {
- XF86ConfInputPtr p;
-
- for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
- if (p->inp_option_lst &&
- xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) {
- confInput = p;
- foundKeyboard = TRUE;
- from = X_DEFAULT;
- keyboardMsg = "first core keyboard device";
- break;
- }
- }
+ XF86ConfInputPtr p;
+
+ for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
+ if (p->inp_option_lst &&
+ xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) {
+ confInput = p;
+ foundKeyboard = TRUE;
+ from = X_DEFAULT;
+ keyboardMsg = "first core keyboard device";
+ break;
+ }
+ }
}
/* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
if (!foundKeyboard && xf86Info.forceInputDevices) {
- confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
- xf86configptr->conf_input_lst);
- if (!confInput) {
- confInput = xf86findInputByDriver("kbd",
- xf86configptr->conf_input_lst);
- }
- if (confInput) {
- foundKeyboard = TRUE;
- from = X_DEFAULT;
- keyboardMsg = "first keyboard device";
- }
+ confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ confInput = xf86findInputByDriver("kbd",
+ xf86configptr->conf_input_lst);
+ }
+ if (confInput) {
+ foundKeyboard = TRUE;
+ from = X_DEFAULT;
+ keyboardMsg = "first keyboard device";
+ }
}
/* 5. Built-in default. */
if (!foundKeyboard && xf86Info.forceInputDevices) {
- memset(&defKbd, 0, sizeof(defKbd));
- defKbd.inp_identifier = strdup("<default keyboard>");
- defKbd.inp_driver = strdup("kbd");
- confInput = &defKbd;
- foundKeyboard = TRUE;
- keyboardMsg = "default keyboard configuration";
- from = X_DEFAULT;
+ memset(&defKbd, 0, sizeof(defKbd));
+ defKbd.inp_identifier = strdup("<default keyboard>");
+ defKbd.inp_driver = strdup("kbd");
+ confInput = &defKbd;
+ foundKeyboard = TRUE;
+ keyboardMsg = "default keyboard configuration";
+ from = X_DEFAULT;
}
/* Add the core keyboard device to the layout, and set it to Core. */
if (foundKeyboard && confInput) {
- Keyboard = xf86AllocateInput();
- if (Keyboard)
- foundKeyboard = configInput(Keyboard, confInput, from);
- if (foundKeyboard) {
- Keyboard->options = xf86AddNewOption(Keyboard->options,
- "CoreKeyboard", "on");
- Keyboard->options = xf86AddNewOption(Keyboard->options,
+ Keyboard = xf86AllocateInput();
+ if (Keyboard)
+ foundKeyboard = configInput(Keyboard, confInput, from);
+ if (foundKeyboard) {
+ Keyboard->options = xf86AddNewOption(Keyboard->options,
+ "CoreKeyboard", "on");
+ Keyboard->options = xf86AddNewOption(Keyboard->options,
"driver",
confInput->inp_driver);
Keyboard->options =
xf86AddNewOption(Keyboard->options, "identifier",
confInput->inp_identifier);
- servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
- }
+ servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
+ }
}
if (!foundKeyboard && xf86Info.forceInputDevices) {
- /* This shouldn't happen. */
- xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
- xf86DeleteInput(Keyboard, 0);
- return FALSE;
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
+ xf86DeleteInput(Keyboard, 0);
+ return FALSE;
}
if (pointerMsg) {
- if (implicitLayout)
- xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
- pointerMsg);
- else
- xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
- "explicitly in the layout.\n"
- "\tUsing the %s.\n", pointerMsg);
+ if (implicitLayout)
+ xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
+ pointerMsg);
+ else
+ xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
+ "explicitly in the layout.\n"
+ "\tUsing the %s.\n", pointerMsg);
}
if (keyboardMsg) {
- if (implicitLayout)
- xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
- keyboardMsg);
- else
- xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
- "explicitly in the layout.\n"
- "\tUsing the %s.\n", keyboardMsg);
+ if (implicitLayout)
+ xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
+ keyboardMsg);
+ else
+ xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
+ "explicitly in the layout.\n"
+ "\tUsing the %s.\n", keyboardMsg);
}
if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
- const char *config_backend;
+ const char *config_backend;
#if defined(CONFIG_HAL)
- config_backend = "HAL";
+ config_backend = "HAL";
#elif defined(CONFIG_UDEV)
- config_backend = "udev";
+ config_backend = "udev";
#else
- config_backend = "wscons";
+ config_backend = "wscons";
#endif
- xf86Msg(X_INFO, "The server relies on %s to provide the list of "
- "input devices.\n\tIf no devices become available, "
- "reconfigure %s or disable AutoAddDevices.\n",
- config_backend, config_backend);
+ xf86Msg(X_INFO, "The server relies on %s to provide the list of "
+ "input devices.\n\tIf no devices become available, "
+ "reconfigure %s or disable AutoAddDevices.\n",
+ config_backend, config_backend);
#else
- xf86Msg(X_WARNING, "Hotplugging requested but the server was "
- "compiled without a config backend. "
- "No input devices were configured, the server "
- "will start without any input devices.\n");
+ xf86Msg(X_WARNING, "Hotplugging requested but the server was "
+ "compiled without a config backend. "
+ "No input devices were configured, the server "
+ "will start without any input devices.\n");
#endif
}
@@ -1402,12 +1407,12 @@ typedef enum {
} LayoutValues;
static OptionInfoRec LayoutOptions[] = {
- {LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING,
- {0}, FALSE},
- {LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN,
- {0}, FALSE},
- {-1, NULL, OPTV_NONE,
- {0}, FALSE},
+ { LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING,
+ {0}, FALSE },
+ { LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
};
static Bool
@@ -1422,28 +1427,28 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
*/
irp = layout->lay_input_lst;
while (irp) {
- count++;
- irp = (XF86ConfInputrefPtr) irp->list.next;
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
}
DebugF("Found %d input devices in the layout section %s\n",
- count, layout->lay_identifier);
+ count, layout->lay_identifier);
indp = xnfcalloc((count + 1), sizeof(InputInfoPtr));
indp[count] = NULL;
irp = layout->lay_input_lst;
count = 0;
while (irp) {
- indp[count] = xf86AllocateInput();
- if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
- do {
- free(indp[count]);
- } while (count--);
- free(indp);
- return FALSE;
- }
- indp[count]->options = xf86OptionListMerge(indp[count]->options,
- irp->iref_option_lst);
- count++;
- irp = (XF86ConfInputrefPtr) irp->list.next;
+ indp[count] = xf86AllocateInput();
+ if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
+ do {
+ free(indp[count]);
+ } while(count--);
+ free(indp);
+ return FALSE;
+ }
+ indp[count]->options = xf86OptionListMerge(indp[count]->options,
+ irp->iref_option_lst);
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
}
servlayoutp->inputs = indp;
@@ -1456,7 +1461,7 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
*/
static Bool
configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
- char *default_layout)
+ char *default_layout)
{
XF86ConfAdjacencyPtr adjp;
XF86ConfInactivePtr idp;
@@ -1469,7 +1474,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
int i = 0, j;
if (!servlayoutp)
- return FALSE;
+ return FALSE;
/*
* which layout section is the active one?
@@ -1479,18 +1484,18 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
*/
from = X_DEFAULT;
if (xf86LayoutName != NULL)
- from = X_CMDLINE;
+ from = X_CMDLINE;
else if (default_layout) {
- xf86LayoutName = default_layout;
- from = X_CONFIG;
+ xf86LayoutName = default_layout;
+ from = X_CONFIG;
}
if (xf86LayoutName != NULL) {
- if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
- xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
- xf86LayoutName);
- return FALSE;
- }
- conf_layout = l;
+ if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
+ xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
+ xf86LayoutName);
+ return FALSE;
+ }
+ conf_layout = l;
}
xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
adjp = conf_layout->lay_adjacency_lst;
@@ -1503,12 +1508,12 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
*/
while (adjp) {
count++;
- adjp = (XF86ConfAdjacencyPtr) adjp->list.next;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
DebugF("Found %d screens in the layout section %s",
count, conf_layout->lay_identifier);
- if (!count) /* alloc enough storage even if no screen is specified */
+ if (!count) /* alloc enough storage even if no screen is specified */
count = 1;
slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
@@ -1522,50 +1527,50 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
count = 0;
while (adjp) {
slp[count].screen = xnfcalloc(1, sizeof(confScreenRec));
- if (adjp->adj_scrnum < 0)
- scrnum = count;
- else
- scrnum = adjp->adj_scrnum;
- if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
- X_CONFIG)) {
- do {
- free(slp[count].screen);
- } while (count--);
- free(slp);
- return FALSE;
- }
- slp[count].x = adjp->adj_x;
- slp[count].y = adjp->adj_y;
- slp[count].refname = adjp->adj_refscreen;
- switch (adjp->adj_where) {
- case CONF_ADJ_OBSOLETE:
- slp[count].where = PosObsolete;
- slp[count].topname = adjp->adj_top_str;
- slp[count].bottomname = adjp->adj_bottom_str;
- slp[count].leftname = adjp->adj_left_str;
- slp[count].rightname = adjp->adj_right_str;
- break;
- case CONF_ADJ_ABSOLUTE:
- slp[count].where = PosAbsolute;
- break;
- case CONF_ADJ_RIGHTOF:
- slp[count].where = PosRightOf;
- break;
- case CONF_ADJ_LEFTOF:
- slp[count].where = PosLeftOf;
- break;
- case CONF_ADJ_ABOVE:
- slp[count].where = PosAbove;
- break;
- case CONF_ADJ_BELOW:
- slp[count].where = PosBelow;
- break;
- case CONF_ADJ_RELATIVE:
- slp[count].where = PosRelative;
- break;
- }
+ if (adjp->adj_scrnum < 0)
+ scrnum = count;
+ else
+ scrnum = adjp->adj_scrnum;
+ if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
+ X_CONFIG)) {
+ do {
+ free(slp[count].screen);
+ } while(count--);
+ free(slp);
+ return FALSE;
+ }
+ slp[count].x = adjp->adj_x;
+ slp[count].y = adjp->adj_y;
+ slp[count].refname = adjp->adj_refscreen;
+ switch (adjp->adj_where) {
+ case CONF_ADJ_OBSOLETE:
+ slp[count].where = PosObsolete;
+ slp[count].topname = adjp->adj_top_str;
+ slp[count].bottomname = adjp->adj_bottom_str;
+ slp[count].leftname = adjp->adj_left_str;
+ slp[count].rightname = adjp->adj_right_str;
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ slp[count].where = PosAbsolute;
+ break;
+ case CONF_ADJ_RIGHTOF:
+ slp[count].where = PosRightOf;
+ break;
+ case CONF_ADJ_LEFTOF:
+ slp[count].where = PosLeftOf;
+ break;
+ case CONF_ADJ_ABOVE:
+ slp[count].where = PosAbove;
+ break;
+ case CONF_ADJ_BELOW:
+ slp[count].where = PosBelow;
+ break;
+ case CONF_ADJ_RELATIVE:
+ slp[count].where = PosRelative;
+ break;
+ }
count++;
- adjp = (XF86ConfAdjacencyPtr) adjp->list.next;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
/* No screen was specified in the layout. take the first one from the
@@ -1573,54 +1578,54 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
* us */
if (!count) {
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
- if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
+ if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
0, X_CONFIG)) {
- free(slp[0].screen);
- free(slp);
- return FALSE;
- }
+ free(slp[0].screen);
+ free(slp);
+ return FALSE;
+ }
}
/* XXX Need to tie down the upper left screen. */
/* Fill in the refscreen and top/bottom/left/right values */
for (i = 0; i < count; i++) {
- for (j = 0; j < count; j++) {
- if (slp[i].refname &&
- strcmp(slp[i].refname, slp[j].screen->id) == 0) {
- slp[i].refscreen = slp[j].screen;
- }
- if (slp[i].topname &&
- strcmp(slp[i].topname, slp[j].screen->id) == 0) {
- slp[i].top = slp[j].screen;
- }
- if (slp[i].bottomname &&
- strcmp(slp[i].bottomname, slp[j].screen->id) == 0) {
- slp[i].bottom = slp[j].screen;
- }
- if (slp[i].leftname &&
- strcmp(slp[i].leftname, slp[j].screen->id) == 0) {
- slp[i].left = slp[j].screen;
- }
- if (slp[i].rightname &&
- strcmp(slp[i].rightname, slp[j].screen->id) == 0) {
- slp[i].right = slp[j].screen;
- }
- }
- if (slp[i].where != PosObsolete
+ for (j = 0; j < count; j++) {
+ if (slp[i].refname &&
+ strcmp(slp[i].refname, slp[j].screen->id) == 0) {
+ slp[i].refscreen = slp[j].screen;
+ }
+ if (slp[i].topname &&
+ strcmp(slp[i].topname, slp[j].screen->id) == 0) {
+ slp[i].top = slp[j].screen;
+ }
+ if (slp[i].bottomname &&
+ strcmp(slp[i].bottomname, slp[j].screen->id) == 0) {
+ slp[i].bottom = slp[j].screen;
+ }
+ if (slp[i].leftname &&
+ strcmp(slp[i].leftname, slp[j].screen->id) == 0) {
+ slp[i].left = slp[j].screen;
+ }
+ if (slp[i].rightname &&
+ strcmp(slp[i].rightname, slp[j].screen->id) == 0) {
+ slp[i].right = slp[j].screen;
+ }
+ }
+ if (slp[i].where != PosObsolete
&& slp[i].where != PosAbsolute && !slp[i].refscreen) {
- xf86Msg(X_ERROR, "Screen %s doesn't exist: deleting placement\n",
- slp[i].refname);
- slp[i].where = PosAbsolute;
- slp[i].x = 0;
- slp[i].y = 0;
- }
+ xf86Msg(X_ERROR,"Screen %s doesn't exist: deleting placement\n",
+ slp[i].refname);
+ slp[i].where = PosAbsolute;
+ slp[i].x = 0;
+ slp[i].y = 0;
+ }
}
if (!count)
- saved_count = 1;
+ saved_count = 1;
else
- saved_count = count;
+ saved_count = count;
/*
* Count the number of inactive devices.
*/
@@ -1628,7 +1633,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
idp = conf_layout->lay_inactive_lst;
while (idp) {
count++;
- idp = (XF86ConfInactivePtr) idp->list.next;
+ idp = (XF86ConfInactivePtr)idp->list.next;
}
DebugF("Found %d inactive devices in the layout section %s\n",
count, conf_layout->lay_identifier);
@@ -1637,14 +1642,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
idp = conf_layout->lay_inactive_lst;
count = 0;
while (idp) {
- if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
- goto bail;
+ if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
+ goto bail;
count++;
- idp = (XF86ConfInactivePtr) idp->list.next;
+ idp = (XF86ConfInactivePtr)idp->list.next;
}
if (!configInputDevices(conf_layout, servlayoutp))
- goto bail;
+ goto bail;
servlayoutp->id = conf_layout->lay_identifier;
servlayoutp->screens = slp;
@@ -1654,10 +1659,10 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
return TRUE;
- bail:
+bail:
do {
- free(slp[saved_count].screen);
- } while (saved_count--);
+ free(slp[saved_count].screen);
+ } while(saved_count--);
free(slp);
free(gdp);
return FALSE;
@@ -1678,7 +1683,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
XF86ConfLayoutRec layout;
if (!servlayoutp)
- return FALSE;
+ return FALSE;
/*
* which screen section is the active one?
@@ -1689,13 +1694,13 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
from = X_CONFIG;
if (xf86ScreenName != NULL) {
- if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
- xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
- xf86ScreenName);
- return FALSE;
- }
- conf_screen = s;
- from = X_CMDLINE;
+ if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
+ xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
+ xf86ScreenName);
+ return FALSE;
+ }
+ conf_screen = s;
+ from = X_CMDLINE;
}
/* We have exactly one screen */
@@ -1704,8 +1709,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
slp[1].screen = NULL;
if (!configScreen(slp[0].screen, conf_screen, 0, from)) {
- free(slp);
- return FALSE;
+ free(slp);
+ return FALSE;
}
servlayoutp->id = "(implicit)";
servlayoutp->screens = slp;
@@ -1715,15 +1720,15 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
memset(&layout, 0, sizeof(layout));
layout.lay_identifier = servlayoutp->id;
if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) {
- if (!configInputDevices(&layout, servlayoutp))
- return FALSE;
- from = X_DEFAULT;
+ if (!configInputDevices(&layout, servlayoutp))
+ return FALSE;
+ from = X_DEFAULT;
}
else {
- /* Set up an empty input device list, then look for some core devices. */
- indp = xnfalloc(sizeof(InputInfoPtr));
- *indp = NULL;
- servlayoutp->inputs = indp;
+ /* Set up an empty input device list, then look for some core devices. */
+ indp = xnfalloc(sizeof(InputInfoPtr));
+ *indp = NULL;
+ servlayoutp->inputs = indp;
}
return TRUE;
@@ -1736,31 +1741,31 @@ configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
XF86ConfVideoPortPtr conf_port;
xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n",
- conf_adaptor->va_identifier);
+ conf_adaptor->va_identifier);
adaptor->identifier = conf_adaptor->va_identifier;
adaptor->options = conf_adaptor->va_option_lst;
if (conf_adaptor->va_busid || conf_adaptor->va_driver) {
- xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
- return FALSE;
+ xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
+ return FALSE;
}
/*
* figure out how many videoport subsections there are and fill them in
*/
conf_port = conf_adaptor->va_port_lst;
- while (conf_port) {
+ while(conf_port) {
count++;
- conf_port = (XF86ConfVideoPortPtr) conf_port->list.next;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
}
adaptor->ports = xnfalloc((count) * sizeof(confXvPortRec));
adaptor->numports = count;
count = 0;
conf_port = conf_adaptor->va_port_lst;
- while (conf_port) {
- adaptor->ports[count].identifier = conf_port->vp_identifier;
- adaptor->ports[count].options = conf_port->vp_option_lst;
+ while(conf_port) {
+ adaptor->ports[count].identifier = conf_port->vp_identifier;
+ adaptor->ports[count].options = conf_port->vp_option_lst;
count++;
- conf_port = (XF86ConfVideoPortPtr) conf_port->list.next;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
}
return TRUE;
@@ -1768,7 +1773,7 @@ configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
static Bool
configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
- MessageType from)
+ MessageType from)
{
int count = 0;
XF86ConfDisplayPtr dispptr;
@@ -1784,98 +1789,98 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
}
xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
- scrnum);
+ scrnum);
/*
* now we fill in the elements of the screen
*/
- screenp->id = conf_screen->scrn_identifier;
- screenp->screennum = scrnum;
+ screenp->id = conf_screen->scrn_identifier;
+ screenp->screennum = scrnum;
screenp->defaultdepth = conf_screen->scrn_defaultdepth;
screenp->defaultbpp = conf_screen->scrn_defaultbpp;
screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp;
- screenp->monitor = xnfcalloc(1, sizeof(MonRec));
+ screenp->monitor = xnfcalloc(1, sizeof(MonRec));
/* If no monitor is specified, create a default one. */
if (!conf_screen->scrn_monitor) {
- XF86ConfMonitorRec defMon;
+ XF86ConfMonitorRec defMon;
- memset(&defMon, 0, sizeof(defMon));
- defMon.mon_identifier = "<default monitor>";
- if (!configMonitor(screenp->monitor, &defMon))
- return FALSE;
- defaultMonitor = TRUE;
+ memset(&defMon, 0, sizeof(defMon));
+ defMon.mon_identifier = "<default monitor>";
+ if (!configMonitor(screenp->monitor, &defMon))
+ return FALSE;
+ defaultMonitor = TRUE;
}
else {
- if (!configMonitor(screenp->monitor, conf_screen->scrn_monitor))
- return FALSE;
+ if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
+ return FALSE;
}
/* Configure the device. If there isn't one configured, attach to the
* first inactive one that we can configure. If there's none that work,
* set it to NULL so that the section can be autoconfigured later */
- screenp->device = xnfcalloc(1, sizeof(GDevRec));
+ screenp->device = xnfcalloc(1, sizeof(GDevRec));
if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) {
conf_screen->scrn_device = xf86configptr->conf_device_lst;
- xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
- "\tUsing the first device section listed.\n", screenp->id);
+ xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
+ "\tUsing the first device section listed.\n", screenp->id);
}
- if (configDevice(screenp->device, conf_screen->scrn_device, TRUE)) {
+ if (configDevice(screenp->device,conf_screen->scrn_device, TRUE)) {
screenp->device->myScreenSection = screenp;
}
else {
screenp->device = NULL;
}
screenp->options = conf_screen->scrn_option_lst;
-
+
/*
* figure out how many display subsections there are and fill them in
*/
dispptr = conf_screen->scrn_display_lst;
- while (dispptr) {
+ while(dispptr) {
count++;
- dispptr = (XF86ConfDisplayPtr) dispptr->list.next;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
}
- screenp->displays = xnfalloc((count) * sizeof(DispRec));
+ screenp->displays = xnfalloc((count) * sizeof(DispRec));
screenp->numdisplays = count;
-
+
/* Fill in the default Virtual size, if any */
if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) {
- for (count = 0, dispptr = conf_screen->scrn_display_lst;
- dispptr;
- dispptr = (XF86ConfDisplayPtr) dispptr->list.next, count++) {
- screenp->displays[count].virtualX = conf_screen->scrn_virtualX;
- screenp->displays[count].virtualY = conf_screen->scrn_virtualY;
- }
+ for (count = 0, dispptr = conf_screen->scrn_display_lst;
+ dispptr;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next, count++) {
+ screenp->displays[count].virtualX = conf_screen->scrn_virtualX;
+ screenp->displays[count].virtualY = conf_screen->scrn_virtualY;
+ }
}
/* Now do the per-Display Virtual sizes */
count = 0;
dispptr = conf_screen->scrn_display_lst;
- while (dispptr) {
- configDisplay(&(screenp->displays[count]), dispptr);
+ while(dispptr) {
+ configDisplay(&(screenp->displays[count]),dispptr);
count++;
- dispptr = (XF86ConfDisplayPtr) dispptr->list.next;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
}
/*
* figure out how many videoadaptor references there are and fill them in
*/
conf_adaptor = conf_screen->scrn_adaptor_lst;
- while (conf_adaptor) {
+ while(conf_adaptor) {
count++;
- conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
}
screenp->xvadaptors = xnfalloc((count) * sizeof(confXvAdaptorRec));
screenp->numxvadaptors = 0;
conf_adaptor = conf_screen->scrn_adaptor_lst;
- while (conf_adaptor) {
+ while(conf_adaptor) {
if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]),
- conf_adaptor->al_adaptor))
- screenp->numxvadaptors++;
- conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next;
+ conf_adaptor->al_adaptor))
+ screenp->numxvadaptors++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
}
if (defaultMonitor) {
- xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
- "\tUsing a default monitor configuration.\n", screenp->id);
+ xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
+ "\tUsing a default monitor configuration.\n", screenp->id);
}
return TRUE;
}
@@ -1886,26 +1891,26 @@ typedef enum {
} MonitorValues;
static OptionInfoRec MonitorOptions[] = {
- {MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN,
- {0}, FALSE},
- {MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ,
- {0}, FALSE},
- {-1, NULL, OPTV_NONE,
- {0}, FALSE},
+ { MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
};
static Bool
configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
{
int count;
- DisplayModePtr mode, last = NULL;
+ DisplayModePtr mode,last = NULL;
XF86ConfModeLinePtr cmodep;
XF86ConfModesPtr modes;
XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
- Gamma zeros = { 0.0, 0.0, 0.0 };
+ Gamma zeros = {0.0, 0.0, 0.0};
float badgamma = 0.0;
double maxPixClock;
-
+
xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier);
monitorp->id = conf_monitor->mon_identifier;
monitorp->vendor = conf_monitor->mon_vendor;
@@ -1921,16 +1926,16 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
/*
* fill in the monitor structure
- */
- for (count = 0;
+ */
+ for( count = 0 ;
count < conf_monitor->mon_n_hsync && count < MAX_HSYNC; count++) {
monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi;
monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo;
}
monitorp->nHsync = count;
- for (count = 0;
- count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH;
- count++) {
+ for( count = 0 ;
+ count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH;
+ count++) {
monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi;
monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo;
}
@@ -1940,22 +1945,22 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
* first we collect the mode lines from the UseModes directive
*/
while (modeslnk) {
- modes = xf86findModes(modeslnk->ml_modes_str,
- xf86configptr->conf_modes_lst);
- modeslnk->ml_modes = modes;
-
- /* now add the modes found in the modes
- section to the list of modes for this
- monitor unless it has been added before
- because we are reusing the same section
- for another screen */
+ modes = xf86findModes (modeslnk->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ modeslnk->ml_modes = modes;
+
+ /* now add the modes found in the modes
+ section to the list of modes for this
+ monitor unless it has been added before
+ because we are reusing the same section
+ for another screen */
if (xf86itemNotSublist((GenericListPtr) conf_monitor->mon_modeline_lst,
- (GenericListPtr) modes->mon_modeline_lst)) {
- conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
+ (GenericListPtr)modes->mon_modeline_lst)) {
+ conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
xf86addListItem((GenericListPtr) conf_monitor->mon_modeline_lst,
- (GenericListPtr) modes->mon_modeline_lst);
- }
- modeslnk = modeslnk->list.next;
+ (GenericListPtr)modes->mon_modeline_lst);
+ }
+ modeslnk = modeslnk->list.next;
}
/*
@@ -1964,23 +1969,23 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
* is double linked
*/
cmodep = conf_monitor->mon_modeline_lst;
- while (cmodep) {
+ while( cmodep ) {
mode = xnfcalloc(1, sizeof(DisplayModeRec));
- mode->type = 0;
- mode->Clock = cmodep->ml_clock;
- mode->HDisplay = cmodep->ml_hdisplay;
+ mode->type = 0;
+ mode->Clock = cmodep->ml_clock;
+ mode->HDisplay = cmodep->ml_hdisplay;
mode->HSyncStart = cmodep->ml_hsyncstart;
- mode->HSyncEnd = cmodep->ml_hsyncend;
- mode->HTotal = cmodep->ml_htotal;
- mode->VDisplay = cmodep->ml_vdisplay;
+ mode->HSyncEnd = cmodep->ml_hsyncend;
+ mode->HTotal = cmodep->ml_htotal;
+ mode->VDisplay = cmodep->ml_vdisplay;
mode->VSyncStart = cmodep->ml_vsyncstart;
- mode->VSyncEnd = cmodep->ml_vsyncend;
- mode->VTotal = cmodep->ml_vtotal;
- mode->Flags = cmodep->ml_flags;
- mode->HSkew = cmodep->ml_hskew;
- mode->VScan = cmodep->ml_vscan;
- mode->name = xnfstrdup(cmodep->ml_identifier);
- if (last) {
+ mode->VSyncEnd = cmodep->ml_vsyncend;
+ mode->VTotal = cmodep->ml_vtotal;
+ mode->Flags = cmodep->ml_flags;
+ mode->HSkew = cmodep->ml_hskew;
+ mode->VScan = cmodep->ml_vscan;
+ mode->name = xnfstrdup(cmodep->ml_identifier);
+ if( last ) {
mode->prev = last;
last->next = mode;
}
@@ -1992,53 +1997,53 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
mode->prev = NULL;
}
last = mode;
- cmodep = (XF86ConfModeLinePtr) cmodep->list.next;
+ cmodep = (XF86ConfModeLinePtr)cmodep->list.next;
}
- if (last) {
- last->next = NULL;
+ if(last){
+ last->next = NULL;
}
monitorp->Last = last;
/* add the (VESA) default modes */
- if (!addDefaultModes(monitorp))
- return FALSE;
+ if (! addDefaultModes(monitorp) )
+ return FALSE;
if (conf_monitor->mon_gamma_red > GAMMA_ZERO)
- monitorp->gamma.red = conf_monitor->mon_gamma_red;
+ monitorp->gamma.red = conf_monitor->mon_gamma_red;
if (conf_monitor->mon_gamma_green > GAMMA_ZERO)
- monitorp->gamma.green = conf_monitor->mon_gamma_green;
+ monitorp->gamma.green = conf_monitor->mon_gamma_green;
if (conf_monitor->mon_gamma_blue > GAMMA_ZERO)
- monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
-
+ monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
+
/* Check that the gamma values are within range */
if (monitorp->gamma.red > GAMMA_ZERO &&
(monitorp->gamma.red < GAMMA_MIN || monitorp->gamma.red > GAMMA_MAX)) {
- badgamma = monitorp->gamma.red;
+ badgamma = monitorp->gamma.red;
}
else if (monitorp->gamma.green > GAMMA_ZERO &&
- (monitorp->gamma.green < GAMMA_MIN ||
- monitorp->gamma.green > GAMMA_MAX)) {
- badgamma = monitorp->gamma.green;
+ (monitorp->gamma.green < GAMMA_MIN ||
+ monitorp->gamma.green > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.green;
}
else if (monitorp->gamma.blue > GAMMA_ZERO &&
- (monitorp->gamma.blue < GAMMA_MIN ||
- monitorp->gamma.blue > GAMMA_MAX)) {
- badgamma = monitorp->gamma.blue;
+ (monitorp->gamma.blue < GAMMA_MIN ||
+ monitorp->gamma.blue > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.blue;
}
if (badgamma > GAMMA_ZERO) {
- xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
- badgamma, GAMMA_MIN, GAMMA_MAX);
- return FALSE;
+ xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
+ badgamma, GAMMA_MIN, GAMMA_MAX);
+ return FALSE;
}
xf86ProcessOptions(-1, monitorp->options, MonitorOptions);
xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING,
&monitorp->reducedblanking);
if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
- &maxPixClock) == TRUE) {
- monitorp->maxPixClock = (int) maxPixClock;
+ &maxPixClock) == TRUE) {
+ monitorp->maxPixClock = (int) maxPixClock;
}
-
+
return TRUE;
}
@@ -2048,15 +2053,15 @@ lookupVisual(const char *visname)
int i;
if (!visname || !*visname)
- return -1;
+ return -1;
for (i = 0; i <= DirectColor; i++) {
- if (!xf86nameCompare(visname, xf86VisualNames[i]))
- break;
+ if (!xf86nameCompare(visname, xf86VisualNames[i]))
+ break;
}
if (i <= DirectColor)
- return i;
+ return i;
return -1;
}
@@ -2066,53 +2071,53 @@ configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display)
{
int count = 0;
XF86ModePtr modep;
-
- displayp->frameX0 = conf_display->disp_frameX0;
- displayp->frameY0 = conf_display->disp_frameY0;
- displayp->virtualX = conf_display->disp_virtualX;
- displayp->virtualY = conf_display->disp_virtualY;
- displayp->depth = conf_display->disp_depth;
- displayp->fbbpp = conf_display->disp_bpp;
- displayp->weight.red = conf_display->disp_weight.red;
- displayp->weight.green = conf_display->disp_weight.green;
- displayp->weight.blue = conf_display->disp_weight.blue;
- displayp->blackColour.red = conf_display->disp_black.red;
+
+ displayp->frameX0 = conf_display->disp_frameX0;
+ displayp->frameY0 = conf_display->disp_frameY0;
+ displayp->virtualX = conf_display->disp_virtualX;
+ displayp->virtualY = conf_display->disp_virtualY;
+ displayp->depth = conf_display->disp_depth;
+ displayp->fbbpp = conf_display->disp_bpp;
+ displayp->weight.red = conf_display->disp_weight.red;
+ displayp->weight.green = conf_display->disp_weight.green;
+ displayp->weight.blue = conf_display->disp_weight.blue;
+ displayp->blackColour.red = conf_display->disp_black.red;
displayp->blackColour.green = conf_display->disp_black.green;
- displayp->blackColour.blue = conf_display->disp_black.blue;
- displayp->whiteColour.red = conf_display->disp_white.red;
+ displayp->blackColour.blue = conf_display->disp_black.blue;
+ displayp->whiteColour.red = conf_display->disp_white.red;
displayp->whiteColour.green = conf_display->disp_white.green;
- displayp->whiteColour.blue = conf_display->disp_white.blue;
- displayp->options = conf_display->disp_option_lst;
+ displayp->whiteColour.blue = conf_display->disp_white.blue;
+ displayp->options = conf_display->disp_option_lst;
if (conf_display->disp_visual) {
- displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
- if (displayp->defaultVisual == -1) {
- xf86ConfigError("Invalid visual name: \"%s\"",
- conf_display->disp_visual);
- return FALSE;
- }
+ displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
+ if (displayp->defaultVisual == -1) {
+ xf86ConfigError("Invalid visual name: \"%s\"",
+ conf_display->disp_visual);
+ return FALSE;
+ }
}
else {
- displayp->defaultVisual = -1;
+ displayp->defaultVisual = -1;
}
-
+
/*
* now hook in the modes
*/
modep = conf_display->disp_mode_lst;
- while (modep) {
+ while(modep) {
count++;
- modep = (XF86ModePtr) modep->list.next;
+ modep = (XF86ModePtr)modep->list.next;
}
- displayp->modes = xnfalloc((count + 1) * sizeof(char *));
+ displayp->modes = xnfalloc((count+1) * sizeof(char*));
modep = conf_display->disp_mode_lst;
count = 0;
- while (modep) {
+ while(modep) {
displayp->modes[count] = modep->mode_name;
count++;
- modep = (XF86ModePtr) modep->list.next;
+ modep = (XF86ModePtr)modep->list.next;
}
displayp->modes[count] = NULL;
-
+
return TRUE;
}
@@ -2126,11 +2131,11 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
}
if (active)
- xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
- conf_device->dev_identifier);
+ xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
+ conf_device->dev_identifier);
else
- xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
- conf_device->dev_identifier);
+ xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
+ conf_device->dev_identifier);
devicep->identifier = conf_device->dev_identifier;
devicep->vendor = conf_device->dev_vendor;
@@ -2153,16 +2158,16 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
devicep->screen = conf_device->dev_screen;
for (i = 0; i < MAXDACSPEEDS; i++) {
- if (i < CONF_MAXDACSPEEDS)
+ if (i < CONF_MAXDACSPEEDS)
devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i];
- else
- devicep->dacSpeeds[i] = 0;
+ else
+ devicep->dacSpeeds[i] = 0;
}
devicep->numclocks = conf_device->dev_clocks;
if (devicep->numclocks > MAXCLOCKS)
- devicep->numclocks = MAXCLOCKS;
+ devicep->numclocks = MAXCLOCKS;
for (i = 0; i < devicep->numclocks; i++) {
- devicep->clock[i] = conf_device->dev_clock[i];
+ devicep->clock[i] = conf_device->dev_clock[i];
}
devicep->claimed = FALSE;
@@ -2173,21 +2178,21 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
static void
configDRI(XF86ConfDRIPtr drip)
{
- struct group *grp;
+ struct group *grp;
- xf86ConfigDRI.group = -1;
- xf86ConfigDRI.mode = 0;
+ xf86ConfigDRI.group = -1;
+ xf86ConfigDRI.mode = 0;
if (drip) {
- if (drip->dri_group_name) {
- if ((grp = getgrnam(drip->dri_group_name)))
- xf86ConfigDRI.group = grp->gr_gid;
+ if (drip->dri_group_name) {
+ if ((grp = getgrnam(drip->dri_group_name)))
+ xf86ConfigDRI.group = grp->gr_gid;
}
else {
- if (drip->dri_group >= 0)
- xf86ConfigDRI.group = drip->dri_group;
- }
- xf86ConfigDRI.mode = drip->dri_mode;
+ if (drip->dri_group >= 0)
+ xf86ConfigDRI.group = drip->dri_group;
+ }
+ xf86ConfigDRI.mode = drip->dri_mode;
}
}
#endif
@@ -2198,51 +2203,51 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
XF86OptionPtr o;
if (conf_ext && conf_ext->ext_option_lst) {
- for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) {
- char *name = xf86OptionName(o);
- char *val = xf86OptionValue(o);
- char *n;
- Bool enable = TRUE;
-
- /* Handle "No<ExtensionName>" */
- n = xf86NormalizeName(name);
- if (strncmp(n, "no", 2) == 0) {
- name += 2;
- enable = FALSE;
- }
-
- if (!val ||
- xf86NameCmp(val, "enable") == 0 ||
- xf86NameCmp(val, "enabled") == 0 ||
- xf86NameCmp(val, "on") == 0 ||
- xf86NameCmp(val, "1") == 0 ||
+ for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) {
+ char *name = xf86OptionName(o);
+ char *val = xf86OptionValue(o);
+ char *n;
+ Bool enable = TRUE;
+
+ /* Handle "No<ExtensionName>" */
+ n = xf86NormalizeName(name);
+ if (strncmp(n, "no", 2) == 0) {
+ name += 2;
+ enable = FALSE;
+ }
+
+ if (!val ||
+ xf86NameCmp(val, "enable") == 0 ||
+ xf86NameCmp(val, "enabled") == 0 ||
+ xf86NameCmp(val, "on") == 0 ||
+ xf86NameCmp(val, "1") == 0 ||
xf86NameCmp(val, "yes") == 0 || xf86NameCmp(val, "true") == 0) {
- /* NOTHING NEEDED -- enabling is handled below */
+ /* NOTHING NEEDED -- enabling is handled below */
}
else if (xf86NameCmp(val, "disable") == 0 ||
- xf86NameCmp(val, "disabled") == 0 ||
- xf86NameCmp(val, "off") == 0 ||
- xf86NameCmp(val, "0") == 0 ||
- xf86NameCmp(val, "no") == 0 ||
- xf86NameCmp(val, "false") == 0) {
- enable = !enable;
+ xf86NameCmp(val, "disabled") == 0 ||
+ xf86NameCmp(val, "off") == 0 ||
+ xf86NameCmp(val, "0") == 0 ||
+ xf86NameCmp(val, "no") == 0 ||
+ xf86NameCmp(val, "false") == 0) {
+ enable = !enable;
}
else {
- xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
- free(n);
- continue;
- }
-
- if (EnableDisableExtension(name, enable)) {
- xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n",
- name, enable ? "enabled" : "disabled");
+ xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
+ free(n);
+ continue;
+ }
+
+ if (EnableDisableExtension(name, enable)) {
+ xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n",
+ name, enable ? "enabled" : "disabled");
}
else {
- xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
+ xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
name);
- }
- free(n);
- }
+ }
+ free(n);
+ }
}
}
@@ -2265,10 +2270,10 @@ modeIsPresent(DisplayModePtr mode, MonPtr monitorp)
/* all I can think of is a linear search... */
while (knownmodes != NULL) {
- if (!strcmp(mode->name, knownmodes->name) &&
- !(knownmodes->type & M_T_DEFAULT))
- return TRUE;
- knownmodes = knownmodes->next;
+ if(!strcmp(mode->name, knownmodes->name) &&
+ !(knownmodes->type & M_T_DEFAULT))
+ return TRUE;
+ knownmodes = knownmodes->next;
}
return FALSE;
}
@@ -2281,14 +2286,14 @@ addDefaultModes(MonPtr monitorp)
int i = 0;
for (i = 0; i < xf86NumDefaultModes; i++) {
- mode = xf86DuplicateMode(&xf86DefaultModes[i]);
+ mode = xf86DuplicateMode(&xf86DefaultModes[i]);
if (!modeIsPresent(mode, monitorp)) {
- monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
- last = mode;
+ monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
+ last = mode;
}
else {
- free(mode);
- }
+ free(mode);
+ }
}
monitorp->Last = last;
@@ -2329,7 +2334,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout)
do {
*current = *(current + 1);
current++;
- } while (*current);
+ } while(*current);
}
else
dev++;
@@ -2348,66 +2353,66 @@ xf86HandleConfigFile(Bool autoconfig)
Bool implicit_layout = FALSE;
if (!autoconfig) {
- char *filename, *dirname, *sysdirname;
- const char *filesearch, *dirsearch;
- MessageType filefrom = X_DEFAULT;
- MessageType dirfrom = X_DEFAULT;
-
- if (!xf86PrivsElevated()) {
- filesearch = ALL_CONFIGPATH;
- dirsearch = ALL_CONFIGDIRPATH;
- }
- else {
- filesearch = RESTRICTED_CONFIGPATH;
- dirsearch = RESTRICTED_CONFIGDIRPATH;
- }
+ char *filename, *dirname, *sysdirname;
+ const char *filesearch, *dirsearch;
+ MessageType filefrom = X_DEFAULT;
+ MessageType dirfrom = X_DEFAULT;
- if (xf86ConfigFile)
- filefrom = X_CMDLINE;
- if (xf86ConfigDir)
- dirfrom = X_CMDLINE;
-
- xf86initConfigFiles();
- sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH, NULL,
- PROJECTROOT);
- dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT);
- filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT);
- if (filename) {
- xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename);
- xf86ConfigFile = xnfstrdup(filename);
+ if (!xf86PrivsElevated()) {
+ filesearch = ALL_CONFIGPATH;
+ dirsearch = ALL_CONFIGDIRPATH;
}
else {
- if (xf86ConfigFile)
- xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n",
- xf86ConfigFile);
- }
- if (dirname) {
- xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n",
- dirname);
- xf86ConfigDir = xnfstrdup(dirname);
+ filesearch = RESTRICTED_CONFIGPATH;
+ dirsearch = RESTRICTED_CONFIGDIRPATH;
+ }
+
+ if (xf86ConfigFile)
+ filefrom = X_CMDLINE;
+ if (xf86ConfigDir)
+ dirfrom = X_CMDLINE;
+
+ xf86initConfigFiles();
+ sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH, NULL,
+ PROJECTROOT);
+ dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT);
+ filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT);
+ if (filename) {
+ xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename);
+ xf86ConfigFile = xnfstrdup(filename);
}
else {
- if (xf86ConfigDir)
- xf86Msg(X_ERROR,
- "Unable to locate/open config directory: \"%s\"\n",
- xf86ConfigDir);
+ if (xf86ConfigFile)
+ xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n",
+ xf86ConfigFile);
+ }
+ if (dirname) {
+ xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n",
+ dirname);
+ xf86ConfigDir = xnfstrdup(dirname);
}
- if (sysdirname)
- xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n",
- sysdirname);
- if (!filename && !dirname && !sysdirname)
- return CONFIG_NOFILE;
+ else {
+ if (xf86ConfigDir)
+ xf86Msg(X_ERROR,
+ "Unable to locate/open config directory: \"%s\"\n",
+ xf86ConfigDir);
+ }
+ if (sysdirname)
+ xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n",
+ sysdirname);
+ if (!filename && !dirname && !sysdirname)
+ return CONFIG_NOFILE;
- free(filename);
- free(dirname);
- free(sysdirname);
+ free(filename);
+ free(dirname);
+ free(sysdirname);
}
- if ((xf86configptr = xf86readConfigFile()) == NULL) {
- xf86Msg(X_ERROR, "Problem parsing the config file\n");
- return CONFIG_PARSE_ERROR;
+ if ((xf86configptr = xf86readConfigFile ()) == NULL) {
+ xf86Msg(X_ERROR, "Problem parsing the config file\n");
+ return CONFIG_PARSE_ERROR;
}
- xf86closeConfigFile();
+ xf86closeConfigFile ();
/* Initialise a few things. */
@@ -2423,65 +2428,65 @@ xf86HandleConfigFile(Bool autoconfig)
/* First check if a layout section is present, and if it is valid. */
if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
- if (xf86ScreenName == NULL) {
- xf86Msg(X_DEFAULT,
- "No Layout section. Using the first Screen section.\n");
- }
- if (!configImpliedLayout(&xf86ConfigLayout,
- xf86configptr->conf_screen_lst,
- xf86configptr)) {
+ if (xf86ScreenName == NULL) {
+ xf86Msg(X_DEFAULT,
+ "No Layout section. Using the first Screen section.\n");
+ }
+ if (!configImpliedLayout(&xf86ConfigLayout,
+ xf86configptr->conf_screen_lst,
+ xf86configptr)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
- return CONFIG_PARSE_ERROR;
- }
- implicit_layout = TRUE;
+ return CONFIG_PARSE_ERROR;
+ }
+ implicit_layout = TRUE;
}
else {
- if (xf86configptr->conf_flags != NULL) {
- char *dfltlayout = NULL;
- pointer optlist = xf86configptr->conf_flags->flg_option_lst;
-
- if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
+ if (xf86configptr->conf_flags != NULL) {
+ char *dfltlayout = NULL;
+ pointer optlist = xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
dfltlayout =
xf86SetStrOption(optlist, "defaultserverlayout", NULL);
if (!configLayout
(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
- dfltlayout)) {
- xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
- return CONFIG_PARSE_ERROR;
- }
+ dfltlayout)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
}
else {
- if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
- NULL)) {
- xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
- return CONFIG_PARSE_ERROR;
- }
- }
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ NULL)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ }
}
xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions);
#ifdef XSERVER_LIBPCIACCESS
if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) {
- ; /* IsolateDevice specified; overrides SingleCard */
+ ; /* IsolateDevice specified; overrides SingleCard */
}
else {
- xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard);
- if (singlecard)
- scanptr = xf86ConfigLayout.screens->screen->device->busID;
+ xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard);
+ if (singlecard)
+ scanptr = xf86ConfigLayout.screens->screen->device->busID;
}
if (scanptr) {
- if (strncmp(scanptr, "PCI:", 4) != 0) {
- xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
- "\tIgnoring IsolateDevice option.\n");
+ if (strncmp(scanptr, "PCI:", 4) != 0) {
+ xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
+ "\tIgnoring IsolateDevice option.\n");
}
else
- xf86PciIsolateDevice(scanptr);
+ xf86PciIsolateDevice(scanptr);
}
#endif
/* Now process everything else */
- if (!configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options)) {
- ErrorF("Problem when converting the config data structures\n");
- return CONFIG_PARSE_ERROR;
+ if (!configServerFlags(xf86configptr->conf_flags,xf86ConfigLayout.options)){
+ ErrorF ("Problem when converting the config data structures\n");
+ return CONFIG_PARSE_ERROR;
}
configFiles(xf86configptr->conf_files);
@@ -2498,13 +2503,13 @@ xf86HandleConfigFile(Bool autoconfig)
*/
#ifdef XF86VIDMODE
if (xf86VidModeDisabled)
- xf86Info.vidModeEnabled = FALSE;
+ xf86Info.vidModeEnabled = FALSE;
if (xf86VidModeAllowNonLocal)
- xf86Info.vidModeAllowNonLocal = TRUE;
+ xf86Info.vidModeAllowNonLocal = TRUE;
#endif
if (xf86AllowMouseOpenFail)
- xf86Info.allowMouseOpenFail = TRUE;
+ xf86Info.allowMouseOpenFail = TRUE;
return CONFIG_OK;
}
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ba80acad7..5d777e13e 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -91,20 +91,20 @@
#include <hotplug.h>
#ifdef XF86PM
-void (*xf86OSPMClose) (void) = NULL;
+void (*xf86OSPMClose)(void) = NULL;
#endif
static Bool xorgHWOpenConsole = FALSE;
/* Common pixmap formats */
static PixmapFormatRec formats[MAXFORMATS] = {
- {1, 1, BITMAP_SCANLINE_PAD},
- {4, 8, BITMAP_SCANLINE_PAD},
- {8, 8, BITMAP_SCANLINE_PAD},
- {15, 16, BITMAP_SCANLINE_PAD},
- {16, 16, BITMAP_SCANLINE_PAD},
- {24, 32, BITMAP_SCANLINE_PAD},
- {32, 32, BITMAP_SCANLINE_PAD},
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+ { 32, 32, BITMAP_SCANLINE_PAD },
};
static int numFormats = 7;
@@ -124,241 +124,241 @@ static void
xf86PrintBanner(void)
{
#if PRE_RELEASE
- xf86ErrorFVerb(0, "\n"
+ xf86ErrorFVerb(0, "\n"
"This is a pre-release version of the X server from "
XVENDORNAME ".\n" "It is not supported in any way.\n"
- "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
- "Select the \"xorg\" product for bugs you find in this release.\n"
- "Before reporting bugs in pre-release versions please check the\n"
- "latest version in the X.Org Foundation git repository.\n"
- "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
+ "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
+ "Select the \"xorg\" product for bugs you find in this release.\n"
+ "Before reporting bugs in pre-release versions please check the\n"
+ "latest version in the X.Org Foundation git repository.\n"
+ "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
#endif
- xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d",
+ xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d",
XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH);
#if XORG_VERSION_SNAP > 0
- xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP);
+ xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP);
#endif
#if XORG_VERSION_SNAP >= 900
- /* When the minor number is 99, that signifies that the we are making
- * a release candidate for a major version. (X.0.0)
- * When the patch number is 99, that signifies that the we are making
- * a release candidate for a minor version. (X.Y.0)
- * When the patch number is < 99, then we are making a release
- * candidate for the next point release. (X.Y.Z)
- */
+ /* When the minor number is 99, that signifies that the we are making
+ * a release candidate for a major version. (X.0.0)
+ * When the patch number is 99, that signifies that the we are making
+ * a release candidate for a minor version. (X.Y.0)
+ * When the patch number is < 99, then we are making a release
+ * candidate for the next point release. (X.Y.Z)
+ */
#if XORG_VERSION_MINOR >= 99
- xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR + 1,
- XORG_VERSION_SNAP - 900);
+ xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1,
+ XORG_VERSION_SNAP - 900);
#elif XORG_VERSION_PATCH == 99
- xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900);
+ xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900);
#else
- xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1,
- XORG_VERSION_SNAP - 900);
+ xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1,
+ XORG_VERSION_SNAP - 900);
#endif
#endif
#ifdef XORG_CUSTOM_VERSION
- xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION);
+ xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION);
#endif
#ifndef XORG_DATE
-#define XORG_DATE "Unknown"
+# define XORG_DATE "Unknown"
#endif
- xf86ErrorFVerb(0, "\nRelease Date: %s\n", XORG_DATE);
- xf86ErrorFVerb(0, "X Protocol Version %d, Revision %d\n",
- X_PROTOCOL, X_PROTOCOL_REVISION);
- xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR);
+ xf86ErrorFVerb(0, "\nRelease Date: %s\n", XORG_DATE);
+ xf86ErrorFVerb(0, "X Protocol Version %d, Revision %d\n",
+ X_PROTOCOL, X_PROTOCOL_REVISION);
+ xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR);
#ifdef HAS_UTSNAME
- {
- struct utsname name;
+ {
+ struct utsname name;
- /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
- and Irix) and Single Unix Spec 3 just say that non-negative is success.
- All agree that failure is represented by a negative number.
- */
- if (uname(&name) >= 0) {
- xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
+ /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
+ and Irix) and Single Unix Spec 3 just say that non-negative is success.
+ All agree that failure is represented by a negative number.
+ */
+ if (uname(&name) >= 0) {
+ xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
name.sysname, name.nodename, name.release,
name.version, name.machine);
#ifdef linux
- do {
- char buf[80];
- int fd = open("/proc/cmdline", O_RDONLY);
-
- if (fd != -1) {
- xf86ErrorFVerb(0, "Kernel command line: ");
- memset(buf, 0, 80);
- while (read(fd, buf, 80) > 0) {
- xf86ErrorFVerb(0, "%.80s", buf);
- memset(buf, 0, 80);
- }
- close(fd);
- }
- } while (0);
+ do {
+ char buf[80];
+ int fd = open("/proc/cmdline", O_RDONLY);
+
+ if (fd != -1) {
+ xf86ErrorFVerb(0, "Kernel command line: ");
+ memset(buf, 0, 80);
+ while (read(fd, buf, 80) > 0) {
+ xf86ErrorFVerb(0, "%.80s", buf);
+ memset(buf, 0, 80);
+ }
+ close(fd);
+ }
+ } while (0);
#endif
- }
}
+ }
#endif
#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
- {
- struct tm t;
- char buf[100];
-
- memset(&t, 0, sizeof(t));
- memset(buf, 0, sizeof(buf));
- t.tm_mday = BUILD_DATE % 100;
- t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
- t.tm_year = BUILD_DATE / 10000 - 1900;
+ {
+ struct tm t;
+ char buf[100];
+
+ memset(&t, 0, sizeof(t));
+ memset(buf, 0, sizeof(buf));
+ t.tm_mday = BUILD_DATE % 100;
+ t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
+ t.tm_year = BUILD_DATE / 10000 - 1900;
#if defined(BUILD_TIME)
- t.tm_sec = BUILD_TIME % 100;
- t.tm_min = (BUILD_TIME / 100) % 100;
- t.tm_hour = (BUILD_TIME / 10000) % 100;
- if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
- xf86ErrorFVerb(0, "Build Date: %s\n", buf);
+ t.tm_sec = BUILD_TIME % 100;
+ t.tm_min = (BUILD_TIME / 100) % 100;
+ t.tm_hour = (BUILD_TIME / 10000) % 100;
+ if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
+ xf86ErrorFVerb(0, "Build Date: %s\n", buf);
#else
- if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
- xf86ErrorFVerb(0, "Build Date: %s\n", buf);
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ xf86ErrorFVerb(0, "Build Date: %s\n", buf);
#endif
- }
+ }
#endif
#if defined(BUILDERSTRING)
- xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
+ xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
#endif
- xf86ErrorFVerb(0, "Current version of pixman: %s\n",
- pixman_version_string());
- xf86ErrorFVerb(0, "\tBefore reporting problems, check "
- "" __VENDORDWEBSUPPORT__ "\n"
- "\tto make sure that you have the latest version.\n");
+ xf86ErrorFVerb(0, "Current version of pixman: %s\n",
+ pixman_version_string());
+ xf86ErrorFVerb(0, "\tBefore reporting problems, check "
+ ""__VENDORDWEBSUPPORT__"\n"
+ "\tto make sure that you have the latest version.\n");
}
static void
xf86PrintMarkers(void)
{
- LogPrintMarkers();
+ LogPrintMarkers();
}
Bool
xf86PrivsElevated(void)
{
- static Bool privsTested = FALSE;
- static Bool privsElevated = TRUE;
+ static Bool privsTested = FALSE;
+ static Bool privsElevated = TRUE;
- if (!privsTested) {
+ if (!privsTested) {
#if defined(WIN32)
- privsElevated = FALSE;
+ privsElevated = FALSE;
#else
- if ((getuid() != geteuid()) || (getgid() != getegid())) {
- privsElevated = TRUE;
+ if ((getuid() != geteuid()) || (getgid() != getegid())) {
+ privsElevated = TRUE;
}
else {
#if defined(HAVE_ISSETUGID)
- privsElevated = issetugid();
+ privsElevated = issetugid();
#elif defined(HAVE_GETRESUID)
- uid_t ruid, euid, suid;
- gid_t rgid, egid, sgid;
-
- if ((getresuid(&ruid, &euid, &suid) == 0) &&
- (getresgid(&rgid, &egid, &sgid) == 0)) {
- privsElevated = (euid != suid) || (egid != sgid);
- }
- else {
- printf("Failed getresuid or getresgid");
- /* Something went wrong, make defensive assumption */
- privsElevated = TRUE;
- }
+ uid_t ruid, euid, suid;
+ gid_t rgid, egid, sgid;
+
+ if ((getresuid(&ruid, &euid, &suid) == 0) &&
+ (getresgid(&rgid, &egid, &sgid) == 0)) {
+ privsElevated = (euid != suid) || (egid != sgid);
+ }
+ else {
+ printf("Failed getresuid or getresgid");
+ /* Something went wrong, make defensive assumption */
+ privsElevated = TRUE;
+ }
#else
- if (getuid() == 0) {
- /* running as root: uid==euid==0 */
- privsElevated = FALSE;
- }
- else {
- /*
- * If there are saved ID's the process might still be privileged
- * even though the above test succeeded. If issetugid() and
- * getresgid() aren't available, test this by trying to set
- * euid to 0.
- */
- unsigned int oldeuid;
-
- oldeuid = geteuid();
-
- if (seteuid(0) != 0) {
- privsElevated = FALSE;
+ if (getuid()==0) {
+ /* running as root: uid==euid==0 */
+ privsElevated = FALSE;
+ }
+ else {
+ /*
+ * If there are saved ID's the process might still be privileged
+ * even though the above test succeeded. If issetugid() and
+ * getresgid() aren't available, test this by trying to set
+ * euid to 0.
+ */
+ unsigned int oldeuid;
+
+ oldeuid = geteuid();
+
+ if (seteuid(0) != 0) {
+ privsElevated = FALSE;
}
else {
- if (seteuid(oldeuid) != 0) {
- FatalError("Failed to drop privileges. Exiting\n");
- }
- privsElevated = TRUE;
- }
- }
-#endif
+ if (seteuid(oldeuid) != 0) {
+ FatalError("Failed to drop privileges. Exiting\n");
+ }
+ privsElevated = TRUE;
}
+ }
#endif
- privsTested = TRUE;
}
- return privsElevated;
+#endif
+ privsTested = TRUE;
+ }
+ return privsElevated;
}
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
- int ret = TRUE;
- int err = Success;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootWinPropPtr pProp;
- CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
- dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
-
- DebugF("xf86CreateRootWindow(%p)\n", pWin);
-
- if (pScreen->CreateWindow != xf86CreateRootWindow) {
- /* Can't find hook we are hung on */
- xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */ ,
- "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
- (void *) xf86CreateRootWindow,
- (void *) pScreen->CreateWindow);
- }
-
- /* Unhook this function ... */
- pScreen->CreateWindow = CreateWindow;
- dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
-
- /* ... and call the previous CreateWindow fuction, if any */
- if (NULL != pScreen->CreateWindow) {
- ret = (*pScreen->CreateWindow) (pWin);
- }
-
- /* Now do our stuff */
- if (xf86RegisteredPropertiesTable != NULL) {
- if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
- for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
+ int ret = TRUE;
+ int err = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootWinPropPtr pProp;
+ CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
+
+ DebugF("xf86CreateRootWindow(%p)\n", pWin);
+
+ if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
+ /* Can't find hook we are hung on */
+ xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
+ "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
+ (void *)xf86CreateRootWindow,
+ (void *)pScreen->CreateWindow );
+ }
+
+ /* Unhook this function ... */
+ pScreen->CreateWindow = CreateWindow;
+ dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
+
+ /* ... and call the previous CreateWindow fuction, if any */
+ if (NULL!=pScreen->CreateWindow) {
+ ret = (*pScreen->CreateWindow)(pWin);
+ }
+
+ /* Now do our stuff */
+ if (xf86RegisteredPropertiesTable != NULL) {
+ if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
+ for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
pProp != NULL && err == Success; pProp = pProp->next) {
- Atom prop;
+ Atom prop;
- prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
- err = dixChangeWindowProperty(serverClient, pWin,
- prop, pProp->type,
- pProp->format, PropModeReplace,
+ prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
+ err = dixChangeWindowProperty(serverClient, pWin,
+ prop, pProp->type,
+ pProp->format, PropModeReplace,
pProp->size, pProp->data, FALSE);
- }
+ }
- /* Look at err */
- ret &= (err == Success);
+ /* Look at err */
+ ret &= (err==Success);
}
else {
- xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
- "non-root window %p (parent %p)\n",
- (void *) pWin, (void *) pWin->parent);
- ret = FALSE;
- }
+ xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
+ "non-root window %p (parent %p)\n",
+ (void *)pWin, (void *)pWin->parent);
+ ret = FALSE;
}
+ }
- DebugF("xf86CreateRootWindow() returns %d\n", ret);
- return ret;
+ DebugF("xf86CreateRootWindow() returns %d\n", ret);
+ return ret;
}
static void
@@ -367,21 +367,21 @@ InstallSignalHandlers(void)
/*
* Install signal handler for unexpected signals
*/
- xf86Info.caughtSignal = FALSE;
+ xf86Info.caughtSignal=FALSE;
if (!xf86Info.notrapSignals) {
- OsRegisterSigWrapper(xf86SigWrapper);
+ OsRegisterSigWrapper(xf86SigWrapper);
}
else {
- signal(SIGSEGV, SIG_DFL);
- signal(SIGILL, SIG_DFL);
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
#ifdef SIGEMT
- signal(SIGEMT, SIG_DFL);
+ signal(SIGEMT, SIG_DFL);
#endif
- signal(SIGFPE, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
- signal(SIGSYS, SIG_DFL);
- signal(SIGXCPU, SIG_DFL);
- signal(SIGXFSZ, SIG_DFL);
+ signal(SIGFPE, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ signal(SIGSYS, SIG_DFL);
+ signal(SIGXCPU, SIG_DFL);
+ signal(SIGXFSZ, SIG_DFL);
}
}
@@ -392,330 +392,330 @@ InstallSignalHandlers(void)
* collecting the pixmap formats.
*/
void
-InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
+InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
- int i, j, k, scr_index, was_blocked = 0;
- char **modulelist;
- pointer *optionlist;
- Pix24Flags screenpix24, pix24;
- MessageType pix24From = X_DEFAULT;
- Bool pix24Fail = FALSE;
- Bool autoconfig = FALSE;
- GDevPtr configured_device;
-
- xf86Initialising = TRUE;
-
- if (serverGeneration == 1) {
- if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
- xf86ServerName++;
- else
- xf86ServerName = argv[0];
-
- xf86PrintBanner();
- xf86PrintMarkers();
- if (xf86LogFile) {
- time_t t;
- const char *ct;
-
- t = time(NULL);
- ct = ctime(&t);
- xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
- xf86LogFile, ct);
- }
-
- /* Read and parse the config file */
- if (!xf86DoConfigure && !xf86DoShowOptions) {
- switch (xf86HandleConfigFile(FALSE)) {
- case CONFIG_OK:
- break;
- case CONFIG_PARSE_ERROR:
- xf86Msg(X_ERROR, "Error parsing the config file\n");
- return;
- case CONFIG_NOFILE:
- autoconfig = TRUE;
- break;
- }
- }
+ int i, j, k, scr_index, was_blocked = 0;
+ char **modulelist;
+ pointer *optionlist;
+ Pix24Flags screenpix24, pix24;
+ MessageType pix24From = X_DEFAULT;
+ Bool pix24Fail = FALSE;
+ Bool autoconfig = FALSE;
+ GDevPtr configured_device;
+
+ xf86Initialising = TRUE;
+
+ if (serverGeneration == 1) {
+ if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
+ xf86ServerName++;
+ else
+ xf86ServerName = argv[0];
+
+ xf86PrintBanner();
+ xf86PrintMarkers();
+ if (xf86LogFile) {
+ time_t t;
+ const char *ct;
+
+ t = time(NULL);
+ ct = ctime(&t);
+ xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
+ xf86LogFile, ct);
+ }
+
+ /* Read and parse the config file */
+ if (!xf86DoConfigure && !xf86DoShowOptions) {
+ switch (xf86HandleConfigFile(FALSE)) {
+ case CONFIG_OK:
+ break;
+ case CONFIG_PARSE_ERROR:
+ xf86Msg(X_ERROR, "Error parsing the config file\n");
+ return;
+ case CONFIG_NOFILE:
+ autoconfig = TRUE;
+ break;
+ }
+ }
- InstallSignalHandlers();
+ InstallSignalHandlers();
- /* Initialise the loader */
- LoaderInit();
+ /* Initialise the loader */
+ LoaderInit();
- /* Tell the loader the default module search path */
- LoaderSetPath(xf86ModulePath);
+ /* Tell the loader the default module search path */
+ LoaderSetPath(xf86ModulePath);
- if (xf86Info.ignoreABI) {
- LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
- }
+ if (xf86Info.ignoreABI) {
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+ }
- if (xf86DoShowOptions)
- DoShowOptions();
+ if (xf86DoShowOptions)
+ DoShowOptions();
- /* Do a general bus probe. This will be a PCI probe for x86 platforms */
- xf86BusProbe();
+ /* Do a general bus probe. This will be a PCI probe for x86 platforms */
+ xf86BusProbe();
- if (xf86DoConfigure)
- DoConfigure();
+ if (xf86DoConfigure)
+ DoConfigure();
- if (autoconfig) {
- if (!xf86AutoConfig()) {
- xf86Msg(X_ERROR, "Auto configuration failed\n");
- return;
- }
- }
+ if (autoconfig) {
+ if (!xf86AutoConfig()) {
+ xf86Msg(X_ERROR, "Auto configuration failed\n");
+ return;
+ }
+ }
#ifdef XF86PM
- xf86OSPMClose = xf86OSPMOpen();
+ xf86OSPMClose = xf86OSPMOpen();
#endif
- /* Load all modules specified explicitly in the config file */
- if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
- xf86LoadModules(modulelist, optionlist);
- free(modulelist);
- free(optionlist);
- }
+ /* Load all modules specified explicitly in the config file */
+ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
+ xf86LoadModules(modulelist, optionlist);
+ free(modulelist);
+ free(optionlist);
+ }
- /* Load all driver modules specified in the config file */
- /* If there aren't any specified in the config file, autoconfig them */
- /* FIXME: Does not handle multiple active screen sections, but I'm not
- * sure if we really want to handle that case*/
- configured_device = xf86ConfigLayout.screens->screen->device;
- if ((!configured_device) || (!configured_device->driver)) {
- if (!autoConfigDevice(configured_device)) {
- xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
- return;
- }
- }
- if ((modulelist = xf86DriverlistFromConfig())) {
- xf86LoadModules(modulelist, NULL);
- free(modulelist);
+ /* Load all driver modules specified in the config file */
+ /* If there aren't any specified in the config file, autoconfig them */
+ /* FIXME: Does not handle multiple active screen sections, but I'm not
+ * sure if we really want to handle that case*/
+ configured_device = xf86ConfigLayout.screens->screen->device;
+ if ((!configured_device) || (!configured_device->driver)) {
+ if (!autoConfigDevice(configured_device)) {
+ xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
+ return ;
}
+ }
+ if ((modulelist = xf86DriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ free(modulelist);
+ }
- /* Load all input driver modules specified in the config file. */
- if ((modulelist = xf86InputDriverlistFromConfig())) {
- xf86LoadModules(modulelist, NULL);
- free(modulelist);
- }
+ /* Load all input driver modules specified in the config file. */
+ if ((modulelist = xf86InputDriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ free(modulelist);
+ }
- /*
- * It is expected that xf86AddDriver()/xf86AddInputDriver will be
- * called for each driver as it is loaded. Those functions save the
- * module pointers for drivers.
- * XXX Nothing keeps track of them for other modules.
- */
- /* XXX What do we do if not all of these could be loaded? */
+ /*
+ * It is expected that xf86AddDriver()/xf86AddInputDriver will be
+ * called for each driver as it is loaded. Those functions save the
+ * module pointers for drivers.
+ * XXX Nothing keeps track of them for other modules.
+ */
+ /* XXX What do we do if not all of these could be loaded? */
- /*
- * At this point, xf86DriverList[] is all filled in with entries for
- * each of the drivers to try and xf86NumDrivers has the number of
- * drivers. If there are none, return now.
- */
+ /*
+ * At this point, xf86DriverList[] is all filled in with entries for
+ * each of the drivers to try and xf86NumDrivers has the number of
+ * drivers. If there are none, return now.
+ */
- if (xf86NumDrivers == 0) {
- xf86Msg(X_ERROR, "No drivers available.\n");
- return;
- }
+ if (xf86NumDrivers == 0) {
+ xf86Msg(X_ERROR, "No drivers available.\n");
+ return;
+ }
- /*
- * Call each of the Identify functions and call the driverFunc to check
- * if HW access is required. The Identify functions print out some
- * identifying information, and anything else that might be
- * needed at this early stage.
- */
+ /*
+ * Call each of the Identify functions and call the driverFunc to check
+ * if HW access is required. The Identify functions print out some
+ * identifying information, and anything else that might be
+ * needed at this early stage.
+ */
- for (i = 0; i < xf86NumDrivers; i++) {
- if (xf86DriverList[i]->Identify != NULL)
- xf86DriverList[i]->Identify(0);
+ for (i = 0; i < xf86NumDrivers; i++) {
+ if (xf86DriverList[i]->Identify != NULL)
+ xf86DriverList[i]->Identify(0);
- if (!xorgHWAccess || !xorgHWOpenConsole) {
- xorgHWFlags flags;
+ if (!xorgHWAccess || !xorgHWOpenConsole) {
+ xorgHWFlags flags;
- if (!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags))
- flags = HW_IO;
+ if(!xf86DriverList[i]->driverFunc
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags))
+ flags = HW_IO;
- if (NEED_IO_ENABLED(flags))
- xorgHWAccess = TRUE;
- if (!(flags & HW_SKIP_CONSOLE))
- xorgHWOpenConsole = TRUE;
- }
- }
+ if(NEED_IO_ENABLED(flags))
+ xorgHWAccess = TRUE;
+ if(!(flags & HW_SKIP_CONSOLE))
+ xorgHWOpenConsole = TRUE;
+ }
+ }
- if (xorgHWOpenConsole)
- xf86OpenConsole();
- else
- xf86Info.dontVTSwitch = TRUE;
+ if (xorgHWOpenConsole)
+ xf86OpenConsole();
+ else
+ xf86Info.dontVTSwitch = TRUE;
- if (xf86BusConfig() == FALSE)
- return;
+ if (xf86BusConfig() == FALSE)
+ return;
- xf86PostProbe();
+ xf86PostProbe();
- /*
- * Sort the drivers to match the requested ording. Using a slow
- * bubble sort.
- */
- for (j = 0; j < xf86NumScreens - 1; j++) {
- for (i = 0; i < xf86NumScreens - j - 1; i++) {
- if (xf86Screens[i + 1]->confScreen->screennum <
- xf86Screens[i]->confScreen->screennum) {
- ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
-
- xf86Screens[i + 1] = xf86Screens[i];
- xf86Screens[i] = tmpScrn;
- }
- }
- }
- /* Fix up the indexes */
- for (i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->scrnIndex = i;
- }
+ /*
+ * Sort the drivers to match the requested ording. Using a slow
+ * bubble sort.
+ */
+ for (j = 0; j < xf86NumScreens - 1; j++) {
+ for (i = 0; i < xf86NumScreens - j - 1; i++) {
+ if (xf86Screens[i + 1]->confScreen->screennum <
+ xf86Screens[i]->confScreen->screennum) {
+ ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
+
+ xf86Screens[i + 1] = xf86Screens[i];
+ xf86Screens[i] = tmpScrn;
+ }
+ }
+ }
+ /* Fix up the indexes */
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->scrnIndex = i;
+ }
- /*
- * Call the driver's PreInit()'s to complete initialisation for the first
- * generation.
- */
+ /*
+ * Call the driver's PreInit()'s to complete initialisation for the first
+ * generation.
+ */
- for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterScrnInit(xf86Screens[i]);
- xf86VGAarbiterLock(xf86Screens[i]);
- if (xf86Screens[i]->PreInit &&
- xf86Screens[i]->PreInit(xf86Screens[i], 0))
- xf86Screens[i]->configured = TRUE;
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- for (i = 0; i < xf86NumScreens; i++)
- if (!xf86Screens[i]->configured)
- xf86DeleteScreen(i--, 0);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86VGAarbiterScrnInit(xf86Screens[i]);
+ xf86VGAarbiterLock(xf86Screens[i]);
+ if (xf86Screens[i]->PreInit &&
+ xf86Screens[i]->PreInit(xf86Screens[i], 0))
+ xf86Screens[i]->configured = TRUE;
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ }
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86Screens[i]->configured)
+ xf86DeleteScreen(i--, 0);
- /*
- * If no screens left, return now.
- */
+ /*
+ * If no screens left, return now.
+ */
- if (xf86NumScreens == 0) {
- xf86Msg(X_ERROR,
- "Screen(s) found, but none have a usable configuration.\n");
- return;
- }
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Screen(s) found, but none have a usable configuration.\n");
+ return;
+ }
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->name == NULL) {
- XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
- xf86MsgVerb(X_WARNING, 0,
- "Screen driver %d has no name set, using `%s'.\n",
- i, xf86Screens[i]->name);
- }
- }
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->name == NULL) {
+ XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
+ xf86MsgVerb(X_WARNING, 0,
+ "Screen driver %d has no name set, using `%s'.\n",
+ i, xf86Screens[i]->name);
+ }
+ }
- /* Remove (unload) drivers that are not required */
- for (i = 0; i < xf86NumDrivers; i++)
- if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
- xf86DeleteDriver(i);
+ /* Remove (unload) drivers that are not required */
+ for (i = 0; i < xf86NumDrivers; i++)
+ if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
+ xf86DeleteDriver(i);
- /*
- * At this stage we know how many screens there are.
- */
+ /*
+ * At this stage we know how many screens there are.
+ */
- for (i = 0; i < xf86NumScreens; i++)
- xf86InitViewport(xf86Screens[i]);
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86InitViewport(xf86Screens[i]);
- /*
- * Collect all pixmap formats and check for conflicts at the display
- * level. Should we die here? Or just delete the offending screens?
- */
- screenpix24 = Pix24DontCare;
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->imageByteOrder !=
- xf86Screens[0]->imageByteOrder)
- FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
- if (xf86Screens[i]->bitmapScanlinePad !=
- xf86Screens[0]->bitmapScanlinePad)
+ /*
+ * Collect all pixmap formats and check for conflicts at the display
+ * level. Should we die here? Or just delete the offending screens?
+ */
+ screenpix24 = Pix24DontCare;
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->imageByteOrder !=
+ xf86Screens[0]->imageByteOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlinePad !=
+ xf86Screens[0]->bitmapScanlinePad)
FatalError
("Inconsistent display bitmapScanlinePad. Exiting\n");
- if (xf86Screens[i]->bitmapScanlineUnit !=
- xf86Screens[0]->bitmapScanlineUnit)
+ if (xf86Screens[i]->bitmapScanlineUnit !=
+ xf86Screens[0]->bitmapScanlineUnit)
FatalError
("Inconsistent display bitmapScanlineUnit. Exiting\n");
- if (xf86Screens[i]->bitmapBitOrder !=
- xf86Screens[0]->bitmapBitOrder)
- FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
-
- /* Determine the depth 24 pixmap format the screens would like */
- if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
- if (screenpix24 == Pix24DontCare)
- screenpix24 = xf86Screens[i]->pixmap24;
- else if (screenpix24 != xf86Screens[i]->pixmap24)
+ if (xf86Screens[i]->bitmapBitOrder !=
+ xf86Screens[0]->bitmapBitOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+
+ /* Determine the depth 24 pixmap format the screens would like */
+ if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
+ if (screenpix24 == Pix24DontCare)
+ screenpix24 = xf86Screens[i]->pixmap24;
+ else if (screenpix24 != xf86Screens[i]->pixmap24)
FatalError
("Inconsistent depth 24 pixmap format. Exiting\n");
- }
- }
- /* check if screenpix24 is consistent with the config/cmdline */
- if (xf86Info.pixmap24 != Pix24DontCare) {
- pix24 = xf86Info.pixmap24;
- pix24From = xf86Info.pix24From;
+ }
+ }
+ /* check if screenpix24 is consistent with the config/cmdline */
+ if (xf86Info.pixmap24 != Pix24DontCare) {
+ pix24 = xf86Info.pixmap24;
+ pix24From = xf86Info.pix24From;
if (screenpix24 != Pix24DontCare &&
screenpix24 != xf86Info.pixmap24)
- pix24Fail = TRUE;
+ pix24Fail = TRUE;
}
else if (screenpix24 != Pix24DontCare) {
- pix24 = screenpix24;
- pix24From = X_PROBED;
+ pix24 = screenpix24;
+ pix24From = X_PROBED;
}
else
- pix24 = Pix24Use32;
+ pix24 = Pix24Use32;
- if (pix24Fail)
- FatalError("Screen(s) can't use the required depth 24 pixmap format"
- " (%d). Exiting\n", PIX24TOBPP(pix24));
+ if (pix24Fail)
+ FatalError("Screen(s) can't use the required depth 24 pixmap format"
+ " (%d). Exiting\n", PIX24TOBPP(pix24));
- /* Initialise the depth 24 format */
+ /* Initialise the depth 24 format */
for (j = 0; j < numFormats && formats[j].depth != 24; j++);
- formats[j].bitsPerPixel = PIX24TOBPP(pix24);
+ formats[j].bitsPerPixel = PIX24TOBPP(pix24);
- /* Collect additional formats */
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numFormats; j++) {
- for (k = 0;; k++) {
- if (k >= numFormats) {
- if (k >= MAXFORMATS)
- FatalError("Too many pixmap formats! Exiting\n");
- formats[k] = xf86Screens[i]->formats[j];
- numFormats++;
- break;
- }
- if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
- if ((formats[k].bitsPerPixel ==
- xf86Screens[i]->formats[j].bitsPerPixel) &&
- (formats[k].scanlinePad ==
- xf86Screens[i]->formats[j].scanlinePad))
- break;
- FatalError("Inconsistent pixmap format for depth %d."
- " Exiting\n", formats[k].depth);
- }
- }
- }
- }
- formatsDone = TRUE;
+ /* Collect additional formats */
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numFormats; j++) {
+ for (k = 0; ; k++) {
+ if (k >= numFormats) {
+ if (k >= MAXFORMATS)
+ FatalError("Too many pixmap formats! Exiting\n");
+ formats[k] = xf86Screens[i]->formats[j];
+ numFormats++;
+ break;
+ }
+ if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
+ if ((formats[k].bitsPerPixel ==
+ xf86Screens[i]->formats[j].bitsPerPixel) &&
+ (formats[k].scanlinePad ==
+ xf86Screens[i]->formats[j].scanlinePad))
+ break;
+ FatalError("Inconsistent pixmap format for depth %d."
+ " Exiting\n", formats[k].depth);
+ }
+ }
+ }
+ }
+ formatsDone = TRUE;
- if (xf86Info.vtno >= 0) {
+ if (xf86Info.vtno >= 0 ) {
#define VT_ATOM_NAME "XFree86_VT"
- Atom VTAtom = -1;
- CARD32 *VT = NULL;
- int ret;
-
- /* This memory needs to stay available until the screen has been
- initialized, and we can create the property for real.
- */
- if ((VT = malloc(sizeof(CARD32))) == NULL) {
+ Atom VTAtom=-1;
+ CARD32 *VT = NULL;
+ int ret;
+
+ /* This memory needs to stay available until the screen has been
+ initialized, and we can create the property for real.
+ */
+ if ( (VT = malloc(sizeof(CARD32)))==NULL ) {
FatalError
("Unable to make VT property - out of memory. Exiting...\n");
- }
- *VT = xf86Info.vtno;
+ }
+ *VT = xf86Info.vtno;
- VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+ VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
for (i = 0, ret = Success; i < xf86NumScreens && ret == Success;
i++) {
@@ -723,169 +723,169 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
VTAtom, XA_INTEGER, 32, 1,
VT);
- if (ret != Success)
- xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register VT property\n");
- }
- }
+ if (ret != Success)
+ xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
+ "Failed to register VT property\n");
+ }
+ }
- if (SeatId) {
- Atom SeatAtom;
+ if (SeatId) {
+ Atom SeatAtom;
SeatAtom =
MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
- for (i = 0; i < xf86NumScreens; i++) {
- int ret;
+ for (i = 0; i < xf86NumScreens; i++) {
+ int ret;
- ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
- SeatAtom, XA_STRING, 8,
+ ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
+ SeatAtom, XA_STRING, 8,
strlen(SeatId) + 1,
SeatId);
- if (ret != Success) {
- xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register seat property\n");
- }
- }
- }
-
- /* If a screen uses depth 24, show what the pixmap format is */
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->depth == 24) {
- xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
- PIX24TOBPP(pix24));
- break;
+ if (ret != Success) {
+ xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
+ "Failed to register seat property\n");
}
}
}
- else {
- /*
- * serverGeneration != 1; some OSs have to do things here, too.
- */
- if (xorgHWOpenConsole)
- xf86OpenConsole();
-#ifdef XF86PM
- /*
- should we reopen it here? We need to deal with an already opened
- device. We could leave this to the OS layer. For now we simply
- close it here
- */
- if (xf86OSPMClose)
- xf86OSPMClose();
- if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
- xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
-#endif
-
- /* Make sure full I/O access is enabled */
- if (xorgHWAccess)
- xf86EnableIO();
+ /* If a screen uses depth 24, show what the pixmap format is */
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->depth == 24) {
+ xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
+ PIX24TOBPP(pix24));
+ break;
+ }
}
-
+ }
+ else {
/*
- * Use the previously collected parts to setup pScreenInfo
+ * serverGeneration != 1; some OSs have to do things here, too.
*/
+ if (xorgHWOpenConsole)
+ xf86OpenConsole();
- pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
- pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
- pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
- pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
- pScreenInfo->numPixmapFormats = numFormats;
- for (i = 0; i < numFormats; i++)
- pScreenInfo->formats[i] = formats[i];
-
- /* Make sure the server's VT is active */
+#ifdef XF86PM
+ /*
+ should we reopen it here? We need to deal with an already opened
+ device. We could leave this to the OS layer. For now we simply
+ close it here
+ */
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
+ xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
+#endif
- if (serverGeneration != 1) {
- xf86Resetting = TRUE;
- /* All screens are in the same state, so just check the first */
- if (!xf86Screens[0]->vtSema) {
+ /* Make sure full I/O access is enabled */
+ if (xorgHWAccess)
+ xf86EnableIO();
+ }
+
+ /*
+ * Use the previously collected parts to setup pScreenInfo
+ */
+
+ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
+ pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
+ pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
+ pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
+ pScreenInfo->numPixmapFormats = numFormats;
+ for (i = 0; i < numFormats; i++)
+ pScreenInfo->formats[i] = formats[i];
+
+ /* Make sure the server's VT is active */
+
+ if (serverGeneration != 1) {
+ xf86Resetting = TRUE;
+ /* All screens are in the same state, so just check the first */
+ if (!xf86Screens[0]->vtSema) {
#ifdef HAS_USL_VTS
- ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
+ ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
#endif
- xf86AccessEnter();
- was_blocked = xf86BlockSIGIO();
- }
+ xf86AccessEnter();
+ was_blocked = xf86BlockSIGIO();
}
-
- for (i = 0; i < xf86NumScreens; i++)
- if (!xf86ColormapAllocatePrivates(xf86Screens[i]))
- FatalError("Cannot register DDX private keys");
-
- if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) ||
- !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0))
- FatalError("Cannot register DDX private keys");
-
- for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterLock(xf86Screens[i]);
- /*
- * Almost everything uses these defaults, and many of those that
- * don't, will wrap them.
- */
- xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+ }
+
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86ColormapAllocatePrivates(xf86Screens[i]))
+ FatalError("Cannot register DDX private keys");
+
+ if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) ||
+ !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0))
+ FatalError("Cannot register DDX private keys");
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86VGAarbiterLock(xf86Screens[i]);
+ /*
+ * Almost everything uses these defaults, and many of those that
+ * don't, will wrap them.
+ */
+ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
#ifdef XFreeXDGA
- xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
+ xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
#endif
- xf86Screens[i]->DPMSSet = NULL;
- xf86Screens[i]->LoadPalette = NULL;
- xf86Screens[i]->SetOverscan = NULL;
- xf86Screens[i]->DriverFunc = NULL;
- xf86Screens[i]->pScreen = NULL;
- scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- if (scr_index == i) {
- /*
- * Hook in our ScrnInfoRec, and initialise some other pScreen
- * fields.
- */
- dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
- xf86ScreenKey, xf86Screens[i]);
- xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
- /* The driver should set this, but make sure it is set anyway */
- xf86Screens[i]->vtSema = TRUE;
+ xf86Screens[i]->DPMSSet = NULL;
+ xf86Screens[i]->LoadPalette = NULL;
+ xf86Screens[i]->SetOverscan = NULL;
+ xf86Screens[i]->DriverFunc = NULL;
+ xf86Screens[i]->pScreen = NULL;
+ scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ if (scr_index == i) {
+ /*
+ * Hook in our ScrnInfoRec, and initialise some other pScreen
+ * fields.
+ */
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86ScreenKey, xf86Screens[i]);
+ xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
+ /* The driver should set this, but make sure it is set anyway */
+ xf86Screens[i]->vtSema = TRUE;
}
else {
- /* This shouldn't normally happen */
- FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
- }
+ /* This shouldn't normally happen */
+ FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
+ }
- DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
- i, xf86Screens[i]->pScreen);
- DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
- i, xf86Screens[i]->pScreen->CreateWindow);
+ DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
+ i, xf86Screens[i]->pScreen );
+ DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
+ i, xf86Screens[i]->pScreen->CreateWindow );
- dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
- xf86CreateRootWindowKey,
- xf86Screens[i]->pScreen->CreateWindow);
- xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86CreateRootWindowKey,
+ xf86Screens[i]->pScreen->CreateWindow);
+ xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
if (PictureGetSubpixelOrder(xf86Screens[i]->pScreen) == SubPixelUnknown) {
- xf86MonPtr DDC = (xf86MonPtr) (xf86Screens[i]->monitor->DDC);
+ xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
- PictureSetSubpixelOrder(xf86Screens[i]->pScreen,
- DDC ?
- (DDC->features.input_type ?
- SubPixelHorizontalRGB : SubPixelNone) :
- SubPixelUnknown);
- }
+ PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
+ DDC ?
+ (DDC->features.input_type ?
+ SubPixelHorizontalRGB : SubPixelNone) :
+ SubPixelUnknown);
+ }
#ifdef RANDR
- if (!xf86Info.disableRandR)
- xf86RandRInit(screenInfo.screens[scr_index]);
- xf86Msg(xf86Info.randRFrom, "RandR %s\n",
- xf86Info.disableRandR ? "disabled" : "enabled");
+ if (!xf86Info.disableRandR)
+ xf86RandRInit (screenInfo.screens[scr_index]);
+ xf86Msg(xf86Info.randRFrom, "RandR %s\n",
+ xf86Info.disableRandR ? "disabled" : "enabled");
#endif
- }
+ }
- xf86VGAarbiterWrapFunctions();
- xf86UnblockSIGIO(was_blocked);
+ xf86VGAarbiterWrapFunctions();
+ xf86UnblockSIGIO(was_blocked);
- xf86InitOrigins();
+ xf86InitOrigins();
- xf86Resetting = FALSE;
- xf86Initialising = FALSE;
+ xf86Resetting = FALSE;
+ xf86Initialising = FALSE;
- RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA, xf86Wakeup,
- NULL);
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
+ NULL);
}
/**
@@ -895,7 +895,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
void
InitInput(int argc, char **argv)
{
- InputInfoPtr *pInfo;
+ InputInfoPtr* pInfo;
DeviceIntPtr dev;
xf86Info.vtRequestsPending = FALSE;
@@ -917,7 +917,7 @@ InitInput(int argc, char **argv)
}
void
-CloseInput(void)
+CloseInput (void)
{
config_fini();
mieqFini();
@@ -932,16 +932,16 @@ CloseInput(void)
void
OsVendorInit(void)
{
- static Bool beenHere = FALSE;
+ static Bool beenHere = FALSE;
- signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
+ signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
- if (!beenHere) {
- umask(022);
- xf86LogInit();
- }
+ if (!beenHere) {
+ umask(022);
+ xf86LogInit();
+ }
- /* Set stderr to non-blocking. */
+ /* Set stderr to non-blocking. */
#ifndef O_NONBLOCK
#if defined(FNDELAY)
#define O_NONBLOCK FNDELAY
@@ -950,21 +950,21 @@ OsVendorInit(void)
#endif
#ifdef O_NONBLOCK
- if (!beenHere) {
+ if (!beenHere) {
if (xf86PrivsElevated()) {
- int status;
+ int status;
- status = fcntl(fileno(stderr), F_GETFL, 0);
- if (status != -1) {
- fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
- }
- }
+ status = fcntl(fileno(stderr), F_GETFL, 0);
+ if (status != -1) {
+ fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
+ }
}
+ }
#endif
#endif
xf86UnblockSIGIO(0);
- beenHere = TRUE;
+ beenHere = TRUE;
}
/*
@@ -983,16 +983,16 @@ ddxGiveUp(enum ExitCode error)
#ifdef XF86PM
if (xf86OSPMClose)
- xf86OSPMClose();
+ xf86OSPMClose();
xf86OSPMClose = NULL;
#endif
for (i = 0; i < xf86NumScreens; i++) {
- /*
- * zero all access functions to
- * trap calls when switched away.
- */
- xf86Screens[i]->vtSema = FALSE;
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
}
#ifdef XFreeXDGA
@@ -1000,13 +1000,13 @@ ddxGiveUp(enum ExitCode error)
#endif
if (xorgHWOpenConsole)
- xf86CloseConsole();
+ xf86CloseConsole();
xf86CloseLog(error);
/* If an unexpected signal was caught, dump a core for debugging */
if (xf86Info.caughtSignal)
- OsAbort();
+ OsAbort();
}
/*
@@ -1019,38 +1019,38 @@ ddxGiveUp(enum ExitCode error)
void
AbortDDX(enum ExitCode error)
{
- int i;
+ int i;
- xf86BlockSIGIO();
+ xf86BlockSIGIO();
- /*
- * try to restore the original video state
- */
-#ifdef DPMSExtension /* Turn screens back on */
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(serverClient, DPMSModeOn);
+ /*
+ * try to restore the original video state
+ */
+#ifdef DPMSExtension /* Turn screens back on */
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(serverClient, DPMSModeOn);
#endif
- if (xf86Screens) {
- for (i = 0; i < xf86NumScreens; i++)
- if (xf86Screens[i]->vtSema) {
- /*
- * if we are aborting before ScreenInit() has finished
- * we might not have been wrapped yet. Therefore enable
- * screen explicitely.
- */
- xf86VGAarbiterLock(xf86Screens[i]);
- (xf86Screens[i]->LeaveVT) (i, 0);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- }
-
- xf86AccessLeave();
-
- /*
- * This is needed for an abnormal server exit, since the normal exit stuff
- * MUST also be performed (i.e. the vt must be left in a defined state)
- */
- ddxGiveUp(error);
+ if (xf86Screens) {
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->vtSema) {
+ /*
+ * if we are aborting before ScreenInit() has finished
+ * we might not have been wrapped yet. Therefore enable
+ * screen explicitely.
+ */
+ xf86VGAarbiterLock(xf86Screens[i]);
+ (xf86Screens[i]->LeaveVT)(i, 0);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ }
+ }
+
+ xf86AccessLeave();
+
+ /*
+ * This is needed for an abnormal server exit, since the normal exit stuff
+ * MUST also be performed (i.e. the vt must be left in a defined state)
+ */
+ ddxGiveUp(error);
}
void
@@ -1058,14 +1058,14 @@ OsVendorFatalError(void)
{
#ifdef VENDORSUPPORT
ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
- "at %s for support on this crash.\n", VENDORSUPPORT);
+ "at %s for support on this crash.\n",VENDORSUPPORT);
#else
- ErrorF("\nPlease consult the " XVENDORNAME " support \n"
- "\t at " __VENDORDWEBSUPPORT__ "\n for help. \n");
+ ErrorF("\nPlease consult the "XVENDORNAME" support \n"
+ "\t at "__VENDORDWEBSUPPORT__"\n for help. \n");
#endif
if (xf86LogFile && xf86LogFileWasOpened)
- ErrorF("Please also check the log file at \"%s\" for additional "
- "information.\n", xf86LogFile);
+ ErrorF("Please also check the log file at \"%s\" for additional "
+ "information.\n", xf86LogFile);
ErrorF("\n");
}
@@ -1092,13 +1092,13 @@ xf86SetLogVerbosity(int verb)
static void
xf86PrintDefaultModulePath(void)
{
- ErrorF("%s\n", DEFAULT_MODULE_PATH);
+ ErrorF("%s\n", DEFAULT_MODULE_PATH);
}
static void
xf86PrintDefaultLibraryPath(void)
{
- ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
+ ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
}
/*
@@ -1120,289 +1120,289 @@ ddxProcessArgument(int argc, char **argv, int i)
FatalError("Required argument to %s not specified\n", argv[i]); \
}
- /* First the options that are not allowed with elevated privileges */
- if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
- if (xf86PrivsElevated()) {
- FatalError("The '%s' option cannot be used with "
- "elevated privileges.\n", argv[i]);
- }
+ /* First the options that are not allowed with elevated privileges */
+ if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
+ if (xf86PrivsElevated()) {
+ FatalError("The '%s' option cannot be used with "
+ "elevated privileges.\n", argv[i]);
+ }
else if (!strcmp(argv[i], "-modulepath")) {
- char *mp;
-
- CHECK_FOR_REQUIRED_ARGUMENT();
- mp = strdup(argv[i + 1]);
- if (!mp)
- FatalError("Can't allocate memory for ModulePath\n");
- xf86ModulePath = mp;
- xf86ModPathFrom = X_CMDLINE;
- return 2;
- }
+ char *mp;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ mp = strdup(argv[i + 1]);
+ if (!mp)
+ FatalError("Can't allocate memory for ModulePath\n");
+ xf86ModulePath = mp;
+ xf86ModPathFrom = X_CMDLINE;
+ return 2;
+ }
else if (!strcmp(argv[i], "-logfile")) {
- char *lf;
-
- CHECK_FOR_REQUIRED_ARGUMENT();
- lf = strdup(argv[i + 1]);
- if (!lf)
- FatalError("Can't allocate memory for LogFile\n");
- xf86LogFile = lf;
- xf86LogFileFrom = X_CMDLINE;
- return 2;
- }
+ char *lf;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ lf = strdup(argv[i + 1]);
+ if (!lf)
+ FatalError("Can't allocate memory for LogFile\n");
+ xf86LogFile = lf;
+ xf86LogFileFrom = X_CMDLINE;
+ return 2;
}
+ }
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
- FatalError("\nInvalid argument for %s\n"
- "\tWith elevated privileges, the file specified with %s must be\n"
- "\ta relative path and must not contain any \"..\" elements.\n"
- "\tUsing default " __XCONFIGFILE__ " search path.\n\n",
- argv[i], argv[i]);
- }
- xf86ConfigFile = argv[i + 1];
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
+ FatalError("\nInvalid argument for %s\n"
+ "\tWith elevated privileges, the file specified with %s must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n"
+ "\tUsing default "__XCONFIGFILE__" search path.\n\n",
+ argv[i], argv[i]);
}
+ xf86ConfigFile = argv[i + 1];
+ return 2;
+ }
if (!strcmp(argv[i], "-configdir")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
- FatalError("\nInvalid argument for %s\n"
- "\tWith elevated privileges, the file specified with %s must be\n"
- "\ta relative path and must not contain any \"..\" elements.\n"
- "\tUsing default " __XCONFIGDIR__ " search path.\n\n",
- argv[i], argv[i]);
- }
- xf86ConfigDir = argv[i + 1];
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
+ FatalError("\nInvalid argument for %s\n"
+ "\tWith elevated privileges, the file specified with %s must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n"
+ "\tUsing default "__XCONFIGDIR__" search path.\n\n",
+ argv[i], argv[i]);
}
+ xf86ConfigDir = argv[i + 1];
+ return 2;
+ }
if (!strcmp(argv[i], "-flipPixels")) {
- xf86FlipPixels = TRUE;
- return 1;
- }
+ xf86FlipPixels = TRUE;
+ return 1;
+ }
#ifdef XF86VIDMODE
if (!strcmp(argv[i], "-disableVidMode")) {
- xf86VidModeDisabled = TRUE;
- return 1;
- }
+ xf86VidModeDisabled = TRUE;
+ return 1;
+ }
if (!strcmp(argv[i], "-allowNonLocalXvidtune")) {
- xf86VidModeAllowNonLocal = TRUE;
- return 1;
- }
+ xf86VidModeAllowNonLocal = TRUE;
+ return 1;
+ }
#endif
if (!strcmp(argv[i], "-allowMouseOpenFail")) {
- xf86AllowMouseOpenFail = TRUE;
- return 1;
- }
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
if (!strcmp(argv[i], "-ignoreABI")) {
- LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
- return 1;
- }
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+ return 1;
+ }
if (!strcmp(argv[i], "-verbose")) {
if (++i < argc && argv[i]) {
- char *end;
- long val;
+ char *end;
+ long val;
- val = strtol(argv[i], &end, 0);
+ val = strtol(argv[i], &end, 0);
if (*end == '\0') {
- xf86SetVerbosity(val);
- return 2;
- }
- }
- xf86SetVerbosity(++xf86Verbose);
- return 1;
+ xf86SetVerbosity(val);
+ return 2;
+ }
}
+ xf86SetVerbosity(++xf86Verbose);
+ return 1;
+ }
if (!strcmp(argv[i], "-logverbose")) {
if (++i < argc && argv[i]) {
- char *end;
- long val;
+ char *end;
+ long val;
- val = strtol(argv[i], &end, 0);
+ val = strtol(argv[i], &end, 0);
if (*end == '\0') {
- xf86SetLogVerbosity(val);
- return 2;
- }
- }
- xf86SetLogVerbosity(++xf86LogVerbose);
- return 1;
+ xf86SetLogVerbosity(val);
+ return 2;
+ }
}
+ xf86SetLogVerbosity(++xf86LogVerbose);
+ return 1;
+ }
if (!strcmp(argv[i], "-quiet")) {
- xf86SetVerbosity(-1);
- return 1;
- }
+ xf86SetVerbosity(-1);
+ return 1;
+ }
if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) {
- xf86PrintBanner();
- exit(0);
- }
+ xf86PrintBanner();
+ exit(0);
+ }
if (!strcmp(argv[i], "-showDefaultModulePath")) {
- xf86PrintDefaultModulePath();
- exit(0);
- }
+ xf86PrintDefaultModulePath();
+ exit(0);
+ }
if (!strcmp(argv[i], "-showDefaultLibPath")) {
- xf86PrintDefaultLibraryPath();
- exit(0);
- }
- /* Notice the -fp flag, but allow it to pass to the dix layer */
+ xf86PrintDefaultLibraryPath();
+ exit(0);
+ }
+ /* Notice the -fp flag, but allow it to pass to the dix layer */
if (!strcmp(argv[i], "-fp")) {
- xf86fpFlag = TRUE;
- return 0;
- }
- /* Notice the -bs flag, but allow it to pass to the dix layer */
+ xf86fpFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -bs flag, but allow it to pass to the dix layer */
if (!strcmp(argv[i], "-bs")) {
- xf86bsDisableFlag = TRUE;
- return 0;
- }
- /* Notice the +bs flag, but allow it to pass to the dix layer */
+ xf86bsDisableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the +bs flag, but allow it to pass to the dix layer */
if (!strcmp(argv[i], "+bs")) {
- xf86bsEnableFlag = TRUE;
- return 0;
- }
- /* Notice the -s flag, but allow it to pass to the dix layer */
+ xf86bsEnableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -s flag, but allow it to pass to the dix layer */
if (!strcmp(argv[i], "-s")) {
- xf86sFlag = TRUE;
- return 0;
- }
+ xf86sFlag = TRUE;
+ return 0;
+ }
if (!strcmp(argv[i], "-pixmap24")) {
- xf86Pix24 = Pix24Use24;
- return 1;
- }
+ xf86Pix24 = Pix24Use24;
+ return 1;
+ }
if (!strcmp(argv[i], "-pixmap32")) {
- xf86Pix24 = Pix24Use32;
- return 1;
- }
+ xf86Pix24 = Pix24Use32;
+ return 1;
+ }
if (!strcmp(argv[i], "-fbbpp")) {
- int bpp;
+ int bpp;
- CHECK_FOR_REQUIRED_ARGUMENT();
+ CHECK_FOR_REQUIRED_ARGUMENT();
if (sscanf(argv[++i], "%d", &bpp) == 1) {
- xf86FbBpp = bpp;
- return 2;
- }
+ xf86FbBpp = bpp;
+ return 2;
+ }
else {
- ErrorF("Invalid fbbpp\n");
- return 0;
- }
+ ErrorF("Invalid fbbpp\n");
+ return 0;
}
+ }
if (!strcmp(argv[i], "-depth")) {
- int depth;
+ int depth;
- CHECK_FOR_REQUIRED_ARGUMENT();
+ CHECK_FOR_REQUIRED_ARGUMENT();
if (sscanf(argv[++i], "%d", &depth) == 1) {
- xf86Depth = depth;
- return 2;
- }
+ xf86Depth = depth;
+ return 2;
+ }
else {
- ErrorF("Invalid depth\n");
- return 0;
- }
+ ErrorF("Invalid depth\n");
+ return 0;
}
+ }
if (!strcmp(argv[i], "-weight")) {
- int red, green, blue;
+ int red, green, blue;
- CHECK_FOR_REQUIRED_ARGUMENT();
+ CHECK_FOR_REQUIRED_ARGUMENT();
if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3) {
- xf86Weight.red = red;
- xf86Weight.green = green;
- xf86Weight.blue = blue;
- return 2;
- }
+ xf86Weight.red = red;
+ xf86Weight.green = green;
+ xf86Weight.blue = blue;
+ return 2;
+ }
else {
- ErrorF("Invalid weighting\n");
- return 0;
- }
+ ErrorF("Invalid weighting\n");
+ return 0;
}
- if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
+ }
+ if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
!strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) {
- double gamma;
-
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%lf", &gamma) == 1) {
- if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
- ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
- " is valid\n", GAMMA_MIN, GAMMA_MAX);
- return 0;
- }
- if (!strcmp(argv[i - 1], "-gamma"))
- xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
+ double gamma;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%lf", &gamma) == 1) {
+ if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
+ ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
+ " is valid\n", GAMMA_MIN, GAMMA_MAX);
+ return 0;
+ }
+ if (!strcmp(argv[i-1], "-gamma"))
+ xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
else if (!strcmp(argv[i - 1], "-rgamma"))
xf86Gamma.red = gamma;
else if (!strcmp(argv[i - 1], "-ggamma"))
xf86Gamma.green = gamma;
else if (!strcmp(argv[i - 1], "-bgamma"))
xf86Gamma.blue = gamma;
- return 2;
- }
+ return 2;
}
+ }
if (!strcmp(argv[i], "-layout")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86LayoutName = argv[++i];
- return 2;
- }
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86LayoutName = argv[++i];
+ return 2;
+ }
if (!strcmp(argv[i], "-screen")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86ScreenName = argv[++i];
- return 2;
- }
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86ScreenName = argv[++i];
+ return 2;
+ }
if (!strcmp(argv[i], "-pointer")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86PointerName = argv[++i];
- return 2;
- }
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86PointerName = argv[++i];
+ return 2;
+ }
if (!strcmp(argv[i], "-keyboard")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86KeyboardName = argv[++i];
- return 2;
- }
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86KeyboardName = argv[++i];
+ return 2;
+ }
if (!strcmp(argv[i], "-nosilk")) {
- xf86silkenMouseDisableFlag = TRUE;
- return 1;
- }
+ xf86silkenMouseDisableFlag = TRUE;
+ return 1;
+ }
#ifdef HAVE_ACPI
if (!strcmp(argv[i], "-noacpi")) {
- xf86acpiDisableFlag = TRUE;
- return 1;
- }
+ xf86acpiDisableFlag = TRUE;
+ return 1;
+ }
#endif
if (!strcmp(argv[i], "-configure")) {
- if (getuid() != 0 && geteuid() == 0) {
- ErrorF("The '-configure' option can only be used by root.\n");
- exit(1);
- }
- xf86DoConfigure = TRUE;
- xf86AllowMouseOpenFail = TRUE;
- return 1;
+ if (getuid() != 0 && geteuid() == 0) {
+ ErrorF("The '-configure' option can only be used by root.\n");
+ exit(1);
}
+ xf86DoConfigure = TRUE;
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
if (!strcmp(argv[i], "-showopts")) {
- if (getuid() != 0 && geteuid() == 0) {
- ErrorF("The '-showopts' option can only be used by root.\n");
- exit(1);
- }
- xf86DoShowOptions = TRUE;
- return 1;
+ if (getuid() != 0 && geteuid() == 0) {
+ ErrorF("The '-showopts' option can only be used by root.\n");
+ exit(1);
}
+ xf86DoShowOptions = TRUE;
+ return 1;
+ }
#ifdef XSERVER_LIBPCIACCESS
if (!strcmp(argv[i], "-isolateDevice")) {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (strncmp(argv[++i], "PCI:", 4)) {
- FatalError("Bus types other than PCI not yet isolable\n");
- }
- xf86PciIsolateDevice(argv[i]);
- return 2;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (strncmp(argv[++i], "PCI:", 4)) {
+ FatalError("Bus types other than PCI not yet isolable\n");
}
+ xf86PciIsolateDevice(argv[i]);
+ return 2;
+ }
#endif
- /* Notice cmdline xkbdir, but pass to dix as well */
+ /* Notice cmdline xkbdir, but pass to dix as well */
if (!strcmp(argv[i], "-xkbdir")) {
- xf86xkbdirFlag = TRUE;
- return 0;
- }
+ xf86xkbdirFlag = TRUE;
+ return 0;
+ }
if (!strcmp(argv[i], "-novtswitch")) {
- xf86Info.autoVTSwitch = FALSE;
- return 1;
- }
+ xf86Info.autoVTSwitch = FALSE;
+ return 1;
+ }
if (!strcmp(argv[i], "-sharevts")) {
- xf86Info.ShareVTs = TRUE;
- return 1;
- }
+ xf86Info.ShareVTs = TRUE;
+ return 1;
+ }
- /* OS-specific processing */
- return xf86ProcessArgument(argc, argv, i);
+ /* OS-specific processing */
+ return xf86ProcessArgument(argc, argv, i);
}
/*
@@ -1414,12 +1414,12 @@ ddxProcessArgument(int argc, char **argv, int i)
void
ddxUseMsg(void)
{
- ErrorF("\n");
- ErrorF("\n");
- ErrorF("Device Dependent Usage\n");
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("Device Dependent Usage\n");
if (!xf86PrivsElevated()) {
- ErrorF("-modulepath paths specify the module search path\n");
- ErrorF("-logfile file specify a log file name\n");
+ ErrorF("-modulepath paths specify the module search path\n");
+ ErrorF("-logfile file specify a log file name\n");
ErrorF("-configure probe for devices and write an "
__XCONFIGFILE__ "\n");
ErrorF
@@ -1433,49 +1433,49 @@ ddxUseMsg(void)
("-configdir dir specify a configuration directory, relative to the\n");
ErrorF(" " __XCONFIGDIR__
" search path, only root can use absolute\n");
- ErrorF("-verbose [n] verbose startup messages\n");
- ErrorF("-logverbose [n] verbose log messages\n");
- ErrorF("-quiet minimal startup messages\n");
- ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
- ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
- ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
- ErrorF("-depth n set colour depth. Default: 8\n");
+ ErrorF("-verbose [n] verbose startup messages\n");
+ ErrorF("-logverbose [n] verbose log messages\n");
+ ErrorF("-quiet minimal startup messages\n");
+ ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
+ ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
+ ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
+ ErrorF("-depth n set colour depth. Default: 8\n");
ErrorF
("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
- ErrorF("-rgamma f set gamma value for red phase\n");
- ErrorF("-ggamma f set gamma value for green phase\n");
- ErrorF("-bgamma f set gamma value for blue phase\n");
+ ErrorF("-rgamma f set gamma value for red phase\n");
+ ErrorF("-ggamma f set gamma value for green phase\n");
+ ErrorF("-bgamma f set gamma value for blue phase\n");
ErrorF
("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
- ErrorF("-layout name specify the ServerLayout section name\n");
- ErrorF("-screen name specify the Screen section name\n");
+ ErrorF("-layout name specify the ServerLayout section name\n");
+ ErrorF("-screen name specify the Screen section name\n");
ErrorF
("-keyboard name specify the core keyboard InputDevice name\n");
ErrorF
("-pointer name specify the core pointer InputDevice name\n");
- ErrorF("-nosilk disable Silken Mouse\n");
- ErrorF("-flipPixels swap default black/white Pixel values\n");
+ ErrorF("-nosilk disable Silken Mouse\n");
+ ErrorF("-flipPixels swap default black/white Pixel values\n");
#ifdef XF86VIDMODE
- ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
+ ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
ErrorF
("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
#endif
ErrorF
("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
- ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
+ ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
#ifdef XSERVER_LIBPCIACCESS
ErrorF
("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
#endif
- ErrorF("-version show the server version\n");
- ErrorF("-showDefaultModulePath show the server default module path\n");
- ErrorF("-showDefaultLibPath show the server default library path\n");
+ ErrorF("-version show the server version\n");
+ ErrorF("-showDefaultModulePath show the server default module path\n");
+ ErrorF("-showDefaultLibPath show the server default library path\n");
ErrorF
("-novtswitch don't automatically switch VT at reset & exit\n");
- ErrorF("-sharevts share VTs with another X server\n");
- /* OS-specific usage */
- xf86UseMsg();
- ErrorF("\n");
+ ErrorF("-sharevts share VTs with another X server\n");
+ /* OS-specific usage */
+ xf86UseMsg();
+ ErrorF("\n");
}
/*
@@ -1491,34 +1491,34 @@ xf86LoadModules(char **list, pointer *optlist)
Bool failed = FALSE;
if (!list)
- return TRUE;
+ return TRUE;
for (i = 0; list[i] != NULL; i++) {
- /* Normalise the module name */
- name = xf86NormalizeName(list[i]);
+ /* Normalise the module name */
+ name = xf86NormalizeName(list[i]);
- /* Skip empty names */
- if (name == NULL || *name == '\0') {
- free(name);
- continue;
- }
+ /* Skip empty names */
+ if (name == NULL || *name == '\0') {
+ free(name);
+ continue;
+ }
- /* Replace obsolete keyboard driver with kbd */
- if (!xf86NameCmp(name, "keyboard")) {
- strcpy(name, "kbd");
- }
+ /* Replace obsolete keyboard driver with kbd */
+ if (!xf86NameCmp(name, "keyboard")) {
+ strcpy(name, "kbd");
+ }
- if (optlist)
- opt = optlist[i];
- else
- opt = NULL;
+ if (optlist)
+ opt = optlist[i];
+ else
+ opt = NULL;
if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
- LoaderErrorMsg(NULL, name, errmaj, errmin);
- failed = TRUE;
- }
- free(name);
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ failed = TRUE;
+ }
+ free(name);
}
return !failed;
}
@@ -1529,7 +1529,7 @@ PixmapFormatPtr
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
{
int i;
- static PixmapFormatRec format; /* XXX not reentrant */
+ static PixmapFormatRec format; /* XXX not reentrant */
/*
* When the formats[] list initialisation isn't complete, check the
@@ -1537,35 +1537,35 @@ xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
*/
if (!formatsDone) {
- if (depth == 24) {
- Pix24Flags pix24 = Pix24DontCare;
-
- format.depth = 24;
- format.scanlinePad = BITMAP_SCANLINE_PAD;
- if (xf86Info.pixmap24 != Pix24DontCare)
- pix24 = xf86Info.pixmap24;
- else if (pScrn->pixmap24 != Pix24DontCare)
- pix24 = pScrn->pixmap24;
- if (pix24 == Pix24Use24)
- format.bitsPerPixel = 24;
- else
- format.bitsPerPixel = 32;
- return &format;
- }
+ if (depth == 24) {
+ Pix24Flags pix24 = Pix24DontCare;
+
+ format.depth = 24;
+ format.scanlinePad = BITMAP_SCANLINE_PAD;
+ if (xf86Info.pixmap24 != Pix24DontCare)
+ pix24 = xf86Info.pixmap24;
+ else if (pScrn->pixmap24 != Pix24DontCare)
+ pix24 = pScrn->pixmap24;
+ if (pix24 == Pix24Use24)
+ format.bitsPerPixel = 24;
+ else
+ format.bitsPerPixel = 32;
+ return &format;
+ }
}
for (i = 0; i < numFormats; i++)
- if (formats[i].depth == depth)
- break;
+ if (formats[i].depth == depth)
+ break;
if (i != numFormats)
- return &formats[i];
+ return &formats[i];
else if (!formatsDone) {
- /* Check for screen-specified formats */
- for (i = 0; i < pScrn->numFormats; i++)
- if (pScrn->formats[i].depth == depth)
- break;
- if (i != pScrn->numFormats)
- return &pScrn->formats[i];
+ /* Check for screen-specified formats */
+ for (i = 0; i < pScrn->numFormats; i++)
+ if (pScrn->formats[i].depth == depth)
+ break;
+ if (i != pScrn->numFormats)
+ return &pScrn->formats[i];
}
return NULL;
}
@@ -1577,7 +1577,14 @@ xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
format = xf86GetPixFormat(pScrn, depth);
if (format)
- return format->bitsPerPixel;
+ return format->bitsPerPixel;
else
- return 0;
+ return 0;
}
+
+#ifdef DDXMAIN
+void
+ddxMain(void)
+{
+}
+#endif
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index a5be3ae00..6f4af6c2c 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -30,35 +30,39 @@ INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/miext/shadow \
-I$(top_srcdir)/glx
-libdbe_la_LDFLAGS = -module -avoid-version
+libdbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la
libdbe_la_SOURCES = dbemodule.c
-libfb_la_LDFLAGS = -module -avoid-version
+libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
libfb_la_CFLAGS = $(AM_CFLAGS)
-libwfb_la_LDFLAGS = -module -avoid-version
+libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
-libglx_la_LDFLAGS = -module -avoid-version
+libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
+libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS)
if AIGLX_DRI_LOADER
-GLXDRI_LIBRARY = $(top_builddir)/glx/libglxdri.la
+libglx_la_LIBADD += $(top_builddir)/glx/libglxdri.la
+if NO_UNDEFINED
+libglx_la_LIBADD += ../dri/libdri.la ../dri2/libdri2.la
+endif
endif
-libglx_la_LIBADD = \
- $(top_builddir)/glx/libglx.la \
- $(GLXDRI_LIBRARY)
libglx_la_SOURCES = glxmodule.c
-librecord_la_LDFLAGS = -module -avoid-version
+librecord_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
librecord_la_LIBADD = $(top_builddir)/record/librecord.la
librecord_la_SOURCES = recordmod.c
-libshadow_la_LDFLAGS = -module -avoid-version
+libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la
+if NO_UNDEFINED
+libshadow_la_LIBADD += libfb.la
+endif
libshadow_la_SOURCES = shmodule.c
libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c
diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am
index 87c28a421..d08e9ad15 100644
--- a/hw/xfree86/dixmods/extmod/Makefile.am
+++ b/hw/xfree86/dixmods/extmod/Makefile.am
@@ -21,7 +21,7 @@ INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/hw/xfree86/loader \
-I$(top_srcdir)/miext/shadow
-libextmod_la_LDFLAGS = -module -avoid-version
+libextmod_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libextmod_la_SOURCES = modinit.c \
modinit.h \
$(DGA_SRCS) \
diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
index a7b491c6e..194cf8e3f 100644
--- a/hw/xfree86/dri/Makefile.am
+++ b/hw/xfree86/dri/Makefile.am
@@ -12,7 +12,8 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
@LIBDRM_CFLAGS@ \
@DRI_CFLAGS@
-libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
+libdri_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
+libdri_la_LIBADD = @LIBDRM_LIBS@
libdri_ladir = $(moduledir)/extensions
libdri_la_SOURCES = \
dri.c \
diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am
index c9fdde2f8..0e40fbcf2 100644
--- a/hw/xfree86/dri2/Makefile.am
+++ b/hw/xfree86/dri2/Makefile.am
@@ -6,7 +6,8 @@ libdri2_la_CFLAGS = \
-I$(top_srcdir)/hw/xfree86/common \
-I$(top_srcdir)/hw/xfree86/os-support/bus
-libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
+libdri2_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
+libdri2_la_LIBADD = @LIBDRM_LIBS@
libdri2_ladir = $(moduledir)/extensions
libdri2_la_SOURCES = \
dri2.c \
diff --git a/hw/xfree86/exa/Makefile.am b/hw/xfree86/exa/Makefile.am
index 3ced531fa..433908411 100644
--- a/hw/xfree86/exa/Makefile.am
+++ b/hw/xfree86/exa/Makefile.am
@@ -2,7 +2,7 @@ SUBDIRS = man
module_LTLIBRARIES = libexa.la
-libexa_la_LDFLAGS = -module -avoid-version
+libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
INCLUDES = \
$(XORG_INCS) \
@@ -15,4 +15,4 @@ libexa_la_SOURCES = \
examodule.c
libexa_la_LIBADD = \
- ../../../exa/libexa.la
+ ../../../exa/libexa.la $(PIXMAN_LIBS)
diff --git a/hw/xfree86/fbdevhw/Makefile.am b/hw/xfree86/fbdevhw/Makefile.am
index 4472acd91..1fa9321cb 100644
--- a/hw/xfree86/fbdevhw/Makefile.am
+++ b/hw/xfree86/fbdevhw/Makefile.am
@@ -2,7 +2,7 @@ SUBDIRS = man
module_LTLIBRARIES = libfbdevhw.la
-libfbdevhw_la_LDFLAGS = -module -avoid-version
+libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
if FBDEVHW
libfbdevhw_la_SOURCES = fbdevhw.c
diff --git a/hw/xfree86/i2c/Makefile.am b/hw/xfree86/i2c/Makefile.am
index 0b80cc8a6..f08541cf0 100644
--- a/hw/xfree86/i2c/Makefile.am
+++ b/hw/xfree86/i2c/Makefile.am
@@ -21,23 +21,26 @@ sdk_HEADERS = xf86i2c.h bt829.h fi1236.h msp3430.h tda8425.h tda9850.h tda9885.h
#
# i2c drivers
#
-bt829_drv_la_LDFLAGS = -module -avoid-version
+bt829_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
bt829_drv_la_SOURCES = bt829.c bt829.h bt829_module.c
-fi1236_drv_la_LDFLAGS = -module -avoid-version
+fi1236_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c
+if NO_UNDEFINED
+fi1236_drv_la_LIBADD = tda9885_drv.la
+endif
-msp3430_drv_la_LDFLAGS = -module -avoid-version
+msp3430_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
msp3430_drv_la_SOURCES = msp3430.c msp3430.h msp3430_module.c
-tda8425_drv_la_LDFLAGS = -module -avoid-version
+tda8425_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
tda8425_drv_la_SOURCES = tda8425.c tda8425.h tda8425_module.c
-tda9850_drv_la_LDFLAGS = -module -avoid-version
+tda9850_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
tda9850_drv_la_SOURCES = tda9850.c tda9850.h tda9850_module.c
-tda9885_drv_la_LDFLAGS = -module -avoid-version
+tda9885_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
tda9885_drv_la_SOURCES = tda9885.c tda9885.h tda9885_module.c
-uda1380_drv_la_LDFLAGS = -module -avoid-version
+uda1380_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
uda1380_drv_la_SOURCES = uda1380.c uda1380.h uda1380_module.c
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 6fa9554c9..98fe321fd 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -76,13 +76,13 @@ typedef struct _pattern {
/* Prototypes for static functions */
static char *FindModule(const char *, const char *, const char **, PatternPtr);
static Bool CheckVersion(const char *, XF86ModuleVersionInfo *,
- const XF86ModReqInfo *);
+ const XF86ModReqInfo *);
static void UnloadModuleOrDriver(ModuleDescPtr mod);
static char *LoaderGetCanonicalName(const char *, PatternPtr);
static void RemoveChild(ModuleDescPtr);
static ModuleDescPtr doLoadModule(const char *, const char *, const char **,
- const char **, pointer,
- const XF86ModReqInfo *, int *, int *);
+ const char **, pointer,
+ const XF86ModReqInfo *, int *, int *);
const ModuleVersions LoaderVersionInfo = {
XORG_VERSION_CURRENT,
@@ -93,7 +93,7 @@ const ModuleVersions LoaderVersionInfo = {
ABI_FONT_VERSION
};
-static int ModuleDuplicated[] = { };
+static int ModuleDuplicated[] = {};
static void
FreeStringList(char **paths)
@@ -101,10 +101,10 @@ FreeStringList(char **paths)
char **p;
if (!paths)
- return;
+ return;
for (p = paths; *p; p++)
- free(*p);
+ free(*p);
free(paths);
}
@@ -115,7 +115,7 @@ static Bool
PathIsAbsolute(const char *path)
{
return *path == '/';
-}
+}
/*
* Convert a comma-separated path into a NULL-terminated array of path
@@ -133,45 +133,45 @@ InitPathList(const char *path)
int n = 0;
if (!path)
- return defaultPathList;
+ return defaultPathList;
fullpath = strdup(path);
if (!fullpath)
- return NULL;
+ return NULL;
elem = strtok(fullpath, ",");
while (elem) {
if (PathIsAbsolute(elem)) {
- len = strlen(elem);
- addslash = (elem[len - 1] != '/');
- if (addslash)
- len++;
- save = list;
- list = realloc(list, (n + 2) * sizeof(char *));
- if (!list) {
- if (save) {
- save[n] = NULL;
- FreeStringList(save);
- }
- free(fullpath);
- return NULL;
- }
- list[n] = malloc(len + 1);
- if (!list[n]) {
- FreeStringList(list);
- free(fullpath);
- return NULL;
- }
- strcpy(list[n], elem);
- if (addslash) {
- list[n][len - 1] = '/';
- list[n][len] = '\0';
- }
- n++;
- }
- elem = strtok(NULL, ",");
+ len = strlen(elem);
+ addslash = (elem[len - 1] != '/');
+ if (addslash)
+ len++;
+ save = list;
+ list = realloc(list, (n + 2) * sizeof(char *));
+ if (!list) {
+ if (save) {
+ save[n] = NULL;
+ FreeStringList(save);
+ }
+ free(fullpath);
+ return NULL;
+ }
+ list[n] = malloc(len + 1);
+ if (!list[n]) {
+ FreeStringList(list);
+ free(fullpath);
+ return NULL;
+ }
+ strcpy(list[n], elem);
+ if (addslash) {
+ list[n][len - 1] = '/';
+ list[n][len] = '\0';
+ }
+ n++;
+ }
+ elem = strtok(NULL, ",");
}
if (list)
- list[n] = NULL;
+ list[n] = NULL;
free(fullpath);
return list;
}
@@ -180,14 +180,14 @@ static void
FreePathList(char **pathlist)
{
if (pathlist && pathlist != defaultPathList)
- FreeStringList(pathlist);
+ FreeStringList(pathlist);
}
void
LoaderSetPath(const char *path)
{
if (!path)
- return;
+ return;
defaultPathList = InitPathList(path);
}
@@ -212,9 +212,15 @@ static const char *stdSubdirs[] = {
* to port this DDX to, say, Darwin, we'll need to fix this.
*/
static PatternRec stdPatterns[] = {
+#ifdef __CYGWIN__
+ {"^cyg(.*)\\.dll$",},
+ {"(.*)_drv\\.dll$",},
+ {"(.*)\\.dll$",},
+#else
{"^lib(.*)\\.so$",},
{"(.*)_drv\\.so$",},
{"(.*)\\.so$",},
+#endif
{NULL,}
};
@@ -229,45 +235,45 @@ InitPatterns(const char **patternlist)
const char **s;
if (firstTime) {
- /* precompile stdPatterns */
- firstTime = 0;
- for (p = stdPatterns; p->pattern; p++)
- if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
- regerror(e, &p->rex, errmsg, sizeof(errmsg));
- FatalError("InitPatterns: regcomp error for `%s': %s\n",
- p->pattern, errmsg);
- }
+ /* precompile stdPatterns */
+ firstTime = 0;
+ for (p = stdPatterns; p->pattern; p++)
+ if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
+ regerror(e, &p->rex, errmsg, sizeof(errmsg));
+ FatalError("InitPatterns: regcomp error for `%s': %s\n",
+ p->pattern, errmsg);
+ }
}
if (patternlist) {
- for (i = 0, s = patternlist; *s; i++, s++)
- if (*s == DEFAULT_LIST)
- i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
- patterns = malloc((i + 1) * sizeof(PatternRec));
- if (!patterns) {
- return NULL;
- }
- for (i = 0, s = patternlist; *s; i++, s++)
- if (*s != DEFAULT_LIST) {
- p = patterns + i;
- p->pattern = *s;
- if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
- regerror(e, &p->rex, errmsg, sizeof(errmsg));
- ErrorF("InitPatterns: regcomp error for `%s': %s\n",
- p->pattern, errmsg);
- i--;
- }
+ for (i = 0, s = patternlist; *s; i++, s++)
+ if (*s == DEFAULT_LIST)
+ i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
+ patterns = malloc((i + 1) * sizeof(PatternRec));
+ if (!patterns) {
+ return NULL;
+ }
+ for (i = 0, s = patternlist; *s; i++, s++)
+ if (*s != DEFAULT_LIST) {
+ p = patterns + i;
+ p->pattern = *s;
+ if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
+ regerror(e, &p->rex, errmsg, sizeof(errmsg));
+ ErrorF("InitPatterns: regcomp error for `%s': %s\n",
+ p->pattern, errmsg);
+ i--;
+ }
}
else {
- for (p = stdPatterns; p->pattern; p++, i++)
- patterns[i] = *p;
- if (p != stdPatterns)
- i--;
- }
- patterns[i].pattern = NULL;
+ for (p = stdPatterns; p->pattern; p++, i++)
+ patterns[i] = *p;
+ if (p != stdPatterns)
+ i--;
+ }
+ patterns[i].pattern = NULL;
}
else
- patterns = stdPatterns;
+ patterns = stdPatterns;
return patterns;
}
@@ -275,7 +281,7 @@ static void
FreePatterns(PatternPtr patterns)
{
if (patterns && patterns != stdPatterns)
- free(patterns);
+ free(patterns);
}
static const char **
@@ -291,84 +297,84 @@ InitSubdirs(const char **subdirlist)
Bool indefault;
if (subdirlist == NULL) {
- subdirlist = tmp_subdirlist = malloc(2 * sizeof(char *));
- if (subdirlist == NULL)
- return NULL;
- subdirlist[0] = DEFAULT_LIST;
- subdirlist[1] = NULL;
+ subdirlist = tmp_subdirlist = malloc(2 * sizeof(char *));
+ if (subdirlist == NULL)
+ return NULL;
+ subdirlist[0] = DEFAULT_LIST;
+ subdirlist[1] = NULL;
}
LoaderGetOS(&osname, NULL, NULL, NULL);
oslen = strlen(osname);
{
- /* Count number of entries and check for invalid paths */
- for (i = 0, s = subdirlist; *s; i++, s++) {
- if (*s == DEFAULT_LIST) {
- i += sizeof(stdSubdirs) / sizeof(stdSubdirs[0]) - 1 - 1;
+ /* Count number of entries and check for invalid paths */
+ for (i = 0, s = subdirlist; *s; i++, s++) {
+ if (*s == DEFAULT_LIST) {
+ i += sizeof(stdSubdirs) / sizeof(stdSubdirs[0]) - 1 - 1;
}
else {
- /*
- * Path validity check. Don't allow absolute paths, or
- * paths containing "..". To catch absolute paths on
- * platforms that use driver letters, don't allow the ':'
- * character to appear at all.
- */
- if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
- strstr(*s, "..")) {
- xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
- free(tmp_subdirlist);
- return NULL;
- }
- }
- }
- subdirs = malloc((i * 2 + 1) * sizeof(char *));
- if (!subdirs) {
- free(tmp_subdirlist);
- return NULL;
- }
- i = 0;
- s = subdirlist;
- indefault = FALSE;
- while (*s) {
- if (*s == DEFAULT_LIST) {
- /* Divert to the default list */
- indefault = TRUE;
- stmp = ++s;
- s = stdSubdirs;
- }
- len = strlen(*s);
- if (**s && (*s)[len - 1] != '/') {
- slash = "/";
- len++;
+ /*
+ * Path validity check. Don't allow absolute paths, or
+ * paths containing "..". To catch absolute paths on
+ * platforms that use driver letters, don't allow the ':'
+ * character to appear at all.
+ */
+ if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
+ strstr(*s, "..")) {
+ xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
+ free(tmp_subdirlist);
+ return NULL;
+ }
+ }
+ }
+ subdirs = malloc((i * 2 + 1) * sizeof(char *));
+ if (!subdirs) {
+ free(tmp_subdirlist);
+ return NULL;
+ }
+ i = 0;
+ s = subdirlist;
+ indefault = FALSE;
+ while (*s) {
+ if (*s == DEFAULT_LIST) {
+ /* Divert to the default list */
+ indefault = TRUE;
+ stmp = ++s;
+ s = stdSubdirs;
+ }
+ len = strlen(*s);
+ if (**s && (*s)[len - 1] != '/') {
+ slash = "/";
+ len++;
}
else
- slash = "";
- len += oslen + 2;
- if (!(subdirs[i] = malloc(len))) {
- while (--i >= 0)
- free(subdirs[i]);
- free(subdirs);
- free(tmp_subdirlist);
- return NULL;
- }
- /* tack on the OS name */
- sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
- i++;
- /* path as given */
- subdirs[i] = strdup(*s);
- i++;
- s++;
- if (indefault && !s) {
- /* revert back to the main list */
- indefault = FALSE;
- s = stmp;
- }
- }
- subdirs[i] = NULL;
+ slash = "";
+ len += oslen + 2;
+ if (!(subdirs[i] = malloc(len))) {
+ while (--i >= 0)
+ free(subdirs[i]);
+ free(subdirs);
+ free(tmp_subdirlist);
+ return NULL;
+ }
+ /* tack on the OS name */
+ sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
+ i++;
+ /* path as given */
+ subdirs[i] = strdup(*s);
+ i++;
+ s++;
+ if (indefault && !s) {
+ /* revert back to the main list */
+ indefault = FALSE;
+ s = stmp;
+ }
+ }
+ subdirs[i] = NULL;
}
free(tmp_subdirlist);
- return (const char **) subdirs;
+ return (const char **)subdirs;
}
static void
@@ -377,9 +383,9 @@ FreeSubdirs(const char **subdirs)
const char **s;
if (subdirs) {
- for (s = subdirs; *s; s++)
- free((char *) *s);
- free(subdirs);
+ for (s = subdirs; *s; s++)
+ free((char *)*s);
+ free(subdirs);
}
}
@@ -399,44 +405,56 @@ FindModuleInSubdir(const char *dirpath, const char *module)
if (direntry->d_name[0] == '.')
continue;
snprintf(tmpBuf, PATH_MAX, "%s%s/", dirpath, direntry->d_name);
- /* the stat with the appended / fails for normal files,
- and works for sub dirs fine, looks a bit strange in strace
- but does seem to work */
+ /* the stat with the appended / fails for normal files,
+ and works for sub dirs fine, looks a bit strange in strace
+ but does seem to work */
if ((stat(tmpBuf, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode)) {
if ((ret = FindModuleInSubdir(tmpBuf, module)))
break;
continue;
}
-
+
+#ifdef __CYGWIN__
+ snprintf(tmpBuf, PATH_MAX, "cyg%s.dll", module);
+#else
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
+#endif
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
- ret = NULL;
+ ret = NULL;
break;
}
+#ifdef __CYGWIN__
+ snprintf(tmpBuf, PATH_MAX, "%s_drv.dll", module);
+#else
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
+#endif
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
- ret = NULL;
+ ret = NULL;
break;
}
+#ifdef __CYGWIN__
+ snprintf(tmpBuf, PATH_MAX, "%s.dll", module);
+#else
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
+#endif
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
- ret = NULL;
+ ret = NULL;
break;
}
}
-
+
closedir(dir);
return ret;
}
static char *
FindModule(const char *module, const char *dirname, const char **subdirlist,
- PatternPtr patterns)
+ PatternPtr patterns)
{
char buf[PATH_MAX + 1];
char *name = NULL;
@@ -444,17 +462,17 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
const char **s;
if (strlen(dirname) > PATH_MAX)
- return NULL;
-
+ return NULL;
+
subdirs = InitSubdirs(subdirlist);
if (!subdirs)
- return NULL;
+ return NULL;
for (s = subdirs; *s; s++) {
- if ((strlen(dirname) + strlen(*s)) > PATH_MAX)
- continue;
- strcpy(buf, dirname);
- strcat(buf, *s);
+ if ((strlen(dirname) + strlen(*s)) > PATH_MAX)
+ continue;
+ strcpy(buf, dirname);
+ strcat(buf, *s);
if ((name = FindModuleInSubdir(buf, module)))
break;
}
@@ -486,70 +504,70 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
int n = 0;
if (!(pathlist = InitPathList(NULL)))
- return NULL;
+ return NULL;
if (!(subdirs = InitSubdirs(subdirlist)))
- goto bail;
+ goto bail;
if (!(patterns = InitPatterns(patternlist)))
- goto bail;
+ goto bail;
for (elem = pathlist; *elem; elem++) {
- for (s = subdirs; *s; s++) {
- if ((dirlen = strlen(*elem) + strlen(*s)) > PATH_MAX)
- continue;
- strcpy(buf, *elem);
- strcat(buf, *s);
- fp = buf + dirlen;
- if (stat(buf, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode) &&
- (d = opendir(buf))) {
- if (buf[dirlen - 1] != '/') {
- buf[dirlen++] = '/';
- fp++;
- }
- while ((dp = readdir(d))) {
- if (dirlen + strlen(dp->d_name) > PATH_MAX)
- continue;
- strcpy(fp, dp->d_name);
- if (!(stat(buf, &stat_buf) == 0 &&
- S_ISREG(stat_buf.st_mode)))
- continue;
- for (p = patterns; p->pattern; p++) {
- if (regexec(&p->rex, dp->d_name, 2, match, 0) == 0 &&
- match[1].rm_so != -1) {
- len = match[1].rm_eo - match[1].rm_so;
- save = listing;
- listing = realloc(listing,
- (n + 2) * sizeof(char *));
- if (!listing) {
- if (save) {
- save[n] = NULL;
- FreeStringList(save);
- }
- closedir(d);
- goto bail;
- }
- listing[n] = malloc(len + 1);
- if (!listing[n]) {
- FreeStringList(listing);
- closedir(d);
- goto bail;
- }
- strncpy(listing[n], dp->d_name + match[1].rm_so,
- len);
- listing[n][len] = '\0';
- n++;
- break;
- }
- }
- }
- closedir(d);
- }
- }
+ for (s = subdirs; *s; s++) {
+ if ((dirlen = strlen(*elem) + strlen(*s)) > PATH_MAX)
+ continue;
+ strcpy(buf, *elem);
+ strcat(buf, *s);
+ fp = buf + dirlen;
+ if (stat(buf, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode) &&
+ (d = opendir(buf))) {
+ if (buf[dirlen - 1] != '/') {
+ buf[dirlen++] = '/';
+ fp++;
+ }
+ while ((dp = readdir(d))) {
+ if (dirlen + strlen(dp->d_name) > PATH_MAX)
+ continue;
+ strcpy(fp, dp->d_name);
+ if (!(stat(buf, &stat_buf) == 0 &&
+ S_ISREG(stat_buf.st_mode)))
+ continue;
+ for (p = patterns; p->pattern; p++) {
+ if (regexec(&p->rex, dp->d_name, 2, match, 0) == 0 &&
+ match[1].rm_so != -1) {
+ len = match[1].rm_eo - match[1].rm_so;
+ save = listing;
+ listing = realloc(listing,
+ (n + 2) * sizeof(char *));
+ if (!listing) {
+ if (save) {
+ save[n] = NULL;
+ FreeStringList(save);
+ }
+ closedir(d);
+ goto bail;
+ }
+ listing[n] = malloc(len + 1);
+ if (!listing[n]) {
+ FreeStringList(listing);
+ closedir(d);
+ goto bail;
+ }
+ strncpy(listing[n], dp->d_name + match[1].rm_so,
+ len);
+ listing[n][len] = '\0';
+ n++;
+ break;
+ }
+ }
+ }
+ closedir(d);
+ }
+ }
}
if (listing)
- listing[n] = NULL;
+ listing[n] = NULL;
ret = listing;
- bail:
+bail:
FreePatterns(patterns);
FreeSubdirs(subdirs);
FreePathList(pathlist);
@@ -564,7 +582,7 @@ LoaderFreeDirList(char **list)
static Bool
CheckVersion(const char *module, XF86ModuleVersionInfo * data,
- const XF86ModReqInfo * req)
+ const XF86ModReqInfo * req)
{
int vercode[4];
char verstr[4];
@@ -572,8 +590,8 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
MessageType errtype;
xf86Msg(X_INFO, "Module %s: vendor=\"%s\"\n",
- data->modname ? data->modname : "UNKNOWN!",
- data->vendor ? data->vendor : "UNKNOWN!");
+ data->modname ? data->modname : "UNKNOWN!",
+ data->vendor ? data->vendor : "UNKNOWN!");
/* Check for the different scheme used in XFree86 4.0.x releases:
* ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
@@ -581,157 +599,157 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
* range, which limits the overlap with the new version scheme to conflicts
* with 6.71.8.764 through 6.72.39.934.
*/
- if ((ver > (4 << 24)) && (ver < ((4 << 24) + (1 << 17)))) {
- /* 4.0.x and earlier */
- verstr[1] = verstr[3] = 0;
- verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
- ver >>= 5;
- verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
- ver >>= 5;
- vercode[2] = ver & 0x7f;
- ver >>= 7;
- vercode[1] = ver & 0x7f;
- ver >>= 7;
- vercode[0] = ver;
- xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
- if (vercode[2] != 0)
- xf86ErrorF(".%d", vercode[2]);
- xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
- data->majorversion, data->minorversion, data->patchlevel);
+ if ((ver > (4 << 24)) && (ver < ( (4 << 24) + (1 << 17)))) {
+ /* 4.0.x and earlier */
+ verstr[1] = verstr[3] = 0;
+ verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
+ ver >>= 5;
+ verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
+ ver >>= 5;
+ vercode[2] = ver & 0x7f;
+ ver >>= 7;
+ vercode[1] = ver & 0x7f;
+ ver >>= 7;
+ vercode[0] = ver;
+ xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
+ if (vercode[2] != 0)
+ xf86ErrorF(".%d", vercode[2]);
+ xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
+ data->majorversion, data->minorversion, data->patchlevel);
}
else {
- vercode[0] = ver / 10000000;
- vercode[1] = (ver / 100000) % 100;
- vercode[2] = (ver / 1000) % 100;
- vercode[3] = ver % 1000;
- xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
- vercode[2]);
- if (vercode[3] != 0)
- xf86ErrorF(".%d", vercode[3]);
- xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
- data->minorversion, data->patchlevel);
+ vercode[0] = ver / 10000000;
+ vercode[1] = (ver / 100000) % 100;
+ vercode[2] = (ver / 1000) % 100;
+ vercode[3] = ver % 1000;
+ xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
+ vercode[2]);
+ if (vercode[3] != 0)
+ xf86ErrorF(".%d", vercode[3]);
+ xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
+ data->minorversion, data->patchlevel);
}
if (data->moduleclass)
- xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
+ xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
ver = -1;
if (data->abiclass) {
- int abimaj, abimin;
- int vermaj, vermin;
-
- if (!strcmp(data->abiclass, ABI_CLASS_ANSIC))
- ver = LoaderVersionInfo.ansicVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_VIDEODRV))
- ver = LoaderVersionInfo.videodrvVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_XINPUT))
- ver = LoaderVersionInfo.xinputVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_EXTENSION))
- ver = LoaderVersionInfo.extensionVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_FONT))
- ver = LoaderVersionInfo.fontVersion;
-
- abimaj = GET_ABI_MAJOR(data->abiversion);
- abimin = GET_ABI_MINOR(data->abiversion);
- xf86ErrorFVerb(2, "\tABI class: %s, version %d.%d\n",
- data->abiclass, abimaj, abimin);
- if (ver != -1) {
- vermaj = GET_ABI_MAJOR(ver);
- vermin = GET_ABI_MINOR(ver);
- if (abimaj != vermaj) {
- if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
- errtype = X_WARNING;
- else
- errtype = X_ERROR;
- xf86MsgVerb(errtype, 0,
- "module ABI major version (%d) doesn't"
- " match the server's version (%d)\n",
- abimaj, vermaj);
- if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
- return FALSE;
+ int abimaj, abimin;
+ int vermaj, vermin;
+
+ if (!strcmp(data->abiclass, ABI_CLASS_ANSIC))
+ ver = LoaderVersionInfo.ansicVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_VIDEODRV))
+ ver = LoaderVersionInfo.videodrvVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_XINPUT))
+ ver = LoaderVersionInfo.xinputVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_EXTENSION))
+ ver = LoaderVersionInfo.extensionVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_FONT))
+ ver = LoaderVersionInfo.fontVersion;
+
+ abimaj = GET_ABI_MAJOR(data->abiversion);
+ abimin = GET_ABI_MINOR(data->abiversion);
+ xf86ErrorFVerb(2, "\tABI class: %s, version %d.%d\n",
+ data->abiclass, abimaj, abimin);
+ if (ver != -1) {
+ vermaj = GET_ABI_MAJOR(ver);
+ vermin = GET_ABI_MINOR(ver);
+ if (abimaj != vermaj) {
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
+ "module ABI major version (%d) doesn't"
+ " match the server's version (%d)\n",
+ abimaj, vermaj);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
}
else if (abimin > vermin) {
- if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
- errtype = X_WARNING;
- else
- errtype = X_ERROR;
- xf86MsgVerb(errtype, 0,
- "module ABI minor version (%d) is "
- "newer than the server's version "
- "(%d)\n", abimin, vermin);
- if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
- return FALSE;
- }
- }
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
+ "module ABI minor version (%d) is "
+ "newer than the server's version "
+ "(%d)\n", abimin, vermin);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
+ }
+ }
}
/* Check against requirements that the caller has specified */
if (req) {
- if (req->majorversion != MAJOR_UNSPEC) {
- if (data->majorversion != req->majorversion) {
- xf86MsgVerb(X_WARNING, 2, "module major version (%d) "
- "doesn't match required major version (%d)\n",
- data->majorversion, req->majorversion);
- return FALSE;
+ if (req->majorversion != MAJOR_UNSPEC) {
+ if (data->majorversion != req->majorversion) {
+ xf86MsgVerb(X_WARNING, 2, "module major version (%d) "
+ "doesn't match required major version (%d)\n",
+ data->majorversion, req->majorversion);
+ return FALSE;
}
else if (req->minorversion != MINOR_UNSPEC) {
- if (data->minorversion < req->minorversion) {
- xf86MsgVerb(X_WARNING, 2, "module minor version (%d) "
- "is less than the required minor version (%d)\n",
- data->minorversion, req->minorversion);
- return FALSE;
+ if (data->minorversion < req->minorversion) {
+ xf86MsgVerb(X_WARNING, 2, "module minor version (%d) "
+ "is less than the required minor version (%d)\n",
+ data->minorversion, req->minorversion);
+ return FALSE;
}
else if (data->minorversion == req->minorversion &&
- req->patchlevel != PATCH_UNSPEC) {
- if (data->patchlevel < req->patchlevel) {
- xf86MsgVerb(X_WARNING, 2, "module patch level (%d) "
- "is less than the required patch level (%d)\n",
- data->patchlevel, req->patchlevel);
- return FALSE;
- }
- }
- }
- }
- if (req->moduleclass) {
- if (!data->moduleclass ||
- strcmp(req->moduleclass, data->moduleclass)) {
- xf86MsgVerb(X_WARNING, 2, "Module class (%s) doesn't match "
- "the required class (%s)\n",
- data->moduleclass ? data->moduleclass : "<NONE>",
- req->moduleclass);
- return FALSE;
- }
+ req->patchlevel != PATCH_UNSPEC) {
+ if (data->patchlevel < req->patchlevel) {
+ xf86MsgVerb(X_WARNING, 2, "module patch level (%d) "
+ "is less than the required patch level (%d)\n",
+ data->patchlevel, req->patchlevel);
+ return FALSE;
+ }
+ }
+ }
+ }
+ if (req->moduleclass) {
+ if (!data->moduleclass ||
+ strcmp(req->moduleclass, data->moduleclass)) {
+ xf86MsgVerb(X_WARNING, 2, "Module class (%s) doesn't match "
+ "the required class (%s)\n",
+ data->moduleclass ? data->moduleclass : "<NONE>",
+ req->moduleclass);
+ return FALSE;
+ }
}
else if (req->abiclass != ABI_CLASS_NONE) {
- if (!data->abiclass || strcmp(req->abiclass, data->abiclass)) {
- xf86MsgVerb(X_WARNING, 2, "ABI class (%s) doesn't match the "
- "required ABI class (%s)\n",
- data->abiclass ? data->abiclass : "<NONE>",
- req->abiclass);
- return FALSE;
- }
- }
- if ((req->abiclass != ABI_CLASS_NONE) &&
- req->abiversion != ABI_VERS_UNSPEC) {
- int reqmaj, reqmin, maj, min;
-
- reqmaj = GET_ABI_MAJOR(req->abiversion);
- reqmin = GET_ABI_MINOR(req->abiversion);
- maj = GET_ABI_MAJOR(data->abiversion);
- min = GET_ABI_MINOR(data->abiversion);
- if (maj != reqmaj) {
- xf86MsgVerb(X_WARNING, 2, "ABI major version (%d) doesn't "
- "match the required ABI major version (%d)\n",
- maj, reqmaj);
- return FALSE;
- }
- /* XXX Maybe this should be the other way around? */
- if (min > reqmin) {
- xf86MsgVerb(X_WARNING, 2, "module ABI minor version (%d) "
- "is newer than that available (%d)\n", min, reqmin);
- return FALSE;
- }
- }
+ if (!data->abiclass || strcmp(req->abiclass, data->abiclass)) {
+ xf86MsgVerb(X_WARNING, 2, "ABI class (%s) doesn't match the "
+ "required ABI class (%s)\n",
+ data->abiclass ? data->abiclass : "<NONE>",
+ req->abiclass);
+ return FALSE;
+ }
+ }
+ if ((req->abiclass != ABI_CLASS_NONE) &&
+ req->abiversion != ABI_VERS_UNSPEC) {
+ int reqmaj, reqmin, maj, min;
+
+ reqmaj = GET_ABI_MAJOR(req->abiversion);
+ reqmin = GET_ABI_MINOR(req->abiversion);
+ maj = GET_ABI_MAJOR(data->abiversion);
+ min = GET_ABI_MINOR(data->abiversion);
+ if (maj != reqmaj) {
+ xf86MsgVerb(X_WARNING, 2, "ABI major version (%d) doesn't "
+ "match the required ABI major version (%d)\n",
+ maj, reqmaj);
+ return FALSE;
+ }
+ /* XXX Maybe this should be the other way around? */
+ if (min > reqmin) {
+ xf86MsgVerb(X_WARNING, 2, "module ABI minor version (%d) "
+ "is newer than that available (%d)\n", min, reqmin);
+ return FALSE;
+ }
+ }
}
return TRUE;
}
@@ -745,31 +763,31 @@ AddSibling(ModuleDescPtr head, ModuleDescPtr new)
pointer
LoadSubModule(pointer _parent, const char *module,
- const char **subdirlist, const char **patternlist,
- pointer options, const XF86ModReqInfo * modreq,
- int *errmaj, int *errmin)
+ const char **subdirlist, const char **patternlist,
+ pointer options, const XF86ModReqInfo * modreq,
+ int *errmaj, int *errmin)
{
ModuleDescPtr submod;
- ModuleDescPtr parent = (ModuleDescPtr) _parent;
+ ModuleDescPtr parent = (ModuleDescPtr)_parent;
xf86MsgVerb(X_INFO, 3, "Loading sub module \"%s\"\n", module);
if (PathIsAbsolute(module)) {
- xf86Msg(X_ERROR,
- "LoadSubModule: Absolute module path not permitted: \"%s\"\n",
- module);
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 0;
- return NULL;
+ xf86Msg(X_ERROR,
+ "LoadSubModule: Absolute module path not permitted: \"%s\"\n",
+ module);
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 0;
+ return NULL;
}
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
- modreq, errmaj, errmin);
+ modreq, errmaj, errmin);
if (submod && submod != (ModuleDescPtr) 1) {
- parent->child = AddSibling(parent->child, submod);
- submod->parent = parent;
+ parent->child = AddSibling(parent->child, submod);
+ submod->parent = parent;
}
return submod;
}
@@ -780,7 +798,7 @@ NewModuleDesc(const char *name)
ModuleDescPtr mdp = calloc(1, sizeof(ModuleDesc));
if (mdp)
- mdp->name = xstrdup(name);
+ mdp->name = xstrdup(name);
return mdp;
}
@@ -791,11 +809,11 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
ModuleDescPtr ret;
if (!mod)
- return NULL;
+ return NULL;
ret = NewModuleDesc(mod->name);
if (ret == NULL)
- return NULL;
+ return NULL;
ret->handle = mod->handle;
@@ -820,7 +838,7 @@ static const char *compiled_in_modules[] = {
static ModuleDescPtr
doLoadModule(const char *module, const char *path, const char **subdirlist,
- const char **patternlist, pointer options,
+ const char **patternlist, pointer options,
const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
{
XF86ModuleData *initdata = NULL;
@@ -841,48 +859,48 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
name = LoaderGetCanonicalName(module, patterns);
noncanonical = (name && strcmp(module, name) != 0);
if (noncanonical) {
- xf86ErrorFVerb(3, " (%s)\n", name);
- xf86MsgVerb(X_WARNING, 1,
- "LoadModule: given non-canonical module name \"%s\"\n",
- module);
- m = name;
+ xf86ErrorFVerb(3, " (%s)\n", name);
+ xf86MsgVerb(X_WARNING, 1,
+ "LoadModule: given non-canonical module name \"%s\"\n",
+ module);
+ m = name;
}
else {
- xf86ErrorFVerb(3, "\n");
- m = (char *) module;
+ xf86ErrorFVerb(3, "\n");
+ m = (char *)module;
}
for (cim = compiled_in_modules; *cim; cim++)
if (!strcmp(m, *cim)) {
- xf86MsgVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m);
- ret = (ModuleDescPtr) 1;
- goto LoadModule_exit;
- }
+ xf86MsgVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m);
+ ret = (ModuleDescPtr) 1;
+ goto LoadModule_exit;
+ }
if (!name) {
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
ret = NewModuleDesc(name);
if (!ret) {
- if (errmaj)
- *errmaj = LDR_NOMEM;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ if (errmaj)
+ *errmaj = LDR_NOMEM;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
pathlist = InitPathList(path);
if (!pathlist) {
- /* This could be a malloc failure too */
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 1;
- goto LoadModule_fail;
+ /* This could be a malloc failure too */
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 1;
+ goto LoadModule_fail;
}
/*
@@ -890,35 +908,35 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* check the elements in the path
*/
if (PathIsAbsolute(module))
- found = xstrdup(module);
+ found = xstrdup(module);
path_elem = pathlist;
while (!found && *path_elem != NULL) {
- found = FindModule(m, *path_elem, subdirlist, patterns);
- path_elem++;
- /*
- * When the module name isn't the canonical name, search for the
- * former if no match was found for the latter.
- */
- if (!*path_elem && m == name) {
- path_elem = pathlist;
- m = (char *) module;
- }
+ found = FindModule(m, *path_elem, subdirlist, patterns);
+ path_elem++;
+ /*
+ * When the module name isn't the canonical name, search for the
+ * former if no match was found for the latter.
+ */
+ if (!*path_elem && m == name) {
+ path_elem = pathlist;
+ m = (char *)module;
+ }
}
/*
* did we find the module?
*/
if (!found) {
- xf86Msg(X_WARNING, "Warning, couldn't open module %s\n", module);
- if (errmaj)
- *errmaj = LDR_NOENT;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ xf86Msg(X_WARNING, "Warning, couldn't open module %s\n", module);
+ if (errmaj)
+ *errmaj = LDR_NOENT;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
ret->handle = LoaderOpen(found, errmaj, errmin);
if (ret->handle == NULL)
- goto LoadModule_fail;
+ goto LoadModule_fail;
ret->path = strdup(found);
/* drop any explicit suffix from the module name */
@@ -931,22 +949,22 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* present.
*/
if (asprintf(&p, "%sModuleData", name) == -1) {
- p = NULL;
- if (errmaj)
- *errmaj = LDR_NOMEM;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ p = NULL;
+ if (errmaj)
+ *errmaj = LDR_NOMEM;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
initdata = LoaderSymbolFromModule(ret->handle, p);
if (initdata) {
- ModuleSetupProc setup;
- ModuleTearDownProc teardown;
- XF86ModuleVersionInfo *vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+ XF86ModuleVersionInfo *vers;
- vers = initdata->vers;
- setup = initdata->setup;
- teardown = initdata->teardown;
+ vers = initdata->vers;
+ setup = initdata->setup;
+ teardown = initdata->teardown;
if (vers) {
if (!CheckVersion(module, vers, modreq)) {
@@ -967,43 +985,43 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
*errmin = 0;
goto LoadModule_fail;
}
- if (setup)
- ret->SetupProc = setup;
- if (teardown)
- ret->TearDownProc = teardown;
- ret->VersionInfo = vers;
+ if (setup)
+ ret->SetupProc = setup;
+ if (teardown)
+ ret->TearDownProc = teardown;
+ ret->VersionInfo = vers;
}
else {
- /* No initdata is OK for external modules */
- if (options == EXTERN_MODULE)
- goto LoadModule_exit;
-
- /* no initdata, fail the load */
- xf86Msg(X_ERROR, "LoadModule: Module %s does not have a %s "
- "data object.\n", module, p);
- if (errmaj)
- *errmaj = LDR_INVALID;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ /* No initdata is OK for external modules */
+ if (options == EXTERN_MODULE)
+ goto LoadModule_exit;
+
+ /* no initdata, fail the load */
+ xf86Msg(X_ERROR, "LoadModule: Module %s does not have a %s "
+ "data object.\n", module, p);
+ if (errmaj)
+ *errmaj = LDR_INVALID;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
if (ret->SetupProc) {
- ret->TearDownData = ret->SetupProc(ret, options, errmaj, errmin);
- if (!ret->TearDownData) {
- goto LoadModule_fail;
- }
+ ret->TearDownData = ret->SetupProc(ret, options, errmaj, errmin);
+ if (!ret->TearDownData) {
+ goto LoadModule_fail;
+ }
}
else if (options) {
- xf86Msg(X_WARNING, "Module Options present, but no SetupProc "
- "available for %s\n", module);
+ xf86Msg(X_WARNING, "Module Options present, but no SetupProc "
+ "available for %s\n", module);
}
goto LoadModule_exit;
- LoadModule_fail:
+ LoadModule_fail:
UnloadModule(ret);
ret = NULL;
- LoadModule_exit:
+ LoadModule_exit:
FreePathList(pathlist);
FreePatterns(patterns);
free(found);
@@ -1052,43 +1070,43 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
*/
ModuleDescPtr
LoadModule(const char *module, const char *path, const char **subdirlist,
- const char **patternlist, pointer options,
- const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
+ const char **patternlist, pointer options,
+ const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
{
- return doLoadModule(module, path, subdirlist, patternlist, options,
- modreq, errmaj, errmin);
+ return doLoadModule(module, path, subdirlist, patternlist, options,
+ modreq, errmaj, errmin);
}
void
UnloadModule(pointer mod)
{
- UnloadModuleOrDriver((ModuleDescPtr) mod);
+ UnloadModuleOrDriver((ModuleDescPtr)mod);
}
static void
UnloadModuleOrDriver(ModuleDescPtr mod)
{
if (mod == (ModuleDescPtr) 1)
- return;
+ return;
if (mod == NULL || mod->name == NULL)
- return;
+ return;
if (mod->parent)
- xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name);
+ xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name);
else
- xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name);
+ xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name);
if (mod->TearDownData != ModuleDuplicated) {
- if ((mod->TearDownProc) && (mod->TearDownData))
- mod->TearDownProc(mod->TearDownData);
- LoaderUnload(mod->name, mod->handle);
+ if ((mod->TearDownProc) && (mod->TearDownData))
+ mod->TearDownProc(mod->TearDownData);
+ LoaderUnload(mod->name, mod->handle);
}
if (mod->child)
- UnloadModuleOrDriver(mod->child);
+ UnloadModuleOrDriver(mod->child);
if (mod->sib)
- UnloadModuleOrDriver(mod->sib);
+ UnloadModuleOrDriver(mod->sib);
free(mod->path);
free(mod->name);
free(mod);
@@ -1097,11 +1115,11 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
void
UnloadSubModule(pointer _mod)
{
- ModuleDescPtr mod = (ModuleDescPtr) _mod;
+ ModuleDescPtr mod = (ModuleDescPtr)_mod;
/* Some drivers are calling us on built-in submodules, ignore them */
- if (mod == (ModuleDescPtr) 1)
- return;
+ if (mod == (ModuleDescPtr)1)
+ return;
RemoveChild(mod);
UnloadModuleOrDriver(mod);
}
@@ -1114,22 +1132,22 @@ RemoveChild(ModuleDescPtr child)
ModuleDescPtr parent;
if (!child->parent)
- return;
+ return;
parent = child->parent;
if (parent->child == child) {
- parent->child = child->sib;
- return;
+ parent->child = child->sib;
+ return;
}
prevsib = parent->child;
mdp = prevsib->sib;
while (mdp && mdp != child) {
- prevsib = mdp;
- mdp = mdp->sib;
+ prevsib = mdp;
+ mdp = mdp->sib;
}
if (mdp == child)
- prevsib->sib = child->sib;
+ prevsib->sib = child->sib;
child->sib = NULL;
return;
}
@@ -1142,63 +1160,63 @@ LoaderErrorMsg(const char *name, const char *modname, int errmaj, int errmin)
switch (errmaj) {
case LDR_NOERROR:
- msg = "no error";
- break;
+ msg = "no error";
+ break;
case LDR_NOMEM:
- msg = "out of memory";
- break;
+ msg = "out of memory";
+ break;
case LDR_NOENT:
- msg = "module does not exist";
- break;
+ msg = "module does not exist";
+ break;
case LDR_NOSUBENT:
- msg = "a required submodule could not be loaded";
- break;
+ msg = "a required submodule could not be loaded";
+ break;
case LDR_NOSPACE:
- msg = "too many modules";
- break;
+ msg = "too many modules";
+ break;
case LDR_NOMODOPEN:
- msg = "open failed";
- break;
+ msg = "open failed";
+ break;
case LDR_UNKTYPE:
- msg = "unknown module type";
- break;
+ msg = "unknown module type";
+ break;
case LDR_NOLOAD:
- msg = "loader failed";
- break;
+ msg = "loader failed";
+ break;
case LDR_ONCEONLY:
- msg = "already loaded";
+ msg = "already loaded";
type = X_INFO;
- break;
+ break;
case LDR_NOPORTOPEN:
- msg = "port open failed";
- break;
+ msg = "port open failed";
+ break;
case LDR_NOHARDWARE:
- msg = "no hardware found";
- break;
+ msg = "no hardware found";
+ break;
case LDR_MISMATCH:
- msg = "module requirement mismatch";
- break;
+ msg = "module requirement mismatch";
+ break;
case LDR_BADUSAGE:
- msg = "invalid argument(s) to LoadModule()";
- break;
+ msg = "invalid argument(s) to LoadModule()";
+ break;
case LDR_INVALID:
- msg = "invalid module";
- break;
+ msg = "invalid module";
+ break;
case LDR_BADOS:
- msg = "module doesn't support this OS";
- break;
+ msg = "module doesn't support this OS";
+ break;
case LDR_MODSPECIFIC:
- msg = "module-specific error";
- break;
+ msg = "module-specific error";
+ break;
default:
- msg = "unknown error";
+ msg = "unknown error";
}
if (name)
- xf86Msg(type, "%s: Failed to load module \"%s\" (%s, %d)\n",
- name, modname, msg, errmin);
+ xf86Msg(type, "%s: Failed to load module \"%s\" (%s, %d)\n",
+ name, modname, msg, errmin);
else
- xf86Msg(type, "Failed to load module \"%s\" (%s, %d)\n",
- modname, msg, errmin);
+ xf86Msg(type, "Failed to load module \"%s\" (%s, %d)\n",
+ modname, msg, errmin);
}
/* Given a module path or file name, return the module's canonical name */
@@ -1214,21 +1232,21 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
/* Strip off any leading path */
s = strrchr(modname, '/');
if (s == NULL)
- s = modname;
+ s = modname;
else
- s++;
+ s++;
/* Find the first regex that is matched */
for (p = patterns; p->pattern; p++)
- if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
- len = match[1].rm_eo - match[1].rm_so;
- str = malloc(len + 1);
- if (!str)
- return NULL;
- strncpy(str, s + match[1].rm_so, len);
- str[len] = '\0';
- return str;
- }
+ if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
+ len = match[1].rm_eo - match[1].rm_so;
+ str = malloc(len + 1);
+ if (!str)
+ return NULL;
+ strncpy(str, s + match[1].rm_so, len);
+ str[len] = '\0';
+ return str;
+ }
/* If there is no match, return the whole name minus the leading path */
return strdup(s);
@@ -1241,9 +1259,9 @@ unsigned long
LoaderGetModuleVersion(ModuleDescPtr mod)
{
if (!mod || mod == (ModuleDescPtr) 1 || !mod->VersionInfo)
- return 0;
+ return 0;
return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion,
- mod->VersionInfo->minorversion,
- mod->VersionInfo->patchlevel);
+ mod->VersionInfo->minorversion,
+ mod->VersionInfo->patchlevel);
}
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index c1b3c4f2d..f2605acc7 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -701,7 +701,7 @@ This instructs the server to load the module called
The module name given should be the module's standard name, not the
module file name.
The standard name is case\-sensitive, and does not include the \(lqlib\(rq
-prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
+or \(lqcyg\(rq prefixes, or the \(lq.so\(rq or \(lq.dll\(rq suffixes.
.PP
.RS 7
Example: the DRI extension module can be loaded with the following entry:
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 803de88f3..a22dbcbb3 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -44,7 +44,9 @@
#include "X11/Xatom.h"
#include "picturestr.h"
+#ifdef XV
#include "xf86xv.h"
+#endif
#define NO_OUTPUT_DEFAULT_WIDTH 1024
#define NO_OUTPUT_DEFAULT_HEIGHT 768
@@ -57,22 +59,22 @@ int xf86CrtcConfigPrivateIndex = -1;
void
xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs)
{
- xf86CrtcConfigPtr config;
-
+ xf86CrtcConfigPtr config;
+
if (xf86CrtcConfigPrivateIndex == -1)
- xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
- config = xnfcalloc(1, sizeof(xf86CrtcConfigRec));
+ xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ config = xnfcalloc (1, sizeof (xf86CrtcConfigRec));
config->funcs = funcs;
scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
}
-
+
void
-xf86CrtcSetSizeRange(ScrnInfoPtr scrn,
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
int minWidth, int minHeight, int maxWidth, int maxHeight)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
config->minWidth = minWidth;
config->minHeight = minHeight;
@@ -86,12 +88,12 @@ xf86CrtcSetSizeRange(ScrnInfoPtr scrn,
xf86CrtcPtr
xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CrtcPtr crtc, *crtcs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc, *crtcs;
- crtc = calloc(sizeof(xf86CrtcRec), 1);
+ crtc = calloc(sizeof (xf86CrtcRec), 1);
if (!crtc)
- return NULL;
+ return NULL;
crtc->version = XF86_CRTC_VERSION;
crtc->scrn = scrn;
crtc->funcs = funcs;
@@ -100,9 +102,9 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
#endif
crtc->rotation = RR_Rotate_0;
crtc->desiredRotation = RR_Rotate_0;
- pixman_transform_init_identity(&crtc->crtc_to_framebuffer);
- pixman_f_transform_init_identity(&crtc->f_crtc_to_framebuffer);
- pixman_f_transform_init_identity(&crtc->f_framebuffer_to_crtc);
+ pixman_transform_init_identity (&crtc->crtc_to_framebuffer);
+ pixman_f_transform_init_identity (&crtc->f_crtc_to_framebuffer);
+ pixman_f_transform_init_identity (&crtc->f_framebuffer_to_crtc);
crtc->filter = NULL;
crtc->params = NULL;
crtc->nparams = 0;
@@ -111,27 +113,27 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
crtc->transform_in_use = FALSE;
crtc->transformPresent = FALSE;
crtc->desiredTransformPresent = FALSE;
- memset(&crtc->bounds, '\0', sizeof(crtc->bounds));
+ memset (&crtc->bounds, '\0', sizeof (crtc->bounds));
/* Preallocate gamma at a sensible size. */
crtc->gamma_size = 256;
- crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof(CARD16));
+ crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16));
if (!crtc->gamma_red) {
- free(crtc);
- return NULL;
+ free(crtc);
+ return NULL;
}
crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
if (xf86_config->crtc)
- crtcs = realloc(xf86_config->crtc,
- (xf86_config->num_crtc + 1) * sizeof(xf86CrtcPtr));
+ crtcs = realloc(xf86_config->crtc,
+ (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
else
- crtcs = malloc((xf86_config->num_crtc + 1) * sizeof(xf86CrtcPtr));
+ crtcs = malloc((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
if (!crtcs) {
- free(crtc->gamma_red);
- free(crtc);
- return NULL;
+ free(crtc->gamma_red);
+ free(crtc);
+ return NULL;
}
xf86_config->crtc = crtcs;
xf86_config->crtc[xf86_config->num_crtc++] = crtc;
@@ -139,20 +141,20 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
}
void
-xf86CrtcDestroy(xf86CrtcPtr crtc)
+xf86CrtcDestroy (xf86CrtcPtr crtc)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
- int c;
-
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ int c;
+
(*crtc->funcs->destroy) (crtc);
for (c = 0; c < xf86_config->num_crtc; c++)
if (xf86_config->crtc[c] == crtc) {
- memmove(&xf86_config->crtc[c],
- &xf86_config->crtc[c + 1],
- ((xf86_config->num_crtc - (c + 1)) * sizeof(void *)));
- xf86_config->num_crtc--;
- break;
- }
+ memmove (&xf86_config->crtc[c],
+ &xf86_config->crtc[c+1],
+ ((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
+ xf86_config->num_crtc--;
+ break;
+ }
free(crtc->params);
free(crtc->gamma_red);
free(crtc);
@@ -163,76 +165,76 @@ xf86CrtcDestroy(xf86CrtcPtr crtc)
*/
Bool
-xf86CrtcInUse(xf86CrtcPtr crtc)
+xf86CrtcInUse (xf86CrtcPtr crtc)
{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o;
-
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o;
+
for (o = 0; o < xf86_config->num_output; o++)
- if (xf86_config->output[o]->crtc == crtc)
- return TRUE;
+ if (xf86_config->output[o]->crtc == crtc)
+ return TRUE;
return FALSE;
}
void
-xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen)
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
{
- int subpixel_order = SubPixelUnknown;
- Bool has_none = FALSE;
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
+ int subpixel_order = SubPixelUnknown;
+ Bool has_none = FALSE;
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
for (c = 0; c < xf86_config->num_crtc; c++) {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
for (o = 0; o < xf86_config->num_output; o++) {
- xf86OutputPtr output = xf86_config->output[o];
+ xf86OutputPtr output = xf86_config->output[o];
if (output->crtc == crtc) {
- switch (output->subpixel_order) {
- case SubPixelNone:
- has_none = TRUE;
- break;
- case SubPixelUnknown:
- break;
- default:
- subpixel_order = output->subpixel_order;
- break;
- }
- }
- if (subpixel_order != SubPixelUnknown)
- break;
- }
+ switch (output->subpixel_order) {
+ case SubPixelNone:
+ has_none = TRUE;
+ break;
+ case SubPixelUnknown:
+ break;
+ default:
+ subpixel_order = output->subpixel_order;
+ break;
+ }
+ }
+ if (subpixel_order != SubPixelUnknown)
+ break;
+ }
if (subpixel_order != SubPixelUnknown) {
- static const int circle[4] = {
- SubPixelHorizontalRGB,
- SubPixelVerticalRGB,
- SubPixelHorizontalBGR,
- SubPixelVerticalBGR,
- };
- int rotate;
- int c;
-
- for (rotate = 0; rotate < 4; rotate++)
- if (crtc->rotation & (1 << rotate))
- break;
- for (c = 0; c < 4; c++)
- if (circle[c] == subpixel_order)
- break;
- c = (c + rotate) & 0x3;
- if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
- c ^= 2;
- if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
- c ^= 2;
- subpixel_order = circle[c];
- break;
- }
+ static const int circle[4] = {
+ SubPixelHorizontalRGB,
+ SubPixelVerticalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalBGR,
+ };
+ int rotate;
+ int c;
+
+ for (rotate = 0; rotate < 4; rotate++)
+ if (crtc->rotation & (1 << rotate))
+ break;
+ for (c = 0; c < 4; c++)
+ if (circle[c] == subpixel_order)
+ break;
+ c = (c + rotate) & 0x3;
+ if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
+ c ^= 2;
+ if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
+ c ^= 2;
+ subpixel_order = circle[c];
+ break;
+ }
}
if (subpixel_order == SubPixelUnknown && has_none)
- subpixel_order = SubPixelNone;
- PictureSetSubpixelOrder(pScreen, subpixel_order);
+ subpixel_order = SubPixelNone;
+ PictureSetSubpixelOrder (pScreen, subpixel_order);
}
/**
@@ -243,25 +245,25 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
Rotation rotation, RRTransformPtr transform, int x,
int y)
{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
- Bool ret = FALSE;
- Bool didLock = FALSE;
- DisplayModePtr adjusted_mode;
- DisplayModeRec saved_mode;
- int saved_x, saved_y;
- Rotation saved_rotation;
- RRTransformRec saved_transform;
- Bool saved_transform_present;
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+ Bool ret = FALSE;
+ Bool didLock = FALSE;
+ DisplayModePtr adjusted_mode;
+ DisplayModeRec saved_mode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+ RRTransformRec saved_transform;
+ Bool saved_transform_present;
- crtc->enabled = xf86CrtcInUse(crtc);
+ crtc->enabled = xf86CrtcInUse (crtc);
/* We only hit this if someone explicitly sends a "disabled" modeset. */
if (!crtc->enabled) {
- /* Check everything for stuff that should be off. */
- xf86DisableUnusedFunctions(scrn);
- return TRUE;
+ /* Check everything for stuff that should be off. */
+ xf86DisableUnusedFunctions(scrn);
+ return TRUE;
}
adjusted_mode = xf86DuplicateMode(mode);
@@ -271,8 +273,8 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
saved_y = crtc->y;
saved_rotation = crtc->rotation;
if (crtc->transformPresent) {
- RRTransformInit(&saved_transform);
- RRTransformCopy(&saved_transform, &crtc->transform);
+ RRTransformInit (&saved_transform);
+ RRTransformCopy (&saved_transform, &crtc->transform);
}
saved_transform_present = crtc->transformPresent;
@@ -284,49 +286,49 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
crtc->y = y;
crtc->rotation = rotation;
if (transform) {
- RRTransformCopy(&crtc->transform, transform);
- crtc->transformPresent = TRUE;
+ RRTransformCopy (&crtc->transform, transform);
+ crtc->transformPresent = TRUE;
}
else
- crtc->transformPresent = FALSE;
+ crtc->transformPresent = FALSE;
if (crtc->funcs->set_mode_major) {
- ret = crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
- goto done;
+ ret = crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
+ goto done;
}
- didLock = crtc->funcs->lock(crtc);
+ didLock = crtc->funcs->lock (crtc);
/* Pass our mode to the outputs and the CRTC to give them a chance to
* adjust it according to limitations or output properties, and also
* a chance to reject the mode entirely.
*/
for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
+ xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc != crtc)
- continue;
+ if (output->crtc != crtc)
+ continue;
- if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
- goto done;
- }
+ if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
+ goto done;
+ }
}
if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
- goto done;
+ goto done;
}
- if (!xf86CrtcRotate(crtc))
- goto done;
+ if (!xf86CrtcRotate (crtc))
+ goto done;
/* Prepare the outputs and CRTCs before setting the mode. */
for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
+ xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc != crtc)
- continue;
+ if (output->crtc != crtc)
+ continue;
- /* Disable the output as the first thing we do. */
- output->funcs->prepare(output);
+ /* Disable the output as the first thing we do. */
+ output->funcs->prepare(output);
}
crtc->funcs->prepare(crtc);
@@ -336,51 +338,51 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
*/
crtc->funcs->mode_set(crtc, mode, adjusted_mode, crtc->x, crtc->y);
for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
+ xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->mode_set(output, mode, adjusted_mode);
+ if (output->crtc == crtc)
+ output->funcs->mode_set(output, mode, adjusted_mode);
}
/* Only upload when needed, to avoid unneeded delays. */
if (!crtc->active && crtc->funcs->gamma_set)
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->commit(crtc);
for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
+ xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->commit(output);
+ if (output->crtc == crtc)
+ output->funcs->commit(output);
}
ret = TRUE;
- done:
+done:
if (ret) {
- crtc->active = TRUE;
- if (scrn->pScreen)
- xf86CrtcSetScreenSubpixelOrder(scrn->pScreen);
- if (scrn->ModeSet)
- scrn->ModeSet(scrn);
+ crtc->active = TRUE;
+ if (scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+ if (scrn->ModeSet)
+ scrn->ModeSet(scrn);
}
else {
- crtc->x = saved_x;
- crtc->y = saved_y;
- crtc->rotation = saved_rotation;
- crtc->mode = saved_mode;
- if (saved_transform_present)
- RRTransformCopy(&crtc->transform, &saved_transform);
- crtc->transformPresent = saved_transform_present;
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ if (saved_transform_present)
+ RRTransformCopy (&crtc->transform, &saved_transform);
+ crtc->transformPresent = saved_transform_present;
}
free(adjusted_mode->name);
free(adjusted_mode);
if (didLock)
- crtc->funcs->unlock(crtc);
+ crtc->funcs->unlock (crtc);
return ret;
}
@@ -390,31 +392,31 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
* a transform
*/
Bool
-xf86CrtcSetMode(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
- int x, int y)
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y)
{
- return xf86CrtcSetModeTransform(crtc, mode, rotation, NULL, x, y);
+ return xf86CrtcSetModeTransform (crtc, mode, rotation, NULL, x, y);
}
/**
* Pans the screen, does not change the mode
*/
void
-xf86CrtcSetOrigin(xf86CrtcPtr crtc, int x, int y)
+xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
{
ScrnInfoPtr scrn = crtc->scrn;
crtc->x = x;
crtc->y = y;
if (crtc->funcs->set_origin) {
- if (!xf86CrtcRotate(crtc))
- return;
- crtc->funcs->set_origin(crtc, x, y);
- if (scrn->ModeSet)
- scrn->ModeSet(scrn);
+ if (!xf86CrtcRotate (crtc))
+ return;
+ crtc->funcs->set_origin (crtc, x, y);
+ if (scrn->ModeSet)
+ scrn->ModeSet(scrn);
}
else
- xf86CrtcSetMode(crtc, &crtc->mode, crtc->rotation, x, y);
+ xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
}
/*
@@ -442,22 +444,22 @@ typedef enum {
} OutputOpts;
static OptionInfoRec xf86OutputOptions[] = {
- {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE},
- {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE},
- {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE},
- {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE},
- {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE},
- {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE},
- {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE},
- {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE},
- {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE},
- {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE},
- {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DEFAULT_MODES, "DefaultModes", OPTV_BOOLEAN, {0}, FALSE},
- {-1, NULL, OPTV_NONE, {0}, FALSE},
+ {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE },
+ {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE },
+ {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE },
+ {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE },
+ {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
+ {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE },
+ {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_DEFAULT_MODES, "DefaultModes", OPTV_BOOLEAN, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
};
enum {
@@ -465,138 +467,138 @@ enum {
};
static OptionInfoRec xf86DeviceOptions[] = {
- {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE},
- {-1, NULL, OPTV_NONE, {0}, FALSE},
+ {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
};
static void
-xf86OutputSetMonitor(xf86OutputPtr output)
+xf86OutputSetMonitor (xf86OutputPtr output)
{
- char *option_name;
- const char *monitor;
+ char *option_name;
+ const char *monitor;
if (!output->name)
- return;
+ return;
free(output->options);
- output->options = xnfalloc(sizeof(xf86OutputOptions));
- memcpy(output->options, xf86OutputOptions, sizeof(xf86OutputOptions));
+ output->options = xnfalloc (sizeof (xf86OutputOptions));
+ memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
XNFasprintf(&option_name, "monitor-%s", output->name);
- monitor = xf86findOptionValue(output->scrn->options, option_name);
+ monitor = xf86findOptionValue (output->scrn->options, option_name);
if (!monitor)
- monitor = output->name;
+ monitor = output->name;
else
- xf86MarkOptionUsedByName(output->scrn->options, option_name);
+ xf86MarkOptionUsedByName (output->scrn->options, option_name);
free(option_name);
- output->conf_monitor = xf86findMonitor(monitor,
- xf86configptr->conf_monitor_lst);
+ output->conf_monitor = xf86findMonitor (monitor,
+ xf86configptr->conf_monitor_lst);
/*
* Find the monitor section of the screen and use that
*/
if (!output->conf_monitor && output->use_screen_monitor)
- output->conf_monitor = xf86findMonitor(output->scrn->monitor->id,
- xf86configptr->conf_monitor_lst);
+ output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
+ xf86configptr->conf_monitor_lst);
if (output->conf_monitor) {
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
- "Output %s using monitor section %s\n",
- output->name, output->conf_monitor->mon_identifier);
- xf86ProcessOptions(output->scrn->scrnIndex,
- output->conf_monitor->mon_option_lst,
- output->options);
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s using monitor section %s\n",
+ output->name, output->conf_monitor->mon_identifier);
+ xf86ProcessOptions (output->scrn->scrnIndex,
+ output->conf_monitor->mon_option_lst,
+ output->options);
}
else
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s has no monitor section\n", output->name);
}
static Bool
-xf86OutputEnabled(xf86OutputPtr output, Bool strict)
+xf86OutputEnabled (xf86OutputPtr output, Bool strict)
{
- Bool enable, disable;
+ Bool enable, disable;
/* check to see if this output was enabled in the config file */
if (xf86GetOptValBool(output->options, OPTION_ENABLE, &enable) && enable) {
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
- "Output %s enabled by config file\n", output->name);
- return TRUE;
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s enabled by config file\n", output->name);
+ return TRUE;
}
/* or if this output was disabled in the config file */
if (xf86GetOptValBool(output->options, OPTION_DISABLE, &disable) && disable) {
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
- "Output %s disabled by config file\n", output->name);
- return FALSE;
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s disabled by config file\n", output->name);
+ return FALSE;
}
/* If not, try to only light up the ones we know are connected */
if (strict) {
- enable = output->status == XF86OutputStatusConnected;
+ enable = output->status == XF86OutputStatusConnected;
}
/* But if that fails, try to light up even outputs we're unsure of */
else {
- enable = output->status != XF86OutputStatusDisconnected;
+ enable = output->status != XF86OutputStatusDisconnected;
}
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
- "Output %s %sconnected\n", output->name, enable ? "" : "dis");
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s %sconnected\n", output->name, enable ? "" : "dis");
return enable;
}
static Bool
-xf86OutputIgnored(xf86OutputPtr output)
+xf86OutputIgnored (xf86OutputPtr output)
{
- return xf86ReturnOptValBool(output->options, OPTION_IGNORE, FALSE);
+ return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
}
static const char *direction[4] = {
- "normal",
- "left",
- "inverted",
+ "normal",
+ "left",
+ "inverted",
"right"
};
static Rotation
-xf86OutputInitialRotation(xf86OutputPtr output)
+xf86OutputInitialRotation (xf86OutputPtr output)
{
- char *rotate_name = xf86GetOptValString(output->options,
- OPTION_ROTATE);
- int i;
+ char *rotate_name = xf86GetOptValString (output->options,
+ OPTION_ROTATE);
+ int i;
if (!rotate_name) {
- if (output->initial_rotation)
- return output->initial_rotation;
- return RR_Rotate_0;
+ if (output->initial_rotation)
+ return output->initial_rotation;
+ return RR_Rotate_0;
}
-
+
for (i = 0; i < 4; i++)
- if (xf86nameCompare(direction[i], rotate_name) == 0)
- return 1 << i;
+ if (xf86nameCompare (direction[i], rotate_name) == 0)
+ return 1 << i;
return RR_Rotate_0;
}
xf86OutputPtr
-xf86OutputCreate(ScrnInfoPtr scrn,
+xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec * funcs, const char *name)
{
- xf86OutputPtr output, *outputs;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int len;
- Bool primary;
+ xf86OutputPtr output, *outputs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int len;
+ Bool primary;
if (name)
- len = strlen(name) + 1;
+ len = strlen (name) + 1;
else
- len = 0;
+ len = 0;
- output = calloc(sizeof(xf86OutputRec) + len, 1);
+ output = calloc(sizeof (xf86OutputRec) + len, 1);
if (!output)
- return NULL;
+ return NULL;
output->scrn = scrn;
output->funcs = funcs;
if (name) {
- output->name = (char *) (output + 1);
- strcpy(output->name, name);
+ output->name = (char *) (output + 1);
+ strcpy (output->name, name);
}
output->subpixel_order = SubPixelUnknown;
/*
@@ -607,33 +609,33 @@ xf86OutputCreate(ScrnInfoPtr scrn,
output->randr_output = NULL;
#endif
if (name) {
- xf86OutputSetMonitor(output);
+ xf86OutputSetMonitor (output);
if (xf86OutputIgnored(output)) {
- free(output);
- return FALSE;
- }
+ free(output);
+ return FALSE;
+ }
}
-
+
if (xf86_config->output)
- outputs = realloc(xf86_config->output,
+ outputs = realloc(xf86_config->output,
(xf86_config->num_output +
1) * sizeof(xf86OutputPtr));
else
- outputs = malloc((xf86_config->num_output + 1) * sizeof(xf86OutputPtr));
+ outputs = malloc((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
if (!outputs) {
- free(output);
- return NULL;
+ free(output);
+ return NULL;
}
xf86_config->output = outputs;
if (xf86GetOptValBool(output->options, OPTION_PRIMARY, &primary) && primary) {
- memmove(xf86_config->output + 1, xf86_config->output,
- xf86_config->num_output * sizeof(xf86OutputPtr));
- xf86_config->output[0] = output;
+ memmove(xf86_config->output + 1, xf86_config->output,
+ xf86_config->num_output * sizeof (xf86OutputPtr));
+ xf86_config->output[0] = output;
}
else {
- xf86_config->output[xf86_config->num_output] = output;
+ xf86_config->output[xf86_config->num_output] = output;
}
xf86_config->num_output++;
@@ -642,51 +644,51 @@ xf86OutputCreate(ScrnInfoPtr scrn,
}
Bool
-xf86OutputRename(xf86OutputPtr output, const char *name)
+xf86OutputRename (xf86OutputPtr output, const char *name)
{
- char *newname = strdup(name);
-
+ char *newname = strdup(name);
+
if (!newname)
- return FALSE; /* so sorry... */
-
+ return FALSE; /* so sorry... */
+
if (output->name && output->name != (char *) (output + 1))
- free(output->name);
+ free(output->name);
output->name = newname;
- xf86OutputSetMonitor(output);
- if (xf86OutputIgnored(output))
- return FALSE;
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ return FALSE;
return TRUE;
}
void
-xf86OutputUseScreenMonitor(xf86OutputPtr output, Bool use_screen_monitor)
+xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
{
if (use_screen_monitor != output->use_screen_monitor) {
- output->use_screen_monitor = use_screen_monitor;
- xf86OutputSetMonitor(output);
+ output->use_screen_monitor = use_screen_monitor;
+ xf86OutputSetMonitor (output);
}
}
void
-xf86OutputDestroy(xf86OutputPtr output)
+xf86OutputDestroy (xf86OutputPtr output)
{
- ScrnInfoPtr scrn = output->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
(*output->funcs->destroy) (output);
while (output->probed_modes)
- xf86DeleteMode(&output->probed_modes, output->probed_modes);
+ xf86DeleteMode (&output->probed_modes, output->probed_modes);
for (o = 0; o < xf86_config->num_output; o++)
if (xf86_config->output[o] == output) {
- memmove(&xf86_config->output[o],
- &xf86_config->output[o + 1],
- ((xf86_config->num_output - (o + 1)) * sizeof(void *)));
- xf86_config->num_output--;
- break;
- }
+ memmove (&xf86_config->output[o],
+ &xf86_config->output[o+1],
+ ((xf86_config->num_output - (o + 1)) * sizeof(void*)));
+ xf86_config->num_output--;
+ break;
+ }
if (output->name && output->name != (char *) (output + 1))
- free(output->name);
+ free(output->name);
free(output);
}
@@ -694,18 +696,18 @@ xf86OutputDestroy(xf86OutputPtr output)
* Called during CreateScreenResources to hook up RandR
*/
static Bool
-xf86CrtcCreateScreenResources(ScreenPtr screen)
+xf86CrtcCreateScreenResources (ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
screen->CreateScreenResources = config->CreateScreenResources;
+
+ if (!(*screen->CreateScreenResources)(screen))
+ return FALSE;
- if (!(*screen->CreateScreenResources) (screen))
- return FALSE;
-
- if (!xf86RandR12CreateScreenResources(screen))
- return FALSE;
+ if (!xf86RandR12CreateScreenResources (screen))
+ return FALSE;
return TRUE;
}
@@ -714,29 +716,29 @@ xf86CrtcCreateScreenResources(ScreenPtr screen)
* Clean up config on server reset
*/
static Bool
-xf86CrtcCloseScreen(int index, ScreenPtr screen)
+xf86CrtcCloseScreen (int index, ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o, c;
-
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+
screen->CloseScreen = config->CloseScreen;
- xf86RotateCloseScreen(screen);
+ xf86RotateCloseScreen (screen);
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
- output->randr_output = NULL;
+ output->randr_output = NULL;
}
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
+ xf86CrtcPtr crtc = config->crtc[c];
- crtc->randr_crtc = NULL;
+ crtc->randr_crtc = NULL;
}
- xf86RandR12CloseScreen(screen);
+ xf86RandR12CloseScreen (screen);
- return screen->CloseScreen(index, screen);
+ return screen->CloseScreen (index, screen);
}
/*
@@ -747,36 +749,36 @@ int
#else
Bool
#endif
-xf86CrtcScreenInit(ScreenPtr screen)
+xf86CrtcScreenInit (ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
/* Rotation */
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"RandR 1.2 enabled, ignore the following RandR disabled message.\n");
- xf86DisableRandR(); /* Disable old RandR extension support */
- xf86RandR12Init(screen);
+ xf86DisableRandR(); /* Disable old RandR extension support */
+ xf86RandR12Init (screen);
/* support all rotations if every crtc has the shadow alloc funcs */
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
+ xf86CrtcPtr crtc = config->crtc[c];
- if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
- break;
+ if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
+ break;
}
if (c == config->num_crtc) {
- xf86RandR12SetRotations(screen, RR_Rotate_0 | RR_Rotate_90 |
- RR_Rotate_180 | RR_Rotate_270 |
- RR_Reflect_X | RR_Reflect_Y);
- xf86RandR12SetTransformSupport(screen, TRUE);
+ xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
+ RR_Rotate_180 | RR_Rotate_270 |
+ RR_Reflect_X | RR_Reflect_Y);
+ xf86RandR12SetTransformSupport (screen, TRUE);
}
else {
- xf86RandR12SetRotations(screen, RR_Rotate_0);
- xf86RandR12SetTransformSupport(screen, FALSE);
+ xf86RandR12SetRotations (screen, RR_Rotate_0);
+ xf86RandR12SetTransformSupport (screen, FALSE);
}
-
+
/* Wrap CreateScreenResources so we can initialize the RandR code */
config->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xf86CrtcCreateScreenResources;
@@ -786,7 +788,7 @@ xf86CrtcScreenInit(ScreenPtr screen)
/* This might still be marked wrapped from a previous generation */
config->BlockHandler = NULL;
-
+
#ifdef XFreeXDGA
_xf86_di_dga_init_internal(screen);
#endif
@@ -798,193 +800,193 @@ xf86CrtcScreenInit(ScreenPtr screen)
}
static DisplayModePtr
-xf86DefaultMode(xf86OutputPtr output, int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- DisplayModePtr mode;
- int target_diff = 0;
- int target_preferred = 0;
- int mm_height;
-
+xf86DefaultMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+ int target_preferred = 0;
+ int mm_height;
+
mm_height = output->mm_height;
if (!mm_height)
- mm_height = (768 * 25.4) / DEFAULT_DPI;
+ mm_height = (768 * 25.4) / DEFAULT_DPI;
/*
* Pick a mode closest to DEFAULT_DPI
*/
for (mode = output->probed_modes; mode; mode = mode->next) {
- int dpi;
- int preferred = (((mode->type & M_T_PREFERRED) != 0) +
- ((mode->type & M_T_USERPREF) != 0));
- int diff;
-
- if (xf86ModeWidth(mode, output->initial_rotation) > width ||
- xf86ModeHeight(mode, output->initial_rotation) > height)
- continue;
-
- /* yes, use VDisplay here, not xf86ModeHeight */
- dpi = (mode->VDisplay * 254) / (mm_height * 10);
- diff = dpi - DEFAULT_DPI;
- diff = diff < 0 ? -diff : diff;
- if (target_mode == NULL || (preferred > target_preferred) ||
+ int dpi;
+ int preferred = (((mode->type & M_T_PREFERRED) != 0) +
+ ((mode->type & M_T_USERPREF) != 0));
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* yes, use VDisplay here, not xf86ModeHeight */
+ dpi = (mode->VDisplay * 254) / (mm_height * 10);
+ diff = dpi - DEFAULT_DPI;
+ diff = diff < 0 ? -diff : diff;
+ if (target_mode == NULL || (preferred > target_preferred) ||
(preferred == target_preferred && diff < target_diff)) {
- target_mode = mode;
- target_diff = diff;
- target_preferred = preferred;
- }
+ target_mode = mode;
+ target_diff = diff;
+ target_preferred = preferred;
+ }
}
return target_mode;
}
static DisplayModePtr
-xf86ClosestMode(xf86OutputPtr output,
- DisplayModePtr match, Rotation match_rotation,
- int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- DisplayModePtr mode;
- int target_diff = 0;
-
+xf86ClosestMode (xf86OutputPtr output,
+ DisplayModePtr match, Rotation match_rotation,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+
/*
* Pick a mode closest to the specified mode
*/
for (mode = output->probed_modes; mode; mode = mode->next) {
- int dx, dy;
- int diff;
-
- if (xf86ModeWidth(mode, output->initial_rotation) > width ||
- xf86ModeHeight(mode, output->initial_rotation) > height)
- continue;
-
- /* exact matches are preferred */
- if (output->initial_rotation == match_rotation &&
- xf86ModesEqual(mode, match))
- return mode;
-
+ int dx, dy;
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* exact matches are preferred */
+ if (output->initial_rotation == match_rotation &&
+ xf86ModesEqual (mode, match))
+ return mode;
+
dx = xf86ModeWidth(match, match_rotation) - xf86ModeWidth(mode,
output->
initial_rotation);
dy = xf86ModeHeight(match, match_rotation) - xf86ModeHeight(mode,
output->
initial_rotation);
- diff = dx * dx + dy * dy;
+ diff = dx * dx + dy * dy;
if (target_mode == NULL || diff < target_diff) {
- target_mode = mode;
- target_diff = diff;
- }
+ target_mode = mode;
+ target_diff = diff;
+ }
}
return target_mode;
}
static DisplayModePtr
-xf86OutputHasPreferredMode(xf86OutputPtr output, int width, int height)
+xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
{
- DisplayModePtr mode;
+ DisplayModePtr mode;
for (mode = output->probed_modes; mode; mode = mode->next) {
- if (xf86ModeWidth(mode, output->initial_rotation) > width ||
- xf86ModeHeight(mode, output->initial_rotation) > height)
- continue;
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
- if (mode->type & M_T_PREFERRED)
- return mode;
+ if (mode->type & M_T_PREFERRED)
+ return mode;
}
return NULL;
}
static DisplayModePtr
-xf86OutputHasUserPreferredMode(xf86OutputPtr output)
+xf86OutputHasUserPreferredMode (xf86OutputPtr output)
{
DisplayModePtr mode, first = output->probed_modes;
for (mode = first; mode && mode->next != first; mode = mode->next)
- if (mode->type & M_T_USERPREF)
- return mode;
+ if (mode->type & M_T_USERPREF)
+ return mode;
return NULL;
}
static int
-xf86PickCrtcs(ScrnInfoPtr scrn,
- xf86CrtcPtr * best_crtcs,
+xf86PickCrtcs (ScrnInfoPtr scrn,
+ xf86CrtcPtr *best_crtcs,
DisplayModePtr * modes, int n, int width, int height)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- xf86CrtcPtr *crtcs;
- xf86CrtcPtr best_crtc;
- int best_score;
- int score;
- int my_score;
-
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ xf86CrtcPtr *crtcs;
+ xf86CrtcPtr best_crtc;
+ int best_score;
+ int score;
+ int my_score;
+
if (n == config->num_output)
- return 0;
+ return 0;
output = config->output[n];
-
+
/*
* Compute score with this output disabled
*/
best_crtcs[n] = NULL;
best_crtc = NULL;
- best_score = xf86PickCrtcs(scrn, best_crtcs, modes, n + 1, width, height);
+ best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
if (modes[n] == NULL)
- return best_score;
-
- crtcs = malloc(config->num_output * sizeof(xf86CrtcPtr));
+ return best_score;
+
+ crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
if (!crtcs)
- return best_score;
+ return best_score;
my_score = 1;
/* Score outputs that are known to be connected higher */
if (output->status == XF86OutputStatusConnected)
- my_score++;
+ my_score++;
/* Score outputs with preferred modes higher */
- if (xf86OutputHasPreferredMode(output, width, height))
- my_score++;
+ if (xf86OutputHasPreferredMode (output, width, height))
+ my_score++;
/*
* Select a crtc for this output and
* then attempt to configure the remaining
* outputs
*/
for (c = 0; c < config->num_crtc; c++) {
- if ((output->possible_crtcs & (1 << c)) == 0)
- continue;
-
- crtc = config->crtc[c];
- /*
- * Check to see if some other output is
- * using this crtc
- */
- for (o = 0; o < n; o++)
- if (best_crtcs[o] == crtc)
- break;
+ if ((output->possible_crtcs & (1 << c)) == 0)
+ continue;
+
+ crtc = config->crtc[c];
+ /*
+ * Check to see if some other output is
+ * using this crtc
+ */
+ for (o = 0; o < n; o++)
+ if (best_crtcs[o] == crtc)
+ break;
if (o < n) {
- /*
- * If the two outputs desire the same mode,
- * see if they can be cloned
- */
- if (xf86ModesEqual(modes[o], modes[n]) &&
+ /*
+ * If the two outputs desire the same mode,
+ * see if they can be cloned
+ */
+ if (xf86ModesEqual (modes[o], modes[n]) &&
config->output[o]->initial_rotation ==
config->output[n]->initial_rotation &&
- config->output[o]->initial_x == config->output[n]->initial_x &&
+ config->output[o]->initial_x == config->output[n]->initial_x &&
config->output[o]->initial_y == config->output[n]->initial_y) {
- if ((output->possible_clones & (1 << o)) == 0)
- continue; /* nope, try next CRTC */
- }
- else
- continue; /* different modes, can't clone */
- }
- crtcs[n] = crtc;
- memcpy(crtcs, best_crtcs, n * sizeof(xf86CrtcPtr));
+ if ((output->possible_clones & (1 << o)) == 0)
+ continue; /* nope, try next CRTC */
+ }
+ else
+ continue; /* different modes, can't clone */
+ }
+ crtcs[n] = crtc;
+ memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
score =
my_score + xf86PickCrtcs(scrn, crtcs, modes, n + 1, width, height);
if (score > best_score) {
- best_crtc = crtc;
- best_score = score;
- memcpy(best_crtcs, crtcs, config->num_output * sizeof(xf86CrtcPtr));
- }
+ best_crtc = crtc;
+ best_score = score;
+ memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
+ }
}
free(crtcs);
return best_score;
@@ -1000,18 +1002,18 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
*/
static void
-xf86DefaultScreenLimits(ScrnInfoPtr scrn, int *widthp, int *heightp,
- Bool canGrow)
+xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
+ Bool canGrow)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int width = 0, height = 0;
- int o;
- int c;
- int s;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int width = 0, height = 0;
+ int o;
+ int c;
+ int s;
for (c = 0; c < config->num_crtc; c++) {
- int crtc_width = 0, crtc_height = 0;
- xf86CrtcPtr crtc = config->crtc[c];
+ int crtc_width = 0, crtc_height = 0;
+ xf86CrtcPtr crtc = config->crtc[c];
if (crtc->enabled) {
crtc_width =
@@ -1020,33 +1022,33 @@ xf86DefaultScreenLimits(ScrnInfoPtr scrn, int *widthp, int *heightp,
crtc_height =
crtc->desiredY + xf86ModeHeight(&crtc->desiredMode,
crtc->desiredRotation);
- }
- if (!canGrow) {
+ }
+ if (!canGrow) {
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
- for (s = 0; s < config->num_crtc; s++)
+ for (s = 0; s < config->num_crtc; s++)
if (output->possible_crtcs & (1 << s)) {
- DisplayModePtr mode;
+ DisplayModePtr mode;
for (mode = output->probed_modes; mode;
mode = mode->next) {
- if (mode->HDisplay > crtc_width)
- crtc_width = mode->HDisplay;
- if (mode->VDisplay > crtc_width)
- crtc_width = mode->VDisplay;
- if (mode->VDisplay > crtc_height)
- crtc_height = mode->VDisplay;
- if (mode->HDisplay > crtc_height)
- crtc_height = mode->HDisplay;
- }
- }
- }
- }
- if (crtc_width > width)
- width = crtc_width;
- if (crtc_height > height)
- height = crtc_height;
+ if (mode->HDisplay > crtc_width)
+ crtc_width = mode->HDisplay;
+ if (mode->VDisplay > crtc_width)
+ crtc_width = mode->VDisplay;
+ if (mode->VDisplay > crtc_height)
+ crtc_height = mode->VDisplay;
+ if (mode->HDisplay > crtc_height)
+ crtc_height = mode->HDisplay;
+ }
+ }
+ }
+ }
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
}
if (config->maxWidth && width > config->maxWidth)
width = config->maxWidth;
@@ -1067,200 +1069,200 @@ xf86DefaultScreenLimits(ScrnInfoPtr scrn, int *widthp, int *heightp,
* with either a position or a relative setting or a mode.
*/
static Bool
-xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr * modes)
+xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o;
Bool user_conf = FALSE;
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
- char *position;
- char *relative_name;
- OutputOpts relation;
- int r;
+ xf86OutputPtr output = config->output[o];
+ char *position;
+ char *relative_name;
+ OutputOpts relation;
+ int r;
- static const OutputOpts relations[] = {
- OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
- };
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
position = xf86GetOptValString(output->options, OPTION_POSITION);
- if (position)
- user_conf = TRUE;
+ if (position)
+ user_conf = TRUE;
- relation = 0;
- relative_name = NULL;
+ relation = 0;
+ relative_name = NULL;
for (r = 0; r < 4; r++) {
- relation = relations[r];
+ relation = relations[r];
relative_name = xf86GetOptValString(output->options, relation);
- if (relative_name)
- break;
- }
- if (relative_name)
- user_conf = TRUE;
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ user_conf = TRUE;
- modes[o] = xf86OutputHasUserPreferredMode(output);
- if (modes[o])
- user_conf = TRUE;
+ modes[o] = xf86OutputHasUserPreferredMode(output);
+ if (modes[o])
+ user_conf = TRUE;
}
return user_conf;
}
static Bool
-xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
+xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
- int min_x, min_y;
-
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ int min_x, min_y;
+
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
- output->initial_x = output->initial_y = POSITION_UNSET;
+ output->initial_x = output->initial_y = POSITION_UNSET;
}
-
+
/*
* Loop until all outputs are set
*/
for (;;) {
- Bool any_set = FALSE;
- Bool keep_going = FALSE;
+ Bool any_set = FALSE;
+ Bool keep_going = FALSE;
for (o = 0; o < config->num_output; o++) {
- static const OutputOpts relations[] = {
- OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
- };
- xf86OutputPtr output = config->output[o];
- xf86OutputPtr relative;
- char *relative_name;
- char *position;
- OutputOpts relation;
- int r;
-
- if (output->initial_x != POSITION_UNSET)
- continue;
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+ xf86OutputPtr output = config->output[o];
+ xf86OutputPtr relative;
+ char *relative_name;
+ char *position;
+ OutputOpts relation;
+ int r;
+
+ if (output->initial_x != POSITION_UNSET)
+ continue;
position = xf86GetOptValString(output->options, OPTION_POSITION);
- /*
- * Absolute position wins
- */
+ /*
+ * Absolute position wins
+ */
if (position) {
- int x, y;
+ int x, y;
if (sscanf(position, "%d %d", &x, &y) == 2) {
- output->initial_x = x;
- output->initial_y = y;
- }
+ output->initial_x = x;
+ output->initial_y = y;
+ }
else {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Output %s position not of form \"x y\"\n",
- output->name);
- output->initial_x = output->initial_y = 0;
- }
- any_set = TRUE;
- continue;
- }
- /*
- * Next comes relative positions
- */
- relation = 0;
- relative_name = NULL;
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s position not of form \"x y\"\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ }
+ any_set = TRUE;
+ continue;
+ }
+ /*
+ * Next comes relative positions
+ */
+ relation = 0;
+ relative_name = NULL;
for (r = 0; r < 4; r++) {
- relation = relations[r];
+ relation = relations[r];
relative_name = xf86GetOptValString(output->options, relation);
- if (relative_name)
- break;
- }
+ if (relative_name)
+ break;
+ }
if (relative_name) {
- int or;
+ int or;
- relative = NULL;
+ relative = NULL;
for (or = 0; or < config->num_output; or++) {
- xf86OutputPtr out_rel = config->output[or];
- XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
+ xf86OutputPtr out_rel = config->output[or];
+ XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
if (rel_mon) {
- if (xf86nameCompare(rel_mon->mon_identifier,
+ if (xf86nameCompare (rel_mon->mon_identifier,
relative_name) == 0) {
- relative = config->output[or];
- break;
- }
- }
+ relative = config->output[or];
+ break;
+ }
+ }
if (strcmp(out_rel->name, relative_name) == 0) {
- relative = config->output[or];
- break;
- }
- }
+ relative = config->output[or];
+ break;
+ }
+ }
if (!relative) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Cannot position output %s relative to unknown output %s\n",
- output->name, relative_name);
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- continue;
- }
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to unknown output %s\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
if (!modes[or]) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Cannot position output %s relative to output %s without modes\n",
- output->name, relative_name);
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- continue;
- }
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to output %s without modes\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
if (relative->initial_x == POSITION_UNSET) {
- keep_going = TRUE;
- continue;
- }
- output->initial_x = relative->initial_x;
- output->initial_y = relative->initial_y;
- switch (relation) {
- case OPTION_BELOW:
+ keep_going = TRUE;
+ continue;
+ }
+ output->initial_x = relative->initial_x;
+ output->initial_y = relative->initial_y;
+ switch (relation) {
+ case OPTION_BELOW:
output->initial_y +=
xf86ModeHeight(modes[or], relative->initial_rotation);
- break;
- case OPTION_RIGHT_OF:
+ break;
+ case OPTION_RIGHT_OF:
output->initial_x +=
xf86ModeWidth(modes[or], relative->initial_rotation);
- break;
- case OPTION_ABOVE:
- if (modes[o])
+ break;
+ case OPTION_ABOVE:
+ if (modes[o])
output->initial_y -=
xf86ModeHeight(modes[o], output->initial_rotation);
- break;
- case OPTION_LEFT_OF:
- if (modes[o])
+ break;
+ case OPTION_LEFT_OF:
+ if (modes[o])
output->initial_x -=
xf86ModeWidth(modes[o], output->initial_rotation);
- break;
- default:
- break;
- }
- any_set = TRUE;
- continue;
- }
-
- /* Nothing set, just stick them at 0,0 */
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- }
- if (!keep_going)
- break;
+ break;
+ default:
+ break;
+ }
+ any_set = TRUE;
+ continue;
+ }
+
+ /* Nothing set, just stick them at 0,0 */
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ }
+ if (!keep_going)
+ break;
if (!any_set) {
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
if (output->initial_x == POSITION_UNSET) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Output position loop. Moving %s to 0,0\n",
- output->name);
- output->initial_x = output->initial_y = 0;
- break;
- }
- }
- }
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output position loop. Moving %s to 0,0\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ break;
+ }
+ }
+ }
}
/*
@@ -1269,88 +1271,88 @@ xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
min_x = 1000000;
min_y = 1000000;
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
- if (output->initial_x < min_x)
- min_x = output->initial_x;
- if (output->initial_y < min_y)
- min_y = output->initial_y;
+ if (output->initial_x < min_x)
+ min_x = output->initial_x;
+ if (output->initial_y < min_y)
+ min_y = output->initial_y;
}
-
+
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
- output->initial_x -= min_x;
- output->initial_y -= min_y;
+ output->initial_x -= min_x;
+ output->initial_y -= min_y;
}
return TRUE;
}
static void
-xf86InitialPanning(ScrnInfoPtr scrn)
+xf86InitialPanning (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
- char *panning = xf86GetOptValString(output->options, OPTION_PANNING);
- int width, height, left, top;
- int track_width, track_height, track_left, track_top;
- int brdr[4];
-
- memset(&output->initialTotalArea, 0, sizeof(BoxRec));
- memset(&output->initialTrackingArea, 0, sizeof(BoxRec));
- memset(output->initialBorder, 0, 4 * sizeof(INT16));
-
- if (!panning)
- continue;
-
- switch (sscanf(panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
- &width, &height, &left, &top,
- &track_width, &track_height, &track_left, &track_top,
- &brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
- case 12:
- output->initialBorder[0] = brdr[0];
- output->initialBorder[1] = brdr[1];
- output->initialBorder[2] = brdr[2];
- output->initialBorder[3] = brdr[3];
- /* fall through */
- case 8:
- output->initialTrackingArea.x1 = track_left;
- output->initialTrackingArea.y1 = track_top;
- output->initialTrackingArea.x2 = track_left + track_width;
- output->initialTrackingArea.y2 = track_top + track_height;
- /* fall through */
- case 4:
- output->initialTotalArea.x1 = left;
- output->initialTotalArea.y1 = top;
- /* fall through */
- case 2:
- output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
- output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
- break;
- default:
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Broken panning specification '%s' for output %s in config file\n",
- panning, output->name);
- }
+ xf86OutputPtr output = config->output[o];
+ char *panning = xf86GetOptValString (output->options, OPTION_PANNING);
+ int width, height, left, top;
+ int track_width, track_height, track_left, track_top;
+ int brdr[4];
+
+ memset (&output->initialTotalArea, 0, sizeof(BoxRec));
+ memset (&output->initialTrackingArea, 0, sizeof(BoxRec));
+ memset (output->initialBorder, 0, 4*sizeof(INT16));
+
+ if (! panning)
+ continue;
+
+ switch (sscanf (panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
+ &width, &height, &left, &top,
+ &track_width, &track_height, &track_left, &track_top,
+ &brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
+ case 12:
+ output->initialBorder[0] = brdr[0];
+ output->initialBorder[1] = brdr[1];
+ output->initialBorder[2] = brdr[2];
+ output->initialBorder[3] = brdr[3];
+ /* fall through */
+ case 8:
+ output->initialTrackingArea.x1 = track_left;
+ output->initialTrackingArea.y1 = track_top;
+ output->initialTrackingArea.x2 = track_left + track_width;
+ output->initialTrackingArea.y2 = track_top + track_height;
+ /* fall through */
+ case 4:
+ output->initialTotalArea.x1 = left;
+ output->initialTotalArea.y1 = top;
+ /* fall through */
+ case 2:
+ output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
+ output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
+ break;
+ default:
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Broken panning specification '%s' for output %s in config file\n",
+ panning, output->name);
+ }
}
}
/** Return - 0 + if a should be earlier, same or later than b in list
*/
static int
-xf86ModeCompare(DisplayModePtr a, DisplayModePtr b)
+xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
{
- int diff;
+ int diff;
diff = ((b->type & M_T_PREFERRED) != 0) - ((a->type & M_T_PREFERRED) != 0);
if (diff)
- return diff;
+ return diff;
diff = b->HDisplay * b->VDisplay - a->HDisplay * a->VDisplay;
if (diff)
- return diff;
+ return diff;
diff = b->Clock - a->Clock;
return diff;
}
@@ -1359,34 +1361,34 @@ xf86ModeCompare(DisplayModePtr a, DisplayModePtr b)
* Insertion sort input in-place and return the resulting head
*/
static DisplayModePtr
-xf86SortModes(DisplayModePtr input)
+xf86SortModes (DisplayModePtr input)
{
- DisplayModePtr output = NULL, i, o, n, *op, prev;
+ DisplayModePtr output = NULL, i, o, n, *op, prev;
/* sort by preferred status and pixel area */
while (input) {
- i = input;
- input = input->next;
- for (op = &output; (o = *op); op = &o->next)
- if (xf86ModeCompare(o, i) > 0)
- break;
- i->next = *op;
- *op = i;
+ i = input;
+ input = input->next;
+ for (op = &output; (o = *op); op = &o->next)
+ if (xf86ModeCompare (o, i) > 0)
+ break;
+ i->next = *op;
+ *op = i;
}
/* prune identical modes */
for (o = output; o && (n = o->next); o = n) {
if (!strcmp(o->name, n->name) && xf86ModesEqual(o, n)) {
- o->next = n->next;
- free(n->name);
- free(n);
- n = o;
- }
+ o->next = n->next;
+ free(n->name);
+ free(n);
+ n = o;
+ }
}
/* hook up backward links */
prev = NULL;
for (o = output; o; o = o->next) {
- o->prev = prev;
- prev = o;
+ o->prev = prev;
+ prev = o;
}
return output;
}
@@ -1397,13 +1399,13 @@ preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
char *preferred_mode = NULL;
/* Check for a configured preference for a particular mode */
- preferred_mode = xf86GetOptValString(output->options,
- OPTION_PREFERRED_MODE);
+ preferred_mode = xf86GetOptValString (output->options,
+ OPTION_PREFERRED_MODE);
if (preferred_mode)
- return preferred_mode;
+ return preferred_mode;
if (pScrn->display->modes && *pScrn->display->modes)
- preferred_mode = *pScrn->display->modes;
+ preferred_mode = *pScrn->display->modes;
return preferred_mode;
}
@@ -1412,7 +1414,7 @@ static void
GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
{
if (!mon || !mode)
- return;
+ return;
mon->nHsync = 1;
mon->hsync[0].lo = 1024.0;
@@ -1423,33 +1425,33 @@ GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
mon->vrefresh[0].hi = 0.0;
while (mode) {
- if (!mode->HSync)
- mode->HSync = ((float) mode->Clock) / ((float) mode->HTotal);
+ if (!mode->HSync)
+ mode->HSync = ((float) mode->Clock ) / ((float) mode->HTotal);
- if (!mode->VRefresh)
- mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
- ((float) (mode->HTotal * mode->VTotal));
+ if (!mode->VRefresh)
+ mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
+ ((float) (mode->HTotal * mode->VTotal));
- if (mode->HSync < mon->hsync[0].lo)
- mon->hsync[0].lo = mode->HSync;
+ if (mode->HSync < mon->hsync[0].lo)
+ mon->hsync[0].lo = mode->HSync;
- if (mode->HSync > mon->hsync[0].hi)
- mon->hsync[0].hi = mode->HSync;
+ if (mode->HSync > mon->hsync[0].hi)
+ mon->hsync[0].hi = mode->HSync;
- if (mode->VRefresh < mon->vrefresh[0].lo)
- mon->vrefresh[0].lo = mode->VRefresh;
+ if (mode->VRefresh < mon->vrefresh[0].lo)
+ mon->vrefresh[0].lo = mode->VRefresh;
- if (mode->VRefresh > mon->vrefresh[0].hi)
- mon->vrefresh[0].hi = mode->VRefresh;
+ if (mode->VRefresh > mon->vrefresh[0].hi)
+ mon->vrefresh[0].hi = mode->VRefresh;
- mode = mode->next;
+ mode = mode->next;
}
/* stretch out the bottom to fit 640x480@60 */
if (mon->hsync[0].lo > 31.0)
- mon->hsync[0].lo = 31.0;
+ mon->hsync[0].lo = 31.0;
if (mon->vrefresh[0].lo > 58.0)
- mon->vrefresh[0].lo = 58.0;
+ mon->vrefresh[0].lo = 58.0;
}
enum det_monrec_source {
@@ -1469,7 +1471,7 @@ handle_detailed_monrec(struct detailed_monitor_section *det_mon, void *data)
{
struct det_monrec_parameter *p;
- p = (struct det_monrec_parameter *) data;
+ p = (struct det_monrec_parameter *)data;
if (det_mon->type == DS_RANGES) {
struct monitor_ranges *ranges = &det_mon->section.ranges;
@@ -1494,10 +1496,10 @@ handle_detailed_monrec(struct detailed_monitor_section *det_mon, void *data)
}
void
-xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
+xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
/* When canGrow was TRUE in the initial configuration we have to
* compare against the maximum values so that we don't drop modes.
@@ -1505,228 +1507,228 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
* anyway.
*/
if (maxX == 0 || maxY == 0) {
- maxX = config->maxWidth;
- maxY = config->maxHeight;
+ maxX = config->maxWidth;
+ maxY = config->maxHeight;
}
/* Probe the list of modes for each output. */
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr mode;
- DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
- char *preferred_mode;
- xf86MonPtr edid_monitor;
- XF86ConfMonitorPtr conf_monitor;
- MonRec mon_rec;
- int min_clock = 0;
- int max_clock = 0;
- double clock;
- Bool add_default_modes;
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode;
+ DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
+ char *preferred_mode;
+ xf86MonPtr edid_monitor;
+ XF86ConfMonitorPtr conf_monitor;
+ MonRec mon_rec;
+ int min_clock = 0;
+ int max_clock = 0;
+ double clock;
+ Bool add_default_modes;
Bool debug_modes = config->debug_modes || xf86Initialising;
- enum det_monrec_source sync_source = sync_default;
-
- while (output->probed_modes != NULL)
- xf86DeleteMode(&output->probed_modes, output->probed_modes);
+ enum det_monrec_source sync_source = sync_default;
+
+ while (output->probed_modes != NULL)
+ xf86DeleteMode(&output->probed_modes, output->probed_modes);
- /*
- * Check connection status
- */
- output->status = (*output->funcs->detect) (output);
+ /*
+ * Check connection status
+ */
+ output->status = (*output->funcs->detect)(output);
- if (output->status == XF86OutputStatusDisconnected &&
+ if (output->status == XF86OutputStatusDisconnected &&
!xf86ReturnOptValBool(output->options, OPTION_ENABLE, FALSE)) {
- xf86OutputSetEDID(output, NULL);
- continue;
- }
-
- memset(&mon_rec, '\0', sizeof(mon_rec));
-
- conf_monitor = output->conf_monitor;
-
+ xf86OutputSetEDID (output, NULL);
+ continue;
+ }
+
+ memset (&mon_rec, '\0', sizeof (mon_rec));
+
+ conf_monitor = output->conf_monitor;
+
if (conf_monitor) {
- int i;
-
+ int i;
+
for (i = 0; i < conf_monitor->mon_n_hsync; i++) {
mon_rec.hsync[mon_rec.nHsync].lo =
conf_monitor->mon_hsync[i].lo;
mon_rec.hsync[mon_rec.nHsync].hi =
conf_monitor->mon_hsync[i].hi;
- mon_rec.nHsync++;
- sync_source = sync_config;
- }
+ mon_rec.nHsync++;
+ sync_source = sync_config;
+ }
for (i = 0; i < conf_monitor->mon_n_vrefresh; i++) {
mon_rec.vrefresh[mon_rec.nVrefresh].lo =
conf_monitor->mon_vrefresh[i].lo;
mon_rec.vrefresh[mon_rec.nVrefresh].hi =
conf_monitor->mon_vrefresh[i].hi;
- mon_rec.nVrefresh++;
- sync_source = sync_config;
- }
- config_modes = xf86GetMonitorModes(scrn, conf_monitor);
- }
-
- output_modes = (*output->funcs->get_modes) (output);
-
- /*
- * If the user has a preference, respect it.
- * Otherwise, don't second-guess the driver.
- */
- if (!xf86GetOptValBool(output->options, OPTION_DEFAULT_MODES,
- &add_default_modes))
- add_default_modes = (output_modes == NULL);
-
- edid_monitor = output->MonInfo;
-
+ mon_rec.nVrefresh++;
+ sync_source = sync_config;
+ }
+ config_modes = xf86GetMonitorModes (scrn, conf_monitor);
+ }
+
+ output_modes = (*output->funcs->get_modes) (output);
+
+ /*
+ * If the user has a preference, respect it.
+ * Otherwise, don't second-guess the driver.
+ */
+ if (!xf86GetOptValBool(output->options, OPTION_DEFAULT_MODES,
+ &add_default_modes))
+ add_default_modes = (output_modes == NULL);
+
+ edid_monitor = output->MonInfo;
+
if (edid_monitor) {
struct det_monrec_parameter p;
- struct disp_features *features = &edid_monitor->features;
+ struct disp_features *features = &edid_monitor->features;
- /* if display is not continuous-frequency, don't add default modes */
- if (!GTF_SUPPORTED(features->msc))
- add_default_modes = FALSE;
+ /* if display is not continuous-frequency, don't add default modes */
+ if (!GTF_SUPPORTED(features->msc))
+ add_default_modes = FALSE;
- p.mon_rec = &mon_rec;
- p.max_clock = &max_clock;
- p.set_hsync = mon_rec.nHsync == 0;
- p.set_vrefresh = mon_rec.nVrefresh == 0;
- p.sync_source = &sync_source;
+ p.mon_rec = &mon_rec;
+ p.max_clock = &max_clock;
+ p.set_hsync = mon_rec.nHsync == 0;
+ p.set_vrefresh = mon_rec.nVrefresh == 0;
+ p.sync_source = &sync_source;
xf86ForEachDetailedBlock(edid_monitor, handle_detailed_monrec, &p);
- }
-
- if (xf86GetOptValFreq(output->options, OPTION_MIN_CLOCK,
- OPTUNITS_KHZ, &clock))
- min_clock = (int) clock;
- if (xf86GetOptValFreq(output->options, OPTION_MAX_CLOCK,
- OPTUNITS_KHZ, &clock))
- max_clock = (int) clock;
-
- /* If we still don't have a sync range, guess wildly */
- if (!mon_rec.nHsync || !mon_rec.nVrefresh)
- GuessRangeFromModes(&mon_rec, output_modes);
-
- /*
- * These limits will end up setting a 1024x768@60Hz mode by default,
- * which seems like a fairly good mode to use when nothing else is
- * specified
- */
+ }
+
+ if (xf86GetOptValFreq (output->options, OPTION_MIN_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ min_clock = (int) clock;
+ if (xf86GetOptValFreq (output->options, OPTION_MAX_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ max_clock = (int) clock;
+
+ /* If we still don't have a sync range, guess wildly */
+ if (!mon_rec.nHsync || !mon_rec.nVrefresh)
+ GuessRangeFromModes(&mon_rec, output_modes);
+
+ /*
+ * These limits will end up setting a 1024x768@60Hz mode by default,
+ * which seems like a fairly good mode to use when nothing else is
+ * specified
+ */
if (mon_rec.nHsync == 0) {
- mon_rec.hsync[0].lo = 31.0;
- mon_rec.hsync[0].hi = 55.0;
- mon_rec.nHsync = 1;
- }
+ mon_rec.hsync[0].lo = 31.0;
+ mon_rec.hsync[0].hi = 55.0;
+ mon_rec.nHsync = 1;
+ }
if (mon_rec.nVrefresh == 0) {
- mon_rec.vrefresh[0].lo = 58.0;
- mon_rec.vrefresh[0].hi = 62.0;
- mon_rec.nVrefresh = 1;
- }
+ mon_rec.vrefresh[0].lo = 58.0;
+ mon_rec.vrefresh[0].hi = 62.0;
+ mon_rec.nVrefresh = 1;
+ }
- if (add_default_modes)
- default_modes = xf86GetDefaultModes();
+ if (add_default_modes)
+ default_modes = xf86GetDefaultModes ();
- /*
- * If this is not an RB monitor, remove RB modes from the default
- * pool. RB modes from the config or the monitor itself are fine.
- */
- if (!mon_rec.reducedblanking)
- xf86ValidateModesReducedBlanking(scrn, default_modes);
+ /*
+ * If this is not an RB monitor, remove RB modes from the default
+ * pool. RB modes from the config or the monitor itself are fine.
+ */
+ if (!mon_rec.reducedblanking)
+ xf86ValidateModesReducedBlanking (scrn, default_modes);
if (sync_source == sync_config) {
- /*
- * Check output and config modes against sync range from config file
- */
- xf86ValidateModesSync(scrn, output_modes, &mon_rec);
- xf86ValidateModesSync(scrn, config_modes, &mon_rec);
- }
- /*
- * Check default modes against sync range
- */
- xf86ValidateModesSync(scrn, default_modes, &mon_rec);
- /*
- * Check default modes against monitor max clock
- */
- if (max_clock) {
- xf86ValidateModesClocks(scrn, default_modes,
- &min_clock, &max_clock, 1);
- xf86ValidateModesClocks(scrn, output_modes,
- &min_clock, &max_clock, 1);
- }
-
- output->probed_modes = NULL;
- output->probed_modes = xf86ModesAdd(output->probed_modes, config_modes);
- output->probed_modes = xf86ModesAdd(output->probed_modes, output_modes);
+ /*
+ * Check output and config modes against sync range from config file
+ */
+ xf86ValidateModesSync (scrn, output_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, config_modes, &mon_rec);
+ }
+ /*
+ * Check default modes against sync range
+ */
+ xf86ValidateModesSync (scrn, default_modes, &mon_rec);
+ /*
+ * Check default modes against monitor max clock
+ */
+ if (max_clock) {
+ xf86ValidateModesClocks(scrn, default_modes,
+ &min_clock, &max_clock, 1);
+ xf86ValidateModesClocks(scrn, output_modes,
+ &min_clock, &max_clock, 1);
+ }
+
+ output->probed_modes = NULL;
+ output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, output_modes);
output->probed_modes =
xf86ModesAdd(output->probed_modes, default_modes);
-
- /*
- * Check all modes against max size, interlace, and doublescan
- */
- if (maxX && maxY)
+
+ /*
+ * Check all modes against max size, interlace, and doublescan
+ */
+ if (maxX && maxY)
xf86ValidateModesSize(scrn, output->probed_modes, maxX, maxY, 0);
- {
- int flags = (output->interlaceAllowed ? V_INTERLACE : 0) |
- (output->doubleScanAllowed ? V_DBLSCAN : 0);
- xf86ValidateModesFlags(scrn, output->probed_modes, flags);
- }
-
- /*
- * Check all modes against output
- */
- for (mode = output->probed_modes; mode != NULL; mode = mode->next)
- if (mode->status == MODE_OK)
- mode->status = (*output->funcs->mode_valid) (output, mode);
-
- xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
-
- output->probed_modes = xf86SortModes(output->probed_modes);
-
- /* Check for a configured preference for a particular mode */
- preferred_mode = preferredMode(scrn, output);
+ {
+ int flags = (output->interlaceAllowed ? V_INTERLACE : 0) |
+ (output->doubleScanAllowed ? V_DBLSCAN : 0);
+ xf86ValidateModesFlags (scrn, output->probed_modes, flags);
+ }
+
+ /*
+ * Check all modes against output
+ */
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ if (mode->status == MODE_OK)
+ mode->status = (*output->funcs->mode_valid)(output, mode);
+
+ xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
+
+ output->probed_modes = xf86SortModes (output->probed_modes);
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = preferredMode(scrn, output);
if (preferred_mode) {
for (mode = output->probed_modes; mode; mode = mode->next) {
if (!strcmp(preferred_mode, mode->name)) {
if (mode != output->probed_modes) {
- if (mode->prev)
- mode->prev->next = mode->next;
- if (mode->next)
- mode->next->prev = mode->prev;
- mode->next = output->probed_modes;
- output->probed_modes->prev = mode;
- mode->prev = NULL;
- output->probed_modes = mode;
- }
- mode->type |= (M_T_PREFERRED | M_T_USERPREF);
- break;
- }
- }
- }
-
- output->initial_rotation = xf86OutputInitialRotation(output);
-
- if (debug_modes) {
- if (output->probed_modes != NULL) {
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Printing probed modes for output %s\n",
- output->name);
+ if (mode->prev)
+ mode->prev->next = mode->next;
+ if (mode->next)
+ mode->next->prev = mode->prev;
+ mode->next = output->probed_modes;
+ output->probed_modes->prev = mode;
+ mode->prev = NULL;
+ output->probed_modes = mode;
+ }
+ mode->type |= (M_T_PREFERRED|M_T_USERPREF);
+ break;
+ }
+ }
+ }
+
+ output->initial_rotation = xf86OutputInitialRotation (output);
+
+ if (debug_modes) {
+ if (output->probed_modes != NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Printing probed modes for output %s\n",
+ output->name);
}
else {
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "No remaining probed modes for output %s\n",
- output->name);
- }
- }
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "No remaining probed modes for output %s\n",
+ output->name);
+ }
+ }
for (mode = output->probed_modes; mode != NULL; mode = mode->next) {
- /* The code to choose the best mode per pipe later on will require
- * VRefresh to be set.
- */
- mode->VRefresh = xf86ModeVRefresh(mode);
- xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
-
- if (debug_modes)
- xf86PrintModeline(scrn->scrnIndex, mode);
- }
+ /* The code to choose the best mode per pipe later on will require
+ * VRefresh to be set.
+ */
+ mode->VRefresh = xf86ModeVRefresh(mode);
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+ if (debug_modes)
+ xf86PrintModeline(scrn->scrnIndex, mode);
+ }
}
}
@@ -1736,7 +1738,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
/* XXX where does this function belong? Here? */
void
- xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
static DisplayModePtr
biggestMode(DisplayModePtr a, DisplayModePtr b)
@@ -1744,15 +1746,15 @@ biggestMode(DisplayModePtr a, DisplayModePtr b)
int A, B;
if (!a)
- return b;
+ return b;
if (!b)
- return a;
+ return a;
A = a->HDisplay * a->VDisplay;
B = b->HDisplay * b->VDisplay;
if (A > B)
- return a;
+ return a;
return b;
}
@@ -1766,105 +1768,105 @@ SetCompatOutput(xf86CrtcConfigPtr config)
/* Look for one that's definitely connected */
for (o = 0; o < config->num_output; o++) {
- test = config->output[o];
- if (!test->crtc)
- continue;
- if (test->status != XF86OutputStatusConnected)
- continue;
- if (!test->probed_modes)
- continue;
-
- testmode = mode = test->probed_modes;
- for (count = 0; mode; mode = mode->next, count++)
- testmode = biggestMode(testmode, mode);
-
- if (!output) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (test->status != XF86OutputStatusConnected)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ testmode = mode = test->probed_modes;
+ for (count = 0; mode; mode = mode->next, count++)
+ testmode = biggestMode(testmode, mode);
+
+ if (!output) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
}
else if (maxmode == biggestMode(maxmode, testmode)) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
}
else if ((maxmode->HDisplay == testmode->HDisplay) &&
- (maxmode->VDisplay == testmode->VDisplay) &&
- count <= mincount) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- }
+ (maxmode->VDisplay == testmode->VDisplay) &&
+ count <= mincount) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ }
}
/* If we didn't find one, take anything we can get */
if (!output) {
for (o = 0; o < config->num_output; o++) {
- test = config->output[o];
- if (!test->crtc)
- continue;
- if (!test->probed_modes)
- continue;
-
- if (!output) {
- output = test;
- compat = o;
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ if (!output) {
+ output = test;
+ compat = o;
}
else if (test->probed_modes->HDisplay <
output->probed_modes->HDisplay) {
- output = test;
- compat = o;
- }
- }
+ output = test;
+ compat = o;
+ }
+ }
}
if (compat >= 0) {
- config->compat_output = compat;
+ config->compat_output = compat;
}
else {
- /* Don't change the compat output when no valid outputs found */
- output = config->output[config->compat_output];
+ /* Don't change the compat output when no valid outputs found */
+ output = config->output[config->compat_output];
}
return output;
}
void
-xf86SetScrnInfoModes(ScrnInfoPtr scrn)
+xf86SetScrnInfoModes (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- DisplayModePtr last, mode = NULL;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ DisplayModePtr last, mode = NULL;
output = SetCompatOutput(config);
if (!output)
- return; /* punt */
+ return; /* punt */
crtc = output->crtc;
/* Clear any existing modes from scrn->modes */
while (scrn->modes != NULL)
- xf86DeleteMode(&scrn->modes, scrn->modes);
+ xf86DeleteMode(&scrn->modes, scrn->modes);
/* Set scrn->modes to the mode list for the 'compat' output */
scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
if (crtc) {
- for (mode = scrn->modes; mode; mode = mode->next)
- if (xf86ModesEqual(mode, &crtc->desiredMode))
- break;
+ for (mode = scrn->modes; mode; mode = mode->next)
+ if (xf86ModesEqual (mode, &crtc->desiredMode))
+ break;
}
if (!scrn->modes) {
- scrn->modes = xf86ModesAdd(scrn->modes,
- xf86CVTMode(scrn->display->virtualX,
- scrn->display->virtualY,
- 60, 0, 0));
+ scrn->modes = xf86ModesAdd(scrn->modes,
+ xf86CVTMode(scrn->display->virtualX,
+ scrn->display->virtualY,
+ 60, 0, 0));
}
/* For some reason, scrn->modes is circular, unlike the other mode
@@ -1874,32 +1876,32 @@ xf86SetScrnInfoModes(ScrnInfoPtr scrn)
last->next = scrn->modes;
scrn->modes->prev = last;
if (mode) {
- while (scrn->modes != mode)
- scrn->modes = scrn->modes->next;
+ while (scrn->modes != mode)
+ scrn->modes = scrn->modes->next;
}
scrn->currentMode = scrn->modes;
#ifdef XFreeXDGA
if (scrn->pScreen)
- _xf86_di_dga_reinit_internal(scrn->pScreen);
+ _xf86_di_dga_reinit_internal(scrn->pScreen);
#endif
}
static Bool
xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- Bool *enabled)
+ Bool *enabled)
{
Bool any_enabled = FALSE;
int o;
for (o = 0; o < config->num_output; o++)
- any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
-
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
+
if (!any_enabled) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING,
- "No outputs definitely connected, trying again...\n");
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "No outputs definitely connected, trying again...\n");
- for (o = 0; o < config->num_output; o++)
+ for (o = 0; o < config->num_output; o++)
any_enabled |= enabled[o] =
xf86OutputEnabled(config->output[o], FALSE);
}
@@ -1913,12 +1915,12 @@ nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
int o = *index;
for (o++; o < config->num_output; o++) {
- if (enabled[o]) {
- *index = o;
- return TRUE;
- }
+ if (enabled[o]) {
+ *index = o;
+ return TRUE;
+ }
}
-
+
return FALSE;
}
@@ -1934,16 +1936,16 @@ nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
DisplayModePtr m = NULL;
if (!o)
- return NULL;
+ return NULL;
if (!last)
- m = o->probed_modes;
+ m = o->probed_modes;
else
- m = last->next;
+ m = last->next;
for (; m; m = m->next)
- if (aspectMatch(aspect, (float) m->HDisplay / (float) m->VDisplay))
- return m;
+ if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
+ return m;
return NULL;
}
@@ -1955,27 +1957,27 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
DisplayModePtr mode = NULL, test = NULL, match = NULL;
if (!nextEnabledOutput(config, enabled, &o))
- return NULL;
+ return NULL;
while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
- test = mode;
- for (p = o; nextEnabledOutput(config, enabled, &p);) {
- test = xf86OutputFindClosestMode(config->output[p], mode);
- if (!test)
- break;
- if (test->HDisplay != mode->HDisplay ||
- test->VDisplay != mode->VDisplay) {
- test = NULL;
- break;
- }
- }
-
- /* if we didn't match it on all outputs, try the next one */
- if (!test)
- continue;
-
- /* if it's bigger than the last one, save it */
- if (!match || (test->HDisplay > match->HDisplay))
- match = test;
+ test = mode;
+ for (p = o; nextEnabledOutput(config, enabled, &p); ) {
+ test = xf86OutputFindClosestMode(config->output[p], mode);
+ if (!test)
+ break;
+ if (test->HDisplay != mode->HDisplay ||
+ test->VDisplay != mode->VDisplay) {
+ test = NULL;
+ break;
+ }
+ }
+
+ /* if we didn't match it on all outputs, try the next one */
+ if (!test)
+ continue;
+
+ /* if it's bigger than the last one, save it */
+ if (!match || (test->HDisplay > match->HDisplay))
+ match = test;
}
/* return the biggest one found */
@@ -1984,8 +1986,8 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
static Bool
xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr * modes, Bool *enabled,
- int width, int height)
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
{
int o, p;
int max_pref_width = 0, max_pref_height = 0;
@@ -1996,60 +1998,60 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
/* Check if the preferred mode is available on all outputs */
- for (p = -1; nextEnabledOutput(config, enabled, &p);) {
- Rotation r = config->output[p]->initial_rotation;
- DisplayModePtr mode;
-
- if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
- width, height))) {
- int pref_width = xf86ModeWidth(preferred[p], r);
- int pref_height = xf86ModeHeight(preferred[p], r);
- Bool all_match = TRUE;
-
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- Bool match = FALSE;
- xf86OutputPtr output = config->output[o];
-
- if (o == p)
- continue;
-
- /*
- * First see if the preferred mode matches on the next
- * output as well. This catches the common case of identical
- * monitors and makes sure they all have the same timings
- * and refresh. If that fails, we fall back to trying to
- * match just width & height.
- */
- mode = xf86OutputHasPreferredMode(output, pref_width,
- pref_height);
- if (mode && xf86ModesEqual(mode, preferred[p])) {
- preferred[o] = mode;
- match = TRUE;
+ for (p = -1; nextEnabledOutput(config, enabled, &p); ) {
+ Rotation r = config->output[p]->initial_rotation;
+ DisplayModePtr mode;
+
+ if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
+ width, height))) {
+ int pref_width = xf86ModeWidth(preferred[p], r);
+ int pref_height = xf86ModeHeight(preferred[p], r);
+ Bool all_match = TRUE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ Bool match = FALSE;
+ xf86OutputPtr output = config->output[o];
+
+ if (o == p)
+ continue;
+
+ /*
+ * First see if the preferred mode matches on the next
+ * output as well. This catches the common case of identical
+ * monitors and makes sure they all have the same timings
+ * and refresh. If that fails, we fall back to trying to
+ * match just width & height.
+ */
+ mode = xf86OutputHasPreferredMode(output, pref_width,
+ pref_height);
+ if (mode && xf86ModesEqual(mode, preferred[p])) {
+ preferred[o] = mode;
+ match = TRUE;
}
else {
for (mode = output->probed_modes; mode; mode = mode->next) {
- Rotation r = output->initial_rotation;
-
- if (xf86ModeWidth(mode, r) == pref_width &&
- xf86ModeHeight(mode, r) == pref_height) {
- preferred[o] = mode;
- match = TRUE;
- }
- }
- }
-
- all_match &= match;
- }
-
- if (all_match &&
- (pref_width * pref_height > max_pref_width * max_pref_height)) {
- for (o = -1; nextEnabledOutput(config, enabled, &o);)
- preferred_match[o] = preferred[o];
- max_pref_width = pref_width;
- max_pref_height = pref_height;
- ret = TRUE;
- }
- }
+ Rotation r = output->initial_rotation;
+
+ if (xf86ModeWidth(mode, r) == pref_width &&
+ xf86ModeHeight(mode, r) == pref_height) {
+ preferred[o] = mode;
+ match = TRUE;
+ }
+ }
+ }
+
+ all_match &= match;
+ }
+
+ if (all_match &&
+ (pref_width*pref_height > max_pref_width*max_pref_height)) {
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ preferred_match[o] = preferred[o];
+ max_pref_width = pref_width;
+ max_pref_height = pref_height;
+ ret = TRUE;
+ }
+ }
}
/*
@@ -2062,17 +2064,17 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
float aspect = 0.0;
DisplayModePtr a = NULL, b = NULL;
- /* count the number of enabled outputs */
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
+ /* count the number of enabled outputs */
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
- if (i != 1)
- break;
+ if (i != 1)
+ break;
- p = -1;
- nextEnabledOutput(config, enabled, &p);
- if (config->output[p]->mm_height)
- aspect = (float) config->output[p]->mm_width /
- (float) config->output[p]->mm_height;
+ p = -1;
+ nextEnabledOutput(config, enabled, &p);
+ if (config->output[p]->mm_height)
+ aspect = (float)config->output[p]->mm_width /
+ (float)config->output[p]->mm_height;
a = bestModeForAspect(config, enabled, 4.0/3.0);
if (aspect)
@@ -2080,15 +2082,15 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
preferred_match[p] = biggestMode(a, b);
- if (preferred_match[p])
- ret = TRUE;
+ if (preferred_match[p])
+ ret = TRUE;
- } while (0);
+ } while (0);
if (ret) {
- /* oh good, there is a match. stash the selected modes and return. */
- memcpy(modes, preferred_match,
- config->num_output * sizeof(DisplayModePtr));
+ /* oh good, there is a match. stash the selected modes and return. */
+ memcpy(modes, preferred_match,
+ config->num_output * sizeof(DisplayModePtr));
}
free(preferred);
@@ -2109,44 +2111,44 @@ xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
aspects = xnfcalloc(config->num_output, sizeof(float));
/* collect the aspect ratios */
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- output = config->output[o];
- if (output->mm_height)
- aspects[o] = (float) output->mm_width / (float) output->mm_height;
- else
- aspects[o] = 4.0 / 3.0;
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (output->mm_height)
+ aspects[o] = (float)output->mm_width / (float)output->mm_height;
+ else
+ aspects[o] = 4.0 / 3.0;
}
/* check that they're all the same */
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- output = config->output[o];
- if (!aspect) {
- aspect = aspects[o];
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (!aspect) {
+ aspect = aspects[o];
}
else if (!aspectMatch(aspect, aspects[o])) {
- goto no_aspect_match;
- }
+ goto no_aspect_match;
+ }
}
/* if they're all 4:3, just skip ahead and save effort */
- if (!aspectMatch(aspect, 4.0 / 3.0))
- aspect_guess = bestModeForAspect(config, enabled, aspect);
+ if (!aspectMatch(aspect, 4.0/3.0))
+ aspect_guess = bestModeForAspect(config, enabled, aspect);
- no_aspect_match:
- base_guess = bestModeForAspect(config, enabled, 4.0 / 3.0);
+no_aspect_match:
+ base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
guess = biggestMode(base_guess, aspect_guess);
if (!guess)
- goto out;
+ goto out;
/* found a mode that works everywhere, now apply it */
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
}
ret = TRUE;
- out:
+out:
free(aspects);
return ret;
}
@@ -2161,30 +2163,30 @@ xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
int default_preferred, target_preferred = 0, o;
/* User preferred > preferred > other modes */
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- default_mode = xf86DefaultMode(config->output[o], width, height);
- if (!default_mode)
- continue;
-
- default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
- ((default_mode->type & M_T_USERPREF) != 0));
-
- if (default_preferred > target_preferred || !target_mode) {
- target_mode = default_mode;
- target_preferred = default_preferred;
- target_rotation = config->output[o]->initial_rotation;
- config->compat_output = o;
- }
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ default_mode = xf86DefaultMode (config->output[o], width, height);
+ if (!default_mode)
+ continue;
+
+ default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
+ ((default_mode->type & M_T_USERPREF) != 0));
+
+ if (default_preferred > target_preferred || !target_mode) {
+ target_mode = default_mode;
+ target_preferred = default_preferred;
+ target_rotation = config->output[o]->initial_rotation;
+ config->compat_output = o;
+ }
}
if (target_mode)
- modes[config->compat_output] = target_mode;
+ modes[config->compat_output] = target_mode;
/* Fill in other output modes */
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- if (!modes[o])
- modes[o] = xf86ClosestMode(config->output[o], target_mode,
- target_rotation, width, height);
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ modes[o] = xf86ClosestMode(config->output[o], target_mode,
+ target_rotation, width, height);
}
return target_mode != NULL;
@@ -2197,19 +2199,19 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
int o;
if (xf86UserConfiguredOutputs(scrn, modes))
- return xf86TargetFallback(scrn, config, modes, enabled, width, height);
-
- for (o = -1; nextEnabledOutput(config, enabled, &o);)
- if (xf86OutputHasUserPreferredMode(config->output[o]))
- return
- xf86TargetFallback(scrn, config, modes, enabled, width, height);
+ return xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ if (xf86OutputHasUserPreferredMode(config->output[o]))
+ return
+ xf86TargetFallback(scrn, config, modes, enabled, width, height);
return FALSE;
}
static Bool
xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
- float gamma_blue)
+ float gamma_blue)
{
int i, size = 256;
CARD16 *red, *green, *blue;
@@ -2218,7 +2220,7 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
green = red + size;
blue = green + size;
- /* Only cause warning if user wanted gamma to be set. */
+ /* Only cause warning if user wanted gamma to be set. */
if (!crtc->funcs->gamma_set &&
(gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) {
free(red);
@@ -2227,7 +2229,7 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
else if (!crtc->funcs->gamma_set) {
free(red);
return TRUE;
- }
+ }
/* At this early stage none of the randr-interface stuff is up.
* So take the default gamma size for lack of something better.
@@ -2236,7 +2238,7 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
if (gamma_red == 1.0)
red[i] = i << 8;
else
- red[i] = (CARD16) (pow((double) i / (double) (size - 1),
+ red[i] = (CARD16)(pow((double)i/(double)(size - 1),
1. / (double) gamma_red) * (double) (size -
1) *
256);
@@ -2244,14 +2246,14 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
if (gamma_green == 1.0)
green[i] = i << 8;
else
- green[i] = (CARD16) (pow((double) i / (double) (size - 1),
+ green[i] = (CARD16)(pow((double)i/(double)(size - 1),
1. / (double) gamma_green) *
(double) (size - 1) * 256);
if (gamma_blue == 1.0)
blue[i] = i << 8;
else
- blue[i] = (CARD16) (pow((double) i / (double) (size - 1),
+ blue[i] = (CARD16)(pow((double)i/(double)(size - 1),
1. / (double) gamma_blue) * (double) (size -
1) *
256);
@@ -2261,12 +2263,12 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
if (size != crtc->gamma_size) {
free(red);
return FALSE;
- }
+ }
crtc->gamma_size = size;
- memcpy(crtc->gamma_red, red, crtc->gamma_size * sizeof(CARD16));
- memcpy(crtc->gamma_green, green, crtc->gamma_size * sizeof(CARD16));
- memcpy(crtc->gamma_blue, blue, crtc->gamma_size * sizeof(CARD16));
+ memcpy (crtc->gamma_red, red, crtc->gamma_size * sizeof (CARD16));
+ memcpy (crtc->gamma_green, green, crtc->gamma_size * sizeof (CARD16));
+ memcpy (crtc->gamma_blue, blue, crtc->gamma_size * sizeof (CARD16));
/* Do not set gamma now, delay until the crtc is activated. */
@@ -2280,7 +2282,7 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
{
XF86ConfMonitorPtr mon = output->conf_monitor;
float gamma_red = 1.0, gamma_green = 1.0, gamma_blue = 1.0;
-
+
if (!mon)
return TRUE;
@@ -2289,13 +2291,13 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
/* Get configured values, where they exist. */
if (mon->mon_gamma_red >= GAMMA_MIN && mon->mon_gamma_red <= GAMMA_MAX)
- gamma_red = mon->mon_gamma_red;
+ gamma_red = mon->mon_gamma_red;
if (mon->mon_gamma_green >= GAMMA_MIN && mon->mon_gamma_green <= GAMMA_MAX)
- gamma_green = mon->mon_gamma_green;
+ gamma_green = mon->mon_gamma_green;
if (mon->mon_gamma_blue >= GAMMA_MIN && mon->mon_gamma_blue <= GAMMA_MAX)
- gamma_blue = mon->mon_gamma_blue;
+ gamma_blue = mon->mon_gamma_blue;
/* This avoids setting gamma 1.0 in case another cloned output on this crtc has a specific gamma. */
if (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0) {
@@ -2306,7 +2308,7 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
gamma_blue);
}
else
- return TRUE;
+ return TRUE;
}
/**
@@ -2324,105 +2326,105 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
*/
Bool
-xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o, c;
- xf86CrtcPtr *crtcs;
- DisplayModePtr *modes;
- Bool *enabled;
- int width, height;
- int i = scrn->scrnIndex;
+xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+ xf86CrtcPtr *crtcs;
+ DisplayModePtr *modes;
+ Bool *enabled;
+ int width, height;
+ int i = scrn->scrnIndex;
Bool have_outputs = TRUE;
Bool ret;
Bool success = FALSE;
/* Set up the device options */
- config->options = xnfalloc(sizeof(xf86DeviceOptions));
- memcpy(config->options, xf86DeviceOptions, sizeof(xf86DeviceOptions));
+ config->options = xnfalloc (sizeof (xf86DeviceOptions));
+ memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions));
xf86ProcessOptions(scrn->scrnIndex, scrn->options, config->options);
- config->debug_modes = xf86ReturnOptValBool(config->options,
- OPTION_MODEDEBUG, FALSE);
+ config->debug_modes = xf86ReturnOptValBool (config->options,
+ OPTION_MODEDEBUG, FALSE);
if (scrn->display->virtualX)
- width = scrn->display->virtualX;
+ width = scrn->display->virtualX;
else
- width = config->maxWidth;
+ width = config->maxWidth;
if (scrn->display->virtualY)
- height = scrn->display->virtualY;
+ height = scrn->display->virtualY;
else
- height = config->maxHeight;
-
- xf86ProbeOutputModes(scrn, width, height);
+ height = config->maxHeight;
- crtcs = xnfcalloc(config->num_output, sizeof(xf86CrtcPtr));
- modes = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
- enabled = xnfcalloc(config->num_output, sizeof(Bool));
+ xf86ProbeOutputModes (scrn, width, height);
+ crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
+ modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
+ enabled = xnfcalloc (config->num_output, sizeof (Bool));
+
ret = xf86CollectEnabledOutputs(scrn, config, enabled);
if (ret == FALSE && canGrow) {
xf86DrvMsg(i, X_WARNING,
"Unable to find connected outputs - setting %dx%d initial framebuffer\n",
- NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
- have_outputs = FALSE;
+ NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+ have_outputs = FALSE;
}
else {
- if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
else if (xf86TargetPreferred
(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
- else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
+ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO,
"Using fuzzy aspect match for initial modes\n");
else if (xf86TargetFallback
(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
- else
- xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
+ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
+ else
+ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
}
- for (o = -1; nextEnabledOutput(config, enabled, &o);) {
- if (!modes[o])
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Output %s enabled but has no modes\n",
- config->output[o]->name);
- else
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- config->output[o]->name, modes[o]->name);
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s enabled but has no modes\n",
+ config->output[o]->name);
+ else
+ xf86DrvMsg (scrn->scrnIndex, X_INFO,
+ "Output %s using initial mode %s\n",
+ config->output[o]->name, modes[o]->name);
}
/*
* Set the position of each output
*/
- if (!xf86InitialOutputPositions(scrn, modes))
- goto bailout;
+ if (!xf86InitialOutputPositions (scrn, modes))
+ goto bailout;
/*
* Set initial panning of each output
*/
- xf86InitialPanning(scrn);
-
+ xf86InitialPanning (scrn);
+
/*
* Assign CRTCs to fit output configuration
*/
- if (have_outputs && !xf86PickCrtcs(scrn, crtcs, modes, 0, width, height))
- goto bailout;
-
+ if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
+ goto bailout;
+
/* XXX override xf86 common frame computation code */
-
+
scrn->display->frameX0 = 0;
scrn->display->frameY0 = 0;
-
+
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
+ xf86CrtcPtr crtc = config->crtc[c];
- crtc->enabled = FALSE;
- memset(&crtc->desiredMode, '\0', sizeof(crtc->desiredMode));
- /* Set default gamma for all crtc's. */
- /* This is done to avoid problems later on with cloned outputs. */
- xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0);
+ crtc->enabled = FALSE;
+ memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode));
+ /* Set default gamma for all crtc's. */
+ /* This is done to avoid problems later on with cloned outputs. */
+ xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0);
}
if (xf86_crtc_supports_gamma(scrn))
@@ -2433,74 +2435,74 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
* Set initial configuration
*/
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr mode = modes[o];
- xf86CrtcPtr crtc = crtcs[o];
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode = modes[o];
+ xf86CrtcPtr crtc = crtcs[o];
if (mode && crtc) {
- crtc->desiredMode = *mode;
- crtc->desiredRotation = output->initial_rotation;
- crtc->desiredX = output->initial_x;
- crtc->desiredY = output->initial_y;
- crtc->desiredTransformPresent = FALSE;
- crtc->enabled = TRUE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = output->initial_rotation;
+ crtc->desiredX = output->initial_x;
+ crtc->desiredY = output->initial_y;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->enabled = TRUE;
memcpy(&crtc->panningTotalArea, &output->initialTotalArea,
sizeof(BoxRec));
memcpy(&crtc->panningTrackingArea, &output->initialTrackingArea,
sizeof(BoxRec));
memcpy(crtc->panningBorder, output->initialBorder,
4 * sizeof(INT16));
- output->crtc = crtc;
- if (!xf86OutputSetInitialGamma(output))
+ output->crtc = crtc;
+ if (!xf86OutputSetInitialGamma(output))
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Initial gamma correction for output %s: failed.\n",
output->name);
}
else {
- output->crtc = NULL;
- }
+ output->crtc = NULL;
+ }
}
if (scrn->display->virtualX == 0) {
- /*
- * Expand virtual size to cover the current config and potential mode
- * switches, if the driver can't enlarge the screen later.
- */
- xf86DefaultScreenLimits(scrn, &width, &height, canGrow);
-
- if (have_outputs == FALSE) {
+ /*
+ * Expand virtual size to cover the current config and potential mode
+ * switches, if the driver can't enlarge the screen later.
+ */
+ xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
+
+ if (have_outputs == FALSE) {
if (width < NO_OUTPUT_DEFAULT_WIDTH &&
height < NO_OUTPUT_DEFAULT_HEIGHT) {
- width = NO_OUTPUT_DEFAULT_WIDTH;
- height = NO_OUTPUT_DEFAULT_HEIGHT;
- }
- }
+ width = NO_OUTPUT_DEFAULT_WIDTH;
+ height = NO_OUTPUT_DEFAULT_HEIGHT;
+ }
+ }
- scrn->display->virtualX = width;
- scrn->display->virtualY = height;
+ scrn->display->virtualX = width;
+ scrn->display->virtualY = height;
}
if (width > scrn->virtualX)
- scrn->virtualX = width;
+ scrn->virtualX = width;
if (height > scrn->virtualY)
- scrn->virtualY = height;
+ scrn->virtualY = height;
/*
* Make sure the configuration isn't too small.
*/
if (width < config->minWidth || height < config->minHeight)
- goto bailout;
+ goto bailout;
/*
* Limit the crtc config to virtual[XY] if the driver can't grow the
* desktop.
*/
if (!canGrow) {
- xf86CrtcSetSizeRange(scrn, config->minWidth, config->minHeight,
- width, height);
+ xf86CrtcSetSizeRange (scrn, config->minWidth, config->minHeight,
+ width, height);
}
- xf86SetScrnInfoModes(scrn);
+ xf86SetScrnInfoModes (scrn);
success = TRUE;
bailout:
@@ -2516,58 +2518,58 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
* since the driver will have to re-route things.
*/
static void
-xf86PrepareOutputs(ScrnInfoPtr scrn)
+xf86PrepareOutputs (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
#if RANDR_GET_CRTC_INTERFACE
- /* Disable outputs that are unused or will be re-routed */
- if (!output->funcs->get_crtc ||
- output->crtc != (*output->funcs->get_crtc) (output) ||
- output->crtc == NULL)
+ /* Disable outputs that are unused or will be re-routed */
+ if (!output->funcs->get_crtc ||
+ output->crtc != (*output->funcs->get_crtc)(output) ||
+ output->crtc == NULL)
#endif
- (*output->funcs->dpms) (output, DPMSModeOff);
+ (*output->funcs->dpms)(output, DPMSModeOff);
}
}
static void
-xf86PrepareCrtcs(ScrnInfoPtr scrn)
+xf86PrepareCrtcs (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
for (c = 0; c < config->num_crtc; c++) {
#if RANDR_GET_CRTC_INTERFACE
- xf86CrtcPtr crtc = config->crtc[c];
- xf86OutputPtr output = NULL;
- uint32_t desired_outputs = 0, current_outputs = 0;
- int o;
-
- for (o = 0; o < config->num_output; o++) {
- output = config->output[o];
- if (output->crtc == crtc)
- desired_outputs |= (1 << o);
- /* If we can't tell where it's mapped, force it off */
- if (!output->funcs->get_crtc) {
- desired_outputs = 0;
- break;
- }
- if ((*output->funcs->get_crtc) (output) == crtc)
- current_outputs |= (1 << o);
- }
-
- /*
- * If mappings are different or the CRTC is unused,
- * we need to disable it
- */
+ xf86CrtcPtr crtc = config->crtc[c];
+ xf86OutputPtr output = NULL;
+ uint32_t desired_outputs = 0, current_outputs = 0;
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ output = config->output[o];
+ if (output->crtc == crtc)
+ desired_outputs |= (1<<o);
+ /* If we can't tell where it's mapped, force it off */
+ if (!output->funcs->get_crtc) {
+ desired_outputs = 0;
+ break;
+ }
+ if ((*output->funcs->get_crtc)(output) == crtc)
+ current_outputs |= (1<<o);
+ }
+
+ /*
+ * If mappings are different or the CRTC is unused,
+ * we need to disable it
+ */
if (desired_outputs != current_outputs || !desired_outputs)
- (*crtc->funcs->dpms) (crtc, DPMSModeOff);
+ (*crtc->funcs->dpms)(crtc, DPMSModeOff);
#else
- (*crtc->funcs->dpms) (crtc, DPMSModeOff);
+ (*crtc->funcs->dpms)(crtc, DPMSModeOff);
#endif
}
}
@@ -2578,65 +2580,65 @@ xf86PrepareCrtcs(ScrnInfoPtr scrn)
*/
Bool
-xf86SetDesiredModes(ScrnInfoPtr scrn)
+xf86SetDesiredModes (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CrtcPtr crtc = config->crtc[0];
- int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc = config->crtc[0];
+ int c;
/* A driver with this hook will take care of this */
if (!crtc->funcs->set_mode_major) {
- xf86PrepareOutputs(scrn);
- xf86PrepareCrtcs(scrn);
+ xf86PrepareOutputs(scrn);
+ xf86PrepareCrtcs(scrn);
}
for (c = 0; c < config->num_crtc; c++) {
- xf86OutputPtr output = NULL;
- int o;
- RRTransformPtr transform;
+ xf86OutputPtr output = NULL;
+ int o;
+ RRTransformPtr transform;
- crtc = config->crtc[c];
+ crtc = config->crtc[c];
- /* Skip disabled CRTCs */
- if (!crtc->enabled)
- continue;
+ /* Skip disabled CRTCs */
+ if (!crtc->enabled)
+ continue;
- if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
- output = xf86CompatOutput(scrn);
+ if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
+ output = xf86CompatOutput(scrn);
else {
- for (o = 0; o < config->num_output; o++)
+ for (o = 0; o < config->num_output; o++)
if (config->output[o]->crtc == crtc) {
- output = config->output[o];
- break;
- }
- }
- /* paranoia */
- if (!output)
- continue;
-
- /* Mark that we'll need to re-set the mode for sure */
- memset(&crtc->mode, 0, sizeof(crtc->mode));
+ output = config->output[o];
+ break;
+ }
+ }
+ /* paranoia */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
if (!crtc->desiredMode.CrtcHDisplay) {
DisplayModePtr mode =
xf86OutputFindClosestMode(output, scrn->currentMode);
- if (!mode)
- return FALSE;
- crtc->desiredMode = *mode;
- crtc->desiredRotation = RR_Rotate_0;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
-
- if (crtc->desiredTransformPresent)
- transform = &crtc->desiredTransform;
- else
- transform = NULL;
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (crtc->desiredTransformPresent)
+ transform = &crtc->desiredTransform;
+ else
+ transform = NULL;
if (!xf86CrtcSetModeTransform
(crtc, &crtc->desiredMode, crtc->desiredRotation, transform,
crtc->desiredX, crtc->desiredY))
- return FALSE;
+ return FALSE;
}
xf86DisableUnusedFunctions(scrn);
@@ -2654,52 +2656,52 @@ xf86SetDesiredModes(ScrnInfoPtr scrn)
*/
DisplayModePtr
-xf86OutputFindClosestMode(xf86OutputPtr output, DisplayModePtr desired)
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
{
- DisplayModePtr best = NULL, scan = NULL;
+ DisplayModePtr best = NULL, scan = NULL;
for (scan = output->probed_modes; scan != NULL; scan = scan->next) {
- /* If there's an exact match, we're done. */
- if (xf86ModesEqual(scan, desired)) {
- best = desired;
- break;
- }
-
- /* Reject if it's larger than the desired mode. */
- if (scan->HDisplay > desired->HDisplay ||
+ /* If there's an exact match, we're done. */
+ if (xf86ModesEqual(scan, desired)) {
+ best = desired;
+ break;
+ }
+
+ /* Reject if it's larger than the desired mode. */
+ if (scan->HDisplay > desired->HDisplay ||
scan->VDisplay > desired->VDisplay) {
- continue;
- }
+ continue;
+ }
- /*
- * If we haven't picked a best mode yet, use the first
- * one in the size range
- */
+ /*
+ * If we haven't picked a best mode yet, use the first
+ * one in the size range
+ */
if (best == NULL) {
- best = scan;
- continue;
- }
-
- /* Find if it's closer to the right size than the current best
- * option.
- */
- if ((scan->HDisplay > best->HDisplay &&
- scan->VDisplay >= best->VDisplay) ||
- (scan->HDisplay >= best->HDisplay &&
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's closer to the right size than the current best
+ * option.
+ */
+ if ((scan->HDisplay > best->HDisplay &&
+ scan->VDisplay >= best->VDisplay) ||
+ (scan->HDisplay >= best->HDisplay &&
scan->VDisplay > best->VDisplay)) {
- best = scan;
- continue;
- }
-
- /* Find if it's still closer to the right refresh than the current
- * best resolution.
- */
- if (scan->HDisplay == best->HDisplay &&
- scan->VDisplay == best->VDisplay &&
- (fabs(scan->VRefresh - desired->VRefresh) <
- fabs(best->VRefresh - desired->VRefresh))) {
- best = scan;
- }
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's still closer to the right refresh than the current
+ * best resolution.
+ */
+ if (scan->HDisplay == best->HDisplay &&
+ scan->VDisplay == best->VDisplay &&
+ (fabs(scan->VRefresh - desired->VRefresh) <
+ fabs(best->VRefresh - desired->VRefresh))) {
+ best = scan;
+ }
}
return best;
}
@@ -2713,64 +2715,64 @@ xf86OutputFindClosestMode(xf86OutputPtr output, DisplayModePtr desired)
*/
Bool
-xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
+xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- Bool ok = TRUE;
- xf86OutputPtr compat_output;
- DisplayModePtr compat_mode = NULL;
- int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ Bool ok = TRUE;
+ xf86OutputPtr compat_output;
+ DisplayModePtr compat_mode = NULL;
+ int c;
/*
* Let the compat output drive the final mode selection
*/
compat_output = xf86CompatOutput(pScrn);
if (compat_output)
- compat_mode = xf86OutputFindClosestMode(compat_output, desired);
+ compat_mode = xf86OutputFindClosestMode (compat_output, desired);
if (compat_mode)
- desired = compat_mode;
-
+ desired = compat_mode;
+
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
- DisplayModePtr crtc_mode = NULL;
- int o;
-
- if (!crtc->enabled)
- continue;
+ xf86CrtcPtr crtc = config->crtc[c];
+ DisplayModePtr crtc_mode = NULL;
+ int o;
+ if (!crtc->enabled)
+ continue;
+
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr output_mode;
-
- /* skip outputs not on this crtc */
- if (output->crtc != crtc)
- continue;
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr output_mode;
+ /* skip outputs not on this crtc */
+ if (output->crtc != crtc)
+ continue;
+
if (crtc_mode) {
- output_mode = xf86OutputFindClosestMode(output, crtc_mode);
- if (output_mode != crtc_mode)
- output->crtc = NULL;
- }
- else
- crtc_mode = xf86OutputFindClosestMode(output, desired);
- }
+ output_mode = xf86OutputFindClosestMode (output, crtc_mode);
+ if (output_mode != crtc_mode)
+ output->crtc = NULL;
+ }
+ else
+ crtc_mode = xf86OutputFindClosestMode (output, desired);
+ }
if (!crtc_mode) {
- crtc->enabled = FALSE;
- continue;
- }
- if (!xf86CrtcSetModeTransform(crtc, crtc_mode, rotation, NULL, 0, 0))
- ok = FALSE;
+ crtc->enabled = FALSE;
+ continue;
+ }
+ if (!xf86CrtcSetModeTransform (crtc, crtc_mode, rotation, NULL, 0, 0))
+ ok = FALSE;
else {
- crtc->desiredMode = *crtc_mode;
- crtc->desiredRotation = rotation;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
+ crtc->desiredMode = *crtc_mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
}
xf86DisableUnusedFunctions(pScrn);
#ifdef RANDR_12_INTERFACE
- xf86RandR12TellChanged(pScrn->pScreen);
+ xf86RandR12TellChanged (pScrn->pScreen);
#endif
return ok;
}
@@ -2784,35 +2786,35 @@ xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
void
xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
if (!scrn->vtSema)
- return;
+ return;
if (mode == DPMSModeOff) {
- for (i = 0; i < config->num_output; i++) {
- xf86OutputPtr output = config->output[i];
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
- if (output->crtc != NULL)
- (*output->funcs->dpms) (output, mode);
- }
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
}
for (i = 0; i < config->num_crtc; i++) {
- xf86CrtcPtr crtc = config->crtc[i];
+ xf86CrtcPtr crtc = config->crtc[i];
- if (crtc->enabled)
- (*crtc->funcs->dpms) (crtc, mode);
+ if (crtc->enabled)
+ (*crtc->funcs->dpms) (crtc, mode);
}
if (mode != DPMSModeOff) {
- for (i = 0; i < config->num_output; i++) {
- xf86OutputPtr output = config->output[i];
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
- if (output->crtc != NULL)
- (*output->funcs->dpms) (output, mode);
- }
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
}
}
@@ -2828,9 +2830,9 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (xf86IsUnblank(mode))
- xf86DPMSSet(pScrn, DPMSModeOn, 0);
+ xf86DPMSSet(pScrn, DPMSModeOn, 0);
else
- xf86DPMSSet(pScrn, DPMSModeOff, 0);
+ xf86DPMSSet(pScrn, DPMSModeOff, 0);
return TRUE;
}
@@ -2841,30 +2843,30 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o, c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, c;
for (o = 0; o < xf86_config->num_output; o++) {
- xf86OutputPtr output = xf86_config->output[o];
+ xf86OutputPtr output = xf86_config->output[o];
- if (!output->crtc)
- (*output->funcs->dpms) (output, DPMSModeOff);
+ if (!output->crtc)
+ (*output->funcs->dpms)(output, DPMSModeOff);
}
for (c = 0; c < xf86_config->num_crtc; c++) {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
if (!crtc->enabled) {
- crtc->funcs->dpms(crtc, DPMSModeOff);
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- xf86RotateDestroy(crtc);
- crtc->active = FALSE;
- }
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ xf86RotateDestroy(crtc);
+ crtc->active = FALSE;
+ }
}
if (pScrn->pScreen)
- xf86_crtc_notify(pScrn->pScreen);
+ xf86_crtc_notify(pScrn->pScreen);
if (pScrn->ModeSet)
- pScrn->ModeSet(pScrn);
+ pScrn->ModeSet(pScrn);
}
#ifdef RANDR_12_INTERFACE
@@ -2875,20 +2877,20 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
* Set the RandR EDID property
*/
static void
-xf86OutputSetEDIDProperty(xf86OutputPtr output, void *data, int data_len)
+xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
{
Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME) - 1, TRUE);
/* This may get called before the RandR resources have been created */
if (output->randr_output == NULL)
- return;
+ return;
if (data_len != 0) {
- RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
- PropModeReplace, data_len, data, FALSE, TRUE);
+ RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
+ PropModeReplace, data_len, data, FALSE, TRUE);
}
else {
- RRDeleteOutputProperty(output->randr_output, edid_atom);
+ RRDeleteOutputProperty(output->randr_output, edid_atom);
}
}
@@ -2903,14 +2905,14 @@ struct det_phySize_parameter {
static void
handle_detailed_physical_size(struct detailed_monitor_section
- *det_mon, void *data)
+ *det_mon, void *data)
{
struct det_phySize_parameter *p;
- p = (struct det_phySize_parameter *) data;
+ p = (struct det_phySize_parameter *)data;
- if (p->ret == TRUE)
- return;
+ if (p->ret == TRUE )
+ return ;
xf86DetTimingApplyQuirks(det_mon, p->quirks,
p->output->MonInfo->features.hsize,
@@ -2929,26 +2931,26 @@ handle_detailed_physical_size(struct detailed_monitor_section
* Set the EDID information for the specified output
*/
void
-xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
{
- ScrnInfoPtr scrn = output->scrn;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- Bool debug_modes = config->debug_modes || xf86Initialising;
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ Bool debug_modes = config->debug_modes || xf86Initialising;
#ifdef RANDR_12_INTERFACE
- int size;
+ int size;
#endif
-
+
free(output->MonInfo);
-
+
output->MonInfo = edid_mon;
output->mm_width = 0;
output->mm_height = 0;
if (debug_modes) {
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
- output->name);
- xf86PrintEDID(edid_mon);
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
+ output->name);
+ xf86PrintEDID(edid_mon);
}
/* Set the DDC properties for the 'compat' output */
@@ -2959,13 +2961,13 @@ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
/* Set the RandR output properties */
size = 0;
if (edid_mon) {
- if (edid_mon->ver.version == 1) {
- size = 128;
- if (edid_mon->flags & EDID_COMPLETE_RAWDATA)
- size += edid_mon->no_sections * 128;
+ if (edid_mon->ver.version == 1) {
+ size = 128;
+ if (edid_mon->flags & EDID_COMPLETE_RAWDATA)
+ size += edid_mon->no_sections * 128;
}
else if (edid_mon->ver.version == 2)
- size = 256;
+ size = 256;
}
xf86OutputSetEDIDProperty(output, edid_mon ? edid_mon->rawData : NULL,
size);
@@ -2976,16 +2978,16 @@ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
struct det_phySize_parameter p;
p.output = output;
- p.quirks = xf86DDCDetectQuirks(scrn->scrnIndex, edid_mon, FALSE);
+ p.quirks = xf86DDCDetectQuirks(scrn->scrnIndex,edid_mon, FALSE);
p.ret = FALSE;
xf86ForEachDetailedBlock(edid_mon, handle_detailed_physical_size, &p);
- /* if no mm size is available from a detailed timing, check the max size field */
- if ((!output->mm_width || !output->mm_height) &&
+ /* if no mm size is available from a detailed timing, check the max size field */
+ if ((!output->mm_width || !output->mm_height) &&
(edid_mon->features.hsize && edid_mon->features.vsize)) {
- output->mm_width = edid_mon->features.hsize * 10;
- output->mm_height = edid_mon->features.vsize * 10;
- }
+ output->mm_width = edid_mon->features.hsize * 10;
+ output->mm_height = edid_mon->features.vsize * 10;
+ }
}
}
@@ -2994,21 +2996,21 @@ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
* stored in 'output'
*/
DisplayModePtr
-xf86OutputGetEDIDModes(xf86OutputPtr output)
+xf86OutputGetEDIDModes (xf86OutputPtr output)
{
- ScrnInfoPtr scrn = output->scrn;
- xf86MonPtr edid_mon = output->MonInfo;
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr edid_mon = output->MonInfo;
if (!edid_mon)
- return NULL;
+ return NULL;
return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
}
/* maybe we should care about DDC1? meh. */
xf86MonPtr
-xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus)
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
{
- ScrnInfoPtr scrn = output->scrn;
+ ScrnInfoPtr scrn = output->scrn;
xf86MonPtr mon;
mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE);
@@ -3019,11 +3021,11 @@ xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus)
}
static const char *_xf86ConnectorNames[] = {
- "None", "VGA", "DVI-I", "DVI-D",
- "DVI-A", "Composite", "S-Video",
- "Component", "LFP", "Proprietary",
- "HDMI", "DisplayPort",
-};
+ "None", "VGA", "DVI-I", "DVI-D",
+ "DVI-A", "Composite", "S-Video",
+ "Component", "LFP", "Proprietary",
+ "HDMI", "DisplayPort",
+ };
const char *
xf86ConnectorGetName(xf86ConnectorType connector)
@@ -3040,20 +3042,20 @@ x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
- dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
+ dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
}
static void
x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
{
if (crtc->enabled) {
- crtc_box->x1 = crtc->x;
- crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
- crtc_box->y1 = crtc->y;
- crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
+ crtc_box->x1 = crtc->x;
+ crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
+ crtc_box->y1 = crtc->y;
+ crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
}
else
- crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+ crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
}
static int
@@ -3073,11 +3075,11 @@ static xf86CrtcPtr
xf86_covering_crtc(ScrnInfoPtr pScrn,
BoxPtr box, xf86CrtcPtr desired, BoxPtr crtc_box_ret)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc, best_crtc;
- int coverage, best_coverage;
- int c;
- BoxRec crtc_box, cover_box;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc, best_crtc;
+ int coverage, best_coverage;
+ int c;
+ BoxRec crtc_box, cover_box;
best_crtc = NULL;
best_coverage = 0;
@@ -3086,19 +3088,19 @@ xf86_covering_crtc(ScrnInfoPtr pScrn,
crtc_box_ret->y1 = 0;
crtc_box_ret->y2 = 0;
for (c = 0; c < xf86_config->num_crtc; c++) {
- crtc = xf86_config->crtc[c];
- x86_crtc_box(crtc, &crtc_box);
- x86_crtc_box_intersect(&cover_box, &crtc_box, box);
- coverage = xf86_crtc_box_area(&cover_box);
- if (coverage && crtc == desired) {
- *crtc_box_ret = crtc_box;
- return crtc;
+ crtc = xf86_config->crtc[c];
+ x86_crtc_box(crtc, &crtc_box);
+ x86_crtc_box_intersect(&cover_box, &crtc_box, box);
+ coverage = xf86_crtc_box_area(&cover_box);
+ if (coverage && crtc == desired) {
+ *crtc_box_ret = crtc_box;
+ return crtc;
}
else if (coverage > best_coverage) {
- *crtc_box_ret = crtc_box;
- best_crtc = crtc;
- best_coverage = coverage;
- }
+ *crtc_box_ret = crtc_box;
+ best_crtc = crtc;
+ best_coverage = coverage;
+ }
}
return best_crtc;
}
@@ -3113,53 +3115,53 @@ xf86_covering_crtc(ScrnInfoPtr pScrn,
Bool
xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
- xf86CrtcPtr * crtc_ret,
- xf86CrtcPtr desired_crtc,
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
+ xf86CrtcPtr *crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
INT32 *yb, RegionPtr reg, INT32 width, INT32 height)
{
- Bool ret;
- RegionRec crtc_region_local;
- RegionPtr crtc_region = reg;
-
+ Bool ret;
+ RegionRec crtc_region_local;
+ RegionPtr crtc_region = reg;
+
if (crtc_ret) {
- BoxRec crtc_box;
- xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
- desired_crtc,
- &crtc_box);
-
- if (crtc) {
- RegionInit(&crtc_region_local, &crtc_box, 1);
- crtc_region = &crtc_region_local;
- RegionIntersect(crtc_region, crtc_region, reg);
- }
- *crtc_ret = crtc;
+ BoxRec crtc_box;
+ xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
+ desired_crtc,
+ &crtc_box);
+
+ if (crtc) {
+ RegionInit(&crtc_region_local, &crtc_box, 1);
+ crtc_region = &crtc_region_local;
+ RegionIntersect(crtc_region, crtc_region, reg);
+ }
+ *crtc_ret = crtc;
}
- ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
- crtc_region, width, height);
+ ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
+ crtc_region, width, height);
if (crtc_region != reg)
- RegionUninit(&crtc_region_local);
+ RegionUninit(&crtc_region_local);
return ret;
}
#endif
xf86_crtc_notify_proc_ptr
-xf86_wrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
+xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
{
if (xf86CrtcConfigPrivateIndex != -1) {
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86_crtc_notify_proc_ptr old;
-
- old = config->xf86_crtc_notify;
- config->xf86_crtc_notify = new;
- return old;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86_crtc_notify_proc_ptr old;
+
+ old = config->xf86_crtc_notify;
+ config->xf86_crtc_notify = new;
+ return old;
}
return NULL;
}
@@ -3168,38 +3170,38 @@ void
xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
{
if (xf86CrtcConfigPrivateIndex != -1) {
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- config->xf86_crtc_notify = old;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->xf86_crtc_notify = old;
}
}
void
xf86_crtc_notify(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
if (config->xf86_crtc_notify)
- config->xf86_crtc_notify(screen);
+ config->xf86_crtc_notify(screen);
}
Bool
xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
{
if (xf86CrtcConfigPrivateIndex != -1) {
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc;
- /* for multiple drivers loaded we need this */
- if (!xf86_config)
- return FALSE;
- if (xf86_config->num_crtc == 0)
- return FALSE;
- crtc = xf86_config->crtc[0];
+ /* for multiple drivers loaded we need this */
+ if (!xf86_config)
+ return FALSE;
+ if (xf86_config->num_crtc == 0)
+ return FALSE;
+ crtc = xf86_config->crtc[0];
- return crtc->funcs->gamma_set != NULL;
+ return crtc->funcs->gamma_set != NULL;
}
return FALSE;
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 9161e181e..e1193087a 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -85,150 +85,150 @@
/**************************************************************************/
#if (defined(SYSV) || defined(SVR4)) && \
(defined(sun) || defined(__i386__))
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <termio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <errno.h>
-
-#if defined(_NEED_SYSI86)
-#if !(defined (sun) && defined (SVR4))
-#include <sys/immu.h>
-#include <sys/region.h>
-#include <sys/proc.h>
-#endif
-#include <sys/tss.h>
-#include <sys/sysi86.h>
-#if defined(SVR4) && !defined(sun)
-#include <sys/seg.h>
-#endif /* SVR4 && !sun */
+# include <sys/ioctl.h>
+# include <signal.h>
+# include <termio.h>
+# include <sys/stat.h>
+# include <sys/types.h>
+
+# include <errno.h>
+
+# if defined(_NEED_SYSI86)
+# if !(defined (sun) && defined (SVR4))
+# include <sys/immu.h>
+# include <sys/region.h>
+# include <sys/proc.h>
+# endif
+# include <sys/tss.h>
+# include <sys/sysi86.h>
+# if defined(SVR4) && !defined(sun)
+# include <sys/seg.h>
+# endif /* SVR4 && !sun */
/* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
-#if !defined(V86SC_IOPL) /* Solaris 7 or later? */
-#include <sys/v86.h> /* Nope */
-#endif
-#if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4)
-#include <sys/psw.h>
-#endif
-#endif /* _NEED_SYSI86 */
-
-#if defined(HAS_SVR3_MMAPDRV)
-#include <sys/sysmacros.h>
-#if !defined(_NEED_SYSI86)
-#include <sys/immu.h>
-#include <sys/region.h>
-#endif
-#include <sys/mmap.h> /* MMAP driver header */
-#endif
-
-#if !defined(sun) || defined(HAVE_SYS_VT_H)
-#define HAS_USL_VTS
-#endif
-#if !defined(sun)
-#include <sys/emap.h>
-#endif
-#if defined(HAS_USL_VTS)
-#if !defined(sun)
-#include <sys/at_ansi.h>
-#endif
-#include <sys/kd.h>
-#include <sys/vt.h>
-#endif
-
-#if defined(sun)
-#include <sys/fbio.h>
-#include <sys/kbd.h>
-#include <sys/kbio.h>
+# if !defined(V86SC_IOPL) /* Solaris 7 or later? */
+# include <sys/v86.h> /* Nope */
+# endif
+# if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4)
+# include <sys/psw.h>
+# endif
+# endif /* _NEED_SYSI86 */
+
+# if defined(HAS_SVR3_MMAPDRV)
+# include <sys/sysmacros.h>
+# if !defined(_NEED_SYSI86)
+# include <sys/immu.h>
+# include <sys/region.h>
+# endif
+# include <sys/mmap.h> /* MMAP driver header */
+# endif
+
+# if !defined(sun) || defined(HAVE_SYS_VT_H)
+# define HAS_USL_VTS
+# endif
+# if !defined(sun)
+# include <sys/emap.h>
+# endif
+# if defined(HAS_USL_VTS)
+# if !defined(sun)
+# include <sys/at_ansi.h>
+# endif
+# include <sys/kd.h>
+# include <sys/vt.h>
+# endif
+
+# if defined(sun)
+# include <sys/fbio.h>
+# include <sys/kbd.h>
+# include <sys/kbio.h>
/* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
definitions in parser/xf86tokens.h */
-#undef STRING
-#undef LEFTALT
-#undef RIGHTALT
-
-#define LED_CAP LED_CAPS_LOCK
-#define LED_NUM LED_NUM_LOCK
-#define LED_SCR LED_SCROLL_LOCK
-#define LED_COMP LED_COMPOSE
-#endif /* sun */
-
-#if !defined(VT_ACKACQ)
-#define VT_ACKACQ 2
-#endif /* !VT_ACKACQ */
-
-#if defined(SVR4)
-#include <sys/mman.h>
-#if !(defined(sun) && defined (SVR4))
-#define DEV_MEM "/dev/pmem"
-#endif
-#define CLEARDTR_SUPPORT
-#define POSIX_TTY
-#endif /* SVR4 */
-
-#endif /* (SYSV || SVR4) */
+# undef STRING
+# undef LEFTALT
+# undef RIGHTALT
+
+# define LED_CAP LED_CAPS_LOCK
+# define LED_NUM LED_NUM_LOCK
+# define LED_SCR LED_SCROLL_LOCK
+# define LED_COMP LED_COMPOSE
+# endif /* sun */
+
+# if !defined(VT_ACKACQ)
+# define VT_ACKACQ 2
+# endif /* !VT_ACKACQ */
+
+# if defined(SVR4)
+# include <sys/mman.h>
+# if !(defined(sun) && defined (SVR4))
+# define DEV_MEM "/dev/pmem"
+# endif
+# define CLEARDTR_SUPPORT
+# define POSIX_TTY
+# endif /* SVR4 */
+
+#endif /* (SYSV || SVR4) */
/**************************************************************************/
/* Linux or Glibc-based system */
/**************************************************************************/
-#if defined(__linux__) || defined(__GLIBC__)
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <assert.h>
-
-#ifdef __linux__
-#include <termio.h>
-#else /* __GLIBC__ */
-#include <termios.h>
-#endif
-#ifdef __sparc__
-#include <sys/param.h>
-#endif
-
-#include <errno.h>
-
-#include <sys/stat.h>
-
-#include <sys/mman.h>
-#ifdef __linux__
-#define HAS_USL_VTS
-#include <sys/kd.h>
-#include <sys/vt.h>
-#define LDGMAP GIO_SCRNMAP
-#define LDSMAP PIO_SCRNMAP
-#define LDNMAP LDSMAP
-#define CLEARDTR_SUPPORT
-#endif
-
-#define POSIX_TTY
-
-#endif /* __linux__ || __GLIBC__ */
+#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__)
+# include <sys/ioctl.h>
+# include <signal.h>
+# include <stdlib.h>
+# include <sys/types.h>
+# include <assert.h>
+
+# ifdef __linux__
+# include <termio.h>
+# else /* __GLIBC__ */
+# include <termios.h>
+# endif
+# ifdef __sparc__
+# include <sys/param.h>
+# endif
+
+# include <errno.h>
+
+# include <sys/stat.h>
+
+# include <sys/mman.h>
+# ifdef __linux__
+# define HAS_USL_VTS
+# include <sys/kd.h>
+# include <sys/vt.h>
+# define LDGMAP GIO_SCRNMAP
+# define LDSMAP PIO_SCRNMAP
+# define LDNMAP LDSMAP
+# define CLEARDTR_SUPPORT
+# endif
+
+# define POSIX_TTY
+
+#endif /* __linux__ || __GLIBC__ */
/**************************************************************************/
/* 386BSD and derivatives, BSD/386 */
/**************************************************************************/
#if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
-#undef __386BSD__
+# undef __386BSD__
#endif
#ifdef CSRG_BASED
-#include <sys/ioctl.h>
-#include <signal.h>
+# include <sys/ioctl.h>
+# include <signal.h>
-#include <termios.h>
-#define termio termios
-#define POSIX_TTY
+# include <termios.h>
+# define termio termios
+# define POSIX_TTY
-#include <errno.h>
+# include <errno.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
+# include <sys/types.h>
+# include <sys/mman.h>
+# include <sys/stat.h>
-#endif /* CSRG_BASED */
+#endif /* CSRG_BASED */
/**************************************************************************/
/* Kernel of *BSD */
@@ -236,92 +236,92 @@
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-#include <sys/param.h>
-#if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
-#define __FreeBSD_kernel_version __FreeBSD_version
-#endif
+# include <sys/param.h>
+# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
+# define __FreeBSD_kernel_version __FreeBSD_version
+# endif
-#if !defined(LINKKIT)
+# if !defined(LINKKIT)
/* Don't need this stuff for the Link Kit */
-#ifdef SYSCONS_SUPPORT
-#define COMPAT_SYSCONS
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
-#include <sys/consio.h>
-#include <sys/kbio.h>
-#else
-#include <machine/console.h>
-#endif /* FreeBSD 4.1 RELEASE or lator */
-#else
-#include <sys/console.h>
-#endif
-#endif /* SYSCONS_SUPPORT */
-#if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__)
-#if !defined(SYSCONS_SUPPORT)
+# ifdef SYSCONS_SUPPORT
+# define COMPAT_SYSCONS
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+# if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
+# include <sys/consio.h>
+# include <sys/kbio.h>
+# else
+# include <machine/console.h>
+# endif /* FreeBSD 4.1 RELEASE or lator */
+# else
+# include <sys/console.h>
+# endif
+# endif /* SYSCONS_SUPPORT */
+# if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__)
+# if !defined(SYSCONS_SUPPORT)
/* no syscons, so include pcvt specific header file */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#include <machine/pcvt_ioctl.h>
-#else
-#include <sys/pcvt_ioctl.h>
-#endif /* __FreeBSD_kernel__ */
-#else /* pcvt and syscons: hard-code the ID magic */
-#define VGAPCVTID _IOWR('V',113, struct pcvtid)
-struct pcvtid {
- char name[16];
- int rmajor, rminor;
-};
-#endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
-#endif /* PCVT_SUPPORT */
-#ifdef WSCONS_SUPPORT
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplay_usl_io.h>
-#endif /* WSCONS_SUPPORT */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
-#include <sys/mouse.h>
-#else
-#undef MOUSE_GETINFO
-#include <machine/mouse.h>
-#endif
-#endif
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# include <machine/pcvt_ioctl.h>
+# else
+# include <sys/pcvt_ioctl.h>
+# endif /* __FreeBSD_kernel__ */
+# else /* pcvt and syscons: hard-code the ID magic */
+# define VGAPCVTID _IOWR('V',113, struct pcvtid)
+ struct pcvtid {
+ char name[16];
+ int rmajor, rminor;
+ };
+# endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
+# endif /* PCVT_SUPPORT */
+# ifdef WSCONS_SUPPORT
+# include <dev/wscons/wsconsio.h>
+# include <dev/wscons/wsdisplay_usl_io.h>
+# endif /* WSCONS_SUPPORT */
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+# if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
+# include <sys/mouse.h>
+# else
+# undef MOUSE_GETINFO
+# include <machine/mouse.h>
+# endif
+# endif
/* Include these definitions in case ioctl_pc.h didn't get included */
-#ifndef CONSOLE_X_MODE_ON
-#define CONSOLE_X_MODE_ON _IO('t',121)
-#endif
-#ifndef CONSOLE_X_MODE_OFF
-#define CONSOLE_X_MODE_OFF _IO('t',122)
-#endif
-#ifndef CONSOLE_X_BELL
-#define CONSOLE_X_BELL _IOW('t',123,int[2])
-#endif
-#ifndef CONSOLE_X_TV_ON
-#define CONSOLE_X_TV_ON _IOW('t',155,int)
-#define XMODE_RGB 0
-#define XMODE_NTSC 1
-#define XMODE_PAL 2
-#define XMODE_SECAM 3
-#endif
-#ifndef CONSOLE_X_TV_OFF
-#define CONSOLE_X_TV_OFF _IO('t',156)
-#endif
+# ifndef CONSOLE_X_MODE_ON
+# define CONSOLE_X_MODE_ON _IO('t',121)
+# endif
+# ifndef CONSOLE_X_MODE_OFF
+# define CONSOLE_X_MODE_OFF _IO('t',122)
+# endif
+# ifndef CONSOLE_X_BELL
+# define CONSOLE_X_BELL _IOW('t',123,int[2])
+# endif
+# ifndef CONSOLE_X_TV_ON
+# define CONSOLE_X_TV_ON _IOW('t',155,int)
+# define XMODE_RGB 0
+# define XMODE_NTSC 1
+# define XMODE_PAL 2
+# define XMODE_SECAM 3
+# endif
+# ifndef CONSOLE_X_TV_OFF
+# define CONSOLE_X_TV_OFF _IO('t',156)
+# endif
#ifndef CONSOLE_GET_LINEAR_INFO
-#define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
+# define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
#endif
-#ifndef CONSOLE_GET_IO_INFO
-#define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
+#ifndef CONSOLE_GET_IO_INFO
+# define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
#endif
-#ifndef CONSOLE_GET_MEM_INFO
-#define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
+#ifndef CONSOLE_GET_MEM_INFO
+# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
#endif
-#endif /* !LINKKIT */
+# endif /* !LINKKIT */
#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
#include <machine/sysarch.h>
#endif
-#define CLEARDTR_SUPPORT
+# define CLEARDTR_SUPPORT
-#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
/**************************************************************************/
/* IRIX */
@@ -331,7 +331,7 @@ struct pcvtid {
/* Generic */
/**************************************************************************/
-#include <sys/wait.h> /* May need to adjust this for other OSs */
+#include <sys/wait.h> /* May need to adjust this for other OSs */
/* For PATH_MAX */
#include "misc.h"
@@ -341,20 +341,20 @@ struct pcvtid {
* and it's safe, so just do it.
*/
#if !defined(O_NDELAY) && defined(O_NONBLOCK)
-#define O_NDELAY O_NONBLOCK
-#endif /* !O_NDELAY && O_NONBLOCK */
+# define O_NDELAY O_NONBLOCK
+#endif /* !O_NDELAY && O_NONBLOCK */
#if !defined(MAXHOSTNAMELEN)
-#define MAXHOSTNAMELEN 32
-#endif /* !MAXHOSTNAMELEN */
+# define MAXHOSTNAMELEN 32
+#endif /* !MAXHOSTNAMELEN */
#if defined(_POSIX_SOURCE)
-#include <limits.h>
+# include <limits.h>
#else
-#define _POSIX_SOURCE
-#include <limits.h>
-#undef _POSIX_SOURCE
-#endif /* _POSIX_SOURCE */
+# define _POSIX_SOURCE
+# include <limits.h>
+# undef _POSIX_SOURCE
+#endif /* _POSIX_SOURCE */
#ifndef DEV_MEM
#define DEV_MEM "/dev/mem"
@@ -373,4 +373,4 @@ struct pcvtid {
#include "compiler.h"
#endif
-#endif /* _XF86_OSLIB_H */
+#endif /* _XF86_OSLIB_H */
diff --git a/hw/xfree86/shadowfb/Makefile.am b/hw/xfree86/shadowfb/Makefile.am
index 39c66109e..5756fca3b 100644
--- a/hw/xfree86/shadowfb/Makefile.am
+++ b/hw/xfree86/shadowfb/Makefile.am
@@ -1,6 +1,7 @@
module_LTLIBRARIES = libshadowfb.la
-libshadowfb_la_LDFLAGS = -module -avoid-version
+libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libshadowfb_la_SOURCES = sfbmodule.c shadow.c
+libshadowfb_la_LIBADD = $(PIXMAN_LIBS)
sdk_HEADERS = shadowfb.h
diff --git a/hw/xfree86/vbe/Makefile.am b/hw/xfree86/vbe/Makefile.am
index 4b794e647..0b24faf1f 100644
--- a/hw/xfree86/vbe/Makefile.am
+++ b/hw/xfree86/vbe/Makefile.am
@@ -1,6 +1,9 @@
module_LTLIBRARIES = libvbe.la
-libvbe_la_LDFLAGS = -module -avoid-version
+libvbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c
+if NO_UNDEFINED
+libvbe_la_LIBADD = ../int10/libint10.la
+endif
sdk_HEADERS = vbe.h vbeModes.h
diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am
index 78d934876..f6480a713 100644
--- a/hw/xfree86/xaa/Makefile.am
+++ b/hw/xfree86/xaa/Makefile.am
@@ -10,7 +10,7 @@ POLYSEG = s-xaaLine.c s-xaaDashLine.c
if XAA
-libxaa_la_LDFLAGS = -module -avoid-version
+libxaa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
if COMPOSITE
libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la
endif
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 0909826d9..6162155c8 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -46,69 +46,69 @@ is" without express or implied warranty.
Bool xnestDoFullGeneration = True;
void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
- int i, j;
-
- xnestOpenDisplay(argc, argv);
-
- screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
- screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
- screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
- screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
-
- screenInfo->numPixmapFormats = 0;
- for (i = 0; i < xnestNumPixmapFormats; i++)
- for (j = 0; j < xnestNumDepths; j++)
- if ((xnestPixmapFormats[i].depth == 1) ||
- (xnestPixmapFormats[i].depth == xnestDepths[j])) {
- screenInfo->formats[screenInfo->numPixmapFormats].depth =
- xnestPixmapFormats[i].depth;
- screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
- xnestPixmapFormats[i].bits_per_pixel;
- screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
- xnestPixmapFormats[i].scanline_pad;
- screenInfo->numPixmapFormats++;
- break;
- }
-
- xnestFontPrivateIndex = AllocateFontPrivateIndex();
-
+ int i, j;
+
+ xnestOpenDisplay(argc, argv);
+
+ screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
+ screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
+ screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
+ screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
+
+ screenInfo->numPixmapFormats = 0;
+ for (i = 0; i < xnestNumPixmapFormats; i++)
+ for (j = 0; j < xnestNumDepths; j++)
+ if ((xnestPixmapFormats[i].depth == 1) ||
+ (xnestPixmapFormats[i].depth == xnestDepths[j])) {
+ screenInfo->formats[screenInfo->numPixmapFormats].depth =
+ xnestPixmapFormats[i].depth;
+ screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
+ xnestPixmapFormats[i].bits_per_pixel;
+ screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
+ xnestPixmapFormats[i].scanline_pad;
+ screenInfo->numPixmapFormats++;
+ break;
+ }
+
+ xnestFontPrivateIndex = AllocateFontPrivateIndex();
+
if (!xnestNumScreens)
xnestNumScreens = 1;
- for (i = 0; i < xnestNumScreens; i++)
- AddScreen(xnestOpenScreen, argc, argv);
+ for (i = 0; i < xnestNumScreens; i++)
+ AddScreen(xnestOpenScreen, argc, argv);
- xnestNumScreens = screenInfo->numScreens;
+ xnestNumScreens = screenInfo->numScreens;
- xnestDoFullGeneration = xnestFullGeneration;
+ xnestDoFullGeneration = xnestFullGeneration;
}
void
InitInput(int argc, char *argv[])
{
- int rc;
+ int rc;
- rc = AllocDevicePair(serverClient, "Xnest",
- &xnestPointerDevice,
- &xnestKeyboardDevice,
+ rc = AllocDevicePair(serverClient, "Xnest",
+ &xnestPointerDevice,
+ &xnestKeyboardDevice,
xnestPointerProc, xnestKeyboardProc, FALSE);
- if (rc != Success)
- FatalError("Failed to init Xnest default devices.\n");
+ if (rc != Success)
+ FatalError("Failed to init Xnest default devices.\n");
- mieqInit();
+ mieqInit();
- AddEnabledDevice(XConnectionNumber(xnestDisplay));
+ AddEnabledDevice(XConnectionNumber(xnestDisplay));
- RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
+ RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
}
void
CloseInput(void)
{
- mieqFini();
+ mieqFini();
}
/*
@@ -117,15 +117,15 @@ CloseInput(void)
void
AbortDDX(enum ExitCode error)
{
- xnestDoFullGeneration = True;
- xnestCloseDisplay();
+ xnestDoFullGeneration = True;
+ xnestCloseDisplay();
}
/* Called by GiveUp(). */
void
ddxGiveUp(enum ExitCode error)
{
- AbortDDX(error);
+ AbortDDX(error);
}
#ifdef __APPLE__
@@ -147,10 +147,9 @@ OsVendorFatalError(void)
return;
}
-#if defined(DDXBEFORERESET)
+#ifdef DDXMAIN
void
-ddxBeforeReset(void)
+ddxMain(void)
{
- return;
}
#endif
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index a7cc012d9..57928005c 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -28,7 +28,6 @@ libXquartz_la_SOURCES = \
darwinEvents.c \
darwinXinput.c \
keysym2ucs.c \
- pseudoramiX.c \
quartz.c \
quartzCocoa.m \
quartzKeyboard.c \
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 4d0df110f..2fe01b1c6 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -35,12 +35,10 @@ from The Open Group.
#include "winmsg.h"
#include "winconfig.h"
#include "winprefs.h"
-#ifdef XWIN_CLIPBOARD
-#include "X11/Xlocale.h"
-#endif
#ifdef DPMSExtension
#include "dpmsproc.h"
#endif
+#include <locale.h>
#ifdef __CYGWIN__
#include <mntent.h>
#endif
@@ -50,53 +48,58 @@ from The Open Group.
#ifdef RELOCATE_PROJECTROOT
#include <shlobj.h>
typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner,
- int nFolder,
- HANDLE hToken,
+ int nFolder,
+ HANDLE hToken,
DWORD dwFlags, LPTSTR pszPath);
#endif
+#include "ddxhooks.h"
+#include "winmonitors.h"
+#include "pseudoramiX/pseudoramiX.h"
/*
* References to external symbols
*/
#ifdef XWIN_CLIPBOARD
-extern Bool g_fUnicodeClipboard;
-extern Bool g_fClipboardLaunched;
-extern Bool g_fClipboardStarted;
-extern pthread_t g_ptClipboardProc;
-extern HWND g_hwndClipboard;
-extern Bool g_fClipboard;
+extern Bool g_fUnicodeClipboard;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardStarted;
+extern pthread_t g_ptClipboardProc;
+extern HWND g_hwndClipboard;
+extern Bool g_fClipboard;
#endif
+extern Bool noRRXineramaExtension;
+
/*
* Function prototypes
*/
#ifdef XWIN_CLIPBOARD
static void
- winClipboardShutdown(void);
+winClipboardShutdown (void);
#endif
#if defined(DDXOSVERRORF)
void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
+OsVendorVErrorF (const char *pszFormat, va_list va_args);
#endif
-static Bool
- winCheckDisplayNumber(void);
void
- winLogCommandLine(int argc, char *argv[]);
+winLogCommandLine (int argc, char *argv[]);
void
- winLogVersionInfo(void);
+winLogVersionInfo (void);
Bool
- winValidateArgs(void);
+winValidateArgs (void);
#ifdef RELOCATE_PROJECTROOT
const char *winGetBaseDir(void);
#endif
+static void winCheckMount(void);
+
/*
* For the depth 24 pixmap we default to 32 bits per pixel, but
* we change this pixmap format later if we detect that the display
@@ -111,38 +114,38 @@ const char *winGetBaseDir(void);
*/
static PixmapFormatRec g_PixmapFormats[] = {
- {1, 1, BITMAP_SCANLINE_PAD},
- {4, 8, BITMAP_SCANLINE_PAD},
- {8, 8, BITMAP_SCANLINE_PAD},
- {15, 16, BITMAP_SCANLINE_PAD},
- {16, 16, BITMAP_SCANLINE_PAD},
- {24, 32, BITMAP_SCANLINE_PAD},
- {32, 32, BITMAP_SCANLINE_PAD}
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+ { 32, 32, BITMAP_SCANLINE_PAD }
};
-const int NUMFORMATS = sizeof(g_PixmapFormats) / sizeof(g_PixmapFormats[0]);
+const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]);
#ifdef XWIN_CLIPBOARD
static void
-winClipboardShutdown(void)
+winClipboardShutdown (void)
{
- /* Close down clipboard resources */
+ /* Close down clipboard resources */
if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted) {
- /* Synchronously destroy the clipboard window */
+ /* Synchronously destroy the clipboard window */
if (g_hwndClipboard != NULL) {
- SendMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
- /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */
- }
- else
- return;
-
- /* Wait for the clipboard thread to exit */
- pthread_join(g_ptClipboardProc, NULL);
-
- g_fClipboardLaunched = FALSE;
- g_fClipboardStarted = FALSE;
-
- winDebug("winClipboardShutdown - Clipboard thread has exited.\n");
+ SendMessage (g_hwndClipboard, WM_DESTROY, 0, 0);
+ /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */
+ }
+ else
+ return;
+
+ /* Wait for the clipboard thread to exit */
+ pthread_join (g_ptClipboardProc, NULL);
+
+ g_fClipboardLaunched = FALSE;
+ g_fClipboardStarted = FALSE;
+
+ winDebug ("winClipboardShutdown - Clipboard thread has exited.\n");
}
}
#endif
@@ -152,96 +155,136 @@ ddxPushProviders(void)
{
#ifdef XWIN_GLX_WINDOWS
if (g_fNativeGl) {
- /* install the native GL provider */
- glxWinPushNativeProvider();
+ /* install the native GL provider */
+ glxWinPushNativeProvider();
}
#endif
}
-#if defined(DDXBEFORERESET)
/*
* Called right before KillAllClients when the server is going to reset,
* allows us to shutdown our seperate threads cleanly.
*/
-void
-ddxBeforeReset(void)
+static void
+ddxBeforeReset (void)
{
- winDebug("ddxBeforeReset - Hello\n");
+ winDebug ("ddxBeforeReset - Hello\n");
#ifdef XWIN_CLIPBOARD
- winClipboardShutdown();
+ winClipboardShutdown ();
#endif
}
-#endif
+
+void
+ddxMain(void)
+{
+ int iReturn;
+
+ /* Initialize DDX-specific hooks */
+ ddxHooks.ddxBeforeReset = ddxBeforeReset;
+ ddxHooks.ddxPushProviders = ddxPushProviders;
+
+ /* Create & acquire the termination mutex */
+ iReturn = pthread_mutex_init (&g_pmTerminating, NULL);
+ if (iReturn != 0)
+ {
+ ErrorF ("ddxMain - pthread_mutex_init () failed: %d\n", iReturn);
+ }
+
+ iReturn = pthread_mutex_lock (&g_pmTerminating);
+ if (iReturn != 0)
+ {
+ ErrorF ("ddxMain - pthread_mutex_lock () failed: %d\n", iReturn);
+ }
+
+ winCheckMount();
+}
/* See Porting Layer Definition - p. 57 */
void
-ddxGiveUp(enum ExitCode error)
+ddxGiveUp (enum ExitCode error)
{
- int i;
+ int i;
#if CYGDEBUG
- winDebug("ddxGiveUp\n");
+ winDebug ("ddxGiveUp\n");
#endif
- /* Perform per-screen deinitialization */
+ /* Perform per-screen deinitialization */
for (i = 0; i < g_iNumScreens; ++i) {
- /* Delete the tray icon */
- if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen)
- winDeleteNotifyIcon(winGetScreenPriv(g_ScreenInfo[i].pScreen));
+ /* Delete the tray icon */
+ if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen)
+ winDeleteNotifyIcon (winGetScreenPriv (g_ScreenInfo[i].pScreen));
}
#ifdef XWIN_MULTIWINDOW
- /* Notify the worker threads we're exiting */
- winDeinitMultiWindowWM();
+ /* Unload libraries for taskbar grouping */
+ winTaskbarDestroy ();
+
+ /* Notify the worker threads we're exiting */
+ winDeinitMultiWindowWM ();
#endif
#ifdef HAS_DEVWINDOWS
- /* Close our handle to our message queue */
+ /* Close our handle to our message queue */
if (g_fdMessageQueue != WIN_FD_INVALID) {
- /* Close /dev/windows */
- close(g_fdMessageQueue);
+ /* Close /dev/windows */
+ close (g_fdMessageQueue);
- /* Set the file handle to invalid */
- g_fdMessageQueue = WIN_FD_INVALID;
+ /* Set the file handle to invalid */
+ g_fdMessageQueue = WIN_FD_INVALID;
}
#endif
- if (!g_fLogInited) {
- g_pszLogFile = LogInit(g_pszLogFile, NULL);
- g_fLogInited = TRUE;
- }
- LogClose(error);
-
- /*
- * At this point we aren't creating any new screens, so
- * we are guaranteed to not need the DirectDraw functions.
- */
- winReleaseDDProcAddresses();
-
- /* Free concatenated command line */
- free(g_pszCommandLine);
- g_pszCommandLine = NULL;
-
- /* Remove our keyboard hook if it is installed */
- winRemoveKeyboardHookLL();
-
- /* Tell Windows that we want to end the app */
- PostQuitMessage(0);
+ if (!g_fLogInited) {
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose (error);
+
+ /*
+ * At this point we aren't creating any new screens, so
+ * we are guaranteed to not need the DirectDraw functions.
+ */
+ winReleaseDDProcAddresses();
+
+ /* Free concatenated command line */
+ free(g_pszCommandLine);
+ g_pszCommandLine = NULL;
+
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL ();
+
+ /* Tell Windows that we want to end the app */
+ PostQuitMessage (0);
+
+ {
+ winDebug ("ddxGiveUp - Releasing termination mutex\n");
+
+ int iReturn = pthread_mutex_unlock (&g_pmTerminating);
+ if (iReturn != 0)
+ {
+ ErrorF ("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n", iReturn);
+ }
+ }
+
+ winDebug ("ddxGiveUp - End\n");
}
/* See Porting Layer Definition - p. 57 */
void
-AbortDDX(enum ExitCode error)
+AbortDDX (enum ExitCode error)
{
#if CYGDEBUG
- winDebug("AbortDDX\n");
+ winDebug ("AbortDDX\n");
#endif
- ddxGiveUp(error);
+ ddxGiveUp (error);
}
#ifdef __CYGWIN__
+extern Bool nolock;
+
/* hasmntopt is currently not implemented for cygwin */
static const char *
winCheckMntOpt(const struct mntent *mnt, const char *opt)
@@ -262,66 +305,81 @@ winCheckMntOpt(const struct mntent *mnt, const char *opt)
return NULL;
if ((s == mnt->mnt_opts || *(s - 1) == ',') &&
(s[len] == 0 || s[len] == ','))
- return (char *) opt;
+ return (char *)opt;
return NULL;
}
+/*
+ Check mounts and issue warnings/activate workarounds as needed
+ */
static void
winCheckMount(void)
{
- FILE *mnt;
- struct mntent *ent;
+ FILE *mnt;
+ struct mntent *ent;
- enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
- level = none, curlevel;
- BOOL binary = TRUE;
+ enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
+ level = none, curlevel;
+ BOOL binary = TRUE;
+ BOOL fat = TRUE;
- mnt = setmntent("/etc/mtab", "r");
+ mnt = setmntent("/etc/mtab", "r");
if (mnt == NULL) {
- ErrorF("setmntent failed");
- return;
- }
+ ErrorF("setmntent failed");
+ return;
+ }
while ((ent = getmntent(mnt)) != NULL) {
- BOOL system = (winCheckMntOpt(ent, "user") != NULL);
- BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
- BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
-
+ BOOL system = (winCheckMntOpt(ent, "user") != NULL);
+ BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
+ BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
+
if (system) {
- if (root)
- curlevel = sys_root;
- else if (tmp)
- curlevel = sys_tmp;
- else
- continue;
- }
+ if (root)
+ curlevel = sys_root;
+ else if (tmp)
+ curlevel = sys_tmp;
+ else
+ continue;
+ }
else {
- if (root)
- curlevel = user_root;
- else if (tmp)
- curlevel = user_tmp;
- else
- continue;
- }
+ if (root)
+ curlevel = user_root;
+ else if (tmp)
+ curlevel = user_tmp;
+ else
+ continue;
+ }
- if (curlevel <= level)
- continue;
- level = curlevel;
+ if (curlevel <= level)
+ continue;
+ level = curlevel;
- if ((winCheckMntOpt(ent, "binary") == NULL) &&
- (winCheckMntOpt(ent, "binmode") == NULL))
- binary = FALSE;
- else
- binary = TRUE;
- }
+ if ((winCheckMntOpt(ent, "binary") == NULL) &&
+ (winCheckMntOpt(ent, "binmode") == NULL))
+ binary = FALSE;
+ else
+ binary = TRUE;
- if (endmntent(mnt) != 1) {
- ErrorF("endmntent failed");
- return;
- }
+ if (strcmp(ent->mnt_type, "vfat") == 0)
+ fat = TRUE;
+ else
+ fat = FALSE;
+ }
- if (!binary)
- winMsg(X_WARNING, "/tmp mounted in textmode\n");
+ if (endmntent(mnt) != 1) {
+ ErrorF("endmntent failed");
+ return;
+ }
+
+ if (!binary)
+ winMsg(X_WARNING, "/tmp mounted in textmode\n");
+
+ if (fat)
+ {
+ winMsg(X_WARNING, "/tmp mounted on FAT filesystem, activating -nolock\n");
+ nolock = TRUE;
+ }
}
#else
static void
@@ -331,7 +389,7 @@ winCheckMount(void)
#endif
#ifdef RELOCATE_PROJECTROOT
-const char *
+const char *
winGetBaseDir(void)
{
static BOOL inited = FALSE;
@@ -343,8 +401,8 @@ winGetBaseDir(void)
DWORD size = GetModuleFileName(module, buffer, sizeof(buffer));
if (sizeof(buffer) > 0)
- buffer[sizeof(buffer) - 1] = 0;
-
+ buffer[sizeof(buffer)-1] = 0;
+
fendptr = buffer + size;
while (fendptr > buffer) {
if (*fendptr == '\\' || *fendptr == '/') {
@@ -360,7 +418,7 @@ winGetBaseDir(void)
#endif
static void
-winFixupPaths(void)
+winFixupPaths (void)
{
BOOL changed_fontpath = FALSE;
MessageType font_from = X_DEFAULT;
@@ -377,7 +435,7 @@ winFixupPaths(void)
if (fontdirs != NULL) {
char buffer[256];
- int needs_sep = TRUE;
+ int needs_sep = TRUE;
int comment_block = FALSE;
/* get default fontpath */
@@ -393,7 +451,7 @@ winFixupPaths(void)
/* read one line */
str = fgets(buffer, sizeof(buffer), fontdirs);
- if (str == NULL) /* stop on error or eof */
+ if (str == NULL) /* stop on error or eof */
break;
if (strchr(str, '\n') != NULL)
@@ -402,9 +460,9 @@ winFixupPaths(void)
/* check if block is continued comment */
if (comment_block) {
/* ignore all input */
- *str = 0;
- blen = 0;
- if (has_eol) /* check if line ended in this block */
+ *str = 0;
+ blen = 0;
+ if (has_eol) /* check if line ended in this block */
comment_block = FALSE;
}
else {
@@ -412,7 +470,7 @@ winFixupPaths(void)
hashchar = strchr(str, '#');
if (hashchar != NULL) {
*hashchar = 0;
- if (!has_eol) /* mark next block as continued comment */
+ if (!has_eol) /* mark next block as continued comment */
comment_block = TRUE;
}
}
@@ -421,15 +479,15 @@ winFixupPaths(void)
while (*str == ' ' || *str == '\t')
str++;
- /* get size, strip whitespaces from end */
+ /* get size, strip whitespaces from end */
blen = strlen(str);
- while (blen > 0 && (str[blen - 1] == ' ' ||
+ while (blen > 0 && (str[blen-1] == ' ' ||
str[blen - 1] == '\t' ||
str[blen - 1] == '\n')) {
str[--blen] = 0;
}
- /* still something left to add? */
+ /* still something left to add? */
if (blen > 0) {
size_t newsize = size + blen;
@@ -439,9 +497,9 @@ winFixupPaths(void)
/* allocate memory */
if (fontpath == NULL)
- fontpath = malloc(newsize + 1);
+ fontpath = malloc(newsize+1);
else
- fontpath = realloc(fontpath, newsize + 1);
+ fontpath = realloc(fontpath, newsize+1);
/* add separator */
if (needs_sep) {
@@ -462,14 +520,14 @@ winFixupPaths(void)
}
/* cleanup */
- fclose(fontdirs);
+ fclose(fontdirs);
defaultFontPath = strdup(fontpath);
free(fontpath);
changed_fontpath = TRUE;
font_from = X_CONFIG;
}
}
-#endif /* READ_FONTDIRS */
+#endif /* READ_FONTDIRS */
#ifdef RELOCATE_PROJECTROOT
{
const char *libx11dir = PROJECTROOT "/lib/X11";
@@ -494,7 +552,7 @@ winFixupPaths(void)
char *compose;
newsize = newsize - libx11dir_len + basedirlen;
- compose = malloc(newsize + 1);
+ compose = malloc(newsize + 1);
strcpy(compose, basedir);
strncat(compose, newpath + libx11dir_len, newsize - basedirlen);
compose[newsize] = 0;
@@ -504,7 +562,7 @@ winFixupPaths(void)
oldfp_len = newfp_len;
if (oldfp_len > 0)
- newfp_len++; /* space for separator */
+ newfp_len ++; /* space for separator */
newfp_len += newsize;
if (newfp == NULL)
@@ -530,36 +588,36 @@ winFixupPaths(void)
if (ptr == NULL)
ptr = endptr;
}
- }
+ }
defaultFontPath = strdup(newfp);
free(newfp);
changed_fontpath = TRUE;
}
-#endif /* RELOCATE_PROJECTROOT */
+#endif /* RELOCATE_PROJECTROOT */
if (changed_fontpath)
- winMsg(font_from, "FontPath set to \"%s\"\n", defaultFontPath);
+ winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath);
#ifdef RELOCATE_PROJECTROOT
if (getenv("XKEYSYMDB") == NULL) {
char buffer[MAX_PATH];
snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB", basedir);
- buffer[sizeof(buffer) - 1] = 0;
+ buffer[sizeof(buffer)-1] = 0;
putenv(buffer);
}
if (getenv("XERRORDB") == NULL) {
char buffer[MAX_PATH];
snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB", basedir);
- buffer[sizeof(buffer) - 1] = 0;
+ buffer[sizeof(buffer)-1] = 0;
putenv(buffer);
}
if (getenv("XLOCALEDIR") == NULL) {
char buffer[MAX_PATH];
snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale", basedir);
- buffer[sizeof(buffer) - 1] = 0;
+ buffer[sizeof(buffer)-1] = 0;
putenv(buffer);
}
if (getenv("HOME") == NULL) {
@@ -574,7 +632,7 @@ winFixupPaths(void)
putenv(buffer);
}
else {
- winMsg(X_ERROR, "Can not determine HOME directory\n");
+ winMsg (X_ERROR, "Can not determine HOME directory\n");
}
}
if (!g_fLogFileChanged) {
@@ -582,11 +640,11 @@ winFixupPaths(void)
DWORD size = GetTempPath(sizeof(buffer), buffer);
if (size && size < sizeof(buffer)) {
- snprintf(buffer + size, sizeof(buffer) - size,
- "XWin.%s.log", display);
- buffer[sizeof(buffer) - 1] = 0;
+ snprintf(buffer + size, sizeof(buffer) - size,
+ "XWin.%s.log", display);
+ buffer[sizeof(buffer)-1] = 0;
g_pszLogFile = buffer;
- winMsg(X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
+ winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
}
}
{
@@ -594,106 +652,106 @@ winFixupPaths(void)
snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir);
if (sizeof(xkbbasedir) > 0)
- xkbbasedir[sizeof(xkbbasedir) - 1] = 0;
+ xkbbasedir[sizeof(xkbbasedir)-1] = 0;
XkbBaseDirectory = xkbbasedir;
- XkbBinDirectory = basedir;
+ XkbBinDirectory = basedir;
}
-#endif /* RELOCATE_PROJECTROOT */
+#endif /* RELOCATE_PROJECTROOT */
}
void
-OsVendorInit(void)
+OsVendorInit (void)
{
- /* Re-initialize global variables on server reset */
- winInitializeGlobals();
+ /* Re-initialize global variables on server reset */
+ winInitializeGlobals ();
- winFixupPaths();
+ winFixupPaths();
#ifdef DDXOSVERRORF
- if (!OsVendorVErrorFProc)
- OsVendorVErrorFProc = OsVendorVErrorF;
+ if (!OsVendorVErrorFProc)
+ OsVendorVErrorFProc = OsVendorVErrorF;
#endif
- if (!g_fLogInited) {
- /* keep this order. If LogInit fails it calls Abort which then calls
- * ddxGiveUp where LogInit is called again and creates an infinite
- * recursion. If we set g_fLogInited to TRUE before the init we
- * avoid the second call
- */
- g_fLogInited = TRUE;
- g_pszLogFile = LogInit(g_pszLogFile, NULL);
- }
- LogSetParameter(XLOG_FLUSH, 1);
- LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose);
- LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose);
-
- /* Log the version information */
- if (serverGeneration == 1)
- winLogVersionInfo();
-
- winCheckMount();
-
- /* Add a default screen if no screens were specified */
+ if (!g_fLogInited) {
+ /* keep this order. If LogInit fails it calls Abort which then calls
+ * ddxGiveUp where LogInit is called again and creates an infinite
+ * recursion. If we set g_fLogInited to TRUE before the init we
+ * avoid the second call
+ */
+ g_fLogInited = TRUE;
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
+ }
+ LogSetParameter (XLOG_FLUSH, 1);
+ LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
+ LogSetParameter (XLOG_FILE_VERBOSITY, g_iLogVerbose);
+
+ /* Log the version information */
+ if (serverGeneration == 1)
+ winLogVersionInfo ();
+
+ winCheckMount();
+
+ /* Add a default screen if no screens were specified */
if (g_iNumScreens == 0) {
- winDebug("OsVendorInit - Creating default screen 0\n");
-
- /*
- * We need to initialize the default screen 0 if no -screen
- * arguments were processed.
- *
- * Add a screen 0 using the defaults set by winInitializeDefaultScreens()
- * and any additional default screen parameters given
- */
- winInitializeScreens(1);
-
- /* We have to flag this as an explicit screen, even though it isn't */
- g_ScreenInfo[0].fExplicitScreen = TRUE;
+ winDebug ("OsVendorInit - Creating default screen 0\n");
+
+ /*
+ * We need to initialize the default screen 0 if no -screen
+ * arguments were processed.
+ *
+ * Add a screen 0 using the defaults set by winInitializeDefaultScreens()
+ * and any additional default screen parameters given
+ */
+ winInitializeScreens(1);
+
+ /* We have to flag this as an explicit screen, even though it isn't */
+ g_ScreenInfo[0].fExplicitScreen = TRUE;
}
- /* Work out what the default emulate3buttons setting should be, and apply
- it if nothing was explicitly specified */
- {
- int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
- int j;
+ /* Work out what the default emulate3buttons setting should be, and apply
+ it if nothing was explicitly specified */
+ {
+ int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ int j;
for (j = 0; j < g_iNumScreens; j++) {
if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT) {
if (mouseButtons < 3) {
- static Bool reportOnce = TRUE;
+ static Bool reportOnce = TRUE;
- g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+ g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME;
if (reportOnce) {
- reportOnce = FALSE;
+ reportOnce = FALSE;
winMsg(X_PROBED,
"Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n",
mouseButtons);
- }
- }
+ }
+ }
else {
- g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF;
- }
- }
- }
- }
+ g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF;
+ }
+ }
+ }
+ }
}
static void
-winUseMsg(void)
+winUseMsg (void)
{
- ErrorF("\n");
- ErrorF("\n");
- ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n");
- ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n");
+ ErrorF("\n");
#ifdef XWIN_CLIPBOARD
- ErrorF("-[no]clipboard\n"
- "\tEnable [disable] the clipboard integration. Default is enabled.\n");
+ ErrorF ("-[no]clipboard\n"
+ "\tEnable [disable] the clipboard integration. Default is enabled.\n");
#endif
- ErrorF("-clipupdates num_boxes\n"
- "\tUse a clipping region to constrain shadow update blits to\n"
- "\tthe updated region when num_boxes, or more, are in the\n"
- "\tupdated region.\n");
+ ErrorF ("-clipupdates num_boxes\n"
+ "\tUse a clipping region to constrain shadow update blits to\n"
+ "\tthe updated region when num_boxes, or more, are in the\n"
+ "\tupdated region.\n");
#ifdef XWIN_XF86CONFIG
ErrorF("-config\n" "\tSpecify a configuration file.\n");
@@ -701,176 +759,181 @@ winUseMsg(void)
ErrorF("-configdir\n" "\tSpecify a configuration directory.\n");
#endif
- ErrorF("-depth bits_per_pixel\n"
- "\tSpecify an optional bitdepth to use in fullscreen mode\n"
- "\twith a DirectDraw engine.\n");
+ ErrorF ("-depth bits_per_pixel\n"
+ "\tSpecify an optional bitdepth to use in fullscreen mode\n"
+ "\twith a DirectDraw engine.\n");
- ErrorF("-[no]emulate3buttons [timeout]\n"
- "\tEmulate 3 button mouse with an optional timeout in\n"
- "\tmilliseconds.\n");
+ ErrorF ("-[no]emulate3buttons [timeout]\n"
+ "\tEmulate 3 button mouse with an optional timeout in\n"
+ "\tmilliseconds.\n");
#ifdef XWIN_EMULATEPSEUDO
- ErrorF("-emulatepseudo\n"
- "\tCreate a depth 8 PseudoColor visual when running in\n"
- "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
- "\tdepths. The PseudoColor visual does not have correct colors,\n"
- "\tand it may crash, but it at least allows you to run your\n"
- "\tapplication in TrueColor modes.\n");
+ ErrorF ("-emulatepseudo\n"
+ "\tCreate a depth 8 PseudoColor visual when running in\n"
+ "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
+ "\tdepths. The PseudoColor visual does not have correct colors,\n"
+ "\tand it may crash, but it at least allows you to run your\n"
+ "\tapplication in TrueColor modes.\n");
#endif
- ErrorF("-engine engine_type_id\n"
- "\tOverride the server's automatically selected engine type:\n"
- "\t\t1 - Shadow GDI\n"
- "\t\t2 - Shadow DirectDraw\n"
- "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
+ ErrorF ("-engine engine_type_id\n"
+ "\tOverride the server's automatically selected engine type:\n"
+ "\t\t1 - Shadow GDI\n"
+ "\t\t2 - Shadow DirectDraw\n"
+ "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
#ifdef XWIN_PRIMARYFB
- "\t\t8 - Primary DirectDraw - obsolete\n"
+ "\t\t8 - Primary DirectDraw - obsolete\n"
#endif
#ifdef XWIN_NATIVEGDI
- "\t\t16 - Native GDI - experimental\n"
+ "\t\t16 - Native GDI - experimental\n"
#endif
- );
+ );
ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
- ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n");
+ ErrorF ("-hostintitle\n"
+ "\tIn multiwindow mode, add remote host names to window titles.\n");
+
+ ErrorF ("-ignoreinput\n"
+ "\tIgnore keyboard and mouse input.\n");
#ifdef XWIN_MULTIWINDOWEXTWM
ErrorF("-internalwm\n" "\tRun the internal window manager.\n");
#endif
#ifdef XWIN_XF86CONFIG
- ErrorF("-keyboard\n"
- "\tSpecify a keyboard device from the configuration file.\n");
+ ErrorF ("-keyboard\n"
+ "\tSpecify a keyboard device from the configuration file.\n");
#endif
- ErrorF("-[no]keyhook\n"
- "\tGrab special Windows keypresses like Alt-Tab or the Menu "
- "key.\n");
+ ErrorF ("-[no]keyhook\n"
+ "\tGrab special Windows keypresses like Alt-Tab or the Menu "
+ "key.\n");
- ErrorF("-lesspointer\n"
- "\tHide the windows mouse pointer when it is over any\n"
+ ErrorF ("-lesspointer\n"
+ "\tHide the windows mouse pointer when it is over any\n"
"\t" EXECUTABLE_NAME
" window. This prevents ghost cursors appearing when\n"
- "\tthe Windows cursor is drawn on top of the X cursor\n");
+ "\tthe Windows cursor is drawn on top of the X cursor\n");
ErrorF("-logfile filename\n" "\tWrite log messages to <filename>.\n");
- ErrorF("-logverbose verbosity\n"
- "\tSet the verbosity of log messages. [NOTE: Only a few messages\n"
- "\trespect the settings yet]\n"
- "\t\t0 - only print fatal error.\n"
- "\t\t1 - print additional configuration information.\n"
- "\t\t2 - print additional runtime information [default].\n"
- "\t\t3 - print debugging and tracing information.\n");
+ ErrorF ("-logverbose verbosity\n"
+ "\tSet the verbosity of log messages. [NOTE: Only a few messages\n"
+ "\trespect the settings yet]\n"
+ "\t\t0 - only print fatal error.\n"
+ "\t\t1 - print additional configuration information.\n"
+ "\t\t2 - print additional runtime information [default].\n"
+ "\t\t3 - print debugging and tracing information.\n");
- ErrorF("-[no]multimonitors or -[no]multiplemonitors\n"
- "\tUse the entire virtual screen if multiple\n"
- "\tmonitors are present.\n");
+ ErrorF ("-[no]multimonitors or -[no]multiplemonitors\n"
+ "\tUse the entire virtual screen if multiple\n"
+ "\tmonitors are present.\n");
#ifdef XWIN_MULTIWINDOW
ErrorF("-multiwindow\n" "\tRun the server in multi-window mode.\n");
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- ErrorF("-mwextwm\n"
- "\tRun the server in multi-window external window manager mode.\n");
+ ErrorF ("-mwextwm\n"
+ "\tRun the server in multi-window external window manager mode.\n");
#endif
- ErrorF("-nodecoration\n"
- "\tDo not draw a window border, title bar, etc. Windowed\n"
- "\tmode only.\n");
+ ErrorF ("-nodecoration\n"
+ "\tDo not draw a window border, title bar, etc. Windowed\n"
+ "\tmode only.\n");
#ifdef XWIN_CLIPBOARD
- ErrorF("-nounicodeclipboard\n"
- "\tDo not use Unicode clipboard even if on a NT-based platform.\n");
+ ErrorF ("-nounicodeclipboard\n"
+ "\tDo not use Unicode clipboard even if on a NT-based platform.\n");
#endif
- ErrorF("-refresh rate_in_Hz\n"
- "\tSpecify an optional refresh rate to use in fullscreen mode\n"
- "\twith a DirectDraw engine.\n");
+ ErrorF ("-refresh rate_in_Hz\n"
+ "\tSpecify an optional refresh rate to use in fullscreen mode\n"
+ "\twith a DirectDraw engine.\n");
- ErrorF("-resize=none|scrollbars|randr"
- "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
- "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
- "\textension to resize the X screen.\n");
+ ErrorF ("-resize=none|scrollbars|randr"
+ "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
+ "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
+ "\textension to resize the X screen. 'randr' is the default.\n");
ErrorF("-rootless\n" "\tRun the server in rootless mode.\n");
- ErrorF("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
- "\tEnable screen scr_num and optionally specify a width and\n"
- "\theight and initial position for that screen. Additionally\n"
- "\ta monitor number can be specified to start the server on,\n"
- "\tat which point, all coordinates become relative to that\n"
- "\tmonitor. Examples:\n"
- "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
- "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
- "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
-
- ErrorF("-silent-dup-error\n"
+ ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
+ "\tEnable screen scr_num and optionally specify a width and\n"
+ "\theight and initial position for that screen. Additionally\n"
+ "\ta monitor number can be specified to start the server on,\n"
+ "\tat which point, all coordinates become relative to that\n"
+ "\tmonitor. Examples:\n"
+ "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
+ "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
+ "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
+
+ ErrorF ("-silent-dup-error\n"
"\tIf another instance of " EXECUTABLE_NAME
" with the same display number is running\n"
- "\texit silently and don't display any error message.\n");
+ "\texit silently and don't display any error message.\n");
- ErrorF("-swcursor\n"
- "\tDisable the usage of the Windows cursor and use the X11 software\n"
- "\tcursor instead.\n");
+ ErrorF ("-swcursor\n"
+ "\tDisable the usage of the Windows cursor and use the X11 software\n"
+ "\tcursor instead.\n");
- ErrorF("-[no]trayicon\n"
- "\tDo not create a tray icon. Default is to create one\n"
- "\ticon per screen. You can globally disable tray icons with\n"
- "\t-notrayicon, then enable it for specific screens with\n"
- "\t-trayicon for those screens.\n");
+ ErrorF ("-[no]trayicon\n"
+ "\tDo not create a tray icon. Default is to create one\n"
+ "\ticon per screen. You can globally disable tray icons with\n"
+ "\t-notrayicon, then enable it for specific screens with\n"
+ "\t-trayicon for those screens.\n");
ErrorF("-[no]unixkill\n" "\tCtrl+Alt+Backspace exits the X Server.\n");
#ifdef XWIN_GLX_WINDOWS
- ErrorF("-[no]wgl\n"
- "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n");
+ ErrorF ("-[no]wgl\n"
+ "\tEnable the GLX extension to use the native Windows WGL interface\n"
+ "\tfor hardware-accelerated OpenGL (AIGLX). Enabled by default.\n");
#endif
ErrorF("-[no]winkill\n" "\tAlt+F4 exits the X Server.\n");
- ErrorF("-xkblayout XKBLayout\n"
- "\tEquivalent to XKBLayout in XF86Config files.\n"
- "\tFor example: -xkblayout de\n");
+ ErrorF ("-xkblayout XKBLayout\n"
+ "\tEquivalent to XKBLayout in XF86Config files.\n"
+ "\tFor example: -xkblayout de\n");
- ErrorF("-xkbmodel XKBModel\n"
- "\tEquivalent to XKBModel in XF86Config files.\n");
+ ErrorF ("-xkbmodel XKBModel\n"
+ "\tEquivalent to XKBModel in XF86Config files.\n");
- ErrorF("-xkboptions XKBOptions\n"
- "\tEquivalent to XKBOptions in XF86Config files.\n");
+ ErrorF ("-xkboptions XKBOptions\n"
+ "\tEquivalent to XKBOptions in XF86Config files.\n");
- ErrorF("-xkbrules XKBRules\n"
- "\tEquivalent to XKBRules in XF86Config files.\n");
+ ErrorF ("-xkbrules XKBRules\n"
+ "\tEquivalent to XKBRules in XF86Config files.\n");
- ErrorF("-xkbvariant XKBVariant\n"
- "\tEquivalent to XKBVariant in XF86Config files.\n"
- "\tFor example: -xkbvariant nodeadkeys\n");
+ ErrorF ("-xkbvariant XKBVariant\n"
+ "\tEquivalent to XKBVariant in XF86Config files.\n"
+ "\tFor example: -xkbvariant nodeadkeys\n");
}
/* See Porting Layer Definition - p. 57 */
void
ddxUseMsg(void)
{
- /* Set a flag so that FatalError won't give duplicate warning message */
- g_fSilentFatalError = TRUE;
-
- winUseMsg();
-
- /* Log file will not be opened for UseMsg unless we open it now */
- if (!g_fLogInited) {
- g_pszLogFile = LogInit(g_pszLogFile, NULL);
- g_fLogInited = TRUE;
- }
- LogClose(EXIT_NO_ERROR);
-
- /* Notify user where UseMsg text can be found. */
- if (!g_fNoHelpMessageBox)
- winMessageBoxF("The " PROJECT_NAME " help text has been printed to "
- "%s.\n"
- "Please open %s to read the help text.\n",
- MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
+ /* Set a flag so that FatalError won't give duplicate warning message */
+ g_fSilentFatalError = TRUE;
+
+ winUseMsg();
+
+ /* Log file will not be opened for UseMsg unless we open it now */
+ if (!g_fLogInited) {
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose (EXIT_NO_ERROR);
+
+ /* Notify user where UseMsg text can be found.*/
+ if (!g_fNoHelpMessageBox)
+ winMessageBoxF ("The " PROJECT_NAME " help text has been printed to "
+ "%s.\n"
+ "Please open %s to read the help text.\n",
+ MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
}
/* See Porting Layer Definition - p. 20 */
@@ -881,158 +944,164 @@ ddxUseMsg(void)
*/
void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
{
- int i;
+ int i;
- /* Log the command line */
- winLogCommandLine(argc, argv);
+ /* Log the command line */
+ winLogCommandLine (argc, argv);
#if CYGDEBUG
- winDebug("InitOutput\n");
+ winDebug ("InitOutput\n");
#endif
- /* Validate command-line arguments */
+ /* Validate command-line arguments */
if (serverGeneration == 1 && !winValidateArgs()) {
- FatalError("InitOutput - Invalid command-line arguments found. "
- "Exiting.\n");
- }
-
- /* Check for duplicate invocation on same display number. */
- if (serverGeneration == 1 && !winCheckDisplayNumber()) {
- if (g_fSilentDupError)
- g_fSilentFatalError = TRUE;
- FatalError("InitOutput - Duplicate invocation on display "
- "number: %s. Exiting.\n", display);
+ FatalError ("InitOutput - Invalid command-line arguments found. "
+ "Exiting.\n");
}
#ifdef XWIN_XF86CONFIG
- /* Try to read the xorg.conf-style configuration file */
- if (!winReadConfigfile())
- winErrorFVerb(1, "InitOutput - Error reading config file\n");
+ /* Try to read the xorg.conf-style configuration file */
+ if (!winReadConfigfile ())
+ winErrorFVerb (1, "InitOutput - Error reading config file\n");
#else
- winMsg(X_INFO, "xorg.conf is not supported\n");
- winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html "
- "for more information\n");
- winConfigFiles();
+ winMsg(X_INFO, "xorg.conf is not supported\n");
+ winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html "
+ "for more information\n");
+ winConfigFiles ();
#endif
- /* Load preferences from XWinrc file */
- LoadPreferences();
-
- /* Setup global screen info parameters */
- screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
- screenInfo->numPixmapFormats = NUMFORMATS;
-
- /* Describe how we want common pixmap formats padded */
+ /* Load preferences from XWinrc file */
+ LoadPreferences();
+
+ /* Setup global screen info parameters */
+ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screenInfo->numPixmapFormats = NUMFORMATS;
+
+ /* Describe how we want common pixmap formats padded */
for (i = 0; i < NUMFORMATS; i++) {
- screenInfo->formats[i] = g_PixmapFormats[i];
+ screenInfo->formats[i] = g_PixmapFormats[i];
}
- /* Load pointers to DirectDraw functions */
- winGetDDProcAddresses();
+ /* Load pointers to DirectDraw functions */
+ winGetDDProcAddresses ();
+
+ /* Detect supported engines */
+ winDetectSupportedEngines ();
+
+#ifdef XWIN_MULTIWINDOW
+ /* Load libraries for taskbar grouping */
+ winTaskbarInit ();
+#endif
- /* Detect supported engines */
- winDetectSupportedEngines();
+ /* Store the instance handle */
+ g_hInstance = GetModuleHandle (NULL);
- /* Store the instance handle */
- g_hInstance = GetModuleHandle(NULL);
+ /* Create the messaging window */
+ if (serverGeneration == 1)
+ winCreateMsgWindowThread();
- /* Initialize each screen */
+ /* Initialize each screen */
for (i = 0; i < g_iNumScreens; ++i) {
- /* Initialize the screen */
+ /* Initialize the screen */
if (-1 == AddScreen(winScreenInit, argc, argv)) {
- FatalError("InitOutput - Couldn't add screen %d", i);
- }
+ FatalError ("InitOutput - Couldn't add screen %d", i);
+ }
}
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /*
+ Unless full xinerama has been explicitly enabled, register all native screens with pseudoramiX
+ */
+ if (!noPanoramiXExtension)
+ noPseudoramiXExtension = TRUE;
- /* Generate a cookie used by internal clients for authorization */
- if (g_fXdmcpEnabled || g_fAuthEnabled)
- winGenerateAuthorization();
-
- /* Perform some one time initialization */
- if (1 == serverGeneration) {
- /*
- * setlocale applies to all threads in the current process.
- * Apply locale specified in LANG environment variable.
- */
- setlocale(LC_ALL, "");
+ if ((g_ScreenInfo[0].fMultipleMonitors) && !noPseudoramiXExtension)
+ {
+ int pass;
+
+ noRRXineramaExtension = TRUE;
+
+ PseudoramiXExtensionInit();
+
+ /* Add primary monitor on pass 0, other monitors on pass 1, to ensure
+ the primary monitor is first in XINERAMA list */
+ for (pass = 0; pass < 2; pass++)
+ {
+ int iMonitor;
+
+ for (iMonitor = 1; ; iMonitor++)
+ {
+ struct GetMonitorInfoData data;
+ QueryMonitor(iMonitor, &data);
+ if (data.bMonitorSpecifiedExists)
+ {
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+
+ if (GetMonitorInfo(data.monitorHandle, &mi))
+ {
+ /* pass == 1 XOR primary monitor flags is set */
+ if ((!(pass == 1)) != (!(mi.dwFlags & MONITORINFOF_PRIMARY)))
+ {
+ /*
+ Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+ of the native virtual desktop area
+ */
+ data.monitorOffsetX = data.monitorOffsetX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ data.monitorOffsetY = data.monitorOffsetY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ winDebug ("InitOutput - screen %d added at virtual desktop coordinate (%d,%d) (pseudoramiX) \n",
+ iMonitor-1, data.monitorOffsetX, data.monitorOffsetY);
+
+ PseudoramiXAddScreen(data.monitorOffsetX, data.monitorOffsetY,
+ data.monitorWidth, data.monitorHeight);
+ }
+ }
+ }
+ else
+ break;
+ }
+ }
}
-#endif
-
-#if CYGDEBUG || YES
- winDebug("InitOutput - Returning.\n");
-#endif
-}
-
-/*
- * winCheckDisplayNumber - Check if another instance of Cygwin/X is
- * already running on the same display number. If no one exists,
- * make a mutex to prevent new instances from running on the same display.
- *
- * return FALSE if the display number is already used.
- */
-static Bool
-winCheckDisplayNumber(void)
-{
- int nDisp;
- HANDLE mutex;
- char name[MAX_PATH];
- char *pszPrefix = '\0';
- OSVERSIONINFO osvi = { 0 };
-
- /* Check display range */
- nDisp = atoi(display);
- if (nDisp < 0 || nDisp > 65535) {
- ErrorF("winCheckDisplayNumber - Bad display number: %d\n", nDisp);
- return FALSE;
- }
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Set first character of mutex name to null */
- name[0] = '\0';
+ /* Generate a cookie used by internal clients for authorization */
+ if (g_fXdmcpEnabled || g_fAuthEnabled)
+ winGenerateAuthorization ();
- /* Get operating system version information */
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
+ /* Perform some one time initialization */
+ if (1 == serverGeneration)
+ {
+ /* Allow multiple threads to access Xlib */
+ if (XInitThreads () == 0)
+ {
+ ErrorF ("XInitThreads failed.\n");
+ }
- /* Want a mutex shared among all terminals on NT > 4.0 */
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5) {
- pszPrefix = "Global\\";
- }
+ /*
+ * setlocale applies to all threads in the current process.
+ * Apply locale specified in LANG environment variable.
+ */
+ if (!setlocale (LC_ALL, ""))
+ {
+ ErrorF ("setlocale failed.\n");
+ }
- /* Setup Cygwin/X specific part of name */
- snprintf(name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp);
-
- /* Windows automatically releases the mutex when this process exits */
- mutex = CreateMutex(NULL, FALSE, name);
- if (!mutex) {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) & lpMsgBuf, 0, NULL);
- ErrorF("winCheckDisplayNumber - CreateMutex failed: %s\n",
- (LPSTR) lpMsgBuf);
- LocalFree(lpMsgBuf);
-
- return FALSE;
- }
- if (GetLastError() == ERROR_ALREADY_EXISTS) {
- ErrorF("winCheckDisplayNumber - "
- PROJECT_NAME " is already running on display %d\n", nDisp);
- return FALSE;
+ /* See if X supports the current locale */
+ if (XSupportsLocale () == FALSE)
+ {
+ ErrorF ("Warning: Locale not supported by X, falling back to 'C' locale.\n");
+ setlocale(LC_ALL, "C");
+ }
}
+#endif
- return TRUE;
+#if CYGDEBUG || YES
+ winDebug ("InitOutput - Returning.\n");
+#endif
}
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index c49016398..31714ea2e 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -5,7 +5,6 @@ SRCS_CLIPBOARD = \
winclipboardinit.c \
winclipboardtextconv.c \
winclipboardthread.c \
- winclipboardunicode.c \
winclipboardwndproc.c \
winclipboardwrappers.c \
winclipboardxevents.c
@@ -26,6 +25,7 @@ SRCS_MULTIWINDOW = \
winmultiwindowwm.c \
winmultiwindowwndproc.c
DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
+MULTIWINDOW_LIBS = -lshlwapi -lole32
endif
if XWIN_MULTIWINDOWEXTWM
@@ -90,6 +90,7 @@ SRCS = InitInput.c \
winmonitors.c \
winmouse.c \
winmsg.c \
+ winmsgwindow.c \
winmultiwindowclass.c \
winmultiwindowicons.c \
winprefs.c \
@@ -101,6 +102,7 @@ SRCS = InitInput.c \
winshaddd.c \
winshadddnl.c \
winshadgdi.c \
+ wintaskbar.c \
wintrayicon.c \
winvalargs.c \
winwakeup.c \
@@ -120,6 +122,7 @@ SRCS = InitInput.c \
winprefs.h \
winresource.h \
winwindow.h \
+ windisplay.c \
XWin.rc \
$(top_srcdir)/Xext/dpmsstubs.c \
$(top_srcdir)/Xi/stubs.c \
@@ -146,8 +149,10 @@ XWin_SOURCES = $(SRCS)
INCLUDES = -I$(top_srcdir)/miext/rootless
+XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la
+
XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS)
-XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
+XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
XWin_LDFLAGS = -mwindows -static
.rc.o:
diff --git a/hw/xwin/README b/hw/xwin/README
deleted file mode 100644
index 219fd1337..000000000
--- a/hw/xwin/README
+++ /dev/null
@@ -1,141 +0,0 @@
-Cygwin/X Release Notes
-======================
-
-Release X11R6.7
-===============
-
-Cygwin/X has continued its rapid pace of development that it has sustained
-since Spring 2001 and this release shows it, we now have: a stable and fast
-multi-window mode, seamless clipboard integration, a configurable tray menu
-icon, popups on error messages pointing users to the log file and our mailing
-list, the beginnings of indirect 3D acceleration for OpenGL applications,
-improved non-US keyboard and clipboard support, and only a handful of bugs
-that continue to be reported.
-
-Between the XFree86 4.3.0 release and the X.Org X11R6.7 release the Cyg-
-win/XFree86 project broke away from The XFree86 Project, Inc. due to a lack
-of support from the XFree86 project. As such, the Cygwin/XFree86 project was
-renamed to the Cygwin/X project and the upstream source code tree that Cyg-
-win/X pulls from and pushes to is now the tree managed by the X.Org Founda-
-tion. The Cygwin/X project has seen a rush of development and interest in
-the project since the split; one metric showing this is that the number of
-CVS committers we have has gone from zero to six.
-
-The most outstanding features of this release are
-
- o Major multi-window mode improvements. (Takuma Murakami, Earle F.
- Philhower III)
-
- o Initial work of accelerated OpenGL using the windows OpenGL drivers.
- (Alexander Gottwald)
-
- o Massive rework of clipboard integration with windows. (Harold L Hunt II,
- Kensuke Matsuzaki)
-
- o Improved Japanese clipboard and keyboard support. (Kensuke Matsuzaki,
- Takuma Murakami, Alexander Gottwald)
-
- o Customizable tray menu icon allowing shortcuts to start programs,
- etc.(Earle F. Philhower III)
-
- o New icons. (Jehan Bing, Michael Bax, Benjamin Rienfenstahl)
-
- o Fix some multi-monitor problems.(Takuma Murakami)
-
- o Fix repeated key strokes. (Ivan Pascal)
-
- o Automatic keyboard layouts for the most frequently used keyboard lay-
- outs. (Alexander Gottwald)
-
- o Built in SHM support with detection of the SHM engine (cygserver).
- (Ralf Habacker, Harold L Hunt II)
-
- o Merged in work on the NativeGDI engine. (Alan Hourihane)
-
-OpenGL with Cygwin/X
-====================
-
-Cygwin/X has supported GLX only with software rendering provided by the Mesa
-library. Starting with X11R6.7 we add support for hardware accelerated OpenGL.
-
-This support is still under development and still has some bigger problems.
-To provide both versions (the stable software rendering and the new hardware
-accelerated) we ship to binaries. XWin.exe contains the software rendering
-and XWin_GL.exe uses the hardware acceleration provided by the windows drivers.
-
-The known problems with hardware accelerated OpenGL are:
-
- o Only multiwindow mode is useful. In the other modes the OpenGL output
- does not align with the X11 windows.
-
- o Using two programs which require different visuals will fail. For example
- glxgears and glxinfo will not work without restarting XWin_GL.exe.
-
- o OpenGL extensions and functions from OpenGL 1.2 and later should work
- but are not completely tested.
-
- o The standard Windows OpenGL driver will produce no output. Use the one
- from your video adapter vendor.
-
-If you notice problems with some programs please send a message with the
-logfile /tmp/XWin.log and a short error description to <cygwin-xfree@cygwin.com>
-
-The hardware accelerated OpenGL was tested using:
-
- o glxgears
- o glxinfo
- o blender
- o tuxkart
- o GLUT demos (some did fail)
- o tuxracer (currently not working)
-
-
-Release X11R6.8
-===============
-
-Having reached a quite mature state in release X11R6.7 the development
-has slowed down a little bit. Some of the former active developers have
-retired or cut their work for the Cygwin/X project due to conflicts with
-job, study and family.
-
-The X11R6.8 release now includes major improvements from the xserver project.
-This includes the XFixes, Damage, Composite and XEVIE extension which is a
-major step towards allowing Cygwin/X to have real transparency.
-
-But at the current state Composite is not working with Cygwin/X. Not all code
-in the Cygwin/X Server has been updated to support the Composite feature and
-using it will even crash the xserver. But as a second problem nearly all
-functions required for compositing are lacking acceleration in Cygwin/X so
-the feature would not be very useful if it would work. So it is disabled by
-default.
-
-OpenGL with Cygwin/X
-====================
-
-The OpenGL support has lost some of it's limitations from the last release
-and should be much more stable. But due to missing wide spread testing in
-the community it is still available in a separate program. XWin still uses
-the old software OpenGL which is known to be stable.
-
-The known problems with hardware accelerated OpenGL are:
-
- o Only multiwindow mode is useful. In the other modes the OpenGL output
- does not align with the X11 windows.
-
- o OpenGL extensions and functions from OpenGL 1.2 and later should work
- but are not completely tested.
-
- o The standard Windows OpenGL driver will produce no output. Use the one
- from your video adapter vendor.
-
-If you notice problems with some programs please send a message with the
-logfile /tmp/XWin.log and a short error description to <cygwin-xfree@cygwin.com>
-
-The hardware accelerated OpenGL was tested using:
-
- o glxgears
- o glxinfo
- o blender
- o tuxkart
- o GLUT demos (some did fail)
-
diff --git a/hw/xwin/glx/gen_gl_wrappers.py b/hw/xwin/glx/gen_gl_wrappers.py
index e2d960ec6..0ff579ac0 100755
--- a/hw/xwin/glx/gen_gl_wrappers.py
+++ b/hw/xwin/glx/gen_gl_wrappers.py
@@ -67,7 +67,7 @@ if dispatchheader :
fh = open(dispatchheader)
dispatchh = fh.readlines()
- dispatch_regex = re.compile(r'#define\sSET_(\S*)\(')
+ dispatch_regex = re.compile(r'(?:#define\s|static\sinline\svoid\s|)SET_(\S*)\(')
for line in dispatchh :
line = line.strip()
@@ -308,12 +308,20 @@ for w in sorted(wrappers.keys()) :
if dispatchheader :
print 'void glWinSetupDispatchTable(void)'
print '{'
- print ' struct _glapi_table *disp = _glapi_get_dispatch();'
+ print ' static struct _glapi_table *disp = NULL;'
+ print ''
+ print ' if (!disp)'
+ print ' {'
+ print ' disp = calloc(sizeof(void *), _glapi_get_dispatch_table_size());'
+ print ' assert(disp);'
for d in sorted(dispatch.keys()) :
if wrappers.has_key(d) :
- print ' SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);'
+ print ' SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);'
else :
print '#warning No wrapper for ' + prefix + d + ' !'
+ print ' }'
+ print ''
+ print ' _glapi_set_dispatch(disp);'
print '}'
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 56f677a8f..14d99fe1c 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -86,6 +86,7 @@
#include <winpriv.h>
#include <wgl_ext_api.h>
+#include <winglobals.h>
#define NUM_ELEMENTS(x) (sizeof(x)/ sizeof(x[1]))
@@ -105,53 +106,53 @@
* structure definitions
*/
-typedef struct __GLXWinContext __GLXWinContext;
+typedef struct __GLXWinContext __GLXWinContext;
typedef struct __GLXWinDrawable __GLXWinDrawable;
typedef struct __GLXWinScreen glxWinScreen;
typedef struct __GLXWinConfig GLXWinConfig;
struct __GLXWinContext {
- __GLXcontext base;
- HGLRC ctx; /* Windows GL Context */
- __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
- HWND hwnd; /* For detecting when HWND has changed */
+ __GLXcontext base;
+ HGLRC ctx; /* Windows GL Context */
+ __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
+ HWND hwnd; /* For detecting when HWND has changed */
};
struct __GLXWinDrawable {
- __GLXdrawable base;
- __GLXWinContext *drawContext;
- __GLXWinContext *readContext;
-
- /* If this drawable is GLX_DRAWABLE_PBUFFER */
- HPBUFFERARB hPbuffer;
-
- /* If this drawable is GLX_DRAWABLE_PIXMAP */
- HDC dibDC;
- HBITMAP hDIB;
- HBITMAP hOldDIB; /* original DIB for DC */
- void *pOldBits; /* original pBits for this drawable's pixmap */
+ __GLXdrawable base;
+ __GLXWinContext *drawContext;
+ __GLXWinContext *readContext;
+
+ /* If this drawable is GLX_DRAWABLE_PBUFFER */
+ HPBUFFERARB hPbuffer;
+
+ /* If this drawable is GLX_DRAWABLE_PIXMAP */
+ HDC dibDC;
+ HBITMAP hDIB;
+ HBITMAP hOldDIB; /* original DIB for DC */
+ void *pOldBits; /* original pBits for this drawable's pixmap */
};
struct __GLXWinScreen {
- __GLXscreen base;
+ __GLXscreen base;
- /* Supported GLX extensions */
- unsigned char glx_enable_bits[__GLX_EXT_BYTES];
+ /* Supported GLX extensions */
+ unsigned char glx_enable_bits[__GLX_EXT_BYTES];
- Bool has_WGL_ARB_multisample;
- Bool has_WGL_ARB_pixel_format;
- Bool has_WGL_ARB_pbuffer;
- Bool has_WGL_ARB_render_texture;
+ Bool has_WGL_ARB_multisample;
+ Bool has_WGL_ARB_pixel_format;
+ Bool has_WGL_ARB_pbuffer;
+ Bool has_WGL_ARB_render_texture;
- /* wrapped screen functions */
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- CopyWindowProcPtr CopyWindow;
+ /* wrapped screen functions */
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ CopyWindowProcPtr CopyWindow;
};
struct __GLXWinConfig {
- __GLXconfig base;
- int pixelFormatIndex;
+ __GLXconfig base;
+ int pixelFormatIndex;
};
/* ---------------------------------------------------------------------- */
@@ -166,7 +167,7 @@ struct __GLXWinConfig {
GLWIN_DEBUG_MSG("Got HWND %p for window '%s'", hwnd, buffer); \
}
-glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0 };
+glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0};
static void
glxWinInitDebugSettings(void)
@@ -210,33 +211,33 @@ glxWinInitDebugSettings(void)
glxWinDebugSettings.dumpDC = 1;
glxWinDebugSettings.enableGLcallTrace = 1;
glxWinDebugSettings.enableWGLcallTrace = 1;
- }
+ }
}
static
const char *
glxWinErrorMessage(void)
{
- static char errorbuffer[1024];
- unsigned int last_error = GetLastError();
+ static char errorbuffer[1024];
+ unsigned int last_error = GetLastError();
if (!FormatMessage
(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, last_error, 0,
(LPTSTR) & errorbuffer, sizeof(errorbuffer), NULL)) {
- snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
+ snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
}
if ((errorbuffer[strlen(errorbuffer) - 1] == '\n') ||
(errorbuffer[strlen(errorbuffer) - 1] == '\r'))
- errorbuffer[strlen(errorbuffer) - 1] = 0;
+ errorbuffer[strlen(errorbuffer)-1] = 0;
- sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error);
+ sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error);
- return errorbuffer;
+ return errorbuffer;
}
-static void pfdOut(const PIXELFORMATDESCRIPTOR * pfd);
+static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd);
#define DUMP_PFD_FLAG(flag) \
if (pfd->dwFlags & flag) { \
@@ -247,31 +248,31 @@ static void pfdOut(const PIXELFORMATDESCRIPTOR * pfd);
static void
pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
{
- const char *pipesym = ""; /* will be set after first flag dump */
+ const char *pipesym = ""; /* will be set after first flag dump */
ErrorF("PIXELFORMATDESCRIPTOR:\n");
ErrorF("nSize = %u\n", pfd->nSize);
ErrorF("nVersion = %u\n", pfd->nVersion);
ErrorF("dwFlags = %lu = {", pfd->dwFlags);
- DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
- DUMP_PFD_FLAG(PFD_STEREO);
- DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
- DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
- DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
- DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
- DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
- DUMP_PFD_FLAG(PFD_NEED_PALETTE);
- DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
- DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
- DUMP_PFD_FLAG(PFD_SWAP_COPY);
- DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
- DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
- DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW);
- DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED);
- DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION);
- DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
- DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
- DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
+ DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
+ DUMP_PFD_FLAG(PFD_STEREO);
+ DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
+ DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
+ DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
+ DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
+ DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
+ DUMP_PFD_FLAG(PFD_NEED_PALETTE);
+ DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
+ DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
+ DUMP_PFD_FLAG(PFD_SWAP_COPY);
+ DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
+ DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
+ DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW);
+ DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED);
+ DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION);
+ DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
+ DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
+ DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
ErrorF("}\n");
ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType,
@@ -305,22 +306,22 @@ pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
static const char *
visual_class_name(int cls)
{
- switch (cls) {
- case GLX_STATIC_COLOR:
- return "StaticColor";
- case GLX_PSEUDO_COLOR:
- return "PseudoColor";
- case GLX_STATIC_GRAY:
- return "StaticGray";
- case GLX_GRAY_SCALE:
- return "GrayScale";
- case GLX_TRUE_COLOR:
- return "TrueColor";
- case GLX_DIRECT_COLOR:
- return "DirectColor";
- default:
- return "-none-";
- }
+ switch (cls) {
+ case GLX_STATIC_COLOR:
+ return "StaticColor";
+ case GLX_PSEUDO_COLOR:
+ return "PseudoColor";
+ case GLX_STATIC_GRAY:
+ return "StaticGray";
+ case GLX_GRAY_SCALE:
+ return "GrayScale";
+ case GLX_TRUE_COLOR:
+ return "TrueColor";
+ case GLX_DIRECT_COLOR:
+ return "DirectColor";
+ default:
+ return "-none-";
+ }
}
static const char *
@@ -328,20 +329,25 @@ swap_method_name(int mthd)
{
switch (mthd) {
case GLX_SWAP_EXCHANGE_OML:
- return "xchg";
+ return "xchg";
case GLX_SWAP_COPY_OML:
- return "copy";
+ return "copy";
case GLX_SWAP_UNDEFINED_OML:
- return " ";
+ return " ";
default:
- return "????";
+ return "????";
}
}
static void
-fbConfigsDump(unsigned int n, __GLXconfig * c)
+fbConfigsDump(unsigned int n, __GLXconfig *c)
{
- ErrorF("%d fbConfigs\n", n);
+ LogMessage(X_INFO, "%d fbConfigs\n", n);
+
+ if (g_iLogVerbose < 3)
+ return;
+
+ ErrorF("%d fbConfigs\n", n);
ErrorF
("pxf vis fb render Ste aux accum MS drawable Group/\n");
ErrorF
@@ -350,43 +356,43 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
("-----------------------------------------------------------------------------------------------------------------------------\n");
while (c != NULL) {
- unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex;
-
- ErrorF("%3d %3x %3x "
- "%-11s"
- " %3d %3d %s %s %s %s %s "
- "%2d %2d %2d %2d "
- "%2d %2d "
- "%2d "
- "%2d %2d %2d %2d"
- " %2d %2d"
- " %s %s %s "
- " %s "
- " %s "
- " %d %s"
- "\n",
- i, c->visualID, c->fbconfigID,
- visual_class_name(c->visualType),
- c->rgbBits ? c->rgbBits : c->indexBits,
- c->level,
- (c->renderType & GLX_RGBA_BIT) ? "y" : ".",
- (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".",
- c->doubleBufferMode ? "y" : ".",
- swap_method_name(c->swapMethod),
- c->stereoMode ? "y" : ".",
- c->redBits, c->greenBits, c->blueBits, c->alphaBits,
- c->depthBits, c->stencilBits,
- c->numAuxBuffers,
+ unsigned int i = ((GLXWinConfig *)c)->pixelFormatIndex;
+
+ ErrorF("%3d %3x %3x "
+ "%-11s"
+ " %3d %3d %s %s %s %s %s "
+ "%2d %2d %2d %2d "
+ "%2d %2d "
+ "%2d "
+ "%2d %2d %2d %2d"
+ " %2d %2d"
+ " %s %s %s "
+ " %s "
+ " %s "
+ " %d %s"
+ "\n",
+ i, c->visualID, c->fbconfigID,
+ visual_class_name(c->visualType),
+ c->rgbBits ? c->rgbBits : c->indexBits,
+ c->level,
+ (c->renderType & GLX_RGBA_BIT) ? "y" : ".",
+ (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".",
+ c->doubleBufferMode ? "y" : ".",
+ swap_method_name(c->swapMethod),
+ c->stereoMode ? "y" : ".",
+ c->redBits, c->greenBits, c->blueBits, c->alphaBits,
+ c->depthBits, c->stencilBits,
+ c->numAuxBuffers,
c->accumRedBits, c->accumGreenBits, c->accumBlueBits,
c->accumAlphaBits, c->sampleBuffers, c->samples,
- (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
- (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
+ (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
+ (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
(c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
- (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
+ (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
c->visualSelectGroup,
(c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
- c = c->next;
+ c = c->next;
}
}
@@ -396,14 +402,14 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
*/
static __GLXscreen *glxWinScreenProbe(ScreenPtr pScreen);
-static __GLXcontext *glxWinCreateContext(__GLXscreen * screen,
- __GLXconfig * modes,
- __GLXcontext * baseShareContext);
+static __GLXcontext *glxWinCreateContext(__GLXscreen *screen,
+ __GLXconfig *modes,
+ __GLXcontext *baseShareContext);
static __GLXdrawable *glxWinCreateDrawable(ClientPtr client,
- __GLXscreen * screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
+ __GLXscreen *screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type,
XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
@@ -413,10 +419,10 @@ static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
static HDC glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw,
HDC * hdc, HWND * hwnd);
-static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw);
+static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable *draw);
-static void glxWinCreateConfigs(HDC dc, glxWinScreen * screen);
-static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen);
+static void glxWinCreateConfigs(HDC dc, glxWinScreen *screen);
+static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen);
static int fbConfigToPixelFormat(__GLXconfig * mode,
PIXELFORMATDESCRIPTOR * pfdret,
int drawableTypeOverride);
@@ -438,7 +444,7 @@ __GLXprovider __glXWGLProvider = {
void
glxWinPushNativeProvider(void)
{
- GlxPushProvider(&__glXWGLProvider);
+ GlxPushProvider(&__glXWGLProvider);
}
/* ---------------------------------------------------------------------- */
@@ -447,7 +453,7 @@ glxWinPushNativeProvider(void)
*/
static void
-glxWinScreenDestroy(__GLXscreen * screen)
+glxWinScreenDestroy(__GLXscreen *screen)
{
GLWIN_DEBUG_MSG("glxWinScreenDestroy(%p)", screen);
__glXScreenDestroy(screen);
@@ -455,15 +461,15 @@ glxWinScreenDestroy(__GLXscreen * screen)
}
static int
-glxWinScreenSwapInterval(__GLXdrawable * drawable, int interval)
+glxWinScreenSwapInterval(__GLXdrawable *drawable, int interval)
{
- BOOL ret = wglSwapIntervalEXTWrapper(interval);
+ BOOL ret = wglSwapIntervalEXTWrapper(interval);
if (!ret) {
ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval,
glxWinErrorMessage());
}
- return ret;
+ return ret;
}
/*
@@ -472,41 +478,42 @@ glxWinScreenSwapInterval(__GLXdrawable * drawable, int interval)
static void
glxLogExtensions(const char *prefix, const char *extensions)
{
- int length = 0;
- char *strl;
- char *str = strdup(extensions);
+ int length = 0;
+ const char *strl;
+ char *str = strdup(extensions);
if (str == NULL) {
- ErrorF("glxLogExtensions: xalloc error\n");
- return;
+ ErrorF("glxLogExtensions: xalloc error\n");
+ return;
}
- strl = strtok(str, " ");
- ErrorF("%s%s", prefix, strl);
- length = strlen(prefix) + strlen(strl);
+ strl = strtok(str, " ");
+ if (strl == NULL) strl = "";
+ ErrorF("%s%s", prefix, strl);
+ length = strlen(prefix) + strlen(strl);
while (1) {
- strl = strtok(NULL, " ");
+ strl = strtok(NULL, " ");
if (strl == NULL)
break;
if (length + strlen(strl) + 1 > 120) {
- ErrorF("\n");
- ErrorF("%s", prefix);
- length = strlen(prefix);
+ ErrorF("\n");
+ ErrorF("%s",prefix);
+ length = strlen(prefix);
}
else {
- ErrorF(" ");
- length++;
+ ErrorF(" ");
+ length++;
}
- ErrorF("%s", strl);
- length = length + strlen(strl);
+ ErrorF("%s", strl);
+ length = length + strlen(strl);
}
- ErrorF("\n");
+ ErrorF("\n");
- free(str);
+ free(str);
}
/* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */
@@ -515,6 +522,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
{
glxWinScreen *screen;
const char *gl_extensions;
+ const char *gl_renderer;
const char *wgl_extensions;
HWND hwnd;
HDC hdc;
@@ -525,51 +533,43 @@ glxWinScreenProbe(ScreenPtr pScreen)
glxWinInitDebugSettings();
if (pScreen == NULL)
- return NULL;
+ return NULL;
if (!winCheckScreenAiglxIsSupported(pScreen)) {
LogMessage(X_ERROR,
"AIGLX: No native OpenGL in modes with a root window\n");
return NULL;
- }
+ }
screen = calloc(1, sizeof(glxWinScreen));
if (NULL == screen)
- return NULL;
-
- /* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */
- screen->RealizeWindow = pScreen->RealizeWindow;
- pScreen->RealizeWindow = glxWinRealizeWindow;
- screen->UnrealizeWindow = pScreen->UnrealizeWindow;
- pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
- screen->CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = glxWinCopyWindow;
+ return NULL;
/* Dump out some useful information about the native renderer */
// create window class
#define WIN_GL_TEST_WINDOW_CLASS "XWinGLTest"
{
- static wATOM glTestWndClass = 0;
+ static wATOM glTestWndClass = 0;
if (glTestWndClass == 0) {
- WNDCLASSEX wc;
-
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = DefWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = GetModuleHandle(NULL);
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
- wc.hIconSm = 0;
- RegisterClassEx(&wc);
- }
+ WNDCLASSEX wc;
+
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = DefWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = GetModuleHandle(NULL);
+ wc.hIcon = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
+ wc.hIconSm = 0;
+ RegisterClassEx (&wc);
+ }
}
// create an invisible window for a scratch DC
@@ -595,13 +595,24 @@ glxWinScreenProbe(ScreenPtr pScreen)
ErrorF("GL_VERSION: %s\n", glGetStringWrapperNonstatic(GL_VERSION));
ErrorF("GL_VENDOR: %s\n", glGetStringWrapperNonstatic(GL_VENDOR));
- ErrorF("GL_RENDERER: %s\n", glGetStringWrapperNonstatic(GL_RENDERER));
- gl_extensions = (const char *) glGetStringWrapperNonstatic(GL_EXTENSIONS);
- glxLogExtensions("GL_EXTENSIONS: ", gl_extensions);
+ gl_renderer = (const char *)glGetStringWrapperNonstatic(GL_RENDERER);
+ ErrorF("GL_RENDERER: %s\n", gl_renderer);
+ gl_extensions = (const char *)glGetStringWrapperNonstatic(GL_EXTENSIONS);
wgl_extensions = wglGetExtensionsStringARBWrapper(hdc);
- if (!wgl_extensions)
- wgl_extensions = "";
- glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
+ if (!wgl_extensions) wgl_extensions = "";
+
+ if (g_iLogVerbose >= 3)
+ {
+ glxLogExtensions("GL_EXTENSIONS: ", gl_extensions);
+ glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
+ }
+
+ if (strcasecmp(gl_renderer, "GDI Generic") == 0)
+ {
+ free(screen);
+ LogMessage(X_ERROR,"AIGLX: Won't use generic native renderer as it is not accelerated\n");
+ return NULL;
+ }
// Can you see the problem here? The extensions string is DC specific
// Different DCs for windows on a multimonitor system driven by multiple cards
@@ -609,41 +620,41 @@ glxWinScreenProbe(ScreenPtr pScreen)
// those screens to be accelerated in XP and earlier...
{
- // testing facility to not use any WGL extensions
- char *envptr = getenv("GLWIN_NO_WGL_EXTENSIONS");
+ // testing facility to not use any WGL extensions
+ char *envptr = getenv("GLWIN_NO_WGL_EXTENSIONS");
if ((envptr != NULL) && (atoi(envptr) != 0)) {
- ErrorF("GLWIN_NO_WGL_EXTENSIONS is set, ignoring WGL_EXTENSIONS\n");
- wgl_extensions = "";
+ ErrorF("GLWIN_NO_WGL_EXTENSIONS is set, ignoring WGL_EXTENSIONS\n");
+ wgl_extensions = "";
}
}
{
- Bool glx_sgi_make_current_read = FALSE;
+ Bool glx_sgi_make_current_read = FALSE;
- //
- // Based on the WGL extensions available, enable various GLX extensions
- // XXX: make this table-driven ?
- //
- memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
+ //
+ // Based on the WGL extensions available, enable various GLX extensions
+ // XXX: make this table-driven ?
+ //
+ memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_SGI_make_current_read");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
- glx_sgi_make_current_read = TRUE;
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ glx_sgi_make_current_read = TRUE;
}
if (strstr(gl_extensions, "GL_WIN_swap_hint")) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_MESA_copy_sub_buffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
}
if (strstr(wgl_extensions, "WGL_EXT_swap_control")) {
@@ -664,9 +675,9 @@ glxWinScreenProbe(ScreenPtr pScreen)
/* } */
if (strstr(wgl_extensions, "WGL_ARB_pbuffer")) {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
- screen->has_WGL_ARB_pbuffer = TRUE;
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
+ screen->has_WGL_ARB_pbuffer = TRUE;
}
if (strstr(wgl_extensions, "WGL_ARB_multisample")) {
@@ -676,84 +687,81 @@ glxWinScreenProbe(ScreenPtr pScreen)
"GLX_SGIS_multisample");
LogMessage(X_INFO,
"AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n");
- screen->has_WGL_ARB_multisample = TRUE;
+ screen->has_WGL_ARB_multisample = TRUE;
}
- screen->base.destroy = glxWinScreenDestroy;
- screen->base.createContext = glxWinCreateContext;
- screen->base.createDrawable = glxWinCreateDrawable;
- screen->base.swapInterval = glxWinScreenSwapInterval;
- screen->base.pScreen = pScreen;
+ screen->base.destroy = glxWinScreenDestroy;
+ screen->base.createContext = glxWinCreateContext;
+ screen->base.createDrawable = glxWinCreateDrawable;
+ screen->base.swapInterval = glxWinScreenSwapInterval;
+ screen->base.pScreen = pScreen;
- // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs
+ // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs
if (strstr(wgl_extensions, "WGL_ARB_pixel_format")) {
- glxWinCreateConfigsExt(hdc, screen);
+ glxWinCreateConfigsExt(hdc, screen);
- /*
- Some graphics drivers appear to advertise WGL_ARB_pixel_format,
- but it doesn't work usefully, so we have to be prepared for it
- to fail and fall back to using DescribePixelFormat()
- */
+ /*
+ Some graphics drivers appear to advertise WGL_ARB_pixel_format,
+ but it doesn't work usefully, so we have to be prepared for it
+ to fail and fall back to using DescribePixelFormat()
+ */
if (screen->base.numFBConfigs > 0) {
- screen->has_WGL_ARB_pixel_format = TRUE;
+ screen->has_WGL_ARB_pixel_format = TRUE;
}
}
if (screen->base.numFBConfigs <= 0) {
- glxWinCreateConfigs(hdc, screen);
- screen->has_WGL_ARB_pixel_format = FALSE;
+ glxWinCreateConfigs(hdc, screen);
+ screen->has_WGL_ARB_pixel_format = FALSE;
}
- /*
- If we still didn't get any fbConfigs, we can't provide GLX for this screen
- */
+ /*
+ If we still didn't get any fbConfigs, we can't provide GLX for this screen
+ */
if (screen->base.numFBConfigs <= 0) {
- free(screen);
+ free(screen);
LogMessage(X_ERROR,
"AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n");
- return NULL;
+ return NULL;
}
- /* These will be set by __glXScreenInit */
- screen->base.visuals = NULL;
- screen->base.numVisuals = 0;
+ /* These will be set by __glXScreenInit */
+ screen->base.visuals = NULL;
+ screen->base.numVisuals = 0;
- __glXScreenInit(&screen->base, pScreen);
+ __glXScreenInit(&screen->base, pScreen);
- // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
- fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
+ // Override the GL extensions string set by __glXScreenInit()
+ screen->base.GLextensions = strdup(gl_extensions);
- // Override the GL extensions string set by __glXScreenInit()
- screen->base.GLextensions = strdup(gl_extensions);
-
- // Generate the GLX extensions string (overrides that set by __glXScreenInit())
- {
+ // Generate the GLX extensions string (overrides that set by __glXScreenInit())
+ {
unsigned int buffer_size =
__glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) {
- free(screen->base.GLXextensions);
+ free(screen->base.GLXextensions);
- screen->base.GLXextensions = xnfalloc(buffer_size);
+ screen->base.GLXextensions = xnfalloc(buffer_size);
__glXGetExtensionString(screen->glx_enable_bits,
screen->base.GLXextensions);
- }
- }
-
- //
- // Override the GLX version (__glXScreenInit() sets it to "1.2")
- // if we have all the needed extensions to operate as a higher version
- //
- // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3
- // ARB_multisample -> 1.4
- //
+ }
+ }
+
+ //
+ // Override the GLX version (__glXScreenInit() sets it to "1.2")
+ // if we have all the needed extensions to operate as a higher version
+ //
+ // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3
+ // ARB_multisample -> 1.4
+ //
if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read) {
if (screen->has_WGL_ARB_multisample) {
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 4;
+ screen->base.GLXmajor = 1;
+ screen->base.GLXminor = 4;
}
else {
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 3;
+ screen->base.GLXmajor = 1;
+ screen->base.GLXminor = 3;
}
}
}
@@ -765,6 +773,17 @@ glxWinScreenProbe(ScreenPtr pScreen)
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
+ // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
+ fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
+
+ /* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */
+ screen->RealizeWindow = pScreen->RealizeWindow;
+ pScreen->RealizeWindow = glxWinRealizeWindow;
+ screen->UnrealizeWindow = pScreen->UnrealizeWindow;
+ pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
+ screen->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = glxWinCopyWindow;
+
return &screen->base;
}
@@ -808,11 +827,11 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
For regions which are being drawn by GL, the shadow framebuffer doesn't have the
correct bits, so we wish to avoid shadow framebuffer damage occuring, which will
cause those incorrect bits to be transferred to the display....
- */
+ */
if (pGlxDraw && pGlxDraw->drawContext) {
GLWIN_DEBUG_MSG("glxWinCopyWindow: discarding");
return;
- }
+ }
GLWIN_DEBUG_MSG("glxWinCopyWindow - passing to hw layer");
@@ -826,7 +845,7 @@ glxWinUnrealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
- glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
+ glxWinScreen *screenPriv = (glxWinScreen *)glxGetScreen(pScreen);
GLWIN_DEBUG_MSG("glxWinUnrealizeWindow");
@@ -843,18 +862,18 @@ glxWinUnrealizeWindow(WindowPtr pWin)
*/
static GLboolean
-glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
+glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base)
{
HDC dc;
HWND hwnd;
BOOL ret;
- __GLXWinDrawable *draw = (__GLXWinDrawable *) base;
+ __GLXWinDrawable *draw = (__GLXWinDrawable *)base;
/* Swap buffers on the last active context for drawing on the drawable */
if (draw->drawContext == NULL) {
GLWIN_TRACE_MSG("glxWinSwapBuffers - no context for drawable");
return GL_FALSE;
- }
+ }
GLWIN_TRACE_MSG
("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)",
@@ -863,13 +882,13 @@ glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
/*
draw->drawContext->base.drawPriv will not be set if the context is not current anymore,
but if it is, it should point to this drawable....
- */
+ */
assert((draw->drawContext->base.drawPriv == NULL) ||
(draw->drawContext->base.drawPriv == base));
dc = glxWinMakeDC(draw->drawContext, draw, &dc, &hwnd);
if (dc == NULL)
- return GL_FALSE;
+ return GL_FALSE;
ret = wglSwapLayerBuffers(dc, WGL_SWAP_MAIN_PLANE);
@@ -878,91 +897,91 @@ glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
if (!ret) {
ErrorF("wglSwapBuffers failed: %s\n", glxWinErrorMessage());
return GL_FALSE;
- }
+ }
return GL_TRUE;
}
static void
-glxWinDrawableCopySubBuffer(__GLXdrawable * drawable,
+glxWinDrawableCopySubBuffer(__GLXdrawable *drawable,
int x, int y, int w, int h)
{
- glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
- glxWinDrawableSwapBuffers(NULL, drawable);
+ glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
+ glxWinDrawableSwapBuffers(NULL, drawable);
}
static void
-glxWinDrawableDestroy(__GLXdrawable * base)
+glxWinDrawableDestroy(__GLXdrawable *base)
{
- __GLXWinDrawable *glxPriv = (__GLXWinDrawable *) base;
+ __GLXWinDrawable *glxPriv = (__GLXWinDrawable *)base;
if (glxPriv->drawContext &&
(__glXLastContext == &((glxPriv->drawContext)->base))) {
- // if this context is current and has unflushed commands, say we have flushed them
- // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
- // on the next context change)
- // (GLX core considers it an error when we try to select a new current context if the old one
- // has unflushed commands, but the window has disappeared..)
- __glXLastContext->hasUnflushedCommands = FALSE;
- __glXLastContext = NULL;
+ // if this context is current and has unflushed commands, say we have flushed them
+ // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
+ // on the next context change)
+ // (GLX core considers it an error when we try to select a new current context if the old one
+ // has unflushed commands, but the window has disappeared..)
+ __glXLastContext->hasUnflushedCommands = FALSE;
+ __glXLastContext = NULL;
}
- if (glxPriv->hPbuffer)
+ if (glxPriv->hPbuffer)
if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer)) {
- ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
- }
+ ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
+ }
if (glxPriv->dibDC) {
- // restore the default DIB
- SelectObject(glxPriv->dibDC, glxPriv->hOldDIB);
+ // restore the default DIB
+ SelectObject(glxPriv->dibDC, glxPriv->hOldDIB);
if (!DeleteDC(glxPriv->dibDC)) {
- ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage());
+ ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage());
}
}
if (glxPriv->hDIB) {
if (!DeleteObject(glxPriv->hDIB)) {
- ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage());
+ ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage());
}
- ((PixmapPtr) glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits;
+ ((PixmapPtr)glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits;
}
- GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
- free(glxPriv);
+ GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
+ free(glxPriv);
}
static __GLXdrawable *
glxWinCreateDrawable(ClientPtr client,
- __GLXscreen * screen,
- DrawablePtr pDraw,
+ __GLXscreen *screen,
+ DrawablePtr pDraw,
XID drawId, int type, XID glxDrawId, __GLXconfig * conf)
{
- __GLXWinDrawable *glxPriv;
+ __GLXWinDrawable *glxPriv;
- glxPriv = malloc(sizeof *glxPriv);
+ glxPriv = malloc(sizeof *glxPriv);
- if (glxPriv == NULL)
- return NULL;
+ if (glxPriv == NULL)
+ return NULL;
- memset(glxPriv, 0, sizeof *glxPriv);
+ memset(glxPriv, 0, sizeof *glxPriv);
if (!__glXDrawableInit
(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
- free(glxPriv);
- return NULL;
- }
+ free(glxPriv);
+ return NULL;
+ }
- glxPriv->base.destroy = glxWinDrawableDestroy;
- glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers;
- glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer;
- // glxPriv->base.waitX what are these for?
- // glxPriv->base.waitGL
+ glxPriv->base.destroy = glxWinDrawableDestroy;
+ glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers;
+ glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer;
+ // glxPriv->base.waitX what are these for?
+ // glxPriv->base.waitGL
- GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv);
+ GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv);
- return &glxPriv->base;
+ return &glxPriv->base;
}
/* ---------------------------------------------------------------------- */
@@ -975,8 +994,8 @@ static
glxWinBindTexImage(__GLXcontext * baseContext,
int buffer, __GLXdrawable * pixmap)
{
- ErrorF("glxWinBindTexImage: not implemented\n");
- return FALSE;
+ ErrorF("glxWinBindTexImage: not implemented\n");
+ return FALSE;
}
static
@@ -984,8 +1003,8 @@ static
glxWinReleaseTexImage(__GLXcontext * baseContext,
int buffer, __GLXdrawable * pixmap)
{
- ErrorF(" glxWinReleaseTexImage: not implemented\n");
- return FALSE;
+ ErrorF(" glxWinReleaseTexImage: not implemented\n");
+ return FALSE;
}
/* ---------------------------------------------------------------------- */
@@ -1011,19 +1030,19 @@ static Bool
glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
int drawableTypeOverride)
{
- __GLXscreen *screen = gc->base.pGlxScreen;
- glxWinScreen *winScreen = (glxWinScreen *) screen;
+ __GLXscreen *screen = gc->base.pGlxScreen;
+ glxWinScreen *winScreen = (glxWinScreen *)screen;
- __GLXconfig *config = gc->base.config;
- GLXWinConfig *winConfig = (GLXWinConfig *) config;
+ __GLXconfig *config = gc->base.config;
+ GLXWinConfig *winConfig = (GLXWinConfig *)config;
GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d",
winConfig->pixelFormatIndex);
- /*
- Normally, we can just use the the pixelFormatIndex corresponding
- to the fbconfig which has been specified by the client
- */
+ /*
+ Normally, we can just use the the pixelFormatIndex corresponding
+ to the fbconfig which has been specified by the client
+ */
if (!
((bppOverride &&
@@ -1031,21 +1050,21 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
(config->redBits + config->greenBits + config->blueBits)))
|| ((config->drawableType & drawableTypeOverride) == 0))) {
if (!SetPixelFormat(hdc, winConfig->pixelFormatIndex, NULL)) {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
- /*
- However, in certain special cases this pixel format will be incompatible with the
- use we are going to put it to, so we need to re-evaluate the pixel format to use:
+ /*
+ However, in certain special cases this pixel format will be incompatible with the
+ use we are going to put it to, so we need to re-evaluate the pixel format to use:
- 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with
+ 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with
the cColorBits we asked for, so we need to ensure it matches the bpp of the bitmap
- 2) Applications may assume that visuals selected with glXChooseVisual() work with
+ 2) Applications may assume that visuals selected with glXChooseVisual() work with
pixmap drawables (there is no attribute to explicitly query for pixmap drawable
support as there is for glXChooseFBConfig())
(it's arguable this is an error in the application, but we try to make it work)
@@ -1054,35 +1073,35 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
by default, but if the actual drawable type we're trying to select the context
on (drawableTypeOverride) isn't supported by the selected fbConfig, reconsider
and see if we can find a suitable one...
- */
+ */
ErrorF
("glxWinSetPixelFormat: having second thoughts: cColorbits %d, bppOveride %d; config->drawableType %d, drawableTypeOverride %d\n",
(config->redBits + config->greenBits + config->blueBits), bppOverride,
config->drawableType, drawableTypeOverride);
if (!winScreen->has_WGL_ARB_pixel_format) {
- PIXELFORMATDESCRIPTOR pfd;
- int pixelFormat;
+ PIXELFORMATDESCRIPTOR pfd;
+ int pixelFormat;
- /* convert fbConfig to PFD */
+ /* convert fbConfig to PFD */
if (fbConfigToPixelFormat(gc->base.config, &pfd, drawableTypeOverride)) {
- ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n");
- return FALSE;
+ ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n");
+ return FALSE;
}
- if (glxWinDebugSettings.dumpPFD)
- pfdOut(&pfd);
+ if (glxWinDebugSettings.dumpPFD)
+ pfdOut(&pfd);
if (bppOverride) {
GLWIN_DEBUG_MSG("glxWinSetPixelFormat: Forcing bpp from %d to %d\n",
pfd.cColorBits, bppOverride);
- pfd.cColorBits = bppOverride;
+ pfd.cColorBits = bppOverride;
}
- pixelFormat = ChoosePixelFormat(hdc, &pfd);
+ pixelFormat = ChoosePixelFormat(hdc, &pfd);
if (pixelFormat == 0) {
- ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d",
@@ -1092,8 +1111,8 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
pixelFormat, winConfig->pixelFormatIndex);
if (!SetPixelFormat(hdc, pixelFormat, &pfd)) {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
}
else {
@@ -1101,8 +1120,8 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
fbConfigToPixelFormatIndex(hdc, gc->base.config,
drawableTypeOverride, winScreen);
if (pixelFormat == 0) {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d",
@@ -1112,142 +1131,142 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
pixelFormat, winConfig->pixelFormatIndex);
if (!SetPixelFormat(hdc, pixelFormat, NULL)) {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
}
- return TRUE;
+ return TRUE;
}
static HDC
glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw, HDC * hdc,
HWND * hwnd)
{
- *hdc = NULL;
- *hwnd = NULL;
+ *hdc = NULL;
+ *hwnd = NULL;
if (draw == NULL) {
GLWIN_TRACE_MSG("No drawable for context %p (native ctx %p)", gc,
gc->ctx);
- return NULL;
+ return NULL;
}
switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- WindowPtr pWin;
+ WindowPtr pWin;
- pWin = (WindowPtr) draw->base.pDraw;
+ pWin = (WindowPtr) draw->base.pDraw;
if (pWin == NULL) {
- GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin);
- return NULL;
+ GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin);
+ return NULL;
}
- *hwnd = winGetWindowInfo(pWin);
+ *hwnd = winGetWindowInfo(pWin);
if (*hwnd == NULL) {
- ErrorF("No HWND error: %s\n", glxWinErrorMessage());
- return NULL;
+ ErrorF("No HWND error: %s\n", glxWinErrorMessage());
+ return NULL;
}
- *hdc = GetDC(*hwnd);
+ *hdc = GetDC(*hwnd);
- if (*hdc == NULL)
- ErrorF("GetDC error: %s\n", glxWinErrorMessage());
+ if (*hdc == NULL)
+ ErrorF("GetDC error: %s\n", glxWinErrorMessage());
- /* Check if the hwnd has changed... */
+ /* Check if the hwnd has changed... */
if (*hwnd != gc->hwnd) {
- if (glxWinDebugSettings.enableTrace)
- GLWIN_DEBUG_HWND(*hwnd);
+ if (glxWinDebugSettings.enableTrace)
+ GLWIN_DEBUG_HWND(*hwnd);
GLWIN_TRACE_MSG
("for context %p (native ctx %p), hWnd changed from %p to %p",
gc, gc->ctx, gc->hwnd, *hwnd);
- gc->hwnd = *hwnd;
+ gc->hwnd = *hwnd;
- /* We must select a pixelformat, but SetPixelFormat can only be called once for a window... */
+ /* We must select a pixelformat, but SetPixelFormat can only be called once for a window... */
if (!glxWinSetPixelFormat(gc, *hdc, 0, GLX_WINDOW_BIT)) {
ErrorF("glxWinSetPixelFormat error: %s\n",
glxWinErrorMessage());
- ReleaseDC(*hwnd, *hdc);
- *hdc = NULL;
- return NULL;
+ ReleaseDC(*hwnd, *hdc);
+ *hdc = NULL;
+ return NULL;
}
}
}
- break;
+ break;
- case GLX_DRAWABLE_PBUFFER:
+ case GLX_DRAWABLE_PBUFFER:
{
- *hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer);
+ *hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer);
- if (*hdc == NULL)
- ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage());
+ if (*hdc == NULL)
+ ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage());
}
- break;
+ break;
- case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PIXMAP:
{
- *hdc = draw->dibDC;
+ *hdc = draw->dibDC;
}
- break;
+ break;
- default:
+ default:
{
ErrorF("glxWinMakeDC: tried to makeDC for unhandled drawable type %d\n",
draw->base.type);
}
- }
+ }
- if (glxWinDebugSettings.dumpDC)
- GLWIN_DEBUG_MSG("Got HDC %p", *hdc);
+ if (glxWinDebugSettings.dumpDC)
+ GLWIN_DEBUG_MSG("Got HDC %p", *hdc);
- return *hdc;
+ return *hdc;
}
static void
-glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw)
+glxWinReleaseDC(HWND hwnd, HDC hdc,__GLXWinDrawable *draw)
{
switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- ReleaseDC(hwnd, hdc);
+ ReleaseDC(hwnd, hdc);
}
- break;
+ break;
- case GLX_DRAWABLE_PBUFFER:
+ case GLX_DRAWABLE_PBUFFER:
{
if (!wglReleasePbufferDCARBWrapper(draw->hPbuffer, hdc)) {
- ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage());
+ ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage());
}
}
- break;
+ break;
- case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PIXMAP:
{
- // don't release DC, the memory DC lives as long as the bitmap
+ // don't release DC, the memory DC lives as long as the bitmap
- // We must ensure that all GDI drawing into the bitmap has completed
- // in case we subsequently access the bits from it
- GdiFlush();
+ // We must ensure that all GDI drawing into the bitmap has completed
+ // in case we subsequently access the bits from it
+ GdiFlush();
}
- break;
+ break;
- default:
+ default:
{
ErrorF
("glxWinReleaseDC: tried to releaseDC for unhandled drawable type %d\n",
draw->base.type);
}
- }
+ }
}
static void
-glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
+glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
{
- HDC dc;
- HWND hwnd;
+ HDC dc;
+ HWND hwnd;
GLWIN_DEBUG_MSG
("glxWinDeferredCreateContext: attach context %p to drawable %p", gc,
@@ -1256,7 +1275,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- WindowPtr pWin = (WindowPtr) draw->base.pDraw;
+ WindowPtr pWin = (WindowPtr) draw->base.pDraw;
if (!(gc->base.config->drawableType & GLX_WINDOW_BIT)) {
ErrorF
@@ -1264,36 +1283,36 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
}
if (pWin == NULL) {
- GLWIN_DEBUG_MSG("Deferring until X window is created");
- return;
+ GLWIN_DEBUG_MSG("Deferring until X window is created");
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pWin %p", pWin);
+ GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pWin %p", pWin);
if (winGetWindowInfo(pWin) == NULL) {
- GLWIN_DEBUG_MSG("Deferring until native window is created");
- return;
+ GLWIN_DEBUG_MSG("Deferring until native window is created");
+ return;
}
}
- break;
+ break;
case GLX_DRAWABLE_PBUFFER:
{
if (draw->hPbuffer == NULL) {
- __GLXscreen *screen;
- glxWinScreen *winScreen;
- int pixelFormat;
+ __GLXscreen *screen;
+ glxWinScreen *winScreen;
+ int pixelFormat;
- // XXX: which DC are supposed to use???
- HDC screenDC = GetDC(NULL);
+ // XXX: which DC are supposed to use???
+ HDC screenDC = GetDC(NULL);
if (!(gc->base.config->drawableType & GLX_PBUFFER_BIT)) {
ErrorF
("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PBUFFER_BIT to a GLX_DRAWABLE_PBUFFER drawable\n");
}
- screen = gc->base.pGlxScreen;
- winScreen = (glxWinScreen *) screen;
+ screen = gc->base.pGlxScreen;
+ winScreen = (glxWinScreen *)screen;
pixelFormat =
fbConfigToPixelFormatIndex(screenDC, gc->base.config,
@@ -1301,19 +1320,19 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
if (pixelFormat == 0) {
ErrorF("wglChoosePixelFormat error: %s\n",
glxWinErrorMessage());
- return;
+ return;
}
draw->hPbuffer =
wglCreatePbufferARBWrapper(screenDC, pixelFormat,
draw->base.pDraw->width,
draw->base.pDraw->height, NULL);
- ReleaseDC(NULL, screenDC);
+ ReleaseDC(NULL, screenDC);
if (draw->hPbuffer == NULL) {
ErrorF("wglCreatePbufferARBWrapper error: %s\n",
glxWinErrorMessage());
- return;
+ return;
}
GLWIN_DEBUG_MSG
@@ -1321,55 +1340,55 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
draw->hPbuffer, draw);
}
}
- break;
+ break;
case GLX_DRAWABLE_PIXMAP:
{
if (draw->dibDC == NULL) {
- BITMAPINFOHEADER bmpHeader;
- void *pBits;
+ BITMAPINFOHEADER bmpHeader;
+ void *pBits;
- memset(&bmpHeader, 0, sizeof(BITMAPINFOHEADER));
- bmpHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmpHeader.biWidth = draw->base.pDraw->width;
- bmpHeader.biHeight = draw->base.pDraw->height;
- bmpHeader.biPlanes = 1;
- bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel;
- bmpHeader.biCompression = BI_RGB;
+ memset (&bmpHeader, 0, sizeof(BITMAPINFOHEADER));
+ bmpHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmpHeader.biWidth = draw->base.pDraw->width;
+ bmpHeader.biHeight = draw->base.pDraw->height;
+ bmpHeader.biPlanes = 1;
+ bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel;
+ bmpHeader.biCompression = BI_RGB;
if (!(gc->base.config->drawableType & GLX_PIXMAP_BIT)) {
ErrorF
("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PIXMAP_BIT to a GLX_DRAWABLE_PIXMAP drawable\n");
}
- draw->dibDC = CreateCompatibleDC(NULL);
+ draw->dibDC = CreateCompatibleDC(NULL);
if (draw->dibDC == NULL) {
- ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage());
- return;
+ ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage());
+ return;
}
draw->hDIB =
CreateDIBSection(draw->dibDC, (BITMAPINFO *) & bmpHeader,
DIB_RGB_COLORS, &pBits, 0, 0);
if (draw->dibDC == NULL) {
- ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
- return;
+ ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
+ return;
}
- // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to
- // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits
- // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are
- // even compatible ...
- draw->pOldBits = ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr;
- ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr = pBits;
+ // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to
+ // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits
+ // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are
+ // even compatible ...
+ draw->pOldBits = ((PixmapPtr)draw->base.pDraw)->devPrivate.ptr;
+ ((PixmapPtr)draw->base.pDraw)->devPrivate.ptr = pBits;
- // Select the DIB into the DC
- draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB);
+ // Select the DIB into the DC
+ draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB);
if (!draw->hOldDIB) {
- ErrorF("SelectObject error: %s\n", glxWinErrorMessage());
+ ErrorF("SelectObject error: %s\n", glxWinErrorMessage());
}
- // Set the pixel format of the bitmap
+ // Set the pixel format of the bitmap
glxWinSetPixelFormat(gc, draw->dibDC,
draw->base.pDraw->bitsPerPixel,
GLX_PIXMAP_BIT);
@@ -1379,38 +1398,38 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
draw->hDIB, draw);
}
}
- break;
+ break;
default:
{
ErrorF
("glxWinDeferredCreateContext: tried to attach unhandled drawable type %d\n",
draw->base.type);
- return;
- }
+ return;
}
+ }
- dc = glxWinMakeDC(gc, draw, &dc, &hwnd);
- gc->ctx = wglCreateContext(dc);
- glxWinReleaseDC(hwnd, dc, draw);
+ dc = glxWinMakeDC(gc, draw, &dc, &hwnd);
+ gc->ctx = wglCreateContext(dc);
+ glxWinReleaseDC(hwnd, dc, draw);
if (gc->ctx == NULL) {
- ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage());
- return;
+ ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage());
+ return;
}
GLWIN_DEBUG_MSG
("glxWinDeferredCreateContext: attached context %p to native context %p drawable %p",
gc, gc->ctx, draw);
- // if the native context was created successfully, shareLists if needed
+ // if the native context was created successfully, shareLists if needed
if (gc->ctx && gc->shareContext) {
GLWIN_DEBUG_MSG
("glxWinCreateContextReal shareLists with context %p (native ctx %p)",
gc->shareContext, gc->shareContext->ctx);
if (!wglShareLists(gc->shareContext->ctx, gc->ctx)) {
- ErrorF("wglShareLists error: %s\n", glxWinErrorMessage());
+ ErrorF("wglShareLists error: %s\n", glxWinErrorMessage());
}
}
}
@@ -1422,175 +1441,175 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
/* Context manipulation routines should return TRUE on success, FALSE on failure */
static int
-glxWinContextMakeCurrent(__GLXcontext * base)
+glxWinContextMakeCurrent(__GLXcontext *base)
{
- __GLXWinContext *gc = (__GLXWinContext *) base;
- BOOL ret;
- HDC drawDC;
- HDC readDC = NULL;
- __GLXdrawable *drawPriv;
- __GLXdrawable *readPriv = NULL;
- HWND hDrawWnd;
- HWND hReadWnd;
+ __GLXWinContext *gc = (__GLXWinContext *)base;
+ BOOL ret;
+ HDC drawDC;
+ HDC readDC = NULL;
+ __GLXdrawable *drawPriv;
+ __GLXdrawable *readPriv = NULL;
+ HWND hDrawWnd;
+ HWND hReadWnd;
GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc,
gc->ctx);
- glWinCallDelta();
+ glWinCallDelta();
- /* Keep a note of the last active context in the drawable */
- drawPriv = gc->base.drawPriv;
- ((__GLXWinDrawable *) drawPriv)->drawContext = gc;
+ /* Keep a note of the last active context in the drawable */
+ drawPriv = gc->base.drawPriv;
+ ((__GLXWinDrawable *)drawPriv)->drawContext = gc;
if (gc->ctx == NULL) {
- glxWinDeferredCreateContext(gc, (__GLXWinDrawable *) drawPriv);
+ glxWinDeferredCreateContext(gc, (__GLXWinDrawable *)drawPriv);
}
if (gc->ctx == NULL) {
- ErrorF("glxWinContextMakeCurrent: Native context is NULL\n");
- return FALSE;
+ ErrorF("glxWinContextMakeCurrent: Native context is NULL\n");
+ return FALSE;
}
drawDC =
glxWinMakeDC(gc, (__GLXWinDrawable *) drawPriv, &drawDC, &hDrawWnd);
if (drawDC == NULL) {
- ErrorF("glxWinMakeDC failed for drawDC\n");
- return FALSE;
+ ErrorF("glxWinMakeDC failed for drawDC\n");
+ return FALSE;
}
if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv)) {
- // XXX: should only occur with WGL_ARB_make_current_read
- /*
- If there is a separate read drawable, create a separate read DC, and
- use the wglMakeContextCurrent extension to make the context current drawing
- to one DC and reading from the other
- */
- readPriv = gc->base.readPriv;
+ // XXX: should only occur with WGL_ARB_make_current_read
+ /*
+ If there is a separate read drawable, create a separate read DC, and
+ use the wglMakeContextCurrent extension to make the context current drawing
+ to one DC and reading from the other
+ */
+ readPriv = gc->base.readPriv;
readDC =
glxWinMakeDC(gc, (__GLXWinDrawable *) readPriv, &readDC, &hReadWnd);
if (readDC == NULL) {
- ErrorF("glxWinMakeDC failed for readDC\n");
- glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *) drawPriv);
- return FALSE;
+ ErrorF("glxWinMakeDC failed for readDC\n");
+ glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *)drawPriv);
+ return FALSE;
}
- ret = wglMakeContextCurrentARBWrapper(drawDC, readDC, gc->ctx);
+ ret = wglMakeContextCurrentARBWrapper(drawDC, readDC, gc->ctx);
if (!ret) {
ErrorF("wglMakeContextCurrentARBWrapper error: %s\n",
glxWinErrorMessage());
}
}
else {
- /* Otherwise, just use wglMakeCurrent */
- ret = wglMakeCurrent(drawDC, gc->ctx);
+ /* Otherwise, just use wglMakeCurrent */
+ ret = wglMakeCurrent(drawDC, gc->ctx);
if (!ret) {
- ErrorF("wglMakeCurrent error: %s\n", glxWinErrorMessage());
+ ErrorF("wglMakeCurrent error: %s\n", glxWinErrorMessage());
}
}
- // apparently make current could fail if the context is current in a different thread,
- // but that shouldn't be able to happen in the current server...
+ // apparently make current could fail if the context is current in a different thread,
+ // but that shouldn't be able to happen in the current server...
- glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *) drawPriv);
- if (readDC)
- glxWinReleaseDC(hReadWnd, readDC, (__GLXWinDrawable *) readPriv);
+ glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *)drawPriv);
+ if (readDC)
+ glxWinReleaseDC(hReadWnd, readDC, (__GLXWinDrawable *)readPriv);
- return ret;
+ return ret;
}
static int
-glxWinContextLoseCurrent(__GLXcontext * base)
+glxWinContextLoseCurrent(__GLXcontext *base)
{
- BOOL ret;
- __GLXWinContext *gc = (__GLXWinContext *) base;
+ BOOL ret;
+ __GLXWinContext *gc = (__GLXWinContext *)base;
GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc,
gc->ctx);
- glWinCallDelta();
+ glWinCallDelta();
- /*
- An error seems to be reported if we try to make no context current
- if there is already no current context, so avoid doing that...
- */
+ /*
+ An error seems to be reported if we try to make no context current
+ if there is already no current context, so avoid doing that...
+ */
if (__glXLastContext != NULL) {
- ret = wglMakeCurrent(NULL, NULL); /* We don't need a DC when setting no current context */
- if (!ret)
+ ret = wglMakeCurrent(NULL, NULL); /* We don't need a DC when setting no current context */
+ if (!ret)
ErrorF("glxWinContextLoseCurrent error: %s\n",
glxWinErrorMessage());
}
- return TRUE;
+ return TRUE;
}
static int
glxWinContextCopy(__GLXcontext * dst_base, __GLXcontext * src_base,
unsigned long mask)
{
- __GLXWinContext *dst = (__GLXWinContext *) dst_base;
- __GLXWinContext *src = (__GLXWinContext *) src_base;
- BOOL ret;
+ __GLXWinContext *dst = (__GLXWinContext *)dst_base;
+ __GLXWinContext *src = (__GLXWinContext *)src_base;
+ BOOL ret;
- GLWIN_DEBUG_MSG("glxWinContextCopy");
+ GLWIN_DEBUG_MSG("glxWinContextCopy");
- ret = wglCopyContext(src->ctx, dst->ctx, mask);
+ ret = wglCopyContext(src->ctx, dst->ctx, mask);
if (!ret) {
- ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage());
+ ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage());
}
- return ret;
+ return ret;
}
static void
-glxWinContextDestroy(__GLXcontext * base)
+glxWinContextDestroy(__GLXcontext *base)
{
- __GLXWinContext *gc = (__GLXWinContext *) base;
+ __GLXWinContext *gc = (__GLXWinContext *)base;
if (gc != NULL) {
GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base,
gc->ctx);
if (gc->ctx) {
- /* It's bad style to delete the context while it's still current */
+ /* It's bad style to delete the context while it's still current */
if (wglGetCurrentContext() == gc->ctx) {
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(NULL, NULL);
}
- {
- BOOL ret = wglDeleteContext(gc->ctx);
+ {
+ BOOL ret = wglDeleteContext(gc->ctx);
- if (!ret)
+ if (!ret)
ErrorF("wglDeleteContext error: %s\n",
glxWinErrorMessage());
- }
+ }
- gc->ctx = NULL;
+ gc->ctx = NULL;
}
- free(gc);
+ free(gc);
}
}
static __GLXcontext *
-glxWinCreateContext(__GLXscreen * screen,
+glxWinCreateContext(__GLXscreen *screen,
__GLXconfig * modes, __GLXcontext * baseShareContext)
{
__GLXWinContext *context;
- __GLXWinContext *shareContext = (__GLXWinContext *) baseShareContext;
+ __GLXWinContext *shareContext = (__GLXWinContext *)baseShareContext;
static __GLXtextureFromPixmap glxWinTextureFromPixmap = {
glxWinBindTexImage,
glxWinReleaseTexImage
- };
+ };
- context = (__GLXWinContext *) calloc(1, sizeof(__GLXWinContext));
+ context = (__GLXWinContext *)calloc(1, sizeof(__GLXWinContext));
if (!context)
return NULL;
memset(context, 0, sizeof *context);
- context->base.destroy = glxWinContextDestroy;
- context->base.makeCurrent = glxWinContextMakeCurrent;
- context->base.loseCurrent = glxWinContextLoseCurrent;
- context->base.copy = glxWinContextCopy;
+ context->base.destroy = glxWinContextDestroy;
+ context->base.makeCurrent = glxWinContextMakeCurrent;
+ context->base.loseCurrent = glxWinContextLoseCurrent;
+ context->base.copy = glxWinContextCopy;
context->base.textureFromPixmap = &glxWinTextureFromPixmap;
context->base.config = modes;
context->base.pGlxScreen = screen;
@@ -1616,29 +1635,29 @@ fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret,
int drawableTypeOverride)
{
PIXELFORMATDESCRIPTOR pfd = {
- sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */
- 1, /* version number */
- PFD_SUPPORT_OPENGL, /* support OpenGL */
- PFD_TYPE_RGBA, /* RGBA type */
- 24, /* 24-bit color depth */
- 0, 0, 0, 0, 0, 0, /* color bits ignored */
- 0, /* no alpha buffer */
- 0, /* shift bit ignored */
- 0, /* no accumulation buffer */
- 0, 0, 0, 0, /* accum bits ignored */
- 32, /* 32-bit z-buffer */
- 0, /* no stencil buffer */
- 0, /* no auxiliary buffer */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
- 0, 0, 0 /* layer masks ignored */
+ sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */
+ 1, /* version number */
+ PFD_SUPPORT_OPENGL, /* support OpenGL */
+ PFD_TYPE_RGBA, /* RGBA type */
+ 24, /* 24-bit color depth */
+ 0, 0, 0, 0, 0, 0, /* color bits ignored */
+ 0, /* no alpha buffer */
+ 0, /* shift bit ignored */
+ 0, /* no accumulation buffer */
+ 0, 0, 0, 0, /* accum bits ignored */
+ 32, /* 32-bit z-buffer */
+ 0, /* no stencil buffer */
+ 0, /* no auxiliary buffer */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
+ 0, 0, 0 /* layer masks ignored */
};
if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
- pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */
+ pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */
if ((mode->drawableType | drawableTypeOverride) & GLX_PIXMAP_BIT)
- pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */
+ pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */
if (mode->stereoMode) {
pfd.dwFlags |= PFD_STEREO;
@@ -1650,13 +1669,13 @@ fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret,
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = mode->redBits + mode->greenBits + mode->blueBits;
pfd.cRedBits = mode->redBits;
- pfd.cRedShift = 0; /* FIXME */
+ pfd.cRedShift = 0; /* FIXME */
pfd.cGreenBits = mode->greenBits;
- pfd.cGreenShift = 0; /* FIXME */
+ pfd.cGreenShift = 0; /* FIXME */
pfd.cBlueBits = mode->blueBits;
- pfd.cBlueShift = 0; /* FIXME */
+ pfd.cBlueShift = 0; /* FIXME */
pfd.cAlphaBits = mode->alphaBits;
- pfd.cAlphaShift = 0; /* FIXME */
+ pfd.cAlphaShift = 0; /* FIXME */
pfd.cAccumBits =
mode->accumRedBits + mode->accumGreenBits + mode->accumBlueBits +
@@ -1684,13 +1703,13 @@ static int
fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
int drawableTypeOverride, glxWinScreen * winScreen)
{
- UINT numFormats;
- unsigned int i = 0;
+ UINT numFormats;
+ unsigned int i = 0;
- /* convert fbConfig to attr-value list */
- int attribList[60];
+ /* convert fbConfig to attr-value list */
+ int attribList[60];
- SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE);
+ SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE);
SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB,
(mode->visualType ==
GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB :
@@ -1698,81 +1717,81 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
SET_ATTR_VALUE(WGL_COLOR_BITS_ARB,
(mode->visualType ==
GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits);
- SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits);
- SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits);
- SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits);
- SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits);
- SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits);
- SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits);
- SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits);
- SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits);
- SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits);
- SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits);
- SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers);
-
- if (mode->doubleBufferMode)
- SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE);
-
- if (mode->stereoMode)
- SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE);
-
- // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft..
- if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML)
- SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
-
- if (mode->swapMethod == GLX_SWAP_COPY_OML)
- SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
-
- // XXX: this should probably be the other way around, but that messes up drawableTypeOverride
- if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
- SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB);
-
- // must support all the drawable types the mode supports
- if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, TRUE);
-
- // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea
- // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride)
+ SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits);
+ SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits);
+ SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits);
+ SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits);
+ SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits);
+ SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits);
+ SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits);
+ SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits);
+ SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits);
+ SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits);
+ SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers);
+
+ if (mode->doubleBufferMode)
+ SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE);
+
+ if (mode->stereoMode)
+ SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE);
+
+ // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft..
+ if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML)
+ SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
+
+ if (mode->swapMethod == GLX_SWAP_COPY_OML)
+ SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
+
+ // XXX: this should probably be the other way around, but that messes up drawableTypeOverride
+ if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
+ SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB);
+
+ // must support all the drawable types the mode supports
+ if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB,TRUE);
+
+ // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea
+ // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride)
if (drawableTypeOverride == GLX_WINDOW_BIT) {
- if (mode->drawableType & GLX_PIXMAP_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+ if (mode->drawableType & GLX_PIXMAP_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
- if (mode->drawableType & GLX_PBUFFER_BIT)
- if (winScreen->has_WGL_ARB_pbuffer)
- SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+ if (mode->drawableType & GLX_PBUFFER_BIT)
+ if (winScreen->has_WGL_ARB_pbuffer)
+ SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
else {
- if (drawableTypeOverride & GLX_PIXMAP_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+ if (drawableTypeOverride & GLX_PIXMAP_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
- if (drawableTypeOverride & GLX_PBUFFER_BIT)
- if (winScreen->has_WGL_ARB_pbuffer)
- SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+ if (drawableTypeOverride & GLX_PBUFFER_BIT)
+ if (winScreen->has_WGL_ARB_pbuffer)
+ SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
- SET_ATTR_VALUE(0, 0); // terminator
+ SET_ATTR_VALUE(0, 0); // terminator
- /* choose the first match */
- {
- int pixelFormatIndex;
+ /* choose the first match */
+ {
+ int pixelFormatIndex;
if (!wglChoosePixelFormatARBWrapper
(hdc, attribList, NULL, 1, &pixelFormatIndex, &numFormats)) {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- }
+ ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ }
else {
if (numFormats > 0) {
GLWIN_DEBUG_MSG
("wglChoosePixelFormat: chose pixelFormatIndex %d)",
pixelFormatIndex);
- return pixelFormatIndex;
- }
- else
- ErrorF("wglChoosePixelFormat couldn't decide\n");
- }
- }
+ return pixelFormatIndex;
+ }
+ else
+ ErrorF("wglChoosePixelFormat couldn't decide\n");
+ }
+ }
- return 0;
+ return 0;
}
/* ---------------------------------------------------------------------- */
@@ -1783,42 +1802,40 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
// Create the GLXconfigs using DescribePixelFormat()
//
static void
-glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
+glxWinCreateConfigs(HDC hdc, glxWinScreen *screen)
{
- GLXWinConfig *c, *result, *prev = NULL;
- int numConfigs = 0;
- int i = 0;
- int n = 0;
- PIXELFORMATDESCRIPTOR pfd;
+ GLXWinConfig *c, *result, *prev = NULL;
+ int numConfigs = 0;
+ int i = 0;
+ int n = 0;
+ PIXELFORMATDESCRIPTOR pfd;
- GLWIN_DEBUG_MSG("glxWinCreateConfigs");
+ GLWIN_DEBUG_MSG("glxWinCreateConfigs");
- screen->base.numFBConfigs = 0;
- screen->base.fbconfigs = NULL;
+ screen->base.numFBConfigs = 0;
+ screen->base.fbconfigs = NULL;
- // get the number of pixelformats
- numConfigs =
- DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
- GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats",
- numConfigs);
+ // get the number of pixelformats
+ numConfigs = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
+ LogMessage(X_INFO, "%d pixel formats reported by DescribePixelFormat\n", numConfigs);
- /* alloc */
- result = malloc(sizeof(GLXWinConfig) * numConfigs);
+ /* alloc */
+ result = malloc(sizeof(GLXWinConfig) * numConfigs);
if (NULL == result) {
- return;
+ return;
}
- memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
- n = 0;
+ memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
+ n = 0;
- /* fill in configs */
+ /* fill in configs */
for (i = 0; i < numConfigs; i++) {
- int rc;
+ int rc;
- c = &(result[i]);
- c->base.next = NULL;
- c->pixelFormatIndex = i + 1;
+ c = &(result[i]);
+ c->base.next = NULL;
+ c->pixelFormatIndex = i+1;
rc = DescribePixelFormat(hdc, i + 1, sizeof(PIXELFORMATDESCRIPTOR),
&pfd);
@@ -1826,30 +1843,30 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
if (!rc) {
ErrorF("DescribePixelFormat failed for index %d, error %s\n", i + 1,
glxWinErrorMessage());
- break;
+ break;
}
- if (glxWinDebugSettings.dumpPFD)
- pfdOut(&pfd);
+ if (glxWinDebugSettings.dumpPFD)
+ pfdOut(&pfd);
if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) ||
!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) {
GLWIN_DEBUG_MSG
("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i + 1,
pfd.dwFlags);
- continue;
+ continue;
}
c->base.doubleBufferMode =
(pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE;
- c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
+ c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
- c->base.redBits = pfd.cRedBits;
- c->base.greenBits = pfd.cGreenBits;
- c->base.blueBits = pfd.cBlueBits;
- c->base.alphaBits = pfd.cAlphaBits;
+ c->base.redBits = pfd.cRedBits;
+ c->base.greenBits = pfd.cGreenBits;
+ c->base.blueBits = pfd.cBlueBits;
+ c->base.alphaBits = pfd.cAlphaBits;
- c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift);
+ c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift);
c->base.greenMask =
BITS_AND_SHIFT_TO_MASK(pfd.cGreenBits, pfd.cGreenShift);
c->base.blueMask =
@@ -1857,143 +1874,143 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
c->base.alphaMask =
BITS_AND_SHIFT_TO_MASK(pfd.cAlphaBits, pfd.cAlphaShift);
- c->base.rgbBits = pfd.cColorBits;
+ c->base.rgbBits = pfd.cColorBits;
if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
- c->base.indexBits = pfd.cColorBits;
+ c->base.indexBits = pfd.cColorBits;
}
else {
- c->base.indexBits = 0;
+ c->base.indexBits = 0;
}
- c->base.accumRedBits = pfd.cAccumRedBits;
- c->base.accumGreenBits = pfd.cAccumGreenBits;
- c->base.accumBlueBits = pfd.cAccumBlueBits;
- c->base.accumAlphaBits = pfd.cAccumAlphaBits;
- // pfd.cAccumBits;
+ c->base.accumRedBits = pfd.cAccumRedBits;
+ c->base.accumGreenBits = pfd.cAccumGreenBits;
+ c->base.accumBlueBits = pfd.cAccumBlueBits;
+ c->base.accumAlphaBits = pfd.cAccumAlphaBits;
+ // pfd.cAccumBits;
- c->base.depthBits = pfd.cDepthBits;
- c->base.stencilBits = pfd.cStencilBits;
- c->base.numAuxBuffers = pfd.cAuxBuffers;
+ c->base.depthBits = pfd.cDepthBits;
+ c->base.stencilBits = pfd.cStencilBits;
+ c->base.numAuxBuffers = pfd.cAuxBuffers;
- // pfd.iLayerType; // ignored
- c->base.level = 0;
- // pfd.dwLayerMask; // ignored
- // pfd.dwDamageMask; // ignored
+ // pfd.iLayerType; // ignored
+ c->base.level = 0;
+ // pfd.dwLayerMask; // ignored
+ // pfd.dwDamageMask; // ignored
- c->base.pixmapMode = 0;
- c->base.visualID = -1; // will be set by __glXScreenInit()
+ c->base.pixmapMode = 0;
+ c->base.visualID = -1; // will be set by __glXScreenInit()
- /* EXT_visual_rating / GLX 1.2 */
+ /* EXT_visual_rating / GLX 1.2 */
if (pfd.dwFlags & PFD_GENERIC_FORMAT) {
- c->base.visualRating = GLX_SLOW_VISUAL_EXT;
+ c->base.visualRating = GLX_SLOW_VISUAL_EXT;
}
else {
- // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated...
- c->base.visualRating = GLX_NONE_EXT;
+ // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated...
+ c->base.visualRating = GLX_NONE_EXT;
}
- /* EXT_visual_info / GLX 1.2 */
+ /* EXT_visual_info / GLX 1.2 */
if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
- c->base.visualType = GLX_STATIC_COLOR;
+ c->base.visualType = GLX_STATIC_COLOR;
if (!getenv("GLWIN_ENABLE_COLORINDEX_FBCONFIGS")) {
GLWIN_DEBUG_MSG
("pixelFormat %d is PFD_TYPE_COLORINDEX, skipping", i + 1);
- continue;
+ continue;
}
}
else {
- c->base.visualType = GLX_TRUE_COLOR;
+ c->base.visualType = GLX_TRUE_COLOR;
}
- // pfd.dwVisibleMask; ???
- c->base.transparentPixel = GLX_NONE;
- c->base.transparentRed = GLX_NONE;
- c->base.transparentGreen = GLX_NONE;
- c->base.transparentBlue = GLX_NONE;
- c->base.transparentAlpha = GLX_NONE;
- c->base.transparentIndex = GLX_NONE;
+ // pfd.dwVisibleMask; ???
+ c->base.transparentPixel = GLX_NONE;
+ c->base.transparentRed = GLX_NONE;
+ c->base.transparentGreen = GLX_NONE;
+ c->base.transparentBlue = GLX_NONE;
+ c->base.transparentAlpha = GLX_NONE;
+ c->base.transparentIndex = GLX_NONE;
- /* ARB_multisample / SGIS_multisample */
- c->base.sampleBuffers = 0;
- c->base.samples = 0;
+ /* ARB_multisample / SGIS_multisample */
+ c->base.sampleBuffers = 0;
+ c->base.samples = 0;
- /* SGIX_fbconfig / GLX 1.3 */
+ /* SGIX_fbconfig / GLX 1.3 */
c->base.drawableType =
(((pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? GLX_WINDOW_BIT : 0)
- | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0));
+ | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0));
if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
- c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
+ c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
}
else {
- c->base.renderType = GLX_RGBA_BIT;
+ c->base.renderType = GLX_RGBA_BIT;
}
- c->base.xRenderable = GL_TRUE;
- c->base.fbconfigID = -1; // will be set by __glXScreenInit()
+ c->base.xRenderable = GL_TRUE;
+ c->base.fbconfigID = -1; // will be set by __glXScreenInit()
- /* SGIX_pbuffer / GLX 1.3 */
- // XXX: How can we find these values out ???
- c->base.maxPbufferWidth = -1;
- c->base.maxPbufferHeight = -1;
- c->base.maxPbufferPixels = -1;
- c->base.optimalPbufferWidth = 0; // there is no optimal value
- c->base.optimalPbufferHeight = 0;
+ /* SGIX_pbuffer / GLX 1.3 */
+ // XXX: How can we find these values out ???
+ c->base.maxPbufferWidth = -1;
+ c->base.maxPbufferHeight = -1;
+ c->base.maxPbufferPixels = -1;
+ c->base.optimalPbufferWidth = 0; // there is no optimal value
+ c->base.optimalPbufferHeight = 0;
- /* SGIX_visual_select_group */
- // arrange for visuals with the best acceleration to be preferred in selection
+ /* SGIX_visual_select_group */
+ // arrange for visuals with the best acceleration to be preferred in selection
switch (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) {
case 0:
- c->base.visualSelectGroup = 2;
- break;
+ c->base.visualSelectGroup = 2;
+ break;
case PFD_GENERIC_ACCELERATED:
- c->base.visualSelectGroup = 1;
- break;
+ c->base.visualSelectGroup = 1;
+ break;
case PFD_GENERIC_FORMAT:
- c->base.visualSelectGroup = 0;
- break;
+ c->base.visualSelectGroup = 0;
+ break;
default:
- ;
- // "can't happen"
+ ;
+ // "can't happen"
}
- /* OML_swap_method */
- if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
- c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
- else if (pfd.dwFlags & PFD_SWAP_COPY)
- c->base.swapMethod = GLX_SWAP_COPY_OML;
- else
- c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
+ /* OML_swap_method */
+ if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
+ c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
+ else if (pfd.dwFlags & PFD_SWAP_COPY)
+ c->base.swapMethod = GLX_SWAP_COPY_OML;
+ else
+ c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
- /* EXT_import_context */
- c->base.screen = screen->base.pScreen->myNum;
+ /* EXT_import_context */
+ c->base.screen = screen->base.pScreen->myNum;
- /* EXT_texture_from_pixmap */
- c->base.bindToTextureRgb = -1;
- c->base.bindToTextureRgba = -1;
- c->base.bindToMipmapTexture = -1;
- c->base.bindToTextureTargets = -1;
- c->base.yInverted = -1;
+ /* EXT_texture_from_pixmap */
+ c->base.bindToTextureRgb = -1;
+ c->base.bindToTextureRgba = -1;
+ c->base.bindToMipmapTexture = -1;
+ c->base.bindToTextureTargets = -1;
+ c->base.yInverted = -1;
- n++;
+ n++;
- // update previous config to point to this config
- if (prev)
- prev->base.next = &(c->base);
+ // update previous config to point to this config
+ if (prev)
+ prev->base.next = &(c->base);
- prev = c;
+ prev = c;
}
GLWIN_DEBUG_MSG
("found %d pixelFormats suitable for conversion to fbConfigs", n);
- screen->base.numFBConfigs = n;
- screen->base.fbconfigs = &(result->base);
+ screen->base.numFBConfigs = n;
+ screen->base.fbconfigs = &(result->base);
}
// helper function to access an attribute value from an attribute value array by attribute
@@ -2002,132 +2019,130 @@ static
getAttrValue(const int attrs[], int values[], unsigned int num, int attr,
int fallback)
{
- unsigned int i;
+ unsigned int i;
for (i = 0; i < num; i++) {
if (attrs[i] == attr) {
GLWIN_TRACE_MSG("getAttrValue attr 0x%x, value %d", attr,
values[i]);
- return values[i];
+ return values[i];
}
}
ErrorF("getAttrValue failed to find attr 0x%x, using default value %d\n",
attr, fallback);
- return fallback;
+ return fallback;
}
//
// Create the GLXconfigs using wglGetPixelFormatAttribfvARB() extension
//
static void
-glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
+glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen)
{
- GLXWinConfig *c, *result, *prev = NULL;
- int i = 0;
- int n = 0;
+ GLXWinConfig *c, *result, *prev = NULL;
+ int i = 0;
+ int n = 0;
- const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB;
- int numConfigs;
+ const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB;
+ int numConfigs;
- int attrs[50];
- unsigned int num_attrs = 0;
+ int attrs[50];
+ unsigned int num_attrs = 0;
- GLWIN_DEBUG_MSG("glxWinCreateConfigsExt");
+ GLWIN_DEBUG_MSG("glxWinCreateConfigsExt");
- screen->base.numFBConfigs = 0;
- screen->base.fbconfigs = NULL;
+ screen->base.numFBConfigs = 0;
+ screen->base.fbconfigs = NULL;
if (!wglGetPixelFormatAttribivARBWrapper(hdc, 0, 0, 1, &attr, &numConfigs)) {
ErrorF
("wglGetPixelFormatAttribivARB failed for WGL_NUMBER_PIXEL_FORMATS_ARB: %s\n",
glxWinErrorMessage());
- return;
+ return;
}
- GLWIN_DEBUG_MSG
- ("wglGetPixelFormatAttribivARB says %d possible pixel formats",
- numConfigs);
+ LogMessage(X_INFO, "%d pixel formats reported by wglGetPixelFormatAttribivARB\n", numConfigs);
- /* alloc */
- result = malloc(sizeof(GLXWinConfig) * numConfigs);
+ /* alloc */
+ result = malloc(sizeof(GLXWinConfig) * numConfigs);
if (NULL == result) {
- return;
+ return;
}
- memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
- n = 0;
+ memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
+ n = 0;
#define ADD_ATTR(a) { attrs[num_attrs++] = a; assert(num_attrs < NUM_ELEMENTS(attrs)); }
- ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB);
- ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB);
- ADD_ATTR(WGL_ACCELERATION_ARB);
- ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB);
- ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB);
- ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB);
- ADD_ATTR(WGL_TRANSPARENT_ARB);
- ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB);
- ADD_ATTR(WGL_SUPPORT_OPENGL_ARB);
- ADD_ATTR(WGL_DOUBLE_BUFFER_ARB);
- ADD_ATTR(WGL_STEREO_ARB);
- ADD_ATTR(WGL_PIXEL_TYPE_ARB);
- ADD_ATTR(WGL_COLOR_BITS_ARB);
- ADD_ATTR(WGL_RED_BITS_ARB);
- ADD_ATTR(WGL_RED_SHIFT_ARB);
- ADD_ATTR(WGL_GREEN_BITS_ARB);
- ADD_ATTR(WGL_GREEN_SHIFT_ARB);
- ADD_ATTR(WGL_BLUE_BITS_ARB);
- ADD_ATTR(WGL_BLUE_SHIFT_ARB);
- ADD_ATTR(WGL_ALPHA_BITS_ARB);
- ADD_ATTR(WGL_ALPHA_SHIFT_ARB);
- ADD_ATTR(WGL_ACCUM_RED_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB);
- ADD_ATTR(WGL_DEPTH_BITS_ARB);
- ADD_ATTR(WGL_STENCIL_BITS_ARB);
- ADD_ATTR(WGL_AUX_BUFFERS_ARB);
- ADD_ATTR(WGL_SWAP_METHOD_ARB);
+ ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB);
+ ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB);
+ ADD_ATTR(WGL_ACCELERATION_ARB);
+ ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB);
+ ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB);
+ ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB);
+ ADD_ATTR(WGL_SUPPORT_OPENGL_ARB);
+ ADD_ATTR(WGL_DOUBLE_BUFFER_ARB);
+ ADD_ATTR(WGL_STEREO_ARB);
+ ADD_ATTR(WGL_PIXEL_TYPE_ARB);
+ ADD_ATTR(WGL_COLOR_BITS_ARB);
+ ADD_ATTR(WGL_RED_BITS_ARB);
+ ADD_ATTR(WGL_RED_SHIFT_ARB);
+ ADD_ATTR(WGL_GREEN_BITS_ARB);
+ ADD_ATTR(WGL_GREEN_SHIFT_ARB);
+ ADD_ATTR(WGL_BLUE_BITS_ARB);
+ ADD_ATTR(WGL_BLUE_SHIFT_ARB);
+ ADD_ATTR(WGL_ALPHA_BITS_ARB);
+ ADD_ATTR(WGL_ALPHA_SHIFT_ARB);
+ ADD_ATTR(WGL_ACCUM_RED_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB);
+ ADD_ATTR(WGL_DEPTH_BITS_ARB);
+ ADD_ATTR(WGL_STENCIL_BITS_ARB);
+ ADD_ATTR(WGL_AUX_BUFFERS_ARB);
+ ADD_ATTR(WGL_SWAP_METHOD_ARB);
if (screen->has_WGL_ARB_multisample) {
- // we may not query these attrs if WGL_ARB_multisample is not offered
- ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB);
- ADD_ATTR(WGL_SAMPLES_ARB);
+ // we may not query these attrs if WGL_ARB_multisample is not offered
+ ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB);
+ ADD_ATTR(WGL_SAMPLES_ARB);
}
if (screen->has_WGL_ARB_render_texture) {
- // we may not query these attrs if WGL_ARB_render_texture is not offered
- ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB);
- ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB);
+ // we may not query these attrs if WGL_ARB_render_texture is not offered
+ ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB);
+ ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB);
}
if (screen->has_WGL_ARB_pbuffer) {
- // we may not query these attrs if WGL_ARB_pbuffer is not offered
- ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
+ // we may not query these attrs if WGL_ARB_pbuffer is not offered
+ ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
}
- /* fill in configs */
+ /* fill in configs */
for (i = 0; i < numConfigs; i++) {
- int values[num_attrs];
+ int values[num_attrs];
- c = &(result[i]);
- c->base.next = NULL;
- c->pixelFormatIndex = i + 1;
+ c = &(result[i]);
+ c->base.next = NULL;
+ c->pixelFormatIndex = i+1;
if (!wglGetPixelFormatAttribivARBWrapper
(hdc, i + 1, 0, num_attrs, attrs, values)) {
ErrorF
("wglGetPixelFormatAttribivARB failed for index %d, error %s\n",
i + 1, glxWinErrorMessage());
- break;
+ break;
}
#define ATTR_VALUE(a, d) getAttrValue(attrs, values, num_attrs, (a), (d))
@@ -2136,17 +2151,17 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
GLWIN_DEBUG_MSG
("pixelFormat %d isn't WGL_SUPPORT_OPENGL_ARB, skipping",
i + 1);
- continue;
+ continue;
}
c->base.doubleBufferMode =
ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, 0) ? GL_TRUE : GL_FALSE;
- c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE;
+ c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE;
- c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0);
- c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0);
- c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0);
- c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0);
+ c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0);
+ c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0);
+ c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0);
+ c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0);
c->base.redMask =
BITS_AND_SHIFT_TO_MASK(c->base.redBits,
@@ -2163,53 +2178,53 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
switch (ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0)) {
case WGL_TYPE_COLORINDEX_ARB:
- c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
- c->base.rgbBits = 0;
- c->base.visualType = GLX_STATIC_COLOR;
+ c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
+ c->base.rgbBits = 0;
+ c->base.visualType = GLX_STATIC_COLOR;
if (!getenv("GLWIN_ENABLE_COLORINDEX_FBCONFIGS")) {
GLWIN_DEBUG_MSG
("pixelFormat %d is WGL_TYPE_COLORINDEX_ARB, skipping",
i + 1);
- continue;
+ continue;
}
- break;
+ break;
case WGL_TYPE_RGBA_FLOAT_ARB:
GLWIN_DEBUG_MSG
("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i + 1);
- continue;
+ continue;
case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT:
GLWIN_DEBUG_MSG
("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping",
i + 1);
- continue;
+ continue;
case WGL_TYPE_RGBA_ARB:
- c->base.indexBits = 0;
- c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
- c->base.visualType = GLX_TRUE_COLOR;
- break;
+ c->base.indexBits = 0;
+ c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
+ c->base.visualType = GLX_TRUE_COLOR;
+ break;
default:
ErrorF
("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_PIXEL_TYPE_ARB\n",
ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0));
- continue;
+ continue;
}
- c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0);
- c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0);
- c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0);
- c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0);
+ c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0);
+ c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0);
+ c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0);
+ c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0);
- c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0);
- c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0);
- c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0);
+ c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0);
+ c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0);
+ c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0);
- {
+ {
int layers =
ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,
0) + ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0);
@@ -2219,15 +2234,15 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
("pixelFormat %d: has %d overlay, %d underlays which aren't currently handled",
i, ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB, 0),
ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0));
- // XXX: need to iterate over layers?
- }
- }
- c->base.level = 0;
+ // XXX: need to iterate over layers?
+ }
+ }
+ c->base.level = 0;
- c->base.pixmapMode = 0; // ???
- c->base.visualID = -1; // will be set by __glXScreenInit()
+ c->base.pixmapMode = 0; // ???
+ c->base.visualID = -1; // will be set by __glXScreenInit()
- /* EXT_visual_rating / GLX 1.2 */
+ /* EXT_visual_rating / GLX 1.2 */
switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) {
default:
ErrorF
@@ -2235,17 +2250,17 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
ATTR_VALUE(WGL_ACCELERATION_ARB, 0));
case WGL_NO_ACCELERATION_ARB:
- c->base.visualRating = GLX_SLOW_VISUAL_EXT;
- break;
+ c->base.visualRating = GLX_SLOW_VISUAL_EXT;
+ break;
case WGL_GENERIC_ACCELERATION_ARB:
case WGL_FULL_ACCELERATION_ARB:
- c->base.visualRating = GLX_NONE_EXT;
- break;
+ c->base.visualRating = GLX_NONE_EXT;
+ break;
}
- /* EXT_visual_info / GLX 1.2 */
- // c->base.visualType is set above
+ /* EXT_visual_info / GLX 1.2 */
+ // c->base.visualType is set above
if (ATTR_VALUE(WGL_TRANSPARENT_ARB, 0)) {
c->base.transparentPixel =
(c->base.visualType ==
@@ -2263,90 +2278,90 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
ATTR_VALUE(WGL_TRANSPARENT_INDEX_VALUE_ARB, 0);
}
else {
- c->base.transparentPixel = GLX_NONE_EXT;
- c->base.transparentRed = GLX_NONE;
- c->base.transparentGreen = GLX_NONE;
- c->base.transparentBlue = GLX_NONE;
- c->base.transparentAlpha = GLX_NONE;
- c->base.transparentIndex = GLX_NONE;
+ c->base.transparentPixel = GLX_NONE_EXT;
+ c->base.transparentRed = GLX_NONE;
+ c->base.transparentGreen = GLX_NONE;
+ c->base.transparentBlue = GLX_NONE;
+ c->base.transparentAlpha = GLX_NONE;
+ c->base.transparentIndex = GLX_NONE;
}
- /* ARB_multisample / SGIS_multisample */
+ /* ARB_multisample / SGIS_multisample */
if (screen->has_WGL_ARB_multisample) {
- c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0);
- c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0);
+ c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0);
+ c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0);
}
else {
- c->base.sampleBuffers = 0;
- c->base.samples = 0;
+ c->base.sampleBuffers = 0;
+ c->base.samples = 0;
}
- /* SGIX_fbconfig / GLX 1.3 */
+ /* SGIX_fbconfig / GLX 1.3 */
c->base.drawableType =
((ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, 0) ? GLX_WINDOW_BIT : 0)
- | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0)
- | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0));
+ | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0)
+ | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0));
- /*
- Assume OpenGL RGBA rendering is available on all visuals
- (it is specified to render to red component in single-channel visuals,
- if supported, but there doesn't seem to be any mechanism to check if it
- is supported)
+ /*
+ Assume OpenGL RGBA rendering is available on all visuals
+ (it is specified to render to red component in single-channel visuals,
+ if supported, but there doesn't seem to be any mechanism to check if it
+ is supported)
- Color index rendering is only supported on single-channel visuals
- */
+ Color index rendering is only supported on single-channel visuals
+ */
if (c->base.visualType == GLX_STATIC_COLOR) {
- c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
+ c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
}
else {
- c->base.renderType = GLX_RGBA_BIT;
+ c->base.renderType = GLX_RGBA_BIT;
}
- c->base.xRenderable = GL_TRUE;
- c->base.fbconfigID = -1; // will be set by __glXScreenInit()
+ c->base.xRenderable = GL_TRUE;
+ c->base.fbconfigID = -1; // will be set by __glXScreenInit()
- /* SGIX_pbuffer / GLX 1.3 */
+ /* SGIX_pbuffer / GLX 1.3 */
if (screen->has_WGL_ARB_pbuffer) {
- c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1);
+ c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1);
c->base.maxPbufferHeight =
ATTR_VALUE(WGL_MAX_PBUFFER_HEIGHT_ARB, -1);
c->base.maxPbufferPixels =
ATTR_VALUE(WGL_MAX_PBUFFER_PIXELS_ARB, -1);
}
else {
- c->base.maxPbufferWidth = -1;
- c->base.maxPbufferHeight = -1;
- c->base.maxPbufferPixels = -1;
+ c->base.maxPbufferWidth = -1;
+ c->base.maxPbufferHeight = -1;
+ c->base.maxPbufferPixels = -1;
}
- c->base.optimalPbufferWidth = 0; // there is no optimal value
- c->base.optimalPbufferHeight = 0;
+ c->base.optimalPbufferWidth = 0; // there is no optimal value
+ c->base.optimalPbufferHeight = 0;
- /* SGIX_visual_select_group */
- // arrange for visuals with the best acceleration to be preferred in selection
+ /* SGIX_visual_select_group */
+ // arrange for visuals with the best acceleration to be preferred in selection
switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) {
case WGL_FULL_ACCELERATION_ARB:
- c->base.visualSelectGroup = 2;
- break;
+ c->base.visualSelectGroup = 2;
+ break;
case WGL_GENERIC_ACCELERATION_ARB:
- c->base.visualSelectGroup = 1;
- break;
+ c->base.visualSelectGroup = 1;
+ break;
default:
case WGL_NO_ACCELERATION_ARB:
- c->base.visualSelectGroup = 0;
- break;
+ c->base.visualSelectGroup = 0;
+ break;
}
- /* OML_swap_method */
+ /* OML_swap_method */
switch (ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0)) {
case WGL_SWAP_EXCHANGE_ARB:
- c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
- break;
+ c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
+ break;
case WGL_SWAP_COPY_ARB:
- c->base.swapMethod = GLX_SWAP_COPY_OML;
- break;
+ c->base.swapMethod = GLX_SWAP_COPY_OML;
+ break;
default:
ErrorF
@@ -2354,18 +2369,18 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0));
case WGL_SWAP_UNDEFINED_ARB:
- c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
+ c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
}
- /* EXT_import_context */
- c->base.screen = screen->base.pScreen->myNum;
+ /* EXT_import_context */
+ c->base.screen = screen->base.pScreen->myNum;
- /* EXT_texture_from_pixmap */
- /*
- Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
- bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use,
- so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea...
- */
+ /* EXT_texture_from_pixmap */
+ /*
+ Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
+ bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use,
+ so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea...
+ */
if (screen->has_WGL_ARB_render_texture) {
c->base.bindToTextureRgb =
ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGB_ARB, -1);
@@ -2373,24 +2388,24 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGBA_ARB, -1);
}
else {
- c->base.bindToTextureRgb = -1;
- c->base.bindToTextureRgba = -1;
+ c->base.bindToTextureRgb = -1;
+ c->base.bindToTextureRgba = -1;
}
- c->base.bindToMipmapTexture = -1;
+ c->base.bindToMipmapTexture = -1;
c->base.bindToTextureTargets =
GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
GLX_TEXTURE_RECTANGLE_BIT_EXT;
- c->base.yInverted = -1;
+ c->base.yInverted = -1;
- n++;
+ n++;
- // update previous config to point to this config
- if (prev)
- prev->base.next = &(c->base);
+ // update previous config to point to this config
+ if (prev)
+ prev->base.next = &(c->base);
- prev = c;
+ prev = c;
}
- screen->base.numFBConfigs = n;
- screen->base.fbconfigs = &(result->base);
+ screen->base.numFBConfigs = n;
+ screen->base.fbconfigs = &(result->base);
}
diff --git a/hw/xwin/glx/winpriv.c b/hw/xwin/glx/winpriv.c
index 4f6e4ffd5..35cb0c73a 100644
--- a/hw/xwin/glx/winpriv.c
+++ b/hw/xwin/glx/winpriv.c
@@ -12,7 +12,40 @@
#include "winwindow.h"
void
- winCreateWindowsWindow(WindowPtr pWin);
+winCreateWindowsWindow (WindowPtr pWin);
+
+static
+void
+winCreateWindowsWindowHierarchy(WindowPtr pWin)
+{
+ winWindowPriv(pWin);
+
+ winDebug("winCreateWindowsWindowHierarchy - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
+
+ /* recursively ensure parent window exists if it's not the root window */
+ if (pWin->parent)
+ {
+ if (pWin->parent != pWin->drawable.pScreen->root)
+ winCreateWindowsWindowHierarchy(pWin->parent);
+ }
+
+ /* ensure this window exists */
+ if (pWinPriv->hWnd == NULL)
+ {
+ winCreateWindowsWindow(pWin);
+
+ /* ... and if it's already been mapped, make sure it's visible */
+ if (pWin->mapped)
+ {
+ /* Display the window without activating it */
+ if (pWin->drawable.class != InputOnly)
+ ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
+
+ /* Send first paint message */
+ UpdateWindow (pWinPriv->hWnd);
+ }
+ }
+}
/**
* Return size and handles of a window.
@@ -50,8 +83,8 @@ winGetWindowInfo(WindowPtr pWin)
}
if (pWinPriv->hWnd == NULL) {
- winCreateWindowsWindow(pWin);
- ErrorF("winGetWindowInfo: forcing window to exist...\n");
+ ErrorF("winGetWindowInfo: forcing window to exist\n");
+ winCreateWindowsWindowHierarchy(pWin);
}
if (pWinPriv->hWnd != NULL) {
@@ -60,7 +93,7 @@ winGetWindowInfo(WindowPtr pWin)
/* mark GLX active on that hwnd */
pWinPriv->fWglUsed = TRUE;
- }
+ }
return hwnd;
}
@@ -69,7 +102,7 @@ winGetWindowInfo(WindowPtr pWin)
/* check for multiwindow external wm mode */
if (pScreenInfo->fMWExtWM) {
win32RootlessWindowPtr pRLWinPriv
- = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
+ = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
if (pRLWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
@@ -104,18 +137,18 @@ winGetWindowInfo(WindowPtr pWin)
Bool
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
{
- winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
+ winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
- if (pScreenInfo->fMultiWindow)
- return TRUE;
+ if (pScreenInfo->fMultiWindow)
+ return TRUE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- if (pScreenInfo->fMWExtWM)
- return TRUE;
+ if (pScreenInfo->fMWExtWM)
+ return TRUE;
#endif
- return FALSE;
+ return FALSE;
}
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index d03a36521..cf5324131 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -76,6 +76,9 @@ preceeding \fB\-screen\fP parameter.
.B \-[no]multimonitors or \-[no]multiplemonitors
Create a screen 0 that covers all monitors [the primary monitor] on a system with
multiple monitors.
+Fake XINERAMA data is created describing the individual monitors,
+(This is similar to the 'merged framebuffer' or 'pseudo-xinerama' mode provided by
+some drivers for the xorg X server).
This option is currently enabled by default in \fB\-multiwindow\fP mode.
.TP 8
.B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] "
@@ -121,14 +124,16 @@ Alternative name for \fB\-resize=scrollbars\fP.
.SH OPTIONS CONTROLLING RESIZE BEHAVIOUR
.TP 8
.B \-resize[=none|scrollbars|randr]
-Select the resize mode of an X screen.
+Select the resize mode of an X screen. The default is randr.
.RS
.IP \fB\-resize=none\fP 8
-(default). The screen is not resizable.
+The screen is not resizable.
In windowed mode, if the window has decorations, a fixed frame is used.
+Alternative name is \fB\-noresize\fP.
+
.IP \fB\-resize=scrollbars\fP 8
The screen window is resizeable, but the screen is not resizable.
@@ -159,10 +164,16 @@ of the X screen using the RANDR extension is not permitted.
The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop.
-.IP \fB\--resize\fP 8
-on its own is equivalent to \fB\--resize=randr\fP
+.IP \fB\-resize\fP 8
+on its own is equivalent to \fB\-resize=randr\fP
.RE
+.SH OPTIONS FOR MULTIWINDOW MODE
+.TP 8
+.B \-hostintitle
+Add the host name to the window title for X applications which are running
+on remote hosts, when that information is available and it's useful to do so.
+
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
.TP 8
.B \-[no]clipboard
@@ -211,7 +222,7 @@ is disabled by default.
.TP 8
.B \-[no]wgl
Enable [disable] the GLX extension to use the native Windows WGL interface
-for hardware accelerated OpenGL (AIGLX). (Experimental)
+for hardware accelerated OpenGL (AIGLX). The default is enabled.
.TP 8
.B \-[no]winkill
Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
@@ -313,18 +324,22 @@ exit silently and don't display any error message.
.B "\-xkbvariant \fIvariant\fp"
These options configure the xkeyboard extension to load
a particular keyboard map as the X server starts. The behavior is similar
-to the \fIsetxkbmap\fP program. The layout data is located at \fI
-__datadir__/X11/xkb/\fP. Additional information is found in the
-README files therein and in the man page of \fIsetxkbmap\fP. For example
-in order to load a German layout for a pc105 keyboard one uses
-the options:
+to the \fIsetxkbmap\fP(1) program.
+
+See the \fIxkeyboard-config\fP(__miscmansuffix__) manual page for a list of
+keyboard configurations.
+
+The keyboard layout data is located at \fI__datadir__/X11/xkb/\fP. Additional information
+can be found in the README files there and in the \fIsetxkbmap\fP(1) manual page.
+
+For example, in order to load a German layout for a pc105 keyboard, use the options:
.br
.I " \-xkblayout de \-xkbmodel pc105"
-Alternatively one may use the \fIsetxkbmap\fP program after \fIXWin\fP is
+Alternatively, you can use the \fIsetxkbmap\fP(1) program after \fIXWin\fP is
running.
-The default is to select a configuration matching your current layout as
+The default is to select a keyboard configuration matching your current layout as
reported by \fIWindows\fP, if known, or the default X server configuration
if no matching keyboard configuration was found.
@@ -370,7 +385,7 @@ window, in both the generic case and for particular programs.
* To change the style that is associated to the \fIWindows\fP window that
\fXWin I-multiwindow\fP produces for each top-level X window.
.PP
-The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
+The format of the \fI.XWinrc\fP file is given in the XWinrc(5) manual page.
.SH EXAMPLES
Need some examples
@@ -378,15 +393,15 @@ Need some examples
.SH "SEE ALSO"
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__),
-setxkbmap(1), xkeyboard-config (__miscmansuffix__).
+setxkbmap(1), xkeyboard-config(__miscmansuffix__).
.SH BUGS
.I XWin
-and this man page still have many limitations.
+and this manual page still have many limitations.
The \fIXWin\fP software is continuously developing; it is therefore possible that
-this man page is not up to date. It is always prudent to
+this manual page is not up to date. It is always prudent to
look also at the output of \fIXWin -help\fP in order to
check the options that are operative.
diff --git a/hw/xwin/man/XWinrc.man b/hw/xwin/man/XWinrc.man
index 71d8dad23..0f641e92f 100644
--- a/hw/xwin/man/XWinrc.man
+++ b/hw/xwin/man/XWinrc.man
@@ -54,6 +54,35 @@ There are four kinds of instructions: miscellaneous, menu, icon and style.
.SH Miscellaneous instruction
.TP 8
+.B DPI \fIresolution\fP
+Sets the resolution for all screens, in dots per inch. To be used when
+the server cannot determine the screen size(s) from the hardware.
+
+.TP 8
+.B XKBLayout \fIlayout\fP
+.TP 8
+.B XKBModel \fImodel\fP
+.TP 8
+.B XKBOptions \fIoption\fP
+.TP 8
+.B XKBRules \fIrule\fP
+.TP 8
+.B XKBVariant \fIvariant\fp
+These options configure the xkeyboard extension to load a particular
+keyboard map as the X server starts. The behavior is similar to the
+\fIsetxkbmap\fP(1) program.
+
+See the \fIxkeyboard-config\fP(__miscmansuffix__) manual page for a list of
+keyboard configurations.
+
+Alternatively, you can use \fIsetxkbmap\fP(1) program after \fIXWin\fP
+is running.
+
+The default is to select a keyboard configuration matching your current
+layout as reported by \fIWindows\fP, if known, or the default X server
+configuration if no matching keyboard configuration was found.
+
+.TP 8
.B DEBUG \fIString\fP
The \fIString\fP is printed to the XWin log file.
diff --git a/hw/xwin/system.XWinrc b/hw/xwin/system.XWinrc
index f0771c610..5ff3abad6 100644
--- a/hw/xwin/system.XWinrc
+++ b/hw/xwin/system.XWinrc
@@ -89,9 +89,17 @@ menu apps {
}
menu root {
+ "Applications" menu apps
// Comments fit here, too...
+
+ SEPARATOR
+ FAQ EXEC "cygstart http://x.cygwin.com/docs/faq/cygwin-x-faq.html"
+ "User's Guide" EXEC "cygstart http://x.cygwin.com/docs/ug/cygwin-x-ug.html"
+ SEPARATOR
+ "View logfile" EXEC "xterm -e less +F $XWINLOGFILE"
+ SEPARATOR
+
"Reload .XWinrc" RELOAD
- "Applications" menu apps
SEParATOR
}
diff --git a/hw/xwin/taskbar.h b/hw/xwin/taskbar.h
new file mode 100644
index 000000000..bfe301d12
--- /dev/null
+++ b/hw/xwin/taskbar.h
@@ -0,0 +1,72 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ */
+
+#ifndef _TASKBAR_H
+#define _TASKBAR_H
+
+#include <windows.h>
+
+typedef struct _tagpropertykey {
+ GUID fmtid;
+ DWORD pid;
+} PROPERTYKEY;
+#define REFPROPERTYKEY const PROPERTYKEY *
+#define REFPROPVARIANT const PROPVARIANT *
+
+#ifdef INTERFACE
+#undef INTERFACE
+#endif
+
+#define INTERFACE IPropertyStore
+DECLARE_INTERFACE_(IPropertyStore,IUnknown) {
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(GetCount)(THIS_ DWORD) PURE;
+ STDMETHOD(GetAt)(THIS_ DWORD,PROPERTYKEY) PURE;
+ STDMETHOD(GetValue)(THIS_ REFPROPERTYKEY,PROPVARIANT) PURE;
+ STDMETHOD(SetValue)(THIS_ REFPROPERTYKEY,REFPROPVARIANT) PURE;
+ STDMETHOD(Commit)(THIS) PURE;
+};
+#undef INTERFACE
+typedef IPropertyStore *LPPROPERTYSTORE;
+
+DEFINE_GUID(IID_IPropertyStore,0x886d8eeb, 0x8cf2, 0x4446, 0x8d,0x02, 0xcd,0xba,0x1d,0xbd,0xcf,0x99);
+
+#ifdef INITGUID
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid }
+#else
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY name
+#endif
+
+DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5);
+
+typedef HRESULT (__stdcall *SHGETPROPERTYSTOREFORWINDOWPROC)(HWND,REFIID,void**);
+typedef HRESULT (__stdcall *PROPVARIANTCLEARPROC)(PROPVARIANT*);
+
+#endif
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index ce90d05e2..e5a05a22a 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -49,20 +49,20 @@
/* WM_XBUTTON Messages. They should go into w32api. */
#ifndef WM_XBUTTONDOWN
-#define WM_XBUTTONDOWN 523
+# define WM_XBUTTONDOWN 523
#endif
#ifndef WM_XBUTTONUP
-#define WM_XBUTTONUP 524
+# define WM_XBUTTONUP 524
#endif
#ifndef WM_XBUTTONDBLCLK
-#define WM_XBUTTONDBLCLK 525
+# define WM_XBUTTONDBLCLK 525
#endif
#define WIN_DEFAULT_BPP 0
#define WIN_DEFAULT_WHITEPIXEL 255
#define WIN_DEFAULT_BLACKPIXEL 0
#define WIN_DEFAULT_LINEBIAS 0
-#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
+#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
#define WIN_DEFAULT_DPI 96
#define WIN_DEFAULT_REFRESH 0
#define WIN_DEFAULT_WIN_KILL TRUE
@@ -105,15 +105,15 @@
#define WIN_FD_INVALID -1
-#define WIN_SERVER_NONE 0x0L /* 0 */
-#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
-#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
-#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
+#define WIN_SERVER_NONE 0x0L /* 0 */
+#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
+#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
+#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
#ifdef XWIN_PRIMARYFB
-#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
+#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
#endif
#ifdef XWIN_NATIVEGDI
-#define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
+# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
#endif
#define AltMapIndex Mod1MapIndex
@@ -148,8 +148,8 @@
#include <sys/mman.h>
#ifndef MAP_FILE
#define MAP_FILE 0
-#endif /* MAP_FILE */
-#endif /* HAVE_MMAP */
+#endif /* MAP_FILE */
+#endif /* HAVE_MMAP */
#include <X11/X.h>
#include <X11/Xproto.h>
@@ -267,55 +267,55 @@ static Atom func (void) { \
* Typedefs for engine dependent function pointers
*/
-typedef Bool (*winAllocateFBProcPtr) (ScreenPtr);
+typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
-typedef void (*winFreeFBProcPtr) (ScreenPtr);
+typedef void (*winFreeFBProcPtr)(ScreenPtr);
-typedef void (*winShadowUpdateProcPtr) (ScreenPtr, shadowBufPtr);
+typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
-typedef Bool (*winInitScreenProcPtr) (ScreenPtr);
+typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
-typedef Bool (*winCloseScreenProcPtr) (int, ScreenPtr);
+typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
-typedef Bool (*winInitVisualsProcPtr) (ScreenPtr);
+typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
-typedef Bool (*winAdjustVideoModeProcPtr) (ScreenPtr);
+typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
-typedef Bool (*winCreateBoundingWindowProcPtr) (ScreenPtr);
+typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
-typedef Bool (*winFinishScreenInitProcPtr) (int, ScreenPtr, int, char **);
+typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
-typedef Bool (*winBltExposedRegionsProcPtr) (ScreenPtr);
+typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
-typedef Bool (*winActivateAppProcPtr) (ScreenPtr);
+typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
-typedef Bool (*winRedrawScreenProcPtr) (ScreenPtr pScreen);
+typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
-typedef Bool (*winRealizeInstalledPaletteProcPtr) (ScreenPtr pScreen);
+typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
-typedef Bool (*winInstallColormapProcPtr) (ColormapPtr pColormap);
+typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
-typedef Bool (*winStoreColorsProcPtr) (ColormapPtr pmap,
- int ndef, xColorItem * pdefs);
+typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
+ int ndef, xColorItem *pdefs);
-typedef Bool (*winCreateColormapProcPtr) (ColormapPtr pColormap);
+typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
-typedef Bool (*winDestroyColormapProcPtr) (ColormapPtr pColormap);
+typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
-typedef Bool (*winHotKeyAltTabProcPtr) (ScreenPtr);
+typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
-typedef Bool (*winCreatePrimarySurfaceProcPtr) (ScreenPtr);
+typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
-typedef Bool (*winReleasePrimarySurfaceProcPtr) (ScreenPtr);
+typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
-typedef Bool (*winFinishCreateWindowsWindowProcPtr) (WindowPtr pWin);
+typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
-typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
+typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
#ifdef XWIN_NATIVEGDI
/* Typedefs for native GDI wrappers */
typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
-typedef Bool (*UnrealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
+typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
#endif
/*
@@ -323,8 +323,8 @@ typedef Bool (*UnrealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
*/
typedef struct {
- HDC hdc;
- HDC hdcMem;
+ HDC hdc;
+ HDC hdcMem;
} winPrivGCRec, *winPrivGCPtr;
/*
@@ -332,11 +332,11 @@ typedef struct {
*/
typedef struct {
- HDC hdcSelected;
- HBITMAP hBitmap;
- BYTE *pbBits;
- DWORD dwScanlineBytes;
- BITMAPINFOHEADER *pbmih;
+ HDC hdcSelected;
+ HBITMAP hBitmap;
+ BYTE *pbBits;
+ DWORD dwScanlineBytes;
+ BITMAPINFOHEADER *pbmih;
} winPrivPixmapRec, *winPrivPixmapPtr;
/*
@@ -344,34 +344,34 @@ typedef struct {
*/
typedef struct {
- HPALETTE hPalette;
- LPDIRECTDRAWPALETTE lpDDPalette;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
- PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
+ HPALETTE hPalette;
+ LPDIRECTDRAWPALETTE lpDDPalette;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
} winPrivCmapRec, *winPrivCmapPtr;
/*
* Windows Cursor handling.
- */
-
+ */
+
typedef struct {
- /* from GetSystemMetrics */
- int sm_cx;
- int sm_cy;
-
- BOOL visible;
- HCURSOR handle;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
+ /* from GetSystemMetrics */
+ int sm_cx;
+ int sm_cy;
+
+ BOOL visible;
+ HCURSOR handle;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
} winCursorRec;
/*
* Resize modes
*/
typedef enum {
- notAllowed,
- resizeWithScrollbars,
- resizeWithRandr
+ notAllowed,
+ resizeWithScrollbars,
+ resizeWithRandr
} winResizeMode;
/*
@@ -380,72 +380,74 @@ typedef enum {
*/
typedef struct {
- ScreenPtr pScreen;
-
- /* Did the user specify a height and width? */
- Bool fUserGaveHeightAndWidth;
-
- DWORD dwScreen;
-
- int iMonitor;
- DWORD dwUserWidth;
- DWORD dwUserHeight;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwPaddedWidth;
-
- /* Did the user specify a screen position? */
- Bool fUserGavePosition;
- DWORD dwInitialX;
- DWORD dwInitialY;
-
- /*
- * dwStride is the number of whole pixels that occupy a scanline,
- * including those pixels that are not displayed. This is basically
- * a rounding up of the width.
- */
- DWORD dwStride;
-
- /* Offset of the screen in the window when using scrollbars */
- DWORD dwXOffset;
- DWORD dwYOffset;
-
- DWORD dwBPP;
- DWORD dwDepth;
- DWORD dwRefreshRate;
- char *pfb;
- DWORD dwEngine;
- DWORD dwEnginePreferred;
- DWORD dwClipUpdatesNBoxes;
+ ScreenPtr pScreen;
+
+ /* Did the user specify a height and width? */
+ Bool fUserGaveHeightAndWidth;
+
+ DWORD dwScreen;
+
+ int iMonitor;
+ HMONITOR hMonitor;
+
+ DWORD dwUserWidth;
+ DWORD dwUserHeight;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwPaddedWidth;
+
+ /* Did the user specify a screen position? */
+ Bool fUserGavePosition;
+ DWORD dwInitialX;
+ DWORD dwInitialY;
+
+ /*
+ * dwStride is the number of whole pixels that occupy a scanline,
+ * including those pixels that are not displayed. This is basically
+ * a rounding up of the width.
+ */
+ DWORD dwStride;
+
+ /* Offset of the screen in the window when using scrollbars */
+ DWORD dwXOffset;
+ DWORD dwYOffset;
+
+ DWORD dwBPP;
+ DWORD dwDepth;
+ DWORD dwRefreshRate;
+ char *pfb;
+ DWORD dwEngine;
+ DWORD dwEnginePreferred;
+ DWORD dwClipUpdatesNBoxes;
#ifdef XWIN_EMULATEPSEUDO
- Bool fEmulatePseudo;
+ Bool fEmulatePseudo;
#endif
- Bool fFullScreen;
- Bool fDecoration;
+ Bool fFullScreen;
+ Bool fDecoration;
#ifdef XWIN_MULTIWINDOWEXTWM
- Bool fMWExtWM;
- Bool fInternalWM;
- Bool fAnotherWMRunning;
+ Bool fMWExtWM;
+ Bool fInternalWM;
+ Bool fAnotherWMRunning;
#endif
- Bool fRootless;
+ Bool fRootless;
#ifdef XWIN_MULTIWINDOW
- Bool fMultiWindow;
+ Bool fMultiWindow;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- Bool fMultiMonitorOverride;
+ Bool fMultiMonitorOverride;
#endif
- Bool fMultipleMonitors;
- Bool fLessPointer;
- winResizeMode iResizeMode;
- Bool fNoTrayIcon;
- int iE3BTimeout;
- /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
- Bool fUseWinKillKey;
- Bool fUseUnixKillKey;
- Bool fIgnoreInput;
-
- /* Did the user explicitly set this screen? */
- Bool fExplicitScreen;
+ Bool fMultipleMonitors;
+ Bool fLessPointer;
+ winResizeMode iResizeMode;
+ Bool fNoTrayIcon;
+ int iE3BTimeout;
+ /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
+ Bool fUseWinKillKey;
+ Bool fUseUnixKillKey;
+ Bool fIgnoreInput;
+
+ /* Did the user explicitly set this screen? */
+ Bool fExplicitScreen;
} winScreenInfo, *winScreenInfoPtr;
/*
@@ -453,171 +455,170 @@ typedef struct {
*/
typedef struct _winPrivScreenRec {
- winScreenInfoPtr pScreenInfo;
+ winScreenInfoPtr pScreenInfo;
- Bool fEnabled;
- Bool fClosed;
- Bool fActive;
- Bool fBadDepth;
+ Bool fEnabled;
+ Bool fClosed;
+ Bool fActive;
+ Bool fBadDepth;
- int iDeltaZ;
+ int iDeltaZ;
- int iConnectedClients;
+ int iConnectedClients;
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
- DWORD dwRedMask;
- DWORD dwGreenMask;
- DWORD dwBlueMask;
- DWORD dwBitsPerRGB;
+ DWORD dwRedMask;
+ DWORD dwGreenMask;
+ DWORD dwBlueMask;
+ DWORD dwBitsPerRGB;
- DWORD dwModeKeyStates;
+ DWORD dwModeKeyStates;
- /* Handle to icons that must be freed */
- HICON hiconNotifyIcon;
+ /* Handle to icons that must be freed */
+ HICON hiconNotifyIcon;
- /* Palette management */
- ColormapPtr pcmapInstalled;
+ /* Palette management */
+ ColormapPtr pcmapInstalled;
- /* Pointer to the root visual so we only have to look it up once */
- VisualPtr pRootVisual;
+ /* Pointer to the root visual so we only have to look it up once */
+ VisualPtr pRootVisual;
- /* 3 button emulation variables */
- int iE3BCachedPress;
- Bool fE3BFakeButton2Sent;
+ /* 3 button emulation variables */
+ int iE3BCachedPress;
+ Bool fE3BFakeButton2Sent;
- /* Privates used by shadow fb GDI server */
- HBITMAP hbmpShadow;
- HDC hdcScreen;
- HDC hdcShadow;
- HWND hwndScreen;
- BITMAPINFOHEADER *pbmih;
+ /* Privates used by shadow fb GDI server */
+ HBITMAP hbmpShadow;
+ HDC hdcScreen;
+ HDC hdcShadow;
+ HWND hwndScreen;
+ BITMAPINFOHEADER *pbmih;
- /* Privates used by shadow fb and primary fb DirectDraw servers */
- LPDIRECTDRAW pdd;
- LPDIRECTDRAWSURFACE2 pddsPrimary;
- LPDIRECTDRAW2 pdd2;
+ /* Privates used by shadow fb and primary fb DirectDraw servers */
+ LPDIRECTDRAW pdd;
+ LPDIRECTDRAWSURFACE2 pddsPrimary;
+ LPDIRECTDRAW2 pdd2;
- /* Privates used by shadow fb DirectDraw server */
- LPDIRECTDRAWSURFACE2 pddsShadow;
- LPDDSURFACEDESC pddsdShadow;
+ /* Privates used by shadow fb DirectDraw server */
+ LPDIRECTDRAWSURFACE2 pddsShadow;
+ LPDDSURFACEDESC pddsdShadow;
- /* Privates used by primary fb DirectDraw server */
- LPDIRECTDRAWSURFACE2 pddsOffscreen;
- LPDDSURFACEDESC pddsdOffscreen;
- LPDDSURFACEDESC pddsdPrimary;
+ /* Privates used by primary fb DirectDraw server */
+ LPDIRECTDRAWSURFACE2 pddsOffscreen;
+ LPDDSURFACEDESC pddsdOffscreen;
+ LPDDSURFACEDESC pddsdPrimary;
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAW4 pdd4;
- LPDIRECTDRAWSURFACE4 pddsShadow4;
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
- BOOL fRetryCreateSurface;
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAW4 pdd4;
+ LPDIRECTDRAWSURFACE4 pddsShadow4;
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
#ifdef XWIN_MULTIWINDOWEXTWM
- /* Privates used by multi-window external window manager */
- RootlessFrameID widTop;
- Bool fRestacking;
+ /* Privates used by multi-window external window manager */
+ RootlessFrameID widTop;
+ Bool fRestacking;
#endif
#ifdef XWIN_MULTIWINDOW
- /* Privates used by multi-window */
- pthread_t ptWMProc;
- pthread_t ptXMsgProc;
- void *pWMInfo;
+ /* Privates used by multi-window */
+ pthread_t ptWMProc;
+ pthread_t ptXMsgProc;
+ void *pWMInfo;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- /* Privates used by both multi-window and rootless */
- Bool fRootWindowShown;
+ /* Privates used by both multi-window and rootless */
+ Bool fRootWindowShown;
#endif
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Privates used for any module running in a seperate thread */
- pthread_mutex_t pmServerStarted;
- Bool fServerStarted;
+ /* Privates used for any module running in a seperate thread */
+ pthread_mutex_t pmServerStarted;
+ Bool fServerStarted;
#endif
-
- /* Engine specific functions */
- winAllocateFBProcPtr pwinAllocateFB;
- winFreeFBProcPtr pwinFreeFB;
- winShadowUpdateProcPtr pwinShadowUpdate;
- winInitScreenProcPtr pwinInitScreen;
- winCloseScreenProcPtr pwinCloseScreen;
- winInitVisualsProcPtr pwinInitVisuals;
- winAdjustVideoModeProcPtr pwinAdjustVideoMode;
- winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
- winFinishScreenInitProcPtr pwinFinishScreenInit;
- winBltExposedRegionsProcPtr pwinBltExposedRegions;
- winActivateAppProcPtr pwinActivateApp;
- winRedrawScreenProcPtr pwinRedrawScreen;
- winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
- winInstallColormapProcPtr pwinInstallColormap;
- winStoreColorsProcPtr pwinStoreColors;
- winCreateColormapProcPtr pwinCreateColormap;
- winDestroyColormapProcPtr pwinDestroyColormap;
- winHotKeyAltTabProcPtr pwinHotKeyAltTab;
- winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
- winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
-
- winCreateScreenResourcesProc pwinCreateScreenResources;
+
+ /* Engine specific functions */
+ winAllocateFBProcPtr pwinAllocateFB;
+ winFreeFBProcPtr pwinFreeFB;
+ winShadowUpdateProcPtr pwinShadowUpdate;
+ winInitScreenProcPtr pwinInitScreen;
+ winCloseScreenProcPtr pwinCloseScreen;
+ winInitVisualsProcPtr pwinInitVisuals;
+ winAdjustVideoModeProcPtr pwinAdjustVideoMode;
+ winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
+ winFinishScreenInitProcPtr pwinFinishScreenInit;
+ winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winActivateAppProcPtr pwinActivateApp;
+ winRedrawScreenProcPtr pwinRedrawScreen;
+ winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
+ winInstallColormapProcPtr pwinInstallColormap;
+ winStoreColorsProcPtr pwinStoreColors;
+ winCreateColormapProcPtr pwinCreateColormap;
+ winDestroyColormapProcPtr pwinDestroyColormap;
+ winHotKeyAltTabProcPtr pwinHotKeyAltTab;
+ winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
+ winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+
+ winCreateScreenResourcesProc pwinCreateScreenResources;
#ifdef XWIN_MULTIWINDOW
- /* Window Procedures for MultiWindow mode */
- winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
+ /* Window Procedures for MultiWindow mode */
+ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
#endif
- /* Window Procedures for Rootless mode */
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- PositionWindowProcPtr PositionWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- ClipNotifyProcPtr ClipNotify;
- RestackWindowProcPtr RestackWindow;
- ReparentWindowProcPtr ReparentWindow;
- ResizeWindowProcPtr ResizeWindow;
- MoveWindowProcPtr MoveWindow;
- SetShapeProcPtr SetShape;
-
- winCursorRec cursor;
+ /* Window Procedures for Rootless mode */
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
+ ReparentWindowProcPtr ReparentWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
+ SetShapeProcPtr SetShape;
+
+ winCursorRec cursor;
#ifdef XWIN_NATIVEGDI
- RealizeFontPtr RealizeFont;
- UnrealizeFontPtr UnrealizeFont;
+ RealizeFontPtr RealizeFont;
+ UnrealizeFontPtr UnrealizeFont;
#endif
} winPrivScreenRec;
#ifdef XWIN_MULTIWINDOWEXTWM
typedef struct {
- RootlessWindowPtr pFrame;
- HWND hWnd;
- int dwWidthBytes;
- BITMAPINFOHEADER *pbmihShadow;
- HBITMAP hbmpShadow;
- HDC hdcShadow;
- HDC hdcScreen;
- BOOL fResized;
- BOOL fRestackingNow;
- BOOL fClose;
- BOOL fMovingOrSizing;
- BOOL fDestroyed; //for debug
- char *pfb;
+ RootlessWindowPtr pFrame;
+ HWND hWnd;
+ int dwWidthBytes;
+ BITMAPINFOHEADER *pbmihShadow;
+ HBITMAP hbmpShadow;
+ HDC hdcShadow;
+ HDC hdcScreen;
+ BOOL fResized;
+ BOOL fRestackingNow;
+ BOOL fClose;
+ BOOL fMovingOrSizing;
+ BOOL fDestroyed;//for debug
+ char *pfb;
} win32RootlessWindowRec, *win32RootlessWindowPtr;
#endif
typedef struct {
- pointer value;
- XID id;
+ pointer value;
+ XID id;
} WindowIDPairRec, *WindowIDPairPtr;
/*
@@ -626,44 +627,44 @@ typedef struct {
#include "winglobals.h"
-extern winScreenInfo *g_ScreenInfo;
-extern miPointerScreenFuncRec g_winPointerCursorFuncs;
-extern DWORD g_dwEvents;
+extern winScreenInfo * g_ScreenInfo;
+extern miPointerScreenFuncRec g_winPointerCursorFuncs;
+extern DWORD g_dwEvents;
#ifdef HAS_DEVWINDOWS
-extern int g_fdMessageQueue;
+extern int g_fdMessageQueue;
#endif
-extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
+extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
-extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
+extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iGCPrivateKeyRec;
+extern DevPrivateKeyRec g_iGCPrivateKeyRec;
#define g_iGCPrivateKey (&g_iGCPrivateKeyRec)
-extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
+extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
+extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec)
-extern unsigned long g_ulServerGeneration;
-extern DWORD g_dwEnginesSupported;
-extern HINSTANCE g_hInstance;
-extern int g_copyROP[];
-extern int g_patternROP[];
-extern const char *g_pszQueryHost;
-extern DeviceIntPtr g_pwinPointer;
-extern DeviceIntPtr g_pwinKeyboard;
+extern unsigned long g_ulServerGeneration;
+extern DWORD g_dwEnginesSupported;
+extern HINSTANCE g_hInstance;
+extern int g_copyROP[];
+extern int g_patternROP[];
+extern const char * g_pszQueryHost;
+extern DeviceIntPtr g_pwinPointer;
+extern DeviceIntPtr g_pwinKeyboard;
/*
* Extern declares for dynamically loaded library function pointers
*/
-extern FARPROC g_fpDirectDrawCreate;
-extern FARPROC g_fpDirectDrawCreateClipper;
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
/*
* Screen privates macros
@@ -742,7 +743,7 @@ extern FARPROC g_fpDirectDrawCreateClipper;
real->mem = priv->mem; \
}
-#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
+#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
@@ -755,13 +756,13 @@ extern FARPROC g_fpDirectDrawCreateClipper;
*/
Bool
- winAllocatePrivates(ScreenPtr pScreen);
+winAllocatePrivates (ScreenPtr pScreen);
Bool
- winInitCmapPrivates(ColormapPtr pCmap, int index);
+winInitCmapPrivates (ColormapPtr pCmap, int index);
Bool
- winAllocateCmapPrivates(ColormapPtr pCmap);
+winAllocateCmapPrivates (ColormapPtr pCmap);
/*
* winauth.c
@@ -769,7 +770,7 @@ Bool
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
Bool
- winGenerateAuthorization(void);
+winGenerateAuthorization (void);
void winSetAuthorization(void);
#endif
@@ -788,7 +789,7 @@ winBlockHandler(int nScreen,
*/
RegionPtr
- winPixmapToRegionNativeGDI(PixmapPtr pPix);
+winPixmapToRegionNativeGDI (PixmapPtr pPix);
#endif
#ifdef XWIN_CLIPBOARD
@@ -797,10 +798,10 @@ RegionPtr
*/
Bool
- winInitClipboard(void);
+winInitClipboard (void);
void
- winFixClipboardChain(void);
+winFixClipboardChain (void);
#endif
/*
@@ -808,49 +809,49 @@ void
*/
void
- winSetColormapFunctions(ScreenPtr pScreen);
+winSetColormapFunctions (ScreenPtr pScreen);
Bool
- winCreateDefColormap(ScreenPtr pScreen);
+winCreateDefColormap (ScreenPtr pScreen);
/*
* wincreatewnd.c
*/
Bool
- winCreateBoundingWindowFullScreen(ScreenPtr pScreen);
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
Bool
- winCreateBoundingWindowWindowed(ScreenPtr pScreen);
+winCreateBoundingWindowWindowed (ScreenPtr pScreen);
/*
* windialogs.c
*/
void
- winDisplayExitDialog(winPrivScreenPtr pScreenPriv);
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
void
- winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv);
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
void
- winDisplayAboutDialog(winPrivScreenPtr pScreenPriv);
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
/*
* winengine.c
*/
void
- winDetectSupportedEngines(void);
+winDetectSupportedEngines (void);
Bool
- winSetEngine(ScreenPtr pScreen);
+winSetEngine (ScreenPtr pScreen);
Bool
- winGetDDProcAddresses(void);
+winGetDDProcAddresses (void);
void
- winReleaseDDProcAddresses(void);
+winReleaseDDProcAddresses(void);
/*
* winerror.c
@@ -858,11 +859,11 @@ void
#ifdef DDXOSVERRORF
void
- OSVenderVErrorF(const char *pszFormat, va_list va_args);
+OSVenderVErrorF (const char *pszFormat, va_list va_args);
#endif
void
- winMessageBoxF(const char *pszError, UINT uType, ...);
+winMessageBoxF (const char *pszError, UINT uType, ...);
#ifdef XWIN_NATIVEGDI
/*
@@ -871,9 +872,9 @@ void
void
-winFillSpansNativeGDI(DrawablePtr pDrawable,
- GCPtr pGC,
- int nSpans,
+winFillSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
DDXPointPtr pPoints, int *pWidths, int fSorted);
#endif
@@ -883,10 +884,10 @@ winFillSpansNativeGDI(DrawablePtr pDrawable,
*/
Bool
- winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
+winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
Bool
- winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
+winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
#endif
#ifdef XWIN_NATIVEGDI
@@ -895,7 +896,7 @@ Bool
*/
Bool
- winCreateGCNativeGDI(GCPtr pGC);
+winCreateGCNativeGDI (GCPtr pGC);
#endif
#ifdef XWIN_NATIVEGDI
@@ -905,8 +906,8 @@ Bool
void
-winGetSpansNativeGDI(DrawablePtr pDrawable,
- int wMax,
+winGetSpansNativeGDI (DrawablePtr pDrawable,
+ int wMax,
DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst);
#endif
@@ -915,47 +916,47 @@ winGetSpansNativeGDI(DrawablePtr pDrawable,
*/
void
- winInitializeGlobals(void);
+winInitializeGlobals (void);
/*
* winkeybd.c
*/
void
- winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode);
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
int
- winKeybdProc(DeviceIntPtr pDeviceInt, int iState);
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
void
- winInitializeModeKeyStates(void);
+winInitializeModeKeyStates (void);
void
- winRestoreModeKeyStates(void);
+winRestoreModeKeyStates (void);
Bool
- winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam);
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
void
- winKeybdReleaseKeys(void);
+winKeybdReleaseKeys (void);
void
- winSendKeyEvent(DWORD dwKey, Bool fDown);
+winSendKeyEvent (DWORD dwKey, Bool fDown);
BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
void
- winFixShiftKeys(int iScanCode);
+winFixShiftKeys (int iScanCode);
/*
* winkeyhook.c
*/
Bool
- winInstallKeyboardHookLL(void);
+winInstallKeyboardHookLL (void);
void
- winRemoveKeyboardHookLL(void);
+winRemoveKeyboardHookLL (void);
/*
* winmisc.c
@@ -964,15 +965,15 @@ void
#ifdef XWIN_NATIVEGDI
void
-winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen);
+winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
#endif
CARD8
- winCountBits(DWORD dw);
+winCountBits (DWORD dw);
Bool
- winUpdateFBPointer(ScreenPtr pScreen, void *pbits);
+winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
#ifdef XWIN_NATIVEGDI
BOOL winPaintBackground(HWND hwnd, COLORREF colorref);
@@ -983,21 +984,21 @@ BOOL winPaintBackground(HWND hwnd, COLORREF colorref);
*/
int
- winMouseProc(DeviceIntPtr pDeviceInt, int iState);
+winMouseProc (DeviceIntPtr pDeviceInt, int iState);
int
- winMouseWheel(ScreenPtr pScreen, int iDeltaZ);
+winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
void
- winMouseButtonsSendEvent(int iEventType, int iButton);
+winMouseButtonsSendEvent (int iEventType, int iButton);
int
-winMouseButtonsHandle(ScreenPtr pScreen,
+winMouseButtonsHandle (ScreenPtr pScreen,
int iEventType, int iButton, WPARAM wParam);
void
- winEnqueueMotion(int x, int y);
+winEnqueueMotion(int x, int y);
#ifdef XWIN_NATIVEGDI
/*
@@ -1005,11 +1006,11 @@ void
*/
HBITMAP
-winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
- BYTE ** ppbBits, BITMAPINFO ** ppbmi);
+winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
+ BYTE **ppbBits, BITMAPINFO **ppbmi);
Bool
- winSetEngineFunctionsNativeGDI(ScreenPtr pScreen);
+winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
#endif
#ifdef XWIN_PRIMARYFB
@@ -1018,7 +1019,7 @@ Bool
*/
Bool
- winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen);
+winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
#endif
#ifdef XWIN_NATIVEGDI
@@ -1028,18 +1029,18 @@ Bool
PixmapPtr
-winCreatePixmapNativeGDI(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
+winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
Bool
- winDestroyPixmapNativeGDI(PixmapPtr pPixmap);
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
Bool
-winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
int devKind, pointer pPixData);
#endif
@@ -1050,7 +1051,7 @@ winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
void
-winPolyLineNativeGDI(DrawablePtr pDrawable,
+winPolyLineNativeGDI (DrawablePtr pDrawable,
GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
#endif
@@ -1061,8 +1062,8 @@ winPolyLineNativeGDI(DrawablePtr pDrawable,
void
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg);
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
#endif
/*
@@ -1078,7 +1079,7 @@ Bool
#if defined(XWIN_NATIVEGDI)
Bool
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI (int index,
ScreenPtr pScreen, int argc, char **argv);
#endif
@@ -1089,9 +1090,9 @@ winFinishScreenInitNativeGDI(int index,
void
-winSetSpansNativeGDI(DrawablePtr pDrawable,
- GCPtr pGC,
- char *pSrc,
+winSetSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
DDXPointPtr pPoints, int *pWidth, int nSpans, int fSorted);
#endif
@@ -1100,21 +1101,21 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
*/
Bool
- winSetEngineFunctionsShadowDD(ScreenPtr pScreen);
+winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
/*
* winshadddnl.c
*/
Bool
- winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen);
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
/*
* winshadgdi.c
*/
Bool
- winSetEngineFunctionsShadowGDI(ScreenPtr pScreen);
+winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
/*
* winwakeup.c
@@ -1122,8 +1123,8 @@ Bool
void
-winWakeupHandler(int nScreen,
- pointer pWakeupData,
+winWakeupHandler (int nScreen,
+ pointer pWakeupData,
unsigned long ulResult, pointer pReadmask);
/*
@@ -1132,48 +1133,48 @@ winWakeupHandler(int nScreen,
#ifdef XWIN_NATIVEGDI
Bool
- winCreateWindowNativeGDI(WindowPtr pWin);
+winCreateWindowNativeGDI (WindowPtr pWin);
Bool
- winDestroyWindowNativeGDI(WindowPtr pWin);
+winDestroyWindowNativeGDI (WindowPtr pWin);
Bool
- winPositionWindowNativeGDI(WindowPtr pWin, int x, int y);
+winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
-void
+void
winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
Bool
- winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask);
+winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
Bool
- winUnmapWindowNativeGDI(WindowPtr pWindow);
+winUnmapWindowNativeGDI (WindowPtr pWindow);
Bool
- winMapWindowNativeGDI(WindowPtr pWindow);
+winMapWindowNativeGDI (WindowPtr pWindow);
#endif
Bool
- winCreateWindowRootless(WindowPtr pWindow);
+winCreateWindowRootless (WindowPtr pWindow);
Bool
- winDestroyWindowRootless(WindowPtr pWindow);
+winDestroyWindowRootless (WindowPtr pWindow);
Bool
- winPositionWindowRootless(WindowPtr pWindow, int x, int y);
+winPositionWindowRootless (WindowPtr pWindow, int x, int y);
Bool
- winChangeWindowAttributesRootless(WindowPtr pWindow, unsigned long mask);
+winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
Bool
- winUnmapWindowRootless(WindowPtr pWindow);
+winUnmapWindowRootless (WindowPtr pWindow);
Bool
- winMapWindowRootless(WindowPtr pWindow);
+winMapWindowRootless (WindowPtr pWindow);
void
- winSetShapeRootless(WindowPtr pWindow, int kind);
+winSetShapeRootless (WindowPtr pWindow, int kind);
/*
* winmultiwindowicons.c - Used by both multi-window and Win32Rootless
@@ -1181,8 +1182,7 @@ void
HICON winXIconToHICON(WindowPtr pWin, int iconSize);
-void
- winSelectIcons(WindowPtr pWin, HICON * pIcon, HICON * pSmallIcon);
+void winSelectIcons(HICON * pIcon, HICON * pSmallIcon);
#ifdef XWIN_MULTIWINDOW
/*
@@ -1190,13 +1190,13 @@ void
*/
void
- winReshapeMultiWindow(WindowPtr pWin);
+winReshapeMultiWindow (WindowPtr pWin);
void
- winSetShapeMultiWindow(WindowPtr pWindow, int kind);
+winSetShapeMultiWindow (WindowPtr pWindow, int kind);
void
- winUpdateRgnMultiWindow(WindowPtr pWindow);
+winUpdateRgnMultiWindow (WindowPtr pWindow);
#endif
#ifdef XWIN_MULTIWINDOW
@@ -1205,51 +1205,51 @@ void
*/
Bool
- winCreateWindowMultiWindow(WindowPtr pWindow);
+winCreateWindowMultiWindow (WindowPtr pWindow);
Bool
- winDestroyWindowMultiWindow(WindowPtr pWindow);
+winDestroyWindowMultiWindow (WindowPtr pWindow);
Bool
- winPositionWindowMultiWindow(WindowPtr pWindow, int x, int y);
+winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
Bool
- winChangeWindowAttributesMultiWindow(WindowPtr pWindow, unsigned long mask);
+winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
Bool
- winUnmapWindowMultiWindow(WindowPtr pWindow);
+winUnmapWindowMultiWindow (WindowPtr pWindow);
Bool
- winMapWindowMultiWindow(WindowPtr pWindow);
+winMapWindowMultiWindow (WindowPtr pWindow);
void
- winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent);
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
void
- winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib);
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
void
- winReorderWindowsMultiWindow(void);
+winReorderWindowsMultiWindow (void);
void
-winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib);
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
void
-winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind);
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind);
void
-winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt,
- RegionPtr oldRegion);
+winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion);
XID
- winGetWindowID(WindowPtr pWin);
+winGetWindowID (WindowPtr pWin);
int
- winAdjustXWindow(WindowPtr pWin, HWND hwnd);
+winAdjustXWindow (WindowPtr pWin, HWND hwnd);
#endif
#ifdef XWIN_MULTIWINDOW
@@ -1258,7 +1258,11 @@ int
*/
LRESULT CALLBACK
-winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+winTopLevelWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK
+winChildWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
#endif
/*
@@ -1266,15 +1270,15 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
*/
void
- winInitNotifyIcon(winPrivScreenPtr pScreenPriv);
+winInitNotifyIcon (winPrivScreenPtr pScreenPriv);
void
- winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv);
+winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
LRESULT
-winHandleIconMessage(HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam,
- winPrivScreenPtr pScreenPriv);
+winHandleIconMessage (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv);
/*
* winwndproc.c
@@ -1290,54 +1294,54 @@ winWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Bool
-winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape);
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
void
- winMWExtWMDestroyFrame(RootlessFrameID wid);
+winMWExtWMDestroyFrame (RootlessFrameID wid);
void
-winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
void
-winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int gravity);
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
void
- winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid);
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
void
- winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape);
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
void
- winMWExtWMUnmapFrame(RootlessFrameID wid);
+winMWExtWMUnmapFrame (RootlessFrameID wid);
void
-winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
void
- winMWExtWMStopDrawing(RootlessFrameID wid, Bool flush);
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
void
- winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage);
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
void
-winMWExtWMDamageRects(RootlessFrameID wid, int count, const BoxRec * rects,
- int shift_x, int shift_y);
+winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
+ int shift_x, int shift_y);
void
- winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin);
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
void
-winMWExtWMCopyBytes(unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes);
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
void
@@ -1351,32 +1355,32 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int dstNrects,
*/
void
- winMWExtWMReorderWindows(ScreenPtr pScreen);
+winMWExtWMReorderWindows (ScreenPtr pScreen);
void
- winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y);
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
void
- winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h);
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
void
- winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h);
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
void
- winMWExtWMUpdateIcon(Window id);
+winMWExtWMUpdateIcon (Window id);
void
-winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo);
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo);
wBOOL CALLBACK winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam);
Bool
- winIsInternalWMRunning(winScreenInfoPtr pScreenInfo);
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
void
- winMWExtWMRestackWindows(ScreenPtr pScreen);
+winMWExtWMRestackWindows (ScreenPtr pScreen);
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
@@ -1394,38 +1398,52 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
void
-winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h);
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h);
void
- winWindowsWMExtensionInit(void);
+winWindowsWMExtensionInit (void);
/*
* wincursor.c
*/
Bool
- winInitCursor(ScreenPtr pScreen);
+winInitCursor (ScreenPtr pScreen);
/*
* winprocarg.c
*/
void
- winInitializeScreens(int maxscreens);
+winInitializeScreens(int maxscreens);
/*
* winrandr.c
*/
Bool
- winRandRInit(ScreenPtr pScreen);
+winRandRInit (ScreenPtr pScreen);
+void
+
+winDoRandRScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight);
+/*
+ * windisplay.c
+ */
+
void
+winGetDisplayName(char *szDisplay, unsigned int screen);
-winDoRandRScreenSetSize(ScreenPtr pScreen,
- CARD16 width,
- CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
+/*
+ * winmsgwindow.c
+ */
+Bool
+winCreateMsgWindowThread(void);
/*
* END DDX and DIX Function Prototypes
*/
-#endif /* _WIN_H_ */
+#endif /* _WIN_H_ */
diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c
index c18d080fa..613b60143 100644
--- a/hw/xwin/winblock.c
+++ b/hw/xwin/winblock.c
@@ -36,54 +36,67 @@
/* See Porting Layer Definition - p. 6 */
void
-winBlockHandler(int nScreen,
+winBlockHandler (int nScreen,
pointer pBlockData, pointer pTimeout, pointer pReadMask)
{
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- winScreenPriv((ScreenPtr) pBlockData);
+ winScreenPriv((ScreenPtr)pBlockData);
#endif
- MSG msg;
#ifndef HAS_DEVWINDOWS
- struct timeval **tvp = pTimeout;
+ struct timeval **tvp = pTimeout;
if (*tvp != NULL) {
- (*tvp)->tv_sec = 0;
- (*tvp)->tv_usec = 100;
+ (*tvp)->tv_sec = 0;
+ (*tvp)->tv_usec = 100;
+ }
+#else
+ /*
+ Sometimes, we have work to do on the Windows message queue,
+ but /dev/windows doesn't appear to be ready. At the moment,
+ I don't understand how that happens.
+
+ As a workaround, make sure select() just polls rather than
+ blocking if there are still messages to process...
+ */
+ if (GetQueueStatus(QS_ALLINPUT | QS_ALLPOSTMESSAGE) != 0)
+ {
+ struct timeval **tvp = pTimeout;
+ if (*tvp != NULL)
+ {
+ (*tvp)->tv_sec = 0;
+ (*tvp)->tv_usec = 0;
+ }
}
#endif
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Signal threaded modules to begin */
+ /* Signal threaded modules to begin */
if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
- int iReturn;
+ int iReturn;
- winDebug("winBlockHandler - Releasing pmServerStarted\n");
+ ErrorF ("winBlockHandler - pthread_mutex_unlock()\n");
- /* Flag that modules are to be started */
- pScreenPriv->fServerStarted = TRUE;
+ /* Flag that modules are to be started */
+ pScreenPriv->fServerStarted = TRUE;
- /* Unlock the mutex for threaded modules */
- iReturn = pthread_mutex_unlock(&pScreenPriv->pmServerStarted);
+ /* Unlock the mutex for threaded modules */
+ iReturn = pthread_mutex_unlock (&pScreenPriv->pmServerStarted);
if (iReturn != 0) {
- ErrorF("winBlockHandler - pthread_mutex_unlock () failed: %d\n",
- iReturn);
- goto winBlockHandler_ProcessMessages;
- }
-
- winDebug("winBlockHandler - pthread_mutex_unlock () returned\n");
+ ErrorF ("winBlockHandler - pthread_mutex_unlock () failed: %d\n",
+ iReturn);
+ }
+ else
+ {
+ winDebug ("winBlockHandler - pthread_mutex_unlock () returned\n");
+ }
}
-
- winBlockHandler_ProcessMessages:
#endif
- /* Process all messages on our queue */
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- if ((g_hDlgDepthChange == 0
- || !IsDialogMessage(g_hDlgDepthChange, &msg))
- && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg))
- && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) {
- DispatchMessage(&msg);
- }
- }
+ /*
+ At least one X client has asked to suspend the screensaver, so
+ reset Windows' display idle timer
+ */
+ if (screenSaverSuspended)
+ SetThreadExecutionState(ES_DISPLAY_REQUIRED);
}
diff --git a/hw/xwin/winclipboard.h b/hw/xwin/winclipboard.h
index 203a9639a..22d17952d 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -49,7 +49,6 @@
#include <X11/Xatom.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
-#include <X11/Xlocale.h>
/* Windows headers */
#include <X11/Xwindows.h>
@@ -58,7 +57,7 @@
#define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip"
#define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip"
#ifdef HAS_DEVWINDOWS
-#define WIN_MSG_QUEUE_FNAME "/dev/windows"
+# define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_CONNECT_RETRIES 40
#define WIN_CONNECT_DELAY 4
@@ -79,16 +78,16 @@
*/
extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
-extern void winDebug(const char *format, ...);
-extern void winErrorFVerb(int verb, const char *format, ...);
+extern void ErrorF (const char* /*f*/, ...);
+extern void winDebug (const char *format, ...);
+extern void winErrorFVerb (int verb, const char *format, ...);
/*
* winclipboardinit.c
*/
Bool
- winInitClipboard(void);
+winInitClipboard (void);
HWND winClipboardCreateMessagingWindow(void);
@@ -97,10 +96,10 @@ HWND winClipboardCreateMessagingWindow(void);
*/
void
- winClipboardDOStoUNIX(char *pszData, int iLength);
+winClipboardDOStoUNIX (char *pszData, int iLength);
void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
/*
* winclipboardthread.c
@@ -109,14 +108,7 @@ void
void *winClipboardProc(void *);
void
- winDeinitClipboard(void);
-
-/*
- * winclipboardunicode.c
- */
-
-Bool
- winClipboardDetectUnicodeSupport(void);
+winDeinitClipboard (void);
/*
* winclipboardwndproc.c
@@ -133,6 +125,6 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int
-winClipboardFlushXEvents(HWND hwnd,
+winClipboardFlushXEvents (HWND hwnd,
int iWindow, Display * pDisplay, Bool fUnicodeSupport);
#endif
diff --git a/hw/xwin/winclipboardinit.c b/hw/xwin/winclipboardinit.c
index 696d9e2d6..2657c1873 100644
--- a/hw/xwin/winclipboardinit.c
+++ b/hw/xwin/winclipboardinit.c
@@ -40,40 +40,40 @@
typedef int (*winDispatchProcPtr) (ClientPtr);
-int winProcSetSelectionOwner(ClientPtr /* client */ );
+int winProcSetSelectionOwner(ClientPtr /* client */);
/*
* References to external symbols
*/
-extern pthread_t g_ptClipboardProc;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
-extern Bool g_fClipboard;
-extern HWND g_hwndClipboard;
+extern pthread_t g_ptClipboardProc;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
+extern Bool g_fClipboard;
+extern HWND g_hwndClipboard;
/*
* Intialize the Clipboard module
*/
Bool
-winInitClipboard(void)
+winInitClipboard (void)
{
- ErrorF("winInitClipboard ()\n");
+ winDebug ("winInitClipboard ()\n");
- /* Wrap some internal server functions */
+ /* Wrap some internal server functions */
if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner) {
- winProcSetSelectionOwnerOrig = ProcVector[X_SetSelectionOwner];
- ProcVector[X_SetSelectionOwner] = winProcSetSelectionOwner;
+ winProcSetSelectionOwnerOrig = ProcVector[X_SetSelectionOwner];
+ ProcVector[X_SetSelectionOwner] = winProcSetSelectionOwner;
}
-
- /* Spawn a thread for the Clipboard module */
+
+ /* Spawn a thread for the Clipboard module */
if (pthread_create(&g_ptClipboardProc, NULL, winClipboardProc, NULL)) {
- /* Bail if thread creation failed */
- ErrorF("winInitClipboard - pthread_create failed.\n");
- return FALSE;
+ /* Bail if thread creation failed */
+ ErrorF ("winInitClipboard - pthread_create failed.\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
/*
@@ -81,54 +81,54 @@ winInitClipboard(void)
*/
HWND
-winClipboardCreateMessagingWindow(void)
+winClipboardCreateMessagingWindow (void)
{
- WNDCLASSEX wc;
- HWND hwnd;
-
- /* Setup our window class */
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winClipboardWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = GetModuleHandle(NULL);
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS;
- wc.hIconSm = 0;
- RegisterClassEx(&wc);
-
- /* Create the window */
- hwnd = CreateWindowExA(0, /* Extended styles */
- WIN_CLIPBOARD_WINDOW_CLASS, /* Class name */
- WIN_CLIPBOARD_WINDOW_TITLE, /* Window name */
- WS_OVERLAPPED, /* Not visible anyway */
- CW_USEDEFAULT, /* Horizontal position */
- CW_USEDEFAULT, /* Vertical position */
- CW_USEDEFAULT, /* Right edge */
- CW_USEDEFAULT, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle(NULL), /* Instance handle */
- NULL); /* Creation data */
- assert(hwnd != NULL);
-
- /* I'm not sure, but we may need to call this to start message processing */
- ShowWindow(hwnd, SW_HIDE);
-
- /* Similarly, we may need a call to this even though we don't paint */
- UpdateWindow(hwnd);
-
- return hwnd;
+ WNDCLASSEX wc;
+ HWND hwnd;
+
+ /* Setup our window class */
+ wc.cbSize=sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winClipboardWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = GetModuleHandle (NULL);
+ wc.hIcon = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS;
+ wc.hIconSm = 0;
+ RegisterClassEx (&wc);
+
+ /* Create the window */
+ hwnd = CreateWindowExA (0, /* Extended styles */
+ WIN_CLIPBOARD_WINDOW_CLASS,/* Class name */
+ WIN_CLIPBOARD_WINDOW_TITLE,/* Window name */
+ WS_OVERLAPPED, /* Not visible anyway */
+ CW_USEDEFAULT, /* Horizontal position */
+ CW_USEDEFAULT, /* Vertical position */
+ CW_USEDEFAULT, /* Right edge */
+ CW_USEDEFAULT, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL),/* Instance handle */
+ NULL); /* Creation data */
+ assert (hwnd != NULL);
+
+ /* I'm not sure, but we may need to call this to start message processing */
+ ShowWindow (hwnd, SW_HIDE);
+
+ /* Similarly, we may need a call to this even though we don't paint */
+ UpdateWindow (hwnd);
+
+ return hwnd;
}
void
-winFixClipboardChain(void)
+winFixClipboardChain (void)
{
if (g_fClipboard && g_hwndClipboard) {
- PostMessage(g_hwndClipboard, WM_WM_REINIT, 0, 0);
- }
+ PostMessage (g_hwndClipboard, WM_WM_REINIT, 0, 0);
+ }
}
diff --git a/hw/xwin/winclipboardtextconv.c b/hw/xwin/winclipboardtextconv.c
index 74a351b17..cc6be8dd5 100644
--- a/hw/xwin/winclipboardtextconv.c
+++ b/hw/xwin/winclipboardtextconv.c
@@ -36,9 +36,9 @@
#include <stdlib.h>
void
- winClipboardDOStoUNIX(char *pszSrc, int iLength);
+winClipboardDOStoUNIX (char *pszSrc, int iLength);
void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
/*
* Convert \r\n to \n
@@ -48,26 +48,31 @@ void
*/
void
-winClipboardDOStoUNIX(char *pszSrc, int iLength)
+winClipboardDOStoUNIX (char *pszData, int iLength)
{
- char *pszDest = pszSrc;
- char *pszEnd = pszSrc + iLength;
+ char *pszSrc = pszData;
+ char *pszDest = pszSrc;
+ char *pszEnd = pszSrc + iLength;
- /* Loop until the last character */
+ winDebug("DOXtoUNIX() - Original data:'%s'\n", pszData);
+
+ /* Loop until the last character */
while (pszSrc < pszEnd) {
- /* Copy the current source character to current destination character */
- *pszDest = *pszSrc;
+ /* Copy the current source character to current destination character */
+ *pszDest = *pszSrc;
- /* Advance to the next source character */
- pszSrc++;
+ /* Advance to the next source character */
+ pszSrc++;
- /* Don't advance the destination character if we need to drop an \r */
- if (*pszDest != '\r' || *pszSrc != '\n')
- pszDest++;
+ /* Don't advance the destination character if we need to drop an \r */
+ if (*pszDest != '\r' || *pszSrc != '\n')
+ pszDest++;
}
- /* Move the terminating null */
- *pszDest = '\0';
+ /* Move the terminating null */
+ *pszDest = '\0';
+
+ winDebug("DOStoUNIX() - Final string:'%s'\n", pszData);
}
/*
@@ -75,73 +80,76 @@ winClipboardDOStoUNIX(char *pszSrc, int iLength)
*/
void
-winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength)
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength)
{
- int iNewlineCount = 0;
- unsigned char *pszSrc = *ppszData;
- unsigned char *pszEnd = pszSrc + iLength;
- unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+ int iNewlineCount = 0;
+ unsigned char *pszSrc = *ppszData;
+ unsigned char *pszEnd = pszSrc + iLength;
+ unsigned char *pszDest = NULL, *pszDestBegin = NULL;
- winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
+ winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
- /* Count \n characters without leading \r */
+ /* Count \n characters without leading \r */
while (pszSrc < pszEnd) {
- /* Skip ahead two character if found set of \r\n */
+ /* Skip ahead two character if found set of \r\n */
if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') {
- pszSrc += 2;
- continue;
- }
+ pszSrc += 2;
+ continue;
+ }
- /* Increment the count if found naked \n */
+ /* Increment the count if found naked \n */
if (*pszSrc == '\n') {
- iNewlineCount++;
- }
+ iNewlineCount++;
+ }
- pszSrc++;
+ pszSrc++;
+ }
+
+ /* Return if no naked \n's */
+ if (iNewlineCount == 0)
+ {
+ winDebug("UNIXtoDOS () - no conversion necessary\n");
+ return;
}
- /* Return if no naked \n's */
- if (iNewlineCount == 0)
- return;
-
- /* Allocate a new string */
- pszDestBegin = pszDest = malloc(iLength + iNewlineCount + 1);
+ /* Allocate a new string */
+ pszDestBegin = pszDest = malloc (iLength + iNewlineCount + 1);
- /* Set source pointer to beginning of data string */
- pszSrc = *ppszData;
+ /* Set source pointer to beginning of data string */
+ pszSrc = *ppszData;
- /* Loop through all characters in source string */
+ /* Loop through all characters in source string */
while (pszSrc < pszEnd) {
- /* Copy line endings that are already valid */
+ /* Copy line endings that are already valid */
if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') {
- *pszDest = *pszSrc;
- *(pszDest + 1) = *(pszSrc + 1);
- pszDest += 2;
- pszSrc += 2;
- continue;
- }
-
- /* Add \r to naked \n's */
+ *pszDest = *pszSrc;
+ *(pszDest + 1) = *(pszSrc + 1);
+ pszDest += 2;
+ pszSrc += 2;
+ continue;
+ }
+
+ /* Add \r to naked \n's */
if (*pszSrc == '\n') {
- *pszDest = '\r';
- *(pszDest + 1) = *pszSrc;
- pszDest += 2;
- pszSrc += 1;
- continue;
- }
-
- /* Copy normal characters */
- *pszDest = *pszSrc;
- pszSrc++;
- pszDest++;
+ *pszDest = '\r';
+ *(pszDest + 1) = *pszSrc;
+ pszDest += 2;
+ pszSrc += 1;
+ continue;
+ }
+
+ /* Copy normal characters */
+ *pszDest = *pszSrc;
+ pszSrc++;
+ pszDest++;
}
- /* Put terminating null at end of new string */
- *pszDest = '\0';
+ /* Put terminating null at end of new string */
+ *pszDest = '\0';
- /* Swap string pointers */
- free(*ppszData);
- *ppszData = pszDestBegin;
+ /* Swap string pointers */
+ free (*ppszData);
+ *ppszData = pszDestBegin;
- winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin);
+ winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin);
}
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index 181cb7203..8de7d2f25 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -46,400 +46,410 @@
* References to external symbols
*/
-extern Bool g_fUnicodeClipboard;
-extern unsigned long serverGeneration;
-extern Bool g_fClipboardStarted;
-extern Bool g_fClipboardLaunched;
-extern Bool g_fClipboard;
-extern HWND g_hwndClipboard;
-extern void *g_pClipboardDisplay;
-extern Window g_iClipboardWindow;
+extern Bool g_fUnicodeClipboard;
+extern unsigned long serverGeneration;
+extern Bool g_fClipboardStarted;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboard;
+extern HWND g_hwndClipboard;
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
/*
* Global variables
*/
-static jmp_buf g_jmpEntry;
+static jmp_buf g_jmpEntry;
static int clipboardRestarts = 0;
static XIOErrorHandler g_winClipboardOldIOErrorHandler;
static pthread_t g_winClipboardProcThread;
-Bool g_fUnicodeSupport = FALSE;
-Bool g_fUseUnicode = FALSE;
+Bool g_fUseUnicode = FALSE;
/*
* Local function prototypes
*/
static int
- winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr);
+winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr);
static int
- winClipboardIOErrorHandler(Display * pDisplay);
+winClipboardIOErrorHandler (Display *pDisplay);
+
+static void
+winClipboardThreadExit(void *arg);
/*
* Main thread function
*/
void *
-winClipboardProc(void *pvNotUsed)
+winClipboardProc (void *pvNotUsed)
{
- Atom atomClipboard, atomClipboardManager;
- int iReturn;
- HWND hwnd = NULL;
- int iConnectionNumber = 0;
+ Atom atomClipboard, atomClipboardManager;
+ int iReturn;
+ HWND hwnd = NULL;
+ int iConnectionNumber = 0;
#ifdef HAS_DEVWINDOWS
- int fdMessageQueue = 0;
+ int fdMessageQueue = 0;
#else
- struct timeval tvTimeout;
+ struct timeval tvTimeout;
#endif
- fd_set fdsRead;
- int iMaxDescriptor;
- Display *pDisplay = NULL;
- Window iWindow = None;
- int iRetries;
- Bool fUseUnicode;
- char szDisplay[512];
- int iSelectError;
-
- ErrorF("winClipboardProc - Hello\n");
- ++clipboardRestarts;
-
- /* Do we have Unicode support? */
- g_fUnicodeSupport = winClipboardDetectUnicodeSupport();
-
- /* Do we use Unicode clipboard? */
- fUseUnicode = g_fUnicodeClipboard && g_fUnicodeSupport;
-
- /* Save the Unicode support flag in a global */
- g_fUseUnicode = fUseUnicode;
-
- /* Allow multiple threads to access Xlib */
- if (XInitThreads() == 0) {
- ErrorF("winClipboardProc - XInitThreads failed.\n");
- goto winClipboardProc_Exit;
- }
+ fd_set fdsRead;
+ int iMaxDescriptor;
+ Display *pDisplay = NULL;
+ Window iWindow = None;
+ int iRetries;
+ Bool fUseUnicode;
+ char szDisplay[512];
+ int iSelectError;
- /* See if X supports the current locale */
- if (XSupportsLocale() == False) {
- ErrorF("winClipboardProc - Warning: Locale not supported by X.\n");
- }
+ pthread_cleanup_push(&winClipboardThreadExit, NULL);
+
+ winDebug ("winClipboardProc - Hello\n");
+ ++clipboardRestarts;
- /* Set error handler */
- XSetErrorHandler(winClipboardErrorHandler);
- g_winClipboardProcThread = pthread_self();
+ /* Do we use Unicode clipboard? */
+ fUseUnicode = g_fUnicodeClipboard;
+
+ /* Save the Unicode support flag in a global */
+ g_fUseUnicode = fUseUnicode;
+
+ /* Set error handler */
+ XSetErrorHandler (winClipboardErrorHandler);
+ g_winClipboardProcThread = pthread_self();
g_winClipboardOldIOErrorHandler =
XSetIOErrorHandler(winClipboardIOErrorHandler);
- /* Set jump point for Error exits */
- iReturn = setjmp(g_jmpEntry);
-
- /* Check if we should continue operations */
+ /* Set jump point for Error exits */
+ iReturn = setjmp (g_jmpEntry);
+
+ /* Check if we should continue operations */
if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) {
- /* setjmp returned an unknown value, exit */
+ /* setjmp returned an unknown value, exit */
ErrorF("winClipboardProc - setjmp returned: %d exiting\n", iReturn);
- goto winClipboardProc_Exit;
+ goto winClipboardProc_Exit;
}
- else if (iReturn == WIN_JMP_ERROR_IO) {
- /* TODO: Cleanup the Win32 window and free any allocated memory */
- ErrorF("winClipboardProc - setjmp returned for IO Error Handler.\n");
- pthread_exit(NULL);
+ else if (iReturn == WIN_JMP_ERROR_IO)
+ {
+ /* TODO: cleanup and free any allocated memory */
+ ErrorF("winClipboardProc - setjmp returned for IO Error Handler\n");
+ goto winClipboardProc_Done;
}
- /* Use our generated cookie for authentication */
- winSetAuthorization();
+ /* Use our generated cookie for authentication */
+ winSetAuthorization();
- /* Initialize retry count */
- iRetries = 0;
+ /* Initialize retry count */
+ iRetries = 0;
- /* Setup the display connection string x */
- /*
- * NOTE: Always connect to screen 0 since we require that screen
- * numbers start at 0 and increase without gaps. We only need
- * to connect to one screen on the display to get events
- * for all screens on the display. That is why there is only
- * one clipboard client thread.
- */
- snprintf(szDisplay, 512, "127.0.0.1:%s.0", display);
+ /* Setup the display connection string x */
+ /*
+ * NOTE: Always connect to screen 0 since we require that screen
+ * numbers start at 0 and increase without gaps. We only need
+ * to connect to one screen on the display to get events
+ * for all screens on the display. That is why there is only
+ * one clipboard client thread.
+ */
+ winGetDisplayName(szDisplay, 0);
- /* Print the display connection string */
- ErrorF("winClipboardProc - DISPLAY=%s\n", szDisplay);
+ /* Print the display connection string */
+ ErrorF ("winClipboardProc - DISPLAY=%s\n", szDisplay);
- /* Open the X display */
+ /* Open the X display */
do {
- pDisplay = XOpenDisplay(szDisplay);
+ pDisplay = XOpenDisplay (szDisplay);
if (pDisplay == NULL) {
- ErrorF("winClipboardProc - Could not open display, "
+ ErrorF ("winClipboardProc - Could not open display, "
"try: %d, sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY);
- ++iRetries;
- sleep(WIN_CONNECT_DELAY);
- continue;
- }
- else
- break;
+ ++iRetries;
+ sleep (WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
}
- while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+ while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
- /* Make sure that the display opened */
+ /* Make sure that the display opened */
if (pDisplay == NULL) {
- ErrorF("winClipboardProc - Failed opening the display, giving up\n");
- goto winClipboardProc_Done;
+ ErrorF ("winClipboardProc - Failed opening the display, giving up\n");
+ goto winClipboardProc_Done;
}
- /* Save the display in the screen privates */
- g_pClipboardDisplay = pDisplay;
+ /* Save the display in a global used by the wndproc */
+ g_pClipboardDisplay = pDisplay;
- ErrorF("winClipboardProc - XOpenDisplay () returned and "
- "successfully opened the display.\n");
+ ErrorF ("winClipboardProc - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
- /* Get our connection number */
- iConnectionNumber = ConnectionNumber(pDisplay);
+ /* Get our connection number */
+ iConnectionNumber = ConnectionNumber (pDisplay);
#ifdef HAS_DEVWINDOWS
- /* Open a file descriptor for the windows message queue */
- fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY);
+ /* Open a file descriptor for the windows message queue */
+ fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
if (fdMessageQueue == -1) {
- ErrorF("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
- goto winClipboardProc_Done;
+ ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
+ goto winClipboardProc_Done;
}
- /* Find max of our file descriptors */
- iMaxDescriptor = max(fdMessageQueue, iConnectionNumber) + 1;
+ /* Find max of our file descriptors */
+ iMaxDescriptor = max (fdMessageQueue, iConnectionNumber) + 1;
#else
- iMaxDescriptor = iConnectionNumber + 1;
+ iMaxDescriptor = iConnectionNumber + 1;
#endif
- /* Create atoms */
- atomClipboard = XInternAtom(pDisplay, "CLIPBOARD", False);
- atomClipboardManager = XInternAtom(pDisplay, "CLIPBOARD_MANAGER", False);
-
- /* Create a messaging window */
- iWindow = XCreateSimpleWindow(pDisplay,
- DefaultRootWindow(pDisplay),
- 1, 1,
- 500, 500,
- 0,
- BlackPixel(pDisplay, 0),
- BlackPixel(pDisplay, 0));
+ /* Create atoms */
+ atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
+ atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
+
+ /* Create a messaging window */
+ iWindow = XCreateSimpleWindow (pDisplay,
+ DefaultRootWindow (pDisplay),
+ 1, 1,
+ 500, 500,
+ 0,
+ BlackPixel (pDisplay, 0),
+ BlackPixel (pDisplay, 0));
if (iWindow == 0) {
- ErrorF("winClipboardProc - Could not create an X window.\n");
- goto winClipboardProc_Done;
+ ErrorF ("winClipboardProc - Could not create an X window.\n");
+ goto winClipboardProc_Done;
}
- XStoreName(pDisplay, iWindow, "xwinclip");
+ XStoreName(pDisplay, iWindow, "xwinclip");
- /* Select event types to watch */
+ /* Select event types to watch */
if (XSelectInput(pDisplay, iWindow, PropertyChangeMask) == BadWindow)
- ErrorF("winClipboardProc - XSelectInput generated BadWindow "
- "on messaging window\n");
-
- /* Save the window in the screen privates */
- g_iClipboardWindow = iWindow;
+ ErrorF ("winClipboardProc - XSelectInput generated BadWindow "
+ "on messaging window\n");
- /* Create Windows messaging window */
- hwnd = winClipboardCreateMessagingWindow();
+ /* Save the window in the screen privates */
+ g_iClipboardWindow = iWindow;
- /* Save copy of HWND in screen privates */
- g_hwndClipboard = hwnd;
+ /* Create Windows messaging window */
+ hwnd = winClipboardCreateMessagingWindow ();
+
+ /* Save copy of HWND in screen privates */
+ g_hwndClipboard = hwnd;
- /* Assert ownership of selections if Win32 clipboard is owned */
+ /* Assert ownership of selections if Win32 clipboard is owned */
if (NULL != GetClipboardOwner()) {
- /* PRIMARY */
- iReturn = XSetSelectionOwner(pDisplay, XA_PRIMARY,
- iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow ||
+ /* PRIMARY */
+ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow ||
XGetSelectionOwner(pDisplay, XA_PRIMARY) != iWindow) {
- ErrorF("winClipboardProc - Could not set PRIMARY owner\n");
- goto winClipboardProc_Done;
- }
-
- /* CLIPBOARD */
- iReturn = XSetSelectionOwner(pDisplay, atomClipboard,
- iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow ||
+ ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
+ goto winClipboardProc_Done;
+ }
+
+ /* CLIPBOARD */
+ iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow ||
XGetSelectionOwner(pDisplay, atomClipboard) != iWindow) {
- ErrorF("winClipboardProc - Could not set CLIPBOARD owner\n");
- goto winClipboardProc_Done;
- }
+ ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
+ goto winClipboardProc_Done;
+ }
}
- /* Pre-flush X events */
- /*
- * NOTE: Apparently you'll freeze if you don't do this,
- * because there may be events in local data structures
- * already.
- */
+ /* Pre-flush X events */
+ /*
+ * NOTE: Apparently you'll freeze if you don't do this,
+ * because there may be events in local data structures
+ * already.
+ */
winClipboardFlushXEvents(hwnd, iWindow, pDisplay, fUseUnicode);
- /* Pre-flush Windows messages */
- if (!winClipboardFlushWindowsMessageQueue(hwnd))
- return 0;
+ /* Pre-flush Windows messages */
+ if (!winClipboardFlushWindowsMessageQueue (hwnd))
+ {
+ ErrorF ("winClipboardProc - winClipboardFlushWindowsMessageQueue failed\n");
+ pthread_exit (NULL);
+ }
- /* Signal that the clipboard client has started */
- g_fClipboardStarted = TRUE;
+ /* Signal that the clipboard client has started */
+ g_fClipboardStarted = TRUE;
- /* Loop for X events */
+ /* Loop for X events */
while (1) {
- /* Setup the file descriptor set */
- /*
- * NOTE: You have to do this before every call to select
- * because select modifies the mask to indicate
- * which descriptors are ready.
- */
- FD_ZERO(&fdsRead);
- FD_SET(iConnectionNumber, &fdsRead);
+ /* Setup the file descriptor set */
+ /*
+ * NOTE: You have to do this before every call to select
+ * because select modifies the mask to indicate
+ * which descriptors are ready.
+ */
+ FD_ZERO (&fdsRead);
+ FD_SET (iConnectionNumber, &fdsRead);
#ifdef HAS_DEVWINDOWS
- FD_SET(fdMessageQueue, &fdsRead);
+ FD_SET (fdMessageQueue, &fdsRead);
#else
- tvTimeout.tv_sec = 0;
- tvTimeout.tv_usec = 100;
+ tvTimeout.tv_sec = 0;
+ tvTimeout.tv_usec = 100;
#endif
- /* Wait for a Windows event or an X event */
- iReturn = select(iMaxDescriptor, /* Highest fds number */
- &fdsRead, /* Read mask */
- NULL, /* No write mask */
- NULL, /* No exception mask */
+ winDebug ("winClipboardProc - Waiting in select\n");
+
+ /* Wait for a Windows event or an X event */
+ iReturn = select (iMaxDescriptor, /* Highest fds number */
+ &fdsRead, /* Read mask */
+ NULL, /* No write mask */
+ NULL, /* No exception mask */
#ifdef HAS_DEVWINDOWS
- NULL /* No timeout */
+ NULL /* No timeout */
#else
- &tvTimeout /* Set timeout */
+ &tvTimeout /* Set timeout */
#endif
- );
+ );
#ifndef HAS_WINSOCK
- iSelectError = errno;
+ iSelectError = errno;
#else
- iSelectError = WSAGetLastError();
+ iSelectError = WSAGetLastError();
#endif
if (iReturn < 0) {
#ifndef HAS_WINSOCK
- if (iSelectError == EINTR)
+ if (iSelectError == EINTR)
#else
- if (iSelectError == WSAEINTR)
+ if (iSelectError == WSAEINTR)
#endif
- continue;
-
- ErrorF("winClipboardProc - Call to select () failed: %d. "
- "Bailing.\n", iReturn);
- break;
- }
-
- /* Branch on which descriptor became active */
- if (FD_ISSET(iConnectionNumber, &fdsRead)) {
- /* Process X events */
- /* Exit when we see that server is shutting down */
- iReturn = winClipboardFlushXEvents(hwnd,
+ continue;
+
+ ErrorF ("winClipboardProc - Call to select () failed: %d. "
+ "Bailing.\n", iReturn);
+ break;
+ }
+
+ winDebug ("winClipboardProc - select returned %d\n", iReturn);
+
+ /* Branch on which descriptor became active */
+ if (FD_ISSET (iConnectionNumber, &fdsRead))
+ {
+ winDebug ("winClipboardProc - X connection ready, pumping X event queue\n");
+
+ /* Process X events */
+ /* Exit when we see that server is shutting down */
+ iReturn = winClipboardFlushXEvents (hwnd,
iWindow, pDisplay, fUseUnicode);
if (WIN_XEVENTS_SHUTDOWN == iReturn) {
- ErrorF("winClipboardProc - winClipboardFlushXEvents "
- "trapped shutdown event, exiting main loop.\n");
- break;
- }
- }
+ ErrorF ("winClipboardProc - winClipboardFlushXEvents "
+ "trapped shutdown event, exiting main loop.\n");
+ break;
+ }
+ }
#ifdef HAS_DEVWINDOWS
- /* Check for Windows event ready */
- if (FD_ISSET(fdMessageQueue, &fdsRead))
+ /* Check for Windows event ready */
+ if (FD_ISSET (fdMessageQueue, &fdsRead))
#else
- if (1)
+ if (1)
#endif
- {
- /* Process Windows messages */
+ {
+ winDebug ("winClipboardProc - /dev/windows ready, pumping Windows message queue\n");
+
+ /* Process Windows messages */
if (!winClipboardFlushWindowsMessageQueue(hwnd)) {
- ErrorF("winClipboardProc - "
- "winClipboardFlushWindowsMessageQueue trapped "
- "WM_QUIT message, exiting main loop.\n");
- break;
- }
+ ErrorF ("winClipboardProc - "
+ "winClipboardFlushWindowsMessageQueue trapped "
+ "WM_QUIT message, exiting main loop.\n");
+ break;
+ }
+ }
+
+ if (!(FD_ISSET(iConnectionNumber, &fdsRead)) && !(FD_ISSET(fdMessageQueue, &fdsRead)))
+ {
+ winDebug ("winClipboardProc - Spurious wake\n");
}
}
- winClipboardProc_Exit:
- /* disable the clipboard, which means the thread will die */
- g_fClipboard = FALSE;
+winClipboardProc_Exit:
+ /* disable the clipboard, which means the thread will die */
+ g_fClipboard = FALSE;
- winClipboardProc_Done:
- /* Close our Windows window */
+winClipboardProc_Done:
+ /* Close our Windows window */
if (g_hwndClipboard) {
- /* Destroy the Window window (hwnd) */
- winDebug("winClipboardProc - Destroy Windows window\n");
- PostMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
- winClipboardFlushWindowsMessageQueue(g_hwndClipboard);
+ /* Destroy the Window window (hwnd) */
+ winDebug("winClipboardProc - Destroy Windows window\n");
+ PostMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
+ winClipboardFlushWindowsMessageQueue(g_hwndClipboard);
}
- /* Close our X window */
+ /* Close our X window */
if (pDisplay && iWindow) {
- iReturn = XDestroyWindow(pDisplay, iWindow);
- if (iReturn == BadWindow)
- ErrorF("winClipboardProc - XDestroyWindow returned BadWindow.\n");
- else
- ErrorF("winClipboardProc - XDestroyWindow succeeded.\n");
+ iReturn = XDestroyWindow (pDisplay, iWindow);
+ if (iReturn == BadWindow)
+ ErrorF ("winClipboardProc - XDestroyWindow returned BadWindow.\n");
+ else
+ ErrorF ("winClipboardProc - XDestroyWindow succeeded.\n");
}
#ifdef HAS_DEVWINDOWS
- /* Close our Win32 message handle */
- if (fdMessageQueue)
- close(fdMessageQueue);
+ /* Close our Win32 message handle */
+ if (fdMessageQueue)
+ close (fdMessageQueue);
#endif
#if 0
- /*
- * FIXME: XCloseDisplay hangs if we call it, as of 2004/03/26. The
- * XSync and XSelectInput calls did not help.
- */
+ /*
+ * FIXME: XCloseDisplay hangs if we call it, as of 2004/03/26. The
+ * XSync and XSelectInput calls did not help.
+ */
- /* Discard any remaining events */
- XSync(pDisplay, TRUE);
+ /* Discard any remaining events */
+ XSync (pDisplay, TRUE);
- /* Select event types to watch */
+ /* Select event types to watch */
XSelectInput(pDisplay, DefaultRootWindow(pDisplay), None);
- /* Close our X display */
+ /* Close our X display */
if (pDisplay) {
- XCloseDisplay(pDisplay);
+ XCloseDisplay (pDisplay);
}
#endif
- /* global clipboard variable reset */
- g_fClipboardLaunched = FALSE;
- g_fClipboardStarted = FALSE;
- g_iClipboardWindow = None;
- g_pClipboardDisplay = NULL;
- g_hwndClipboard = NULL;
+ /* global clipboard variable reset */
+ g_fClipboardLaunched = FALSE;
+ g_fClipboardStarted = FALSE;
+ g_iClipboardWindow = None;
+ g_pClipboardDisplay = NULL;
+ g_hwndClipboard = NULL;
- /* checking if we need to restart */
+ /* checking if we need to restart */
if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES) {
- /* terminates clipboard thread but the main server still lives */
+ /* terminates clipboard thread but the main server still lives */
ErrorF
("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n",
clipboardRestarts);
- g_fClipboard = FALSE;
- return;
+ g_fClipboard = FALSE;
+ return;
}
if (g_fClipboard) {
- sleep(WIN_CLIPBOARD_DELAY);
- ErrorF("winClipboardProc - trying to restart clipboard thread \n");
- /* Create the clipboard client thread */
+ sleep(WIN_CLIPBOARD_DELAY);
+ ErrorF("winClipboardProc - trying to restart clipboard thread \n");
+ /* Create the clipboard client thread */
if (!winInitClipboard()) {
- ErrorF("winClipboardProc - winClipboardInit failed.\n");
- return;
+ ErrorF ("winClipboardProc - winClipboardInit failed.\n");
+ return;
}
- winDebug("winClipboardProc - winInitClipboard returned.\n");
- /* Flag that clipboard client has been launched */
- g_fClipboardLaunched = TRUE;
+ winDebug ("winClipboardProc - winInitClipboard returned.\n");
+ /* Flag that clipboard client has been launched */
+ g_fClipboardLaunched = TRUE;
}
else {
- ErrorF("winClipboardProc - Clipboard disabled - Exit from server \n");
- /* clipboard thread has exited, stop server as well */
- kill(getpid(), SIGTERM);
+ ErrorF ("winClipboardProc - Clipboard disabled - Exit from server \n");
+ /* clipboard thread has exited, stop server as well */
+ kill(getpid(), SIGTERM);
}
- return NULL;
+ pthread_cleanup_pop(0);
+
+ return NULL;
}
/*
@@ -447,15 +457,15 @@ winClipboardProc(void *pvNotUsed)
*/
static int
-winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr)
+winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr)
{
- char pszErrorMsg[100];
-
+ char pszErrorMsg[100];
+
XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg));
- ErrorF("winClipboardErrorHandler - ERROR: \n\t%s\n"
- "\tSerial: %lu, Request Code: %d, Minor Code: %d\n",
+ ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n"
+ "\tSerial: %lu, Request Code: %d, Minor Code: %d\n",
pszErrorMsg, pErr->serial, pErr->request_code, pErr->minor_code);
- return 0;
+ return 0;
}
/*
@@ -463,17 +473,28 @@ winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr)
*/
static int
-winClipboardIOErrorHandler(Display * pDisplay)
+winClipboardIOErrorHandler (Display *pDisplay)
{
- ErrorF("winClipboardIOErrorHandler!\n\n");
+ ErrorF ("winClipboardIOErrorHandler!\n");
if (pthread_equal(pthread_self(), g_winClipboardProcThread)) {
- /* Restart at the main entry point */
- longjmp(g_jmpEntry, WIN_JMP_ERROR_IO);
+ /* Restart at the main entry point */
+ longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
}
- if (g_winClipboardOldIOErrorHandler)
- g_winClipboardOldIOErrorHandler(pDisplay);
+ if (g_winClipboardOldIOErrorHandler)
+ g_winClipboardOldIOErrorHandler(pDisplay);
+
+ return 0;
+}
- return 0;
+/*
+ * winClipboardThreadExit - Thread exit handler
+ */
+
+static void
+winClipboardThreadExit(void *arg)
+{
+ /* clipboard thread has exited, stop server as well */
+ kill(getpid(), SIGTERM);
}
diff --git a/hw/xwin/winclipboardunicode.c b/hw/xwin/winclipboardunicode.c
deleted file mode 100644
index 9c06f7b4d..000000000
--- a/hw/xwin/winclipboardunicode.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "winclipboard.h"
-
-/*
- * Determine whether we suport Unicode or not.
- * NOTE: Currently, just check if we are on an NT-based platform or not.
- */
-
-Bool
-winClipboardDetectUnicodeSupport(void)
-{
- Bool fReturn = FALSE;
- OSVERSIONINFO osvi = { 0 };
-
- /* Get operating system version information */
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
-
- /* Branch on platform ID */
- switch (osvi.dwPlatformId) {
- case VER_PLATFORM_WIN32_NT:
- /* Unicode supported on NT only */
- fReturn = TRUE;
- break;
-
- case VER_PLATFORM_WIN32_WINDOWS:
- /* Unicode is not supported on non-NT */
- fReturn = FALSE;
- break;
- }
-
- return fReturn;
-}
diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c
index 78b061517..3a710ecfb 100644
--- a/hw/xwin/winclipboardwndproc.c
+++ b/hw/xwin/winclipboardwndproc.c
@@ -48,11 +48,10 @@
* References to external symbols
*/
-extern Bool g_fUseUnicode;
-extern Bool g_fUnicodeSupport;
-extern void *g_pClipboardDisplay;
-extern Window g_iClipboardWindow;
-extern Atom g_atomLastOwnedSelection;
+extern Bool g_fUseUnicode;
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
/*
* Local function prototypes
@@ -60,70 +59,86 @@ extern Atom g_atomLastOwnedSelection;
static int
-winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
- Bool fUseUnicode, int iTimeoutSec);
+winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
+ Bool fUseUnicode, int iTimeoutSec);
/*
* Process X events up to specified timeout
*/
static int
-winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
- Bool fUseUnicode, int iTimeoutSec)
+winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
+ Bool fUseUnicode, int iTimeoutSec)
{
- int iConnNumber;
- struct timeval tv;
- int iReturn;
- DWORD dwStopTime = (GetTickCount() / 1000) + iTimeoutSec;
+ int iConnNumber;
+ struct timeval tv;
+ int iReturn;
+ DWORD dwStopTime = GetTickCount() + iTimeoutSec * 1000;
- /* We need to ensure that all pending events are processed */
- XSync(pDisplay, FALSE);
+ winDebug("winProcessXEventsTimeout () - pumping X events for %d seconds\n", iTimeoutSec);
- /* Get our connection number */
- iConnNumber = ConnectionNumber(pDisplay);
+ /* Get our connection number */
+ iConnNumber = ConnectionNumber (pDisplay);
- /* Loop for X events */
+ /* Loop for X events */
while (1) {
- fd_set fdsRead;
-
- /* Setup the file descriptor set */
- FD_ZERO(&fdsRead);
- FD_SET(iConnNumber, &fdsRead);
-
- /* Adjust timeout */
- tv.tv_sec = dwStopTime - (GetTickCount() / 1000);
- tv.tv_usec = 0;
-
- /* Break out if no time left */
- if (tv.tv_sec < 0)
- return WIN_XEVENTS_SUCCESS;
-
- /* Wait for an X event */
- iReturn = select(iConnNumber + 1, /* Highest fds number */
- &fdsRead, /* Read mask */
- NULL, /* No write mask */
- NULL, /* No exception mask */
- &tv); /* No timeout */
- if (iReturn < 0) {
- ErrorF("winProcessXEventsTimeout - Call to select () failed: %d. "
- "Bailing.\n", iReturn);
- break;
- }
-
- /* Branch on which descriptor became active */
+ fd_set fdsRead;
+ long remainingTime;
+
+ /* We need to ensure that all pending events are processed */
+ XSync (pDisplay, FALSE);
+
+ /* Setup the file descriptor set */
+ FD_ZERO (&fdsRead);
+ FD_SET (iConnNumber, &fdsRead);
+
+ /* Adjust timeout */
+ remainingTime = dwStopTime - GetTickCount();
+ tv.tv_sec = remainingTime / 1000;
+ tv.tv_usec = (remainingTime % 1000) * 1000;
+ winDebug("winProcessXEventsTimeout () - %d milliseconds left\n", remainingTime);
+
+ /* Break out if no time left */
+ if (remainingTime <= 0)
+ return WIN_XEVENTS_SUCCESS;
+
+ /* Wait for an X event */
+ iReturn = select (iConnNumber + 1,/* Highest fds number */
+ &fdsRead, /* Read mask */
+ NULL, /* No write mask */
+ NULL, /* No exception mask */
+ &tv); /* Timeout */
+ if (iReturn < 0)
+ {
+ ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d. "
+ "Bailing.\n", iReturn);
+ break;
+ }
+
+ /* Branch on which descriptor became active */
if (FD_ISSET(iConnNumber, &fdsRead)) {
- /* Process X events */
- /* Exit when we see that server is shutting down */
- iReturn = winClipboardFlushXEvents(hwnd,
- iWindow, pDisplay, fUseUnicode);
- if (WIN_XEVENTS_NOTIFY == iReturn) {
- /* Bail out if notify processed */
- return iReturn;
- }
+ /* Process X events */
+ /* Exit when we see that server is shutting down */
+ iReturn = winClipboardFlushXEvents (hwnd,
+ iWindow,
+ pDisplay,
+ fUseUnicode);
+
+ winDebug("winProcessXEventsTimeout () - winClipboardFlushXEvents returned %d\n", iReturn);
+
+ if (WIN_XEVENTS_NOTIFY == iReturn)
+ {
+ /* Bail out if notify processed */
+ return iReturn;
+ }
+ }
+ else
+ {
+ winDebug("winProcessXEventsTimeout - Spurious wake\n");
}
}
- return WIN_XEVENTS_SUCCESS;
+ return WIN_XEVENTS_SUCCESS;
}
/*
@@ -133,371 +148,401 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
LRESULT CALLBACK
winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- static HWND s_hwndNextViewer;
- static Bool s_fCBCInitialized;
+ static HWND s_hwndNextViewer;
+ static Bool s_fCBCInitialized;
+
+#if CYGDEBUG
+ winDebugWin32Message("winClipboardWindowProc", hwnd, message, wParam, lParam);
+#endif
- /* Branch on message type */
+ /* Branch on message type */
switch (message) {
case WM_DESTROY:
- {
- winDebug("winClipboardWindowProc - WM_DESTROY\n");
-
- /* Remove ourselves from the clipboard chain */
- ChangeClipboardChain(hwnd, s_hwndNextViewer);
+ {
+ winDebug ("winClipboardWindowProc - WM_DESTROY\n");
- s_hwndNextViewer = NULL;
+ /* Remove ourselves from the clipboard chain */
+ ChangeClipboardChain (hwnd, s_hwndNextViewer);
+
+ s_hwndNextViewer = NULL;
- PostQuitMessage(0);
- }
- return 0;
+ PostQuitMessage (0);
+ }
+ return 0;
case WM_CREATE:
- {
- HWND first, next;
- DWORD error_code = 0;
-
- winDebug("winClipboardWindowProc - WM_CREATE\n");
+ {
+ HWND first, next;
+ DWORD error_code = 0;
- first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ winDebug ("winClipboardWindowProc - WM_CREATE\n");
+
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
if (first == hwnd)
return 0; /* Make sure it's not us! */
- /* Add ourselves to the clipboard viewer chain */
- next = SetClipboardViewer(hwnd);
- error_code = GetLastError();
- if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
- s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
- else
- s_fCBCInitialized = FALSE;
- }
- return 0;
+ /* Add ourselves to the clipboard viewer chain */
+ next = SetClipboardViewer (hwnd);
+ error_code = GetLastError();
+ if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
+ s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
+ else
+ s_fCBCInitialized = FALSE;
+ }
+ return 0;
case WM_CHANGECBCHAIN:
- {
- winDebug("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
- "lParam(%x) s_hwndNextViewer(%x)\n",
- wParam, lParam, s_hwndNextViewer);
+ {
+ winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
+ "lParam(%x) s_hwndNextViewer(%x)\n",
+ wParam, lParam, s_hwndNextViewer);
if ((HWND) wParam == s_hwndNextViewer) {
- s_hwndNextViewer = (HWND) lParam;
+ s_hwndNextViewer = (HWND) lParam;
if (s_hwndNextViewer == hwnd) {
- s_hwndNextViewer = NULL;
- winErrorFVerb(1, "winClipboardWindowProc - WM_CHANGECBCHAIN: "
- "attempted to set next window to ourselves.");
- }
- }
- else if (s_hwndNextViewer)
+ s_hwndNextViewer = NULL;
+ winErrorFVerb (1, "winClipboardWindowProc - WM_CHANGECBCHAIN: "
+ "attempted to set next window to ourselves.");
+ }
+ }
+ else if (s_hwndNextViewer)
SendMessage(s_hwndNextViewer, message, wParam, lParam);
- }
- winDebug("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
- return 0;
+ }
+ winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
+ return 0;
case WM_WM_REINIT:
- {
+ {
/* Ensure that we're in the clipboard chain. Some apps,
* WinXP's remote desktop for one, don't play nice with the
* chain. This message is called whenever we receive a
* WM_ACTIVATEAPP message to ensure that we continue to
* receive clipboard messages.
- *
- * It might be possible to detect if we're still in the chain
- * by calling SendMessage (GetClipboardViewer(),
- * WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the
- * WM_DRAWCLIPBOARD message. That, however, might be more
- * expensive than just putting ourselves back into the chain.
- */
+ *
+ * It might be possible to detect if we're still in the chain
+ * by calling SendMessage (GetClipboardViewer(),
+ * WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the
+ * WM_DRAWCLIPBOARD message. That, however, might be more
+ * expensive than just putting ourselves back into the chain.
+ */
- HWND first, next;
- DWORD error_code = 0;
+ HWND first, next;
+ DWORD error_code = 0;
- winDebug("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
+ winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
- first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
if (first == hwnd)
return 0; /* Make sure it's not us! */
- winDebug(" WM_WM_REINIT: Replacing us(%x) with %x at head "
- "of chain\n", hwnd, s_hwndNextViewer);
- s_fCBCInitialized = FALSE;
- ChangeClipboardChain(hwnd, s_hwndNextViewer);
- s_hwndNextViewer = NULL;
- s_fCBCInitialized = FALSE;
- winDebug(" WM_WM_REINIT: Putting us back at head of chain.\n");
- first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head "
+ "of chain\n", hwnd, s_hwndNextViewer);
+ s_fCBCInitialized = FALSE;
+ ChangeClipboardChain (hwnd, s_hwndNextViewer);
+ s_hwndNextViewer = NULL;
+ s_fCBCInitialized = FALSE;
+ winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n");
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
if (first == hwnd)
return 0; /* Make sure it's not us! */
- next = SetClipboardViewer(hwnd);
- error_code = GetLastError();
- if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
- s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
- else
- s_fCBCInitialized = FALSE;
- }
- winDebug("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
- return 0;
+ next = SetClipboardViewer (hwnd);
+ error_code = GetLastError();
+ if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
+ s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
+ else
+ s_fCBCInitialized = FALSE;
+ }
+ winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
+ return 0;
case WM_DRAWCLIPBOARD:
- {
- static Atom atomClipboard;
- static int generation;
- static Bool s_fProcessingDrawClipboard = FALSE;
- Display *pDisplay = g_pClipboardDisplay;
- Window iWindow = g_iClipboardWindow;
- int iReturn;
+ {
+ static Atom atomClipboard;
+ static int generation;
+ static Bool s_fProcessingDrawClipboard = FALSE;
+ Display *pDisplay = g_pClipboardDisplay;
+ Window iWindow = g_iClipboardWindow;
+ int iReturn;
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
if (generation != serverGeneration) {
generation = serverGeneration;
- atomClipboard = XInternAtom(pDisplay, "CLIPBOARD", False);
- }
+ atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
+ }
- /*
- * We've occasionally seen a loop in the clipboard chain.
- * Try and fix it on the first hint of recursion.
- */
+ /*
+ * We've occasionally seen a loop in the clipboard chain.
+ * Try and fix it on the first hint of recursion.
+ */
if (!s_fProcessingDrawClipboard) {
- s_fProcessingDrawClipboard = TRUE;
- }
+ s_fProcessingDrawClipboard = TRUE;
+ }
else {
- /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
- s_fCBCInitialized = FALSE;
- ChangeClipboardChain(hwnd, s_hwndNextViewer);
- winFixClipboardChain();
- winErrorFVerb(1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Nested calls detected. Re-initing.\n");
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- s_fProcessingDrawClipboard = FALSE;
- return 0;
- }
-
- /* Bail on first message */
+ /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
+ s_fCBCInitialized = FALSE;
+ ChangeClipboardChain (hwnd, s_hwndNextViewer);
+ winFixClipboardChain();
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Nested calls detected. Re-initing.\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ return 0;
+ }
+
+ /* Bail on first message */
if (!s_fCBCInitialized) {
- s_fCBCInitialized = TRUE;
- s_fProcessingDrawClipboard = FALSE;
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- return 0;
- }
-
- /*
- * NOTE: We cannot bail out when NULL == GetClipboardOwner ()
- * because some applications deal with the clipboard in a manner
- * that causes the clipboard owner to be NULL when they are in
- * fact taking ownership. One example of this is the Win32
- * native compile of emacs.
- */
-
- /* Bail when we still own the clipboard */
+ s_fCBCInitialized = TRUE;
+ s_fProcessingDrawClipboard = FALSE;
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ return 0;
+ }
+
+ /*
+ * NOTE: We cannot bail out when NULL == GetClipboardOwner ()
+ * because some applications deal with the clipboard in a manner
+ * that causes the clipboard owner to be NULL when they are in
+ * fact taking ownership. One example of this is the Win32
+ * native compile of emacs.
+ */
+
+ /* Bail when we still own the clipboard */
if (hwnd == GetClipboardOwner()) {
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "We own the clipboard, returning.\n");
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- s_fProcessingDrawClipboard = FALSE;
- if (s_hwndNextViewer)
- SendMessage(s_hwndNextViewer, message, wParam, lParam);
- return 0;
- }
-
- /*
- * Do not take ownership of the X11 selections when something
- * other than CF_TEXT or CF_UNICODETEXT has been copied
- * into the Win32 clipboard.
- */
- if (!IsClipboardFormatAvailable(CF_TEXT)
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "We own the clipboard, returning.\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+ }
+
+ /*
+ * Do not take ownership of the X11 selections when something
+ * other than CF_TEXT or CF_UNICODETEXT has been copied
+ * into the Win32 clipboard.
+ */
+ if (!IsClipboardFormatAvailable (CF_TEXT)
&& !IsClipboardFormatAvailable(CF_UNICODETEXT)) {
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Clipboard does not contain CF_TEXT nor "
- "CF_UNICODETEXT.\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Clipboard does not contain CF_TEXT nor "
+ "CF_UNICODETEXT.\n");
+
+ winDebug ("winClipboardWindowProc: %d formats\n", CountClipboardFormats());
+ {
+ unsigned int format = 0;
+ do {
+ format = EnumClipboardFormats(format);
+ if (GetLastError() != ERROR_SUCCESS)
+ {
+ winDebug ("winClipboardWindowProc: EnumClipboardFormats failed %x\n", GetLastError());
+ }
+ if (format > 0xc000)
+ {
+ char buff[256];
+ GetClipboardFormatName(format, buff, 256);
+ winDebug ("winClipboardWindowProc: %d %s\n", format, buff);
+ }
+ else if (format > 0)
+ winDebug ("winClipboardWindowProc: %d\n", format);
+ } while (format != 0);
+ }
- /*
- * We need to make sure that the X Server has processed
- * previous XSetSelectionOwner messages.
- */
- XSync(pDisplay, FALSE);
+ /*
+ * We need to make sure that the X Server has processed
+ * previous XSetSelectionOwner messages.
+ */
+ XSync (pDisplay, FALSE);
winDebug("winClipboardWindowProc - XSync done.\n");
-
- /* Release PRIMARY selection if owned */
- iReturn = XGetSelectionOwner(pDisplay, XA_PRIMARY);
+
+ /* Release PRIMARY selection if owned */
+ iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
if (iReturn == g_iClipboardWindow) {
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "PRIMARY selection is owned by us.\n");
- XSetSelectionOwner(pDisplay, XA_PRIMARY, None, CurrentTime);
- }
- else if (BadWindow == iReturn || BadAtom == iReturn)
- winErrorFVerb(1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "XGetSelection failed for PRIMARY: %d\n",
- iReturn);
-
- /* Release CLIPBOARD selection if owned */
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "PRIMARY selection is owned by us, releasing\n");
+ XSetSelectionOwner (pDisplay,
+ XA_PRIMARY,
+ None,
+ CurrentTime);
+ }
+ else if (BadWindow == iReturn || BadAtom == iReturn)
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "XGetSelectionOwner failed for PRIMARY: %d\n", iReturn);
+
+ /* Release CLIPBOARD selection if owned */
iReturn = XGetSelectionOwner(pDisplay, atomClipboard);
if (iReturn == g_iClipboardWindow) {
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "CLIPBOARD selection is owned by us.\n");
- XSetSelectionOwner(pDisplay, atomClipboard, None, CurrentTime);
- }
- else if (BadWindow == iReturn || BadAtom == iReturn)
- winErrorFVerb(1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "XGetSelection failed for CLIPBOARD: %d\n",
- iReturn);
-
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- s_fProcessingDrawClipboard = FALSE;
- if (s_hwndNextViewer)
- SendMessage(s_hwndNextViewer, message, wParam, lParam);
- return 0;
- }
-
- /* Reassert ownership of PRIMARY */
- iReturn = XSetSelectionOwner(pDisplay,
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "CLIPBOARD selection is owned by us, releasing\n");
+ XSetSelectionOwner (pDisplay,
+ atomClipboard,
+ None,
+ CurrentTime);
+ }
+ else if (BadWindow == iReturn || BadAtom == iReturn)
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "XGetSelectionOwner failed for CLIPBOARD: %d\n", iReturn);
+
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+ }
+
+ /* Reassert ownership of PRIMARY */
+ iReturn = XSetSelectionOwner (pDisplay,
XA_PRIMARY, iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow ||
+ if (iReturn == BadAtom || iReturn == BadWindow ||
XGetSelectionOwner(pDisplay, XA_PRIMARY) != iWindow) {
- winErrorFVerb(1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Could not reassert ownership of PRIMARY\n");
- }
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Could not reassert ownership of PRIMARY\n");
+ }
else {
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Reasserted ownership of PRIMARY\n");
- }
-
- /* Reassert ownership of the CLIPBOARD */
- iReturn = XSetSelectionOwner(pDisplay,
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Reasserted ownership of PRIMARY\n");
+ }
+
+ /* Reassert ownership of the CLIPBOARD */
+ iReturn = XSetSelectionOwner (pDisplay,
atomClipboard, iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow ||
+ if (iReturn == BadAtom || iReturn == BadWindow ||
XGetSelectionOwner(pDisplay, atomClipboard) != iWindow) {
- winErrorFVerb(1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Could not reassert ownership of CLIPBOARD\n");
- }
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Could not reassert ownership of CLIPBOARD\n");
+ }
else {
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Reasserted ownership of CLIPBOARD\n");
- }
-
- /* Flush the pending SetSelectionOwner event now */
- XFlush(pDisplay);
-
- s_fProcessingDrawClipboard = FALSE;
- }
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- /* Pass the message on the next window in the clipboard viewer chain */
- if (s_hwndNextViewer)
- SendMessage(s_hwndNextViewer, message, wParam, lParam);
- return 0;
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Reasserted ownership of CLIPBOARD\n");
+ }
+
+ /* Flush the pending SetSelectionOwner event now */
+ XFlush (pDisplay);
+
+ s_fProcessingDrawClipboard = FALSE;
+ }
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ /* Pass the message on the next window in the clipboard viewer chain */
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
case WM_DESTROYCLIPBOARD:
- /*
- * NOTE: Intentionally do nothing.
- * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
- * above. We only process this message to conform to the specs
- * for delayed clipboard rendering in Win32. You might think
- * that we need to release ownership of the X11 selections, but
- * we do not, because a WM_DRAWCLIPBOARD message will closely
- * follow this message and reassert ownership of the X11
- * selections, handling the issue for us.
- */
- winDebug("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n");
- return 0;
+ /*
+ * NOTE: Intentionally do nothing.
+ * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
+ * above. We only process this message to conform to the specs
+ * for delayed clipboard rendering in Win32. You might think
+ * that we need to release ownership of the X11 selections, but
+ * we do not, because a WM_DRAWCLIPBOARD message will closely
+ * follow this message and reassert ownership of the X11
+ * selections, handling the issue for us.
+ */
+ winDebug ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n");
+ return 0;
case WM_RENDERFORMAT:
case WM_RENDERALLFORMATS:
- {
- int iReturn;
- Display *pDisplay = g_pClipboardDisplay;
- Window iWindow = g_iClipboardWindow;
- Bool fConvertToUnicode;
-
- winDebug("winClipboardWindowProc - WM_RENDER*FORMAT - Hello.\n");
-
- /* Flag whether to convert to Unicode or not */
- if (message == WM_RENDERALLFORMATS)
- fConvertToUnicode = FALSE;
+ {
+ int iReturn;
+ Display *pDisplay = g_pClipboardDisplay;
+ Window iWindow = g_iClipboardWindow;
+ Bool fConvertToUnicode;
+
+ if (message == WM_RENDERALLFORMATS)
+ winDebug ("winClipboardWindowProc - WM_RENDERALLFORMATS - Hello.\n");
else
- fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
-
- /* Request the selection contents */
- iReturn = XConvertSelection(pDisplay,
- g_atomLastOwnedSelection,
- XInternAtom(pDisplay,
- "COMPOUND_TEXT", False),
- XInternAtom(pDisplay,
- "CYGX_CUT_BUFFER", False),
+ winDebug ("winClipboardWindowProc - WM_RENDERFORMAT %d - Hello.\n", wParam);
+
+ /* Flag whether to convert to Unicode or not */
+ if (message == WM_RENDERALLFORMATS)
+ fConvertToUnicode = FALSE;
+ else
+ fConvertToUnicode = (CF_UNICODETEXT == wParam);
+
+ /* Request the selection contents */
+ iReturn = XConvertSelection (pDisplay,
+ g_atomLastOwnedSelection,
+ XInternAtom (pDisplay,
+ "COMPOUND_TEXT", False),
+ XInternAtom (pDisplay,
+ "CYGX_CUT_BUFFER", False),
iWindow, CurrentTime);
if (iReturn == BadAtom || iReturn == BadWindow) {
- winErrorFVerb(1, "winClipboardWindowProc - WM_RENDER*FORMAT - "
- "XConvertSelection () failed\n");
- break;
- }
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMAT - "
+ "XConvertSelection () failed\n");
+ break;
+ }
- /* Special handling for WM_RENDERALLFORMATS */
+ /* Special handling for WM_RENDERALLFORMATS */
if (message == WM_RENDERALLFORMATS) {
- /* We must open and empty the clipboard */
+ /* We must open and empty the clipboard */
- /* Close clipboard if we have it open already */
+ /* Close clipboard if we have it open already */
if (GetOpenClipboardWindow() == hwnd) {
- CloseClipboard();
- }
+ CloseClipboard ();
+ }
if (!OpenClipboard(hwnd)) {
- winErrorFVerb(1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
- "OpenClipboard () failed: %08x\n",
- GetLastError());
- break;
- }
-
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
+ "OpenClipboard () failed: %08x\n",
+ GetLastError ());
+ break;
+ }
+
if (!EmptyClipboard()) {
- winErrorFVerb(1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
- "EmptyClipboard () failed: %08x\n",
- GetLastError());
- break;
- }
- }
-
- /* Process the SelectionNotify event */
- iReturn = winProcessXEventsTimeout(hwnd,
- iWindow,
- pDisplay,
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
+ "EmptyClipboard () failed: %08x\n",
+ GetLastError ());
+ break;
+ }
+ }
+
+ /* Process the SelectionNotify event */
+ iReturn = winProcessXEventsTimeout (hwnd,
+ iWindow,
+ pDisplay,
fConvertToUnicode, WIN_POLL_TIMEOUT);
- /*
- * The last call to winProcessXEventsTimeout
- * from above had better have seen a notify event, or else we
- * are dealing with a buggy or old X11 app. In these cases we
- * have to paste some fake data to the Win32 clipboard to
- * satisfy the requirement that we write something to it.
- */
+ /*
+ * The last call to winProcessXEventsTimeout
+ * from above had better have seen a notify event, or else we
+ * are dealing with a buggy or old X11 app. In these cases we
+ * have to paste some fake data to the Win32 clipboard to
+ * satisfy the requirement that we write something to it.
+ */
if (WIN_XEVENTS_NOTIFY != iReturn) {
- /* Paste no data, to satisfy required call to SetClipboardData */
- if (g_fUnicodeSupport)
- SetClipboardData(CF_UNICODETEXT, NULL);
- SetClipboardData(CF_TEXT, NULL);
+ /* Paste no data, to satisfy required call to SetClipboardData */
+ SetClipboardData (CF_UNICODETEXT, NULL);
+ SetClipboardData (CF_TEXT, NULL);
ErrorF
("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY\n");
- }
+ }
- /* Special handling for WM_RENDERALLFORMATS */
+ /* Special handling for WM_RENDERALLFORMATS */
if (message == WM_RENDERALLFORMATS) {
- /* We must close the clipboard */
-
+ /* We must close the clipboard */
+
if (!CloseClipboard()) {
winErrorFVerb(1,
"winClipboardWindowProc - WM_RENDERALLFORMATS - "
- "CloseClipboard () failed: %08x\n",
- GetLastError());
- break;
- }
- }
-
- winDebug("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
- return 0;
- }
+ "CloseClipboard () failed: %08x\n",
+ GetLastError ());
+ break;
+ }
+ }
+
+ winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
+ return 0;
+ }
}
- /* Let Windows perform default processing for unhandled messages */
- return DefWindowProc(hwnd, message, wParam, lParam);
+ /* Let Windows perform default processing for unhandled messages */
+ return DefWindowProc (hwnd, message, wParam, lParam);
}
/*
@@ -505,22 +550,22 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
*/
BOOL
-winClipboardFlushWindowsMessageQueue(HWND hwnd)
+winClipboardFlushWindowsMessageQueue (HWND hwnd)
{
- MSG msg;
+ MSG msg;
- /* Flush the messaging window queue */
- /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage,
- * as this will filter out many non-window-specific messages that
- * are sent to our thread, such as WM_QUIT.
- */
+ /* Flush the messaging window queue */
+ /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage,
+ * as this will filter out many non-window-specific messages that
+ * are sent to our thread, such as WM_QUIT.
+ */
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- /* Dispatch the message if not WM_QUIT */
- if (msg.message == WM_QUIT)
- return FALSE;
- else
- DispatchMessage(&msg);
+ /* Dispatch the message if not WM_QUIT */
+ if (msg.message == WM_QUIT)
+ return FALSE;
+ else
+ DispatchMessage (&msg);
}
-
- return TRUE;
+
+ return TRUE;
}
diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c
index 53b419ea0..80b19c5de 100644
--- a/hw/xwin/winclipboardwrappers.c
+++ b/hw/xwin/winclipboardwrappers.c
@@ -49,9 +49,9 @@
* Local function prototypes
*/
-int winProcEstablishConnection(ClientPtr /* client */ );
-int winProcQueryTree(ClientPtr /* client */ );
-int winProcSetSelectionOwner(ClientPtr /* client */ );
+int winProcEstablishConnection(ClientPtr /* client */);
+int winProcQueryTree(ClientPtr /* client */);
+int winProcSetSelectionOwner(ClientPtr /* client */);
DISPATCH_PROC(winProcEstablishConnection);
DISPATCH_PROC(winProcSetSelectionOwner);
@@ -60,21 +60,20 @@ DISPATCH_PROC(winProcSetSelectionOwner);
* References to external symbols
*/
-extern Bool g_fUnicodeSupport;
-extern int g_iNumScreens;
-extern unsigned int g_uiAuthDataLen;
-extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
-extern Bool g_fClipboardLaunched;
-extern Bool g_fClipboardStarted;
-extern Bool g_fClipboard;
-extern Window g_iClipboardWindow;
-extern Atom g_atomLastOwnedSelection;
-extern HWND g_hwndClipboard;
-
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
+extern int g_iNumScreens;
+extern unsigned int g_uiAuthDataLen;
+extern char *g_pAuthData;
+extern Bool g_fXdmcpEnabled;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardStarted;
+extern Bool g_fClipboard;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
+extern HWND g_hwndClipboard;
+
+extern winDispatchProcPtr winProcEstablishConnectionOrig;
+extern winDispatchProcPtr winProcQueryTreeOrig;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
/*
* Wrapper for internal EstablishConnection function.
@@ -83,102 +82,101 @@ extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
*/
int
-winProcEstablishConnection(ClientPtr client)
+winProcEstablishConnection (ClientPtr client)
{
- int iReturn;
- static int s_iCallCount = 0;
- static unsigned long s_ulServerGeneration = 0;
+ int iReturn;
+ static int s_iCallCount = 0;
+ static unsigned long s_ulServerGeneration = 0;
- if (s_iCallCount == 0)
- ErrorF("winProcEstablishConnection - Hello\n");
+ if (s_iCallCount == 0) winDebug ("winProcEstablishConnection - Hello\n");
- /* Do nothing if clipboard is not enabled */
+ /* Do nothing if clipboard is not enabled */
if (!g_fClipboard) {
- ErrorF("winProcEstablishConnection - Clipboard is not enabled, "
- "returning.\n");
-
- /* Unwrap the original function, call it, and return */
- InitialVector[2] = winProcEstablishConnectionOrig;
- iReturn = (*winProcEstablishConnectionOrig) (client);
- winProcEstablishConnectionOrig = NULL;
- return iReturn;
+ ErrorF ("winProcEstablishConnection - Clipboard is not enabled, "
+ "returning.\n");
+
+ /* Unwrap the original function, call it, and return */
+ InitialVector[2] = winProcEstablishConnectionOrig;
+ iReturn = (*winProcEstablishConnectionOrig) (client);
+ winProcEstablishConnectionOrig = NULL;
+ return iReturn;
}
- /* Watch for server reset */
+ /* Watch for server reset */
if (s_ulServerGeneration != serverGeneration) {
- /* Save new generation number */
- s_ulServerGeneration = serverGeneration;
+ /* Save new generation number */
+ s_ulServerGeneration = serverGeneration;
- /* Reset call count */
- s_iCallCount = 0;
+ /* Reset call count */
+ s_iCallCount = 0;
}
- /* Increment call count */
- ++s_iCallCount;
-
- /*
- * This procedure is only used for initialization.
- * We can unwrap the original procedure at this point
- * so that this function is no longer called until the
- * server resets and the function is wrapped again.
- */
- InitialVector[2] = winProcEstablishConnectionOrig;
-
- /*
- * Call original function and bail if it fails.
- * NOTE: We must do this first, since we need XdmcpOpenDisplay
- * to be called before we initialize our clipboard client.
- */
- iReturn = (*winProcEstablishConnectionOrig) (client);
+ /* Increment call count */
+ ++s_iCallCount;
+
+ /*
+ * This procedure is only used for initialization.
+ * We can unwrap the original procedure at this point
+ * so that this function is no longer called until the
+ * server resets and the function is wrapped again.
+ */
+ InitialVector[2] = winProcEstablishConnectionOrig;
+
+ /*
+ * Call original function and bail if it fails.
+ * NOTE: We must do this first, since we need XdmcpOpenDisplay
+ * to be called before we initialize our clipboard client.
+ */
+ iReturn = (*winProcEstablishConnectionOrig) (client);
if (iReturn != 0) {
- ErrorF("winProcEstablishConnection - ProcEstablishConnection "
- "failed, bailing.\n");
- return iReturn;
+ ErrorF ("winProcEstablishConnection - ProcEstablishConnection "
+ "failed, bailing.\n");
+ return iReturn;
}
- /* Clear original function pointer */
- winProcEstablishConnectionOrig = NULL;
+ /* Clear original function pointer */
+ winProcEstablishConnectionOrig = NULL;
- /* If the clipboard client has already been started, abort */
+ /* If the clipboard client has already been started, abort */
if (g_fClipboardLaunched) {
- ErrorF("winProcEstablishConnection - Clipboard client already "
- "launched, returning.\n");
- return iReturn;
+ ErrorF ("winProcEstablishConnection - Clipboard client already "
+ "launched, returning.\n");
+ return iReturn;
}
- /* Startup the clipboard client if clipboard mode is being used */
+ /* Startup the clipboard client if clipboard mode is being used */
if (g_fClipboard) {
- /*
- * NOTE: The clipboard client is started here for a reason:
- * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
- * 2) If the clipboard client attaches during X Server startup,
- * then it becomes the "magic client" that causes the X Server
- * to reset if it exits.
- * 3) XDMCP calls KillAllClients when it starts up.
- * 4) The clipboard client is a client, so it is killed.
- * 5) The clipboard client is the "magic client", so the X Server
- * resets itself.
- * 6) This repeats ad infinitum.
- * 7) We avoid this by waiting until at least one client (could
- * be XDM, could be another client) connects, which makes it
- * almost certain that the clipboard client will not connect
- * until after XDM when using XDMCP.
- */
-
- /* Create the clipboard client thread */
+ /*
+ * NOTE: The clipboard client is started here for a reason:
+ * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
+ * 2) If the clipboard client attaches during X Server startup,
+ * then it becomes the "magic client" that causes the X Server
+ * to reset if it exits.
+ * 3) XDMCP calls KillAllClients when it starts up.
+ * 4) The clipboard client is a client, so it is killed.
+ * 5) The clipboard client is the "magic client", so the X Server
+ * resets itself.
+ * 6) This repeats ad infinitum.
+ * 7) We avoid this by waiting until at least one client (could
+ * be XDM, could be another client) connects, which makes it
+ * almost certain that the clipboard client will not connect
+ * until after XDM when using XDMCP.
+ */
+
+ /* Create the clipboard client thread */
if (!winInitClipboard()) {
- ErrorF("winProcEstablishConnection - winClipboardInit "
- "failed.\n");
- return iReturn;
- }
-
- ErrorF("winProcEstablishConnection - winInitClipboard returned.\n");
+ ErrorF ("winProcEstablishConnection - winClipboardInit "
+ "failed.\n");
+ return iReturn;
+ }
+
+ ErrorF ("winProcEstablishConnection - winInitClipboard returned.\n");
}
+
+ /* Flag that clipboard client has been launched */
+ g_fClipboardLaunched = TRUE;
- /* Flag that clipboard client has been launched */
- g_fClipboardLaunched = TRUE;
-
- return iReturn;
+ return iReturn;
}
/*
@@ -187,198 +185,196 @@ winProcEstablishConnection(ClientPtr client)
*/
int
-winProcSetSelectionOwner(ClientPtr client)
+winProcSetSelectionOwner (ClientPtr client)
{
- int i;
- DrawablePtr pDrawable;
- WindowPtr pWindow = None;
- Bool fOwnedToNotOwned = FALSE;
- static Window s_iOwners[CLIP_NUM_SELECTIONS] = { None };
- static unsigned long s_ulServerGeneration = 0;
-
- REQUEST(xSetSelectionOwnerReq);
+ int i;
+ DrawablePtr pDrawable;
+ WindowPtr pWindow = None;
+ Bool fOwnedToNotOwned = FALSE;
+ static Window s_iOwners[CLIP_NUM_SELECTIONS] = {None};
+ static unsigned long s_ulServerGeneration = 0;
- REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
+ REQUEST(xSetSelectionOwnerReq);
+
+ REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
- winDebug("winProcSetSelectionOwner - Hello.\n");
+ winDebug("winProcSetSelectionOwner - Hello. atom 0x%08x window XID 0x%08x \n",
+ stuff->selection, stuff->window);
- /* Watch for server reset */
+ /* Watch for server reset */
if (s_ulServerGeneration != serverGeneration) {
- /* Save new generation number */
- s_ulServerGeneration = serverGeneration;
+ /* Save new generation number */
+ s_ulServerGeneration = serverGeneration;
- /* Initialize static variables */
- for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
- s_iOwners[i] = None;
+ /* Initialize static variables */
+ for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
+ s_iOwners[i] = None;
}
- /* Abort if clipboard not completely initialized yet */
+ /* Abort if clipboard not completely initialized yet */
if (!g_fClipboardStarted) {
- /* ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, "
- "aborting.\n"); */
- goto winProcSetSelectionOwner_Done;
+ /* ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, "
+ "aborting.\n"); */
+ goto winProcSetSelectionOwner_Done;
}
-
- /* Grab window if we have one */
+
+ /* Grab window if we have one */
if (None != stuff->window) {
- /* Grab the Window from the request */
+ /* Grab the Window from the request */
int rc =
dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
- if (rc != Success) {
- ErrorF("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
- goto winProcSetSelectionOwner_Done;
- }
+ if (rc != Success) {
+ ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
+ goto winProcSetSelectionOwner_Done;
+ }
}
- /* Now we either have a valid window or None */
+ /* Now we either have a valid window or None */
- /* Save selection owners for monitored selections, ignore other selections */
+ /* Save selection owners for monitored selections, ignore other selections */
if (XA_PRIMARY == stuff->selection) {
- /* Look for owned -> not owned transition */
+ /* Look for owned -> not owned transition */
if (None == stuff->window && None != s_iOwners[CLIP_OWN_PRIMARY]) {
- fOwnedToNotOwned = TRUE;
-
- winDebug("winProcSetSelectionOwner - PRIMARY - Going from "
- "owned to not owned.\n");
-
- /* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
- g_atomLastOwnedSelection = MakeAtom("CLIPBOARD", 9, TRUE);
- else
- g_atomLastOwnedSelection = None;
- }
-
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
-
- winDebug("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
- stuff->window);
+ fOwnedToNotOwned = TRUE;
+
+ winDebug("winProcSetSelectionOwner - PRIMARY - Going from "
+ "owned to not owned.\n");
+
+ /* Adjust last owned selection */
+ if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
+ g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
+
+ winDebug("winProcSetSelectionOwner - PRIMARY - Now owned by XID 0x%08x\n",
+ stuff->window);
}
else if (MakeAtom("CLIPBOARD", 9, TRUE) == stuff->selection) {
- /* Look for owned -> not owned transition */
+ /* Look for owned -> not owned transition */
if (None == stuff->window && None != s_iOwners[CLIP_OWN_CLIPBOARD]) {
- fOwnedToNotOwned = TRUE;
-
- winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from "
- "owned to not owned.\n");
+ fOwnedToNotOwned = TRUE;
- /* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_PRIMARY])
- g_atomLastOwnedSelection = XA_PRIMARY;
- else
- g_atomLastOwnedSelection = None;
- }
+ winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from "
+ "owned to not owned.\n");
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
+ /* Adjust last owned selection */
+ if (None != s_iOwners[CLIP_OWN_PRIMARY])
+ g_atomLastOwnedSelection = XA_PRIMARY;
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
- winDebug("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
- stuff->window);
+ winDebug("winProcSetSelectionOwner - CLIPBOARD - Now owned by XID 0x%08x\n",
+ stuff->window);
}
- else
- goto winProcSetSelectionOwner_Done;
-
- /*
- * At this point, if one of the selections is still owned by the
- * clipboard manager then it should be marked as unowned since
- * we will be taking ownership of the Win32 clipboard.
- */
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
- s_iOwners[CLIP_OWN_PRIMARY] = None;
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
- s_iOwners[CLIP_OWN_CLIPBOARD] = None;
-
- /*
- * Handle case when selection is being disowned,
- * WM_DRAWCLIPBOARD did not do the disowning,
- * both monitored selections are no longer owned,
- * an owned to not owned transition was detected,
- * and we currently own the Win32 clipboard.
- */
- if (stuff->window == None
- && s_iOwners[CLIP_OWN_PRIMARY] == None
- && s_iOwners[CLIP_OWN_CLIPBOARD] == None
- && fOwnedToNotOwned
+ else
+ goto winProcSetSelectionOwner_Done;
+
+ /*
+ * At this point, if one of the selections is still owned by the
+ * clipboard manager then it should be marked as unowned since
+ * we will be taking ownership of the Win32 clipboard.
+ */
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
+ s_iOwners[CLIP_OWN_PRIMARY] = None;
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
+ s_iOwners[CLIP_OWN_CLIPBOARD] = None;
+
+ /*
+ * Handle case when selection is being disowned,
+ * WM_DRAWCLIPBOARD did not do the disowning,
+ * both monitored selections are no longer owned,
+ * an owned to not owned transition was detected,
+ * and we currently own the Win32 clipboard.
+ */
+ if (stuff->window == None
+ && s_iOwners[CLIP_OWN_PRIMARY] == None
+ && s_iOwners[CLIP_OWN_CLIPBOARD] == None
+ && fOwnedToNotOwned
&& g_hwndClipboard != NULL && g_hwndClipboard == GetClipboardOwner()) {
- winDebug("winProcSetSelectionOwner - We currently own the "
- "clipboard and neither the PRIMARY nor the CLIPBOARD "
- "selections are owned, releasing ownership of Win32 "
- "clipboard.\n");
+ winDebug("winProcSetSelectionOwner - We currently own the "
+ "clipboard and neither the PRIMARY nor the CLIPBOARD "
+ "selections are owned, releasing ownership of Win32 "
+ "clipboard.\n");
- /* Release ownership of the Windows clipboard */
- OpenClipboard(NULL);
- EmptyClipboard();
- CloseClipboard();
+ /* Release ownership of the Windows clipboard */
+ OpenClipboard (NULL);
+ EmptyClipboard ();
+ CloseClipboard ();
- goto winProcSetSelectionOwner_Done;
+ goto winProcSetSelectionOwner_Done;
}
- /* Abort if no window at this point */
+ /* Abort if no window at this point */
if (None == stuff->window) {
- winDebug("winProcSetSelectionOwner - No window, returning.\n");
- goto winProcSetSelectionOwner_Done;
+ winDebug("winProcSetSelectionOwner - No window, returning.\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Abort if invalid selection */
+ /* Abort if invalid selection */
if (!ValidAtom(stuff->selection)) {
- ErrorF("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
- goto winProcSetSelectionOwner_Done;
+ ErrorF ("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Cast Window to Drawable */
- pDrawable = (DrawablePtr) pWindow;
-
- /* Abort if clipboard manager is owning the selection */
+ /* Cast Window to Drawable */
+ pDrawable = (DrawablePtr) pWindow;
+
+ /* Abort if clipboard manager is owning the selection */
if (pDrawable->id == g_iClipboardWindow) {
- winDebug("winProcSetSelectionOwner - We changed ownership, "
- "aborting.\n");
- goto winProcSetSelectionOwner_Done;
+ winDebug("winProcSetSelectionOwner - We changed ownership, "
+ "aborting.\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Abort if root window is taking ownership */
+ /* Abort if root window is taking ownership */
if (pDrawable->id == 0) {
- ErrorF("winProcSetSelectionOwner - Root window taking ownership, "
- "aborting\n");
- goto winProcSetSelectionOwner_Done;
+ ErrorF ("winProcSetSelectionOwner - Root window taking ownership, "
+ "aborting\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Close clipboard if we have it open already */
+ /* Close clipboard if we have it open already */
if (GetOpenClipboardWindow() == g_hwndClipboard) {
- CloseClipboard();
+ CloseClipboard ();
}
- /* Access the Windows clipboard */
+ /* Access the Windows clipboard */
if (!OpenClipboard(g_hwndClipboard)) {
- ErrorF("winProcSetSelectionOwner - OpenClipboard () failed: %08x\n",
- (int) GetLastError());
- goto winProcSetSelectionOwner_Done;
+ ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x\n",
+ (int) GetLastError ());
+ goto winProcSetSelectionOwner_Done;
}
- /* Take ownership of the Windows clipboard */
+ /* Take ownership of the Windows clipboard */
if (!EmptyClipboard()) {
- ErrorF("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
- (int) GetLastError());
- goto winProcSetSelectionOwner_Done;
+ ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
+ (int) GetLastError ());
+ goto winProcSetSelectionOwner_Done;
}
- /* Advertise Unicode if we support it */
- if (g_fUnicodeSupport)
- SetClipboardData(CF_UNICODETEXT, NULL);
-
- /* Always advertise regular text */
- SetClipboardData(CF_TEXT, NULL);
+ /* Advertise regular text and unicode */
+ SetClipboardData (CF_UNICODETEXT, NULL);
+ SetClipboardData (CF_TEXT, NULL);
- /* Save handle to last owned selection */
- g_atomLastOwnedSelection = stuff->selection;
+ /* Save handle to last owned selection */
+ g_atomLastOwnedSelection = stuff->selection;
- /* Release the clipboard */
+ /* Release the clipboard */
if (!CloseClipboard()) {
- ErrorF("winProcSetSelectionOwner - CloseClipboard () failed: "
+ ErrorF ("winProcSetSelectionOwner - CloseClipboard () failed: "
"%08x\n", (int) GetLastError());
- goto winProcSetSelectionOwner_Done;
+ goto winProcSetSelectionOwner_Done;
}
winProcSetSelectionOwner_Done:
- return (*winProcSetSelectionOwnerOrig) (client);
+ return (*winProcSetSelectionOwnerOrig) (client);
}
diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c
index 59b1f0715..76eefedfa 100644
--- a/hw/xwin/winclipboardxevents.c
+++ b/hw/xwin/winclipboardxevents.c
@@ -37,678 +37,695 @@
#include "misc.h"
/*
- * References to external symbols
- */
-
-extern Bool g_fUnicodeSupport;
-
-/*
* Process any pending X events
*/
int
-winClipboardFlushXEvents(HWND hwnd,
+winClipboardFlushXEvents (HWND hwnd,
int iWindow, Display * pDisplay, Bool fUseUnicode)
{
- static Atom atomLocalProperty;
- static Atom atomCompoundText;
- static Atom atomUTF8String;
- static Atom atomTargets;
- static int generation;
+ static Atom atomLocalProperty;
+ static Atom atomCompoundText;
+ static Atom atomUTF8String;
+ static Atom atomTargets;
+ static int generation;
if (generation != serverGeneration) {
- generation = serverGeneration;
- atomLocalProperty = XInternAtom(pDisplay, WIN_LOCAL_PROPERTY, False);
- atomUTF8String = XInternAtom(pDisplay, "UTF8_STRING", False);
- atomCompoundText = XInternAtom(pDisplay, "COMPOUND_TEXT", False);
- atomTargets = XInternAtom(pDisplay, "TARGETS", False);
+ generation = serverGeneration;
+ atomLocalProperty = XInternAtom (pDisplay, WIN_LOCAL_PROPERTY, False);
+ atomUTF8String = XInternAtom (pDisplay, "UTF8_STRING", False);
+ atomCompoundText = XInternAtom (pDisplay, "COMPOUND_TEXT", False);
+ atomTargets = XInternAtom (pDisplay, "TARGETS", False);
}
- /* Process all pending events */
+ /* Process all pending events */
while (XPending(pDisplay)) {
- XTextProperty xtpText = { 0 };
- XEvent event;
- XSelectionEvent eventSelection;
- unsigned long ulReturnBytesLeft;
- char *pszReturnData = NULL;
- char *pszGlobalData = NULL;
- int iReturn;
- HGLOBAL hGlobal = NULL;
- XICCEncodingStyle xiccesStyle;
- int iConvertDataLen = 0;
- char *pszConvertData = NULL;
- char *pszTextList[2] = { NULL };
- int iCount;
- char **ppszTextList = NULL;
- wchar_t *pwszUnicodeStr = NULL;
- int iUnicodeLen = 0;
- int iReturnDataLen = 0;
- int i;
- Bool fAbort = FALSE;
- Bool fCloseClipboard = FALSE;
- Bool fSetClipboardData = TRUE;
-
- /* Get the next event - will not block because one is ready */
- XNextEvent(pDisplay, &event);
-
- /* Branch on the event type */
+ XTextProperty xtpText = {0};
+ XEvent event;
+ XSelectionEvent eventSelection;
+ unsigned long ulReturnBytesLeft;
+ char *pszReturnData = NULL;
+ char *pszGlobalData = NULL;
+ int iReturn;
+ HGLOBAL hGlobal = NULL;
+ XICCEncodingStyle xiccesStyle;
+ int iConvertDataLen = 0;
+ char *pszConvertData = NULL;
+ char *pszTextList[2] = {NULL};
+ int iCount;
+ char **ppszTextList = NULL;
+ wchar_t *pwszUnicodeStr = NULL;
+ int iUnicodeLen = 0;
+ int iReturnDataLen = 0;
+ int i;
+ Bool fAbort = FALSE;
+ Bool fCloseClipboard = FALSE;
+ Bool fSetClipboardData = TRUE;
+
+ /* Get the next event - will not block because one is ready */
+ XNextEvent (pDisplay, &event);
+
+ /* Branch on the event type */
switch (event.type) {
- /*
- * SelectionRequest
- */
+ /*
+ * SelectionRequest
+ */
- case SelectionRequest:
- {
- char *pszAtomName = NULL;
+ case SelectionRequest:
+ {
+ char *pszAtomName = NULL;
- winDebug("SelectionRequest - target %d\n",
+ winDebug("SelectionRequest - target %d\n",
event.xselectionrequest.target);
- pszAtomName = XGetAtomName(pDisplay,
- event.xselectionrequest.target);
- winDebug("SelectionRequest - Target atom name %s\n", pszAtomName);
- XFree(pszAtomName);
- pszAtomName = NULL;
- }
-
- /* Abort if invalid target type */
- if (event.xselectionrequest.target != XA_STRING
- && event.xselectionrequest.target != atomUTF8String
- && event.xselectionrequest.target != atomCompoundText
+ pszAtomName = XGetAtomName (pDisplay,
+ event.xselectionrequest.target);
+ winDebug("SelectionRequest - Target atom name %s\n", pszAtomName);
+ XFree (pszAtomName);
+ pszAtomName = NULL;
+ }
+
+ /* Abort if invalid target type */
+ if (event.xselectionrequest.target != XA_STRING
+ && event.xselectionrequest.target != atomUTF8String
+ && event.xselectionrequest.target != atomCompoundText
&& event.xselectionrequest.target != atomTargets) {
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
- /* Handle targets type of request */
+ /* Handle targets type of request */
if (event.xselectionrequest.target == atomTargets) {
- Atom atomTargetArr[] = { atomTargets,
- atomCompoundText,
- atomUTF8String,
+ Atom atomTargetArr[] = {atomTargets,
+ atomCompoundText,
+ atomUTF8String,
XA_STRING
};
- /* Try to change the property */
- iReturn = XChangeProperty(pDisplay,
- event.xselectionrequest.requestor,
- event.xselectionrequest.property,
- XA_ATOM,
- 32,
- PropModeReplace,
- (unsigned char *) atomTargetArr,
- (sizeof(atomTargetArr)
- / sizeof(atomTargetArr[0])));
- if (iReturn == BadAlloc
- || iReturn == BadAtom
- || iReturn == BadMatch
+ winDebug("SelectionRequest - populating targets\n");
+
+ /* Try to change the property */
+ iReturn = XChangeProperty (pDisplay,
+ event.xselectionrequest.requestor,
+ event.xselectionrequest.property,
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ (unsigned char *) atomTargetArr,
+ (sizeof (atomTargetArr)
+ / sizeof (atomTargetArr[0])));
+ if (iReturn == BadAlloc
+ || iReturn == BadAtom
+ || iReturn == BadMatch
|| iReturn == BadValue || iReturn == BadWindow) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
"XChangeProperty failed: %d\n", iReturn);
- }
-
- /* Setup selection notify xevent */
- eventSelection.type = SelectionNotify;
- eventSelection.send_event = True;
- eventSelection.display = pDisplay;
- eventSelection.requestor = event.xselectionrequest.requestor;
- eventSelection.selection = event.xselectionrequest.selection;
- eventSelection.target = event.xselectionrequest.target;
- eventSelection.property = event.xselectionrequest.property;
- eventSelection.time = event.xselectionrequest.time;
-
- /*
- * Notify the requesting window that
- * the operation has completed
- */
- iReturn = XSendEvent(pDisplay,
- eventSelection.requestor,
+ }
+
+ /* Setup selection notify xevent */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = event.xselectionrequest.property;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /*
+ * Notify the requesting window that
+ * the operation has completed
+ */
+ iReturn = XSendEvent (pDisplay,
+ eventSelection.requestor,
False, 0L, (XEvent *) & eventSelection);
if (iReturn == BadValue || iReturn == BadWindow) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "XSendEvent () failed\n");
- }
- break;
- }
-
- /* Check that clipboard format is available */
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
+ }
+ break;
+ }
+
+ /* Close clipboard if we have it open already */
+ if (GetOpenClipboardWindow () == hwnd)
+ {
+ CloseClipboard ();
+ }
+
+ /* Access the clipboard */
+ if (!OpenClipboard (hwnd))
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "OpenClipboard () failed: %08lx\n",
+ GetLastError ());
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Indicate that clipboard was opened */
+ fCloseClipboard = TRUE;
+
+ /* Check that clipboard format is available */
if (fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) {
- static int count; /* Hack to stop acroread spamming the log */
- static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */
+ static int count; /* Hack to stop acroread spamming the log */
+ static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */
if (hwnd != lasthwnd)
count = 0;
- count++;
+ count++;
if (count < 6)
ErrorF("winClipboardFlushXEvents - CF_UNICODETEXT is not "
"available from Win32 clipboard. Aborting %d.\n",
count);
- lasthwnd = hwnd;
+ lasthwnd = hwnd;
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
else if (!fUseUnicode && !IsClipboardFormatAvailable(CF_TEXT)) {
- ErrorF("winClipboardFlushXEvents - CF_TEXT is not "
- "available from Win32 clipboard. Aborting.\n");
+ ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
+ "available from Win32 clipboard. Aborting.\n");
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
- /* Close clipboard if we have it open already */
- if (GetOpenClipboardWindow() == hwnd) {
- CloseClipboard();
- }
-
- /* Access the clipboard */
- if (!OpenClipboard(hwnd)) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "OpenClipboard () failed: %08lx\n", GetLastError());
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Indicate that clipboard was opened */
- fCloseClipboard = TRUE;
-
- /* Setup the string style */
- if (event.xselectionrequest.target == XA_STRING)
- xiccesStyle = XStringStyle;
+ /* Setup the string style */
+ if (event.xselectionrequest.target == XA_STRING)
+ xiccesStyle = XStringStyle;
#ifdef X_HAVE_UTF8_STRING
- else if (event.xselectionrequest.target == atomUTF8String)
- xiccesStyle = XUTF8StringStyle;
+ else if (event.xselectionrequest.target == atomUTF8String)
+ xiccesStyle = XUTF8StringStyle;
#endif
- else if (event.xselectionrequest.target == atomCompoundText)
- xiccesStyle = XCompoundTextStyle;
- else
- xiccesStyle = XStringStyle;
+ else if (event.xselectionrequest.target == atomCompoundText)
+ xiccesStyle = XCompoundTextStyle;
+ else
+ xiccesStyle = XStringStyle;
- /*
- * FIXME: Can't pass CF_UNICODETEXT on Windows 95/98/Me
- */
-
- /* Get a pointer to the clipboard text, in desired format */
+ /* Get a pointer to the clipboard text, in desired format */
if (fUseUnicode) {
- /* Retrieve clipboard data */
- hGlobal = GetClipboardData(CF_UNICODETEXT);
- }
+ /* Retrieve clipboard data */
+ hGlobal = GetClipboardData (CF_UNICODETEXT);
+ }
else {
- /* Retrieve clipboard data */
- hGlobal = GetClipboardData(CF_TEXT);
- }
+ /* Retrieve clipboard data */
+ hGlobal = GetClipboardData (CF_TEXT);
+ }
if (!hGlobal) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
"GetClipboardData () failed: %08lx\n", GetLastError());
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
- pszGlobalData = (char *) GlobalLock(hGlobal);
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+ pszGlobalData = (char *) GlobalLock (hGlobal);
- /* Convert the Unicode string to UTF8 (MBCS) */
+ /* Convert the Unicode string to UTF8 (MBCS) */
if (fUseUnicode) {
- iConvertDataLen = WideCharToMultiByte(CP_UTF8,
- 0,
- (LPCWSTR) pszGlobalData,
+ iConvertDataLen = WideCharToMultiByte (CP_UTF8,
+ 0,
+ (LPCWSTR)pszGlobalData,
-1, NULL, 0, NULL, NULL);
- /* NOTE: iConvertDataLen includes space for null terminator */
- pszConvertData = (char *) malloc(iConvertDataLen);
- WideCharToMultiByte(CP_UTF8,
- 0,
- (LPCWSTR) pszGlobalData,
- -1,
- pszConvertData,
+ /* NOTE: iConvertDataLen includes space for null terminator */
+ pszConvertData = (char *) malloc (iConvertDataLen);
+ WideCharToMultiByte (CP_UTF8,
+ 0,
+ (LPCWSTR)pszGlobalData,
+ -1,
+ pszConvertData,
iConvertDataLen, NULL, NULL);
- }
+ }
else {
- pszConvertData = strdup(pszGlobalData);
- iConvertDataLen = strlen(pszConvertData) + 1;
- }
+ pszConvertData = strdup (pszGlobalData);
+ iConvertDataLen = strlen (pszConvertData) + 1;
+ }
- /* Convert DOS string to UNIX string */
- winClipboardDOStoUNIX(pszConvertData, strlen(pszConvertData));
+ /* Convert DOS string to UNIX string */
+ winClipboardDOStoUNIX (pszConvertData, strlen (pszConvertData));
- /* Setup our text list */
- pszTextList[0] = pszConvertData;
- pszTextList[1] = NULL;
+ /* Setup our text list */
+ pszTextList[0] = pszConvertData;
+ pszTextList[1] = NULL;
- /* Initialize the text property */
- xtpText.value = NULL;
- xtpText.nitems = 0;
+ /* Initialize the text property */
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
- /* Create the text property from the text list */
+ /* Create the text property from the text list */
if (fUseUnicode) {
#ifdef X_HAVE_UTF8_STRING
- iReturn = Xutf8TextListToTextProperty(pDisplay,
- pszTextList,
+ iReturn = Xutf8TextListToTextProperty (pDisplay,
+ pszTextList,
1, xiccesStyle, &xtpText);
#endif
- }
+ }
else {
- iReturn = XmbTextListToTextProperty(pDisplay,
- pszTextList,
+ iReturn = XmbTextListToTextProperty (pDisplay,
+ pszTextList,
1, xiccesStyle, &xtpText);
- }
+ }
if (iReturn == XNoMemory || iReturn == XLocaleNotSupported) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
"X*TextListToTextProperty failed: %d\n", iReturn);
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Free the converted string */
- free(pszConvertData);
- pszConvertData = NULL;
-
- /* Copy the clipboard text to the requesting window */
- iReturn = XChangeProperty(pDisplay,
- event.xselectionrequest.requestor,
- event.xselectionrequest.property,
- event.xselectionrequest.target,
- 8,
- PropModeReplace,
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Free the converted string */
+ free (pszConvertData);
+ pszConvertData = NULL;
+
+ /* Copy the clipboard text to the requesting window */
+ iReturn = XChangeProperty (pDisplay,
+ event.xselectionrequest.requestor,
+ event.xselectionrequest.property,
+ event.xselectionrequest.target,
+ 8,
+ PropModeReplace,
xtpText.value, xtpText.nitems);
- if (iReturn == BadAlloc || iReturn == BadAtom
- || iReturn == BadMatch || iReturn == BadValue
+ if (iReturn == BadAlloc || iReturn == BadAtom
+ || iReturn == BadMatch || iReturn == BadValue
|| iReturn == BadWindow) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
"XChangeProperty failed: %d\n", iReturn);
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Release the clipboard data */
- GlobalUnlock(hGlobal);
- pszGlobalData = NULL;
- fCloseClipboard = FALSE;
- CloseClipboard();
-
- /* Clean up */
- XFree(xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
-
- /* Setup selection notify event */
- eventSelection.type = SelectionNotify;
- eventSelection.send_event = True;
- eventSelection.display = pDisplay;
- eventSelection.requestor = event.xselectionrequest.requestor;
- eventSelection.selection = event.xselectionrequest.selection;
- eventSelection.target = event.xselectionrequest.target;
- eventSelection.property = event.xselectionrequest.property;
- eventSelection.time = event.xselectionrequest.time;
-
- /* Notify the requesting window that the operation has completed */
- iReturn = XSendEvent(pDisplay,
- eventSelection.requestor,
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Release the clipboard data */
+ GlobalUnlock (hGlobal);
+ pszGlobalData = NULL;
+ fCloseClipboard = FALSE;
+ CloseClipboard ();
+
+ /* Clean up */
+ XFree (xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+
+ /* Setup selection notify event */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = event.xselectionrequest.property;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /* Notify the requesting window that the operation has completed */
+ iReturn = XSendEvent (pDisplay,
+ eventSelection.requestor,
False, 0L, (XEvent *) & eventSelection);
if (iReturn == BadValue || iReturn == BadWindow) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "XSendEvent () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
- winClipboardFlushXEvents_SelectionRequest_Done:
- /* Free allocated resources */
+ winClipboardFlushXEvents_SelectionRequest_Done:
+ /* Free allocated resources */
if (xtpText.value) {
- XFree(xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
- }
- free(pszConvertData);
- if (hGlobal && pszGlobalData)
- GlobalUnlock(hGlobal);
-
- /*
- * Send a SelectionNotify event to the requesting
- * client when we abort.
- */
- if (fAbort) {
- /* Setup selection notify event */
- eventSelection.type = SelectionNotify;
- eventSelection.send_event = True;
- eventSelection.display = pDisplay;
- eventSelection.requestor = event.xselectionrequest.requestor;
- eventSelection.selection = event.xselectionrequest.selection;
- eventSelection.target = event.xselectionrequest.target;
- eventSelection.property = None;
- eventSelection.time = event.xselectionrequest.time;
-
- /* Notify the requesting window that the operation is complete */
- iReturn = XSendEvent(pDisplay,
- eventSelection.requestor,
+ XFree (xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+ }
+ free(pszConvertData);
+ if (hGlobal && pszGlobalData)
+ GlobalUnlock (hGlobal);
+
+ /*
+ * Send a SelectionNotify event to the requesting
+ * client when we abort.
+ */
+ if (fAbort)
+ {
+ winDebug("SelectionRequest - aborting\n");
+ /* Setup selection notify event */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = None;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /* Notify the requesting window that the operation is complete */
+ iReturn = XSendEvent (pDisplay,
+ eventSelection.requestor,
False, 0L, (XEvent *) & eventSelection);
if (iReturn == BadValue || iReturn == BadWindow) {
- /*
- * Should not be a problem if XSendEvent fails because
- * the client may simply have exited.
- */
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "XSendEvent () failed for abort event.\n");
- }
- }
-
- /* Close clipboard if it was opened */
+ /*
+ * Should not be a problem if XSendEvent fails because
+ * the client may simply have exited.
+ */
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed for abort event.\n");
+ }
+ }
+
+ /* Close clipboard if it was opened */
if (fCloseClipboard) {
- fCloseClipboard = FALSE;
- CloseClipboard();
- }
- break;
+ fCloseClipboard = FALSE;
+ CloseClipboard ();
+ }
+ break;
- /*
- * SelectionNotify
- */
+ /*
+ * SelectionNotify
+ */
- case SelectionNotify:
+ case SelectionNotify:
- winDebug("winClipboardFlushXEvents - SelectionNotify\n");
- {
- char *pszAtomName;
+ winDebug ("winClipboardFlushXEvents - SelectionNotify\n");
+ {
+ char *pszAtomName;
- pszAtomName = XGetAtomName(pDisplay,
- event.xselection.selection);
+ pszAtomName = XGetAtomName (pDisplay,
+ event.xselection.selection);
winDebug
("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
pszAtomName);
- XFree(pszAtomName);
- }
+ XFree (pszAtomName);
+ }
- /*
- * Request conversion of UTF8 and CompoundText targets.
- */
+ /*
+ * Request conversion of UTF8 and CompoundText targets.
+ */
if (event.xselection.property == None) {
if (event.xselection.target == XA_STRING) {
- winDebug("winClipboardFlushXEvents - SelectionNotify - "
- "XA_STRING\n");
+ winDebug ("winClipboardFlushXEvents - SelectionNotify - "
+ "XA_STRING\n");
- return WIN_XEVENTS_CONVERT;
- }
+ return WIN_XEVENTS_CONVERT;
+ }
else if (event.xselection.target == atomUTF8String) {
- winDebug("winClipboardFlushXEvents - SelectionNotify - "
- "Requesting conversion of UTF8 target.\n");
+ winDebug("winClipboardFlushXEvents - SelectionNotify - "
+ "Requesting conversion of UTF8 target.\n");
- XConvertSelection(pDisplay,
- event.xselection.selection,
- XA_STRING,
+ XConvertSelection (pDisplay,
+ event.xselection.selection,
+ XA_STRING,
atomLocalProperty, iWindow, CurrentTime);
- /* Process the ConvertSelection event */
- XFlush(pDisplay);
- return WIN_XEVENTS_CONVERT;
- }
+ /* Process the ConvertSelection event */
+ XFlush (pDisplay);
+ return WIN_XEVENTS_CONVERT;
+ }
#ifdef X_HAVE_UTF8_STRING
else if (event.xselection.target == atomCompoundText) {
- winDebug("winClipboardFlushXEvents - SelectionNotify - "
- "Requesting conversion of CompoundText target.\n");
+ winDebug("winClipboardFlushXEvents - SelectionNotify - "
+ "Requesting conversion of CompoundText target.\n");
- XConvertSelection(pDisplay,
- event.xselection.selection,
- atomUTF8String,
+ XConvertSelection (pDisplay,
+ event.xselection.selection,
+ atomUTF8String,
atomLocalProperty, iWindow, CurrentTime);
- /* Process the ConvertSelection event */
- XFlush(pDisplay);
- return WIN_XEVENTS_CONVERT;
- }
+ /* Process the ConvertSelection event */
+ XFlush (pDisplay);
+ return WIN_XEVENTS_CONVERT;
+ }
#endif
else {
- ErrorF("winClipboardFlushXEvents - SelectionNotify - "
- "Unknown format. Cannot request conversion, "
- "aborting.\n");
- break;
- }
- }
-
- /* Retrieve the size of the stored data */
- iReturn = XGetWindowProperty(pDisplay, iWindow, atomLocalProperty, 0, 0, /* Don't get data, just size */
- False,
- AnyPropertyType,
- &xtpText.encoding,
- &xtpText.format,
- &xtpText.nitems,
- &ulReturnBytesLeft, &xtpText.value);
- if (iReturn != Success) {
- ErrorF("winClipboardFlushXEvents - SelectionNotify - "
- "XGetWindowProperty () failed, aborting: %d\n", iReturn);
- break;
- }
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "Unknown format. Cannot request conversion, "
+ "aborting.\n");
+ break;
+ }
+ }
- winDebug("SelectionNotify - returned data %d left %d\n",
- xtpText.nitems, ulReturnBytesLeft);
-
- /* Request the selection data */
- iReturn = XGetWindowProperty(pDisplay,
- iWindow,
- atomLocalProperty,
- 0,
- ulReturnBytesLeft,
- False,
- AnyPropertyType,
- &xtpText.encoding,
- &xtpText.format,
- &xtpText.nitems,
- &ulReturnBytesLeft, &xtpText.value);
- if (iReturn != Success) {
- ErrorF("winClipboardFlushXEvents - SelectionNotify - "
- "XGetWindowProperty () failed, aborting: %d\n", iReturn);
- break;
- }
+ case SelectionClear:
+ winDebug("SelectionClear - doing nothing\n");
+ break;
+
+ case PropertyNotify:
+ {
+ char *pszAtomName;
+ pszAtomName = XGetAtomName (pDisplay, event.xproperty.atom);
+ winDebug("winClipboardFlushXEvents - PropertyNotify - ATOM: %s\n", pszAtomName);
+ XFree (pszAtomName);
+ }
+
+ if (event.xproperty.atom != atomLocalProperty)
+ break;
- {
- char *pszAtomName = NULL;
-
- winDebug("SelectionNotify - returned data %d left %d\n",
- xtpText.nitems, ulReturnBytesLeft);
- pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
- winDebug("Notify atom name %s\n", pszAtomName);
- XFree(pszAtomName);
- pszAtomName = NULL;
- }
+ /* Retrieve the size of the stored data */
+ iReturn = XGetWindowProperty(pDisplay, iWindow, atomLocalProperty, 0, 0, /* Don't get data, just size */
+ False,
+ AnyPropertyType,
+ &xtpText.encoding,
+ &xtpText.format,
+ &xtpText.nitems,
+ &ulReturnBytesLeft,
+ &xtpText.value);
+ if (iReturn != Success)
+ {
+ ErrorF ("winClipboardFlushXEvents - PropertyNotify - "
+ "XGetWindowProperty () failed, aborting: %d\n",
+ iReturn);
+ break;
+ }
+
+ winDebug("PropertyNotify - returned data %d left %d\n",
+ xtpText.nitems, ulReturnBytesLeft);
+
+ /* Request the selection data */
+ iReturn = XGetWindowProperty (pDisplay,
+ iWindow,
+ atomLocalProperty,
+ 0,
+ ulReturnBytesLeft,
+ False,
+ AnyPropertyType,
+ &xtpText.encoding,
+ &xtpText.format,
+ &xtpText.nitems,
+ &ulReturnBytesLeft,
+ &xtpText.value);
+ if (iReturn != Success)
+ {
+ ErrorF ("winClipboardFlushXEvents - PropertyNotify - "
+ "XGetWindowProperty () failed, aborting: %d\n",
+ iReturn);
+ break;
+ }
+
+ {
+ char *pszAtomName = NULL;
+
+ winDebug("PropertyNotify - returned data %d left %d\n",
+ xtpText.nitems, ulReturnBytesLeft);
+ pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
+ winDebug("SelectionNotify - encoding atom name %s\n", pszAtomName);
+ XFree (pszAtomName);
+ pszAtomName = NULL;
+ }
if (fUseUnicode) {
#ifdef X_HAVE_UTF8_STRING
- /* Convert the text property to a text list */
- iReturn = Xutf8TextPropertyToTextList(pDisplay,
- &xtpText,
+ /* Convert the text property to a text list */
+ iReturn = Xutf8TextPropertyToTextList (pDisplay,
+ &xtpText,
&ppszTextList, &iCount);
#endif
- }
+ }
else {
- iReturn = XmbTextPropertyToTextList(pDisplay,
- &xtpText,
+ iReturn = XmbTextPropertyToTextList (pDisplay,
+ &xtpText,
&ppszTextList, &iCount);
- }
+ }
if (iReturn == Success || iReturn > 0) {
- /* Conversion succeeded or some unconvertible characters */
+ /* Conversion succeeded or some unconvertible characters */
if (ppszTextList != NULL) {
- iReturnDataLen = 0;
+ iReturnDataLen = 0;
for (i = 0; i < iCount; i++) {
- iReturnDataLen += strlen(ppszTextList[i]);
- }
- pszReturnData = malloc(iReturnDataLen + 1);
- pszReturnData[0] = '\0';
+ iReturnDataLen += strlen(ppszTextList[i]);
+ }
+ pszReturnData = malloc (iReturnDataLen + 1);
+ pszReturnData[0] = '\0';
for (i = 0; i < iCount; i++) {
- strcat(pszReturnData, ppszTextList[i]);
- }
- }
- else {
- ErrorF("winClipboardFlushXEvents - SelectionNotify - "
- "X*TextPropertyToTextList list_return is NULL.\n");
- pszReturnData = malloc(1);
- pszReturnData[0] = '\0';
- }
- }
- else {
- ErrorF("winClipboardFlushXEvents - SelectionNotify - "
- "X*TextPropertyToTextList returned: ");
+ strcat (pszReturnData, ppszTextList[i]);
+ }
+ }
+ else
+ {
+ ErrorF ("winClipboardFlushXEvents - PropertyNotify - "
+ "X*TextPropertyToTextList list_return is NULL.\n");
+ pszReturnData = malloc (1);
+ pszReturnData[0] = '\0';
+ }
+ }
+ else
+ {
+ ErrorF ("winClipboardFlushXEvents - PropertyNotify - "
+ "X*TextPropertyToTextList returned: ");
switch (iReturn) {
- case XNoMemory:
- ErrorF("XNoMemory\n");
- break;
- case XLocaleNotSupported:
- ErrorF("XLocaleNotSupported\n");
- break;
- case XConverterNotFound:
- ErrorF("XConverterNotFound\n");
- break;
- default:
- ErrorF("%d\n", iReturn);
- break;
- }
- pszReturnData = malloc(1);
- pszReturnData[0] = '\0';
- }
-
- /* Free the data returned from XGetWindowProperty */
- if (ppszTextList)
- XFreeStringList(ppszTextList);
- ppszTextList = NULL;
- XFree(xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
-
- /* Convert the X clipboard string to DOS format */
- winClipboardUNIXtoDOS(&pszReturnData, strlen(pszReturnData));
+ case XNoMemory:
+ ErrorF ("XNoMemory\n");
+ break;
+ case XLocaleNotSupported:
+ ErrorF ("XLocaleNotSupported\n");
+ break;
+ case XConverterNotFound:
+ ErrorF ("XConverterNotFound\n");
+ break;
+ default:
+ ErrorF ("%d\n", iReturn);
+ break;
+ }
+ pszReturnData = malloc (1);
+ pszReturnData[0] = '\0';
+ }
+
+ /* Free the data returned from XGetWindowProperty */
+ if (ppszTextList)
+ XFreeStringList (ppszTextList);
+ ppszTextList = NULL;
+ XFree (xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+
+ /* Convert the X clipboard string to DOS format */
+ winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
if (fUseUnicode) {
- /* Find out how much space needed to convert MBCS to Unicode */
- iUnicodeLen = MultiByteToWideChar(CP_UTF8,
- 0,
+ /* Find out how much space needed to convert MBCS to Unicode */
+ iUnicodeLen = MultiByteToWideChar (CP_UTF8,
+ 0,
pszReturnData, -1, NULL, 0);
- /* Allocate memory for the Unicode string */
- pwszUnicodeStr
- = (wchar_t *) malloc(sizeof(wchar_t) * (iUnicodeLen + 1));
- if (!pwszUnicodeStr) {
- ErrorF("winClipboardFlushXEvents - SelectionNotify "
- "malloc failed for pwszUnicodeStr, aborting.\n");
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionNotify_Done;
- }
-
- /* Do the actual conversion */
- MultiByteToWideChar(CP_UTF8,
- 0,
- pszReturnData,
+ /* Allocate memory for the Unicode string */
+ pwszUnicodeStr
+ = (wchar_t*) malloc (sizeof (wchar_t) * (iUnicodeLen + 1));
+ if (!pwszUnicodeStr)
+ {
+ ErrorF ("winClipboardFlushXEvents - PropertyNotify "
+ "malloc failed for pwszUnicodeStr, aborting.\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_PropertyNotify_Done;
+ }
+
+ /* Do the actual conversion */
+ MultiByteToWideChar (CP_UTF8,
+ 0,
+ pszReturnData,
-1, pwszUnicodeStr, iUnicodeLen);
-
- /* Allocate global memory for the X clipboard data */
- hGlobal = GlobalAlloc(GMEM_MOVEABLE,
- sizeof(wchar_t) * (iUnicodeLen + 1));
- }
+
+ /* Allocate global memory for the X clipboard data */
+ hGlobal = GlobalAlloc (GMEM_MOVEABLE,
+ sizeof (wchar_t) * (iUnicodeLen + 1));
+ }
else {
- pszConvertData = strdup(pszReturnData);
- iConvertDataLen = strlen(pszConvertData) + 1;
+ pszConvertData = strdup (pszReturnData);
+ iConvertDataLen = strlen (pszConvertData) + 1;
- /* Allocate global memory for the X clipboard data */
- hGlobal = GlobalAlloc(GMEM_MOVEABLE, iConvertDataLen);
- }
+ /* Allocate global memory for the X clipboard data */
+ hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen);
+ }
- free(pszReturnData);
+ free (pszReturnData);
- /* Check that global memory was allocated */
- if (!hGlobal) {
- ErrorF("winClipboardFlushXEvents - SelectionNotify "
- "GlobalAlloc failed, aborting: %ld\n", GetLastError());
+ /* Check that global memory was allocated */
+ if (!hGlobal)
+ {
+ ErrorF ("winClipboardFlushXEvents - PropertyNotify "
+ "GlobalAlloc failed, aborting: %ld\n",
+ GetLastError ());
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionNotify_Done;
- }
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_PropertyNotify_Done;
+ }
- /* Obtain a pointer to the global memory */
- pszGlobalData = GlobalLock(hGlobal);
+ /* Obtain a pointer to the global memory */
+ pszGlobalData = GlobalLock (hGlobal);
if (pszGlobalData == NULL) {
- ErrorF("winClipboardFlushXEvents - Could not lock global "
- "memory for clipboard transfer\n");
+ ErrorF ("winClipboardFlushXEvents - Could not lock global "
+ "memory for clipboard transfer\n");
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionNotify_Done;
- }
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_PropertyNotify_Done;
+ }
- /* Copy the returned string into the global memory */
+ /* Copy the returned string into the global memory */
if (fUseUnicode) {
- memcpy(pszGlobalData,
+ memcpy (pszGlobalData,
pwszUnicodeStr, sizeof(wchar_t) * (iUnicodeLen + 1));
- free(pwszUnicodeStr);
- pwszUnicodeStr = NULL;
- }
+ free (pwszUnicodeStr);
+ pwszUnicodeStr = NULL;
+ }
else {
- strcpy(pszGlobalData, pszConvertData);
- free(pszConvertData);
- pszConvertData = NULL;
- }
-
- /* Release the pointer to the global memory */
- GlobalUnlock(hGlobal);
- pszGlobalData = NULL;
-
- /* Push the selection data to the Windows clipboard */
- if (fUseUnicode)
- SetClipboardData(CF_UNICODETEXT, hGlobal);
- else
- SetClipboardData(CF_TEXT, hGlobal);
-
- /* Flag that SetClipboardData has been called */
- fSetClipboardData = FALSE;
-
- /*
- * NOTE: Do not try to free pszGlobalData, it is owned by
- * Windows after the call to SetClipboardData ().
- */
-
- winClipboardFlushXEvents_SelectionNotify_Done:
- /* Free allocated resources */
- if (ppszTextList)
- XFreeStringList(ppszTextList);
+ strcpy (pszGlobalData, pszConvertData);
+ free (pszConvertData);
+ pszConvertData = NULL;
+ }
+
+ /* Release the pointer to the global memory */
+ GlobalUnlock (hGlobal);
+ pszGlobalData = NULL;
+
+ /* Push the selection data to the Windows clipboard */
+ if (fUseUnicode)
+ SetClipboardData (CF_UNICODETEXT, hGlobal);
+ else
+ SetClipboardData (CF_TEXT, hGlobal);
+
+ /* Flag that SetClipboardData has been called */
+ fSetClipboardData = FALSE;
+
+ /*
+ * NOTE: Do not try to free pszGlobalData, it is owned by
+ * Windows after the call to SetClipboardData ().
+ */
+
+ winClipboardFlushXEvents_PropertyNotify_Done:
+ /* Free allocated resources */
+ if (ppszTextList)
+ XFreeStringList (ppszTextList);
if (xtpText.value) {
- XFree(xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
+ XFree (xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+ }
+ free(pszConvertData);
+ free(pwszUnicodeStr);
+ if (hGlobal && pszGlobalData)
+ GlobalUnlock (hGlobal);
+ if (fSetClipboardData)
+ {
+ SetClipboardData (CF_UNICODETEXT, NULL);
+ SetClipboardData (CF_TEXT, NULL);
}
- free(pszConvertData);
- free(pwszUnicodeStr);
- if (hGlobal && pszGlobalData)
- GlobalUnlock(hGlobal);
- if (fSetClipboardData && g_fUnicodeSupport)
- SetClipboardData(CF_UNICODETEXT, NULL);
- if (fSetClipboardData)
- SetClipboardData(CF_TEXT, NULL);
- return WIN_XEVENTS_NOTIFY;
+ return WIN_XEVENTS_NOTIFY;
- case SelectionClear:
- winDebug("SelectionClear - doing nothing\n");
- break;
+ case MappingNotify:
+ break;
- case PropertyNotify:
- break;
-
- case MappingNotify:
- break;
-
- default:
+ default:
ErrorF("winClipboardFlushXEvents - unexpected event type %d\n",
event.type);
- break;
- }
+ break;
+ }
}
- return WIN_XEVENTS_SUCCESS;
+ return WIN_XEVENTS_SUCCESS;
}
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index 313320f1a..8e6003993 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -70,6 +70,7 @@ WinCmdlineRec g_cmdline = {
#ifdef XWIN_XF86CONFIG
NULL, /* keyboard */
#endif
+ FALSE, /* customDPI */
NULL, /* xkbRules */
NULL, /* xkbModel */
NULL, /* xkbLayout */
diff --git a/hw/xwin/winconfig.h b/hw/xwin/winconfig.h
index 94571ff71..4f41a62ad 100644
--- a/hw/xwin/winconfig.h
+++ b/hw/xwin/winconfig.h
@@ -160,6 +160,7 @@ typedef struct {
#ifdef XWIN_XF86CONFIG
char *keyboard;
#endif
+ Bool customDPI;
char *xkbRules;
char *xkbModel;
char *xkbLayout;
diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c
index 0a18a6a29..e0e1defd9 100644
--- a/hw/xwin/wincreatewnd.c
+++ b/hw/xwin/wincreatewnd.c
@@ -34,108 +34,104 @@
#include "win.h"
#include "shellapi.h"
-#ifndef ABS_AUTOHIDE
-#define ABS_AUTOHIDE 1
-#endif
-
/*
* Local function prototypes
*/
static Bool
- winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
+winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo);
static Bool
- winAdjustForAutoHide(RECT * prcWorkArea);
+winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo);
/*
* Create a full screen window
*/
Bool
-winCreateBoundingWindowFullScreen(ScreenPtr pScreen)
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- int iX = pScreenInfo->dwInitialX;
- int iY = pScreenInfo->dwInitialY;
- int iWidth = pScreenInfo->dwWidth;
- int iHeight = pScreenInfo->dwHeight;
- HWND *phwnd = &pScreenPriv->hwndScreen;
- WNDCLASSEX wc;
- char szTitle[256];
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int iX = pScreenInfo->dwInitialX;
+ int iY = pScreenInfo->dwInitialY;
+ int iWidth = pScreenInfo->dwWidth;
+ int iHeight = pScreenInfo->dwHeight;
+ HWND *phwnd = &pScreenPriv->hwndScreen;
+ WNDCLASSEX wc;
+ char szTitle[256];
#if CYGDEBUG
- winDebug("winCreateBoundingWindowFullScreen\n");
+ winDebug ("winCreateBoundingWindowFullScreen\n");
#endif
- /* Setup our window class */
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
+ /* Setup our window class */
+ wc.cbSize=sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
wc.hIcon =
(HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), 0);
- wc.hCursor = 0;
- wc.hbrBackground = 0;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WINDOW_CLASS;
+ wc.hCursor = 0;
+ wc.hbrBackground = 0;
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINDOW_CLASS;
wc.hIconSm =
(HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
- RegisterClassEx(&wc);
+ RegisterClassEx (&wc);
- /* Set display and screen-specific tooltip text */
- if (g_pszQueryHost != NULL)
- snprintf(szTitle,
- sizeof(szTitle),
- WINDOW_TITLE_XDMCP,
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost != NULL)
+ snprintf (szTitle,
+ sizeof (szTitle),
+ WINDOW_TITLE_XDMCP,
g_pszQueryHost, display, (int) pScreenInfo->dwScreen);
- else
- snprintf(szTitle,
- sizeof(szTitle),
+ else
+ snprintf (szTitle,
+ sizeof (szTitle),
WINDOW_TITLE, display, (int) pScreenInfo->dwScreen);
- /* Create the window */
- *phwnd = CreateWindowExA(0, /* Extended styles */
- WINDOW_CLASS, /* Class name */
- szTitle, /* Window name */
+ /* Create the window */
+ *phwnd = CreateWindowExA (0, /* Extended styles */
+ WINDOW_CLASS, /* Class name */
+ szTitle, /* Window name */
WS_POPUP, iX, /* Horizontal position */
- iY, /* Vertical position */
- iWidth, /* Right edge */
- iHeight, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle(NULL), /* Instance handle */
- pScreenPriv); /* ScreenPrivates */
-
- /* Branch on the server engine */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL),/* Instance handle */
+ pScreenPriv); /* ScreenPrivates */
+
+ /* Branch on the server engine */
switch (pScreenInfo->dwEngine) {
#ifdef XWIN_NATIVEGDI
case WIN_SERVER_SHADOW_GDI:
- /* Show the window */
- ShowWindow(*phwnd, SW_SHOWMAXIMIZED);
- break;
+ /* Show the window */
+ ShowWindow (*phwnd, SW_SHOWMAXIMIZED);
+ break;
#endif
default:
- /* Hide the window */
- ShowWindow(*phwnd, SW_SHOWNORMAL);
- break;
+ /* Hide the window */
+ ShowWindow (*phwnd, SW_SHOWNORMAL);
+ break;
}
- /* Send first paint message */
- UpdateWindow(*phwnd);
+ /* Send first paint message */
+ UpdateWindow (*phwnd);
- /* Attempt to bring our window to the top of the display */
- BringWindowToTop(*phwnd);
+ /* Attempt to bring our window to the top of the display */
+ BringWindowToTop (*phwnd);
- return TRUE;
+ return TRUE;
}
/*
@@ -143,124 +139,124 @@ winCreateBoundingWindowFullScreen(ScreenPtr pScreen)
*/
Bool
-winCreateBoundingWindowWindowed(ScreenPtr pScreen)
+winCreateBoundingWindowWindowed (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- int iWidth = pScreenInfo->dwUserWidth;
- int iHeight = pScreenInfo->dwUserHeight;
- int iPosX;
- int iPosY;
- HWND *phwnd = &pScreenPriv->hwndScreen;
- WNDCLASSEX wc;
- RECT rcClient, rcWorkArea;
- DWORD dwWindowStyle;
- BOOL fForceShowWindow = FALSE;
- char szTitle[256];
-
- winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
- (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
- winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
- (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
-
- /* Set the common window style flags */
- dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
-
- /* Decorated or undecorated window */
- if (pScreenInfo->fDecoration
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int iWidth = pScreenInfo->dwUserWidth;
+ int iHeight = pScreenInfo->dwUserHeight;
+ int iPosX;
+ int iPosY;
+ HWND *phwnd = &pScreenPriv->hwndScreen;
+ WNDCLASSEX wc;
+ RECT rcClient, rcWorkArea;
+ DWORD dwWindowStyle;
+ BOOL fForceShowWindow = FALSE;
+ char szTitle[256];
+
+ winDebug ("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
+ (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
+ winDebug ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
+ (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
+
+ /* Set the common window style flags */
+ dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
+
+ /* Decorated or undecorated window */
+ if (pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- && !pScreenInfo->fRootless
+ && !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
) {
/* Try to handle startup via run.exe. run.exe instructs Windows to
* hide all created windows. Detect this case and make sure the
* window is shown nevertheless */
- STARTUPINFO startupInfo;
+ STARTUPINFO startupInfo;
GetStartupInfo(&startupInfo);
- if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
+ if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
startupInfo.wShowWindow == SW_HIDE) {
- fForceShowWindow = TRUE;
- }
+ fForceShowWindow = TRUE;
+ }
dwWindowStyle |= WS_CAPTION;
if (pScreenInfo->iResizeMode != notAllowed)
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
}
- else
- dwWindowStyle |= WS_POPUP;
-
- /* Setup our window class */
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
+ else
+ dwWindowStyle |= WS_POPUP;
+
+ /* Setup our window class */
+ wc.cbSize=sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
wc.hIcon =
(HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WINDOW_CLASS;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINDOW_CLASS;
wc.hIconSm =
(HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
- RegisterClassEx(&wc);
+ RegisterClassEx (&wc);
- /* Get size of work area */
- winGetWorkArea(&rcWorkArea, pScreenInfo);
+ /* Get size of work area */
+ winGetWorkArea (&rcWorkArea, pScreenInfo);
- /* Adjust for auto-hide taskbars */
- winAdjustForAutoHide(&rcWorkArea);
+ /* Adjust for auto-hide taskbars */
+ winAdjustForAutoHide (&rcWorkArea, pScreenInfo);
- /* Did the user specify a position? */
+ /* Did the user specify a position? */
if (pScreenInfo->fUserGavePosition) {
- iPosX = pScreenInfo->dwInitialX;
- iPosY = pScreenInfo->dwInitialY;
+ iPosX = pScreenInfo->dwInitialX;
+ iPosY = pScreenInfo->dwInitialY;
}
else {
- iPosX = rcWorkArea.left;
- iPosY = rcWorkArea.top;
+ iPosX = rcWorkArea.left;
+ iPosY = rcWorkArea.top;
}
- /* Clean up the scrollbars flag, if necessary */
- if ((!pScreenInfo->fDecoration
+ /* Clean up the scrollbars flag, if necessary */
+ if ((!pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
- || pScreenInfo->fRootless
+ || pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
- )
+ )
&& (pScreenInfo->iResizeMode == resizeWithScrollbars)) {
- /* We cannot have scrollbars if we do not have a window border */
- pScreenInfo->iResizeMode = notAllowed;
+ /* We cannot have scrollbars if we do not have a window border */
+ pScreenInfo->iResizeMode = notAllowed;
}
- /* Did the user specify a height and width? */
+ /* Did the user specify a height and width? */
if (pScreenInfo->fUserGaveHeightAndWidth) {
- /* User gave a desired height and width, try to accomodate */
+ /* User gave a desired height and width, try to accomodate */
#if CYGDEBUG
- winDebug("winCreateBoundingWindowWindowed - User gave height "
- "and width\n");
+ winDebug ("winCreateBoundingWindowWindowed - User gave height "
+ "and width\n");
#endif
-
- /* Adjust the window width and height for borders and title bar */
- if (pScreenInfo->fDecoration
+
+ /* Adjust the window width and height for borders and title bar */
+ if (pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- && !pScreenInfo->fRootless
+ && !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
) {
#if CYGDEBUG
@@ -268,225 +264,225 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
("winCreateBoundingWindowWindowed - Window has decoration\n");
#endif
- /* Are we resizable */
+ /* Are we resizable */
if (pScreenInfo->iResizeMode != notAllowed) {
#if CYGDEBUG
winDebug
("winCreateBoundingWindowWindowed - Window is resizable\n");
#endif
- iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME)
- + GetSystemMetrics(SM_CYCAPTION);
- }
+ iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
+ iHeight += 2 * GetSystemMetrics (SM_CYSIZEFRAME)
+ + GetSystemMetrics (SM_CYCAPTION);
+ }
else {
#if CYGDEBUG
winDebug
("winCreateBoundingWindowWindowed - Window is not resizable\n");
#endif
- iWidth += 2 * GetSystemMetrics(SM_CXFIXEDFRAME);
- iHeight += 2 * GetSystemMetrics(SM_CYFIXEDFRAME)
- + GetSystemMetrics(SM_CYCAPTION);
- }
- }
+ iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
+ iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME)
+ + GetSystemMetrics (SM_CYCAPTION);
+ }
+ }
}
else {
- /* By default, we are creating a window that is as large as possible */
+ /* By default, we are creating a window that is as large as possible */
#if CYGDEBUG
- winDebug("winCreateBoundingWindowWindowed - User did not give "
- "height and width\n");
+ winDebug ("winCreateBoundingWindowWindowed - User did not give "
+ "height and width\n");
#endif
- /* Defaults are wrong if we have multiple monitors */
+ /* Defaults are wrong if we have multiple monitors */
if (pScreenInfo->fMultipleMonitors) {
- iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
- }
+ iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ }
}
- /* Make sure window is no bigger than work area */
- if (TRUE
+ /* Make sure window is no bigger than work area */
+ if (TRUE
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
) {
- /* Trim window width to fit work area */
- if (iWidth > (rcWorkArea.right - rcWorkArea.left))
- iWidth = rcWorkArea.right - rcWorkArea.left;
-
- /* Trim window height to fit work area */
- if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
- iHeight = rcWorkArea.bottom - rcWorkArea.top;
-
+ /* Trim window width to fit work area */
+ if (iWidth > (rcWorkArea.right - rcWorkArea.left))
+ iWidth = rcWorkArea.right - rcWorkArea.left;
+
+ /* Trim window height to fit work area */
+ if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
+ iHeight = rcWorkArea.bottom - rcWorkArea.top;
+
#if CYGDEBUG
winDebug("winCreateBoundingWindowWindowed - Adjusted width: %d "
"height: %d\n", iWidth, iHeight);
#endif
}
- /* Set display and screen-specific tooltip text */
- if (g_pszQueryHost != NULL)
- snprintf(szTitle,
- sizeof(szTitle),
- WINDOW_TITLE_XDMCP,
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost != NULL)
+ snprintf (szTitle,
+ sizeof (szTitle),
+ WINDOW_TITLE_XDMCP,
g_pszQueryHost, display, (int) pScreenInfo->dwScreen);
- else
- snprintf(szTitle,
- sizeof(szTitle),
+ else
+ snprintf (szTitle,
+ sizeof (szTitle),
WINDOW_TITLE, display, (int) pScreenInfo->dwScreen);
- /* Create the window */
- *phwnd = CreateWindowExA(0, /* Extended styles */
- WINDOW_CLASS, /* Class name */
- szTitle, /* Window name */
+ /* Create the window */
+ *phwnd = CreateWindowExA (0, /* Extended styles */
+ WINDOW_CLASS, /* Class name */
+ szTitle, /* Window name */
dwWindowStyle, iPosX, /* Horizontal position */
- iPosY, /* Vertical position */
- iWidth, /* Right edge */
- iHeight, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle(NULL), /* Instance handle */
- pScreenPriv); /* ScreenPrivates */
+ iPosY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL),/* Instance handle */
+ pScreenPriv); /* ScreenPrivates */
if (*phwnd == NULL) {
- ErrorF("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n");
- return FALSE;
+ ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n");
+ return FALSE;
}
#if CYGDEBUG
- winDebug("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
+ winDebug ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
#endif
if (fForceShowWindow) {
ErrorF
("winCreateBoundingWindowWindowed - Setting normal windowstyle\n");
- ShowWindow(*phwnd, SW_SHOW);
- }
+ ShowWindow(*phwnd, SW_SHOW);
+ }
- /* Get the client area coordinates */
+ /* Get the client area coordinates */
if (!GetClientRect(*phwnd, &rcClient)) {
- ErrorF("winCreateBoundingWindowWindowed - GetClientRect () "
- "failed\n");
- return FALSE;
+ ErrorF ("winCreateBoundingWindowWindowed - GetClientRect () "
+ "failed\n");
+ return FALSE;
}
- winDebug("winCreateBoundingWindowWindowed - WindowClient "
- "w %ld h %ld r %ld l %ld b %ld t %ld\n",
- rcClient.right - rcClient.left,
- rcClient.bottom - rcClient.top,
+ winDebug ("winCreateBoundingWindowWindowed - WindowClient "
+ "w %ld h %ld r %ld l %ld b %ld t %ld\n",
+ rcClient.right - rcClient.left,
+ rcClient.bottom - rcClient.top,
rcClient.right, rcClient.left, rcClient.bottom, rcClient.top);
-
- /* We adjust the visual size if the user did not specify it */
+
+ /* We adjust the visual size if the user did not specify it */
if (!
((pScreenInfo->iResizeMode == resizeWithScrollbars) &&
pScreenInfo->fUserGaveHeightAndWidth)) {
- /*
- * User did not give a height and width with scrollbars enabled,
- * so we will resize the underlying visual to be as large as
- * the initial view port (page size). This way scrollbars will
- * not appear until the user shrinks the window, if they ever do.
- *
- * NOTE: We have to store the viewport size here because
- * the user may have an autohide taskbar, which would
- * cause the viewport size to be one less in one dimension
- * than the viewport size that we calculated by subtracting
- * the size of the borders and caption.
- */
- pScreenInfo->dwWidth = rcClient.right - rcClient.left;
- pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
+ /*
+ * User did not give a height and width with scrollbars enabled,
+ * so we will resize the underlying visual to be as large as
+ * the initial view port (page size). This way scrollbars will
+ * not appear until the user shrinks the window, if they ever do.
+ *
+ * NOTE: We have to store the viewport size here because
+ * the user may have an autohide taskbar, which would
+ * cause the viewport size to be one less in one dimension
+ * than the viewport size that we calculated by subtracting
+ * the size of the borders and caption.
+ */
+ pScreenInfo->dwWidth = rcClient.right - rcClient.left;
+ pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
}
#if 0
- /*
- * NOTE: For the uninitiated, the page size is the number of pixels
- * that we can display in the x or y direction at a time and the
- * range is the total number of pixels in the x or y direction that we
- * have available to display. In other words, the page size is the
- * size of the window area minus the space the caption, borders, and
- * scrollbars (if any) occupy, and the range is the size of the
- * underlying X visual. Notice that, contrary to what some of the
- * MSDN Library arcticles lead you to believe, the windows
- * ``client area'' size does not include the scrollbars. In other words,
- * the whole client area size that is reported to you is drawable by
- * you; you do not have to subtract the size of the scrollbars from
- * the client area size, and if you did it would result in the size
- * of the scrollbars being double counted.
- */
-
- /* Setup scrollbar page and range, if scrollbars are enabled */
+ /*
+ * NOTE: For the uninitiated, the page size is the number of pixels
+ * that we can display in the x or y direction at a time and the
+ * range is the total number of pixels in the x or y direction that we
+ * have available to display. In other words, the page size is the
+ * size of the window area minus the space the caption, borders, and
+ * scrollbars (if any) occupy, and the range is the size of the
+ * underlying X visual. Notice that, contrary to what some of the
+ * MSDN Library arcticles lead you to believe, the windows
+ * ``client area'' size does not include the scrollbars. In other words,
+ * the whole client area size that is reported to you is drawable by
+ * you; you do not have to subtract the size of the scrollbars from
+ * the client area size, and if you did it would result in the size
+ * of the scrollbars being double counted.
+ */
+
+ /* Setup scrollbar page and range, if scrollbars are enabled */
if (pScreenInfo->fScrollbars) {
- SCROLLINFO si;
-
- /* Initialize the scrollbar info structure */
- si.cbSize = sizeof(si);
- si.fMask = SIF_RANGE | SIF_PAGE;
- si.nMin = 0;
-
- /* Setup the width range and page size */
- si.nMax = pScreenInfo->dwWidth - 1;
- si.nPage = rcClient.right - rcClient.left;
- winDebug("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
- si.nMax, si.nPage);
- SetScrollInfo(*phwnd, SB_HORZ, &si, TRUE);
-
- /* Setup the height range and page size */
- si.nMax = pScreenInfo->dwHeight - 1;
- si.nPage = rcClient.bottom - rcClient.top;
- winDebug("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
- si.nMax, si.nPage);
- SetScrollInfo(*phwnd, SB_VERT, &si, TRUE);
+ SCROLLINFO si;
+
+ /* Initialize the scrollbar info structure */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_RANGE | SIF_PAGE;
+ si.nMin = 0;
+
+ /* Setup the width range and page size */
+ si.nMax = pScreenInfo->dwWidth - 1;
+ si.nPage = rcClient.right - rcClient.left;
+ winDebug ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
+ si.nMax, si.nPage);
+ SetScrollInfo (*phwnd, SB_HORZ, &si, TRUE);
+
+ /* Setup the height range and page size */
+ si.nMax = pScreenInfo->dwHeight - 1;
+ si.nPage = rcClient.bottom - rcClient.top;
+ winDebug ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
+ si.nMax, si.nPage);
+ SetScrollInfo (*phwnd, SB_VERT, &si, TRUE);
}
#endif
- /* Show the window */
- if (FALSE
+ /* Show the window */
+ if (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- pScreenPriv->fRootWindowShown = FALSE;
+ pScreenPriv->fRootWindowShown = FALSE;
#endif
- ShowWindow(*phwnd, SW_HIDE);
+ ShowWindow (*phwnd, SW_HIDE);
}
- else
- ShowWindow(*phwnd, SW_SHOWNORMAL);
+ else
+ ShowWindow (*phwnd, SW_SHOWNORMAL);
if (!UpdateWindow(*phwnd)) {
- ErrorF("winCreateBoundingWindowWindowed - UpdateWindow () failed\n");
- return FALSE;
+ ErrorF ("winCreateBoundingWindowWindowed - UpdateWindow () failed\n");
+ return FALSE;
}
-
- /* Attempt to bring our window to the top of the display */
- if (TRUE
+
+ /* Attempt to bring our window to the top of the display */
+ if (TRUE
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- && !pScreenInfo->fRootless
+ && !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
) {
if (!BringWindowToTop(*phwnd)) {
- ErrorF("winCreateBoundingWindowWindowed - BringWindowToTop () "
- "failed\n");
- return FALSE;
- }
+ ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () "
+ "failed\n");
+ return FALSE;
+ }
}
#ifdef XWIN_NATIVEGDI
- /* Paint window background blue */
- if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
- winPaintBackground(*phwnd, RGB(0x00, 0x00, 0xFF));
+ /* Paint window background blue */
+ if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
+ winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF));
#endif
- winDebug("winCreateBoundingWindowWindowed - Returning\n");
+ winDebug ("winCreateBoundingWindowWindowed - Returning\n");
- return TRUE;
+ return TRUE;
}
/*
@@ -494,66 +490,108 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
*/
static Bool
-winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
+winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
{
- int iPrimaryWidth, iPrimaryHeight;
- int iWidth, iHeight;
- int iLeft, iTop;
- int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
-
- /* SPI_GETWORKAREA only gets the work area of the primary screen. */
- SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0);
+ int iPrimaryWidth, iPrimaryHeight;
+ int iWidth, iHeight;
+ int iLeft, iTop;
+ int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
+
+ /* Use GetMonitorInfo to get work area for monitor */
+ if (!pScreenInfo->fMultipleMonitors)
+ {
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+ if (GetMonitorInfo(pScreenInfo->hMonitor, &mi))
+ {
+ *prcWorkArea = mi.rcWork;
+
+ winDebug ("winGetWorkArea - Monitor %d WorkArea: %d %d %d %d\n",
+ pScreenInfo->iMonitor,
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+ }
+ else
+ {
+ ErrorF ("winGetWorkArea - GetMonitorInfo() failed for monitor %d\n", pScreenInfo->iMonitor);
+ }
/* Bail out here if we aren't using multiple monitors */
- if (!pScreenInfo->fMultipleMonitors)
- return TRUE;
-
- winDebug("winGetWorkArea - Original WorkArea: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
-
- /* Get size of full virtual screen */
- iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
-
- winDebug("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
-
- /* Get origin of full virtual screen */
- iLeft = GetSystemMetrics(SM_XVIRTUALSCREEN);
- iTop = GetSystemMetrics(SM_YVIRTUALSCREEN);
-
- winDebug("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
-
- /* Get size of primary screen */
- iPrimaryWidth = GetSystemMetrics(SM_CXSCREEN);
- iPrimaryHeight = GetSystemMetrics(SM_CYSCREEN);
-
- winDebug("winGetWorkArea - Primary screen is %d x %d\n",
- iPrimaryWidth, iPrimaryHeight);
-
- /* Work out how much of the primary screen we aren't using */
- iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right -
- prcWorkArea->left);
- iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom
- - prcWorkArea->top);
-
- /* Update the rectangle to include all monitors */
+ return TRUE;
+ }
+
+ /* SPI_GETWORKAREA only gets the work area of the primary screen. */
+ SystemParametersInfo (SPI_GETWORKAREA, 0, prcWorkArea, 0);
+
+ winDebug ("winGetWorkArea - Primary Monitor WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ /* Get size of full virtual screen */
+ iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+
+ winDebug ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
+
+ /* Get origin of full virtual screen */
+ iLeft = GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iTop = GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ winDebug ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
+
+ /* Get size of primary screen */
+ iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN);
+ iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN);
+
+ winDebug ("winGetWorkArea - Primary screen is %d x %d\n",
+ iPrimaryWidth, iPrimaryHeight);
+
+ /* Work out how much of the primary screen we aren't using */
+ iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right -
+ prcWorkArea->left);
+ iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom
+ - prcWorkArea->top);
+
+ /* Update the rectangle to include all monitors */
if (iLeft < 0) {
- prcWorkArea->left = iLeft;
+ prcWorkArea->left = iLeft;
}
if (iTop < 0) {
- prcWorkArea->top = iTop;
+ prcWorkArea->top = iTop;
}
prcWorkArea->right = prcWorkArea->left + iWidth - iPrimaryNonWorkAreaWidth;
- prcWorkArea->bottom = prcWorkArea->top + iHeight -
- iPrimaryNonWorkAreaHeight;
-
- winDebug("winGetWorkArea - Adjusted WorkArea for multiple "
- "monitors: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+ prcWorkArea->bottom = prcWorkArea->top + iHeight -
+ iPrimaryNonWorkAreaHeight;
+
+ winDebug ("winGetWorkArea - Adjusted WorkArea for multiple "
+ "monitors: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ return TRUE;
+}
- return TRUE;
+static Bool
+winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo *pScreenInfo)
+{
+ APPBARDATA abd;
+ HWND hwndAutoHide;
+
+ ZeroMemory (&abd, sizeof (abd));
+ abd.cbSize = sizeof (abd);
+ abd.uEdge = uEdge;
+
+ hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
+ if (hwndAutoHide != NULL)
+ {
+ /*
+ Found an autohide taskbar on that edge, but is it on the
+ same monitor as the screen window?
+ */
+ if (pScreenInfo->fMultipleMonitors || (MonitorFromWindow(hwndAutoHide, MONITOR_DEFAULTTONULL) == pScreenInfo->hMonitor))
+ return TRUE;
+ }
+ return FALSE;
}
/*
@@ -562,65 +600,56 @@ winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
*/
static Bool
-winAdjustForAutoHide(RECT * prcWorkArea)
+winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
{
- APPBARDATA abd;
- HWND hwndAutoHide;
-
- winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
-
- /* Find out if the Windows taskbar is set to auto-hide */
- ZeroMemory(&abd, sizeof(abd));
- abd.cbSize = sizeof(abd);
- if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
- winDebug("winAdjustForAutoHide - Taskbar is auto hide\n");
-
- /* Look for a TOP auto-hide taskbar */
- abd.uEdge = ABE_TOP;
- hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
- if (hwndAutoHide != NULL) {
- winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
- prcWorkArea->top += 1;
+ APPBARDATA abd;
+
+ winDebug ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ /* Find out if the Windows taskbar is set to auto-hide */
+ ZeroMemory (&abd, sizeof (abd));
+ abd.cbSize = sizeof (abd);
+ if (SHAppBarMessage (ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
+ winDebug ("winAdjustForAutoHide - Taskbar is auto hide\n");
+
+ /*
+ Despite the forgoing, we are checking for any AppBar
+ hiding along a monitor edge, not just the Windows TaskBar.
+ */
+
+ /* Look for a TOP auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo))
+ {
+ winDebug ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
+ prcWorkArea->top += 1;
}
- /* Look for a LEFT auto-hide taskbar */
- abd.uEdge = ABE_LEFT;
- hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
- if (hwndAutoHide != NULL) {
- winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
- prcWorkArea->left += 1;
+ /* Look for a LEFT auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo))
+ {
+ winDebug ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
+ prcWorkArea->left += 1;
}
- /* Look for a BOTTOM auto-hide taskbar */
- abd.uEdge = ABE_BOTTOM;
- hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
- if (hwndAutoHide != NULL) {
- winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
- prcWorkArea->bottom -= 1;
+ /* Look for a BOTTOM auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo))
+ {
+ winDebug ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
+ prcWorkArea->bottom -= 1;
}
- /* Look for a RIGHT auto-hide taskbar */
- abd.uEdge = ABE_RIGHT;
- hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
- if (hwndAutoHide != NULL) {
- winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
- prcWorkArea->right -= 1;
+ /* Look for a RIGHT auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo))
+ {
+ winDebug ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
+ prcWorkArea->right -= 1;
}
- winDebug("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+ winDebug ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
-#if 0
- /* Obtain the task bar window dimensions */
- abd.hWnd = hwndAutoHide;
- hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
- winDebug("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n",
- hwndAutoHide, abd.hWnd,
- abd.rc.top, abd.rc.left, abd.rc.bottom, abd.rc.right);
-#endif
-
- return TRUE;
+ return TRUE;
}
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index c62b5dbe9..ccf104dec 100644
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -44,7 +44,7 @@
*/
#ifdef XWIN_CLIPBOARD
-extern Bool g_fClipboardStarted;
+extern Bool g_fClipboardStarted;
#endif
/*
* Local function prototypes
@@ -60,57 +60,57 @@ static wBOOL CALLBACK
winAboutDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
static void
- winDrawURLWindow(LPARAM lParam);
+winDrawURLWindow (LPARAM lParam);
static LRESULT CALLBACK
-winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+winURLWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static void
- winOverrideURLButton(HWND hdlg, int id);
+winOverrideURLButton (HWND hdlg, int id);
static void
- winUnoverrideURLButton(HWND hdlg, int id);
+winUnoverrideURLButton (HWND hdlg, int id);
/*
* Owner-draw a button as a URL
*/
static void
-winDrawURLWindow(LPARAM lParam)
+winDrawURLWindow (LPARAM lParam)
{
- DRAWITEMSTRUCT *draw;
- char str[256];
- RECT rect;
- HFONT font;
- COLORREF crText;
-
- draw = (DRAWITEMSTRUCT *) lParam;
- GetWindowText(draw->hwndItem, str, sizeof(str));
- str[255] = 0;
- GetClientRect(draw->hwndItem, &rect);
-
- /* Color the button depending upon its state */
- if (draw->itemState & ODS_SELECTED)
- crText = RGB(128 + 64, 0, 0);
- else if (draw->itemState & ODS_FOCUS)
- crText = RGB(0, 128 + 64, 0);
- else
- crText = RGB(0, 0, 128 + 64);
- SetTextColor(draw->hDC, crText);
-
- /* Create font 8 high, standard dialog font */
- font = CreateFont(-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
- 0, 0, 0, 0, 0, "MS Sans Serif");
+ DRAWITEMSTRUCT *draw;
+ char str[256];
+ RECT rect;
+ HFONT font;
+ COLORREF crText;
+
+ draw = (DRAWITEMSTRUCT *) lParam;
+ GetWindowText (draw->hwndItem, str, sizeof(str));
+ str[255] = 0;
+ GetClientRect (draw->hwndItem, &rect);
+
+ /* Color the button depending upon its state */
+ if (draw->itemState & ODS_SELECTED)
+ crText = RGB(128+64,0,0);
+ else if (draw->itemState & ODS_FOCUS)
+ crText = RGB(0,128+64,0);
+ else
+ crText = RGB(0,0,128+64);
+ SetTextColor (draw->hDC, crText);
+
+ /* Create font 8 high, standard dialog font */
+ font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
+ 0, 0, 0, 0, 0, "MS Sans Serif");
if (!font) {
- ErrorF("winDrawURLWindow: Unable to create URL font, bailing.\n");
- return;
+ ErrorF ("winDrawURLWindow: Unable to create URL font, bailing.\n");
+ return;
}
- /* Draw it */
- SetBkMode(draw->hDC, OPAQUE);
- SelectObject(draw->hDC, font);
- DrawText(draw->hDC, str, strlen(str), &rect, DT_LEFT | DT_VCENTER);
- /* Delete the created font, replace it with stock font */
- DeleteObject(SelectObject(draw->hDC, GetStockObject(ANSI_VAR_FONT)));
+ /* Draw it */
+ SetBkMode (draw->hDC, OPAQUE);
+ SelectObject (draw->hDC, font);
+ DrawText (draw->hDC, str, strlen (str),&rect,DT_LEFT | DT_VCENTER);
+ /* Delete the created font, replace it with stock font */
+ DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT)));
}
/*
@@ -120,22 +120,22 @@ winDrawURLWindow(LPARAM lParam)
static LRESULT CALLBACK
winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC origCB = NULL;
- HCURSOR cursor;
-
- /* If it's a SetCursor message, tell it to the hand */
- if (msg == WM_SETCURSOR) {
- cursor = LoadCursor(NULL, IDC_HAND);
- if (cursor)
- SetCursor(cursor);
- return TRUE;
- }
- origCB = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- /* Otherwise fall through to original WndProc */
- if (origCB)
- return CallWindowProc(origCB, hwnd, msg, wParam, lParam);
- else
- return FALSE;
+ WNDPROC origCB = NULL;
+ HCURSOR cursor;
+
+ /* If it's a SetCursor message, tell it to the hand */
+ if (msg==WM_SETCURSOR) {
+ cursor = LoadCursor (NULL, IDC_HAND);
+ if (cursor)
+ SetCursor (cursor);
+ return TRUE;
+ }
+ origCB = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ /* Otherwise fall through to original WndProc */
+ if (origCB)
+ return CallWindowProc (origCB, hwnd, msg, wParam, lParam);
+ else
+ return FALSE;
}
/*
@@ -143,23 +143,23 @@ winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
*/
static void
-winOverrideURLButton(HWND hwnd, int id)
+winOverrideURLButton (HWND hwnd, int id)
{
- WNDPROC origCB;
+ WNDPROC origCB;
- origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id),
- GWLP_WNDPROC, (LONG_PTR) winURLWndProc);
- SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, (LONG_PTR) origCB);
+ origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id),
+ GWLP_WNDPROC, (LONG_PTR)winURLWndProc);
+ SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_USERDATA, (LONG_PTR)origCB);
}
static void
-winUnoverrideURLButton(HWND hwnd, int id)
+winUnoverrideURLButton (HWND hwnd, int id)
{
- WNDPROC origCB;
+ WNDPROC origCB;
origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, 0);
- if (origCB)
- SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_WNDPROC, (LONG_PTR) origCB);
+ if (origCB)
+ SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_WNDPROC, (LONG_PTR)origCB);
}
/*
@@ -168,68 +168,68 @@ winUnoverrideURLButton(HWND hwnd, int id)
*/
static void
-winInitDialog(HWND hwndDlg)
+winInitDialog (HWND hwndDlg)
{
- HWND hwndDesk;
- RECT rc, rcDlg, rcDesk;
- HICON hIcon, hIconSmall;
-
- hwndDesk = GetParent(hwndDlg);
- if (!hwndDesk || IsIconic(hwndDesk))
- hwndDesk = GetDesktopWindow();
-
- /* Remove minimize and maximize buttons */
+ HWND hwndDesk;
+ RECT rc, rcDlg, rcDesk;
+ HICON hIcon, hIconSmall;
+
+ hwndDesk = GetParent (hwndDlg);
+ if (!hwndDesk || IsIconic (hwndDesk))
+ hwndDesk = GetDesktopWindow ();
+
+ /* Remove minimize and maximize buttons */
SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE)
- & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
-
- /* Set Window not to show in the task bar */
- SetWindowLongPtr(hwndDlg, GWL_EXSTYLE,
- GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);
-
- /* Center dialog window in the screen. Not done for multi-monitor systems, where
- * it is likely to end up split across the screens. In that case, it appears
- * near the Tray icon.
- */
- if (GetSystemMetrics(SM_CMONITORS) > 1) {
- /* Still need to refresh the frame change. */
- SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
+
+ /* Set Window not to show in the task bar */
+ SetWindowLongPtr(hwndDlg, GWL_EXSTYLE,
+ GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW );
+
+ /* Center dialog window in the screen. Not done for multi-monitor systems, where
+ * it is likely to end up split across the screens. In that case, it appears
+ * near the Tray icon.
+ */
+ if (GetSystemMetrics(SM_CMONITORS)>1) {
+ /* Still need to refresh the frame change. */
+ SetWindowPos (hwndDlg, HWND_TOPMOST, 0,0,0,0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
else {
- GetWindowRect(hwndDesk, &rcDesk);
- GetWindowRect(hwndDlg, &rcDlg);
- CopyRect(&rc, &rcDesk);
-
- OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect(&rc, -rc.left, -rc.top);
- OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
-
- SetWindowPos(hwndDlg,
- HWND_TOPMOST,
- rcDesk.left + (rc.right / 2),
- rcDesk.top + (rc.bottom / 2),
+ GetWindowRect (hwndDesk, &rcDesk);
+ GetWindowRect (hwndDlg, &rcDlg);
+ CopyRect (&rc, &rcDesk);
+
+ OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect (&rc, -rc.left, -rc.top);
+ OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom);
+
+ SetWindowPos (hwndDlg,
+ HWND_TOPMOST,
+ rcDesk.left + (rc.right / 2),
+ rcDesk.top + (rc.bottom / 2),
0, 0, SWP_NOSIZE | SWP_FRAMECHANGED);
- }
+ }
#ifdef XWIN_MULTIWINDOW
if (g_hIconX)
hIcon = g_hIconX;
- else
+ else
#endif
- hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+ hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
#ifdef XWIN_MULTIWINDOW
if (g_hSmallIconX)
hIconSmall = g_hSmallIconX;
- else
+ else
#endif
- hIconSmall = LoadImage(g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON),
+ hIconSmall = LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_SHARED);
- PostMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
- PostMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
+ PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
+ PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
}
/*
@@ -237,68 +237,68 @@ winInitDialog(HWND hwndDlg)
*/
void
-winDisplayExitDialog(winPrivScreenPtr pScreenPriv)
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
{
- int i;
- int liveClients = 0;
+ int i;
+ int liveClients = 0;
- /* Count up running clients (clients[0] is serverClient) */
- for (i = 1; i < currentMaxClients; i++)
- if (clients[i] != NullClient)
- liveClients++;
+ /* Count up running clients (clients[0] is serverClient) */
+ for (i = 1; i < currentMaxClients; i++)
+ if (clients[i] != NullClient)
+ liveClients++;
#if defined(XWIN_MULTIWINDOW)
- /* Count down server internal clients */
- if (pScreenPriv->pScreenInfo->fMultiWindow)
- liveClients -= 2; /* multiwindow window manager & XMsgProc */
+ /* Count down server internal clients */
+ if (pScreenPriv->pScreenInfo->fMultiWindow)
+ liveClients -= 2; /* multiwindow window manager & XMsgProc */
#endif
#if defined(XWIN_CLIPBOARD)
- if (g_fClipboardStarted)
- liveClients--; /* clipboard manager */
+ if (g_fClipboardStarted)
+ liveClients--; /* clipboard manager */
#endif
- /* A user reported that this sometimes drops below zero. just eye-candy. */
- if (liveClients < 0)
- liveClients = 0;
+ /* A user reported that this sometimes drops below zero. just eye-candy. */
+ if (liveClients < 0)
+ liveClients = 0;
- /* Don't show the exit confirmation dialog if SilentExit & no clients,
- or ForceExit, is enabled */
+ /* Don't show the exit confirmation dialog if SilentExit & no clients,
+ or ForceExit, is enabled */
if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) {
if (g_hDlgExit != NULL) {
- DestroyWindow(g_hDlgExit);
- g_hDlgExit = NULL;
- }
- PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
- return;
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+ PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ return;
}
- pScreenPriv->iConnectedClients = liveClients;
-
- /* Check if dialog already exists */
+ pScreenPriv->iConnectedClients = liveClients;
+
+ /* Check if dialog already exists */
if (g_hDlgExit != NULL) {
- /* Dialog box already exists, display it */
- ShowWindow(g_hDlgExit, SW_SHOWDEFAULT);
+ /* Dialog box already exists, display it */
+ ShowWindow (g_hDlgExit, SW_SHOWDEFAULT);
- /* User has lost the dialog. Show them where it is. */
- SetForegroundWindow(g_hDlgExit);
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow (g_hDlgExit);
- return;
+ return;
}
- /* Create dialog box */
- g_hDlgExit = CreateDialogParam(g_hInstance,
- "EXIT_DIALOG",
- pScreenPriv->hwndScreen,
+ /* Create dialog box */
+ g_hDlgExit = CreateDialogParam (g_hInstance,
+ "EXIT_DIALOG",
+ pScreenPriv->hwndScreen,
winExitDlgProc, (int) pScreenPriv);
- /* Show the dialog box */
- ShowWindow(g_hDlgExit, SW_SHOW);
-
- /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
- SetForegroundWindow(g_hDlgExit);
-
- /* Set focus to the Cancel button */
- PostMessage(g_hDlgExit, WM_NEXTDLGCTL,
- (WPARAM) GetDlgItem(g_hDlgExit, IDCANCEL), TRUE);
+ /* Show the dialog box */
+ ShowWindow (g_hDlgExit, SW_SHOW);
+
+ /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
+ SetForegroundWindow (g_hDlgExit);
+
+ /* Set focus to the Cancel button */
+ PostMessage (g_hDlgExit, WM_NEXTDLGCTL,
+ (WPARAM)GetDlgItem (g_hDlgExit, IDCANCEL), TRUE);
}
#define CONNECTED_CLIENTS_FORMAT "There %s currently %d client%s connected."
@@ -310,74 +310,74 @@ winDisplayExitDialog(winPrivScreenPtr pScreenPriv)
static wBOOL CALLBACK
winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
- /* Branch on message type */
+ /* Branch on message type */
switch (message) {
case WM_INITDIALOG:
- {
- char *pszConnectedClients;
-
- /* Store pointers to private structures for future use */
- s_pScreenPriv = (winPrivScreenPtr) lParam;
-
- winInitDialog(hDialog);
-
- /* Format the connected clients string */
- if (asprintf(&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
- (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
- s_pScreenPriv->iConnectedClients,
- (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
- return TRUE;
-
- /* Set the number of connected clients */
- SetWindowText(GetDlgItem(hDialog, IDC_CLIENTS_CONNECTED),
- pszConnectedClients);
- free(pszConnectedClients);
- }
- return TRUE;
+ {
+ char *pszConnectedClients;
+
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+
+ winInitDialog (hDialog);
+
+ /* Format the connected clients string */
+ if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
+ (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
+ s_pScreenPriv->iConnectedClients,
+ (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
+ return TRUE;
+
+ /* Set the number of connected clients */
+ SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED),
+ pszConnectedClients);
+ free(pszConnectedClients);
+ }
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
- case IDOK:
- /* Send message to call the GiveUp function */
- PostMessage(s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
- DestroyWindow(g_hDlgExit);
- g_hDlgExit = NULL;
-
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
-
- case IDCANCEL:
- DestroyWindow(g_hDlgExit);
- g_hDlgExit = NULL;
-
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
- }
- break;
+ case IDOK:
+ /* Send message to call the GiveUp function */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+
+ case IDCANCEL:
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+ }
+ break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
- /* Show the cursor if it is hidden */
+ /* Show the cursor if it is hidden */
if (g_fSoftwareCursor && !g_fCursor) {
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
- return TRUE;
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return TRUE;
case WM_CLOSE:
- DestroyWindow(g_hDlgExit);
- g_hDlgExit = NULL;
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
/*
@@ -385,39 +385,39 @@ winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam)
*/
void
-winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv)
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
{
- /* Check if dialog already exists */
+ /* Check if dialog already exists */
if (g_hDlgDepthChange != NULL) {
- /* Dialog box already exists, display it */
- ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT);
+ /* Dialog box already exists, display it */
+ ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT);
- /* User has lost the dialog. Show them where it is. */
- SetForegroundWindow(g_hDlgDepthChange);
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow (g_hDlgDepthChange);
- return;
+ return;
}
- /*
- * Display a notification to the user that the visual
- * will not be displayed until the Windows display depth
- * is restored to the original value.
- */
- g_hDlgDepthChange = CreateDialogParam(g_hInstance,
- "DEPTH_CHANGE_BOX",
- pScreenPriv->hwndScreen,
- winChangeDepthDlgProc,
- (int) pScreenPriv);
- /* Show the dialog box */
- ShowWindow(g_hDlgDepthChange, SW_SHOW);
-
- ErrorF("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
- (int) g_hDlgDepthChange);
- ErrorF("winDisplayDepthChangeDialog - GetLastError: %d\n",
- (int) GetLastError());
-
- /* Minimize the display window */
- ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
+ /*
+ * Display a notification to the user that the visual
+ * will not be displayed until the Windows display depth
+ * is restored to the original value.
+ */
+ g_hDlgDepthChange = CreateDialogParam (g_hInstance,
+ "DEPTH_CHANGE_BOX",
+ pScreenPriv->hwndScreen,
+ winChangeDepthDlgProc,
+ (int) pScreenPriv);
+ /* Show the dialog box */
+ ShowWindow (g_hDlgDepthChange, SW_SHOW);
+
+ ErrorF ("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
+ (int) g_hDlgDepthChange);
+ ErrorF ("winDisplayDepthChangeDialog - GetLastError: %d\n",
+ (int) GetLastError ());
+
+ /* Minimize the display window */
+ ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
}
/*
@@ -426,95 +426,95 @@ winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv)
*/
static wBOOL CALLBACK
-winChangeDepthDlgProc(HWND hwndDialog, UINT message,
- WPARAM wParam, LPARAM lParam)
+winChangeDepthDlgProc (HWND hwndDialog, UINT message,
+ WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
- static winScreenInfo *s_pScreenInfo = NULL;
- static ScreenPtr s_pScreen = NULL;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc\n");
+ winDebug ("winChangeDepthDlgProc\n");
#endif
- /* Branch on message type */
+ /* Branch on message type */
switch (message) {
case WM_INITDIALOG:
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc - WM_INITDIALOG\n");
+ winDebug ("winChangeDepthDlgProc - WM_INITDIALOG\n");
#endif
- /* Store pointers to private structures for future use */
- s_pScreenPriv = (winPrivScreenPtr) lParam;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
- "s_pScreenInfo: %08x, s_pScreen: %08x\n",
- s_pScreenPriv, s_pScreenInfo, s_pScreen);
+ winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
+ "s_pScreenInfo: %08x, s_pScreen: %08x\n",
+ s_pScreenPriv, s_pScreenInfo, s_pScreen);
#endif
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
- "current bpp: %d\n",
- s_pScreenInfo->dwBPP,
- GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
+ winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
+ "current bpp: %d\n",
+ s_pScreenInfo->dwBPP,
+ GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
#endif
- winInitDialog(hwndDialog);
+ winInitDialog( hwndDialog );
- return TRUE;
+ return TRUE;
case WM_DISPLAYCHANGE:
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
- "new bpp: %d\n",
- s_pScreenInfo->dwBPP,
- GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
+ winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
+ "new bpp: %d\n",
+ s_pScreenInfo->dwBPP,
+ GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
#endif
- /* Dismiss the dialog if the display returns to the original depth */
+ /* Dismiss the dialog if the display returns to the original depth */
if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) ==
s_pScreenInfo->dwBPP) {
- ErrorF("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
+ ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
- /* Depth has been restored, dismiss dialog */
- DestroyWindow(g_hDlgDepthChange);
- g_hDlgDepthChange = NULL;
+ /* Depth has been restored, dismiss dialog */
+ DestroyWindow (g_hDlgDepthChange);
+ g_hDlgDepthChange = NULL;
- /* Flag that we have a valid screen depth */
- s_pScreenPriv->fBadDepth = FALSE;
- }
- return TRUE;
+ /* Flag that we have a valid screen depth */
+ s_pScreenPriv->fBadDepth = FALSE;
+ }
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
- case IDOK:
- case IDCANCEL:
- ErrorF("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
-
- /*
- * User dismissed the dialog, hide it until the
- * display mode is restored.
- */
- ShowWindow(g_hDlgDepthChange, SW_HIDE);
- return TRUE;
- }
- break;
+ case IDOK:
+ case IDCANCEL:
+ winDebug ("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+
+ /*
+ * User dismissed the dialog, hide it until the
+ * display mode is restored.
+ */
+ ShowWindow (g_hDlgDepthChange, SW_HIDE);
+ return TRUE;
+ }
+ break;
case WM_CLOSE:
- ErrorF("winChangeDepthDlgProc - WM_CLOSE\n");
+ winDebug ("winChangeDepthDlgProc - WM_CLOSE\n");
- DestroyWindow(g_hDlgAbout);
- g_hDlgAbout = NULL;
+ DestroyWindow (g_hDlgAbout);
+ g_hDlgAbout = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
/*
@@ -522,36 +522,36 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
*/
void
-winDisplayAboutDialog(winPrivScreenPtr pScreenPriv)
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv)
{
- /* Check if dialog already exists */
+ /* Check if dialog already exists */
if (g_hDlgAbout != NULL) {
- /* Dialog box already exists, display it */
- ShowWindow(g_hDlgAbout, SW_SHOWDEFAULT);
+ /* Dialog box already exists, display it */
+ ShowWindow (g_hDlgAbout, SW_SHOWDEFAULT);
- /* User has lost the dialog. Show them where it is. */
- SetForegroundWindow(g_hDlgAbout);
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow (g_hDlgAbout);
- return;
+ return;
}
- /*
- * Display the about box
- */
- g_hDlgAbout = CreateDialogParam(g_hInstance,
- "ABOUT_BOX",
- pScreenPriv->hwndScreen,
+ /*
+ * Display the about box
+ */
+ g_hDlgAbout = CreateDialogParam (g_hInstance,
+ "ABOUT_BOX",
+ pScreenPriv->hwndScreen,
winAboutDlgProc, (int) pScreenPriv);
-
- /* Show the dialog box */
- ShowWindow(g_hDlgAbout, SW_SHOW);
-
- /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
- SetForegroundWindow(g_hDlgAbout);
-
- /* Set focus to the OK button */
- PostMessage(g_hDlgAbout, WM_NEXTDLGCTL,
- (WPARAM) GetDlgItem(g_hDlgAbout, IDOK), TRUE);
+
+ /* Show the dialog box */
+ ShowWindow (g_hDlgAbout, SW_SHOW);
+
+ /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
+ SetForegroundWindow (g_hDlgAbout);
+
+ /* Set focus to the OK button */
+ PostMessage (g_hDlgAbout, WM_NEXTDLGCTL,
+ (WPARAM)GetDlgItem (g_hDlgAbout, IDOK), TRUE);
}
/*
@@ -561,160 +561,160 @@ winDisplayAboutDialog(winPrivScreenPtr pScreenPriv)
static wBOOL CALLBACK
winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
- static winScreenInfo *s_pScreenInfo = NULL;
- static ScreenPtr s_pScreen = NULL;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
#if CYGDEBUG
- winDebug("winAboutDlgProc\n");
+ winDebug ("winAboutDlgProc\n");
#endif
- /* Branch on message type */
+ /* Branch on message type */
switch (message) {
case WM_INITDIALOG:
#if CYGDEBUG
- winDebug("winAboutDlgProc - WM_INITDIALOG\n");
+ winDebug ("winAboutDlgProc - WM_INITDIALOG\n");
#endif
- /* Store pointers to private structures for future use */
- s_pScreenPriv = (winPrivScreenPtr) lParam;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
- winInitDialog(hwndDialog);
+ winInitDialog (hwndDialog);
- /* Override the URL buttons */
- winOverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
- winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
- winOverrideURLButton(hwndDialog, ID_ABOUT_UG);
- winOverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
+ /* Override the URL buttons */
+ winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
+ winOverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
+ winOverrideURLButton (hwndDialog, ID_ABOUT_UG);
+ winOverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
- return TRUE;
+ return TRUE;
case WM_DRAWITEM:
- /* Draw the URL buttons as needed */
- winDrawURLWindow(lParam);
- return TRUE;
+ /* Draw the URL buttons as needed */
+ winDrawURLWindow (lParam);
+ return TRUE;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
- /* Show the cursor if it is hidden */
+ /* Show the cursor if it is hidden */
if (g_fSoftwareCursor && !g_fCursor) {
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
- return TRUE;
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
- case IDOK:
- case IDCANCEL:
- ErrorF("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+ case IDOK:
+ case IDCANCEL:
+ winDebug ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
- DestroyWindow(g_hDlgAbout);
- g_hDlgAbout = NULL;
+ DestroyWindow (g_hDlgAbout);
+ g_hDlgAbout = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- /* Restore window procedures for URL buttons */
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG);
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
+ /* Restore window procedures for URL buttons */
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
- return TRUE;
+ return TRUE;
- case ID_ABOUT_CHANGELOG:
- {
- int iReturn;
+ case ID_ABOUT_CHANGELOG:
+ {
+ int iReturn;
#ifdef __CYGWIN__
- const char *pszCygPath = "/usr/X11R6/share/doc/"
- "xorg-x11-xwin/changelog.html";
- char pszWinPath[MAX_PATH + 1];
+ const char * pszCygPath = "/usr/X11R6/share/doc/"
+ "xorg-x11-xwin/changelog.html";
+ char pszWinPath[MAX_PATH + 1];
- /* Convert the POSIX path to a Win32 path */
- cygwin_conv_to_win32_path(pszCygPath, pszWinPath);
+ /* Convert the POSIX path to a Win32 path */
+ cygwin_conv_to_win32_path (pszCygPath, pszWinPath);
#else
- const char *pszWinPath = "http://x.cygwin.com/"
- "devel/server/changelog.html";
+ const char * pszWinPath = "http://x.cygwin.com/"
+ "devel/server/changelog.html";
#endif
-
- iReturn = (int) ShellExecute(NULL,
- "open",
+
+ iReturn = (int)ShellExecute (NULL,
+ "open",
pszWinPath, NULL, NULL, SW_MAXIMIZE);
if (iReturn < 32) {
- ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
"ShellExecute failed: %d\n", iReturn);
- }
- }
- return TRUE;
-
- case ID_ABOUT_WEBSITE:
- {
- const char *pszPath = __VENDORDWEBSUPPORT__;
- int iReturn;
-
- iReturn = (int) ShellExecute(NULL,
- "open",
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_WEBSITE:
+ {
+ const char * pszPath = __VENDORDWEBSUPPORT__;
+ int iReturn;
+
+ iReturn = (int)ShellExecute (NULL,
+ "open",
pszPath, NULL, NULL, SW_MAXIMIZE);
if (iReturn < 32) {
- ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
"ShellExecute failed: %d\n", iReturn);
- }
- }
- return TRUE;
-
- case ID_ABOUT_UG:
- {
- const char *pszPath = "http://x.cygwin.com/docs/ug/";
- int iReturn;
-
- iReturn = (int) ShellExecute(NULL,
- "open",
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_UG:
+ {
+ const char * pszPath = "http://x.cygwin.com/docs/ug/";
+ int iReturn;
+
+ iReturn = (int)ShellExecute (NULL,
+ "open",
pszPath, NULL, NULL, SW_MAXIMIZE);
if (iReturn < 32) {
- ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
"ShellExecute failed: %d\n", iReturn);
- }
- }
- return TRUE;
-
- case ID_ABOUT_FAQ:
- {
- const char *pszPath = "http://x.cygwin.com/docs/faq/";
- int iReturn;
-
- iReturn = (int) ShellExecute(NULL,
- "open",
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_FAQ:
+ {
+ const char * pszPath = "http://x.cygwin.com/docs/faq/";
+ int iReturn;
+
+ iReturn = (int)ShellExecute (NULL,
+ "open",
pszPath, NULL, NULL, SW_MAXIMIZE);
if (iReturn < 32) {
- ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
"ShellExecute failed: %d\n", iReturn);
- }
- }
- return TRUE;
- }
- break;
+ }
+ }
+ return TRUE;
+ }
+ break;
case WM_CLOSE:
- ErrorF("winAboutDlgProc - WM_CLOSE\n");
+ winDebug ("winAboutDlgProc - WM_CLOSE\n");
- DestroyWindow(g_hDlgAbout);
- g_hDlgAbout = NULL;
+ DestroyWindow (g_hDlgAbout);
+ g_hDlgAbout = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- /* Restore window procedures for URL buttons */
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG);
- winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
+ /* Restore window procedures for URL buttons */
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
- return TRUE;
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
diff --git a/hw/xwin/windisplay.c b/hw/xwin/windisplay.c
new file mode 100644
index 000000000..10ac8f220
--- /dev/null
+++ b/hw/xwin/windisplay.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) Jon TURNEY 2009
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <opaque.h> // for display
+#include "win.h"
+
+/*
+ Generate a display name string referring to the display of this server,
+ using a transport we know is enabled
+*/
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen)
+{
+ if (TransIsListening("local"))
+ {
+ snprintf(szDisplay, 512, ":%s.%d", display, screen);
+ }
+ else if (TransIsListening("inet"))
+ {
+ snprintf(szDisplay, 512, "127.0.0.1:%s.%d", display, screen);
+ }
+ else if (TransIsListening("inet6"))
+ {
+ snprintf(szDisplay, 512, "::1:%s.%d", display, screen);
+ }
+ else
+ {
+ // this can't happen!
+ ErrorF ("winGetDisplay: Don't know what to use for DISPLAY\n");
+ snprintf(szDisplay, 512, "localhost:%s.%d", display, screen);
+ }
+
+ winDebug("winGetDisplay: DISPLAY=%s\n", szDisplay);
+}
diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c
index 67489598b..e2276498c 100644
--- a/hw/xwin/winengine.c
+++ b/hw/xwin/winengine.c
@@ -38,8 +38,8 @@
* Global variables for function pointers into
* dynamically loaded libraries
*/
-FARPROC g_fpDirectDrawCreate = NULL;
-FARPROC g_fpDirectDrawCreateClipper = NULL;
+FARPROC g_fpDirectDrawCreate = NULL;
+FARPROC g_fpDirectDrawCreateClipper = NULL;
/*
module handle for dynamically loaded directdraw library
@@ -52,80 +52,77 @@ static HMODULE g_hmodDirectDraw = NULL;
*/
void
-winDetectSupportedEngines(void)
+winDetectSupportedEngines (void)
{
- OSVERSIONINFO osvi;
+ OSVERSIONINFO osvi;
- /* Initialize the engine support flags */
- g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
+ /* Initialize the engine support flags */
+ g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
#ifdef XWIN_NATIVEGDI
- g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
+ g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
#endif
- /* Get operating system version information */
- ZeroMemory(&osvi, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
+ /* Get operating system version information */
+ ZeroMemory (&osvi, sizeof (osvi));
+ osvi.dwOSVersionInfoSize = sizeof (osvi);
+ GetVersionEx (&osvi);
- /* Do we have DirectDraw? */
+ /* Do we have DirectDraw? */
if (g_hmodDirectDraw != NULL) {
- LPDIRECTDRAW lpdd = NULL;
- LPDIRECTDRAW4 lpdd4 = NULL;
- HRESULT ddrval;
+ LPDIRECTDRAW lpdd = NULL;
+ LPDIRECTDRAW4 lpdd4 = NULL;
+ HRESULT ddrval;
- /* Was the DirectDrawCreate function found? */
+ /* Was the DirectDrawCreate function found? */
if (g_fpDirectDrawCreate == NULL) {
- /* No DirectDraw support */
- return;
- }
+ /* No DirectDraw support */
+ return;
+ }
- /* DirectDrawCreate exists, try to call it */
- /* Create a DirectDraw object, store the address at lpdd */
+ /* DirectDrawCreate exists, try to call it */
+ /* Create a DirectDraw object, store the address at lpdd */
ddrval = (*g_fpDirectDrawCreate) (NULL, (void **) &lpdd, NULL);
if (FAILED(ddrval)) {
- /* No DirectDraw support */
+ /* No DirectDraw support */
winErrorFVerb(2,
"winDetectSupportedEngines - DirectDraw not installed\n");
- return;
- }
+ return;
+ }
else {
- /* We have DirectDraw */
- winErrorFVerb(2,
- "winDetectSupportedEngines - DirectDraw installed\n");
- g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
+ /* We have DirectDraw */
+ winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n");
+ g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
#ifdef XWIN_PRIMARYFB
- /* Allow PrimaryDD engine if NT */
+ /* Allow PrimaryDD engine if NT */
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
- winErrorFVerb(2,
- "winDetectSupportedEngines - Allowing PrimaryDD\n");
- }
+ g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
+ winErrorFVerb (2, "winDetectSupportedEngines - Windows NT, allowing PrimaryDD\n");
+ }
#endif
- }
+ }
- /* Try to query for DirectDraw4 interface */
- ddrval = IDirectDraw_QueryInterface(lpdd,
- &IID_IDirectDraw4,
- (LPVOID *) & lpdd4);
+ /* Try to query for DirectDraw4 interface */
+ ddrval = IDirectDraw_QueryInterface (lpdd,
+ &IID_IDirectDraw4,
+ (LPVOID*) &lpdd4);
if (SUCCEEDED(ddrval)) {
- /* We have DirectDraw4 */
- winErrorFVerb(2,
- "winDetectSupportedEngines - DirectDraw4 installed\n");
- g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
- }
-
- /* Cleanup DirectDraw interfaces */
- if (lpdd4 != NULL)
- IDirectDraw_Release(lpdd4);
- if (lpdd != NULL)
- IDirectDraw_Release(lpdd);
+ /* We have DirectDraw4 */
+ winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL\n");
+ g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
+ }
+
+ /* Cleanup DirectDraw interfaces */
+ if (lpdd4 != NULL)
+ IDirectDraw_Release (lpdd4);
+ if (lpdd != NULL)
+ IDirectDraw_Release (lpdd);
}
winErrorFVerb(2,
"winDetectSupportedEngines - Returning, supported engines %08x\n",
- (unsigned int) g_dwEnginesSupported);
+ (unsigned int) g_dwEnginesSupported);
}
/*
@@ -135,124 +132,124 @@ winDetectSupportedEngines(void)
*/
Bool
-winSetEngine(ScreenPtr pScreen)
+winSetEngine (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc;
- DWORD dwBPP;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc;
+ DWORD dwBPP;
- /* Get a DC */
- hdc = GetDC(NULL);
+ /* Get a DC */
+ hdc = GetDC (NULL);
if (hdc == NULL) {
- ErrorF("winSetEngine - Couldn't get an HDC\n");
- return FALSE;
+ ErrorF ("winSetEngine - Couldn't get an HDC\n");
+ return FALSE;
}
- /*
- * pScreenInfo->dwBPP may be 0 to indicate that the current screen
- * depth is to be used. Thus, we must query for the current display
- * depth here.
- */
- dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
+ /*
+ * pScreenInfo->dwBPP may be 0 to indicate that the current screen
+ * depth is to be used. Thus, we must query for the current display
+ * depth here.
+ */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
- /* Release the DC */
- ReleaseDC(NULL, hdc);
- hdc = NULL;
+ /* Release the DC */
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
- /* ShadowGDI is the only engine that supports windowed PseudoColor */
+ /* ShadowGDI is the only engine that supports windowed PseudoColor */
if (dwBPP == 8 && !pScreenInfo->fFullScreen) {
winErrorFVerb(2,
"winSetEngine - Windowed && PseudoColor => ShadowGDI\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowGDI(pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI (pScreen);
+ return TRUE;
}
- /* ShadowGDI is the only engine that supports Multi Window Mode */
+ /* ShadowGDI is the only engine that supports Multi Window Mode */
if (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
) {
winErrorFVerb(2,
"winSetEngine - Multi Window or Rootless => ShadowGDI\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowGDI(pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI (pScreen);
+ return TRUE;
}
- /* If the user's choice is supported, we'll use that */
+ /* If the user's choice is supported, we'll use that */
if (g_dwEnginesSupported & pScreenInfo->dwEnginePreferred) {
- winErrorFVerb(2, "winSetEngine - Using user's preference: %d\n",
- (int) pScreenInfo->dwEnginePreferred);
- pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred;
+ winErrorFVerb (2, "winSetEngine - Using user's preference: %d\n",
+ (int) pScreenInfo->dwEnginePreferred);
+ pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred;
- /* Setup engine function pointers */
+ /* Setup engine function pointers */
switch (pScreenInfo->dwEngine) {
- case WIN_SERVER_SHADOW_GDI:
- winSetEngineFunctionsShadowGDI(pScreen);
- break;
- case WIN_SERVER_SHADOW_DD:
- winSetEngineFunctionsShadowDD(pScreen);
- break;
- case WIN_SERVER_SHADOW_DDNL:
- winSetEngineFunctionsShadowDDNL(pScreen);
- break;
+ case WIN_SERVER_SHADOW_GDI:
+ winSetEngineFunctionsShadowGDI (pScreen);
+ break;
+ case WIN_SERVER_SHADOW_DD:
+ winSetEngineFunctionsShadowDD (pScreen);
+ break;
+ case WIN_SERVER_SHADOW_DDNL:
+ winSetEngineFunctionsShadowDDNL (pScreen);
+ break;
#ifdef XWIN_PRIMARYFB
- case WIN_SERVER_PRIMARY_DD:
- winSetEngineFunctionsPrimaryDD(pScreen);
- break;
+ case WIN_SERVER_PRIMARY_DD:
+ winSetEngineFunctionsPrimaryDD (pScreen);
+ break;
#endif
#ifdef XWIN_NATIVEGDI
- case WIN_SERVER_NATIVE_GDI:
- winSetEngineFunctionsNativeGDI(pScreen);
- break;
+ case WIN_SERVER_NATIVE_GDI:
+ winSetEngineFunctionsNativeGDI (pScreen);
+ break;
#endif
- default:
- FatalError("winSetEngine - Invalid engine type\n");
- }
- return TRUE;
+ default:
+ FatalError ("winSetEngine - Invalid engine type\n");
+ }
+ return TRUE;
}
- /* ShadowDDNL has good performance, so why not */
+ /* ShadowDDNL has good performance, so why not */
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) {
- winErrorFVerb(2, "winSetEngine - Using Shadow DirectDraw NonLocking\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL;
+ winErrorFVerb (2, "winSetEngine - Using Shadow DirectDraw NonLocking\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowDDNL(pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowDDNL (pScreen);
+ return TRUE;
}
- /* ShadowDD is next in line */
+ /* ShadowDD is next in line */
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD) {
- winErrorFVerb(2, "winSetEngine - Using Shadow DirectDraw\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
+ winErrorFVerb (2, "winSetEngine - Using Shadow DirectDraw\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowDD(pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowDD (pScreen);
+ return TRUE;
}
- /* ShadowGDI is next in line */
+ /* ShadowGDI is next in line */
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI) {
- winErrorFVerb(2, "winSetEngine - Using Shadow GDI DIB\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+ winErrorFVerb (2, "winSetEngine - Using Shadow GDI DIB\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowGDI(pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI (pScreen);
+ return TRUE;
}
- return TRUE;
+ return TRUE;
}
/*
@@ -260,58 +257,58 @@ winSetEngine(ScreenPtr pScreen)
*/
Bool
-winGetDDProcAddresses(void)
+winGetDDProcAddresses (void)
{
- Bool fReturn = TRUE;
-
- /* Load the DirectDraw library */
- g_hmodDirectDraw = LoadLibraryEx("ddraw.dll", NULL, 0);
+ Bool fReturn = TRUE;
+
+ /* Load the DirectDraw library */
+ g_hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0);
if (g_hmodDirectDraw == NULL) {
- ErrorF("winGetDDProcAddresses - Could not load ddraw.dll\n");
- fReturn = TRUE;
- goto winGetDDProcAddresses_Exit;
+ ErrorF ("winGetDDProcAddresses - Could not load ddraw.dll\n");
+ fReturn = TRUE;
+ goto winGetDDProcAddresses_Exit;
}
- /* Try to get the DirectDrawCreate address */
+ /* Try to get the DirectDrawCreate address */
g_fpDirectDrawCreate = GetProcAddress(g_hmodDirectDraw, "DirectDrawCreate");
if (g_fpDirectDrawCreate == NULL) {
- ErrorF("winGetDDProcAddresses - Could not get DirectDrawCreate "
- "address\n");
- fReturn = TRUE;
- goto winGetDDProcAddresses_Exit;
+ ErrorF ("winGetDDProcAddresses - Could not get DirectDrawCreate "
+ "address\n");
+ fReturn = TRUE;
+ goto winGetDDProcAddresses_Exit;
}
- /* Try to get the DirectDrawCreateClipper address */
- g_fpDirectDrawCreateClipper = GetProcAddress(g_hmodDirectDraw,
- "DirectDrawCreateClipper");
+ /* Try to get the DirectDrawCreateClipper address */
+ g_fpDirectDrawCreateClipper = GetProcAddress (g_hmodDirectDraw,
+ "DirectDrawCreateClipper");
if (g_fpDirectDrawCreateClipper == NULL) {
- ErrorF("winGetDDProcAddresses - Could not get "
- "DirectDrawCreateClipper address\n");
- fReturn = FALSE;
- goto winGetDDProcAddresses_Exit;
+ ErrorF ("winGetDDProcAddresses - Could not get "
+ "DirectDrawCreateClipper address\n");
+ fReturn = FALSE;
+ goto winGetDDProcAddresses_Exit;
}
- /*
- * Note: Do not unload ddraw.dll here. Do it in GiveUp
- */
+ /*
+ * Note: Do not unload ddraw.dll here. Do it in GiveUp
+ */
winGetDDProcAddresses_Exit:
- /* Unload the DirectDraw library if we failed to initialize */
+ /* Unload the DirectDraw library if we failed to initialize */
if (!fReturn && g_hmodDirectDraw != NULL) {
- FreeLibrary(g_hmodDirectDraw);
- g_hmodDirectDraw = NULL;
+ FreeLibrary (g_hmodDirectDraw);
+ g_hmodDirectDraw = NULL;
}
-
- return fReturn;
+
+ return fReturn;
}
void
winReleaseDDProcAddresses(void)
{
if (g_hmodDirectDraw != NULL) {
- FreeLibrary(g_hmodDirectDraw);
- g_hmodDirectDraw = NULL;
- g_fpDirectDrawCreate = NULL;
- g_fpDirectDrawCreateClipper = NULL;
+ FreeLibrary (g_hmodDirectDraw);
+ g_hmodDirectDraw = NULL;
+ g_fpDirectDrawCreate = NULL;
+ g_fpDirectDrawCreateClipper = NULL;
}
}
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 4049e9735..1da558a1a 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -35,56 +35,104 @@
#include <../xfree86/common/xorgVersion.h>
#include "win.h"
+/* Last error reported */
+static char lastError[1024] = "";
+
#ifdef DDXOSVERRORF
/* Prototype */
void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
+OsVendorVErrorF (const char *pszFormat, va_list va_args);
void
-OsVendorVErrorF(const char *pszFormat, va_list va_args)
+OsVendorVErrorF (const char *pszFormat, va_list va_args)
{
#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW)
- /* make sure the clipboard and multiwindow threads do not interfere the
- * main thread */
- static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER;
+ /* make sure the clipboard and multiwindow threads do not interfere the
+ * main thread */
+ static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER;
- /* Lock the printing mutex */
- pthread_mutex_lock(&s_pmPrinting);
+ /* Lock the printing mutex */
+ pthread_mutex_lock (&s_pmPrinting);
#endif
- /* Print the error message to a log file, could be stderr */
- LogVWrite(0, pszFormat, va_args);
+ /* If we want to silence it,
+ * detect if we are going to abort due to duplication error */
+ if (g_fSilentDupError)
+ {
+ if ((strcmp(pszFormat,
+ "InitOutput - Duplicate invocation on display "
+ "number: %s. Exiting.\n") == 0)
+ || (strcmp(pszFormat,
+ "Server is already active for display %s\n%s %s\n%s\n") == 0)
+ || (strcmp(pszFormat,
+ "MakeAllCOTSServerListeners: server already running\n") == 0))
+ {
+ g_fSilentFatalError = TRUE;
+ }
+ }
+
+ /* Record the error, in case it's a fatal one... */
+ if ((strcmp(pszFormat,"\n") != 0) &&
+ (strcmp(pszFormat,"Server terminated %s (%d). Closing log file.\n") != 0))
+ {
+ va_list va_args_copy;
+ va_copy(va_args_copy, va_args);
+ vsnprintf(lastError, sizeof(lastError), pszFormat, va_args_copy);
+ va_end(va_args_copy);
+ }
+
+ /* Print the error message to a log file, could be stderr */
+ LogVWrite (0, pszFormat, va_args);
#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW)
- /* Unlock the printing mutex */
- pthread_mutex_unlock(&s_pmPrinting);
+ /* Unlock the printing mutex */
+ pthread_mutex_unlock (&s_pmPrinting);
#endif
}
#endif
/*
- * os/util.c/FatalError () calls our vendor ErrorF, so the message
- * from a FatalError will be logged. Thus, the message for the
- * fatal error is not passed to this function.
+ * os/log.c:FatalError () calls our vendor ErrorF, so the message
+ * from a FatalError will be logged.
+ *
+ * But the message for the fatal error is not passed to this
+ * function, so we stash the log string in lastError so we can
+ * also report it here
*
* Attempt to do last-ditch, safe, important cleanup here.
*/
void
-OsVendorFatalError(void)
+OsVendorFatalError (void)
{
- /* Don't give duplicate warning if UseMsg was called */
- if (g_fSilentFatalError)
- return;
-
- if (!g_fLogInited) {
- g_fLogInited = TRUE;
- g_pszLogFile = LogInit(g_pszLogFile, NULL);
- }
- LogClose(EXIT_ERR_ABORT);
-
- winMessageBoxF("A fatal error has occurred and " PROJECT_NAME
- " will now exit.\n" "Please open %s for more information.\n",
- MB_ICONERROR, (g_pszLogFile ? g_pszLogFile : "the logfile"));
+ /* Don't give duplicate warning if UseMsg was called */
+ if (g_fSilentFatalError)
+ return;
+
+ if (!g_fLogInited) {
+ g_fLogInited = TRUE;
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
+ }
+ LogClose (EXIT_ERR_ABORT);
+
+ /*
+ Sometimes the error message we capture in lastError
+ needs some cosmetic cleaning up for use in a dialog box...
+ */
+ {
+ char *s;
+ while ((s = strstr(lastError, "\n\t")) != NULL)
+ {
+ s[0] = ' ';
+ s[1] = '\n';
+ }
+ }
+
+ winMessageBoxF("A fatal error has occurred and " PROJECT_NAME " will now exit.\n\n" \
+ "%s\n\n" \
+ "Please open %s for more information.\n",
+ MB_ICONERROR,
+ lastError,
+ (g_pszLogFile ? g_pszLogFile : "the logfile"));
}
/*
@@ -93,46 +141,48 @@ OsVendorFatalError(void)
*/
void
-winMessageBoxF(const char *pszError, UINT uType, ...)
+winMessageBoxF (const char *pszError, UINT uType, ...)
{
- char *pszErrorF = NULL;
- char *pszMsgBox = NULL;
- va_list args;
- int size;
-
- va_start(args, uType);
- size = vasprintf(&pszErrorF, pszError, args);
- va_end(args);
- if (size == -1) {
- pszErrorF = NULL;
- goto winMessageBoxF_Cleanup;
- }
+ char * pszErrorF = NULL;
+ char * pszMsgBox = NULL;
+ va_list args;
+ int size;
+
+ va_start(args, uType);
+ size = vasprintf (&pszErrorF, pszError, args);
+ va_end(args);
+ if (size == -1) {
+ pszErrorF = NULL;
+ goto winMessageBoxF_Cleanup;
+ }
#define MESSAGEBOXF \
"%s\n" \
"Vendor: %s\n" \
- "Release: %d.%d.%d.%d (%d)\n" \
+ "Release: %d.%d.%d.%d\n" \
"Contact: %s\n" \
"%s\n\n" \
"XWin was started with the following command-line:\n\n" \
"%s\n"
- size = asprintf(&pszMsgBox, MESSAGEBOXF,
- pszErrorF, XVENDORNAME,
- XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
- XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
- BUILDERADDR, BUILDERSTRING, g_pszCommandLine);
+ size = asprintf (&pszMsgBox, MESSAGEBOXF,
+ pszErrorF, XVENDORNAME,
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
+ XORG_VERSION_SNAP,
+ BUILDERADDR,
+ BUILDERSTRING,
+ g_pszCommandLine);
- if (size == -1) {
- pszMsgBox = NULL;
- goto winMessageBoxF_Cleanup;
- }
+ if (size == -1) {
+ pszMsgBox = NULL;
+ goto winMessageBoxF_Cleanup;
+ }
- /* Display the message box string */
+ /* Display the message box string */
MessageBox(NULL, pszMsgBox, PROJECT_NAME, MB_OK | uType);
winMessageBoxF_Cleanup:
- free(pszErrorF);
- free(pszMsgBox);
+ free(pszErrorF);
+ free(pszMsgBox);
#undef MESSAGEBOXF
}
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 4953bd0cf..c9a934009 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -39,67 +39,69 @@
* General global variables
*/
-int g_iNumScreens = 0;
-winScreenInfo *g_ScreenInfo = 0;
+int g_iNumScreens = 0;
+winScreenInfo * g_ScreenInfo = 0;
#ifdef HAS_DEVWINDOWS
-int g_fdMessageQueue = WIN_FD_INVALID;
+int g_fdMessageQueue = WIN_FD_INVALID;
#endif
DevPrivateKeyRec g_iScreenPrivateKeyRec;
DevPrivateKeyRec g_iCmapPrivateKeyRec;
DevPrivateKeyRec g_iGCPrivateKeyRec;
DevPrivateKeyRec g_iPixmapPrivateKeyRec;
DevPrivateKeyRec g_iWindowPrivateKeyRec;
-unsigned long g_ulServerGeneration = 0;
-DWORD g_dwEnginesSupported = 0;
-HINSTANCE g_hInstance = 0;
-HWND g_hDlgDepthChange = NULL;
-HWND g_hDlgExit = NULL;
-HWND g_hDlgAbout = NULL;
-const char *g_pszQueryHost = NULL;
-Bool g_fXdmcpEnabled = FALSE;
-Bool g_fAuthEnabled = FALSE;
-HICON g_hIconX = NULL;
-HICON g_hSmallIconX = NULL;
+unsigned long g_ulServerGeneration = 0;
+DWORD g_dwEnginesSupported = 0;
+HINSTANCE g_hInstance = 0;
+HWND g_hDlgDepthChange = NULL;
+HWND g_hDlgExit = NULL;
+HWND g_hDlgAbout = NULL;
+const char * g_pszQueryHost = NULL;
+Bool g_fXdmcpEnabled = FALSE;
+Bool g_fAuthEnabled = FALSE;
+HICON g_hIconX = NULL;
+HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
-const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
+const char * g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
#else
-const char *g_pszLogFile = "XWin.log";
-Bool g_fLogFileChanged = FALSE;
+const char * g_pszLogFile = "XWin.log";
+Bool g_fLogFileChanged = FALSE;
#endif
-int g_iLogVerbose = 2;
-Bool g_fLogInited = FALSE;
-char *g_pszCommandLine = NULL;
-Bool g_fSilentFatalError = FALSE;
-DWORD g_dwCurrentThreadID = 0;
-Bool g_fKeyboardHookLL = FALSE;
-Bool g_fNoHelpMessageBox = FALSE;
-Bool g_fSoftwareCursor = FALSE;
-Bool g_fSilentDupError = FALSE;
-Bool g_fNativeGl = FALSE;
+int g_iLogVerbose = 2;
+Bool g_fLogInited = FALSE;
+char * g_pszCommandLine = NULL;
+Bool g_fSilentFatalError = FALSE;
+DWORD g_dwCurrentThreadID = 0;
+Bool g_fKeyboardHookLL = FALSE;
+Bool g_fNoHelpMessageBox = FALSE;
+Bool g_fSoftwareCursor = FALSE;
+Bool g_fSilentDupError = FALSE;
+Bool g_fNativeGl = TRUE;
+Bool g_fHostInTitle = FALSE;
+pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
#ifdef XWIN_CLIPBOARD
/*
* Wrapped DIX functions
*/
-winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
-winDispatchProcPtr winProcQueryTreeOrig = NULL;
-winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL;
+winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
+winDispatchProcPtr winProcQueryTreeOrig = NULL;
+winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL;
/*
* Clipboard variables
*/
-Bool g_fUnicodeClipboard = TRUE;
-Bool g_fClipboard = TRUE;
-Bool g_fClipboardLaunched = FALSE;
-Bool g_fClipboardStarted = FALSE;
-pthread_t g_ptClipboardProc;
-HWND g_hwndClipboard = NULL;
-void *g_pClipboardDisplay = NULL;
-Window g_iClipboardWindow = None;
-Atom g_atomLastOwnedSelection = None;
+Bool g_fUnicodeClipboard = TRUE;
+Bool g_fClipboard = TRUE;
+Bool g_fClipboardLaunched = FALSE;
+Bool g_fClipboardStarted = FALSE;
+pthread_t g_ptClipboardProc;
+HWND g_hwndClipboard = NULL;
+void *g_pClipboardDisplay = NULL;
+Window g_iClipboardWindow = None;
+Atom g_atomLastOwnedSelection = None;
#endif
/*
@@ -108,13 +110,13 @@ Atom g_atomLastOwnedSelection = None;
*/
void
-winInitializeGlobals(void)
+winInitializeGlobals (void)
{
- g_dwCurrentThreadID = GetCurrentThreadId();
+ g_dwCurrentThreadID = GetCurrentThreadId ();
#ifdef XWIN_CLIPBOARD
- g_iClipboardWindow = None;
- g_pClipboardDisplay = NULL;
- g_atomLastOwnedSelection = None;
- g_hwndClipboard = NULL;
+ g_iClipboardWindow = None;
+ g_pClipboardDisplay = NULL;
+ g_atomLastOwnedSelection = None;
+ g_hwndClipboard = NULL;
#endif
}
diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h
index 2edf9571e..501419bbd 100644
--- a/hw/xwin/winglobals.h
+++ b/hw/xwin/winglobals.h
@@ -30,31 +30,32 @@
* References to external symbols
*/
-extern int g_iNumScreens;
-extern int g_iLastScreen;
-extern char *g_pszCommandLine;
-extern Bool g_fSilentFatalError;
-extern const char *g_pszLogFile;
+extern int g_iNumScreens;
+extern int g_iLastScreen;
+extern char * g_pszCommandLine;
+extern Bool g_fSilentFatalError;
+extern const char * g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT
-extern Bool g_fLogFileChanged;
+extern Bool g_fLogFileChanged;
#endif
-extern int g_iLogVerbose;
-extern Bool g_fLogInited;
+extern int g_iLogVerbose;
+extern Bool g_fLogInited;
-extern Bool g_fAuthEnabled;
-extern Bool g_fXdmcpEnabled;
+extern Bool g_fAuthEnabled;
+extern Bool g_fXdmcpEnabled;
-extern Bool g_fNoHelpMessageBox;
-extern Bool g_fSilentDupError;
-extern Bool g_fNativeGl;
+extern Bool g_fNoHelpMessageBox;
+extern Bool g_fSilentDupError;
+extern Bool g_fNativeGl;
+extern Bool g_fHostInTitle;
-extern HWND g_hDlgDepthChange;
-extern HWND g_hDlgExit;
-extern HWND g_hDlgAbout;
+extern HWND g_hDlgDepthChange;
+extern HWND g_hDlgExit;
+extern HWND g_hDlgAbout;
-extern Bool g_fSoftwareCursor;
-extern Bool g_fCursor;
+extern Bool g_fSoftwareCursor;
+extern Bool g_fCursor;
#ifdef XWIN_CLIPBOARD
@@ -64,26 +65,28 @@ typedef int (*winDispatchProcPtr) (ClientPtr);
/*
* Wrapped DIX functions
*/
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
+extern winDispatchProcPtr winProcEstablishConnectionOrig;
+extern winDispatchProcPtr winProcQueryTreeOrig;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
#endif
/* The global X default icons */
#if defined(XWIN_MULTIWINDOW)
-extern HICON g_hIconX;
-extern HICON g_hSmallIconX;
+extern HICON g_hIconX;
+extern HICON g_hSmallIconX;
#endif
#ifdef XWIN_MULTIWINDOW
-extern DWORD g_dwCurrentThreadID;
+extern DWORD g_dwCurrentThreadID;
#endif
-extern Bool g_fKeyboardHookLL;
-extern Bool g_fButton[3];
+extern Bool g_fKeyboardHookLL;
+extern Bool g_fButton[3];
#ifdef XWIN_MULTIWINDOWEXTWM
-extern Bool g_fNoConfigureWindow;
+extern Bool g_fNoConfigureWindow;
#endif
-#endif /* WINGLOBALS_H */
+extern pthread_mutex_t g_pmTerminating;
+
+#endif /* WINGLOBALS_H */
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 2ffb9a943..908997c2d 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -40,6 +40,7 @@
#include "winmsg.h"
#include "xkbsrv.h"
+#include "dixgrabs.h"
static Bool g_winKeyState[NUM_KEYCODES];
@@ -51,7 +52,7 @@ static void
winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass);
static void
- winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl);
+winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
/*
* Translate a Windows WM_[SYS]KEY(UP/DOWN) message
@@ -63,14 +64,14 @@ static void
*/
void
-winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
{
- int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
- int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
- int iParam = HIWORD(lParam);
- int iParamScanCode = LOBYTE(iParam);
+ int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
+ int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
+ int iParam = HIWORD (lParam);
+ int iParamScanCode = LOBYTE (iParam);
- winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
+ winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
* scan code.
@@ -80,54 +81,54 @@ winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
* scan code of 1
*/
if (iParamScanCode <= 1) {
- if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
- /* Trigger special case table to translate to extended
- * keycode, otherwise if num_lock is on, we can get keypad
- * numbers instead of navigation keys. */
- iParam |= KF_EXTENDED;
- else
- iParamScanCode = MapVirtualKeyEx(wParam,
- /*MAPVK_VK_TO_VSC */ 0,
- GetKeyboardLayout(0));
+ if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
+ /* Trigger special case table to translate to extended
+ * keycode, otherwise if num_lock is on, we can get keypad
+ * numbers instead of navigation keys. */
+ iParam |= KF_EXTENDED;
+ else
+ iParamScanCode = MapVirtualKeyEx(wParam,
+ /*MAPVK_VK_TO_VSC*/0,
+ GetKeyboardLayout(0));
}
- /* Branch on special extended, special non-extended, or normal key */
- if ((iParam & KF_EXTENDED) && iKeyFixupEx)
- *piScanCode = iKeyFixupEx;
- else if (iKeyFixup)
- *piScanCode = iKeyFixup;
- else if (wParam == 0 && iParamScanCode == 0x70)
- *piScanCode = KEY_HKTG;
- else
+ /* Branch on special extended, special non-extended, or normal key */
+ if ((iParam & KF_EXTENDED) && iKeyFixupEx)
+ *piScanCode = iKeyFixupEx;
+ else if (iKeyFixup)
+ *piScanCode = iKeyFixup;
+ else if (wParam == 0 && iParamScanCode == 0x70)
+ *piScanCode = KEY_HKTG;
+ else
switch (iParamScanCode) {
- case 0x70:
- *piScanCode = KEY_HKTG;
- break;
- case 0x73:
- *piScanCode = KEY_BSlash2;
- break;
- default:
- *piScanCode = iParamScanCode;
- break;
- }
+ case 0x70:
+ *piScanCode = KEY_HKTG;
+ break;
+ case 0x73:
+ *piScanCode = KEY_BSlash2;
+ break;
+ default:
+ *piScanCode = iParamScanCode;
+ break;
+ }
}
/* Ring the keyboard bell (system speaker on PCs) */
static void
winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass)
{
- /*
- * We can't use Beep () here because it uses the PC speaker
- * on NT/2000. MessageBeep (MB_OK) will play the default system
- * sound on systems with a sound card or it will beep the PC speaker
- * on systems that do not have a sound card.
- */
- MessageBeep(MB_OK);
+ /*
+ * We can't use Beep () here because it uses the PC speaker
+ * on NT/2000. MessageBeep (MB_OK) will play the default system
+ * sound on systems with a sound card or it will beep the PC speaker
+ * on systems that do not have a sound card.
+ */
+ MessageBeep (MB_OK);
}
/* Change some keyboard configuration parameters */
static void
-winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl)
+winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
{
}
@@ -137,58 +138,58 @@ winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl)
*/
int
-winKeybdProc(DeviceIntPtr pDeviceInt, int iState)
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
{
- DevicePtr pDevice = (DevicePtr) pDeviceInt;
- XkbSrvInfoPtr xkbi;
- XkbControlsPtr ctrl;
+ DevicePtr pDevice = (DevicePtr) pDeviceInt;
+ XkbSrvInfoPtr xkbi;
+ XkbControlsPtr ctrl;
switch (iState) {
case DEVICE_INIT:
- winConfigKeyboard(pDeviceInt);
+ winConfigKeyboard (pDeviceInt);
- /* FIXME: Maybe we should use winGetKbdLeds () here? */
- defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
+ /* FIXME: Maybe we should use winGetKbdLeds () here? */
+ defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
- winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
- " Variant = \"%s\" Options = \"%s\"\n",
- g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
- g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
- g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
- g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
- g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");
+ winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
+ " Variant = \"%s\" Options = \"%s\"\n",
+ g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
+ g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
+ g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
+ g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
+ g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");
- InitKeyboardDeviceStruct(pDeviceInt,
+ InitKeyboardDeviceStruct (pDeviceInt,
&g_winInfo.xkb, winKeybdBell, winKeybdCtrl);
- xkbi = pDeviceInt->key->xkbInfo;
+ xkbi = pDeviceInt->key->xkbInfo;
if ((xkbi != NULL) && (xkbi->desc != NULL)) {
- ctrl = xkbi->desc->ctrls;
- ctrl->repeat_delay = g_winInfo.keyboard.delay;
- ctrl->repeat_interval = 1000 / g_winInfo.keyboard.rate;
+ ctrl = xkbi->desc->ctrls;
+ ctrl->repeat_delay = g_winInfo.keyboard.delay;
+ ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
}
else {
winErrorFVerb(1,
"winKeybdProc - Error initializing keyboard AutoRepeat\n");
}
- break;
+ break;
+
+ case DEVICE_ON:
+ pDevice->on = TRUE;
- case DEVICE_ON:
- pDevice->on = TRUE;
-
- // immediately copy the state of this keyboard device to the VCK
- // (which otherwise happens lazily after the first keypress)
- CopyKeyClass(pDeviceInt, inputInfo.keyboard);
- break;
+ // immediately copy the state of this keyboard device to the VCK
+ // (which otherwise happens lazily after the first keypress)
+ CopyKeyClass(pDeviceInt, inputInfo.keyboard);
+ break;
case DEVICE_CLOSE:
- case DEVICE_OFF:
- pDevice->on = FALSE;
- break;
+ case DEVICE_OFF:
+ pDevice->on = FALSE;
+ break;
}
- return Success;
+ return Success;
}
/*
@@ -199,30 +200,30 @@ winKeybdProc(DeviceIntPtr pDeviceInt, int iState)
*/
void
-winInitializeModeKeyStates(void)
+winInitializeModeKeyStates (void)
{
- /* Restore NumLock */
+ /* Restore NumLock */
if (GetKeyState(VK_NUMLOCK) & 0x0001) {
- winSendKeyEvent(KEY_NumLock, TRUE);
- winSendKeyEvent(KEY_NumLock, FALSE);
+ winSendKeyEvent (KEY_NumLock, TRUE);
+ winSendKeyEvent (KEY_NumLock, FALSE);
}
- /* Restore CapsLock */
+ /* Restore CapsLock */
if (GetKeyState(VK_CAPITAL) & 0x0001) {
- winSendKeyEvent(KEY_CapsLock, TRUE);
- winSendKeyEvent(KEY_CapsLock, FALSE);
+ winSendKeyEvent (KEY_CapsLock, TRUE);
+ winSendKeyEvent (KEY_CapsLock, FALSE);
}
- /* Restore ScrollLock */
+ /* Restore ScrollLock */
if (GetKeyState(VK_SCROLL) & 0x0001) {
- winSendKeyEvent(KEY_ScrollLock, TRUE);
- winSendKeyEvent(KEY_ScrollLock, FALSE);
+ winSendKeyEvent (KEY_ScrollLock, TRUE);
+ winSendKeyEvent (KEY_ScrollLock, FALSE);
}
- /* Restore KanaLock */
+ /* Restore KanaLock */
if (GetKeyState(VK_KANA) & 0x0001) {
- winSendKeyEvent(KEY_HKTG, TRUE);
- winSendKeyEvent(KEY_HKTG, FALSE);
+ winSendKeyEvent (KEY_HKTG, TRUE);
+ winSendKeyEvent (KEY_HKTG, FALSE);
}
}
@@ -233,64 +234,87 @@ winInitializeModeKeyStates(void)
*/
void
-winRestoreModeKeyStates(void)
+winRestoreModeKeyStates (void)
{
- DWORD dwKeyState;
- BOOL processEvents = TRUE;
- unsigned short internalKeyStates;
+ DWORD dwKeyState;
+ BOOL processEvents = TRUE;
+ unsigned short internalKeyStates;
- /* X server is being initialized */
- if (!inputInfo.keyboard)
- return;
+ /* X server is being initialized */
+ if (!inputInfo.keyboard)
+ return;
- /* Only process events if the rootwindow is mapped. The keyboard events
- * will cause segfaults otherwise */
+ /* Only process events if the rootwindow is mapped. The keyboard events
+ * will cause segfaults otherwise */
if (screenInfo.screens[0]->root &&
screenInfo.screens[0]->root->mapped == FALSE)
- processEvents = FALSE;
-
- /* Force to process all pending events in the mi event queue */
- if (processEvents)
- mieqProcessInputEvents();
-
- /* Read the mode key states of our X server */
- /* (stored in the virtual core keyboard) */
+ processEvents = FALSE;
+
+ /* Force to process all pending events in the mi event queue */
+ if (processEvents)
+ mieqProcessInputEvents ();
+
+ /* Read the mode key states of our X server */
+ /* (stored in the virtual core keyboard) */
internalKeyStates =
XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state);
- winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
+ winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
+
+ /*
+ * NOTE: The C XOR operator, ^, will not work here because it is
+ * a bitwise operator, not a logical operator. C does not
+ * have a logical XOR operator, so we use a macro instead.
+ */
+
+ {
+ /* consider modifer keys */
+
+ BOOL ctrl = (GetAsyncKeyState (VK_CONTROL) < 0);
+ BOOL shift = (GetAsyncKeyState (VK_SHIFT) < 0);
+ BOOL alt = (GetAsyncKeyState (VK_LMENU) < 0);
+ BOOL altgr = (GetAsyncKeyState (VK_RMENU) < 0);
- /*
- * NOTE: The C XOR operator, ^, will not work here because it is
- * a bitwise operator, not a logical operator. C does not
- * have a logical XOR operator, so we use a macro instead.
- */
+ if (ctrl && altgr) ctrl = FALSE;
- /* Has the key state changed? */
- dwKeyState = GetKeyState(VK_NUMLOCK) & 0x0001;
+ if (WIN_XOR (internalKeyStates & ControlMask, ctrl))
+ winSendKeyEvent (KEY_LCtrl, ctrl);
+
+ if (WIN_XOR (internalKeyStates & ShiftMask, shift))
+ winSendKeyEvent (KEY_ShiftL, shift);
+
+ if (WIN_XOR (internalKeyStates & Mod1Mask, alt))
+ winSendKeyEvent (KEY_Alt, alt);
+
+ if (WIN_XOR (internalKeyStates & Mod5Mask, altgr))
+ winSendKeyEvent (KEY_AltLang, altgr);
+ }
+
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
if (WIN_XOR(internalKeyStates & NumLockMask, dwKeyState)) {
- winSendKeyEvent(KEY_NumLock, TRUE);
- winSendKeyEvent(KEY_NumLock, FALSE);
+ winSendKeyEvent (KEY_NumLock, TRUE);
+ winSendKeyEvent (KEY_NumLock, FALSE);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState(VK_CAPITAL) & 0x0001;
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
if (WIN_XOR(internalKeyStates & LockMask, dwKeyState)) {
- winSendKeyEvent(KEY_CapsLock, TRUE);
- winSendKeyEvent(KEY_CapsLock, FALSE);
+ winSendKeyEvent (KEY_CapsLock, TRUE);
+ winSendKeyEvent (KEY_CapsLock, FALSE);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState(VK_SCROLL) & 0x0001;
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
if (WIN_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) {
- winSendKeyEvent(KEY_ScrollLock, TRUE);
- winSendKeyEvent(KEY_ScrollLock, FALSE);
+ winSendKeyEvent (KEY_ScrollLock, TRUE);
+ winSendKeyEvent (KEY_ScrollLock, FALSE);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState(VK_KANA) & 0x0001;
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_KANA) & 0x0001;
if (WIN_XOR(internalKeyStates & KanaMask, dwKeyState)) {
- winSendKeyEvent(KEY_HKTG, TRUE);
- winSendKeyEvent(KEY_HKTG, FALSE);
+ winSendKeyEvent (KEY_HKTG, TRUE);
+ winSendKeyEvent (KEY_HKTG, FALSE);
}
}
@@ -300,119 +324,119 @@ winRestoreModeKeyStates(void)
*/
Bool
-winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam)
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
{
- MSG msgNext;
- LONG lTime;
- Bool fReturn;
-
- static Bool lastWasControlL = FALSE;
- static UINT lastMessage;
- static LONG lastTime;
-
- /*
- * Fake Ctrl_L presses will be followed by an Alt_R press
- * with the same timestamp as the Ctrl_L press.
- */
- if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+ MSG msgNext;
+ LONG lTime;
+ Bool fReturn;
+
+ static Bool lastWasControlL = FALSE;
+ static UINT lastMessage;
+ static LONG lastTime;
+
+ /*
+ * Fake Ctrl_L presses will be followed by an Alt_R press
+ * with the same timestamp as the Ctrl_L press.
+ */
+ if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
&& wParam == VK_CONTROL && (HIWORD(lParam) & KF_EXTENDED) == 0) {
- /* Got a Ctrl_L press */
+ /* Got a Ctrl_L press */
- /* Get time of current message */
- lTime = GetMessageTime();
+ /* Get time of current message */
+ lTime = GetMessageTime ();
- /* Look for next press message */
- fReturn = PeekMessage(&msgNext, NULL,
+ /* Look for next press message */
+ fReturn = PeekMessage (&msgNext, NULL,
WM_KEYDOWN, WM_SYSKEYDOWN, PM_NOREMOVE);
if (fReturn && msgNext.message != WM_KEYDOWN &&
msgNext.message != WM_SYSKEYDOWN)
- fReturn = 0;
+ fReturn = 0;
if (!fReturn) {
- lastWasControlL = TRUE;
- lastMessage = message;
- lastTime = lTime;
+ lastWasControlL = TRUE;
+ lastMessage = message;
+ lastTime = lTime;
}
else {
- lastWasControlL = FALSE;
+ lastWasControlL = FALSE;
}
- /* Is next press an Alt_R with the same timestamp? */
- if (fReturn && msgNext.wParam == VK_MENU
- && msgNext.time == lTime
+ /* Is next press an Alt_R with the same timestamp? */
+ if (fReturn && msgNext.wParam == VK_MENU
+ && msgNext.time == lTime
&& (HIWORD(msgNext.lParam) & KF_EXTENDED)) {
- /*
- * Next key press is Alt_R with same timestamp as current
- * Ctrl_L message. Therefore, this Ctrl_L press is a fake
- * event, so discard it.
- */
- return TRUE;
- }
+ /*
+ * Next key press is Alt_R with same timestamp as current
+ * Ctrl_L message. Therefore, this Ctrl_L press is a fake
+ * event, so discard it.
+ */
+ return TRUE;
+ }
}
- /*
- * Sometimes, the Alt_R press message is not yet posted when the
- * fake Ctrl_L press message arrives (even though it has the
- * same timestamp), so check for an Alt_R press message that has
- * arrived since the last Ctrl_L message.
- */
- else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+ /*
+ * Sometimes, the Alt_R press message is not yet posted when the
+ * fake Ctrl_L press message arrives (even though it has the
+ * same timestamp), so check for an Alt_R press message that has
+ * arrived since the last Ctrl_L message.
+ */
+ else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
&& wParam == VK_MENU && (HIWORD(lParam) & KF_EXTENDED)) {
- /* Got a Alt_R press */
+ /* Got a Alt_R press */
if (lastWasControlL) {
- lTime = GetMessageTime();
+ lTime = GetMessageTime ();
if (lastTime == lTime) {
/* Undo the fake Ctrl_L press by sending a fake Ctrl_L release */
- winSendKeyEvent(KEY_LCtrl, FALSE);
+ winSendKeyEvent (KEY_LCtrl, FALSE);
}
- lastWasControlL = FALSE;
+ lastWasControlL = FALSE;
}
}
- /*
- * Fake Ctrl_L releases will be followed by an Alt_R release
- * with the same timestamp as the Ctrl_L release.
- */
- else if ((message == WM_KEYUP || message == WM_SYSKEYUP)
+ /*
+ * Fake Ctrl_L releases will be followed by an Alt_R release
+ * with the same timestamp as the Ctrl_L release.
+ */
+ else if ((message == WM_KEYUP || message == WM_SYSKEYUP)
&& wParam == VK_CONTROL && (HIWORD(lParam) & KF_EXTENDED) == 0) {
- /* Got a Ctrl_L release */
+ /* Got a Ctrl_L release */
- /* Get time of current message */
- lTime = GetMessageTime();
+ /* Get time of current message */
+ lTime = GetMessageTime ();
- /* Look for next release message */
- fReturn = PeekMessage(&msgNext, NULL,
+ /* Look for next release message */
+ fReturn = PeekMessage (&msgNext, NULL,
WM_KEYUP, WM_SYSKEYUP, PM_NOREMOVE);
if (fReturn && msgNext.message != WM_KEYUP &&
msgNext.message != WM_SYSKEYUP)
- fReturn = 0;
+ fReturn = 0;
- lastWasControlL = FALSE;
+ lastWasControlL = FALSE;
- /* Is next press an Alt_R with the same timestamp? */
- if (fReturn
+ /* Is next press an Alt_R with the same timestamp? */
+ if (fReturn
&& (msgNext.message == WM_KEYUP || msgNext.message == WM_SYSKEYUP)
- && msgNext.wParam == VK_MENU
- && msgNext.time == lTime
+ && msgNext.wParam == VK_MENU
+ && msgNext.time == lTime
&& (HIWORD(msgNext.lParam) & KF_EXTENDED)) {
- /*
- * Next key release is Alt_R with same timestamp as current
- * Ctrl_L message. Therefore, this Ctrl_L release is a fake
- * event, so discard it.
- */
- return TRUE;
- }
+ /*
+ * Next key release is Alt_R with same timestamp as current
+ * Ctrl_L message. Therefore, this Ctrl_L release is a fake
+ * event, so discard it.
+ */
+ return TRUE;
+ }
}
else {
- /* On any other press or release message, we don't have a
- potentially fake Ctrl_L to worry about anymore... */
- lastWasControlL = FALSE;
+ /* On any other press or release message, we don't have a
+ potentially fake Ctrl_L to worry about anymore... */
+ lastWasControlL = FALSE;
}
- /* Not a fake control left press/release */
- return FALSE;
+ /* Not a fake control left press/release */
+ return FALSE;
}
/*
@@ -420,24 +444,24 @@ winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam)
*/
void
-winKeybdReleaseKeys(void)
+winKeybdReleaseKeys (void)
{
- int i;
+ int i;
#ifdef HAS_DEVWINDOWS
- /* Verify that the mi input system has been initialized */
- if (g_fdMessageQueue == WIN_FD_INVALID)
- return;
+ /* Verify that the mi input system has been initialized */
+ if (g_fdMessageQueue == WIN_FD_INVALID)
+ return;
#endif
- /* Loop through all keys */
+ /* Loop through all keys */
for (i = 0; i < NUM_KEYCODES; ++i) {
- /* Pop key if pressed */
- if (g_winKeyState[i])
- winSendKeyEvent(i, FALSE);
+ /* Pop key if pressed */
+ if (g_winKeyState[i])
+ winSendKeyEvent (i, FALSE);
- /* Reset pressed flag for keys */
- g_winKeyState[i] = FALSE;
+ /* Reset pressed flag for keys */
+ g_winKeyState[i] = FALSE;
}
}
@@ -448,17 +472,17 @@ winKeybdReleaseKeys(void)
*/
void
-winSendKeyEvent(DWORD dwKey, Bool fDown)
+winSendKeyEvent (DWORD dwKey, Bool fDown)
{
- /*
- * When alt-tabing between screens we can get phantom key up messages
- * Here we only pass them through it we think we should!
- */
+ /*
+ * When alt-tabing between screens we can get phantom key up messages
+ * Here we only pass them through it we think we should!
+ */
if (g_winKeyState[dwKey] == FALSE && fDown == FALSE)
return;
- /* Update the keyState map */
- g_winKeyState[dwKey] = fDown;
+ /* Update the keyState map */
+ g_winKeyState[dwKey] = fDown;
QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease,
dwKey + MIN_KEYCODE, NULL);
@@ -468,24 +492,24 @@ winSendKeyEvent(DWORD dwKey, Bool fDown)
BOOL
winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
-{
+ {
switch (wParam) {
case VK_CONTROL:
- if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
- return TRUE;
- if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
- return TRUE;
- break;
+ if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
+ return TRUE;
+ break;
case VK_SHIFT:
- if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
- return TRUE;
- if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
- return TRUE;
- break;
- default:
+ if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
return TRUE;
- }
- return FALSE;
+ if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
+ return TRUE;
+ break;
+ default:
+ return TRUE;
+ }
+ return FALSE;
}
/* Only on shift release message is sent even if both are pressed.
@@ -494,11 +518,42 @@ winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
void
winFixShiftKeys(int iScanCode)
{
- if (GetKeyState(VK_SHIFT) & 0x8000)
- return;
+ if (GetKeyState (VK_SHIFT) & 0x8000)
+ return;
+
+ if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
+ winSendKeyEvent (KEY_ShiftR, FALSE);
+ if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
+ winSendKeyEvent (KEY_ShiftL, FALSE);
+}
+
+/*
+ */
+int
+XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act)
+{
+ XkbAnyAction *xf86act = &(act->any);
+ char msgbuf[XkbAnyActionDataSize+1];
+
+ if (xf86act->type == XkbSA_XFree86Private)
+ {
+ memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize);
+ msgbuf[XkbAnyActionDataSize]= '\0';
+ if (strcasecmp(msgbuf, "prgrbs")==0) {
+ DeviceIntPtr tmp;
+ winMsg(X_INFO, "Printing all currently active device grabs:\n");
+ for (tmp = inputInfo.devices; tmp; tmp = tmp->next)
+ if (tmp->deviceGrab.grab)
+ PrintDeviceGrabInfo(tmp);
+ winMsg(X_INFO, "End list of active device grabs\n");
+ }
+ else if (strcasecmp(msgbuf, "ungrab")==0)
+ UngrabAllDevices(FALSE);
+ else if (strcasecmp(msgbuf, "clsgrb")==0)
+ UngrabAllDevices(TRUE);
+ else if (strcasecmp(msgbuf, "prwins")==0)
+ PrintWindowTree();
+ }
- if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
- winSendKeyEvent(KEY_ShiftR, FALSE);
- if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
- winSendKeyEvent(KEY_ShiftL, FALSE);
+ return 0;
}
diff --git a/hw/xwin/winkeyhook.c b/hw/xwin/winkeyhook.c
index 124150850..8d68094e3 100644
--- a/hw/xwin/winkeyhook.c
+++ b/hw/xwin/winkeyhook.c
@@ -40,13 +40,13 @@ static HHOOK g_hhookKeyboardLL = NULL;
*/
static LRESULT CALLBACK
-winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam);
+winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam);
#ifndef LLKHF_EXTENDED
-#define LLKHF_EXTENDED 0x00000001
+# define LLKHF_EXTENDED 0x00000001
#endif
#ifndef LLKHF_UP
-#define LLKHF_UP 0x00000080
+# define LLKHF_UP 0x00000080
#endif
/*
@@ -54,34 +54,34 @@ winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam);
*/
static LRESULT CALLBACK
-winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
+winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
{
- BOOL fPassKeystroke = FALSE;
- BOOL fPassAltTab = TRUE;
- PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
- HWND hwnd = GetActiveWindow();
+ BOOL fPassKeystroke = FALSE;
+ BOOL fPassAltTab = TRUE;
+ PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
+ HWND hwnd = GetActiveWindow();
#ifdef XWIN_MULTIWINDOW
- WindowPtr pWin = NULL;
- winPrivWinPtr pWinPriv = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
+ WindowPtr pWin = NULL;
+ winPrivWinPtr pWinPriv = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
- /* Check if the Windows window property for our X window pointer is valid */
+ /* Check if the Windows window property for our X window pointer is valid */
if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
- /* Get a pointer to our window privates */
- pWinPriv = winGetWindowPriv(pWin);
+ /* Get a pointer to our window privates */
+ pWinPriv = winGetWindowPriv(pWin);
- /* Get pointers to our screen privates and screen info */
- pScreenPriv = pWinPriv->pScreenPriv;
- pScreenInfo = pScreenPriv->pScreenInfo;
+ /* Get pointers to our screen privates and screen info */
+ pScreenPriv = pWinPriv->pScreenPriv;
+ pScreenInfo = pScreenPriv->pScreenInfo;
- if (pScreenInfo->fMultiWindow)
- fPassAltTab = FALSE;
+ if (pScreenInfo->fMultiWindow)
+ fPassAltTab = FALSE;
}
#endif
- /* Pass keystrokes on to our main message loop */
+ /* Pass keystrokes on to our main message loop */
if (iCode == HC_ACTION) {
winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n",
p->vkCode, p->scanCode);
@@ -91,39 +91,39 @@ winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
- fPassKeystroke =
- (fPassAltTab &&
- (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
+ fPassKeystroke =
+ (fPassAltTab &&
+ (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
|| (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN);
- break;
- }
+ break;
+ }
}
- /*
- * Pass message on to our main message loop.
- * We process this immediately with SendMessage so that the keystroke
- * appears in, hopefully, the correct order.
- */
+ /*
+ * Pass message on to our main message loop.
+ * We process this immediately with SendMessage so that the keystroke
+ * appears in, hopefully, the correct order.
+ */
if (fPassKeystroke) {
- LPARAM lParamKey = 0x0;
-
- /* Construct the lParam from KBDLLHOOKSTRUCT */
- lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */
- lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16));
- lParamKey = lParamKey
- | (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23));
- lParamKey = lParamKey
+ LPARAM lParamKey = 0x0;
+
+ /* Construct the lParam from KBDLLHOOKSTRUCT */
+ lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */
+ lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16));
+ lParamKey = lParamKey
+ | (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23));
+ lParamKey = lParamKey
| (0x20000000 & ((p->flags & LLKHF_ALTDOWN) << 24));
- lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
+ lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
- /* Send message to our main window that has the keyboard focus */
+ /* Send message to our main window that has the keyboard focus */
PostMessage(hwnd, (UINT) wParam, (WPARAM) p->vkCode, lParamKey);
- return 1;
+ return 1;
}
- /* Call next hook */
- return CallNextHookEx(NULL, iCode, wParam, lParam);
+ /* Call next hook */
+ return CallNextHookEx (NULL, iCode, wParam, lParam);
}
/*
@@ -131,33 +131,15 @@ winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
*/
Bool
-winInstallKeyboardHookLL(void)
+winInstallKeyboardHookLL (void)
{
- OSVERSIONINFO osvi = { 0 };
-
- /* Get operating system version information */
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
-
- /* Branch on platform ID */
- switch (osvi.dwPlatformId) {
- case VER_PLATFORM_WIN32_NT:
- /* Low-level is supported on NT 4.0 SP3+ only */
- /* TODO: Return FALSE on NT 4.0 with no SP, SP1, or SP2 */
- break;
-
- case VER_PLATFORM_WIN32_WINDOWS:
- /* Low-level hook is not supported on non-NT */
- return FALSE;
- }
-
- /* Install the hook only once */
- if (!g_hhookKeyboardLL)
- g_hhookKeyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL,
- winKeyboardMessageHookLL,
+ /* Install the hook only once */
+ if (!g_hhookKeyboardLL)
+ g_hhookKeyboardLL = SetWindowsHookEx (WH_KEYBOARD_LL,
+ winKeyboardMessageHookLL,
g_hInstance, 0);
- return TRUE;
+ return TRUE;
}
/*
@@ -165,9 +147,9 @@ winInstallKeyboardHookLL(void)
*/
void
-winRemoveKeyboardHookLL(void)
+winRemoveKeyboardHookLL (void)
{
- if (g_hhookKeyboardLL)
- UnhookWindowsHookEx(g_hhookKeyboardLL);
- g_hhookKeyboardLL = NULL;
+ if (g_hhookKeyboardLL)
+ UnhookWindowsHookEx (g_hhookKeyboardLL);
+ g_hhookKeyboardLL = NULL;
}
diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c
index 26e20b743..8c6b09e13 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -38,19 +38,20 @@ static
wBOOL CALLBACK
getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
{
- struct GetMonitorInfoData *data = (struct GetMonitorInfoData *) _data;
+ struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data;
- // only get data for monitor number specified in <data>
- data->monitorNum++;
+ // only get data for monitor number specified in <data>
+ data->monitorNum++;
if (data->monitorNum == data->requestedMonitor) {
- data->bMonitorSpecifiedExists = TRUE;
- data->monitorOffsetX = rect->left;
- data->monitorOffsetY = rect->top;
- data->monitorHeight = rect->bottom - rect->top;
- data->monitorWidth = rect->right - rect->left;
- return FALSE;
- }
- return TRUE;
+ data->bMonitorSpecifiedExists = TRUE;
+ data->monitorOffsetX = rect->left;
+ data->monitorOffsetY = rect->top;
+ data->monitorHeight = rect->bottom - rect->top;
+ data->monitorWidth = rect->right - rect->left;
+ data->monitorHandle = hMonitor;
+ return FALSE;
+ }
+ return TRUE;
}
Bool
@@ -63,5 +64,7 @@ QueryMonitor(int index, struct GetMonitorInfoData *data)
data->requestedMonitor = index;
/* query information */
- return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+ EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+
+ return TRUE;
}
diff --git a/hw/xwin/winmonitors.h b/hw/xwin/winmonitors.h
index acef48274..9445e90b2 100644
--- a/hw/xwin/winmonitors.h
+++ b/hw/xwin/winmonitors.h
@@ -1,14 +1,43 @@
+/*
+
+Copyright 1993, 1998 The Open Group
+Copyright (C) Colin Harrison 2005-2008
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
/* data returned for monitor information */
struct GetMonitorInfoData {
- int requestedMonitor;
- int monitorNum;
+ int requestedMonitor;
+ int monitorNum;
Bool bUserSpecifiedMonitor;
Bool bMonitorSpecifiedExists;
- int monitorOffsetX;
- int monitorOffsetY;
- int monitorHeight;
- int monitorWidth;
+ int monitorOffsetX;
+ int monitorOffsetY;
+ int monitorHeight;
+ int monitorWidth;
+ HMONITOR monitorHandle;
};
Bool QueryMonitor(int index, struct GetMonitorInfoData *data);
diff --git a/hw/xwin/winmsgwindow.c b/hw/xwin/winmsgwindow.c
new file mode 100644
index 000000000..d8af1b5ff
--- /dev/null
+++ b/hw/xwin/winmsgwindow.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) Jon TURNEY 2011
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "win.h"
+
+/*
+ * This is the messaging window, a hidden top-level window. We never do anything
+ * with it, but other programs may send messages to it.
+ */
+
+/*
+ * winMsgWindowProc - Window procedure for msg window
+ */
+
+static
+LRESULT CALLBACK
+winMsgWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+#if CYGDEBUG
+ winDebugWin32Message("winMsgWindowProc", hwnd, message, wParam, lParam);
+#endif
+
+ switch (message)
+ {
+ case WM_ENDSESSION:
+ if (!wParam)
+ return 0; /* shutdown is being cancelled */
+
+ /*
+ Send a WM_GIVEUP message to the X server thread so it wakes up if
+ blocked in select(), performs GiveUp(), and then notices that GiveUp()
+ has set the DE_TERMINATE flag so exits the msg dispatch loop.
+ */
+ {
+ ScreenPtr pScreen = screenInfo.screens[0];
+ winScreenPriv(pScreen);
+ PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ }
+
+ /*
+ This process will be terminated by the system almost immediately
+ after the last thread with a message queue returns from processing
+ WM_ENDSESSION, so we cannot rely on any code executing after this
+ message is processed and need to wait here until ddxGiveUp() is called
+ and releases the termination mutex to guarantee that the lock file and
+ unix domain sockets have been removed
+
+ ofc, Microsoft doesn't document this under WM_ENDSESSION, you are supposed
+ to read the source of CRSS to find out how it works :-)
+
+ http://blogs.msdn.com/b/michen/archive/2008/04/04/application-termination-when-user-logs-off.aspx
+ */
+ {
+ int iReturn = pthread_mutex_lock (&g_pmTerminating);
+ if (iReturn != 0)
+ {
+ ErrorF ("winMsgWindowProc - pthread_mutex_lock () failed: %d\n", iReturn);
+ }
+ winDebug ("winMsgWindowProc - WM_ENDSESSION termination lock acquired\n");
+ }
+
+ return 0;
+ }
+
+ return DefWindowProc(hwnd, message, wParam, lParam);
+}
+
+static HWND
+winCreateMsgWindow(void)
+{
+ HWND hwndMsg;
+ wATOM winClass;
+
+ // register window class
+ {
+ WNDCLASSEX wcx ;
+ wcx.cbSize=sizeof(WNDCLASSEX);
+ wcx.style = CS_HREDRAW | CS_VREDRAW;
+ wcx.lpfnWndProc = winMsgWindowProc;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = g_hInstance;
+ wcx.hIcon = NULL;
+ wcx.hCursor = 0;
+ wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = WINDOW_CLASS_X_MSG;
+ wcx.hIconSm = NULL;
+ winClass = RegisterClassEx(&wcx);
+ }
+
+ // Create the msg window.
+ hwndMsg = CreateWindowEx(
+ 0, // no extended styles
+ WINDOW_CLASS_X_MSG, // class name
+ "XWin Msg Window", // window name
+ WS_OVERLAPPEDWINDOW, // overlapped window
+ CW_USEDEFAULT, // default horizontal position
+ CW_USEDEFAULT, // default vertical position
+ CW_USEDEFAULT, // default width
+ CW_USEDEFAULT, // default height
+ (HWND) NULL, // no parent or owner window
+ (HMENU) NULL, // class menu used
+ GetModuleHandle (NULL), // instance handle
+ NULL); // no window creation data
+
+ if (!hwndMsg)
+ {
+ ErrorF("winCreateMsgWindow - Create msg window failed\n");
+ return NULL;
+ }
+
+ winDebug("winCreateMsgWindow - Created msg window hwnd 0x%x\n", hwndMsg);
+
+ return hwndMsg;
+}
+
+static void *
+winMsgWindowThreadProc(void *arg)
+{
+ HWND hwndMsg;
+
+ winDebug ("winMsgWindowThreadProc - Hello\n");
+
+ hwndMsg = winCreateMsgWindow();
+ if (hwndMsg)
+ {
+ MSG msg;
+
+ /* Pump the msg window message queue */
+ while (GetMessage (&msg, hwndMsg, 0, 0) > 0)
+ {
+#if CYGDEBUG
+ winDebugWin32Message("winMsgWindowThread", msg.hwnd, msg.message, msg.wParam, msg.lParam);
+#endif
+ DispatchMessage (&msg);
+ }
+ }
+
+ winDebug ("winMsgWindowThreadProc - Exit\n");
+
+ return NULL;
+}
+
+Bool
+winCreateMsgWindowThread(void)
+{
+ pthread_t ptMsgWindowThreadProc;
+
+ /* Spawn a thread for the msg window */
+ if (pthread_create (&ptMsgWindowThreadProc,
+ NULL,
+ winMsgWindowThreadProc,
+ NULL))
+ {
+ /* Bail if thread creation failed */
+ ErrorF ("winCreateMsgWindow - pthread_create failed.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c
index df59f6066..aa6b08fcc 100644
--- a/hw/xwin/winmultiwindowicons.c
+++ b/hw/xwin/winmultiwindowicons.c
@@ -31,321 +31,320 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
-#include "win.h"
-#include "dixevents.h"
-#include "winmultiwindowclass.h"
-#include "winprefs.h"
-#include "propertyst.h"
-#include "windowstr.h"
+#ifndef WINVER
+#define WINVER 0x0500
+#endif
-/*
- * Prototypes for local functions
- */
+#include <X11/Xwindows.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
-static void
+#include "winresource.h"
+#include "winprefs.h"
+#include "winmsg.h"
+#include "winmultiwindowicons.h"
+#include "winglobals.h"
-winScaleXBitmapToWindows(int iconSize, int effBPP,
- PixmapPtr pixmap, unsigned char *image);
+/*
+ * global variables
+ */
+extern HINSTANCE g_hInstance;
/*
- * Scale an X icon bitmap into a Windoze icon bitmap
+ * Scale an X icon ZPixmap into a Windoze icon bitmap
*/
static void
-winScaleXBitmapToWindows(int iconSize,
- int effBPP, PixmapPtr pixmap, unsigned char *image)
+winScaleXImageToWindowsIcon(int iconSize,
+ int effBPP,
+ int stride,
+ XImage *pixmap,
+ unsigned char *image)
{
- int row, column, effXBPP, effXDepth;
- unsigned char *outPtr;
- char *iconData = 0;
- int stride, xStride;
- float factX, factY;
- int posX, posY;
- unsigned char *ptr;
- unsigned int zero;
- unsigned int color;
-
- effXBPP = BitsPerPixel(pixmap->drawable.depth);
- effXDepth = pixmap->drawable.depth;
-
- if (pixmap->drawable.bitsPerPixel == 15)
- effXBPP = 16;
-
- if (pixmap->drawable.depth == 15)
- effXDepth = 16;
-
- /* Need 16-bit aligned rows for DDBitmaps */
- stride = ((iconSize * effBPP + 15) & (~15)) / 8;
- xStride = PixmapBytePad(pixmap->drawable.width, pixmap->drawable.depth);
- if (stride == 0 || xStride == 0) {
- ErrorF("winScaleXBitmapToWindows - stride or xStride is zero. "
- "Bailing.\n");
- return;
+ int row, column, effXBPP, effXDepth;
+ unsigned char *outPtr;
+ unsigned char *iconData = 0;
+ int xStride;
+ float factX, factY;
+ int posX, posY;
+ unsigned char *ptr;
+ unsigned int zero;
+ unsigned int color;
+
+ effXBPP = pixmap->bits_per_pixel;
+ if (pixmap->bits_per_pixel == 15)
+ effXBPP = 16;
+
+ effXDepth = pixmap->depth;
+ if (pixmap->depth == 15)
+ effXDepth = 16;
+
+ xStride = pixmap->bytes_per_line;
+ if (stride == 0 || xStride == 0)
+ {
+ ErrorF ("winScaleXBitmapToWindows - stride or xStride is zero. "
+ "Bailing.\n");
+ return;
}
- /* Allocate memory for icon data */
- iconData = malloc(xStride * pixmap->drawable.height);
- if (!iconData) {
- ErrorF("winScaleXBitmapToWindows - malloc failed for iconData. "
- "Bailing.\n");
- return;
- }
-
- /* Get icon data */
- miGetImage((DrawablePtr) &(pixmap->drawable), 0, 0,
- pixmap->drawable.width, pixmap->drawable.height,
- ZPixmap, 0xffffffff, iconData);
-
- /* Keep aspect ratio */
- factX = ((float) pixmap->drawable.width) / ((float) iconSize);
- factY = ((float) pixmap->drawable.height) / ((float) iconSize);
- if (factX > factY)
- factY = factX;
- else
- factX = factY;
-
- /* Out-of-bounds, fill icon with zero */
- zero = 0;
-
+ /* Get icon data */
+ iconData = (unsigned char *)pixmap->data;
+
+ /* Keep aspect ratio */
+ factX = ((float)pixmap->width) / ((float)iconSize);
+ factY = ((float)pixmap->height) / ((float)iconSize);
+ if (factX > factY)
+ factY = factX;
+ else
+ factX = factY;
+
+ /* Out-of-bounds, fill icon with zero */
+ zero = 0;
+
for (row = 0; row < iconSize; row++) {
- outPtr = image + stride * row;
+ outPtr = image + stride * row;
for (column = 0; column < iconSize; column++) {
- posX = factX * column;
- posY = factY * row;
-
- ptr = (unsigned char *) iconData + posY * xStride;
+ posX = factX * column;
+ posY = factY * row;
+
+ ptr = (unsigned char*) iconData + posY*xStride;
if (effXBPP == 1) {
- ptr += posX / 8;
-
- /* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
- ptr = (unsigned char *) &zero;
-
- if ((*ptr) & (1 << (posX & 7)))
+ ptr += posX / 8;
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->width
+ || posY >= pixmap->height)
+ ptr = (unsigned char *) &zero;
+
+ if ((*ptr) & (1 << (posX & 7)))
switch (effBPP) {
- case 32:
- *(outPtr++) = 0;
- case 24:
- *(outPtr++) = 0;
- case 16:
- *(outPtr++) = 0;
- case 8:
- *(outPtr++) = 0;
- break;
- case 1:
- outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
- break;
- }
- else
+ case 32:
+ *(outPtr++) = 0;
+ case 24:
+ *(outPtr++) = 0;
+ case 16:
+ *(outPtr++) = 0;
+ case 8:
+ *(outPtr++) = 0;
+ break;
+ case 1:
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ break;
+ }
+ else
switch (effBPP) {
- case 32:
- *(outPtr++) = 255;
- *(outPtr++) = 255;
- *(outPtr++) = 255;
- *(outPtr++) = 0;
- break;
- case 24:
- *(outPtr++) = 255;
- case 16:
- *(outPtr++) = 255;
- case 8:
- *(outPtr++) = 255;
- break;
- case 1:
- outPtr[column / 8] |= (1 << (7 - (column & 7)));
- break;
- }
- }
+ case 32:
+ *(outPtr++) = 255;
+ *(outPtr++) = 255;
+ *(outPtr++) = 255;
+ *(outPtr++) = 0;
+ break;
+ case 24:
+ *(outPtr++) = 255;
+ case 16:
+ *(outPtr++) = 255;
+ case 8:
+ *(outPtr++) = 255;
+ break;
+ case 1:
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ break;
+ }
+ }
else if (effXDepth == 24 || effXDepth == 32) {
- ptr += posX * (effXBPP / 8);
-
- /* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
- ptr = (unsigned char *) &zero;
- color = (((*ptr) << 16)
- + ((*(ptr + 1)) << 8)
- + ((*(ptr + 2)) << 0));
+ ptr += posX * (effXBPP / 8);
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->width
+ || posY >= pixmap->height)
+ ptr = (unsigned char *) &zero;
+ color = (((*ptr) << 16)
+ + ((*(ptr + 1)) << 8)
+ + ((*(ptr + 2)) << 0));
switch (effBPP) {
- case 32:
- *(outPtr++) = *(ptr++); /* b */
- *(outPtr++) = *(ptr++); /* g */
- *(outPtr++) = *(ptr++); /* r */
- *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; /* alpha */
- break;
- case 24:
- *(outPtr++) = *(ptr++);
- *(outPtr++) = *(ptr++);
- *(outPtr++) = *(ptr++);
- break;
- case 16:
- color = ((((*ptr) >> 2) << 10)
- + (((*(ptr + 1)) >> 2) << 5)
- + (((*(ptr + 2)) >> 2)));
- *(outPtr++) = (color >> 8);
- *(outPtr++) = (color & 255);
- break;
- case 8:
- color = (((*ptr))) + (((*(ptr + 1)))) + (((*(ptr + 2))));
- color /= 3;
- *(outPtr++) = color;
- break;
- case 1:
- if (color)
- outPtr[column / 8] |= (1 << (7 - (column & 7)));
- else
- outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
- }
- }
+ case 32:
+ *(outPtr++) = *(ptr++); /* b */
+ *(outPtr++) = *(ptr++); /* g */
+ *(outPtr++) = *(ptr++); /* r */
+ *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; /* alpha */
+ break;
+ case 24:
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ break;
+ case 16:
+ color = ((((*ptr) >> 2) << 10)
+ + (((*(ptr + 1)) >> 2) << 5)
+ + (((*(ptr + 2)) >> 2)));
+ *(outPtr++) = (color >> 8);
+ *(outPtr++) = (color & 255);
+ break;
+ case 8:
+ color = (((*ptr))) + (((*(ptr + 1)))) + (((*(ptr + 2))));
+ color /= 3;
+ *(outPtr++) = color;
+ break;
+ case 1:
+ if (color)
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ else
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ }
+ }
else if (effXDepth == 16) {
- ptr += posX * (effXBPP / 8);
-
- /* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
- ptr = (unsigned char *) &zero;
- color = ((*ptr) << 8) + (*(ptr + 1));
+ ptr += posX * (effXBPP / 8);
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->width
+ || posY >= pixmap->height)
+ ptr = (unsigned char *) &zero;
+ color = ((*ptr) << 8) + (*(ptr + 1));
switch (effBPP) {
- case 32:
- *(outPtr++) = (color & 31) << 2;
- *(outPtr++) = ((color >> 5) & 31) << 2;
- *(outPtr++) = ((color >> 10) & 31) << 2;
- *(outPtr++) = 0; /* resvd */
- break;
- case 24:
- *(outPtr++) = (color & 31) << 2;
- *(outPtr++) = ((color >> 5) & 31) << 2;
- *(outPtr++) = ((color >> 10) & 31) << 2;
- break;
- case 16:
- *(outPtr++) = *(ptr++);
- *(outPtr++) = *(ptr++);
- break;
- case 8:
- *(outPtr++) = (((color & 31)
- + ((color >> 5) & 31)
- + ((color >> 10) & 31)) / 3) << 2;
- break;
- case 1:
- if (color)
- outPtr[column / 8] |= (1 << (7 - (column & 7)));
- else
- outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
- break;
- } /* end switch(effbpp) */
- } /* end if effxbpp==16) */
- } /* end for column */
- } /* end for row */
- free(iconData);
+ case 32:
+ *(outPtr++) = (color & 31) << 2;
+ *(outPtr++) = ((color >> 5) & 31) << 2;
+ *(outPtr++) = ((color >> 10) & 31) << 2;
+ *(outPtr++) = 0; /* resvd */
+ break;
+ case 24:
+ *(outPtr++) = (color & 31) << 2;
+ *(outPtr++) = ((color >> 5) & 31) << 2;
+ *(outPtr++) = ((color >> 10) & 31) << 2;
+ break;
+ case 16:
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ break;
+ case 8:
+ *(outPtr++) = (((color & 31)
+ + ((color >> 5) & 31)
+ + ((color >> 10) & 31)) / 3) << 2;
+ break;
+ case 1:
+ if (color)
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ else
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ break;
+ } /* end switch(effbpp) */
+ } /* end if effxbpp==16) */
+ } /* end for column */
+ } /* end for row */
}
static HICON
-NetWMToWinIconAlpha(uint32_t * icon)
+NetWMToWinIconAlpha(uint32_t *icon)
{
- int width = icon[0];
- int height = icon[1];
- uint32_t *pixels = &icon[2];
- HICON result;
- HDC hdc = GetDC(NULL);
- uint32_t *DIB_pixels;
- ICONINFO ii = { TRUE };
- BITMAPV4HEADER bmh = { sizeof(bmh) };
-
- /* Define an ARGB pixel format used for Color+Alpha icons */
- bmh.bV4Width = width;
- bmh.bV4Height = -height; /* Invert the image */
- bmh.bV4Planes = 1;
- bmh.bV4BitCount = 32;
- bmh.bV4V4Compression = BI_BITFIELDS;
- bmh.bV4AlphaMask = 0xFF000000;
- bmh.bV4RedMask = 0x00FF0000;
- bmh.bV4GreenMask = 0x0000FF00;
- bmh.bV4BlueMask = 0x000000FF;
-
- ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) & bmh,
+ int width = icon[0];
+ int height = icon[1];
+ uint32_t *pixels = &icon[2];
+ HICON result;
+ HDC hdc = GetDC(NULL);
+ uint32_t *DIB_pixels;
+ ICONINFO ii;
+ BITMAPV4HEADER bmh = {sizeof(bmh)};
+
+ /* Define an ARGB pixel format used for Color+Alpha icons */
+ bmh.bV4Width = width;
+ bmh.bV4Height = -height; /* Invert the image */
+ bmh.bV4Planes = 1;
+ bmh.bV4BitCount = 32;
+ bmh.bV4V4Compression = BI_BITFIELDS;
+ bmh.bV4AlphaMask = 0xFF000000;
+ bmh.bV4RedMask = 0x00FF0000;
+ bmh.bV4GreenMask = 0x0000FF00;
+ bmh.bV4BlueMask = 0x000000FF;
+
+ ii.fIcon = TRUE;
+ ii.xHotspot = 0; /* ignored */
+ ii.yHotspot = 0; /* ignored */
+ ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh,
DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
0);
- ReleaseDC(NULL, hdc);
- ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
- memcpy(DIB_pixels, pixels, height * width * 4);
+ ReleaseDC(NULL, hdc);
+ ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
+ memcpy(DIB_pixels, pixels, height*width*4);
- /* CreateIconIndirect() traditionally required DDBitmaps */
- /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */
- /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */
- result = CreateIconIndirect(&ii);
+ /* CreateIconIndirect() traditionally required DDBitmaps */
+ /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */
+ /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */
+ result = CreateIconIndirect(&ii);
- DeleteObject(ii.hbmColor);
- DeleteObject(ii.hbmMask);
+ DeleteObject(ii.hbmColor);
+ DeleteObject(ii.hbmMask);
- winDebug("NetWMToWinIconAlpha - %d x %d = %p\n", icon[0], icon[1], result);
- return result;
+ winDebug("NetWMToWinIconAlpha - %d x %d = %p\n", icon[0], icon[1], result);
+ return result;
}
static HICON
-NetWMToWinIconThreshold(uint32_t * icon)
+NetWMToWinIconThreshold(uint32_t *icon)
{
- int width = icon[0];
- int height = icon[1];
- uint32_t *pixels = &icon[2];
- int row, col;
- HICON result;
- ICONINFO ii = { TRUE };
-
- HDC hdc = GetDC(NULL);
- HDC xorDC = CreateCompatibleDC(hdc);
- HDC andDC = CreateCompatibleDC(hdc);
-
- ii.hbmColor = CreateCompatibleBitmap(hdc, width, height);
- ii.hbmMask = CreateCompatibleBitmap(hdc, width, height);
- ReleaseDC(NULL, hdc);
- SelectObject(xorDC, ii.hbmColor);
- SelectObject(andDC, ii.hbmMask);
-
- for (row = 0; row < height; row++) {
- for (col = 0; col < width; col++) {
- if ((*pixels & 0xFF000000) > 31 << 24) { /* 31 alpha threshold, i.e. opaque above, transparent below */
+ int width = icon[0];
+ int height = icon[1];
+ uint32_t *pixels = &icon[2];
+ int row, col;
+ HICON result;
+ ICONINFO ii;
+
+ HDC hdc = GetDC(NULL);
+ HDC xorDC = CreateCompatibleDC(hdc);
+ HDC andDC = CreateCompatibleDC(hdc);
+
+ ii.fIcon = TRUE;
+ ii.xHotspot = 0; /* ignored */
+ ii.yHotspot = 0; /* ignored */
+ ii.hbmColor = CreateCompatibleBitmap(hdc, width, height);
+ ii.hbmMask = CreateCompatibleBitmap(hdc, width, height);
+ ReleaseDC(NULL, hdc);
+ SelectObject(xorDC, ii.hbmColor);
+ SelectObject(andDC, ii.hbmMask);
+
+ for (row = 0; row < height; row++) {
+ for (col = 0; col < width; col++) {
+ if ((*pixels & 0xFF000000) > 31<<24) { /* 31 alpha threshold, i.e. opaque above, transparent below */
SetPixelV(xorDC, col, row,
RGB(((char *) pixels)[2], ((char *) pixels)[1],
- ((char *) pixels)[0]));
- SetPixelV(andDC, col, row, RGB(0, 0, 0)); /* black mask */
- }
- else {
- SetPixelV(xorDC, col, row, RGB(0, 0, 0));
- SetPixelV(andDC, col, row, RGB(255, 255, 255)); /* white mask */
- }
- pixels++;
- }
+ ((char*)pixels)[0]));
+ SetPixelV(andDC, col, row, RGB(0, 0, 0)); /* black mask */
+ }
+ else {
+ SetPixelV(xorDC, col, row, RGB(0, 0, 0));
+ SetPixelV(andDC, col, row, RGB(255, 255, 255)); /* white mask */
+ }
+ pixels++;
}
- DeleteDC(xorDC);
- DeleteDC(andDC);
+ }
+ DeleteDC(xorDC);
+ DeleteDC(andDC);
- result = CreateIconIndirect(&ii);
+ result = CreateIconIndirect(&ii);
- DeleteObject(ii.hbmColor);
- DeleteObject(ii.hbmMask);
+ DeleteObject(ii.hbmColor);
+ DeleteObject(ii.hbmMask );
winDebug("NetWMToWinIconThreshold - %d x %d = %p\n", icon[0], icon[1],
result);
- return result;
+ return result;
}
static HICON
-NetWMToWinIcon(int bpp, uint32_t * icon)
+NetWMToWinIcon(int bpp, uint32_t *icon)
{
- static Bool hasIconAlphaChannel = FALSE;
- static BOOL versionChecked = FALSE;
+ static Bool hasIconAlphaChannel = FALSE;
+ static BOOL versionChecked = FALSE;
if (!versionChecked) {
- OSVERSIONINFOEX osvi = { 0 };
- ULONGLONG dwlConditionMask = 0;
+ OSVERSIONINFOEX osvi = {0};
+ ULONGLONG dwlConditionMask = 0;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- osvi.dwMajorVersion = 5;
- osvi.dwMinorVersion = 1;
+ osvi.dwOSVersionInfoSize = sizeof (osvi);
+ osvi.dwMajorVersion = 5;
+ osvi.dwMinorVersion = 1;
- /* Windows versions later than XP have icon alpha channel suport, 2000 does not */
+ /* Windows versions later than XP have icon alpha channel suport, 2000 does not */
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION,
VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION,
@@ -353,284 +352,282 @@ NetWMToWinIcon(int bpp, uint32_t * icon)
hasIconAlphaChannel =
VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION,
dwlConditionMask);
- versionChecked = TRUE;
+ versionChecked = TRUE;
ErrorF("OS has icon alpha channel support: %s\n",
hasIconAlphaChannel ? "yes" : "no");
}
- if (hasIconAlphaChannel && (bpp == 32))
- return NetWMToWinIconAlpha(icon);
- else
- return NetWMToWinIconThreshold(icon);
-}
-
-static pointer
-GetWindowProp(WindowPtr pWin, Atom name, long int *size_return)
-{
- struct _Window *pwin;
- struct _Property *prop;
-
- if (!pWin || !name) {
- ErrorF("GetWindowProp - pWin or name was NULL\n");
- return 0;
- }
- pwin = (struct _Window *) pWin;
- if (!pwin->optional)
- return NULL;
- for (prop = (struct _Property *) pwin->optional->userProps;
- prop; prop = prop->next) {
- if (prop->propertyName == name) {
- *size_return = prop->size;
- return prop->data;
- }
- }
- return NULL;
+ if (hasIconAlphaChannel && (bpp==32))
+ return NetWMToWinIconAlpha(icon);
+ else
+ return NetWMToWinIconThreshold(icon);
}
/*
* Attempt to create a custom icon from the WM_HINTS bitmaps
*/
+static
HICON
-winXIconToHICON(WindowPtr pWin, int iconSize)
+winXIconToHICON (Display *pDisplay, Window id, int iconSize)
{
- unsigned char *mask, *image, *imageMask;
- unsigned char *dst, *src;
- PixmapPtr iconPtr;
- PixmapPtr maskPtr;
- int planes, bpp, effBPP, stride, maskStride, i;
- int biggest_size = 0;
- HDC hDC;
- ICONINFO ii;
- WinXWMHints hints;
- HICON hIcon = NULL;
- uint32_t *biggest_icon = NULL;
-
- /* Try to get _NET_WM_ICON icons first */
- static Atom _XA_NET_WM_ICON;
- static int generation;
- uint32_t *icon, *icon_data = NULL;
- long int size = 0;
-
- hDC = GetDC(GetDesktopWindow());
- planes = GetDeviceCaps(hDC, PLANES);
- bpp = GetDeviceCaps(hDC, BITSPIXEL);
- ReleaseDC(GetDesktopWindow(), hDC);
-
- if (generation != serverGeneration) {
- generation = serverGeneration;
- _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, TRUE);
- }
-
- if (_XA_NET_WM_ICON)
- icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size);
- if (icon_data) {
- for (icon = icon_data;
- icon < &icon_data[size] && *icon;
- icon = &icon[icon[0] * icon[1] + 2]) {
- if (icon[0] == iconSize && icon[1] == iconSize)
- return NetWMToWinIcon(bpp, icon);
- /* Find the biggest icon and let Windows scale the size */
- else if (biggest_size < icon[0]) {
- biggest_icon = icon;
- biggest_size = icon[0];
+ unsigned char *mask, *image = NULL, *imageMask;
+ unsigned char *dst, *src;
+ int planes, bpp, i;
+ int biggest_size = 0;
+ HDC hDC;
+ ICONINFO ii;
+ XWMHints *hints;
+ HICON hIcon = NULL;
+ uint32_t *biggest_icon = NULL;
+
+ static Atom _XA_NET_WM_ICON;
+ static int generation;
+ uint32_t *icon, *icon_data = NULL;
+ unsigned long int size;
+ unsigned long int type;
+ int format;
+ unsigned long int left;
+
+ hDC = GetDC (GetDesktopWindow ());
+ planes = GetDeviceCaps (hDC, PLANES);
+ bpp = GetDeviceCaps (hDC, BITSPIXEL);
+ ReleaseDC (GetDesktopWindow (), hDC);
+
+ /* Always prefer _NET_WM_ICON icons */
+ if (generation != serverGeneration) {
+ generation = serverGeneration;
+ _XA_NET_WM_ICON = XInternAtom(pDisplay, "_NET_WM_ICON", FALSE);
+ }
+
+ if ((XGetWindowProperty(pDisplay, id, _XA_NET_WM_ICON,
+ 0, MAXINT, FALSE,
+ AnyPropertyType, &type, &format, &size, &left, (unsigned char **)&icon_data) == Success) &&
+ (icon_data != NULL))
+ {
+ for(icon = icon_data;
+ icon < &icon_data[size] && *icon;
+ icon = &icon[icon[0]*icon[1]+2])
+ {
+ /* Find an exact match to the size we require... */
+ if (icon[0]==iconSize && icon[1]==iconSize)
+ {
+ winDebug("winXIconToHICON: found %lu x %lu NetIcon\n", icon[0], icon[1]);
+ hIcon = NetWMToWinIcon(bpp, icon);
+ break;
}
+ /* Otherwise, find the biggest icon and let Windows scale the size */
+ else if (biggest_size < icon[0])
+ {
+ biggest_icon = icon;
+ biggest_size = icon[0];
+ }
+ }
+
+ if (!hIcon && biggest_icon)
+ {
+ winDebug("winXIconToHICON: selected %lu x %lu NetIcon for scaling to %u x %u\n",
+ biggest_icon[0], biggest_icon[1], iconSize, iconSize);
+
+ hIcon = NetWMToWinIcon(bpp, biggest_icon);
}
- if (biggest_icon)
- return NetWMToWinIcon(bpp, biggest_icon);
+
+ XFree(icon_data);
}
- winDebug("winXIconToHICON - pWin %x: no suitable NetIcon\n", (int) pWin,
- iconSize);
- winMultiWindowGetWMHints(pWin, &hints);
- if (!hints.icon_pixmap)
- return NULL;
+ if (!hIcon)
+ {
+ winDebug("winXIconToHICON: no suitable NetIcon\n");
- dixLookupResourceByType((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP,
- NullClient, DixUnknownAccess);
+ hints = XGetWMHints(pDisplay, id);
+ if (hints)
+ {
+ winDebug("winXIconToHICON: id 0x%x icon_pixmap hint %x\n", id, hints->icon_pixmap);
- if (!iconPtr)
- return NULL;
+ if (hints->icon_pixmap)
+ {
+ Window root;
+ int x, y;
+ unsigned int width, height, border_width, depth;
+ XImage *xImageIcon;
+ XImage *xImageMask = NULL;
- /* 15 BPP is really 16BPP as far as we care */
- if (bpp == 15)
- effBPP = 16;
- else
- effBPP = bpp;
+ XGetGeometry(pDisplay, hints->icon_pixmap, &root, &x, &y, &width, &height, &border_width, &depth);
- /* Need 16-bit aligned rows for DDBitmaps */
- stride = ((iconSize * effBPP + 15) & (~15)) / 8;
+ xImageIcon = XGetImage(pDisplay, hints->icon_pixmap, 0, 0, width, height, 0xFFFFFFFF, ZPixmap);
+ winDebug("winXIconToHICON: id 0x%x icon Ximage 0x%x\n", id, xImageIcon);
- /* Mask is 1-bit deep */
- maskStride = ((iconSize * 1 + 15) & (~15)) / 8;
+ if (hints->icon_mask)
+ xImageMask = XGetImage(pDisplay, hints->icon_mask, 0, 0, width, height, 0xFFFFFFFF, ZPixmap);
- image = malloc(stride * iconSize);
- imageMask = malloc(stride * iconSize);
- /* Default to a completely black mask */
- mask = calloc(maskStride, iconSize);
+ if (xImageIcon)
+ {
+ int effBPP, stride, maskStride;
- winScaleXBitmapToWindows(iconSize, effBPP, iconPtr, image);
- dixLookupResourceByType((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP,
- NullClient, DixUnknownAccess);
+ /* 15 BPP is really 16BPP as far as we care */
+ if (bpp == 15)
+ effBPP = 16;
+ else
+ effBPP = bpp;
- if (maskPtr) {
- winScaleXBitmapToWindows(iconSize, 1, maskPtr, mask);
+ /* Need 16-bit aligned rows for DDBitmaps */
+ stride = ((iconSize * effBPP + 15) & (~15)) / 8;
- winScaleXBitmapToWindows(iconSize, effBPP, maskPtr, imageMask);
+ /* Mask is 1-bit deep */
+ maskStride = ((iconSize * 1 + 15) & (~15)) / 8;
- /* Now we need to set all bits of the icon which are not masked */
- /* on to 0 because Color is really an XOR, not an OR function */
- dst = image;
- src = imageMask;
+ image = malloc (stride * iconSize);
+ imageMask = malloc (stride * iconSize);
+ mask = malloc (maskStride * iconSize);
- for (i = 0; i < (stride * iconSize); i++)
- if ((*(src++)))
- *(dst++) = 0;
- else
- dst++;
- }
+ /* Default to a completely black mask */
+ memset(imageMask, 0, stride * iconSize);
+ memset(mask, 0, maskStride * iconSize);
+
+ winScaleXImageToWindowsIcon(iconSize, effBPP, stride, xImageIcon, image);
+
+ if (xImageMask)
+ {
+ winScaleXImageToWindowsIcon(iconSize, 1, maskStride, xImageMask, mask);
+ winScaleXImageToWindowsIcon(iconSize, effBPP, stride, xImageMask, imageMask);
+ }
+
+ /* Now we need to set all bits of the icon which are not masked */
+ /* on to 0 because Color is really an XOR, not an OR function */
+ dst = image;
+ src = imageMask;
+
+ for (i = 0; i < (stride * iconSize); i++)
+ if ((*(src++)))
+ *(dst++) = 0;
+ else
+ dst++;
+
+ ii.fIcon = TRUE;
+ ii.xHotspot = 0; /* ignored */
+ ii.yHotspot = 0; /* ignored */
+
+ /* Create Win32 mask from pixmap shape */
+ ii.hbmMask = CreateBitmap (iconSize, iconSize, planes, 1, mask);
- ii.fIcon = TRUE;
- ii.xHotspot = 0; /* ignored */
- ii.yHotspot = 0; /* ignored */
+ /* Create Win32 bitmap from pixmap */
+ ii.hbmColor = CreateBitmap (iconSize, iconSize, planes, bpp, image);
- /* Create Win32 mask from pixmap shape */
- ii.hbmMask = CreateBitmap(iconSize, iconSize, planes, 1, mask);
+ /* Merge Win32 mask and bitmap into icon */
+ hIcon = CreateIconIndirect (&ii);
- /* Create Win32 bitmap from pixmap */
- ii.hbmColor = CreateBitmap(iconSize, iconSize, planes, bpp, image);
+ /* Release Win32 mask and bitmap */
+ DeleteObject (ii.hbmMask);
+ DeleteObject (ii.hbmColor);
- /* Merge Win32 mask and bitmap into icon */
- hIcon = CreateIconIndirect(&ii);
+ /* Free X mask and bitmap */
+ free (mask);
+ free (image);
+ free (imageMask);
- /* Release Win32 mask and bitmap */
- DeleteObject(ii.hbmMask);
- DeleteObject(ii.hbmColor);
+ if (xImageMask)
+ XDestroyImage(xImageMask);
- /* Free X mask and bitmap */
- free(mask);
- free(image);
- free(imageMask);
+ XDestroyImage(xImageIcon);
+ }
+ }
+ XFree(hints);
+ }
+ }
- return hIcon;
+ return hIcon;
}
/*
- * Change the Windows window icon
+ * Change the Windows window icon
*/
#ifdef XWIN_MULTIWINDOW
void
-winUpdateIcon(Window id)
+winUpdateIcon (HWND hWnd, Display *pDisplay, Window id, HICON hIconNew)
{
- WindowPtr pWin;
- HICON hIcon, hIconSmall = NULL, hIconOld;
-
- dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
- DixUnknownAccess);
- if (pWin) {
- winWindowPriv(pWin);
- if (pWinPriv->hWnd) {
- hIcon = winOverrideIcon((unsigned long) pWin);
- if (!hIcon) {
- hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));
- if (!hIcon) {
- hIcon = g_hIconX;
- hIconSmall = g_hSmallIconX;
- }
- else {
- /* Leave undefined if not found */
- hIconSmall =
- winXIconToHICON(pWin, GetSystemMetrics(SM_CXSMICON));
- }
- }
-
- /* Set the large icon */
- hIconOld = (HICON) SendMessage(pWinPriv->hWnd,
- WM_SETICON, ICON_BIG,
- (LPARAM) hIcon);
+ HICON hIcon, hIconSmall=NULL, hIconOld;
+
+ /* Start with the icon from preferences, if any */
+ hIcon = hIconNew;
+ hIconSmall = hIconNew;
+
+ /* If we still need an icon, try and get the icon from WM_HINTS */
+ if (!hIcon)
+ hIcon = winXIconToHICON(pDisplay, id, GetSystemMetrics(SM_CXICON));
+ if (!hIconSmall)
+ hIconSmall = winXIconToHICON (pDisplay, id, GetSystemMetrics(SM_CXSMICON));
+
+ /* If we got the small, but not the large one swap them */
+ if (!hIcon && hIconSmall)
+ {
+ hIcon = hIconSmall;
+ hIconSmall = NULL;
+ }
- /* Delete the icon if its not the default */
- winDestroyIcon(hIconOld);
+ /* Set the large icon */
+ hIconOld = (HICON) SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
+ /* Delete the old icon if its not the default */
+ winDestroyIcon(hIconOld);
- /* Same for the small icon */
- hIconOld = (HICON) SendMessage(pWinPriv->hWnd,
- WM_SETICON, ICON_SMALL,
- (LPARAM) hIconSmall);
- winDestroyIcon(hIconOld);
- }
- }
+ /* Same for the small icon */
+ hIconOld = (HICON) SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
+ winDestroyIcon(hIconOld);
}
void
winInitGlobalIcons(void)
{
- int sm_cx = GetSystemMetrics(SM_CXICON);
- int sm_cxsm = GetSystemMetrics(SM_CXSMICON);
+ int sm_cx = GetSystemMetrics(SM_CXICON);
+ int sm_cxsm = GetSystemMetrics(SM_CXSMICON);
- /* Load default X icon in case it's not ready yet */
+ /* Load default X icon in case it's not ready yet */
if (!g_hIconX) {
- g_hIconX = winOverrideDefaultIcon(sm_cx);
- g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm);
+ g_hIconX = winOverrideDefaultIcon(sm_cx);
+ g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm);
}
if (!g_hIconX) {
- g_hIconX = (HICON) LoadImage(g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN),
- IMAGE_ICON,
- GetSystemMetrics(SM_CXICON),
+ g_hIconX = (HICON)LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), 0);
- g_hSmallIconX = (HICON) LoadImage(g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN),
- IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON),
- GetSystemMetrics(SM_CYSMICON),
- LR_DEFAULTSIZE);
+ g_hSmallIconX = (HICON)LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON),
+ LR_DEFAULTSIZE);
}
}
void
-winSelectIcons(WindowPtr pWin, HICON * pIcon, HICON * pSmallIcon)
+winSelectIcons(HICON *pIcon, HICON *pSmallIcon)
{
- HICON hIcon, hSmallIcon;
-
- winInitGlobalIcons();
+ HICON hIcon, hSmallIcon;
- /* Try and get the icon from WM_HINTS */
- hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));
- hSmallIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXSMICON));
+ winInitGlobalIcons();
- /* If we got the small, but not the large one swap them */
- if (!hIcon && hSmallIcon) {
- hIcon = hSmallIcon;
- hSmallIcon = NULL;
- }
-
- /* Use default X icon if no icon loaded from WM_HINTS */
- if (!hIcon) {
- hIcon = g_hIconX;
- hSmallIcon = g_hSmallIconX;
- }
+ /* Use default X icon */
+ hIcon = g_hIconX;
+ hSmallIcon = g_hSmallIconX;
- if (pIcon)
- *pIcon = hIcon;
- else
- winDestroyIcon(hIcon);
+ if (pIcon)
+ *pIcon = hIcon;
- if (pSmallIcon)
- *pSmallIcon = hSmallIcon;
- else
- winDestroyIcon(hSmallIcon);
+ if (pSmallIcon)
+ *pSmallIcon = hSmallIcon;
}
void
winDestroyIcon(HICON hIcon)
{
- /* Delete the icon if its not one of the application defaults or an override */
- if (hIcon &&
- hIcon != g_hIconX &&
+ /* Delete the icon if its not one of the application defaults or an override */
+ if (hIcon &&
+ hIcon != g_hIconX &&
hIcon != g_hSmallIconX && !winIconIsOverride((unsigned long) hIcon))
- DestroyIcon(hIcon);
+ DestroyIcon (hIcon);
}
#endif
diff --git a/hw/xwin/winmultiwindowicons.h b/hw/xwin/winmultiwindowicons.h
new file mode 100644
index 000000000..72adfe27b
--- /dev/null
+++ b/hw/xwin/winmultiwindowicons.h
@@ -0,0 +1,42 @@
+/*
+ * File: winmultiwindowicons.h
+ * Purpose: interface for multiwindow mode icon functions
+ *
+ * Copyright (c) Jon TURNEY 2012
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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 WINMULTIWINDOWICONS_H
+#define WINMULTIWINDOWICONS_H
+
+void
+winUpdateIcon (HWND hWnd, Display *pDisplay, Window id, HICON hIconNew);
+
+void
+winInitGlobalIcons (void);
+
+void
+winDestroyIcon(HICON hIcon);
+
+void
+winSelectIcons(HICON *pIcon, HICON *pSmallIcon);
+
+#endif /* WINMULTIWINDOWICONS_H */
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 0093fcbb1..79655b7ba 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -44,45 +44,91 @@
*/
void
- winCreateWindowsWindow(WindowPtr pWin);
+winCreateWindowsWindow (WindowPtr pWin);
static void
- winDestroyWindowsWindow(WindowPtr pWin);
+winDestroyWindowsWindow (WindowPtr pWin);
static void
- winUpdateWindowsWindow(WindowPtr pWin);
+winUpdateWindowsWindow (WindowPtr pWin);
static void
- winFindWindow(pointer value, XID id, pointer cdata);
+winFindWindow (pointer value, XID id, pointer cdata);
+
+static Bool
+isToplevelWindow(WindowPtr pWin)
+{
+ assert(pWin->parent); /* root window isn't expected here */
+
+ /* If the immediate parent is the root window, this is a top-level window */
+ if ((pWin->parent) && (pWin->parent->parent == NULL))
+ {
+ assert(pWin->parent == pWin->drawable.pScreen->root);
+ return TRUE;
+ }
+
+ /* otherwise, a child window */
+ return FALSE;
+}
static
void
winInitMultiWindowClass(void)
{
- static wATOM atomXWinClass = 0;
- WNDCLASSEX wcx;
-
- if (atomXWinClass == 0) {
- /* Setup our window class */
- wcx.cbSize = sizeof(WNDCLASSEX);
- wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
- wcx.lpfnWndProc = winTopLevelWindowProc;
- wcx.cbClsExtra = 0;
- wcx.cbWndExtra = 0;
- wcx.hInstance = g_hInstance;
- wcx.hIcon = g_hIconX;
- wcx.hCursor = 0;
- wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
- wcx.lpszMenuName = NULL;
- wcx.lpszClassName = WINDOW_CLASS_X;
- wcx.hIconSm = g_hSmallIconX;
+ static wATOM atomXWinClass=0;
+ static wATOM atomXWinChildClass = 0;
+ WNDCLASSEX wcx;
+
+ if (atomXWinClass==0)
+ {
+ HICON hIcon, hIconSmall;
+
+ /* Load the default icons */
+ winSelectIcons(&hIcon, &hIconSmall);
+
+ /* Setup our window class */
+ wcx.cbSize=sizeof(WNDCLASSEX);
+ wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
+ wcx.lpfnWndProc = winTopLevelWindowProc;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = g_hInstance;
+ wcx.hIcon = hIcon;
+ wcx.hCursor = 0;
+ wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = WINDOW_CLASS_X;
+ wcx.hIconSm = hIconSmall;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X);
+ ErrorF ("winInitMultiWindowClass - Creating class: %s\n", WINDOW_CLASS_X);
#endif
- atomXWinClass = RegisterClassEx(&wcx);
- }
+ atomXWinClass = RegisterClassEx (&wcx);
+ }
+
+ if (atomXWinChildClass==0)
+ {
+ /* Setup our window class */
+ wcx.cbSize=sizeof(WNDCLASSEX);
+ wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
+ wcx.lpfnWndProc = winChildWindowProc;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = g_hInstance;
+ wcx.hIcon = g_hIconX;
+ wcx.hCursor = 0;
+ wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = WINDOW_CLASS_X_CHILD;
+ wcx.hIconSm = g_hSmallIconX;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winInitMultiWindowClass - Creating class: %s\n", WINDOW_CLASS_X_CHILD);
+#endif
+
+ atomXWinChildClass = RegisterClassEx (&wcx);
+ }
}
/*
@@ -90,32 +136,32 @@ winInitMultiWindowClass(void)
*/
Bool
-winCreateWindowMultiWindow(WindowPtr pWin)
+winCreateWindowMultiWindow (WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- winTrace("winCreateWindowMultiWindow - pWin: %p\n", pWin);
+ winTrace ("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif
-
- WIN_UNWRAP(CreateWindow);
- fResult = (*pScreen->CreateWindow) (pWin);
- WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
-
- /* Initialize some privates values */
- pWinPriv->hRgn = NULL;
- pWinPriv->hWnd = NULL;
- pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
- pWinPriv->fXKilled = FALSE;
+
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
+
+ /* Initialize some privates values */
+ pWinPriv->hRgn = NULL;
+ pWinPriv->hWnd = NULL;
+ pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
+ pWinPriv->fXKilled = FALSE;
#ifdef XWIN_GLX_WINDOWS
- pWinPriv->fWglUsed = FALSE;
+ pWinPriv->fWglUsed = FALSE;
#endif
- return fResult;
+ return fResult;
}
/*
@@ -123,29 +169,29 @@ winCreateWindowMultiWindow(WindowPtr pWin)
*/
Bool
-winDestroyWindowMultiWindow(WindowPtr pWin)
+winDestroyWindowMultiWindow (WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
+ ErrorF ("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
#endif
-
- WIN_UNWRAP(DestroyWindow);
- fResult = (*pScreen->DestroyWindow) (pWin);
- WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
-
- /* Flag that the window has been destroyed */
- pWinPriv->fXKilled = TRUE;
-
- /* Kill the MS Windows window associated with this window */
- winDestroyWindowsWindow(pWin);
-
- return fResult;
+
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow)(pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
+
+ /* Flag that the window has been destroyed */
+ pWinPriv->fXKilled = TRUE;
+
+ /* Kill the MS Windows window associated with this window */
+ winDestroyWindowsWindow (pWin);
+
+ return fResult;
}
/*
@@ -157,115 +203,139 @@ winDestroyWindowMultiWindow(WindowPtr pWin)
*/
Bool
-winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
+winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
{
- Bool fResult = TRUE;
- int iX, iY, iWidth, iHeight;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool fResult = TRUE;
+ int iX, iY, iWidth, iHeight;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
- HWND hWnd = pWinPriv->hWnd;
- RECT rcNew;
- RECT rcOld;
+ HWND hWnd = pWinPriv->hWnd;
+ RECT rcNew;
+ RECT rcOld;
#if CYGMULTIWINDOW_DEBUG
- RECT rcClient;
- RECT *lpRc;
+ RECT rcClient;
+ RECT *lpRc;
#endif
- DWORD dwExStyle;
- DWORD dwStyle;
+ DWORD dwExStyle;
+ DWORD dwStyle;
#if CYGMULTIWINDOW_DEBUG
- winTrace("winPositionWindowMultiWindow - pWin: %p\n", pWin);
+ winTrace ("winPositionWindowMultiWindow - pWin: %p\n", pWin);
#endif
-
- WIN_UNWRAP(PositionWindow);
- fResult = (*pScreen->PositionWindow) (pWin, x, y);
- WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
-
+
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow)(pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
+
#if CYGWINDOWING_DEBUG
ErrorF("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", x, y);
#endif
- /* Bail out if the Windows window handle is bad */
+ /* Bail out if the Windows window handle is bad */
if (!hWnd) {
#if CYGWINDOWING_DEBUG
- ErrorF("\timmediately return since hWnd is NULL\n");
+ ErrorF ("\timmediately return since hWnd is NULL\n");
#endif
- return fResult;
+ return fResult;
}
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
+ if (!isToplevelWindow(pWin))
+ {
+ POINT parentOrigin;
- /* Get the X and Y location of the X window */
- iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* Get the height and width of the X window */
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
- /* Store the origin, height, and width in a rectangle structure */
- SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+ /* Convert screen coordinates into client area co-ordinates of the parent */
+ parentOrigin.x = 0;
+ parentOrigin.y = 0;
+ ClientToScreen(GetParent(hWnd), &parentOrigin);
-#if CYGMULTIWINDOW_DEBUG
- lpRc = &rcNew;
- ErrorF("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n",
- GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
-#endif
+ MoveWindow (hWnd,
+ iX - parentOrigin.x, iY - parentOrigin.y, iWidth, iHeight,
+ TRUE);
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle);
+ return fResult;
+ }
- /* Get a rectangle describing the old Windows window */
- GetWindowRect(hWnd, &rcOld);
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE);
+
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
#if CYGMULTIWINDOW_DEBUG
- /* Get a rectangle describing the Windows window client area */
- GetClientRect(hWnd, &rcClient);
+ lpRc = &rcNew;
+ ErrorF ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+#endif
- lpRc = &rcNew;
- ErrorF("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n",
- GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
- lpRc = &rcOld;
- ErrorF("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n",
- GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+ /* Get a rectangle describing the old Windows window */
+ GetWindowRect (hWnd, &rcOld);
- lpRc = &rcClient;
- ErrorF("(%d ms)rcClient (%d, %d)-(%d, %d)\n",
- GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+#if CYGMULTIWINDOW_DEBUG
+ /* Get a rectangle describing the Windows window client area */
+ GetClientRect (hWnd, &rcClient);
+
+ lpRc = &rcNew;
+ ErrorF ("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+
+ lpRc = &rcOld;
+ ErrorF ("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+
+ lpRc = &rcClient;
+ ErrorF ("(%d ms)rcClient (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
#endif
- /* Check if the old rectangle and new rectangle are the same */
+ /* Check if the old rectangle and new rectangle are the same */
if (!EqualRect(&rcNew, &rcOld)) {
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winPositionWindowMultiWindow - Need to move\n");
+ ErrorF ("winPositionWindowMultiWindow - Need to move\n");
#endif
#if CYGWINDOWING_DEBUG
- ErrorF("\tMoveWindow to (%ld, %ld) - %ldx%ld\n", rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ ErrorF ("\tMoveWindow to (%ld, %ld) - %ldx%ld\n", rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- /* Change the position and dimensions of the Windows window */
- MoveWindow(hWnd,
- rcNew.left, rcNew.top,
+ /* Change the position and dimensions of the Windows window */
+ MoveWindow (hWnd,
+ rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, TRUE);
}
else {
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winPositionWindowMultiWindow - Not need to move\n");
+ ErrorF ("winPositionWindowMultiWindow - Not need to move\n");
#endif
}
- return fResult;
+ return fResult;
}
/*
@@ -273,26 +343,26 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
*/
Bool
-winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask)
+winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
+ ErrorF ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
#endif
-
- WIN_UNWRAP(ChangeWindowAttributes);
- fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
- WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
-
- /*
- * NOTE: We do not currently need to do anything here.
- */
-
- return fResult;
+
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
+
+ /*
+ * NOTE: We do not currently need to do anything here.
+ */
+
+ return fResult;
}
/*
@@ -301,29 +371,29 @@ winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask)
*/
Bool
-winUnmapWindowMultiWindow(WindowPtr pWin)
+winUnmapWindowMultiWindow (WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
+ ErrorF ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
#endif
-
- WIN_UNWRAP(UnrealizeWindow);
- fResult = (*pScreen->UnrealizeWindow) (pWin);
- WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
-
- /* Flag that the window has been killed */
- pWinPriv->fXKilled = TRUE;
-
- /* Destroy the Windows window associated with this X window */
- winDestroyWindowsWindow(pWin);
-
- return fResult;
+
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow)(pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
+
+ /* Flag that the window has been killed */
+ pWinPriv->fXKilled = TRUE;
+
+ /* Destroy the Windows window associated with this X window */
+ winDestroyWindowsWindow (pWin);
+
+ return fResult;
}
/*
@@ -332,33 +402,33 @@ winUnmapWindowMultiWindow(WindowPtr pWin)
*/
Bool
-winMapWindowMultiWindow(WindowPtr pWin)
+winMapWindowMultiWindow (WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winMapWindowMultiWindow - pWin: %08x\n", pWin);
+ ErrorF ("winMapWindowMultiWindow - pWin: %08x\n", pWin);
#endif
-
- WIN_UNWRAP(RealizeWindow);
- fResult = (*pScreen->RealizeWindow) (pWin);
- WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
-
- /* Flag that this window has not been destroyed */
- pWinPriv->fXKilled = FALSE;
-
- /* Refresh/redisplay the Windows window associated with this X window */
- winUpdateWindowsWindow(pWin);
-
- /* Update the Windows window's shape */
- winReshapeMultiWindow(pWin);
- winUpdateRgnMultiWindow(pWin);
-
- return fResult;
+
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow)(pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
+
+ /* Flag that this window has not been destroyed */
+ pWinPriv->fXKilled = FALSE;
+
+ /* Refresh/redisplay the Windows window associated with this X window */
+ winUpdateWindowsWindow (pWin);
+
+ /* Update the Windows window's shape */
+ winReshapeMultiWindow (pWin);
+ winUpdateRgnMultiWindow (pWin);
+
+ return fResult;
}
/*
@@ -366,24 +436,24 @@ winMapWindowMultiWindow(WindowPtr pWin)
*/
void
-winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent)
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
winDebug
("winReparentMultiWindow - pWin:%08x XID:0x%x, reparent from pWin:%08x XID:0x%x to pWin:%08x XID:0x%x\n",
pWin, pWin->drawable.id, pPriorParent, pPriorParent->drawable.id,
pWin->parent, pWin->parent->drawable.id);
- WIN_UNWRAP(ReparentWindow);
- if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow) (pWin, pPriorParent);
- WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
-
- /* Update the Windows window associated with this X window */
- winUpdateWindowsWindow(pWin);
+ WIN_UNWRAP(ReparentWindow);
+ if (pScreen->ReparentWindow)
+ (*pScreen->ReparentWindow)(pWin, pPriorParent);
+ WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
+
+ /* Update the Windows window associated with this X window */
+ winUpdateWindowsWindow (pWin);
}
/*
@@ -391,219 +461,310 @@ winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent)
*/
void
-winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib)
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
{
#if 0
- WindowPtr pPrevWin;
- UINT uFlags;
- HWND hInsertAfter;
- HWND hWnd = NULL;
+ WindowPtr pPrevWin;
+ UINT uFlags;
+ HWND hInsertAfter;
+ HWND hWnd = NULL;
#endif
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
- winTrace("winRestackMultiWindow - %08x\n", pWin);
+ winTrace ("winRestackMultiWindow - %08x\n", pWin);
#endif
-
- WIN_UNWRAP(RestackWindow);
- if (pScreen->RestackWindow)
- (*pScreen->RestackWindow) (pWin, pOldNextSib);
- WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
-
+
+ WIN_UNWRAP(RestackWindow);
+ if (pScreen->RestackWindow)
+ (*pScreen->RestackWindow)(pWin, pOldNextSib);
+ WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
+
#if 1
- /*
- * Calling winReorderWindowsMultiWindow here means our window manager
- * (i.e. Windows Explorer) has initiative to determine Z order.
- */
- if (pWin->nextSib != pOldNextSib)
- winReorderWindowsMultiWindow();
+ /*
+ * Calling winReorderWindowsMultiWindow here means our window manager
+ * (i.e. Windows Explorer) has initiative to determine Z order.
+ */
+ if (pWin->nextSib != pOldNextSib)
+ winReorderWindowsMultiWindow ();
#else
- /* Bail out if no window privates or window handle is invalid */
- if (!pWinPriv || !pWinPriv->hWnd)
- return;
+ /* Bail out if no window privates or window handle is invalid */
+ if (!pWinPriv || !pWinPriv->hWnd)
+ return;
- /* Get a pointer to our previous sibling window */
- pPrevWin = pWin->prevSib;
+ /* Get a pointer to our previous sibling window */
+ pPrevWin = pWin->prevSib;
- /*
- * Look for a sibling window with
- * valid privates and window handle
- */
+ /*
+ * Look for a sibling window with
+ * valid privates and window handle
+ */
while (pPrevWin && !winGetWindowPriv(pPrevWin)
- && !winGetWindowPriv(pPrevWin)->hWnd)
- pPrevWin = pPrevWin->prevSib;
-
- /* Check if we found a valid sibling */
+ && !winGetWindowPriv(pPrevWin)->hWnd)
+ pPrevWin = pPrevWin->prevSib;
+
+ /* Check if we found a valid sibling */
if (pPrevWin) {
- /* Valid sibling - get handle to insert window after */
- hInsertAfter = winGetWindowPriv(pPrevWin)->hWnd;
- uFlags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
-
- hWnd = GetNextWindow(pWinPriv->hWnd, GW_HWNDPREV);
+ /* Valid sibling - get handle to insert window after */
+ hInsertAfter = winGetWindowPriv(pPrevWin)->hWnd;
+ uFlags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
+
+ hWnd = GetNextWindow (pWinPriv->hWnd, GW_HWNDPREV);
do {
if (GetProp(hWnd, WIN_WINDOW_PROP)) {
if (hWnd == winGetWindowPriv(pPrevWin)->hWnd) {
- uFlags |= SWP_NOZORDER;
- }
- break;
- }
- hWnd = GetNextWindow(hWnd, GW_HWNDPREV);
- }
- while (hWnd);
+ uFlags |= SWP_NOZORDER;
+ }
+ break;
+ }
+ hWnd = GetNextWindow (hWnd, GW_HWNDPREV);
+ }
+ while (hWnd);
}
else {
- /* No valid sibling - make this window the top window */
- hInsertAfter = HWND_TOP;
- uFlags = SWP_NOMOVE | SWP_NOSIZE;
+ /* No valid sibling - make this window the top window */
+ hInsertAfter = HWND_TOP;
+ uFlags = SWP_NOMOVE | SWP_NOSIZE;
}
-
- /* Perform the restacking operation in Windows */
+
+ /* Perform the restacking operation in Windows */
SetWindowPos(pWinPriv->hWnd, hInsertAfter, 0, 0, 0, 0, uFlags);
#endif
}
-/*
- * winCreateWindowsWindow - Create a Windows window associated with an X window
- */
-
-void
-winCreateWindowsWindow(WindowPtr pWin)
+static void
+winCreateWindowsTopLevelWindow (WindowPtr pWin)
{
- int iX, iY;
- int iWidth;
- int iHeight;
- HWND hWnd;
- HWND hFore = NULL;
-
- winWindowPriv(pWin);
- HICON hIcon;
- HICON hIconSmall;
- winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
- WinXSizeHints hints;
- WindowPtr pDaddy;
- DWORD dwStyle, dwExStyle;
- RECT rc;
-
- winInitMultiWindowClass();
+ int iX, iY;
+ int iWidth;
+ int iHeight;
+ HWND hWnd;
+ HWND hFore = NULL;
+
+ winWindowPriv(pWin);
+ winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
+ WinXSizeHints hints;
+ WindowPtr pDaddy;
+ DWORD dwStyle, dwExStyle;
+ RECT rc;
+
+ winInitMultiWindowClass();
winDebug("winCreateWindowsTopLevelWindow - pWin:%08x XID:0x%x \n", pWin,
pWin->drawable.id);
- iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
- /* If it's an InputOutput window, and so is going to end up being made visible,
- make sure the window actually ends up somewhere where it will be visible */
+ /* If it's an InputOutput window, and so is going to end up being made visible,
+ make sure the window actually ends up somewhere where it will be visible */
if (pWin->drawable.class != InputOnly) {
if ((iX < GetSystemMetrics(SM_XVIRTUALSCREEN)) ||
(iX > GetSystemMetrics(SM_CXVIRTUALSCREEN)))
- iX = CW_USEDEFAULT;
+ iX = CW_USEDEFAULT;
if ((iY < GetSystemMetrics(SM_YVIRTUALSCREEN)) ||
(iY > GetSystemMetrics(SM_CYVIRTUALSCREEN)))
- iY = CW_USEDEFAULT;
+ iY = CW_USEDEFAULT;
}
- winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX,
- iY);
+ winDebug("winCreateWindowsTopLevelWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
if (winMultiWindowGetTransientFor(pWin, &pDaddy)) {
if (pDaddy) {
- hFore = GetForegroundWindow();
+ hFore = GetForegroundWindow();
if (hFore && (pDaddy != (WindowPtr) GetProp(hFore, WIN_WID_PROP)))
hFore = NULL;
- }
+ }
}
else {
- /* Default positions if none specified */
- if (!winMultiWindowGetWMNormalHints(pWin, &hints))
- hints.flags = 0;
- if (!(hints.flags & (USPosition | PPosition)) &&
+ /* Default positions if none specified */
+ if (!winMultiWindowGetWMNormalHints(pWin, &hints))
+ hints.flags = 0;
+ if (!(hints.flags & (USPosition|PPosition)) &&
!pWin->overrideRedirect) {
- iX = CW_USEDEFAULT;
- iY = CW_USEDEFAULT;
- }
+ iX = CW_USEDEFAULT;
+ iY = CW_USEDEFAULT;
+ }
}
- /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */
- /* CW_USEDEFAULT, change back to popup after creation */
- dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
- dwExStyle = WS_EX_TOOLWINDOW;
-
- /*
- Calculate the window coordinates containing the requested client area,
- being careful to preseve CW_USEDEFAULT
- */
- rc.top = (iY != CW_USEDEFAULT) ? iY : 0;
- rc.left = (iX != CW_USEDEFAULT) ? iX : 0;
- rc.bottom = rc.top + iHeight;
- rc.right = rc.left + iWidth;
- AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
+ winDebug("winCreateWindowsTopLevelWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
+
+ /* Create the window */
+ /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */
+ /* CW_USEDEFAULT, change back to popup after creation */
+ dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+ dwExStyle = WS_EX_TOOLWINDOW;
+
+ /*
+ Calculate the window coordinates containing the requested client area,
+ being careful to preseve CW_USEDEFAULT
+ */
+ rc.top = (iY != CW_USEDEFAULT) ? iY : 0;
+ rc.left = (iX != CW_USEDEFAULT) ? iX : 0;
+ rc.bottom = rc.top + iHeight;
+ rc.right = rc.left + iWidth;
+ AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
if (iY != CW_USEDEFAULT)
iY = rc.top;
if (iX != CW_USEDEFAULT)
iX = rc.left;
- iHeight = rc.bottom - rc.top;
- iWidth = rc.right - rc.left;
+ iHeight = rc.bottom - rc.top;
+ iWidth = rc.right - rc.left;
winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX,
iY);
- /* Create the window */
- hWnd = CreateWindowExA(dwExStyle, /* Extended styles */
- WINDOW_CLASS_X, /* Class name */
- WINDOW_TITLE_X, /* Window name */
- dwStyle, /* Styles */
- iX, /* Horizontal position */
- iY, /* Vertical position */
- iWidth, /* Right edge */
- iHeight, /* Bottom edge */
- hFore, /* Null or Parent window if transient */
- (HMENU) NULL, /* No menu */
- GetModuleHandle(NULL), /* Instance handle */
- pWin); /* ScreenPrivates */
- if (hWnd == NULL) {
- ErrorF("winCreateWindowsWindow - CreateWindowExA () failed: %d\n",
- (int) GetLastError());
+ /* Create the window */
+ hWnd = CreateWindowExA (dwExStyle, /* Extended styles */
+ WINDOW_CLASS_X, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
+ dwStyle, /* Styles */
+ iX, /* Horizontal position */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ hFore, /* Null or Parent window if transient*/
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL), /* Instance handle */
+ pWin); /* ScreenPrivates */
+ if (hWnd == NULL)
+ {
+ ErrorF ("winCreateWindowsTopLevelWindow - CreateWindowExA () failed: %d\n",
+ (int) GetLastError ());
}
- pWinPriv->hWnd = hWnd;
+ pWinPriv->hWnd = hWnd;
- /* Set application or .XWinrc defined Icons */
- winSelectIcons(pWin, &hIcon, &hIconSmall);
- if (hIcon)
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
- if (hIconSmall)
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
+ winDebug("winCreateWindowsTopLevelWindow - hwnd 0x%08x\n", hWnd);
- /* Change style back to popup, already placed... */
+ /* Change style back to popup, already placed... */
SetWindowLongPtr(hWnd, GWL_STYLE,
WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- SetWindowPos(hWnd, 0, 0, 0, 0, 0,
+ SetWindowPos (hWnd, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE |
SWP_NOACTIVATE);
- /* Adjust the X window to match the window placement we actually got... */
- winAdjustXWindow(pWin, hWnd);
+ /* Adjust the X window to match the window placement we actually got... */
+ winAdjustXWindow (pWin, hWnd);
+
+ /* Make sure it gets the proper system menu for a WS_POPUP, too */
+ GetSystemMenu (hWnd, TRUE);
+
+ /* Cause any .XWinrc menus to be added in main WNDPROC */
+ PostMessage (hWnd, WM_INIT_SYS_MENU, 0, 0);
+
+ SetProp (hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
+
+ /* Flag that this Windows window handles its own activation */
+ SetProp (hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
+
+ /* Call engine-specific create window procedure */
+ (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
+}
+
+static void
+winCreateWindowsChildWindow(WindowPtr pWin)
+{
+ int iX, iY, iWidth, iHeight;
+ HWND hWnd;
+ WindowPtr pParent = pWin->parent;
+ DWORD dwStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED;
+ DWORD dwExStyle = WS_EX_TRANSPARENT;
+ /*
+ WS_DISABLED means child window never gains the input focus, so only the
+ top-level window needs deal with passing input to the X server
+
+ WS_EX_TRANSPARENT ensures that the contents of the top-level
+ Windows window (which will contain all non-OpenGL drawing for the hierarchy)
+ can be seen through any intermediate child windows which have nothing
+ drawn to them
+ */
+ winPrivWinPtr pParentPriv, pWinPriv;
+
+ winDebug("winCreateWindowsChildWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
+
+ winInitMultiWindowClass();
+
+ assert(pParent);
+
+ pParentPriv = winGetWindowPriv(pParent);
+ pWinPriv = winGetWindowPriv(pWin);
+
+ iX = pWin->drawable.x - pParent->drawable.x;
+ iY = pWin->drawable.y - pParent->drawable.y;
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ winDebug("winCreateWindowsChildWindow - parent pWin:%08x XID:0x%08x hWnd:0x%08x\n", pParent, pParent->drawable.id, pParentPriv->hWnd);
+ winDebug("winCreateWindowsChildWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
+
+ /* Create the window */
+ hWnd = CreateWindowExA (dwExStyle, /* Extended styles */
+ WINDOW_CLASS_X_CHILD, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
+ dwStyle, /* Styles */
+ iX, /* Horizontal position */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ pParentPriv->hWnd, /* parent window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle(NULL),/* Instance handle */
+ pWin); /* ScreenPrivates */
+ if (hWnd == NULL)
+ {
+ ErrorF ("winCreateWindowsChildWindow - CreateWindowExA () failed: %d\n",
+ (int) GetLastError ());
+ }
+ winDebug("winCreateWindowsChildWindow - hwnd 0x%08x\n", hWnd);
+ pWinPriv->hWnd = hWnd;
+
+ SetProp(hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
+}
+
+/*
+ * winCreateWindowsWindow - Create a Windows window associated with an X window
+ */
+
+void
+winCreateWindowsWindow (WindowPtr pWin)
+{
+ winDebug("winCreateWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
- /* Make sure it gets the proper system menu for a WS_POPUP, too */
- GetSystemMenu(hWnd, TRUE);
+ if (isToplevelWindow(pWin))
+ {
+ winCreateWindowsTopLevelWindow(pWin);
+ }
+ else
+ {
+ winCreateWindowsChildWindow(pWin);
+ }
+}
- /* Cause any .XWinrc menus to be added in main WNDPROC */
- PostMessage(hWnd, WM_INIT_SYS_MENU, 0, 0);
+static int
+winDestroyChildWindowsWindow(WindowPtr pWin, pointer data)
+{
+ winWindowPriv(pWin);
+
+ winDebug("winDestroyChildWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
- SetProp(hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
+ SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
- /* Flag that this Windows window handles its own activation */
- SetProp(hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
+ /* Null our handle to the Window so referencing it will cause an error */
+ pWinPriv->hWnd = NULL;
- /* Call engine-specific create window procedure */
- (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
+#ifdef XWIN_GLX_WINDOWS
+ /* No longer note WGL used on this window */
+ pWinPriv->fWglUsed = FALSE;
+#endif
+
+ return WT_WALKCHILDREN; /* continue enumeration */
}
Bool winInDestroyWindowsWindow = FALSE;
@@ -613,53 +774,53 @@ Bool winInDestroyWindowsWindow = FALSE;
* with an X window
*/
static void
-winDestroyWindowsWindow(WindowPtr pWin)
+winDestroyWindowsWindow (WindowPtr pWin)
{
- MSG msg;
+ MSG msg;
- winWindowPriv(pWin);
- BOOL oldstate = winInDestroyWindowsWindow;
- HICON hIcon;
- HICON hIconSm;
+ winWindowPriv(pWin);
+ BOOL oldstate = winInDestroyWindowsWindow;
+ HICON hIcon;
+ HICON hIconSm;
+ HWND hWnd;
winDebug("winDestroyWindowsWindow - pWin:%08x XID:0x%x \n", pWin,
pWin->drawable.id);
- /* Bail out if the Windows window handle is invalid */
- if (pWinPriv->hWnd == NULL)
- return;
+ /* Bail out if the Windows window handle is invalid */
+ if (pWinPriv->hWnd == NULL)
+ return;
- winInDestroyWindowsWindow = TRUE;
+ winInDestroyWindowsWindow = TRUE;
- /* Store the info we need to destroy after this window is gone */
- hIcon = (HICON) SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
- hIconSm = (HICON) SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
+ /* Store the info we need to destroy after this window is gone */
+ hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
+ hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
- /* Destroy the Windows window */
- DestroyWindow(pWinPriv->hWnd);
+ hWnd = pWinPriv->hWnd;
- /* Null our handle to the Window so referencing it will cause an error */
- pWinPriv->hWnd = NULL;
+ /* DestroyWindow() implicitly destroys all child windows,
+ so first walk over the child tree of this window, clearing
+ any hWnds */
+ TraverseTree(pWin, winDestroyChildWindowsWindow, 0);
- /* Destroy any icons we created for this window */
- winDestroyIcon(hIcon);
- winDestroyIcon(hIconSm);
+ /* Destroy the Windows window */
+ DestroyWindow (hWnd);
-#ifdef XWIN_GLX_WINDOWS
- /* No longer note WGL used on this window */
- pWinPriv->fWglUsed = FALSE;
-#endif
+ /* Destroy any icons we created for this window */
+ winDestroyIcon(hIcon);
+ winDestroyIcon(hIconSm);
- /* Process all messages on our queue */
+ /* Process all messages on our queue */
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (g_hDlgDepthChange == 0 || !IsDialogMessage(g_hDlgDepthChange, &msg)) {
- DispatchMessage(&msg);
- }
+ DispatchMessage (&msg);
+ }
}
- winInDestroyWindowsWindow = oldstate;
+ winInDestroyWindowsWindow = oldstate;
- winDebug("winDestroyWindowsWindow - done\n");
+ winDebug("winDestroyWindowsWindow - done\n");
}
/*
@@ -668,38 +829,71 @@ winDestroyWindowsWindow(WindowPtr pWin)
*/
static void
-winUpdateWindowsWindow(WindowPtr pWin)
+winUpdateWindowsWindow (WindowPtr pWin)
{
- winWindowPriv(pWin);
- HWND hWnd = pWinPriv->hWnd;
+ winWindowPriv(pWin);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winUpdateWindowsWindow\n");
+ ErrorF ("winUpdateWindowsWindow\n");
#endif
- /* Check if the Windows window's parents have been destroyed */
- if (pWin->parent != NULL && pWin->parent->parent == NULL && pWin->mapped) {
- /* Create the Windows window if it has been destroyed */
- if (hWnd == NULL) {
- winCreateWindowsWindow(pWin);
- assert(pWinPriv->hWnd != NULL);
+
+ /* Ignore the root window */
+ if (pWin->parent == NULL)
+ return;
+
+ /* If it's mapped */
+ if (pWin->mapped)
+ {
+ /* If it's a top-level window */
+ if (isToplevelWindow(pWin))
+ {
+ /* Create the Windows window if needed */
+ if (pWinPriv->hWnd == NULL)
+ {
+ winCreateWindowsWindow (pWin);
+ assert (pWinPriv->hWnd != NULL);
+ }
+
+ /* Display the window without activating it */
+ if (pWin->drawable.class != InputOnly)
+ ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
+
+ }
+ /* It's not a top-level window, but we created a window for GLX */
+ else if (pWinPriv->hWnd)
+ {
+ winPrivWinPtr pParentPriv = winGetWindowPriv(pWin->parent);
+
+ /* XXX: This really belongs in winReparentWindow ??? */
+ /* XXX: this assumes parent window has been made to exist */
+ assert(pParentPriv->hWnd);
+
+ /* Ensure we have the correct parent and position if reparented */
+ SetParent(pWinPriv->hWnd, pParentPriv->hWnd);
+ SetWindowPos(pWinPriv->hWnd, NULL, pWin->drawable.x - pWin->parent->drawable.x, pWin->drawable.y - pWin->parent->drawable.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
}
- /* Display the window without activating it */
- if (pWin->drawable.class != InputOnly)
- ShowWindow(pWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ /* If it's top level, or a GLX window which has already been created getting mapped, show it */
+ if (pWinPriv->hWnd != NULL)
+ {
+ /* Display the window without activating it */
+ if (pWin->drawable.class != InputOnly)
+ ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
- /* Send first paint message */
- UpdateWindow(pWinPriv->hWnd);
+ /* Send first paint message */
+ UpdateWindow (pWinPriv->hWnd);
+ }
}
- else if (hWnd != NULL) {
- /* Destroy the Windows window if its parents are destroyed */
- winDestroyWindowsWindow(pWin);
- assert(pWinPriv->hWnd == NULL);
+ else if (pWinPriv->hWnd != NULL)
+ {
+ /* If it's been reparented to an unmapped window when previously mapped, destroy the Windows window */
+ winDestroyWindowsWindow (pWin);
+ assert(pWinPriv->hWnd == NULL);
}
#if CYGMULTIWINDOW_DEBUG
- ErrorF("-winUpdateWindowsWindow\n");
+ ErrorF ("-winUpdateWindowsWindow\n");
#endif
}
@@ -708,19 +902,19 @@ winUpdateWindowsWindow(WindowPtr pWin)
*/
XID
-winGetWindowID(WindowPtr pWin)
+winGetWindowID (WindowPtr pWin)
{
- WindowIDPairRec wi = { pWin, 0 };
- ClientPtr c = wClient(pWin);
-
- /* */
- FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi);
+ WindowIDPairRec wi = {pWin, 0};
+ ClientPtr c = wClient(pWin);
+
+ /* */
+ FindClientResourcesByType (c, RT_WINDOW, winFindWindow, &wi);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winGetWindowID - Window ID: %d\n", wi.id);
+ ErrorF ("winGetWindowID - Window ID: %d\n", wi.id);
#endif
- return wi.id;
+ return wi.id;
}
/*
@@ -728,12 +922,12 @@ winGetWindowID(WindowPtr pWin)
*/
static void
-winFindWindow(pointer value, XID id, pointer cdata)
+winFindWindow (pointer value, XID id, pointer cdata)
{
- WindowIDPairPtr wi = (WindowIDPairPtr) cdata;
+ WindowIDPairPtr wi = (WindowIDPairPtr)cdata;
if (value == wi->value) {
- wi->id = id;
+ wi->id = id;
}
}
@@ -742,58 +936,58 @@ winFindWindow(pointer value, XID id, pointer cdata)
*/
void
-winReorderWindowsMultiWindow(void)
+winReorderWindowsMultiWindow (void)
{
- HWND hwnd = NULL;
- WindowPtr pWin = NULL;
- WindowPtr pWinSib = NULL;
- XID vlist[2];
- static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
- DWORD dwCurrentProcessID = GetCurrentProcessId();
- DWORD dwWindowProcessID = 0;
+ HWND hwnd = NULL;
+ WindowPtr pWin = NULL;
+ WindowPtr pWinSib = NULL;
+ XID vlist[2];
+ static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
- winTrace("winReorderWindowsMultiWindow\n");
+ winTrace ("winReorderWindowsMultiWindow\n");
#endif
if (fRestacking) {
- /* It is a recusive call so immediately exit */
+ /* It is a recusive call so immediately exit */
#if CYGWINDOWING_DEBUG
- ErrorF("winReorderWindowsMultiWindow - "
- "exit because fRestacking == TRUE\n");
+ ErrorF ("winReorderWindowsMultiWindow - "
+ "exit because fRestacking == TRUE\n");
#endif
- return;
+ return;
}
- fRestacking = TRUE;
+ fRestacking = TRUE;
- /* Loop through top level Window windows, descending in Z order */
- for (hwnd = GetTopWindow(NULL);
+ /* Loop through top level Window windows, descending in Z order */
+ for ( hwnd = GetTopWindow (NULL);
hwnd; hwnd = GetNextWindow(hwnd, GW_HWNDNEXT)) {
- /* Don't take care of other Cygwin/X process's windows */
- GetWindowThreadProcessId(hwnd, &dwWindowProcessID);
+ /* Don't take care of other Cygwin/X process's windows */
+ GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
- if (GetProp(hwnd, WIN_WINDOW_PROP)
- && (dwWindowProcessID == dwCurrentProcessID)
+ if ( GetProp (hwnd, WIN_WINDOW_PROP)
+ && (dwWindowProcessID == dwCurrentProcessID)
&& !IsIconic(hwnd)) { /* ignore minimized windows */
- pWinSib = pWin;
- pWin = GetProp(hwnd, WIN_WINDOW_PROP);
-
+ pWinSib = pWin;
+ pWin = GetProp (hwnd, WIN_WINDOW_PROP);
+
if (!pWinSib) { /* 1st window - raise to the top */
- vlist[0] = Above;
-
- ConfigureWindow(pWin, CWStackMode, vlist, wClient(pWin));
- }
+ vlist[0] = Above;
+
+ ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
+ }
else { /* 2nd or deeper windows - just below the previous one */
- vlist[0] = winGetWindowID(pWinSib);
- vlist[1] = Below;
+ vlist[0] = winGetWindowID (pWinSib);
+ vlist[1] = Below;
- ConfigureWindow(pWin, CWSibling | CWStackMode,
- vlist, wClient(pWin));
- }
- }
+ ConfigureWindow (pWin, CWSibling | CWStackMode,
+ vlist, wClient(pWin));
+ }
+ }
}
- fRestacking = FALSE;
+ fRestacking = FALSE;
}
/*
@@ -801,31 +995,31 @@ winReorderWindowsMultiWindow(void)
*/
void
-winMinimizeWindow(Window id)
+winMinimizeWindow (Window id)
{
- WindowPtr pWin;
- winPrivWinPtr pWinPriv;
+ WindowPtr pWin;
+ winPrivWinPtr pWinPriv;
#ifdef XWIN_MULTIWINDOWEXTWM
- win32RootlessWindowPtr pRLWinPriv;
+ win32RootlessWindowPtr pRLWinPriv;
#endif
- HWND hWnd;
- ScreenPtr pScreen = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
+ HWND hWnd;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
#if CYGWINDOWING_DEBUG
- ErrorF("winMinimizeWindow\n");
+ ErrorF ("winMinimizeWindow\n");
#endif
dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
DixUnknownAccess);
if (!pWin) {
- ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
- return;
- }
+ ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
+ return;
+ }
- pScreen = pWin->drawable.pScreen;
+ pScreen = pWin->drawable.pScreen;
if (pScreen)
pScreenPriv = winGetScreenPriv(pScreen);
if (pScreenPriv)
@@ -835,18 +1029,18 @@ winMinimizeWindow(Window id)
if (pScreenPriv && pScreenInfo->fInternalWM) {
pRLWinPriv =
(win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
- hWnd = pRLWinPriv->hWnd;
+ hWnd = pRLWinPriv->hWnd;
}
- else
+ else
#else
- if (pScreenPriv)
+ if (pScreenPriv)
#endif
{
- pWinPriv = winGetWindowPriv(pWin);
- hWnd = pWinPriv->hWnd;
+ pWinPriv = winGetWindowPriv (pWin);
+ hWnd = pWinPriv->hWnd;
}
- ShowWindow(hWnd, SW_MINIMIZE);
+ ShowWindow (hWnd, SW_MINIMIZE);
}
/*
@@ -855,55 +1049,55 @@ winMinimizeWindow(Window id)
void
winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
#if CYGWINDOWING_DEBUG
- ErrorF("CopyWindowMultiWindow\n");
+ ErrorF ("CopyWindowMultiWindow\n");
#endif
- WIN_UNWRAP(CopyWindow);
- (*pScreen->CopyWindow) (pWin, oldpt, oldRegion);
- WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
+ WIN_UNWRAP(CopyWindow);
+ (*pScreen->CopyWindow)(pWin, oldpt, oldRegion);
+ WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
}
/*
* MoveWindow - See Porting Layer Definition - p. 42
*/
void
-winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind)
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
#if CYGWINDOWING_DEBUG
- ErrorF("MoveWindowMultiWindow to (%d, %d)\n", x, y);
+ ErrorF ("MoveWindowMultiWindow to (%d, %d)\n", x, y);
#endif
- WIN_UNWRAP(MoveWindow);
- (*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
- WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
+ WIN_UNWRAP(MoveWindow);
+ (*pScreen->MoveWindow)(pWin, x, y, pSib, kind);
+ WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
}
/*
* ResizeWindow - See Porting Layer Definition - p. 42
*/
void
-winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib)
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
#if CYGWINDOWING_DEBUG
- ErrorF("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
+ ErrorF ("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
#endif
- WIN_UNWRAP(ResizeWindow);
- (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
- WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
+ WIN_UNWRAP(ResizeWindow);
+ (*pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
+ WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
}
/*
@@ -917,95 +1111,104 @@ winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
* adjusts Windows window with respect to X window.
*/
int
-winAdjustXWindow(WindowPtr pWin, HWND hwnd)
+winAdjustXWindow (WindowPtr pWin, HWND hwnd)
{
- RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
- RECT rcWin; /* The source: WindowRect from hwnd */
- DrawablePtr pDraw;
- XID vlist[4];
- LONG dX, dY, dW, dH, x, y;
- DWORD dwStyle, dwExStyle;
+ RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
+ RECT rcWin; /* The source: WindowRect from hwnd */
+ DrawablePtr pDraw;
+ XID vlist[4];
+ LONG dX, dY, dW, dH, x, y;
+ DWORD dwStyle, dwExStyle;
#define WIDTH(rc) (rc.right - rc.left)
#define HEIGHT(rc) (rc.bottom - rc.top)
-
+
#if CYGWINDOWING_DEBUG
- ErrorF("winAdjustXWindow\n");
+ ErrorF ("winAdjustXWindow\n");
#endif
- if (IsIconic(hwnd)) {
-#if CYGWINDOWING_DEBUG
- ErrorF("\timmediately return because the window is iconized\n");
-#endif
- /*
- * If the Windows window is minimized, its WindowRect has
- * meaningless values so we don't adjust X window to it.
- */
- vlist[0] = 0;
- vlist[1] = 0;
- return ConfigureWindow(pWin, CWX | CWY, vlist, wClient(pWin));
+ if (!isToplevelWindow(pWin))
+ {
+#if 1
+ ErrorF ("winAdjustXWindow - immediately return because not a top-level window\n");
+#endif
+ return 0;
}
- pDraw = &pWin->drawable;
+ if (IsIconic (hwnd))
+ {
+#if CYGWINDOWING_DEBUG
+ ErrorF ("\timmediately return because the window is iconized\n");
+#endif
+ /*
+ * If the Windows window is minimized, its WindowRect has
+ * meaningless values so we don't adjust X window to it.
+ */
+ vlist[0] = 0;
+ vlist[1] = 0;
+ return ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
+ }
+
+ pDraw = &pWin->drawable;
- /* Calculate the window rect from the drawable */
- x = pDraw->x + GetSystemMetrics(SM_XVIRTUALSCREEN);
- y = pDraw->y + GetSystemMetrics(SM_YVIRTUALSCREEN);
- SetRect(&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
+ /* Calculate the window rect from the drawable */
+ x = pDraw->x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ y = pDraw->y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+ SetRect (&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
- rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
+ winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
+ rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
#endif
- dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
+ dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
+ winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
#endif
- AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle);
+ AdjustWindowRectEx (&rcDraw, dwStyle, FALSE, dwExStyle);
- /* The source of adjust */
- GetWindowRect(hwnd, &rcWin);
+ /* The source of adjust */
+ GetWindowRect (hwnd, &rcWin);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
- rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
- winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
- rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
+ winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
+ rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
+ winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
+ rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
#endif
- if (EqualRect(&rcDraw, &rcWin)) {
- /* Bail if no adjust is needed */
+ if (EqualRect (&rcDraw, &rcWin)) {
+ /* Bail if no adjust is needed */
#if CYGWINDOWING_DEBUG
- ErrorF("\treturn because already adjusted\n");
+ ErrorF ("\treturn because already adjusted\n");
#endif
- return 0;
- }
-
- /* Calculate delta values */
- dX = rcWin.left - rcDraw.left;
- dY = rcWin.top - rcDraw.top;
- dW = WIDTH(rcWin) - WIDTH(rcDraw);
- dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
-
- /*
- * Adjust.
- * We may only need to move (vlist[0] and [1]), or only resize
- * ([2] and [3]) but currently we set all the parameters and leave
- * the decision to ConfigureWindow. The reason is code simplicity.
- */
- vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
- vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
- vlist[2] = pDraw->width + dW;
- vlist[3] = pDraw->height + dH;
+ return 0;
+ }
+
+ /* Calculate delta values */
+ dX = rcWin.left - rcDraw.left;
+ dY = rcWin.top - rcDraw.top;
+ dW = WIDTH(rcWin) - WIDTH(rcDraw);
+ dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
+
+ /*
+ * Adjust.
+ * We may only need to move (vlist[0] and [1]), or only resize
+ * ([2] and [3]) but currently we set all the parameters and leave
+ * the decision to ConfigureWindow. The reason is code simplicity.
+ */
+ vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
+ vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
+ vlist[2] = pDraw->width + dW;
+ vlist[3] = pDraw->height + dH;
#if CYGWINDOWING_DEBUG
- ErrorF("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
- vlist[2], vlist[3]);
+ ErrorF ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
+ vlist[2], vlist[3]);
#endif
- return ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight,
- vlist, wClient(pWin));
-
+ return ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight,
+ vlist, wClient(pWin));
+
#undef WIDTH
#undef HEIGHT
}
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index c355e8919..23120ae60 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -30,6 +30,10 @@
* Colin Harrison
*/
+#ifndef WINVER
+#define WINVER 0x0500
+#endif
+
/* X headers */
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
@@ -48,7 +52,6 @@
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
-#include <X11/Xlocale.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
@@ -62,6 +65,14 @@
#include "window.h"
#include "pixmapstr.h"
#include "windowstr.h"
+#include "winglobals.h"
+
+#include <shlwapi.h>
+
+#define INITGUID
+#include "initguid.h"
+#include "taskbar.h"
+#undef INITGUID
#ifdef XWIN_MULTIWINDOWEXTWM
#include <X11/extensions/windowswmstr.h>
@@ -86,7 +97,7 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
#define WIN_CONNECT_RETRIES 5
#define WIN_CONNECT_DELAY 5
#ifdef HAS_DEVWINDOWS
-#define WIN_MSG_QUEUE_FNAME "/dev/windows"
+# define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2
@@ -96,94 +107,96 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
*/
typedef struct _WMMsgNodeRec {
- winWMMessageRec msg;
- struct _WMMsgNodeRec *pNext;
+ winWMMessageRec msg;
+ struct _WMMsgNodeRec *pNext;
} WMMsgNodeRec, *WMMsgNodePtr;
typedef struct _WMMsgQueueRec {
- struct _WMMsgNodeRec *pHead;
- struct _WMMsgNodeRec *pTail;
- pthread_mutex_t pmMutex;
- pthread_cond_t pcNotEmpty;
- int nQueueSize;
+ struct _WMMsgNodeRec *pHead;
+ struct _WMMsgNodeRec *pTail;
+ pthread_mutex_t pmMutex;
+ pthread_cond_t pcNotEmpty;
+ int nQueueSize;
} WMMsgQueueRec, *WMMsgQueuePtr;
typedef struct _WMInfo {
- Display *pDisplay;
- WMMsgQueueRec wmMsgQueue;
- Atom atmWmProtos;
- Atom atmWmDelete;
- Atom atmPrivMap;
- Bool fAllowOtherWM;
+ Display *pDisplay;
+ WMMsgQueueRec wmMsgQueue;
+ Atom atmWmProtos;
+ Atom atmWmDelete;
+ Atom atmPrivMap;
+ Bool fAllowOtherWM;
} WMInfoRec, *WMInfoPtr;
typedef struct _WMProcArgRec {
- DWORD dwScreen;
- WMInfoPtr pWMInfo;
- pthread_mutex_t *ppmServerStarted;
+ DWORD dwScreen;
+ WMInfoPtr pWMInfo;
+ pthread_mutex_t *ppmServerStarted;
} WMProcArgRec, *WMProcArgPtr;
typedef struct _XMsgProcArgRec {
- Display *pDisplay;
- DWORD dwScreen;
- WMInfoPtr pWMInfo;
- pthread_mutex_t *ppmServerStarted;
- HWND hwndScreen;
+ Display *pDisplay;
+ DWORD dwScreen;
+ WMInfoPtr pWMInfo;
+ pthread_mutex_t *ppmServerStarted;
+ HWND hwndScreen;
} XMsgProcArgRec, *XMsgProcArgPtr;
/*
* References to external symbols
*/
-extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
+extern void ErrorF (const char* /*f*/, ...);
/*
* Prototypes for local functions
*/
static void
- PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode);
+PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode);
static WMMsgNodePtr PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo);
static Bool
- InitQueue(WMMsgQueuePtr pQueue);
+InitQueue (WMMsgQueuePtr pQueue);
static void
- GetWindowName(Display * pDpy, Window iWin, wchar_t ** ppName);
+GetWindowName (Display * pDpy, Window iWin, char **ppWindowName);
static int
- SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData);
+SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
static void
- UpdateName(WMInfoPtr pWMInfo, Window iWindow);
+UpdateName (WMInfoPtr pWMInfo, Window iWindow);
static void *winMultiWindowWMProc(void *pArg);
static int
- winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr);
+winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr);
static int
- winMultiWindowWMIOErrorHandler(Display * pDisplay);
+winMultiWindowWMIOErrorHandler (Display *pDisplay);
static void *winMultiWindowXMsgProc(void *pArg);
static int
- winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr);
+winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr);
static int
- winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay);
+winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay);
+
+static void
+winMultiWindowThreadExit(void *arg);
static int
- winRedirectErrorHandler(Display * pDisplay, XErrorEvent * pErr);
+winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr);
static void
- winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
+winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
#if 0
static void
- PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
+PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
#endif
static Bool
@@ -192,93 +205,100 @@ CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen,
Bool fAllowOtherWM);
static void
- winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle);
+winApplyUrgency (Display *pDisplay, Window iWindow, HWND hWnd);
+
+static void
+winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle);
void
- winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
+winUpdateWindowPosition (HWND hWnd, HWND *zstyle);
/*
* Local globals
*/
-static jmp_buf g_jmpWMEntry;
+static jmp_buf g_jmpWMEntry;
static XIOErrorHandler g_winMultiWindowWMOldIOErrorHandler;
static pthread_t g_winMultiWindowWMThread;
-static jmp_buf g_jmpXMsgProcEntry;
+static jmp_buf g_jmpXMsgProcEntry;
static XIOErrorHandler g_winMultiWindowXMsgProcOldIOErrorHandler;
static pthread_t g_winMultiWindowXMsgProcThread;
-static Bool g_shutdown = FALSE;
-static Bool redirectError = FALSE;
-static Bool g_fAnotherWMRunning = FALSE;
+static Bool g_shutdown = FALSE;
+static Bool redirectError = FALSE;
+static Bool g_fAnotherWMRunning = FALSE;
+static HMODULE g_hmodShell32Dll = NULL;
+static HMODULE g_hmodOle32Dll = NULL;
+static SHGETPROPERTYSTOREFORWINDOWPROC g_pSHGetPropertyStoreForWindow = NULL;
+static PROPVARIANTCLEARPROC g_pPropVariantClear = NULL;
/*
* PushMessage - Push a message onto the queue
*/
static void
-PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
+PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
{
- /* Lock the queue mutex */
- pthread_mutex_lock(&pQueue->pmMutex);
-
- pNode->pNext = NULL;
+ /* Lock the queue mutex */
+ pthread_mutex_lock (&pQueue->pmMutex);
+ pNode->pNext = NULL;
+
if (pQueue->pTail != NULL) {
- pQueue->pTail->pNext = pNode;
+ pQueue->pTail->pNext = pNode;
}
- pQueue->pTail = pNode;
-
+ pQueue->pTail = pNode;
+
if (pQueue->pHead == NULL) {
- pQueue->pHead = pNode;
+ pQueue->pHead = pNode;
}
#if 0
switch (pNode->msg.msg) {
case WM_WM_MOVE:
- ErrorF("\tWM_WM_MOVE\n");
- break;
+ ErrorF ("\tWM_WM_MOVE\n");
+ break;
case WM_WM_SIZE:
- ErrorF("\tWM_WM_SIZE\n");
- break;
+ ErrorF ("\tWM_WM_SIZE\n");
+ break;
case WM_WM_RAISE:
- ErrorF("\tWM_WM_RAISE\n");
- break;
+ ErrorF ("\tWM_WM_RAISE\n");
+ break;
case WM_WM_LOWER:
- ErrorF("\tWM_WM_LOWER\n");
- break;
+ ErrorF ("\tWM_WM_LOWER\n");
+ break;
case WM_WM_MAP:
- ErrorF("\tWM_WM_MAP\n");
- break;
+ ErrorF ("\tWM_WM_MAP\n");
+ break;
case WM_WM_MAP2:
- ErrorF("\tWM_WM_MAP2\n");
- break;
+ ErrorF ("\tWM_WM_MAP2\n");
+ break;
case WM_WM_MAP3:
- ErrorF("\tWM_WM_MAP3\n");
- break;
+ ErrorF ("\tWM_WM_MAP3\n");
+ break;
case WM_WM_UNMAP:
- ErrorF("\tWM_WM_UNMAP\n");
- break;
+ ErrorF ("\tWM_WM_UNMAP\n");
+ break;
case WM_WM_KILL:
- ErrorF("\tWM_WM_KILL\n");
- break;
+ ErrorF ("\tWM_WM_KILL\n");
+ break;
case WM_WM_ACTIVATE:
- ErrorF("\tWM_WM_ACTIVATE\n");
- break;
+ ErrorF ("\tWM_WM_ACTIVATE\n");
+ break;
default:
- ErrorF("\tUnknown Message.\n");
- break;
+ ErrorF ("\tUnknown Message.\n");
+ break;
}
#endif
- /* Increase the count of elements in the queue by one */
- ++(pQueue->nQueueSize);
+ /* Increase the count of elements in the queue by one */
+ ++(pQueue->nQueueSize);
- /* Release the queue mutex */
- pthread_mutex_unlock(&pQueue->pmMutex);
+ /* Release the queue mutex */
+ pthread_mutex_unlock (&pQueue->pmMutex);
- /* Signal that the queue is not empty */
- pthread_cond_signal(&pQueue->pcNotEmpty);
+ /* Signal that the queue is not empty */
+ pthread_cond_signal (&pQueue->pcNotEmpty);
}
#if CYGMULTIWINDOW_DEBUG
@@ -287,16 +307,16 @@ PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
*/
static int
-QueueSize(WMMsgQueuePtr pQueue)
+QueueSize (WMMsgQueuePtr pQueue)
{
- WMMsgNodePtr pNode;
- int nSize = 0;
-
- /* Loop through all elements in the queue */
- for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
- ++nSize;
-
- return nSize;
+ WMMsgNodePtr pNode;
+ int nSize = 0;
+
+ /* Loop through all elements in the queue */
+ for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
+ ++nSize;
+
+ return nSize;
}
#endif
@@ -305,38 +325,38 @@ QueueSize(WMMsgQueuePtr pQueue)
*/
static WMMsgNodePtr
-PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
+PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
{
- WMMsgNodePtr pNode;
+ WMMsgNodePtr pNode;
- /* Lock the queue mutex */
- pthread_mutex_lock(&pQueue->pmMutex);
+ /* Lock the queue mutex */
+ pthread_mutex_lock (&pQueue->pmMutex);
- /* Wait for --- */
+ /* Wait for --- */
while (pQueue->pHead == NULL) {
- pthread_cond_wait(&pQueue->pcNotEmpty, &pQueue->pmMutex);
+ pthread_cond_wait (&pQueue->pcNotEmpty, &pQueue->pmMutex);
}
-
- pNode = pQueue->pHead;
+
+ pNode = pQueue->pHead;
if (pQueue->pHead != NULL) {
- pQueue->pHead = pQueue->pHead->pNext;
+ pQueue->pHead = pQueue->pHead->pNext;
}
if (pQueue->pTail == pNode) {
- pQueue->pTail = NULL;
+ pQueue->pTail = NULL;
}
- /* Drop the number of elements in the queue by one */
- --(pQueue->nQueueSize);
+ /* Drop the number of elements in the queue by one */
+ --(pQueue->nQueueSize);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("Queue Size %d %d\n", pQueue->nQueueSize, QueueSize(pQueue));
+ ErrorF ("Queue Size %d %d\n", pQueue->nQueueSize, QueueSize(pQueue));
#endif
+
+ /* Release the queue mutex */
+ pthread_mutex_unlock (&pQueue->pmMutex);
- /* Release the queue mutex */
- pthread_mutex_unlock(&pQueue->pmMutex);
-
- return pNode;
+ return pNode;
}
#if 0
@@ -345,16 +365,16 @@ PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
*/
static Bool
-HaveMessage(WMMsgQueuePtr pQueue, UINT msg, Window iWindow)
+HaveMessage (WMMsgQueuePtr pQueue, UINT msg, Window iWindow)
{
- WMMsgNodePtr pNode;
-
+ WMMsgNodePtr pNode;
+
for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext) {
- if (pNode->msg.msg == msg && pNode->msg.iWindow == iWindow)
- return True;
+ if (pNode->msg.msg==msg && pNode->msg.iWindow==iWindow)
+ return True;
}
-
- return False;
+
+ return False;
}
#endif
@@ -363,40 +383,69 @@ HaveMessage(WMMsgQueuePtr pQueue, UINT msg, Window iWindow)
*/
static
- Bool
-InitQueue(WMMsgQueuePtr pQueue)
+Bool
+InitQueue (WMMsgQueuePtr pQueue)
{
- /* Check if the pQueue pointer is NULL */
+ /* Check if the pQueue pointer is NULL */
if (pQueue == NULL) {
- ErrorF("InitQueue - pQueue is NULL. Exiting.\n");
- return FALSE;
+ ErrorF ("InitQueue - pQueue is NULL. Exiting.\n");
+ return FALSE;
}
- /* Set the head and tail to NULL */
- pQueue->pHead = NULL;
- pQueue->pTail = NULL;
+ /* Set the head and tail to NULL */
+ pQueue->pHead = NULL;
+ pQueue->pTail = NULL;
- /* There are no elements initially */
- pQueue->nQueueSize = 0;
+ /* There are no elements initially */
+ pQueue->nQueueSize = 0;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
- QueueSize(pQueue));
+ winDebug ("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize, QueueSize(pQueue));
#endif
- ErrorF("InitQueue - Calling pthread_mutex_init\n");
+ winDebug ("InitQueue - Calling pthread_mutex_init\n");
- /* Create synchronization objects */
- pthread_mutex_init(&pQueue->pmMutex, NULL);
+ /* Create synchronization objects */
+ pthread_mutex_init (&pQueue->pmMutex, NULL);
- ErrorF("InitQueue - pthread_mutex_init returned\n");
- ErrorF("InitQueue - Calling pthread_cond_init\n");
+ winDebug ("InitQueue - pthread_mutex_init returned\n");
+ winDebug ("InitQueue - Calling pthread_cond_init\n");
- pthread_cond_init(&pQueue->pcNotEmpty, NULL);
+ pthread_cond_init (&pQueue->pcNotEmpty, NULL);
- ErrorF("InitQueue - pthread_cond_init returned\n");
+ winDebug ("InitQueue - pthread_cond_init returned\n");
+
+ return TRUE;
+}
+
+static
+char *Xutf8TextPropertyToString(Display *pDisplay, XTextProperty *xtp)
+{
+ int nNum;
+ char **ppList;
+ char *pszReturnData;
+
+ if (Xutf8TextPropertyToTextList (pDisplay, xtp, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
+ {
+ int i;
+ int iLen = 0;
+
+ for (i = 0; i < nNum; i++)
+ iLen += strlen(ppList[i]);
+ pszReturnData = (char *) malloc (iLen + 1);
+ pszReturnData[0] = '\0';
+ for (i = 0; i < nNum; i++)
+ strcat (pszReturnData, ppList[i]);
+ if (ppList)
+ XFreeStringList (ppList);
+ }
+ else
+ {
+ pszReturnData = (char *) malloc (1);
+ pszReturnData[0] = '\0';
+ }
- return TRUE;
+ return pszReturnData;
}
/*
@@ -404,55 +453,69 @@ InitQueue(WMMsgQueuePtr pQueue)
*/
static void
-GetWindowName(Display * pDisplay, Window iWin, wchar_t ** ppName)
+GetWindowName (Display *pDisplay, Window iWin, char **ppWindowName)
{
- int nResult, nNum;
- char **ppList;
- char *pszReturnData;
- int iLen, i;
- XTextProperty xtpName;
+ int nResult;
+ XTextProperty xtpWindowName;
+ XTextProperty xtpClientMachine;
+ char *pszWindowName;
+ char *pszClientMachine;
+ char hostname[HOST_NAME_MAX + 1];
#if CYGMULTIWINDOW_DEBUG
- ErrorF("GetWindowName\n");
+ ErrorF ("GetWindowName\n");
#endif
- /* Intialize ppName to NULL */
- *ppName = NULL;
+ /* Intialize ppWindowName to NULL */
+ *ppWindowName = NULL;
- /* Try to get --- */
- nResult = XGetWMName(pDisplay, iWin, &xtpName);
- if (!nResult || !xtpName.value || !xtpName.nitems) {
+ /* Try to get window name */
+ nResult = XGetWMName (pDisplay, iWin, &xtpWindowName);
+ if (!nResult || !xtpWindowName.value || !xtpWindowName.nitems)
+ {
#if CYGMULTIWINDOW_DEBUG
- ErrorF("GetWindowName - XGetWMName failed. No name.\n");
+ ErrorF ("GetWindowName - XGetWMName failed. No name.\n");
#endif
- return;
+ return;
}
- if (Xutf8TextPropertyToTextList(pDisplay, &xtpName, &ppList, &nNum) >=
- Success && nNum > 0 && *ppList) {
- iLen = 0;
- for (i = 0; i < nNum; i++)
- iLen += strlen(ppList[i]);
- pszReturnData = (char *) malloc(iLen + 1);
- pszReturnData[0] = '\0';
- for (i = 0; i < nNum; i++)
- strcat(pszReturnData, ppList[i]);
- if (ppList)
- XFreeStringList(ppList);
- }
- else {
- pszReturnData = (char *) malloc(1);
- pszReturnData[0] = '\0';
+ pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName);
+ XFree(xtpWindowName.value);
+
+ if (g_fHostInTitle)
+ {
+ /* Try to get client machine name */
+ nResult = XGetWMClientMachine(pDisplay, iWin, &xtpClientMachine);
+ if (nResult && xtpClientMachine.value && xtpClientMachine.nitems)
+ {
+ pszClientMachine = Xutf8TextPropertyToString(pDisplay, &xtpClientMachine);
+ XFree(xtpClientMachine.value);
+
+ /*
+ If we have a client machine name
+ and it's not the local host name...
+ */
+ if (strlen(pszClientMachine) &&
+ !gethostname(hostname, HOST_NAME_MAX + 1) &&
+ strcmp (hostname, pszClientMachine))
+ {
+ /* ... add ' (on <clientmachine>)' to end of window name */
+ *ppWindowName = malloc(strlen(pszWindowName) + strlen(pszClientMachine) + 7);
+ strcpy(*ppWindowName, pszWindowName);
+ strcat(*ppWindowName, " (on ");
+ strcat(*ppWindowName, pszClientMachine);
+ strcat(*ppWindowName, ")");
+
+ free(pszWindowName);
+ free(pszClientMachine);
+
+ return;
+ }
+ }
}
- iLen = MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, NULL, 0);
- *ppName = (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1));
- MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
- XFree(xtpName.value);
- free(pszReturnData);
-#if CYGMULTIWINDOW_DEBUG
- ErrorF("GetWindowName - Returning\n");
-#endif
+ /* otherwise just return the window name */
+ *ppWindowName = pszWindowName;
}
/*
@@ -460,20 +523,55 @@ GetWindowName(Display * pDisplay, Window iWin, wchar_t ** ppName)
*/
static int
-SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData)
+SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData)
{
- XEvent e;
-
- /* Prepare the X event structure */
- e.type = ClientMessage;
- e.xclient.window = iWin;
- e.xclient.message_type = atmType;
- e.xclient.format = 32;
- e.xclient.data.l[0] = nData;
- e.xclient.data.l[1] = CurrentTime;
-
- /* Send the event to X */
- return XSendEvent(pDisplay, iWin, False, NoEventMask, &e);
+ XEvent e;
+
+ /* Prepare the X event structure */
+ e.type = ClientMessage;
+ e.xclient.window = iWin;
+ e.xclient.message_type = atmType;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = nData;
+ e.xclient.data.l[1] = CurrentTime;
+
+ /* Send the event to X */
+ return XSendEvent (pDisplay, iWin, False, NoEventMask, &e);
+}
+
+/*
+ * See if we can get the stored HWND for this window...
+ */
+static HWND
+getHwnd (WMInfoPtr pWMInfo, Window iWindow)
+{
+ Atom atmType;
+ int fmtRet;
+ unsigned long items, remain;
+ HWND *retHwnd, hWnd = NULL;
+
+ if (XGetWindowProperty (pWMInfo->pDisplay,
+ iWindow,
+ pWMInfo->atmPrivMap,
+ 0,
+ 1,
+ False,
+ XA_INTEGER,
+ &atmType,
+ &fmtRet,
+ &items,
+ &remain, (unsigned char **) &retHwnd) == Success) {
+ if (retHwnd) {
+ hWnd = *retHwnd;
+ XFree (retHwnd);
+ }
+ }
+
+ /* Some sanity checks */
+ if (!hWnd) return NULL;
+ if (!IsWindow (hWnd)) return NULL;
+
+ return hWnd;
}
/*
@@ -481,47 +579,113 @@ SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData)
*/
static void
-UpdateName(WMInfoPtr pWMInfo, Window iWindow)
+UpdateName (WMInfoPtr pWMInfo, Window iWindow)
{
- wchar_t *pszName;
- Atom atmType;
- int fmtRet;
- unsigned long items, remain;
- HWND *retHwnd, hWnd;
- XWindowAttributes attr;
-
- hWnd = 0;
-
- /* See if we can get the cached HWND for this window... */
- if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap,
- &atmType,
- &fmtRet,
- &items,
- &remain, (unsigned char **) &retHwnd) == Success) {
- if (retHwnd) {
- hWnd = *retHwnd;
- XFree(retHwnd);
+ wchar_t *pszName;
+ HWND hWnd;
+ XWindowAttributes attr;
+
+ hWnd = getHwnd (pWMInfo, iWindow);
+ if (!hWnd) return;
+
+ /* If window isn't override-redirect */
+ XGetWindowAttributes (pWMInfo->pDisplay, iWindow, &attr);
+ if (!attr.override_redirect)
+ {
+ char *pszWindowName;
+ /* Get the X windows window name */
+ GetWindowName (pWMInfo->pDisplay, iWindow, &pszWindowName);
+
+ if (pszWindowName)
+ {
+ /* Convert from UTF-8 to wide char */
+ int iLen = MultiByteToWideChar (CP_UTF8, 0, pszWindowName, -1, NULL, 0);
+ wchar_t *pwszWideWindowName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
+ MultiByteToWideChar (CP_UTF8, 0, pszWindowName, -1, pwszWideWindowName, iLen);
+
+ /* Set the Windows window name */
+ SetWindowTextW (hWnd, pwszWideWindowName);
+
+ free (pwszWideWindowName);
+ free (pszWindowName);
}
}
+}
- /* Some sanity checks */
- if (!hWnd)
- return;
- if (!IsWindow(hWnd))
- return;
+/*
+ * Updates the icon of a HWND according to its X icon properties
+ */
- /* Set the Windows window name */
- GetWindowName(pWMInfo->pDisplay, iWindow, &pszName);
- if (pszName) {
- /* Get the window attributes */
- XGetWindowAttributes(pWMInfo->pDisplay, iWindow, &attr);
- if (!attr.override_redirect) {
- SetWindowTextW(hWnd, pszName);
- winUpdateIcon(iWindow);
- }
+static void
+UpdateIcon (WMInfoPtr pWMInfo, Window iWindow)
+{
+ HWND hWnd;
+ HICON hIconNew = NULL;
+ XWindowAttributes attr;
- free(pszName);
- }
+ hWnd = getHwnd (pWMInfo, iWindow);
+ if (!hWnd) return;
+
+ /* If window isn't override-redirect */
+ XGetWindowAttributes (pWMInfo->pDisplay, iWindow, &attr);
+ if (!attr.override_redirect)
+ {
+ XClassHint class_hint = {0,0};
+ char *window_name = 0;
+
+ if (XGetClassHint(pWMInfo->pDisplay, iWindow, &class_hint))
+ {
+ XFetchName(pWMInfo->pDisplay, iWindow, &window_name);
+
+ hIconNew = (HICON)winOverrideIcon(class_hint.res_name, class_hint.res_class, window_name);
+
+ if (class_hint.res_name) XFree(class_hint.res_name);
+ if (class_hint.res_class) XFree(class_hint.res_class);
+ if (window_name) XFree(window_name);
+ }
+ }
+
+ winUpdateIcon (hWnd, pWMInfo->pDisplay, iWindow, hIconNew);
+}
+
+/*
+ * Updates the style of a HWND according to its X style properties
+ */
+
+static void
+UpdateStyle (WMInfoPtr pWMInfo, Window iWindow)
+{
+ HWND hWnd;
+ HWND zstyle = HWND_NOTOPMOST;
+ UINT flags;
+ Bool onTaskbar;
+
+ hWnd = getHwnd (pWMInfo, iWindow);
+ if (!hWnd) return;
+
+ /* Determine the Window style, which determines borders and clipping region... */
+ winApplyHints (pWMInfo->pDisplay, iWindow, hWnd, &zstyle);
+ winUpdateWindowPosition (hWnd, &zstyle);
+
+ /* Apply the updated window style, without changing it's show or activation state */
+ flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
+ if (zstyle == HWND_NOTOPMOST) flags |= SWP_NOZORDER | SWP_NOOWNERZORDER;
+ SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags);
+
+ /*
+ Use the WS_EX_TOOLWINDOW style to remove window from Alt-Tab window switcher
+
+ According to MSDN, this is supposed to remove the window from the taskbar as well,
+ if we SW_HIDE before changing the style followed by SW_SHOW afterwards.
+
+ But that doesn't seem to work reliably, so also use iTaskbarList interface to
+ tell the taskbar to show or hide this window.
+ */
+ onTaskbar = GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_APPWINDOW;
+ wintaskbar(hWnd, onTaskbar);
+
+ /* Check urgency hint */
+ winApplyUrgency(pWMInfo->pDisplay, iWindow, hWnd);
}
#if 0
@@ -532,256 +696,263 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow)
static void
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
{
- Atom atmType;
- int fmtRet;
- unsigned long items, remain;
- HWND hWnd, *retHwnd;
- DWORD myWinProcID, winProcID;
- Window xWindow;
- WINDOWPLACEMENT wndPlace;
-
- hWnd = NULL;
- /* See if we can get the cached HWND for this window... */
- if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap,
- &atmType,
- &fmtRet,
- &items,
- &remain, (unsigned char **) &retHwnd) == Success) {
- if (retHwnd) {
- hWnd = *retHwnd;
- XFree(retHwnd);
- }
- }
-
- if (!hWnd)
- return;
-
- GetWindowThreadProcessId(hWnd, &myWinProcID);
- hWnd = GetNextWindow(hWnd, direction);
-
- while (hWnd) {
- GetWindowThreadProcessId(hWnd, &winProcID);
+ HWND hWnd;
+ DWORD myWinProcID, winProcID;
+ Window xWindow;
+ WINDOWPLACEMENT wndPlace;
+
+ hWnd = getHwnd (pWMInfo, iWindow);
+ if (!hWnd) return;
+
+ GetWindowThreadProcessId (hWnd, &myWinProcID);
+ hWnd = GetNextWindow (hWnd, direction);
+
+ while (hWnd) {
+ GetWindowThreadProcessId (hWnd, &winProcID);
if (winProcID == myWinProcID) {
- wndPlace.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hWnd, &wndPlace);
- if (!(wndPlace.showCmd == SW_HIDE ||
+ wndPlace.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement (hWnd, &wndPlace);
+ if ( !(wndPlace.showCmd==SW_HIDE ||
wndPlace.showCmd == SW_MINIMIZE)) {
- xWindow = (Window) GetProp(hWnd, WIN_WID_PROP);
+ xWindow = (Window)GetProp (hWnd, WIN_WID_PROP);
if (xWindow) {
- if (direction == GW_HWNDPREV)
- XRaiseWindow(pWMInfo->pDisplay, xWindow);
- else
- XLowerWindow(pWMInfo->pDisplay, xWindow);
- }
- }
- }
- hWnd = GetNextWindow(hWnd, direction);
- }
+ if (direction==GW_HWNDPREV)
+ XRaiseWindow (pWMInfo->pDisplay, xWindow);
+ else
+ XLowerWindow (pWMInfo->pDisplay, xWindow);
+ }
+ }
+ }
+ hWnd = GetNextWindow(hWnd, direction);
+ }
}
-#endif /* PreserveWin32Stack */
+#endif /* PreserveWin32Stack */
/*
* winMultiWindowWMProc
*/
static void *
-winMultiWindowWMProc(void *pArg)
+winMultiWindowWMProc (void *pArg)
{
- WMProcArgPtr pProcArg = (WMProcArgPtr) pArg;
- WMInfoPtr pWMInfo = pProcArg->pWMInfo;
-
- /* Initialize the Window Manager */
- winInitMultiWindowWM(pWMInfo, pProcArg);
-
+ WMProcArgPtr pProcArg = (WMProcArgPtr)pArg;
+ WMInfoPtr pWMInfo = pProcArg->pWMInfo;
+
+ pthread_cleanup_push(&winMultiWindowThreadExit, NULL);
+
+ /* Initialize the Window Manager */
+ winInitMultiWindowWM (pWMInfo, pProcArg);
+
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winMultiWindowWMProc ()\n");
+ ErrorF ("winMultiWindowWMProc ()\n");
#endif
- /* Loop until we explicitly break out */
+ /* Loop until we explicitly break out */
for (;;) {
- WMMsgNodePtr pNode;
+ WMMsgNodePtr pNode;
if (g_fAnotherWMRunning) { /* Another Window manager exists. */
- Sleep(1000);
- continue;
- }
+ Sleep (1000);
+ continue;
+ }
- /* Pop a message off of our queue */
- pNode = PopMessage(&pWMInfo->wmMsgQueue, pWMInfo);
+ /* Pop a message off of our queue */
+ pNode = PopMessage (&pWMInfo->wmMsgQueue, pWMInfo);
if (pNode == NULL) {
- /* Bail if PopMessage returns without a message */
- /* NOTE: Remember that PopMessage is a blocking function. */
- ErrorF("winMultiWindowWMProc - Queue is Empty? Exiting.\n");
- pthread_exit(NULL);
- }
+ /* Bail if PopMessage returns without a message */
+ /* NOTE: Remember that PopMessage is a blocking function. */
+ ErrorF ("winMultiWindowWMProc - Queue is Empty? Exiting.\n");
+ pthread_exit (NULL);
+ }
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n",
- GetTickCount(), (int) pNode->msg.msg, (int) pNode->msg.dwID);
+ ErrorF ("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n",
+ GetTickCount (), (int)pNode->msg.msg, (int)pNode->msg.dwID);
#endif
- /* Branch on the message type */
+ /* Branch on the message type */
switch (pNode->msg.msg) {
#if 0
- case WM_WM_MOVE:
- ErrorF("\tWM_WM_MOVE\n");
- break;
+ case WM_WM_MOVE:
+ ErrorF ("\tWM_WM_MOVE\n");
+ break;
- case WM_WM_SIZE:
- ErrorF("\tWM_WM_SIZE\n");
- break;
+ case WM_WM_SIZE:
+ ErrorF ("\tWM_WM_SIZE\n");
+ break;
#endif
- case WM_WM_RAISE:
+ case WM_WM_RAISE:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_RAISE\n");
+ ErrorF ("\tWM_WM_RAISE\n");
#endif
- /* Raise the window */
- XRaiseWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
+ /* Raise the window */
+ XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
#if 0
- PreserveWin32Stack(pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
+ PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
#endif
- break;
+ break;
- case WM_WM_LOWER:
+ case WM_WM_LOWER:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_LOWER\n");
+ ErrorF ("\tWM_WM_LOWER\n");
#endif
- /* Lower the window */
- XLowerWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
- break;
+ /* Lower the window */
+ XLowerWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
- case WM_WM_MAP:
+ case WM_WM_MAP:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_MAP\n");
+ ErrorF ("\tWM_WM_MAP\n");
#endif
- /* Put a note as to the HWND associated with this Window */
+ /* Put a note as to the HWND associated with this Window */
XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
- 32,
- PropModeReplace,
+ 32,
+ PropModeReplace,
(unsigned char *) &(pNode->msg.hwndWindow), 1);
- UpdateName(pWMInfo, pNode->msg.iWindow);
- winUpdateIcon(pNode->msg.iWindow);
- break;
+ UpdateName (pWMInfo, pNode->msg.iWindow);
+ UpdateIcon (pWMInfo, pNode->msg.iWindow);
+ break;
- case WM_WM_MAP2:
+ case WM_WM_MAP2:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_MAP2\n");
+ ErrorF ("\tWM_WM_MAP2\n");
#endif
XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
- 32,
- PropModeReplace,
+ 32,
+ PropModeReplace,
(unsigned char *) &(pNode->msg.hwndWindow), 1);
- break;
+ break;
- case WM_WM_MAP3:
+ case WM_WM_MAP3:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_MAP3\n");
+ ErrorF ("\tWM_WM_MAP3\n");
#endif
- /* Put a note as to the HWND associated with this Window */
- XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
- 32,
- PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow), 1);
- UpdateName(pWMInfo, pNode->msg.iWindow);
- winUpdateIcon(pNode->msg.iWindow);
- {
- HWND zstyle = HWND_NOTOPMOST;
-
- winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
- pNode->msg.hwndWindow, &zstyle);
- winUpdateWindowPosition(pNode->msg.hwndWindow, TRUE, &zstyle);
- }
- break;
-
- case WM_WM_UNMAP:
+ /* Put a note as to the HWND associated with this Window */
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ UpdateName (pWMInfo, pNode->msg.iWindow);
+ UpdateIcon (pWMInfo, pNode->msg.iWindow);
+ UpdateStyle (pWMInfo, pNode->msg.iWindow);
+
+ /* Reshape */
+ {
+ WindowPtr pWin = GetProp(pNode->msg.hwndWindow, WIN_WINDOW_PROP);
+ if (pWin)
+ {
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+ }
+ }
+
+ break;
+
+ case WM_WM_UNMAP:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_UNMAP\n");
+ ErrorF ("\tWM_WM_UNMAP\n");
#endif
+
+ /* Unmap the window */
+ XUnmapWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
- /* Unmap the window */
- XUnmapWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
- break;
-
- case WM_WM_KILL:
+ case WM_WM_KILL:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_KILL\n");
+ ErrorF ("\tWM_WM_KILL\n");
#endif
- {
- int i, n, found = 0;
- Atom *protocols;
-
- /* --- */
- if (XGetWMProtocols(pWMInfo->pDisplay,
+ {
+ int i, n, found = 0;
+ Atom *protocols;
+
+ /* --- */
+ if (XGetWMProtocols (pWMInfo->pDisplay,
pNode->msg.iWindow, &protocols, &n)) {
- for (i = 0; i < n; ++i)
- if (protocols[i] == pWMInfo->atmWmDelete)
- ++found;
-
- XFree(protocols);
- }
-
- /* --- */
- if (found)
- SendXMessage(pWMInfo->pDisplay,
- pNode->msg.iWindow,
+ for (i = 0; i < n; ++i)
+ if (protocols[i] == pWMInfo->atmWmDelete)
+ ++found;
+
+ XFree (protocols);
+ }
+
+ /* --- */
+ if (found)
+ SendXMessage (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
pWMInfo->atmWmProtos, pWMInfo->atmWmDelete);
- else
+ else
XKillClient(pWMInfo->pDisplay, pNode->msg.iWindow);
- }
- break;
+ }
+ break;
- case WM_WM_ACTIVATE:
+ case WM_WM_ACTIVATE:
#if CYGMULTIWINDOW_DEBUG
- ErrorF("\tWM_WM_ACTIVATE\n");
+ ErrorF ("\tWM_WM_ACTIVATE\n");
#endif
-
- /* Set the input focus */
- XSetInputFocus(pWMInfo->pDisplay,
- pNode->msg.iWindow,
+
+ /* Set the input focus */
+ XSetInputFocus (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
RevertToPointerRoot, CurrentTime);
- break;
+ break;
- case WM_WM_NAME_EVENT:
- UpdateName(pWMInfo, pNode->msg.iWindow);
- break;
+ case WM_WM_NAME_EVENT:
+ UpdateName (pWMInfo, pNode->msg.iWindow);
+ break;
- case WM_WM_HINTS_EVENT:
- winUpdateIcon(pNode->msg.iWindow);
- break;
+ case WM_WM_ICON_EVENT:
+ UpdateIcon (pWMInfo, pNode->msg.iWindow);
+ break;
- case WM_WM_CHANGE_STATE:
- /* Minimize the window in Windows */
- winMinimizeWindow(pNode->msg.iWindow);
- break;
+ case WM_WM_HINTS_EVENT:
+ {
+ XWindowAttributes attr;
- default:
- ErrorF("winMultiWindowWMProc - Unknown Message. Exiting.\n");
- pthread_exit(NULL);
- break;
- }
+ /* Don't do anything if this is an override-redirect window */
+ XGetWindowAttributes (pWMInfo->pDisplay, pNode->msg.iWindow, &attr);
+ if (attr.override_redirect)
+ break;
- /* Free the retrieved message */
- free(pNode);
+ UpdateStyle(pWMInfo, pNode->msg.iWindow);
+ }
+ break;
- /* Flush any pending events on our display */
- XFlush(pWMInfo->pDisplay);
- }
+ case WM_WM_CHANGE_STATE:
+ /* Minimize the window in Windows */
+ winMinimizeWindow (pNode->msg.iWindow);
+ break;
- /* Free the condition variable */
- pthread_cond_destroy(&pWMInfo->wmMsgQueue.pcNotEmpty);
+ default:
+ ErrorF ("winMultiWindowWMProc - Unknown Message. Exiting.\n");
+ pthread_exit (NULL);
+ break;
+ }
- /* Free the mutex variable */
- pthread_mutex_destroy(&pWMInfo->wmMsgQueue.pmMutex);
+ /* Free the retrieved message */
+ free (pNode);
- /* Free the passed-in argument */
- free(pProcArg);
+ /* Flush any pending events on our display */
+ XFlush (pWMInfo->pDisplay);
+ }
+ /* Free the condition variable */
+ pthread_cond_destroy (&pWMInfo->wmMsgQueue.pcNotEmpty);
+
+ /* Free the mutex variable */
+ pthread_mutex_destroy (&pWMInfo->wmMsgQueue.pmMutex);
+
+ /* Free the passed-in argument */
+ free (pProcArg);
+
#if CYGMULTIWINDOW_DEBUG
- ErrorF("-winMultiWindowWMProc ()\n");
+ ErrorF("-winMultiWindowWMProc ()\n");
#endif
- return NULL;
+
+ pthread_cleanup_pop(0);
+
+ return NULL;
}
/*
@@ -789,305 +960,334 @@ winMultiWindowWMProc(void *pArg)
*/
static void *
-winMultiWindowXMsgProc(void *pArg)
+winMultiWindowXMsgProc (void *pArg)
{
- winWMMessageRec msg;
- XMsgProcArgPtr pProcArg = (XMsgProcArgPtr) pArg;
- char pszDisplay[512];
- int iRetries;
- XEvent event;
- Atom atmWmName;
- Atom atmWmHints;
- Atom atmWmChange;
- int iReturn;
- XIconSize *xis;
-
- ErrorF("winMultiWindowXMsgProc - Hello\n");
-
- /* Check that argument pointer is not invalid */
+ winWMMessageRec msg;
+ XMsgProcArgPtr pProcArg = (XMsgProcArgPtr) pArg;
+ char pszDisplay[512];
+ int iRetries;
+ XEvent event;
+ Atom atmWmName;
+ Atom atmWmChange;
+ int iReturn;
+ XIconSize *xis;
+
+ pthread_cleanup_push(&winMultiWindowThreadExit, NULL);
+
+ winDebug ("winMultiWindowXMsgProc - Hello\n");
+
+ /* Check that argument pointer is not invalid */
if (pProcArg == NULL) {
- ErrorF("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n");
+ pthread_exit (NULL);
}
- ErrorF("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
+ ErrorF ("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
- /* Grab the server started mutex - pause until we get it */
- iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
+ /* Grab the server started mutex - pause until we get it */
+ iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
if (iReturn != 0) {
- ErrorF("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. "
+ ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. "
"Exiting.\n", iReturn);
- pthread_exit(NULL);
+ pthread_exit (NULL);
}
- ErrorF("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
+ ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
- /* Allow multiple threads to access Xlib */
- if (XInitThreads() == 0) {
- ErrorF("winMultiWindowXMsgProc - XInitThreads () failed. Exiting.\n");
- pthread_exit(NULL);
- }
-
- /* See if X supports the current locale */
- if (XSupportsLocale() == False) {
- ErrorF("winMultiWindowXMsgProc - Warning: locale not supported by X\n");
- }
+ /* Release the server started mutex */
+ pthread_mutex_unlock (pProcArg->ppmServerStarted);
- /* Release the server started mutex */
- pthread_mutex_unlock(pProcArg->ppmServerStarted);
+ ErrorF ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
- ErrorF("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
-
- /* Install our error handler */
- XSetErrorHandler(winMultiWindowXMsgProcErrorHandler);
- g_winMultiWindowXMsgProcThread = pthread_self();
+ /* Install our error handler */
+ XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
+ g_winMultiWindowXMsgProcThread = pthread_self();
g_winMultiWindowXMsgProcOldIOErrorHandler =
XSetIOErrorHandler(winMultiWindowXMsgProcIOErrorHandler);
- /* Set jump point for IO Error exits */
- iReturn = setjmp(g_jmpXMsgProcEntry);
+ /* Set jump point for IO Error exits */
+ iReturn = setjmp (g_jmpXMsgProcEntry);
- /* Check if we should continue operations */
+ /* Check if we should continue operations */
if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) {
- /* setjmp returned an unknown value, exit */
- ErrorF("winInitMultiWindowXMsgProc - setjmp returned: %d. Exiting.\n",
- iReturn);
- pthread_exit(NULL);
+ /* setjmp returned an unknown value, exit */
+ ErrorF ("winInitMultiWindowXMsgProc - setjmp returned: %d. Exiting.\n",
+ iReturn);
+ pthread_exit (NULL);
}
else if (iReturn == WIN_JMP_ERROR_IO) {
- ErrorF("winInitMultiWindowXMsgProc - Caught IO Error. Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winInitMultiWindowXMsgProc - Caught IO Error. Exiting.\n");
+ pthread_exit (NULL);
}
- /* Setup the display connection string x */
- snprintf(pszDisplay,
- 512, "127.0.0.1:%s.%d", display, (int) pProcArg->dwScreen);
-
- /* Print the display connection string */
- ErrorF("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
+ /* Setup the display connection string x */
+ winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
- /* Use our generated cookie for authentication */
- winSetAuthorization();
+ /* Print the display connection string */
+ ErrorF ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
- /* Initialize retry count */
- iRetries = 0;
+ /* Use our generated cookie for authentication */
+ winSetAuthorization();
+
+ /* Initialize retry count */
+ iRetries = 0;
- /* Open the X display */
+ /* Open the X display */
do {
- /* Try to open the display */
- pProcArg->pDisplay = XOpenDisplay(pszDisplay);
+ /* Try to open the display */
+ pProcArg->pDisplay = XOpenDisplay (pszDisplay);
if (pProcArg->pDisplay == NULL) {
- ErrorF("winMultiWindowXMsgProc - Could not open display, try: %d, "
+ ErrorF ("winMultiWindowXMsgProc - Could not open display, try: %d, "
"sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY);
- ++iRetries;
- sleep(WIN_CONNECT_DELAY);
- continue;
- }
- else
- break;
+ ++iRetries;
+ sleep (WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
}
- while (pProcArg->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
-
- /* Make sure that the display opened */
+ while (pProcArg->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
if (pProcArg->pDisplay == NULL) {
- ErrorF("winMultiWindowXMsgProc - Failed opening the display. "
- "Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winMultiWindowXMsgProc - Failed opening the display. "
+ "Exiting.\n");
+ pthread_exit (NULL);
}
- ErrorF("winMultiWindowXMsgProc - XOpenDisplay () returned and "
- "successfully opened the display.\n");
+ ErrorF ("winMultiWindowXMsgProc - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
- /* Check if another window manager is already running */
+ /* Check if another window manager is already running */
g_fAnotherWMRunning =
CheckAnotherWindowManager(pProcArg->pDisplay, pProcArg->dwScreen,
pProcArg->pWMInfo->fAllowOtherWM);
if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM) {
- ErrorF("winMultiWindowXMsgProc - "
- "another window manager is running. Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winMultiWindowXMsgProc - "
+ "another window manager is running. Exiting.\n");
+ pthread_exit (NULL);
}
- /* Set up the supported icon sizes */
- xis = XAllocIconSize();
+ /* Set up the supported icon sizes */
+ xis = XAllocIconSize ();
if (xis) {
- xis->min_width = xis->min_height = 16;
- xis->max_width = xis->max_height = 48;
- xis->width_inc = xis->height_inc = 16;
- XSetIconSizes(pProcArg->pDisplay,
- RootWindow(pProcArg->pDisplay, pProcArg->dwScreen),
+ xis->min_width = xis->min_height = 16;
+ xis->max_width = xis->max_height = 48;
+ xis->width_inc = xis->height_inc = 16;
+ XSetIconSizes (pProcArg->pDisplay,
+ RootWindow (pProcArg->pDisplay, pProcArg->dwScreen),
xis, 1);
- XFree(xis);
+ XFree (xis);
}
- atmWmName = XInternAtom(pProcArg->pDisplay, "WM_NAME", False);
- atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False);
- atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False);
+ atmWmName = XInternAtom (pProcArg->pDisplay,
+ "WM_NAME",
+ False);
+ atmWmChange = XInternAtom (pProcArg->pDisplay,
+ "WM_CHANGE_STATE",
+ False);
- /*
- iiimxcf had a bug until 2009-04-27, assuming that the
- WM_STATE atom exists, causing clients to fail with
- a BadAtom X error if it doesn't.
+ /*
+ iiimxcf had a bug until 2009-04-27, assuming that the
+ WM_STATE atom exists, causing clients to fail with
+ a BadAtom X error if it doesn't.
- Since this is on in the default Solaris 10 install,
- workaround this by making sure it does exist...
- */
- XInternAtom(pProcArg->pDisplay, "WM_STATE", 0);
+ Since this is on in the default Solaris 10 install,
+ workaround this by making sure it does exist...
+ */
+ XInternAtom(pProcArg->pDisplay, "WM_STATE", 0);
- /* Loop until we explicitly break out */
+ /* Loop until we explicitly break out */
while (1) {
- if (g_shutdown)
- break;
+ if (g_shutdown)
+ break;
if (pProcArg->pWMInfo->fAllowOtherWM && !XPending(pProcArg->pDisplay)) {
if (CheckAnotherWindowManager
(pProcArg->pDisplay, pProcArg->dwScreen, TRUE)) {
if (!g_fAnotherWMRunning) {
- g_fAnotherWMRunning = TRUE;
+ g_fAnotherWMRunning = TRUE;
SendMessage(*(HWND *) pProcArg->hwndScreen, WM_UNMANAGE, 0,
0);
- }
- }
+ }
+ }
else {
if (g_fAnotherWMRunning) {
- g_fAnotherWMRunning = FALSE;
+ g_fAnotherWMRunning = FALSE;
SendMessage(*(HWND *) pProcArg->hwndScreen, WM_MANAGE, 0,
0);
- }
- }
- Sleep(500);
- continue;
- }
+ }
+ }
+ Sleep (500);
+ continue;
+ }
- /* Fetch next event */
- XNextEvent(pProcArg->pDisplay, &event);
+ /* Fetch next event */
+ XNextEvent (pProcArg->pDisplay, &event);
- /* Branch on event type */
+ /* Branch on event type */
if (event.type == CreateNotify) {
- XWindowAttributes attr;
+ XWindowAttributes attr;
- XSelectInput(pProcArg->pDisplay,
+ XSelectInput (pProcArg->pDisplay,
event.xcreatewindow.window, PropertyChangeMask);
- /* Get the window attributes */
- XGetWindowAttributes(pProcArg->pDisplay,
+ /* Get the window attributes */
+ XGetWindowAttributes (pProcArg->pDisplay,
event.xcreatewindow.window, &attr);
- if (!attr.override_redirect)
- XSetWindowBorderWidth(pProcArg->pDisplay,
+ if (!attr.override_redirect)
+ XSetWindowBorderWidth(pProcArg->pDisplay,
event.xcreatewindow.window, 0);
- }
+ }
else if (event.type == MapNotify) {
- /* Fake a reparentNotify event as SWT/Motif expects a
- Window Manager to reparent a top-level window when
- it is mapped and waits until they do.
-
- We don't actually need to reparent, as the frame is
- a native window, not an X window
-
- We do this on MapNotify, not MapRequest like a real
- Window Manager would, so we don't have do get involved
- in actually mapping the window via it's (non-existent)
- parent...
-
- See sourceware bugzilla #9848
- */
-
- XWindowAttributes attr;
- Window root;
- Window parent;
- Window *children;
- unsigned int nchildren;
-
- if (XGetWindowAttributes(event.xmap.display,
- event.xmap.window,
- &attr) &&
- XQueryTree(event.xmap.display,
- event.xmap.window,
+ /* Fake a reparentNotify event as SWT/Motif expects a
+ Window Manager to reparent a top-level window when
+ it is mapped and waits until they do.
+
+ We don't actually need to reparent, as the frame is
+ a native window, not an X window
+
+ We do this on MapNotify, not MapRequest like a real
+ Window Manager would, so we don't have do get involved
+ in actually mapping the window via it's (non-existent)
+ parent...
+
+ See sourceware bugzilla #9848
+ */
+
+ XWindowAttributes attr;
+ Window root;
+ Window parent;
+ Window *children;
+ unsigned int nchildren;
+
+ if (XGetWindowAttributes(event.xmap.display,
+ event.xmap.window,
+ &attr) &&
+ XQueryTree(event.xmap.display,
+ event.xmap.window,
&root, &parent, &children, &nchildren)) {
if (children)
XFree(children);
- /*
- It's a top-level window if the parent window is a root window
- Only non-override_redirect windows can get reparented
- */
+ /*
+ It's a top-level window if the parent window is a root window
+ Only non-override_redirect windows can get reparented
+ */
if ((attr.root == parent) && !event.xmap.override_redirect) {
- XEvent event_send;
+ XEvent event_send;
- event_send.type = ReparentNotify;
- event_send.xreparent.event = event.xmap.window;
- event_send.xreparent.window = event.xmap.window;
- event_send.xreparent.parent = parent;
- event_send.xreparent.x = attr.x;
- event_send.xreparent.y = attr.y;
+ event_send.type = ReparentNotify;
+ event_send.xreparent.event = event.xmap.window;
+ event_send.xreparent.window = event.xmap.window;
+ event_send.xreparent.parent = parent;
+ event_send.xreparent.x = attr.x;
+ event_send.xreparent.y = attr.y;
- XSendEvent(event.xmap.display,
- event.xmap.window,
+ XSendEvent(event.xmap.display,
+ event.xmap.window,
True, StructureNotifyMask, &event_send);
}
}
}
else if (event.type == ConfigureNotify) {
if (!event.xconfigure.send_event) {
- /*
- Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
- doesn't explicitly know about (See sun bug #6434227)
-
- XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
- ConfigureNotify events to update window location if it's identified the
- WM as a non-reparenting WM it knows about (compiz or lookingglass)
-
- Rather than tell all sorts of lies to get XWM to recognize us as one of
- those, simply send a synthetic ConfigureNotify for every non-synthetic one
- */
- XEvent event_send = event;
-
- event_send.xconfigure.send_event = TRUE;
- event_send.xconfigure.event = event.xconfigure.window;
- XSendEvent(event.xconfigure.display,
- event.xconfigure.window,
+ /*
+ Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
+ doesn't explicitly know about (See sun bug #6434227)
+
+ XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
+ ConfigureNotify events to update window location if it's identified the
+ WM as a non-reparenting WM it knows about (compiz or lookingglass)
+
+ Rather than tell all sorts of lies to get XWM to recognize us as one of
+ those, simply send a synthetic ConfigureNotify for every non-synthetic one
+ */
+ XEvent event_send = event;
+
+ event_send.xconfigure.send_event = TRUE;
+ event_send.xconfigure.event = event.xconfigure.window;
+ XSendEvent(event.xconfigure.display,
+ event.xconfigure.window,
True, StructureNotifyMask, &event_send);
}
}
- else if (event.type == PropertyNotify
- && event.xproperty.atom == atmWmName) {
- memset(&msg, 0, sizeof(msg));
-
- msg.msg = WM_WM_NAME_EVENT;
- msg.iWindow = event.xproperty.window;
+ else if (event.type == PropertyNotify)
+ {
+ char *atomName = XGetAtomName(pProcArg->pDisplay, event.xproperty.atom);
+ winDebug("winMultiWindowXMsgProc: PropertyNotify %s\n", atomName);
+ XFree(atomName);
+
+ if (event.xproperty.atom == atmWmName)
+ {
+ memset (&msg, 0, sizeof (msg));
+
+ msg.msg = WM_WM_NAME_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
+ else
+ {
+ static Atom atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints, atmWmHints, atmNetWmIcon;
+ if (atmWmHints == None) atmWmHints = XInternAtom (pProcArg->pDisplay, "WM_HINTS", False);
+ if (atmWindowState == None) atmWindowState = XInternAtom(pProcArg->pDisplay, "_NET_WM_STATE", False);
+ if (atmMotifWmHints == None) atmMotifWmHints = XInternAtom(pProcArg->pDisplay, "_MOTIF_WM_HINTS", False);
+ if (atmWindowType == None) atmWindowType = XInternAtom(pProcArg->pDisplay, "_NET_WM_WINDOW_TYPE", False);
+ if (atmNormalHints == None) atmNormalHints = XInternAtom(pProcArg->pDisplay, "WM_NORMAL_HINTS", False);
+ if (atmNetWmIcon == None) atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False);
+
+ /*
+ Several properties are considered for WM hints, check if this property change affects any of them...
+ (this list needs to be kept in sync with winApplyHints())
+ */
+ if ((event.xproperty.atom == atmWmHints) ||
+ (event.xproperty.atom == atmWindowState) ||
+ (event.xproperty.atom == atmMotifWmHints) ||
+ (event.xproperty.atom == atmWindowType) ||
+ (event.xproperty.atom == atmNormalHints))
+ {
+ memset (&msg, 0, sizeof (msg));
+ msg.msg = WM_WM_HINTS_EVENT;
+ msg.iWindow = event.xproperty.window;
- /* Other fields ignored */
- winSendMessageToWM(pProcArg->pWMInfo, &msg);
- }
- else if (event.type == PropertyNotify
- && event.xproperty.atom == atmWmHints) {
- memset(&msg, 0, sizeof(msg));
+ /* Other fields ignored */
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
- msg.msg = WM_WM_HINTS_EVENT;
- msg.iWindow = event.xproperty.window;
+ /* Not an else as WM_HINTS affects both style and icon */
+ if ((event.xproperty.atom == atmWmHints) ||
+ (event.xproperty.atom == atmNetWmIcon))
+ {
+ memset (&msg, 0, sizeof (msg));
+ msg.msg = WM_WM_ICON_EVENT;
+ msg.iWindow = event.xproperty.window;
- /* Other fields ignored */
- winSendMessageToWM(pProcArg->pWMInfo, &msg);
- }
- else if (event.type == ClientMessage
- && event.xclient.message_type == atmWmChange
+ /* Other fields ignored */
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
+ }
+ }
+ else if (event.type == ClientMessage
+ && event.xclient.message_type == atmWmChange
&& event.xclient.data.l[0] == IconicState) {
- ErrorF("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n");
+ ErrorF ("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n");
- memset(&msg, 0, sizeof(msg));
+ memset (&msg, 0, sizeof (msg));
- msg.msg = WM_WM_CHANGE_STATE;
- msg.iWindow = event.xclient.window;
+ msg.msg = WM_WM_CHANGE_STATE;
+ msg.iWindow = event.xclient.window;
- winSendMessageToWM(pProcArg->pWMInfo, &msg);
- }
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
}
- XCloseDisplay(pProcArg->pDisplay);
- pthread_exit(NULL);
- return NULL;
+ XCloseDisplay (pProcArg->pDisplay);
+ pthread_cleanup_pop(0);
+ return NULL;
}
/*
@@ -1097,68 +1297,68 @@ winMultiWindowXMsgProc(void *pArg)
*/
Bool
-winInitWM(void **ppWMInfo,
- pthread_t * ptWMProc,
- pthread_t * ptXMsgProc,
- pthread_mutex_t * ppmServerStarted,
+winInitWM (void **ppWMInfo,
+ pthread_t *ptWMProc,
+ pthread_t *ptXMsgProc,
+ pthread_mutex_t *ppmServerStarted,
int dwScreen, HWND hwndScreen, BOOL allowOtherWM)
{
- WMProcArgPtr pArg = (WMProcArgPtr) malloc(sizeof(WMProcArgRec));
- WMInfoPtr pWMInfo = (WMInfoPtr) malloc(sizeof(WMInfoRec));
- XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc(sizeof(XMsgProcArgRec));
-
- /* Bail if the input parameters are bad */
- if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
- ErrorF("winInitWM - malloc failed.\n");
- free(pArg);
- free(pWMInfo);
- free(pXMsgArg);
- return FALSE;
- }
-
- /* Zero the allocated memory */
- ZeroMemory(pArg, sizeof(WMProcArgRec));
- ZeroMemory(pWMInfo, sizeof(WMInfoRec));
- ZeroMemory(pXMsgArg, sizeof(XMsgProcArgRec));
-
- /* Set a return pointer to the Window Manager info structure */
- *ppWMInfo = pWMInfo;
- pWMInfo->fAllowOtherWM = allowOtherWM;
-
- /* Setup the argument structure for the thread function */
- pArg->dwScreen = dwScreen;
- pArg->pWMInfo = pWMInfo;
- pArg->ppmServerStarted = ppmServerStarted;
-
- /* Intialize the message queue */
+ WMProcArgPtr pArg = (WMProcArgPtr) malloc (sizeof(WMProcArgRec));
+ WMInfoPtr pWMInfo = (WMInfoPtr) malloc (sizeof(WMInfoRec));
+ XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec));
+
+ /* Bail if the input parameters are bad */
+ if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
+ ErrorF ("winInitWM - malloc failed.\n");
+ free(pArg);
+ free(pWMInfo);
+ free(pXMsgArg);
+ return FALSE;
+ }
+
+ /* Zero the allocated memory */
+ ZeroMemory (pArg, sizeof (WMProcArgRec));
+ ZeroMemory (pWMInfo, sizeof (WMInfoRec));
+ ZeroMemory (pXMsgArg, sizeof (XMsgProcArgRec));
+
+ /* Set a return pointer to the Window Manager info structure */
+ *ppWMInfo = pWMInfo;
+ pWMInfo->fAllowOtherWM = allowOtherWM;
+
+ /* Setup the argument structure for the thread function */
+ pArg->dwScreen = dwScreen;
+ pArg->pWMInfo = pWMInfo;
+ pArg->ppmServerStarted = ppmServerStarted;
+
+ /* Intialize the message queue */
if (!InitQueue(&pWMInfo->wmMsgQueue)) {
- ErrorF("winInitWM - InitQueue () failed.\n");
- return FALSE;
+ ErrorF ("winInitWM - InitQueue () failed.\n");
+ return FALSE;
}
-
- /* Spawn a thread for the Window Manager */
+
+ /* Spawn a thread for the Window Manager */
if (pthread_create(ptWMProc, NULL, winMultiWindowWMProc, pArg)) {
- /* Bail if thread creation failed */
- ErrorF("winInitWM - pthread_create failed for Window Manager.\n");
- return FALSE;
+ /* Bail if thread creation failed */
+ ErrorF ("winInitWM - pthread_create failed for Window Manager.\n");
+ return FALSE;
}
- /* Spawn the XNextEvent thread, will send messages to WM */
- pXMsgArg->dwScreen = dwScreen;
- pXMsgArg->pWMInfo = pWMInfo;
- pXMsgArg->ppmServerStarted = ppmServerStarted;
- pXMsgArg->hwndScreen = hwndScreen;
+ /* Spawn the XNextEvent thread, will send messages to WM */
+ pXMsgArg->dwScreen = dwScreen;
+ pXMsgArg->pWMInfo = pWMInfo;
+ pXMsgArg->ppmServerStarted = ppmServerStarted;
+ pXMsgArg->hwndScreen = hwndScreen;
if (pthread_create(ptXMsgProc, NULL, winMultiWindowXMsgProc, pXMsgArg)) {
- /* Bail if thread creation failed */
- ErrorF("winInitWM - pthread_create failed on XMSG.\n");
- return FALSE;
+ /* Bail if thread creation failed */
+ ErrorF ("winInitWM - pthread_create failed on XMSG.\n");
+ return FALSE;
}
#if CYGDEBUG || YES
- winDebug("winInitWM - Returning.\n");
+ winDebug ("winInitWM - Returning.\n");
#endif
- return TRUE;
+ return TRUE;
}
/*
@@ -1166,123 +1366,111 @@ winInitWM(void **ppWMInfo,
*/
static void
-winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
+winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
{
- int iRetries = 0;
- char pszDisplay[512];
- int iReturn;
+ int iRetries = 0;
+ char pszDisplay[512];
+ int iReturn;
- ErrorF("winInitMultiWindowWM - Hello\n");
+ winDebug ("winInitMultiWindowWM - Hello\n");
- /* Check that argument pointer is not invalid */
+ /* Check that argument pointer is not invalid */
if (pProcArg == NULL) {
- ErrorF("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n");
+ pthread_exit (NULL);
}
- ErrorF("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
+ ErrorF ("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
- /* Grab our garbage mutex to satisfy pthread_cond_wait */
- iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
+ /* Grab our garbage mutex to satisfy pthread_cond_wait */
+ iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
if (iReturn != 0) {
- ErrorF("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. "
+ ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. "
"Exiting.\n", iReturn);
- pthread_exit(NULL);
+ pthread_exit (NULL);
}
- ErrorF("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
+ ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
- /* Allow multiple threads to access Xlib */
- if (XInitThreads() == 0) {
- ErrorF("winInitMultiWindowWM - XInitThreads () failed. Exiting.\n");
- pthread_exit(NULL);
- }
-
- /* See if X supports the current locale */
- if (XSupportsLocale() == False) {
- ErrorF("winInitMultiWindowWM - Warning: Locale not supported by X.\n");
- }
+ /* Release the server started mutex */
+ pthread_mutex_unlock (pProcArg->ppmServerStarted);
- /* Release the server started mutex */
- pthread_mutex_unlock(pProcArg->ppmServerStarted);
+ ErrorF ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
- ErrorF("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
-
- /* Install our error handler */
- XSetErrorHandler(winMultiWindowWMErrorHandler);
- g_winMultiWindowWMThread = pthread_self();
+ /* Install our error handler */
+ XSetErrorHandler (winMultiWindowWMErrorHandler);
+ g_winMultiWindowWMThread = pthread_self();
g_winMultiWindowWMOldIOErrorHandler =
XSetIOErrorHandler(winMultiWindowWMIOErrorHandler);
- /* Set jump point for IO Error exits */
- iReturn = setjmp(g_jmpWMEntry);
+ /* Set jump point for IO Error exits */
+ iReturn = setjmp (g_jmpWMEntry);
- /* Check if we should continue operations */
+ /* Check if we should continue operations */
if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) {
- /* setjmp returned an unknown value, exit */
- ErrorF("winInitMultiWindowWM - setjmp returned: %d. Exiting.\n",
- iReturn);
- pthread_exit(NULL);
+ /* setjmp returned an unknown value, exit */
+ ErrorF ("winInitMultiWindowWM - setjmp returned: %d. Exiting.\n",
+ iReturn);
+ pthread_exit (NULL);
}
else if (iReturn == WIN_JMP_ERROR_IO) {
- ErrorF("winInitMultiWindowWM - Caught IO Error. Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winInitMultiWindowWM - Caught IO Error. Exiting.\n");
+ pthread_exit (NULL);
}
- /* Setup the display connection string x */
- snprintf(pszDisplay,
- 512, "127.0.0.1:%s.%d", display, (int) pProcArg->dwScreen);
+ /* Setup the display connection string x */
+ winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
- /* Print the display connection string */
- ErrorF("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
+ /* Print the display connection string */
+ ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
- /* Use our generated cookie for authentication */
- winSetAuthorization();
+ /* Use our generated cookie for authentication */
+ winSetAuthorization();
- /* Open the X display */
+ /* Open the X display */
do {
- /* Try to open the display */
- pWMInfo->pDisplay = XOpenDisplay(pszDisplay);
+ /* Try to open the display */
+ pWMInfo->pDisplay = XOpenDisplay (pszDisplay);
if (pWMInfo->pDisplay == NULL) {
- ErrorF("winInitMultiWindowWM - Could not open display, try: %d, "
+ ErrorF ("winInitMultiWindowWM - Could not open display, try: %d, "
"sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY);
- ++iRetries;
- sleep(WIN_CONNECT_DELAY);
- continue;
- }
- else
- break;
+ ++iRetries;
+ sleep (WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
}
- while (pWMInfo->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
-
- /* Make sure that the display opened */
+ while (pWMInfo->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
if (pWMInfo->pDisplay == NULL) {
- ErrorF("winInitMultiWindowWM - Failed opening the display. "
- "Exiting.\n");
- pthread_exit(NULL);
+ ErrorF ("winInitMultiWindowWM - Failed opening the display. "
+ "Exiting.\n");
+ pthread_exit (NULL);
}
- ErrorF("winInitMultiWindowWM - XOpenDisplay () returned and "
- "successfully opened the display.\n");
-
- /* Create some atoms */
- pWMInfo->atmWmProtos = XInternAtom(pWMInfo->pDisplay,
+ ErrorF ("winInitMultiWindowWM - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
+
+ /* Create some atoms */
+ pWMInfo->atmWmProtos = XInternAtom (pWMInfo->pDisplay,
"WM_PROTOCOLS", False);
- pWMInfo->atmWmDelete = XInternAtom(pWMInfo->pDisplay,
+ pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay,
"WM_DELETE_WINDOW", False);
- pWMInfo->atmPrivMap = XInternAtom(pWMInfo->pDisplay,
+ pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay,
WINDOWSWM_NATIVE_HWND, False);
- if (1) {
- Cursor cursor = XCreateFontCursor(pWMInfo->pDisplay, XC_left_ptr);
+ if (1) {
+ Cursor cursor = XCreateFontCursor (pWMInfo->pDisplay, XC_left_ptr);
if (cursor) {
XDefineCursor(pWMInfo->pDisplay,
DefaultRootWindow(pWMInfo->pDisplay), cursor);
- XFreeCursor(pWMInfo->pDisplay, cursor);
- }
+ XFreeCursor (pWMInfo->pDisplay, cursor);
}
+ }
}
/*
@@ -1290,18 +1478,18 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
*/
void
-winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg)
+winSendMessageToWM (void *pWMInfo, winWMMessagePtr pMsg)
{
- WMMsgNodePtr pNode;
-
+ WMMsgNodePtr pNode;
+
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winSendMessageToWM ()\n");
+ ErrorF ("winSendMessageToWM ()\n");
#endif
-
- pNode = (WMMsgNodePtr) malloc(sizeof(WMMsgNodeRec));
+
+ pNode = (WMMsgNodePtr)malloc(sizeof(WMMsgNodeRec));
if (pNode != NULL) {
- memcpy(&pNode->msg, pMsg, sizeof(winWMMessageRec));
- PushMessage(&((WMInfoPtr) pWMInfo)->wmMsgQueue, pNode);
+ memcpy (&pNode->msg, pMsg, sizeof(winWMMessageRec));
+ PushMessage (&((WMInfoPtr)pWMInfo)->wmMsgQueue, pNode);
}
}
@@ -1310,21 +1498,21 @@ winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg)
*/
static int
-winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr)
+winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr)
{
- char pszErrorMsg[100];
+ char pszErrorMsg[100];
- if (pErr->request_code == X_ChangeWindowAttributes
+ if (pErr->request_code == X_ChangeWindowAttributes
&& pErr->error_code == BadAccess) {
- ErrorF("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
- "BadAccess.\n");
- return 0;
+ ErrorF ("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
+ "BadAccess.\n");
+ return 0;
}
-
+
XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg));
- ErrorF("winMultiWindowWMErrorHandler - ERROR: %s\n", pszErrorMsg);
+ ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n", pszErrorMsg);
- return 0;
+ return 0;
}
/*
@@ -1332,22 +1520,22 @@ winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr)
*/
static int
-winMultiWindowWMIOErrorHandler(Display * pDisplay)
+winMultiWindowWMIOErrorHandler (Display *pDisplay)
{
- ErrorF("winMultiWindowWMIOErrorHandler!\n\n");
+ ErrorF ("winMultiWindowWMIOErrorHandler!\n");
if (pthread_equal(pthread_self(), g_winMultiWindowWMThread)) {
- if (g_shutdown)
- pthread_exit(NULL);
+ if (g_shutdown)
+ pthread_exit(NULL);
- /* Restart at the main entry point */
- longjmp(g_jmpWMEntry, WIN_JMP_ERROR_IO);
+ /* Restart at the main entry point */
+ longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO);
}
- if (g_winMultiWindowWMOldIOErrorHandler)
- g_winMultiWindowWMOldIOErrorHandler(pDisplay);
+ if (g_winMultiWindowWMOldIOErrorHandler)
+ g_winMultiWindowWMOldIOErrorHandler(pDisplay);
- return 0;
+ return 0;
}
/*
@@ -1355,16 +1543,16 @@ winMultiWindowWMIOErrorHandler(Display * pDisplay)
*/
static int
-winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr)
+winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr)
{
- char pszErrorMsg[100];
-
+ char pszErrorMsg[100];
+
XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg));
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg);
+ ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg);
#endif
-
- return 0;
+
+ return 0;
}
/*
@@ -1372,19 +1560,30 @@ winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr)
*/
static int
-winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay)
+winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay)
{
- ErrorF("winMultiWindowXMsgProcIOErrorHandler!\n\n");
+ ErrorF ("winMultiWindowXMsgProcIOErrorHandler!\n");
if (pthread_equal(pthread_self(), g_winMultiWindowXMsgProcThread)) {
- /* Restart at the main entry point */
- longjmp(g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
+ /* Restart at the main entry point */
+ longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
}
- if (g_winMultiWindowXMsgProcOldIOErrorHandler)
- g_winMultiWindowXMsgProcOldIOErrorHandler(pDisplay);
+ if (g_winMultiWindowXMsgProcOldIOErrorHandler)
+ g_winMultiWindowXMsgProcOldIOErrorHandler(pDisplay);
- return 0;
+ return 0;
+}
+
+/*
+ * winMultiWindowThreadExit - Thread exit handler
+ */
+
+static void
+winMultiWindowThreadExit(void *arg)
+{
+ /* multiwindow client thread has exited, stop server as well */
+ kill(getpid(), SIGTERM);
}
/*
@@ -1392,10 +1591,10 @@ winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay)
*/
static int
-winRedirectErrorHandler(Display * pDisplay, XErrorEvent * pErr)
+winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
{
- redirectError = TRUE;
- return 0;
+ redirectError = TRUE;
+ return 0;
}
/*
@@ -1406,29 +1605,29 @@ static Bool
CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen,
Bool fAllowOtherWM)
{
- /*
- Try to select the events which only one client at a time is allowed to select.
- If this causes an error, another window manager is already running...
- */
- redirectError = FALSE;
- XSetErrorHandler(winRedirectErrorHandler);
- XSelectInput(pDisplay, RootWindow(pDisplay, dwScreen),
+ /*
+ Try to select the events which only one client at a time is allowed to select.
+ If this causes an error, another window manager is already running...
+ */
+ redirectError = FALSE;
+ XSetErrorHandler (winRedirectErrorHandler);
+ XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
ResizeRedirectMask | SubstructureRedirectMask |
ButtonPressMask);
- XSync(pDisplay, 0);
- XSetErrorHandler(winMultiWindowXMsgProcErrorHandler);
+ XSync (pDisplay, 0);
+ XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
- /*
- Side effect: select the events we are actually interested in...
+ /*
+ Side effect: select the events we are actually interested in...
- If other WMs are not allowed, also select one of the events which only one client
- at a time is allowed to select, so other window managers won't start...
- */
- XSelectInput(pDisplay, RootWindow(pDisplay, dwScreen),
+ If other WMs are not allowed, also select one of the events which only one client
+ at a time is allowed to select, so other window managers won't start...
+ */
+ XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
SubstructureNotifyMask | (!fAllowOtherWM ? ButtonPressMask :
0));
- XSync(pDisplay, 0);
- return redirectError;
+ XSync (pDisplay, 0);
+ return redirectError;
}
/*
@@ -1436,10 +1635,43 @@ CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen,
*/
void
-winDeinitMultiWindowWM(void)
+winDeinitMultiWindowWM (void)
+{
+ ErrorF ("winDeinitMultiWindowWM - Noting shutdown in progress\n");
+ g_shutdown = TRUE;
+}
+
+static void
+winApplyUrgency (Display *pDisplay, Window iWindow, HWND hWnd)
{
- ErrorF("winDeinitMultiWindowWM - Noting shutdown in progress\n");
- g_shutdown = TRUE;
+ XWMHints *hints = XGetWMHints(pDisplay, iWindow);
+ if (hints)
+ {
+ FLASHWINFO fwi;
+ fwi.cbSize = sizeof(FLASHWINFO);
+ fwi.hwnd = hWnd;
+
+ winDebug("winApplyUrgency: window 0x%08x has urgency hint %s\n", iWindow, (hints->flags & XUrgencyHint) ? "on" : "off");
+
+ if (hints->flags & XUrgencyHint)
+ {
+ DWORD count = 3;
+ SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &count, 0);
+ fwi.dwFlags = FLASHW_TRAY;
+ fwi.uCount = count;
+ fwi.dwTimeout = 0;
+ }
+ else
+ {
+ fwi.dwFlags = FLASHW_STOP;
+ fwi.uCount = 0;
+ fwi.dwTimeout = 0;
+ }
+
+ FlashWindowEx(&fwi);
+
+ XFree(hints);
+ }
}
/* Windows window styles */
@@ -1450,60 +1682,65 @@ winDeinitMultiWindowWM(void)
#define HINT_NOMAXIMIZE (1L<<4)
#define HINT_NOMINIMIZE (1L<<5)
#define HINT_NOSYSMENU (1L<<6)
+#define HINT_SKIPTASKBAR (1L<<7)
/* These two are used on their own */
#define HINT_MAX (1L<<0)
#define HINT_MIN (1L<<1)
static void
-winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
+winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
{
- static Atom windowState, motif_wm_hints, windowType;
- static Atom hiddenState, fullscreenState, belowState, aboveState;
- static Atom dockWindow;
- static int generation;
- Atom type, *pAtom = NULL;
- int format;
- unsigned long hint = 0, maxmin = 0, style, nitems = 0, left = 0;
- MwmHints *mwm_hint = NULL;
+ static Atom windowState, motif_wm_hints, windowType;
+ static Atom hiddenState, fullscreenState, belowState, aboveState, skiptaskbarState;
+ static Atom dockWindow;
+ static int generation;
+ Atom type, *pAtom = NULL;
+ int format;
+ unsigned long hint = 0, maxmin = 0, nitems = 0 , left = 0;
+ unsigned long style, exStyle;
+ MwmHints *mwm_hint = NULL;
if (!hWnd)
return;
if (!IsWindow(hWnd))
return;
- if (generation != serverGeneration) {
- generation = serverGeneration;
- windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False);
- motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False);
- windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False);
- hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False);
+ if (generation != serverGeneration) {
+ generation = serverGeneration;
+ windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False);
+ motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False);
+ windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False);
+ hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False);
fullscreenState =
XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False);
- belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
- aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
- dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
- }
-
- if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
- 1L, False, XA_ATOM, &type, &format,
- &nitems, &left,
- (unsigned char **) &pAtom) == Success) {
- if (pAtom && nitems == 1) {
- if (*pAtom == hiddenState)
- maxmin |= HINT_MIN;
- else if (*pAtom == fullscreenState)
- maxmin |= HINT_MAX;
- if (*pAtom == belowState)
- *zstyle = HWND_BOTTOM;
- else if (*pAtom == aboveState)
- *zstyle = HWND_TOPMOST;
- }
- if (pAtom)
- XFree(pAtom);
+ belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
+ aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
+ dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
+ skiptaskbarState = XInternAtom(pDisplay, "_NET_WM_STATE_SKIP_TASKBAR", False);
+ }
+
+ if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
+ MAXINT, False, XA_ATOM, &type, &format,
+ &nitems, &left, (unsigned char **)&pAtom) == Success)
+ {
+ if (pAtom)
+ {
+ unsigned long i;
+ for (i = 0; i < nitems; i++)
+ {
+ if (*pAtom == skiptaskbarState) hint |= HINT_SKIPTASKBAR;
+ if (*pAtom == hiddenState) maxmin |= HINT_MIN;
+ else if (*pAtom == fullscreenState) maxmin |= HINT_MAX;
+ if (*pAtom == belowState) *zstyle = HWND_BOTTOM;
+ else if (*pAtom == aboveState) *zstyle = HWND_TOPMOST;
+ }
+
+ XFree(pAtom);
}
+ }
- nitems = left = 0;
- if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L,
+ nitems = left = 0;
+ if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L,
PropMwmHintsElements, False, motif_wm_hints, &type,
&format, &nitems, &left,
(unsigned char **) &mwm_hint) == Success) {
@@ -1524,82 +1761,96 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
hint |= HINT_NOMINIMIZE;
if (!(mwm_hint->decorations & MwmDecorMaximize))
hint |= HINT_NOMAXIMIZE;
- }
+ }
else {
- /*
- MwmDecorAll means all decorations *except* those specified by other flag
- bits that are set. Not yet implemented.
- */
- }
- }
+ /*
+ MwmDecorAll means all decorations *except* those specified by other flag
+ bits that are set. Not yet implemented.
+ */
+ }
+ }
if (mwm_hint)
XFree(mwm_hint);
- }
+ }
- nitems = left = 0;
- pAtom = NULL;
- if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L,
- 1L, False, XA_ATOM, &type, &format,
+ nitems = left = 0;
+ pAtom = NULL;
+ if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L,
+ 1L, False, XA_ATOM, &type, &format,
&nitems, &left,
(unsigned char **) &pAtom) == Success) {
if (pAtom && nitems == 1) {
if (*pAtom == dockWindow) {
- hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */
- *zstyle = HWND_TOPMOST;
- }
- }
+ hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */
+ *zstyle = HWND_TOPMOST;
+ }
+ }
if (pAtom)
XFree(pAtom);
- }
+ }
- {
- XSizeHints *normal_hint = XAllocSizeHints();
- long supplied;
+ {
+ XSizeHints *normal_hint = XAllocSizeHints();
+ long supplied;
if (normal_hint &&
(XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) ==
Success)) {
if (normal_hint->flags & PMaxSize) {
- /* Not maximizable if a maximum size is specified */
- hint |= HINT_NOMAXIMIZE;
+ /* Not maximizable if a maximum size is specified */
+ hint |= HINT_NOMAXIMIZE;
if (normal_hint->flags & PMinSize) {
- /*
- If both minimum size and maximum size are specified and are the same,
- don't bother with a resizing frame
- */
- if ((normal_hint->min_width == normal_hint->max_width)
- && (normal_hint->min_height == normal_hint->max_height))
- hint = (hint & ~HINT_SIZEBOX);
- }
- }
- }
- XFree(normal_hint);
- }
-
- /* Override hint settings from above with settings from config file */
- {
- XClassHint class_hint = { 0, 0 };
- char *window_name = 0;
+ /*
+ If both minimum size and maximum size are specified and are the same,
+ don't bother with a resizing frame
+ */
+ if ((normal_hint->min_width == normal_hint->max_width)
+ && (normal_hint->min_height == normal_hint->max_height))
+ hint = (hint & ~HINT_SIZEBOX);
+ }
+ }
+ }
+ XFree(normal_hint);
+ }
+
+ /*
+ Override hint settings from above with settings from config file and set
+ application id for grouping.
+ */
+ {
+ XClassHint class_hint = {0,0};
+ char *window_name = 0;
+ char *application_id = 0;
if (XGetClassHint(pDisplay, iWindow, &class_hint)) {
- XFetchName(pDisplay, iWindow, &window_name);
+ XFetchName(pDisplay, iWindow, &window_name);
style =
winOverrideStyle(class_hint.res_name, class_hint.res_class,
window_name);
- if (class_hint.res_name)
- XFree(class_hint.res_name);
- if (class_hint.res_class)
- XFree(class_hint.res_class);
- if (window_name)
- XFree(window_name);
- }
+#define APPLICATION_ID_FORMAT "%s.xwin.%s"
+#define APPLICATION_ID_UNKNOWN "unknown"
+ if (class_hint.res_class)
+ {
+ asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class);
+ }
+ else
+ {
+ asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN);
+ }
+ winSetAppID (hWnd, application_id);
+
+ if (class_hint.res_name) XFree(class_hint.res_name);
+ if (class_hint.res_class) XFree(class_hint.res_class);
+ if (application_id) free(application_id);
+ if (window_name) XFree(window_name);
+ }
else {
- style = STYLE_NONE;
- }
- }
+ style = STYLE_NONE;
+ }
+ }
if (style & STYLE_TOPMOST)
*zstyle = HWND_TOPMOST;
@@ -1615,103 +1866,204 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
else if (maxmin & HINT_MIN)
SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- if (style & STYLE_NOTITLE)
+ if (style & STYLE_NOTITLE)
hint =
(hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) |
HINT_SIZEBOX;
- else if (style & STYLE_OUTLINE)
+ else if (style & STYLE_OUTLINE)
hint =
(hint & ~HINT_NOFRAME & ~HINT_SIZEBOX & ~HINT_CAPTION) |
HINT_BORDER;
- else if (style & STYLE_NOFRAME)
+ else if (style & STYLE_NOFRAME)
hint =
(hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) |
HINT_NOFRAME;
- /* Now apply styles to window */
- style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
- if (!style)
- return;
+ /* Now apply styles to window */
+ style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
+ if (!style) return; /* GetWindowLongPointer returns 0 on failure, we hope this isn't a valid style */
- if (!hint) /* All on */
- style = style | WS_CAPTION | WS_SIZEBOX;
- else if (hint & HINT_NOFRAME) /* All off */
- style = style & ~WS_CAPTION & ~WS_SIZEBOX;
+ if (!(hint & ~HINT_SKIPTASKBAR)) /* All on */
+ style = style | WS_CAPTION | WS_SIZEBOX;
+ else if (hint & HINT_NOFRAME) /* All off */
+ style = style & ~WS_CAPTION & ~WS_SIZEBOX;
else
style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) |
- ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
- ((hint & HINT_CAPTION) ? WS_CAPTION : 0);
+ ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
+ ((hint & HINT_CAPTION) ? WS_CAPTION : 0);
+
+ if (hint & HINT_NOMAXIMIZE)
+ style = style & ~WS_MAXIMIZEBOX;
+
+ if (hint & HINT_NOMINIMIZE)
+ style = style & ~WS_MINIMIZEBOX;
- if (hint & HINT_NOMAXIMIZE)
- style = style & ~WS_MAXIMIZEBOX;
+ if (hint & HINT_NOSYSMENU)
+ style = style & ~WS_SYSMENU;
- if (hint & HINT_NOMINIMIZE)
- style = style & ~WS_MINIMIZEBOX;
+ if (hint & HINT_SKIPTASKBAR)
+ style = style & ~WS_MINIMIZEBOX; /* window will become lost if minimized */
- if (hint & HINT_NOSYSMENU)
- style = style & ~WS_SYSMENU;
+ SetWindowLongPtr (hWnd, GWL_STYLE, style);
- SetWindowLongPtr(hWnd, GWL_STYLE, style);
+ /* now we have iTaskbar, use that as well */
+ exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+ if (hint & HINT_SKIPTASKBAR)
+ exStyle = (exStyle & ~WS_EX_APPWINDOW) | WS_EX_TOOLWINDOW;
+ else
+ exStyle = (exStyle & ~WS_EX_TOOLWINDOW) | WS_EX_APPWINDOW;
+ SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle);
+
+ winDebug("winApplyHints: iWindow 0x%08x hints 0x%08x style 0x%08x exstyle 0x%08x\n", iWindow, hint, style, exStyle);
}
void
-winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle)
+winUpdateWindowPosition (HWND hWnd, HWND *zstyle)
{
- int iX, iY, iWidth, iHeight;
- int iDx, iDy;
- RECT rcNew;
- WindowPtr pWin = GetProp(hWnd, WIN_WINDOW_PROP);
- DrawablePtr pDraw = NULL;
+ int iX, iY, iWidth, iHeight;
+ int iDx, iDy;
+ RECT rcNew;
+ WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
+ DrawablePtr pDraw = NULL;
if (!pWin)
return;
- pDraw = &pWin->drawable;
+ pDraw = &pWin->drawable;
if (!pDraw)
return;
- /* Get the X and Y location of the X window */
- iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* Get the height and width of the X window */
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
- /* Setup a rectangle with the X window position and size */
- SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+ /* Setup a rectangle with the X window position and size */
+ SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
-#if 0
- ErrorF("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom);
-#endif
+ winDebug("winUpdateWindowPosition - drawable extent (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top,
+ rcNew.right, rcNew.bottom);
- AdjustWindowRectEx(&rcNew, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE,
- WS_EX_APPWINDOW);
+ AdjustWindowRectEx (&rcNew, GetWindowLongPtr (hWnd, GWL_STYLE), FALSE, GetWindowLongPtr (hWnd, GWL_EXSTYLE));
- /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
+ /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) {
- iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
- rcNew.left += iDx;
- rcNew.right += iDx;
+ iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
+ rcNew.left += iDx;
+ rcNew.right += iDx;
}
if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) {
- iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
}
-#if 0
- ErrorF("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom);
-#endif
+ winDebug("winUpdateWindowPosition - Window extent (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top,
+ rcNew.right, rcNew.bottom);
- /* Position the Windows window */
- SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top,
+ /* Position the Windows window */
+ SetWindowPos (hWnd, *zstyle, rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0);
+}
+
+void
+winTaskbarInit (void)
+{
+ /*
+ Load libraries and get function pointers to SHGetPropertyStoreForWindow
+ and PropVariantClear for winSetAppID()
+ */
+
+ /*
+ SHGetPropertyStoreForWindow is only supported since Windows 7. On previous
+ versions the pointer will be NULL and taskbar grouping is not supported.
+ winSetAppID() will do nothing in this case.
+ */
+ g_hmodShell32Dll = LoadLibrary ("shell32.dll");
+ if (g_hmodShell32Dll == NULL)
+ {
+ ErrorF ("winTaskbarInit - Could not load shell32.dll\n");
+ return;
+ }
+
+ g_pSHGetPropertyStoreForWindow = (SHGETPROPERTYSTOREFORWINDOWPROC) GetProcAddress (g_hmodShell32Dll, "SHGetPropertyStoreForWindow");
+ if (g_pSHGetPropertyStoreForWindow == NULL)
+ {
+ ErrorF ("winTaskbarInit - Could not get SHGetPropertyStoreForWindow address\n");
+ return;
+ }
+
+ /*
+ PropVariantClear is supported since NT4, but we have no propidl.h to
+ provide a prototype for it
+ */
+ g_hmodOle32Dll = LoadLibrary ("ole32.dll");
+ if (g_hmodOle32Dll == NULL)
+ {
+ ErrorF ("winTaskbarInit - Could not load ole32.dll\n");
+ return;
+ }
+
+ g_pPropVariantClear = (PROPVARIANTCLEARPROC) GetProcAddress (g_hmodOle32Dll, "PropVariantClear");
+ if (g_pPropVariantClear == NULL)
+ {
+ ErrorF ("winTaskbarInit - Could not get g_pPropVariantClear address\n");
+ return;
+ }
+}
+
+void
+winTaskbarDestroy (void)
+{
+ if (g_hmodOle32Dll != NULL)
+ {
+ FreeLibrary (g_hmodOle32Dll);
+ g_hmodOle32Dll = NULL;
+ g_pPropVariantClear = NULL;
+ }
+ if (g_hmodShell32Dll != NULL)
+ {
+ FreeLibrary (g_hmodShell32Dll);
+ g_hmodShell32Dll = NULL;
+ g_pSHGetPropertyStoreForWindow = NULL;
+ }
+}
+
+void
+winSetAppID (HWND hWnd, const char* AppID)
+{
+ PROPVARIANT pv;
+ IPropertyStore *pps = NULL;
+ HRESULT hr;
+
+ if (g_pSHGetPropertyStoreForWindow == NULL ||
+ g_pPropVariantClear == NULL)
+ {
+ return;
+ }
+
+ winDebug ("winSetAppID - hwnd 0x%08x appid '%s'\n", hWnd, AppID);
- if (reshape) {
- winReshapeMultiWindow(pWin);
- winUpdateRgnMultiWindow(pWin);
+ hr = g_pSHGetPropertyStoreForWindow (hWnd, &IID_IPropertyStore, (void**)&pps);
+ if(SUCCEEDED(hr) && pps)
+ {
+ memset(&pv, 0, sizeof(PROPVARIANT));
+ if(AppID)
+ {
+ pv.vt = VT_LPWSTR;
+ hr = SHStrDupA(AppID, &pv.pwszVal);
+ }
+
+ if(SUCCEEDED(hr))
+ {
+ hr = pps->lpVtbl->SetValue(pps, &PKEY_AppUserModel_ID, &pv);
+ g_pPropVariantClear(&pv);
+ }
+ pps->lpVtbl->Release(pps);
}
}
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index af917d6fc..a73d70bb5 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -42,13 +42,13 @@
#include "winmsg.h"
#include "inputstr.h"
-extern void winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
+extern void winUpdateWindowPosition (HWND hWnd, HWND *zstyle);
/*
* Local globals
*/
-static UINT_PTR g_uipMousePollingTimerID = 0;
+static UINT_PTR g_uipMousePollingTimerID = 0;
/*
* Constant defines
@@ -61,125 +61,125 @@ static UINT_PTR g_uipMousePollingTimerID = 0;
*/
#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
static void
-ConstrainSize(WinXSizeHints hints, int *widthp, int *heightp)
+ConstrainSize (WinXSizeHints hints, int *widthp, int *heightp)
{
- int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
- int baseWidth, baseHeight;
- int dwidth = *widthp, dheight = *heightp;
-
+ int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
+ int baseWidth, baseHeight;
+ int dwidth = *widthp, dheight = *heightp;
+
if (hints.flags & PMinSize) {
- minWidth = hints.min_width;
- minHeight = hints.min_height;
+ minWidth = hints.min_width;
+ minHeight = hints.min_height;
}
else if (hints.flags & PBaseSize) {
- minWidth = hints.base_width;
- minHeight = hints.base_height;
+ minWidth = hints.base_width;
+ minHeight = hints.base_height;
}
- else
- minWidth = minHeight = 1;
-
+ else
+ minWidth = minHeight = 1;
+
if (hints.flags & PBaseSize) {
- baseWidth = hints.base_width;
- baseHeight = hints.base_height;
- }
+ baseWidth = hints.base_width;
+ baseHeight = hints.base_height;
+ }
else if (hints.flags & PMinSize) {
- baseWidth = hints.min_width;
- baseHeight = hints.min_height;
+ baseWidth = hints.min_width;
+ baseHeight = hints.min_height;
}
- else
- baseWidth = baseHeight = 0;
+ else
+ baseWidth = baseHeight = 0;
if (hints.flags & PMaxSize) {
- maxWidth = hints.max_width;
- maxHeight = hints.max_height;
+ maxWidth = hints.max_width;
+ maxHeight = hints.max_height;
}
else {
- maxWidth = MAXINT;
- maxHeight = MAXINT;
+ maxWidth = MAXINT;
+ maxHeight = MAXINT;
}
if (hints.flags & PResizeInc) {
- xinc = hints.width_inc;
- yinc = hints.height_inc;
+ xinc = hints.width_inc;
+ yinc = hints.height_inc;
}
- else
- xinc = yinc = 1;
-
- /*
- * First, clamp to min and max values
- */
- if (dwidth < minWidth)
- dwidth = minWidth;
- if (dheight < minHeight)
- dheight = minHeight;
-
- if (dwidth > maxWidth)
- dwidth = maxWidth;
- if (dheight > maxHeight)
- dheight = maxHeight;
-
- /*
- * Second, fit to base + N * inc
- */
- dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
- dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
-
- /*
- * Third, adjust for aspect ratio
- */
-
- /*
- * The math looks like this:
- *
- * minAspectX dwidth maxAspectX
- * ---------- <= ------- <= ----------
- * minAspectY dheight maxAspectY
- *
- * If that is multiplied out, then the width and height are
- * invalid in the following situations:
- *
- * minAspectX * dheight > minAspectY * dwidth
- * maxAspectX * dheight < maxAspectY * dwidth
- *
- */
-
+ else
+ xinc = yinc = 1;
+
+ /*
+ * First, clamp to min and max values
+ */
+ if (dwidth < minWidth)
+ dwidth = minWidth;
+ if (dheight < minHeight)
+ dheight = minHeight;
+
+ if (dwidth > maxWidth)
+ dwidth = maxWidth;
+ if (dheight > maxHeight)
+ dheight = maxHeight;
+
+ /*
+ * Second, fit to base + N * inc
+ */
+ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
+ dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
+
+ /*
+ * Third, adjust for aspect ratio
+ */
+
+ /*
+ * The math looks like this:
+ *
+ * minAspectX dwidth maxAspectX
+ * ---------- <= ------- <= ----------
+ * minAspectY dheight maxAspectY
+ *
+ * If that is multiplied out, then the width and height are
+ * invalid in the following situations:
+ *
+ * minAspectX * dheight > minAspectY * dwidth
+ * maxAspectX * dheight < maxAspectY * dwidth
+ *
+ */
+
if (hints.flags & PAspect) {
if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth) {
delta =
makemult(hints.min_aspect.x * dheight / hints.min_aspect.y -
dwidth, xinc);
- if (dwidth + delta <= maxWidth)
- dwidth += delta;
+ if (dwidth + delta <= maxWidth)
+ dwidth += delta;
else {
delta =
makemult(dheight -
dwidth * hints.min_aspect.y / hints.min_aspect.x,
yinc);
- if (dheight - delta >= minHeight)
- dheight -= delta;
+ if (dheight - delta >= minHeight)
+ dheight -= delta;
}
}
-
+
if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth) {
delta =
makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x -
dheight, yinc);
- if (dheight + delta <= maxHeight)
- dheight += delta;
+ if (dheight + delta <= maxHeight)
+ dheight += delta;
else {
delta =
makemult(dwidth -
hints.max_aspect.x * dheight / hints.max_aspect.y,
xinc);
- if (dwidth - delta >= minWidth)
- dwidth -= delta;
+ if (dwidth - delta >= minWidth)
+ dwidth -= delta;
}
}
}
-
- /* Return computed values */
- *widthp = dwidth;
- *heightp = dheight;
+
+ /* Return computed values */
+ *widthp = dwidth;
+ *heightp = dheight;
}
#undef makemult
@@ -190,107 +190,107 @@ ConstrainSize(WinXSizeHints hints, int *widthp, int *heightp)
static int
ValidateSizing(HWND hwnd, WindowPtr pWin, WPARAM wParam, LPARAM lParam)
{
- WinXSizeHints sizeHints;
- RECT *rect;
- int iWidth, iHeight;
- RECT rcClient, rcWindow;
- int iBorderWidthX, iBorderWidthY;
-
- /* Invalid input checking */
- if (pWin == NULL || lParam == 0)
- return FALSE;
-
- /* No size hints, no checking */
- if (!winMultiWindowGetWMNormalHints(pWin, &sizeHints))
- return FALSE;
-
- /* Avoid divide-by-zero */
+ WinXSizeHints sizeHints;
+ RECT *rect;
+ int iWidth, iHeight;
+ RECT rcClient, rcWindow;
+ int iBorderWidthX, iBorderWidthY;
+
+ /* Invalid input checking */
+ if (pWin==NULL || lParam==0)
+ return FALSE;
+
+ /* No size hints, no checking */
+ if (!winMultiWindowGetWMNormalHints (pWin, &sizeHints))
+ return FALSE;
+
+ /* Avoid divide-by-zero */
if (sizeHints.flags & PResizeInc) {
if (sizeHints.width_inc == 0)
sizeHints.width_inc = 1;
if (sizeHints.height_inc == 0)
sizeHints.height_inc = 1;
}
-
- rect = (RECT *) lParam;
-
- iWidth = rect->right - rect->left;
- iHeight = rect->bottom - rect->top;
-
- /* Now remove size of any borders and title bar */
- GetClientRect(hwnd, &rcClient);
- GetWindowRect(hwnd, &rcWindow);
+
+ rect = (RECT*)lParam;
+
+ iWidth = rect->right - rect->left;
+ iHeight = rect->bottom - rect->top;
+
+ /* Now remove size of any borders and title bar */
+ GetClientRect(hwnd, &rcClient);
+ GetWindowRect(hwnd, &rcWindow);
iBorderWidthX =
(rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left);
iBorderWidthY =
(rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top);
- iWidth -= iBorderWidthX;
- iHeight -= iBorderWidthY;
-
- /* Constrain the size to legal values */
- ConstrainSize(sizeHints, &iWidth, &iHeight);
-
- /* Add back the size of borders and title bar */
- iWidth += iBorderWidthX;
- iHeight += iBorderWidthY;
-
- /* Adjust size according to where we're dragging from */
- switch (wParam) {
- case WMSZ_TOP:
- case WMSZ_TOPRIGHT:
- case WMSZ_BOTTOM:
- case WMSZ_BOTTOMRIGHT:
- case WMSZ_RIGHT:
- rect->right = rect->left + iWidth;
- break;
- default:
- rect->left = rect->right - iWidth;
- break;
- }
- switch (wParam) {
- case WMSZ_BOTTOM:
- case WMSZ_BOTTOMRIGHT:
- case WMSZ_BOTTOMLEFT:
- case WMSZ_RIGHT:
- case WMSZ_LEFT:
- rect->bottom = rect->top + iHeight;
- break;
- default:
- rect->top = rect->bottom - iHeight;
- break;
- }
- return TRUE;
+ iWidth -= iBorderWidthX;
+ iHeight -= iBorderWidthY;
+
+ /* Constrain the size to legal values */
+ ConstrainSize (sizeHints, &iWidth, &iHeight);
+
+ /* Add back the size of borders and title bar */
+ iWidth += iBorderWidthX;
+ iHeight += iBorderWidthY;
+
+ /* Adjust size according to where we're dragging from */
+ switch(wParam) {
+ case WMSZ_TOP:
+ case WMSZ_TOPRIGHT:
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_RIGHT:
+ rect->right = rect->left + iWidth;
+ break;
+ default:
+ rect->left = rect->right - iWidth;
+ break;
+ }
+ switch(wParam) {
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_BOTTOMLEFT:
+ case WMSZ_RIGHT:
+ case WMSZ_LEFT:
+ rect->bottom = rect->top + iHeight;
+ break;
+ default:
+ rect->top = rect->bottom - iHeight;
+ break;
+ }
+ return TRUE;
}
extern Bool winInDestroyWindowsWindow;
static Bool winInRaiseWindow = FALSE;
static void
winRaiseWindow(WindowPtr pWin)
-{
+ {
if (!winInDestroyWindowsWindow && !winInRaiseWindow) {
- BOOL oldstate = winInRaiseWindow;
- XID vlist[1] = { 0 };
- winInRaiseWindow = TRUE;
- /* Call configure window directly to make sure it gets processed
- * in time
- */
- ConfigureWindow(pWin, CWStackMode, vlist, serverClient);
- winInRaiseWindow = oldstate;
- }
+ BOOL oldstate = winInRaiseWindow;
+ XID vlist[1] = { 0 };
+ winInRaiseWindow = TRUE;
+ /* Call configure window directly to make sure it gets processed
+ * in time
+ */
+ ConfigureWindow(pWin, CWStackMode, vlist, serverClient);
+ winInRaiseWindow = oldstate;
+ }
}
static
void
winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
{
- /*
- * Timer to poll mouse position. This is needed to make
- * programs like xeyes follow the mouse properly when the
- * mouse pointer is outside of any X window.
- */
- if (g_uipMousePollingTimerID == 0)
- g_uipMousePollingTimerID = SetTimer(s_pScreenPriv->hwndScreen,
- WIN_POLLING_MOUSE_TIMER_ID,
+ /*
+ * Timer to poll mouse position. This is needed to make
+ * programs like xeyes follow the mouse properly when the
+ * mouse pointer is outside of any X window.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
MOUSE_POLLING_INTERVAL, NULL);
}
@@ -301,374 +301,375 @@ winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
LRESULT CALLBACK
winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- POINT ptMouse;
- HDC hdcUpdate;
- PAINTSTRUCT ps;
- WindowPtr pWin = NULL;
- winPrivWinPtr pWinPriv = NULL;
- ScreenPtr s_pScreen = NULL;
- winPrivScreenPtr s_pScreenPriv = NULL;
- winScreenInfo *s_pScreenInfo = NULL;
- HWND hwndScreen = NULL;
- DrawablePtr pDraw = NULL;
- winWMMessageRec wmMsg;
- Bool fWMMsgInitialized = FALSE;
- static Bool s_fTracking = FALSE;
- Bool needRestack = FALSE;
- LRESULT ret;
+ POINT ptMouse;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ WindowPtr pWin = NULL;
+ winPrivWinPtr pWinPriv = NULL;
+ ScreenPtr s_pScreen = NULL;
+ winPrivScreenPtr s_pScreenPriv = NULL;
+ winScreenInfo *s_pScreenInfo = NULL;
+ HWND hwndScreen = NULL;
+ DrawablePtr pDraw = NULL;
+ winWMMessageRec wmMsg;
+ Bool fWMMsgInitialized = FALSE;
+ static Bool s_fTracking = FALSE;
+ Bool needRestack = FALSE;
+ LRESULT ret;
+ static Bool hasEnteredSizeMove = FALSE;
#if CYGDEBUG
winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam,
lParam);
#endif
-
- /* Check if the Windows window property for our X window pointer is valid */
+
+ /* Check if the Windows window property for our X window pointer is valid */
if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
- /* Our X window pointer is valid */
+ /* Our X window pointer is valid */
- /* Get pointers to the drawable and the screen */
- pDraw = &pWin->drawable;
- s_pScreen = pWin->drawable.pScreen;
+ /* Get pointers to the drawable and the screen */
+ pDraw = &pWin->drawable;
+ s_pScreen = pWin->drawable.pScreen;
- /* Get a pointer to our window privates */
- pWinPriv = winGetWindowPriv(pWin);
+ /* Get a pointer to our window privates */
+ pWinPriv = winGetWindowPriv(pWin);
- /* Get pointers to our screen privates and screen info */
- s_pScreenPriv = pWinPriv->pScreenPriv;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ /* Get pointers to our screen privates and screen info */
+ s_pScreenPriv = pWinPriv->pScreenPriv;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- /* Get the handle for our screen-sized window */
- hwndScreen = s_pScreenPriv->hwndScreen;
+ /* Get the handle for our screen-sized window */
+ hwndScreen = s_pScreenPriv->hwndScreen;
- /* */
- wmMsg.msg = 0;
- wmMsg.hwndWindow = hwnd;
- wmMsg.iWindow = (Window) GetProp(hwnd, WIN_WID_PROP);
+ /* */
+ wmMsg.msg = 0;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window)GetProp (hwnd, WIN_WID_PROP);
- wmMsg.iX = pDraw->x;
- wmMsg.iY = pDraw->y;
- wmMsg.iWidth = pDraw->width;
- wmMsg.iHeight = pDraw->height;
+ wmMsg.iX = pDraw->x;
+ wmMsg.iY = pDraw->y;
+ wmMsg.iWidth = pDraw->width;
+ wmMsg.iHeight = pDraw->height;
- fWMMsgInitialized = TRUE;
+ fWMMsgInitialized = TRUE;
#if 0
- /*
- * Print some debugging information
- */
-
- ErrorF("hWnd %08X\n", hwnd);
- ErrorF("pWin %08X\n", pWin);
- ErrorF("pDraw %08X\n", pDraw);
- ErrorF("\ttype %08X\n", pWin->drawable.type);
- ErrorF("\tclass %08X\n", pWin->drawable.class);
- ErrorF("\tdepth %08X\n", pWin->drawable.depth);
- ErrorF("\tbitsPerPixel %08X\n", pWin->drawable.bitsPerPixel);
- ErrorF("\tid %08X\n", pWin->drawable.id);
- ErrorF("\tx %08X\n", pWin->drawable.x);
- ErrorF("\ty %08X\n", pWin->drawable.y);
- ErrorF("\twidth %08X\n", pWin->drawable.width);
- ErrorF("\thenght %08X\n", pWin->drawable.height);
- ErrorF("\tpScreen %08X\n", pWin->drawable.pScreen);
- ErrorF("\tserialNumber %08X\n", pWin->drawable.serialNumber);
- ErrorF("g_iWindowPrivateKey %p\n", g_iWindowPrivateKey);
- ErrorF("pWinPriv %08X\n", pWinPriv);
- ErrorF("s_pScreenPriv %08X\n", s_pScreenPriv);
- ErrorF("s_pScreenInfo %08X\n", s_pScreenInfo);
- ErrorF("hwndScreen %08X\n", hwndScreen);
+ /*
+ * Print some debugging information
+ */
+
+ ErrorF ("hWnd %08X\n", hwnd);
+ ErrorF ("pWin %08X\n", pWin);
+ ErrorF ("pDraw %08X\n", pDraw);
+ ErrorF ("\ttype %08X\n", pWin->drawable.type);
+ ErrorF ("\tclass %08X\n", pWin->drawable.class);
+ ErrorF ("\tdepth %08X\n", pWin->drawable.depth);
+ ErrorF ("\tbitsPerPixel %08X\n", pWin->drawable.bitsPerPixel);
+ ErrorF ("\tid %08X\n", pWin->drawable.id);
+ ErrorF ("\tx %08X\n", pWin->drawable.x);
+ ErrorF ("\ty %08X\n", pWin->drawable.y);
+ ErrorF ("\twidth %08X\n", pWin->drawable.width);
+ ErrorF ("\thenght %08X\n", pWin->drawable.height);
+ ErrorF ("\tpScreen %08X\n", pWin->drawable.pScreen);
+ ErrorF ("\tserialNumber %08X\n", pWin->drawable.serialNumber);
+ ErrorF ("g_iWindowPrivateKey %p\n", g_iWindowPrivateKey);
+ ErrorF ("pWinPriv %08X\n", pWinPriv);
+ ErrorF ("s_pScreenPriv %08X\n", s_pScreenPriv);
+ ErrorF ("s_pScreenInfo %08X\n", s_pScreenInfo);
+ ErrorF ("hwndScreen %08X\n", hwndScreen);
#endif
}
- /* Branch on message type */
+ /* Branch on message type */
switch (message) {
case WM_CREATE:
- /* */
- SetProp(hwnd,
- WIN_WINDOW_PROP,
- (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams);
-
- /* */
- SetProp(hwnd,
- WIN_WID_PROP,
+ /* */
+ SetProp (hwnd,
+ WIN_WINDOW_PROP,
+ (HANDLE)((LPCREATESTRUCT) lParam)->lpCreateParams);
+
+ /* */
+ SetProp (hwnd,
+ WIN_WID_PROP,
(HANDLE) winGetWindowID(((LPCREATESTRUCT) lParam)->
lpCreateParams));
- /*
- * Make X windows' Z orders sync with Windows windows because
- * there can be AlwaysOnTop windows overlapped on the window
- * currently being created.
- */
- winReorderWindowsMultiWindow();
+ /*
+ * Make X windows' Z orders sync with Windows windows because
+ * there can be AlwaysOnTop windows overlapped on the window
+ * currently being created.
+ */
+ winReorderWindowsMultiWindow ();
- /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
- {
- RECT rWindow;
- HRGN hRgnWindow;
+ /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
+ {
+ RECT rWindow;
+ HRGN hRgnWindow;
- GetWindowRect(hwnd, &rWindow);
- hRgnWindow = CreateRectRgnIndirect(&rWindow);
- SetWindowRgn(hwnd, hRgnWindow, TRUE);
- DeleteObject(hRgnWindow);
- }
+ GetWindowRect(hwnd, &rWindow);
+ hRgnWindow = CreateRectRgnIndirect(&rWindow);
+ SetWindowRgn (hwnd, hRgnWindow, TRUE);
+ DeleteObject(hRgnWindow);
+ }
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) XMING_SIGNATURE);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)XMING_SIGNATURE);
- return 0;
+ return 0;
case WM_INIT_SYS_MENU:
- /*
- * Add whatever the setup file wants to for this window
- */
- SetupSysMenu((unsigned long) hwnd);
- return 0;
+ /*
+ * Add whatever the setup file wants to for this window
+ */
+ SetupSysMenu ((unsigned long)hwnd);
+ return 0;
case WM_SYSCOMMAND:
- /*
- * Any window menu items go through here
- */
+ /*
+ * Any window menu items go through here
+ */
if (HandleCustomWM_COMMAND((unsigned long) hwnd, LOWORD(wParam))) {
- /* Don't pass customized menus to DefWindowProc */
- return 0;
- }
+ /* Don't pass customized menus to DefWindowProc */
+ return 0;
+ }
if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE) {
- WINDOWPLACEMENT wndpl;
+ WINDOWPLACEMENT wndpl;
- wndpl.length = sizeof(wndpl);
+ wndpl.length = sizeof(wndpl);
if (GetWindowPlacement(hwnd, &wndpl) &&
wndpl.showCmd == SW_SHOWMINIMIZED)
- needRestack = TRUE;
- }
- break;
+ needRestack = TRUE;
+ }
+ break;
case WM_INITMENU:
- /* Checks/Unchecks any menu items before they are displayed */
- HandleCustomWM_INITMENU((unsigned long) hwnd, wParam);
- break;
+ /* Checks/Unchecks any menu items before they are displayed */
+ HandleCustomWM_INITMENU ((unsigned long)hwnd, wParam);
+ break;
case WM_ERASEBKGND:
- /*
- * Pretend that we did erase the background but we don't care,
- * since we repaint the entire region anyhow
- * This avoids some flickering when resizing.
- */
- return TRUE;
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * since we repaint the entire region anyhow
+ * This avoids some flickering when resizing.
+ */
+ return TRUE;
case WM_PAINT:
- /* Only paint if our window handle is valid */
- if (hwndScreen == NULL)
- break;
+ /* Only paint if our window handle is valid */
+ if (hwndScreen == NULL)
+ break;
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint(hwnd, &ps);
- /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (hwnd, &ps);
+ /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
if (ps.rcPaint.right == 0 && ps.rcPaint.bottom == 0 &&
ps.rcPaint.left == 0 && ps.rcPaint.top == 0) {
- EndPaint(hwnd, &ps);
- return 0;
- }
+ EndPaint (hwnd, &ps);
+ return 0;
+ }
#ifdef XWIN_GLX_WINDOWS
if (pWinPriv->fWglUsed) {
- /*
- For regions which are being drawn by GL, the shadow framebuffer doesn't have the
- correct bits, so don't bitblt from the shadow framebuffer
-
- XXX: For now, just leave it alone, but ideally we want to send an expose event to
- the window so it really redraws the affected region...
- */
- ValidateRect(hwnd, &(ps.rcPaint));
+ /*
+ For regions which are being drawn by GL, the shadow framebuffer doesn't have the
+ correct bits, so don't bitblt from the shadow framebuffer
+
+ XXX: For now, just leave it alone, but ideally we want to send an expose event to
+ the window so it really redraws the affected region...
+ */
+ ValidateRect(hwnd, &(ps.rcPaint));
}
- else
+ else
#endif
- /* Try to copy from the shadow buffer */
- if (!BitBlt(hdcUpdate,
- ps.rcPaint.left, ps.rcPaint.top,
+ /* Try to copy from the shadow buffer */
+ if (!BitBlt (hdcUpdate,
+ ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right - ps.rcPaint.left,
ps.rcPaint.bottom - ps.rcPaint.top,
- s_pScreenPriv->hdcShadow,
+ s_pScreenPriv->hdcShadow,
ps.rcPaint.left + pWin->drawable.x,
ps.rcPaint.top + pWin->drawable.y, SRCCOPY)) {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError (),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) & lpMsgBuf, 0, NULL);
- ErrorF("winTopLevelWindowProc - BitBlt failed: %s\n",
- (LPSTR) lpMsgBuf);
- LocalFree(lpMsgBuf);
- }
+ ErrorF ("winTopLevelWindowProc - BitBlt failed: %s\n",
+ (LPSTR)lpMsgBuf);
+ LocalFree (lpMsgBuf);
+ }
- /* EndPaint frees the DC */
- EndPaint(hwnd, &ps);
- return 0;
+ /* EndPaint frees the DC */
+ EndPaint (hwnd, &ps);
+ return 0;
case WM_MOUSEMOVE:
- /* Unpack the client area mouse coordinates */
- ptMouse.x = GET_X_LPARAM(lParam);
- ptMouse.y = GET_Y_LPARAM(lParam);
+ /* Unpack the client area mouse coordinates */
+ ptMouse.x = GET_X_LPARAM(lParam);
+ ptMouse.y = GET_Y_LPARAM(lParam);
- /* Translate the client area mouse coordinates to screen coordinates */
- ClientToScreen(hwnd, &ptMouse);
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen (hwnd, &ptMouse);
- /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
- ptMouse.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
- ptMouse.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
+ /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
+ ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* Has the mouse pointer crossed screens? */
- if (s_pScreen != miPointerGetScreen(g_pwinPointer))
- miPointerSetScreen(g_pwinPointer, s_pScreenInfo->dwScreen,
- ptMouse.x - s_pScreenInfo->dwXOffset,
- ptMouse.y - s_pScreenInfo->dwYOffset);
+ /* Has the mouse pointer crossed screens? */
+ if (s_pScreen != miPointerGetScreen(g_pwinPointer))
+ miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen,
+ ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset);
- /* Are we tracking yet? */
+ /* Are we tracking yet? */
if (!s_fTracking) {
- TRACKMOUSEEVENT tme;
-
- /* Setup data structure */
- ZeroMemory(&tme, sizeof(tme));
- tme.cbSize = sizeof(tme);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
-
- /* Call the tracking function */
- if (!TrackMouseEvent(&tme))
- ErrorF("winTopLevelWindowProc - TrackMouseEvent failed\n");
-
- /* Flag that we are tracking now */
- s_fTracking = TRUE;
- }
-
- /* Hide or show the Windows mouse cursor */
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory (&tme, sizeof (tme));
+ tme.cbSize = sizeof (tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!TrackMouseEvent(&tme))
+ ErrorF ("winTopLevelWindowProc - TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Hide or show the Windows mouse cursor */
if (g_fSoftwareCursor && g_fCursor) {
- /* Hide Windows cursor */
- g_fCursor = FALSE;
- ShowCursor(FALSE);
- }
+ /* Hide Windows cursor */
+ g_fCursor = FALSE;
+ ShowCursor (FALSE);
+ }
- /* Kill the timer used to poll mouse events */
+ /* Kill the timer used to poll mouse events */
if (g_uipMousePollingTimerID != 0) {
- KillTimer(s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
- g_uipMousePollingTimerID = 0;
- }
+ KillTimer (s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
+ g_uipMousePollingTimerID = 0;
+ }
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset,
- ptMouse.y - s_pScreenInfo->dwYOffset);
-
- return 0;
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset);
+ return 0;
+
case WM_NCMOUSEMOVE:
- /*
- * We break instead of returning 0 since we need to call
- * DefWindowProc to get the mouse cursor changes
- * and min/max/close button highlighting in Windows XP.
- * The Platform SDK says that you should return 0 if you
- * process this message, but it fails to mention that you
- * will give up any default functionality if you do return 0.
- */
-
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* Non-client mouse movement, show Windows cursor */
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Non-client mouse movement, show Windows cursor */
if (g_fSoftwareCursor && !g_fCursor) {
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
- winStartMousePolling(s_pScreenPriv);
+ winStartMousePolling(s_pScreenPriv);
- break;
+ break;
case WM_MOUSELEAVE:
- /* Mouse has left our client area */
+ /* Mouse has left our client area */
- /* Flag that we are no longer tracking */
- s_fTracking = FALSE;
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
- /* Show the mouse cursor, if necessary */
+ /* Show the mouse cursor, if necessary */
if (g_fSoftwareCursor && !g_fCursor) {
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
- winStartMousePolling(s_pScreenPriv);
+ winStartMousePolling(s_pScreenPriv);
- return 0;
+ return 0;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[0] = TRUE;
- SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, Button1, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[0] = TRUE;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
case WM_LBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[0] = FALSE;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button1, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[0] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[1] = TRUE;
- SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, Button2, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[1] = TRUE;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
case WM_MBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[1] = FALSE;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button2, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[1] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[2] = TRUE;
- SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, Button3, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[2] = TRUE;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
case WM_RBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[2] = FALSE;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button3, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[2] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- SetCapture(hwnd);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture(hwnd);
return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
wParam);
case WM_XBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
return winMouseButtonsHandle(s_pScreen, ButtonRelease,
HIWORD(wParam) + 5, wParam);
@@ -677,376 +678,389 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
(hwnd, WM_NCHITTEST, 0,
MAKELONG(GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam))) == HTCLIENT) {
- /* Pass the message to the root window */
- SendMessage(hwndScreen, message, wParam, lParam);
- return 0;
- }
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+ }
else
break;
case WM_SETFOCUS:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- {
- /* Get the parent window for transient handling */
- HWND hParent = GetParent(hwnd);
+ {
+ /* Get the parent window for transient handling */
+ HWND hParent = GetParent(hwnd);
if (hParent && IsIconic(hParent))
ShowWindow(hParent, SW_RESTORE);
- }
-
- winRestoreModeKeyStates();
+ }
- /* Add the keyboard hook if possible */
- if (g_fKeyboardHookLL)
- g_fKeyboardHookLL = winInstallKeyboardHookLL();
- return 0;
+ winRestoreModeKeyStates ();
+ /* Add the keyboard hook if possible */
+ if (g_fKeyboardHookLL)
+ g_fKeyboardHookLL = winInstallKeyboardHookLL ();
+ return 0;
+
case WM_KILLFOCUS:
- /* Pop any pressed keys since we are losing keyboard focus */
- winKeybdReleaseKeys();
+ /* Pop any pressed keys since we are losing keyboard focus */
+ winKeybdReleaseKeys ();
- /* Remove our keyboard hook if it is installed */
- winRemoveKeyboardHookLL();
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL ();
- /* Revert the X focus as well, but only if the Windows focus is going to another window */
- if (!wParam && pWin)
- DeleteWindowFromAnyEvents(pWin, FALSE);
+ /* Revert the X focus as well, but only if the Windows focus is going to another window */
+ if (!wParam && pWin)
+ DeleteWindowFromAnyEvents(pWin, FALSE);
- return 0;
+ return 0;
- case WM_SYSDEADCHAR:
+ case WM_SYSDEADCHAR:
case WM_DEADCHAR:
- /*
- * NOTE: We do nothing with WM_*CHAR messages,
- * nor does the root window, so we can just toss these messages.
- */
- return 0;
+ /*
+ * NOTE: We do nothing with WM_*CHAR messages,
+ * nor does the root window, so we can just toss these messages.
+ */
+ return 0;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- /*
- * Don't pass Alt-F4 key combo to root window,
- * let Windows translate to WM_CLOSE and close this top-level window.
- *
- * NOTE: We purposely don't check the fUseWinKillKey setting because
- * it should only apply to the key handling for the root window,
- * not for top-level window-manager windows.
- *
- * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
- * because that is a key combo that no X app should be expecting to
- * receive, since it has historically been used to shutdown the X server.
- * Passing Ctrl-Alt-Backspace to the root window preserves that
- * behavior, assuming that -unixkill has been passed as a parameter.
- */
- if (wParam == VK_F4 && (GetKeyState(VK_MENU) & 0x8000))
- break;
+ /*
+ * Don't pass Alt-F4 key combo to root window,
+ * let Windows translate to WM_CLOSE and close this top-level window.
+ *
+ * NOTE: We purposely don't check the fUseWinKillKey setting because
+ * it should only apply to the key handling for the root window,
+ * not for top-level window-manager windows.
+ *
+ * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
+ * because that is a key combo that no X app should be expecting to
+ * receive, since it has historically been used to shutdown the X server.
+ * Passing Ctrl-Alt-Backspace to the root window preserves that
+ * behavior, assuming that -unixkill has been passed as a parameter.
+ */
+ if (wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000))
+ break;
#if CYGWINDOWING_DEBUG
if (wParam == VK_ESCAPE) {
- /* Place for debug: put any tests and dumps here */
- WINDOWPLACEMENT windPlace;
- RECT rc;
- LPRECT pRect;
-
- windPlace.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hwnd, &windPlace);
- pRect = &windPlace.rcNormalPosition;
- ErrorF("\nCYGWINDOWING Dump:\n"
- "\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x,
- pDraw->y, pDraw->width, pDraw->height);
- ErrorF("\twindPlace: (%ld, %ld) - %ldx%ld\n", pRect->left,
- pRect->top, pRect->right - pRect->left,
- pRect->bottom - pRect->top);
+ /* Place for debug: put any tests and dumps here */
+ WINDOWPLACEMENT windPlace;
+ RECT rc;
+ LPRECT pRect;
+
+ windPlace.length = sizeof (WINDOWPLACEMENT);
+ GetWindowPlacement (hwnd, &windPlace);
+ pRect = &windPlace.rcNormalPosition;
+ ErrorF ("\nCYGWINDOWING Dump:\n"
+ "\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x,
+ pDraw->y, pDraw->width, pDraw->height);
+ ErrorF ("\twindPlace: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
if (GetClientRect(hwnd, &rc)) {
- pRect = &rc;
- ErrorF("\tClientRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
- pRect->top, pRect->right - pRect->left,
- pRect->bottom - pRect->top);
- }
+ pRect = &rc;
+ ErrorF ("\tClientRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ }
if (GetWindowRect(hwnd, &rc)) {
- pRect = &rc;
- ErrorF("\tWindowRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
- pRect->top, pRect->right - pRect->left,
- pRect->bottom - pRect->top);
- }
- ErrorF("\n");
- }
+ pRect = &rc;
+ ErrorF ("\tWindowRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ }
+ ErrorF ("\n");
+ }
#endif
-
- /* Pass the message to the root window */
- return winWindowProc(hwndScreen, message, wParam, lParam);
+
+ /* Pass the message to the root window */
+ return winWindowProc(hwndScreen, message, wParam, lParam);
case WM_SYSKEYUP:
case WM_KEYUP:
- /* Pass the message to the root window */
- return winWindowProc(hwndScreen, message, wParam, lParam);
+ /* Pass the message to the root window */
+ return winWindowProc(hwndScreen, message, wParam, lParam);
case WM_HOTKEY:
- /* Pass the message to the root window */
- SendMessage(hwndScreen, message, wParam, lParam);
- return 0;
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
case WM_ACTIVATE:
- /* Pass the message to the root window */
- SendMessage(hwndScreen, message, wParam, lParam);
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
if (LOWORD(wParam) != WA_INACTIVE) {
- /* Raise the window to the top in Z order */
- /* ago: Activate does not mean putting it to front! */
- /*
- wmMsg.msg = WM_WM_RAISE;
- if (fWMMsgInitialized)
- winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
- */
-
- /* Tell our Window Manager thread to activate the window */
- wmMsg.msg = WM_WM_ACTIVATE;
- if (fWMMsgInitialized)
- if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
- winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
- }
- /* Prevent the mouse wheel from stalling when another window is minimized */
- if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
- (HWND) lParam != NULL && (HWND) lParam != (HWND) GetParent(hwnd))
- SetFocus(hwnd);
- return 0;
+ /* Raise the window to the top in Z order */
+ /* ago: Activate does not mean putting it to front! */
+ /*
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ */
+
+ /* Tell our Window Manager thread to activate the window */
+ wmMsg.msg = WM_WM_ACTIVATE;
+ if (fWMMsgInitialized)
+ if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ /* Prevent the mouse wheel from stalling when another window is minimized */
+ if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
+ (HWND)lParam != NULL && (HWND)lParam != (HWND)GetParent(hwnd))
+ SetFocus(hwnd);
+ return 0;
case WM_ACTIVATEAPP:
- /*
- * This message is also sent to the root window
- * so we do nothing for individual multiwindow windows
- */
- break;
+ /*
+ * This message is also sent to the root window
+ * so we do nothing for individual multiwindow windows
+ */
+ break;
case WM_CLOSE:
- /* Branch on if the window was killed in X already */
+ /* Remove property AppUserModelID */
+ winSetAppID (hwnd, NULL);
+
+ /* Branch on if the window was killed in X already */
if (pWinPriv->fXKilled) {
- /* Window was killed, go ahead and destroy the window */
- DestroyWindow(hwnd);
- }
+ /* Window was killed, go ahead and destroy the window */
+ DestroyWindow (hwnd);
+ }
else {
- /* Tell our Window Manager thread to kill the window */
- wmMsg.msg = WM_WM_KILL;
- if (fWMMsgInitialized)
- winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
- }
- return 0;
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ return 0;
case WM_DESTROY:
- /* Branch on if the window was killed in X already */
+ /* Branch on if the window was killed in X already */
if (pWinPriv && !pWinPriv->fXKilled) {
- ErrorF("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n");
-
- /* Tell our Window Manager thread to kill the window */
- wmMsg.msg = WM_WM_KILL;
- if (fWMMsgInitialized)
- winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
- }
+ ErrorF ("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n");
+
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
- RemoveProp(hwnd, WIN_WINDOW_PROP);
- RemoveProp(hwnd, WIN_WID_PROP);
- RemoveProp(hwnd, WIN_NEEDMANAGE_PROP);
+ RemoveProp (hwnd, WIN_WINDOW_PROP);
+ RemoveProp (hwnd, WIN_WID_PROP);
+ RemoveProp (hwnd, WIN_NEEDMANAGE_PROP);
- break;
+ break;
case WM_MOVE:
- /* Adjust the X Window to the moved Windows window */
- winAdjustXWindow(pWin, hwnd);
- return 0;
+ /* Adjust the X Window to the moved Windows window */
+ if (!hasEnteredSizeMove) winAdjustXWindow (pWin, hwnd);
+ /* else: Wait for WM_EXITSIZEMOVE */
+ return 0;
case WM_SHOWWINDOW:
- /* Bail out if the window is being hidden */
- if (!wParam)
- return 0;
-
- /* */
- if (!pWin->overrideRedirect) {
- /* Flag that this window needs to be made active when clicked */
- SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
-
- if (!(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) {
- HWND zstyle = HWND_NOTOPMOST;
-
- /* Set the window extended style flags */
- SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
-
- /* Set the transient style flags */
- if (GetParent(hwnd))
- SetWindowLongPtr(hwnd, GWL_STYLE,
- WS_POPUP | WS_OVERLAPPED | WS_SYSMENU |
- WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- /* Set the window standard style flags */
- else
- SetWindowLongPtr(hwnd, GWL_STYLE,
- (WS_POPUP | WS_OVERLAPPEDWINDOW |
- WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
- & ~WS_CAPTION & ~WS_SIZEBOX);
-
- winUpdateWindowPosition(hwnd, FALSE, &zstyle);
-
- {
- WinXWMHints hints;
+ /* Bail out if the window is being hidden */
+ if (!wParam)
+ return 0;
+
+ /* */
+ if (!pWin->overrideRedirect)
+ {
+ HWND zstyle = HWND_NOTOPMOST;
+
+ /* Flag that this window needs to be made active when clicked */
+ SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
+
+ /* Set the transient style flags */
+ if (GetParent(hwnd))
+ SetWindowLongPtr (hwnd, GWL_STYLE,
+ WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ /* Set the window standard style flags */
+ else
+ SetWindowLongPtr (hwnd, GWL_STYLE,
+ (WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
+ & ~WS_CAPTION & ~WS_SIZEBOX);
+
+ winUpdateWindowPosition (hwnd, &zstyle);
+
+ {
+ WinXWMHints hints;
if (winMultiWindowGetWMHints(pWin, &hints)) {
- /*
- Give the window focus, unless it has an InputHint
- which is FALSE (this is used by e.g. glean to
- avoid every test window grabbing the focus)
- */
+ /*
+ Give the window focus, unless it has an InputHint
+ which is FALSE (this is used by e.g. glean to
+ avoid every test window grabbing the focus)
+ */
if (!((hints.flags & InputHint) && (!hints.input))) {
- SetForegroundWindow(hwnd);
- }
- }
- }
- }
- wmMsg.msg = WM_WM_MAP3;
- }
+ SetForegroundWindow (hwnd);
+ }
+ }
+ }
+ wmMsg.msg = WM_WM_MAP3;
+ }
else { /* It is an overridden window so make it top of Z stack */
- HWND forHwnd = GetForegroundWindow();
+ HWND forHwnd = GetForegroundWindow();
#if CYGWINDOWING_DEBUG
- ErrorF("overridden window is shown\n");
+ ErrorF ("overridden window is shown\n");
#endif
if (forHwnd != NULL) {
if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR)
XMING_SIGNATURE) {
- if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
+ if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- else
+ else
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- }
- wmMsg.msg = WM_WM_MAP2;
- }
+ }
+ }
+ wmMsg.msg = WM_WM_MAP2;
+ }
+
+ /* Tell our Window Manager thread to map the window */
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
- /* Tell our Window Manager thread to map the window */
- if (fWMMsgInitialized)
- winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
+ winStartMousePolling(s_pScreenPriv);
- winStartMousePolling(s_pScreenPriv);
-
- return 0;
+ return 0;
case WM_SIZING:
- /* Need to legalize the size according to WM_NORMAL_HINTS */
- /* for applications like xterm */
- return ValidateSizing(hwnd, pWin, wParam, lParam);
+ /* Need to legalize the size according to WM_NORMAL_HINTS */
+ /* for applications like xterm */
+ return ValidateSizing (hwnd, pWin, wParam, lParam);
case WM_WINDOWPOSCHANGED:
- {
- LPWINDOWPOS pWinPos = (LPWINDOWPOS) lParam;
+ {
+ LPWINDOWPOS pWinPos = (LPWINDOWPOS) lParam;
if (!(pWinPos->flags & SWP_NOZORDER)) {
#if CYGWINDOWING_DEBUG
- winDebug("\twindow z order was changed\n");
+ winDebug ("\twindow z order was changed\n");
#endif
- if (pWinPos->hwndInsertAfter == HWND_TOP
- || pWinPos->hwndInsertAfter == HWND_TOPMOST
+ if (pWinPos->hwndInsertAfter == HWND_TOP
+ ||pWinPos->hwndInsertAfter == HWND_TOPMOST
|| pWinPos->hwndInsertAfter == HWND_NOTOPMOST) {
#if CYGWINDOWING_DEBUG
- winDebug("\traise to top\n");
+ winDebug ("\traise to top\n");
#endif
- /* Raise the window to the top in Z order */
- winRaiseWindow(pWin);
- }
+ /* Raise the window to the top in Z order */
+ winRaiseWindow(pWin);
+ }
else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) {
- }
+ }
else {
- /* Check if this window is top of X windows. */
- HWND hWndAbove = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId();
- DWORD dwWindowProcessID = 0;
+ /* Check if this window is top of X windows. */
+ HWND hWndAbove = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
- for (hWndAbove = pWinPos->hwndInsertAfter;
- hWndAbove != NULL;
+ for (hWndAbove = pWinPos->hwndInsertAfter;
+ hWndAbove != NULL;
hWndAbove = GetNextWindow(hWndAbove, GW_HWNDPREV)) {
- /* Ignore other XWin process's window */
- GetWindowThreadProcessId(hWndAbove, &dwWindowProcessID);
-
- if ((dwWindowProcessID == dwCurrentProcessID)
- && GetProp(hWndAbove, WIN_WINDOW_PROP)
- && !IsWindowVisible(hWndAbove)
- && !IsIconic(hWndAbove)) /* ignore minimized windows */
- break;
- }
- /* If this is top of X windows in Windows stack,
- raise it in X stack. */
+ /* Ignore other XWin process's window */
+ GetWindowThreadProcessId (hWndAbove, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp (hWndAbove, WIN_WINDOW_PROP)
+ && !IsWindowVisible (hWndAbove)
+ && !IsIconic (hWndAbove) ) /* ignore minimized windows */
+ break;
+ }
+ /* If this is top of X windows in Windows stack,
+ raise it in X stack. */
if (hWndAbove == NULL) {
#if CYGWINDOWING_DEBUG
- winDebug("\traise to top\n");
+ winDebug ("\traise to top\n");
#endif
- winRaiseWindow(pWin);
- }
- }
- }
- }
- /*
- * Pass the message to DefWindowProc to let the function
- * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE.
- */
- break;
+ winRaiseWindow(pWin);
+ }
+ }
+ }
+ }
+ /*
+ * Pass the message to DefWindowProc to let the function
+ * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE.
+ */
+ break;
+
+ case WM_ENTERSIZEMOVE:
+ hasEnteredSizeMove = TRUE;
+ return 0;
+
+ case WM_EXITSIZEMOVE:
+ /* Adjust the X Window to the moved Windows window */
+ hasEnteredSizeMove = FALSE;
+ winAdjustXWindow (pWin, hwnd);
+ return 0;
case WM_SIZE:
- /* see dix/window.c */
+ /* see dix/window.c */
#if CYGWINDOWING_DEBUG
- {
- char buf[64];
+ {
+ char buf[64];
switch (wParam) {
- case SIZE_MINIMIZED:
- strcpy(buf, "SIZE_MINIMIZED");
- break;
- case SIZE_MAXIMIZED:
- strcpy(buf, "SIZE_MAXIMIZED");
- break;
- case SIZE_RESTORED:
- strcpy(buf, "SIZE_RESTORED");
- break;
- default:
- strcpy(buf, "UNKNOWN_FLAG");
- }
- ErrorF("winTopLevelWindowProc - WM_SIZE to %dx%d (%s) - %d ms\n",
- (int) LOWORD(lParam), (int) HIWORD(lParam), buf,
- (int) (GetTickCount()));
- }
+ case SIZE_MINIMIZED:
+ strcpy(buf, "SIZE_MINIMIZED");
+ break;
+ case SIZE_MAXIMIZED:
+ strcpy(buf, "SIZE_MAXIMIZED");
+ break;
+ case SIZE_RESTORED:
+ strcpy(buf, "SIZE_RESTORED");
+ break;
+ default:
+ strcpy(buf, "UNKNOWN_FLAG");
+ }
+ ErrorF ("winTopLevelWindowProc - WM_SIZE to %dx%d (%s) - %d ms\n",
+ (int)LOWORD(lParam), (int)HIWORD(lParam), buf,
+ (int)(GetTickCount ()));
+ }
#endif
- /* Adjust the X Window to the moved Windows window */
- winAdjustXWindow(pWin, hwnd);
- return 0; /* end of WM_SIZE handler */
+ if (!hasEnteredSizeMove)
+ {
+ /* Adjust the X Window to the moved Windows window */
+ winAdjustXWindow (pWin, hwnd);
+ if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow();
+ }
+ /* else: wait for WM_EXITSIZEMOVE */
+ return 0; /* end of WM_SIZE handler */
case WM_STYLECHANGING:
- /*
- When the style changes, adjust the Windows window size so the client area remains the same size,
- and adjust the Windows window position so that the client area remains in the same place.
- */
- {
+ /*
+ When the style changes, adjust the Windows window size so the client area remains the same size,
+ and adjust the Windows window position so that the client area remains in the same place.
+ */
+ {
RECT newWinRect;
DWORD dwExStyle;
DWORD dwStyle;
- DWORD newStyle = ((STYLESTRUCT *) lParam)->styleNew;
+ DWORD newStyle = ((STYLESTRUCT *)lParam)->styleNew;
WINDOWINFO wi;
- dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
+ dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
winDebug("winTopLevelWindowProc - WM_STYLECHANGING from %08x %08x\n",
dwStyle, dwExStyle);
if (wParam == GWL_EXSTYLE)
- dwExStyle = newStyle;
+ dwExStyle = newStyle;
if (wParam == GWL_STYLE)
- dwStyle = newStyle;
+ dwStyle = newStyle;
winDebug("winTopLevelWindowProc - WM_STYLECHANGING to %08x %08x\n",
dwStyle, dwExStyle);
@@ -1073,61 +1087,100 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
newWinRect.bottom - newWinRect.top);
/*
- Style change hasn't happened yet, so we can't adjust the window size yet, as the winAdjustXWindow()
- which WM_SIZE does will use the current (unchanged) style. Instead make a note to change it when
- WM_STYLECHANGED is received...
- */
+ Style change hasn't happened yet, so we can't adjust the window size yet, as the winAdjustXWindow()
+ which WM_SIZE does will use the current (unchanged) style. Instead make a note to change it when
+ WM_STYLECHANGED is received...
+ */
pWinPriv->hDwp = BeginDeferWindowPos(1);
pWinPriv->hDwp =
DeferWindowPos(pWinPriv->hDwp, hwnd, NULL, newWinRect.left,
newWinRect.top, newWinRect.right - newWinRect.left,
newWinRect.bottom - newWinRect.top,
SWP_NOACTIVATE | SWP_NOZORDER);
- }
- return 0;
+ }
+ return 0;
case WM_STYLECHANGED:
- {
+ {
if (pWinPriv->hDwp) {
EndDeferWindowPos(pWinPriv->hDwp);
pWinPriv->hDwp = NULL;
- }
+ }
winDebug("winTopLevelWindowProc - WM_STYLECHANGED done\n");
- }
- return 0;
+ }
+ return 0;
case WM_MOUSEACTIVATE:
- /* Check if this window needs to be made active when clicked */
+ /* Check if this window needs to be made active when clicked */
if (!GetProp(pWinPriv->hWnd, WIN_NEEDMANAGE_PROP)) {
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winTopLevelWindowProc - WM_MOUSEACTIVATE - "
- "MA_NOACTIVATE\n");
+ ErrorF ("winTopLevelWindowProc - WM_MOUSEACTIVATE - "
+ "MA_NOACTIVATE\n");
#endif
- /* */
- return MA_NOACTIVATE;
- }
- break;
+ /* */
+ return MA_NOACTIVATE;
+ }
+ break;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
if (!g_fSoftwareCursor)
SetCursor(s_pScreenPriv->cursor.handle);
- return TRUE;
- }
- break;
+ return TRUE;
+ }
+ break;
default:
- break;
+ break;
}
- ret = DefWindowProc(hwnd, message, wParam, lParam);
- /*
- * If the window was minized we get the stack change before the window is restored
- * and so it gets lost. Ensure there stacking order is correct.
- */
- if (needRestack)
- winReorderWindowsMultiWindow();
- return ret;
+ ret = DefWindowProc (hwnd, message, wParam, lParam);
+ /*
+ * If the window was minized we get the stack change before the window is restored
+ * and so it gets lost. Ensure there stacking order is correct.
+ */
+ if (needRestack)
+ winReorderWindowsMultiWindow();
+ return ret;
+}
+
+/*
+ * winChildWindowProc - Window procedure for all top-level Windows windows.
+ */
+
+LRESULT CALLBACK
+winChildWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+#if CYGDEBUG
+ winDebugWin32Message("winChildWindowProc", hwnd, message, wParam, lParam);
+#endif
+
+ switch (message)
+ {
+ case WM_ERASEBKGND:
+ return TRUE;
+
+ case WM_PAINT:
+ /*
+ We don't have the bits to draw into the window, they went straight into the OpenGL
+ surface
+
+ XXX: For now, just leave it alone, but ideally we want to send an expose event to
+ the window so it really redraws the affected region...
+ */
+ {
+ PAINTSTRUCT ps;
+ HDC hdcUpdate;
+ hdcUpdate = BeginPaint(hwnd, &ps);
+ ValidateRect(hwnd, &(ps.rcPaint));
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
+ /* XXX: this is exactly what DefWindowProc does? */
+ }
+
+ return DefWindowProc (hwnd, message, wParam, lParam);
}
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index 86a788287..1d549266d 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -37,6 +37,8 @@
#include <stdlib.h>
#ifdef __CYGWIN__
#include <sys/resource.h>
+#include <sys/wait.h>
+#include <pthread.h>
#endif
#include "win.h"
@@ -52,14 +54,11 @@
extern const char *winGetBaseDir(void);
/* From winprefslex.l, the real parser */
-extern int parse_file(FILE * fp);
+extern int parse_file (FILE *fp);
/* Currently in use command ID, incremented each new menu item created */
static int g_cmdid = STARTMENUID;
-/* Defined in DIX */
-extern char *display;
-
/* Local function to handle comma-ified icon names */
static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
@@ -69,74 +68,74 @@ static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
static HMENU
MakeMenu(char *name, HMENU editMenu, int editItem)
{
- int i;
- int item;
- MENUPARSED *m;
- HMENU hmenu, hsub;
+ int i;
+ int item;
+ MENUPARSED *m;
+ HMENU hmenu, hsub;
for (i = 0; i < pref.menuItems; i++) {
- if (!strcmp(name, pref.menu[i].menuName))
- break;
+ if (!strcmp(name, pref.menu[i].menuName))
+ break;
}
-
- /* Didn't find a match, bummer */
+
+ /* Didn't find a match, bummer */
if (i == pref.menuItems) {
- ErrorF("MakeMenu: Can't find menu %s\n", name);
- return NULL;
+ ErrorF("MakeMenu: Can't find menu %s\n", name);
+ return NULL;
}
-
- m = &(pref.menu[i]);
+
+ m = &(pref.menu[i]);
if (editMenu) {
- hmenu = editMenu;
- item = editItem;
+ hmenu = editMenu;
+ item = editItem;
}
else {
- hmenu = CreatePopupMenu();
+ hmenu = CreatePopupMenu();
if (!hmenu) {
- ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name);
- return NULL;
- }
- item = 0;
+ ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name);
+ return NULL;
+ }
+ item = 0;
}
- /* Add the menu items */
+ /* Add the menu items */
for (i = 0; i < m->menuItems; i++) {
- /* Only assign IDs one time... */
- if (m->menuItem[i].commandID == 0)
- m->menuItem[i].commandID = g_cmdid++;
+ /* Only assign IDs one time... */
+ if ( m->menuItem[i].commandID == 0 )
+ m->menuItem[i].commandID = g_cmdid++;
switch (m->menuItem[i].cmd) {
- case CMD_EXEC:
- case CMD_ALWAYSONTOP:
- case CMD_RELOAD:
- InsertMenu(hmenu,
- item,
- MF_BYPOSITION | MF_ENABLED | MF_STRING,
+ case CMD_EXEC:
+ case CMD_ALWAYSONTOP:
+ case CMD_RELOAD:
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_ENABLED|MF_STRING,
m->menuItem[i].commandID, m->menuItem[i].text);
- break;
-
- case CMD_SEPARATOR:
+ break;
+
+ case CMD_SEPARATOR:
InsertMenu(hmenu, item, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
- break;
-
- case CMD_MENU:
- /* Recursive! */
- hsub = MakeMenu(m->menuItem[i].param, 0, 0);
- if (hsub)
- InsertMenu(hmenu,
- item,
- MF_BYPOSITION | MF_POPUP | MF_ENABLED | MF_STRING,
+ break;
+
+ case CMD_MENU:
+ /* Recursive! */
+ hsub = MakeMenu (m->menuItem[i].param, 0, 0);
+ if (hsub)
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING,
(UINT_PTR) hsub, m->menuItem[i].text);
- break;
- }
+ break;
+ }
- /* If item==-1 (means to add at end of menu) don't increment) */
- if (item >= 0)
- item++;
+ /* If item==-1 (means to add at end of menu) don't increment) */
+ if (item>=0)
+ item++;
}
- return hmenu;
+ return hmenu;
}
#ifdef XWIN_MULTIWINDOW
@@ -145,46 +144,58 @@ MakeMenu(char *name, HMENU editMenu, int editItem)
* Removes or creates custom window settings depending on LPARAM
*/
static wBOOL CALLBACK
-ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
+ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
{
- HICON hicon;
- Window wid;
+ HICON hicon;
- if (!hwnd) {
- ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
- return FALSE;
- }
+ if (!hwnd) {
+ ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
+ return FALSE;
+ }
- /* It's our baby, either clean or dirty it */
+ /* It's our baby, either clean or dirty it */
if (lParam == FALSE) {
- /* Reset the window's icon to undefined. */
- hicon = (HICON) SendMessage(hwnd, WM_SETICON, ICON_BIG, 0);
+ /* Reset the window's icon to undefined. */
+ hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0);
- /* If the old icon is generated on-the-fly, get rid of it, will regen */
- winDestroyIcon(hicon);
+ /* If the old icon is generated on-the-fly, get rid of it, will regen */
+ winDestroyIcon (hicon);
- /* Same for the small icon */
- hicon = (HICON) SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0);
- winDestroyIcon(hicon);
+ /* Same for the small icon */
+ hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0);
+ winDestroyIcon (hicon);
- /* Remove any menu additions; bRevert=TRUE destroys any modified menus */
- GetSystemMenu(hwnd, TRUE);
-
- /* This window is now clean of our taint (but with undefined icons) */
+ /* Remove any menu additions; bRevert=TRUE destroys any modified menus */
+ GetSystemMenu (hwnd, TRUE);
+
+ /* This window is now clean of our taint (but with undefined icons) */
}
- else {
- /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */
- wid = (Window) GetProp(hwnd, WIN_WID_PROP);
- if (wid)
- winUpdateIcon(wid);
-
- /* Update the system menu for this window */
- SetupSysMenu((unsigned long) hwnd);
-
- /* That was easy... */
+ else
+ {
+ /* Send a message to WM thread telling it re-evaluate the icon for this window */
+ {
+ winWMMessageRec wmMsg;
+
+ WindowPtr pWin = GetProp(hwnd, WIN_WINDOW_PROP);
+ if (pWin)
+ {
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin);
+ winPrivScreenPtr s_pScreenPriv = pWinPriv->pScreenPriv;
+
+ wmMsg.msg = WM_WM_ICON_EVENT;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window)GetProp(hwnd, WIN_WID_PROP);
+
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ }
+ /* Update the system menu for this window */
+ SetupSysMenu ((unsigned long)hwnd);
+
+ /* That was easy... */
}
- return TRUE;
+ return TRUE;
}
#endif
@@ -195,71 +206,71 @@ ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
* Set custom icons and menus again.
*/
static void
-ReloadPrefs(void)
+ReloadPrefs (void)
{
- int i;
+ int i;
#ifdef XWIN_MULTIWINDOW
- /* First, iterate over all windows, deleting their icons and custom menus.
- * This is really only needed because winDestroyIcon() will try to
- * destroy the old global icons, which will have changed.
- * It is probably better to set a windows USER_DATA to flag locally defined
- * icons, and use that to accurately know when to destroy old icons.
- */
- EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
+ /* First, iterate over all windows, deleting their icons and custom menus.
+ * This is really only needed because winDestroyIcon() will try to
+ * destroy the old global icons, which will have changed.
+ * It is probably better to set a windows USER_DATA to flag locally defined
+ * icons, and use that to accurately know when to destroy old icons.
+ */
+ EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
#endif
-
- /* Now, free/clear all info from our prefs structure */
- for (i = 0; i < pref.menuItems; i++)
- free(pref.menu[i].menuItem);
- free(pref.menu);
- pref.menu = NULL;
- pref.menuItems = 0;
-
- pref.rootMenuName[0] = 0;
-
- free(pref.sysMenu);
- pref.sysMenuItems = 0;
-
- pref.defaultSysMenuName[0] = 0;
- pref.defaultSysMenuPos = 0;
-
- pref.iconDirectory[0] = 0;
- pref.defaultIconName[0] = 0;
- pref.trayIconName[0] = 0;
-
- for (i = 0; i < pref.iconItems; i++)
- if (pref.icon[i].hicon)
- DestroyIcon((HICON) pref.icon[i].hicon);
- free(pref.icon);
- pref.icon = NULL;
- pref.iconItems = 0;
-
- /* Free global default X icon */
- if (g_hIconX)
- DestroyIcon(g_hIconX);
- if (g_hSmallIconX)
- DestroyIcon(g_hSmallIconX);
-
- /* Reset the custom command IDs */
- g_cmdid = STARTMENUID;
-
- /* Load the updated resource file */
- LoadPreferences();
-
- g_hIconX = NULL;
- g_hSmallIconX = NULL;
+
+ /* Now, free/clear all info from our prefs structure */
+ for (i=0; i<pref.menuItems; i++)
+ free (pref.menu[i].menuItem);
+ free (pref.menu);
+ pref.menu = NULL;
+ pref.menuItems = 0;
+
+ pref.rootMenuName[0] = 0;
+
+ free (pref.sysMenu);
+ pref.sysMenuItems = 0;
+
+ pref.defaultSysMenuName[0] = 0;
+ pref.defaultSysMenuPos = 0;
+
+ pref.iconDirectory[0] = 0;
+ pref.defaultIconName[0] = 0;
+ pref.trayIconName[0] = 0;
+
+ for (i=0; i<pref.iconItems; i++)
+ if (pref.icon[i].hicon)
+ DestroyIcon ((HICON)pref.icon[i].hicon);
+ free (pref.icon);
+ pref.icon = NULL;
+ pref.iconItems = 0;
+
+ /* Free global default X icon */
+ if (g_hIconX)
+ DestroyIcon (g_hIconX);
+ if (g_hSmallIconX)
+ DestroyIcon (g_hSmallIconX);
+
+ /* Reset the custom command IDs */
+ g_cmdid = STARTMENUID;
+
+ /* Load the updated resource file */
+ LoadPreferences();
+
+ g_hIconX = NULL;
+ g_hSmallIconX = NULL;
#ifdef XWIN_MULTIWINDOW
- winInitGlobalIcons();
+ winInitGlobalIcons();
#endif
-
+
#ifdef XWIN_MULTIWINDOW
- /* Rebuild the icons and menus */
- EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
+ /* Rebuild the icons and menus */
+ EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
#endif
- /* Whew, done */
+ /* Whew, done */
}
/*
@@ -268,134 +279,236 @@ ReloadPrefs(void)
void
HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn)
{
- HWND hwnd;
- HMENU hmenu;
- DWORD dwExStyle;
- int i, j;
-
- hwnd = (HWND) hwndIn;
- hmenu = (HMENU) hmenuIn;
- if (!hwnd || !hmenu)
- return;
-
- if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
- dwExStyle = MF_BYCOMMAND | MF_CHECKED;
- else
- dwExStyle = MF_BYCOMMAND | MF_UNCHECKED;
-
- for (i = 0; i < pref.menuItems; i++)
- for (j = 0; j < pref.menu[i].menuItems; j++)
- if (pref.menu[i].menuItem[j].cmd == CMD_ALWAYSONTOP)
+ HWND hwnd;
+ HMENU hmenu;
+ DWORD dwExStyle;
+ int i, j;
+
+ hwnd = (HWND)hwndIn;
+ hmenu = (HMENU)hmenuIn;
+ if (!hwnd || !hmenu)
+ return;
+
+ if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
+ dwExStyle = MF_BYCOMMAND | MF_CHECKED;
+ else
+ dwExStyle = MF_BYCOMMAND | MF_UNCHECKED;
+
+ for (i=0; i<pref.menuItems; i++)
+ for (j=0; j<pref.menu[i].menuItems; j++)
+ if (pref.menu[i].menuItem[j].cmd==CMD_ALWAYSONTOP)
CheckMenuItem(hmenu, pref.menu[i].menuItem[j].commandID,
dwExStyle);
+
+}
+#ifdef __CYGWIN__
+static void
+LogLineFromFd(int fd, const char *fdname, int pid)
+{
+#define BUFSIZE 512 /* must be less than internal buffer size used in LogVWrite */
+ char buf[BUFSIZE];
+ char *bufptr = buf;
+
+ /* read from fd until eof, newline or our buffer is full */
+ while ((read(fd, bufptr, 1) > 0) && (bufptr < &(buf[BUFSIZE-1])))
+ {
+ if (*bufptr == '\n')
+ break;
+ bufptr++;
+ }
+
+ /* null terminate and log */
+ *bufptr = 0;
+ if (strlen(buf))
+ ErrorF("(pid %d %s) %s\n", pid, fdname, buf);
}
-/*
+static void *
+ExecAndLogThread(void *cmd)
+{
+ int pid;
+ int stdout_filedes[2];
+ int stderr_filedes[2];
+ int status;
+
+ /* Create a pair of pipes */
+ pipe(stdout_filedes);
+ pipe(stderr_filedes);
+
+ switch (pid = fork())
+ {
+ case 0: /* child */
+ {
+ struct rlimit rl;
+ unsigned int fd;
+
+ /* dup write end of pipes onto stderr and stdout */
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+
+ dup2(stdout_filedes[1], STDOUT_FILENO);
+ dup2(stderr_filedes[1], STDERR_FILENO);
+
+ /* Close any open descriptors except for STD* */
+ getrlimit (RLIMIT_NOFILE, &rl);
+ for (fd = STDERR_FILENO+1; fd < rl.rlim_cur; fd++)
+ close(fd);
+
+ /* Disassociate any TTYs */
+ setsid();
+
+ execl ("/bin/sh",
+ "/bin/sh",
+ "-c",
+ cmd,
+ NULL);
+ perror("execl failed");
+ exit(127);
+ }
+ break;
+
+ default: /* parent */
+ {
+ close(stdout_filedes[1]);
+ close(stderr_filedes[1]);
+
+ ErrorF("executing '%s', pid %d\n", (char *)cmd, pid);
+
+ /* read from pipes, write to log, until both are closed */
+ while (TRUE)
+ {
+ fd_set readfds, errorfds;
+ int nfds = max(stdout_filedes[0], stderr_filedes[0])+1;
+ FD_ZERO(&readfds);
+ FD_SET(stdout_filedes[0], &readfds);
+ FD_SET(stderr_filedes[0], &readfds);
+ errorfds = readfds;
+
+ if (select(nfds, &readfds, NULL, &errorfds, NULL) > 0)
+ {
+ if (FD_ISSET(stdout_filedes[0], &readfds))
+ LogLineFromFd(stdout_filedes[0], "stdout", pid);
+ if (FD_ISSET(stderr_filedes[0], &readfds))
+ LogLineFromFd(stderr_filedes[0], "stderr", pid);
+
+ if (FD_ISSET(stdout_filedes[0], &errorfds) &&
+ FD_ISSET(stderr_filedes[0], &errorfds))
+ break;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ waitpid(pid, &status, 0);
+ }
+ break;
+
+ case -1: /* error */
+ ErrorF("fork() to run command failed\n");
+ }
+
+ return (void *)status;
+}
+#endif
+
+ /*
* Searches for the custom WM_COMMAND command ID and performs action.
* Return TRUE if command is proccessed, FALSE otherwise.
*/
Bool
HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
{
- HWND hwnd;
- int i, j;
- MENUPARSED *m;
- DWORD dwExStyle;
+ HWND hwnd;
+ int i, j;
+ MENUPARSED *m;
+ DWORD dwExStyle;
- hwnd = (HWND) hwndIn;
+ hwnd = (HWND)hwndIn;
- if (!command)
- return FALSE;
+ if (!command)
+ return FALSE;
for (i = 0; i < pref.menuItems; i++) {
- m = &(pref.menu[i]);
+ m = &(pref.menu[i]);
for (j = 0; j < m->menuItems; j++) {
if (command == m->menuItem[j].commandID) {
- /* Match! */
+ /* Match! */
switch (m->menuItem[j].cmd) {
#ifdef __CYGWIN__
- case CMD_EXEC:
- if (fork() == 0) {
- struct rlimit rl;
- unsigned long i;
-
- /* Close any open descriptors except for STD* */
- getrlimit(RLIMIT_NOFILE, &rl);
- for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++)
- close(i);
-
- /* Disassociate any TTYs */
- setsid();
-
- execl("/bin/sh",
- "/bin/sh", "-c", m->menuItem[j].param, NULL);
- exit(0);
- }
+ case CMD_EXEC:
+ {
+ pthread_t t;
+ if (!pthread_create(&t, NULL, ExecAndLogThread, m->menuItem[j].param))
+ pthread_detach(t);
else
- return TRUE;
- break;
+ ErrorF("Creating command output logging thread failed\n");
+ }
+ return TRUE;
+ break;
#else
- case CMD_EXEC:
- {
- /* Start process without console window */
- STARTUPINFO start;
- PROCESS_INFORMATION child;
+ case CMD_EXEC:
+ {
+ /* Start process without console window */
+ STARTUPINFO start;
+ PROCESS_INFORMATION child;
- memset(&start, 0, sizeof(start));
- start.cb = sizeof(start);
- start.dwFlags = STARTF_USESHOWWINDOW;
- start.wShowWindow = SW_HIDE;
+ memset (&start, 0, sizeof (start));
+ start.cb = sizeof (start);
+ start.dwFlags = STARTF_USESHOWWINDOW;
+ start.wShowWindow = SW_HIDE;
- memset(&child, 0, sizeof(child));
+ memset (&child, 0, sizeof (child));
if (CreateProcess
(NULL, m->menuItem[j].param, NULL, NULL, FALSE, 0, NULL,
NULL, &start, &child)) {
- CloseHandle(child.hThread);
- CloseHandle(child.hProcess);
- }
- else
+ CloseHandle (child.hThread);
+ CloseHandle (child.hProcess);
+ }
+ else
MessageBox(NULL, m->menuItem[j].param,
"Mingrc Exec Command Error!",
MB_OK | MB_ICONEXCLAMATION);
- }
- return TRUE;
+ }
+ return TRUE;
#endif
- case CMD_ALWAYSONTOP:
- if (!hwnd)
- return FALSE;
-
- /* Get extended window style */
- dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
-
- /* Handle topmost windows */
- if (dwExStyle & WS_EX_TOPMOST)
- SetWindowPos(hwnd,
- HWND_NOTOPMOST,
+ case CMD_ALWAYSONTOP:
+ if (!hwnd)
+ return FALSE;
+
+ /* Get extended window style */
+ dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
+
+ /* Handle topmost windows */
+ if (dwExStyle & WS_EX_TOPMOST)
+ SetWindowPos (hwnd,
+ HWND_NOTOPMOST,
0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- else
- SetWindowPos(hwnd,
- HWND_TOPMOST,
+ else
+ SetWindowPos (hwnd,
+ HWND_TOPMOST,
0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
#if XWIN_MULTIWINDOW
- /* Reflect the changed Z order */
- winReorderWindowsMultiWindow();
+ /* Reflect the changed Z order */
+ winReorderWindowsMultiWindow ();
#endif
- return TRUE;
-
- case CMD_RELOAD:
- ReloadPrefs();
- return TRUE;
-
- default:
- return FALSE;
- }
- } /* match */
- } /* for j */
- } /* for i */
-
- return FALSE;
+ return TRUE;
+
+ case CMD_RELOAD:
+ ReloadPrefs();
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ } /* match */
+ } /* for j */
+ } /* for i */
+
+ return FALSE;
}
#ifdef XWIN_MULTIWINDOW
@@ -403,51 +516,51 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
* Add the default or a custom menu depending on the class match
*/
void
-SetupSysMenu(unsigned long hwndIn)
+SetupSysMenu (unsigned long hwndIn)
{
- HWND hwnd;
- HMENU sys;
- int i;
- WindowPtr pWin;
- char *res_name, *res_class;
-
- hwnd = (HWND) hwndIn;
- if (!hwnd)
- return;
-
- pWin = GetProp(hwnd, WIN_WINDOW_PROP);
-
- sys = GetSystemMenu(hwnd, FALSE);
- if (!sys)
- return;
+ HWND hwnd;
+ HMENU sys;
+ int i;
+ WindowPtr pWin;
+ char *res_name, *res_class;
+
+ hwnd = (HWND)hwndIn;
+ if (!hwnd)
+ return;
+
+ pWin = GetProp (hwnd, WIN_WINDOW_PROP);
+
+ sys = GetSystemMenu (hwnd, FALSE);
+ if (!sys)
+ return;
if (pWin) {
- /* First see if there's a class match... */
+ /* First see if there's a class match... */
if (winMultiWindowGetClassHint(pWin, &res_name, &res_class)) {
for (i = 0; i < pref.sysMenuItems; i++) {
- if (!strcmp(pref.sysMenu[i].match, res_name) ||
+ if (!strcmp(pref.sysMenu[i].match, res_name) ||
!strcmp(pref.sysMenu[i].match, res_class)) {
- free(res_name);
- free(res_class);
-
- MakeMenu(pref.sysMenu[i].menuName, sys,
- pref.sysMenu[i].menuPos == AT_START ? 0 : -1);
- return;
- }
- }
-
- /* No match, just free alloc'd strings */
- free(res_name);
- free(res_class);
- } /* Found wm_class */
- } /* if pwin */
-
- /* Fallback to system default */
+ free(res_name);
+ free(res_class);
+
+ MakeMenu (pref.sysMenu[i].menuName, sys,
+ pref.sysMenu[i].menuPos==AT_START?0:-1);
+ return;
+ }
+ }
+
+ /* No match, just free alloc'd strings */
+ free(res_name);
+ free(res_class);
+ } /* Found wm_class */
+ } /* if pwin */
+
+ /* Fallback to system default */
if (pref.defaultSysMenuName[0]) {
- if (pref.defaultSysMenuPos == AT_START)
- MakeMenu(pref.defaultSysMenuName, sys, 0);
- else
- MakeMenu(pref.defaultSysMenuName, sys, -1);
+ if (pref.defaultSysMenuPos==AT_START)
+ MakeMenu (pref.defaultSysMenuName, sys, 0);
+ else
+ MakeMenu (pref.defaultSysMenuName, sys, -1);
}
}
#endif
@@ -456,16 +569,16 @@ SetupSysMenu(unsigned long hwndIn)
* Possibly add a menu to the toolbar icon
*/
void
-SetupRootMenu(unsigned long hmenuRoot)
+SetupRootMenu (unsigned long hmenuRoot)
{
- HMENU root;
+ HMENU root;
- root = (HMENU) hmenuRoot;
- if (!root)
- return;
+ root = (HMENU)hmenuRoot;
+ if (!root)
+ return;
if (pref.rootMenuName[0]) {
- MakeMenu(pref.rootMenuName, root, 0);
+ MakeMenu(pref.rootMenuName, root, 0);
}
}
@@ -475,18 +588,18 @@ SetupRootMenu(unsigned long hmenuRoot)
HICON
winOverrideDefaultIcon(int size)
{
- HICON hicon;
-
+ HICON hicon;
+
if (pref.defaultIconName[0]) {
- hicon = LoadImageComma(pref.defaultIconName, size, size, 0);
- if (hicon == NULL)
- ErrorF("winOverrideDefaultIcon: LoadImageComma(%s) failed\n",
- pref.defaultIconName);
+ hicon = LoadImageComma (pref.defaultIconName, size, size, 0);
+ if (hicon==NULL)
+ ErrorF ("winOverrideDefaultIcon: LoadImageComma(%s) failed\n",
+ pref.defaultIconName);
- return hicon;
+ return hicon;
}
- return 0;
+ return 0;
}
/*
@@ -495,25 +608,25 @@ winOverrideDefaultIcon(int size)
HICON
winTaskbarIcon(void)
{
- HICON hicon;
+ HICON hicon;
- hicon = 0;
- /* First try and load an overridden, if success then return it */
+ hicon = 0;
+ /* First try and load an overridden, if success then return it */
if (pref.trayIconName[0]) {
- hicon = LoadImageComma(pref.trayIconName,
- GetSystemMetrics(SM_CXSMICON),
+ hicon = LoadImageComma (pref.trayIconName,
+ GetSystemMetrics (SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), 0);
}
- /* Otherwise return the default */
- if (!hicon)
- hicon = (HICON) LoadImage(g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN),
- IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON),
+ /* Otherwise return the default */
+ if (!hicon)
+ hicon = (HICON) LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics (SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), 0);
- return hicon;
+ return hicon;
}
/*
@@ -523,53 +636,53 @@ winTaskbarIcon(void)
* else try to load it as an .ico file and if that fails return NULL
*/
static HICON
-LoadImageComma(char *fname, int sx, int sy, int flags)
+LoadImageComma (char *fname, int sx, int sy, int flags)
{
- HICON hicon;
- int index;
- char file[PATH_MAX + NAME_MAX + 2];
+ HICON hicon;
+ int index;
+ char file[PATH_MAX+NAME_MAX+2];
- /* Some input error checking */
- if (!fname || !fname[0])
- return NULL;
+ /* Some input error checking */
+ if (!fname || !fname[0])
+ return NULL;
- index = 0;
- hicon = NULL;
+ index = 0;
+ hicon = NULL;
if (fname[0] == ',') {
- /* It's the XWIN.EXE resource they want */
- index = atoi(fname + 1);
- hicon = LoadImage(g_hInstance,
+ /* It's the XWIN.EXE resource they want */
+ index = atoi (fname+1);
+ hicon = LoadImage (g_hInstance,
MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags);
}
else {
- file[0] = 0;
- /* Prepend path if not given a "X:\" filename */
+ file[0] = 0;
+ /* Prepend path if not given a "X:\" filename */
if (!(fname[0] && fname[1] == ':' && fname[2] == '\\')) {
- strcpy(file, pref.iconDirectory);
- if (pref.iconDirectory[0])
- if (fname[strlen(fname) - 1] != '\\')
- strcat(file, "\\");
+ strcpy (file, pref.iconDirectory);
+ if (pref.iconDirectory[0])
+ if (fname[strlen(fname)-1]!='\\')
+ strcat (file, "\\");
}
- strcat(file, fname);
+ strcat (file, fname);
if (strrchr(file, ',')) {
- /* Specified as <fname>,<index> */
+ /* Specified as <fname>,<index> */
- *(strrchr(file, ',')) = 0; /* End string at comma */
- index = atoi(strrchr(fname, ',') + 1);
- hicon = ExtractIcon(g_hInstance, file, index);
- }
+ *(strrchr (file, ',')) = 0; /* End string at comma */
+ index = atoi (strrchr (fname, ',') + 1);
+ hicon = ExtractIcon (g_hInstance, file, index);
+ }
else {
- /* Just an .ico file... */
+ /* Just an .ico file... */
- hicon = (HICON) LoadImage(NULL,
- file,
- IMAGE_ICON,
+ hicon = (HICON)LoadImage (NULL,
+ file,
+ IMAGE_ICON,
sx, sy, LR_LOADFROMFILE | flags);
- }
+ }
}
- return hicon;
+ return hicon;
}
/*
@@ -577,50 +690,31 @@ LoadImageComma(char *fname, int sx, int sy, int flags)
* ICONS{} section in the prefs file, and load the icon from a file
*/
HICON
-winOverrideIcon(unsigned long longWin)
+winOverrideIcon (char *res_name, char *res_class, char *wmName)
{
- WindowPtr pWin = (WindowPtr) longWin;
- char *res_name, *res_class;
- int i;
- HICON hicon;
- char *wmName;
-
- if (pWin == NULL)
- return 0;
-
- /* If we can't find the class, we can't override from default! */
- if (!winMultiWindowGetClassHint(pWin, &res_name, &res_class))
- return 0;
-
- winMultiWindowGetWMName(pWin, &wmName);
-
- for (i = 0; i < pref.iconItems; i++) {
- if (!strcmp(pref.icon[i].match, res_name) ||
- !strcmp(pref.icon[i].match, res_class) ||
- (wmName && strstr(wmName, pref.icon[i].match))) {
- free(res_name);
- free(res_class);
- free(wmName);
-
- if (pref.icon[i].hicon)
- return pref.icon[i].hicon;
-
- hicon = LoadImageComma(pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE);
- if (hicon == NULL)
- ErrorF("winOverrideIcon: LoadImageComma(%s) failed\n",
- pref.icon[i].iconFile);
-
- pref.icon[i].hicon = hicon;
- return hicon;
- }
- }
-
- /* Didn't find the icon, fail gracefully */
- free(res_name);
- free(res_class);
- free(wmName);
-
- return 0;
+ int i;
+ HICON hicon;
+
+ for (i=0; i<pref.iconItems; i++) {
+ if ((res_name && !strcmp(pref.icon[i].match, res_name)) ||
+ (res_class && !strcmp(pref.icon[i].match, res_class)) ||
+ (wmName && strstr(wmName, pref.icon[i].match)))
+ {
+ if (pref.icon[i].hicon)
+ return pref.icon[i].hicon;
+
+ hicon = LoadImageComma (pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE);
+ if (hicon==NULL)
+ ErrorF ("winOverrideIcon: LoadImageComma(%s) failed\n",
+ pref.icon[i].iconFile);
+
+ pref.icon[i].hicon = hicon;
+ return hicon;
+ }
+ }
+
+ /* Didn't find the icon, fail gracefully */
+ return 0;
}
/*
@@ -630,19 +724,19 @@ winOverrideIcon(unsigned long longWin)
int
winIconIsOverride(unsigned hiconIn)
{
- HICON hicon;
- int i;
-
- hicon = (HICON) hiconIn;
-
- if (!hicon)
- return 0;
+ HICON hicon;
+ int i;
- for (i = 0; i < pref.iconItems; i++)
- if ((HICON) pref.icon[i].hicon == hicon)
- return 1;
+ hicon = (HICON)hiconIn;
+ if (!hicon)
return 0;
+
+ for (i=0; i<pref.iconItems; i++)
+ if ((HICON)pref.icon[i].hicon == hicon)
+ return 1;
+
+ return 0;
}
/*
@@ -650,39 +744,43 @@ winIconIsOverride(unsigned hiconIn)
* If @path is NULL, use the built-in default.
*/
static int
-winPrefsLoadPreferences(char *path)
+winPrefsLoadPreferences (char *path)
{
- FILE *prefFile = NULL;
+ FILE *prefFile = NULL;
- if (path)
- prefFile = fopen(path, "r");
+ if (path)
+ prefFile = fopen (path, "r");
else {
- char defaultPrefs[] =
- "MENU rmenu {\n"
- " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n"
- " \"Launch xterm\" EXEC xterm\n"
- " \"Load .XWinrc\" RELOAD\n"
+ char defaultPrefs[] =
+ "MENU rmenu {\n"
+ " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n"
+ " \"Launch xterm\" EXEC xterm\n"
+ " SEPARATOR\n"
+ " FAQ EXEC \"cygstart http://x.cygwin.com/docs/faq/cygwin-x-faq.html\"\n"
+ " \"User's Guide\" EXEC \"cygstart http://x.cygwin.com/docs/ug/cygwin-x-ug.html\"\n"
+ " SEPARATOR\n"
+ " \"Load .XWinrc\" RELOAD\n"
" SEPARATOR\n" "}\n" "\n" "ROOTMENU rmenu\n";
- path = "built-in default";
- prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
+ path = "built-in default";
+ prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
}
if (!prefFile) {
- ErrorF("LoadPreferences: %s not found\n", path);
- return FALSE;
+ ErrorF ("LoadPreferences: %s not found\n", path);
+ return FALSE;
}
- ErrorF("LoadPreferences: Loading %s\n", path);
+ ErrorF ("LoadPreferences: Loading %s\n", path);
if ((parse_file(prefFile)) != 0) {
- ErrorF("LoadPreferences: %s is badly formed!\n", path);
- fclose(prefFile);
- return FALSE;
+ ErrorF ("LoadPreferences: %s is badly formed!\n", path);
+ fclose (prefFile);
+ return FALSE;
}
- fclose(prefFile);
- return TRUE;
+ fclose (prefFile);
+ return TRUE;
}
/*
@@ -690,83 +788,89 @@ winPrefsLoadPreferences(char *path)
* Load it into prefs structure for use by other functions
*/
void
-LoadPreferences(void)
+LoadPreferences (void)
{
- char *home;
- char fname[PATH_MAX + NAME_MAX + 2];
- char szDisplay[512];
- char *szEnvDisplay;
- int i, j;
- char param[PARAM_MAX + 1];
- char *srcParam, *dstParam;
- int parsed = FALSE;
-
- /* First, clear all preference settings */
- memset(&pref, 0, sizeof(pref));
-
- /* Now try and find a ~/.xwinrc file */
- home = getenv("HOME");
+ char *home;
+ char fname[PATH_MAX+NAME_MAX+2];
+ char szDisplay[512];
+ char *szEnvDisplay;
+ int i, j;
+ char param[PARAM_MAX+1];
+ char *srcParam, *dstParam;
+ int parsed = FALSE;
+
+ /* First, clear all preference settings */
+ memset (&pref, 0, sizeof(pref));
+
+ /* Now try and find a ~/.xwinrc file */
+ home = getenv ("HOME");
if (home) {
- strcpy(fname, home);
- if (fname[strlen(fname) - 1] != '/')
- strcat(fname, "/");
- strcat(fname, ".XWinrc");
- parsed = winPrefsLoadPreferences(fname);
+ strcpy (fname, home);
+ if (fname[strlen(fname)-1]!='/')
+ strcat (fname, "/");
+ strcat (fname, ".XWinrc");
+ parsed = winPrefsLoadPreferences(fname);
}
- /* No home file found, check system default */
+ /* No home file found, check system default */
if (!parsed) {
- char buffer[MAX_PATH];
+ char buffer[MAX_PATH];
#ifdef RELOCATE_PROJECTROOT
- snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
+ snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
#else
- strncpy(buffer, SYSCONFDIR "/X11/system.XWinrc", sizeof(buffer));
+ strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer));
#endif
- buffer[sizeof(buffer) - 1] = 0;
- parsed = winPrefsLoadPreferences(buffer);
+ buffer[sizeof(buffer)-1] = 0;
+ parsed = winPrefsLoadPreferences(buffer);
}
- /* Neither user nor system configuration found, or were badly formed */
+ /* Neither user nor system configuration found, or were badly formed */
if (!parsed) {
ErrorF
("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n");
- parsed = winPrefsLoadPreferences(NULL);
+ parsed = winPrefsLoadPreferences(NULL);
}
- /* Setup a DISPLAY environment variable, need to allocate on heap */
- /* because putenv doesn't copy the argument... */
- snprintf(szDisplay, 512, "DISPLAY=127.0.0.1:%s.0", display);
- szEnvDisplay = (char *) (malloc(strlen(szDisplay) + 1));
- if (szEnvDisplay) {
- strcpy(szEnvDisplay, szDisplay);
- putenv(szEnvDisplay);
+ /* Setup a DISPLAY environment variable, need to allocate on heap */
+ /* because putenv doesn't copy the argument... */
+ winGetDisplayName(szDisplay, 0);
+ szEnvDisplay = (char *)(malloc(strlen(szDisplay)+strlen("DISPLAY=")+1));
+ if (szEnvDisplay)
+ {
+ snprintf(szEnvDisplay, 512, "DISPLAY=%s", szDisplay);
+ putenv (szEnvDisplay);
}
- /* Replace any "%display%" in menu commands with display string */
- snprintf(szDisplay, 512, "127.0.0.1:%s.0", display);
- for (i = 0; i < pref.menuItems; i++) {
- for (j = 0; j < pref.menu[i].menuItems; j++) {
- if (pref.menu[i].menuItem[j].cmd == CMD_EXEC) {
- srcParam = pref.menu[i].menuItem[j].param;
- dstParam = param;
- while (*srcParam) {
+ /* Setup XWINLOGFILE environment variable */
+ setenv("XWINLOGFILE", g_pszLogFile, TRUE);
+
+ /* Replace any "%display%" in menu commands with display string */
+ for (i=0; i<pref.menuItems; i++)
+ {
+ for (j=0; j<pref.menu[i].menuItems; j++)
+ {
+ if (pref.menu[i].menuItem[j].cmd==CMD_EXEC)
+ {
+ srcParam = pref.menu[i].menuItem[j].param;
+ dstParam = param;
+ while (*srcParam) {
if (!strncmp(srcParam, "%display%", 9)) {
- memcpy(dstParam, szDisplay, strlen(szDisplay));
- dstParam += strlen(szDisplay);
- srcParam += 9;
- }
+ memcpy (dstParam, szDisplay, strlen(szDisplay));
+ dstParam += strlen(szDisplay);
+ srcParam += 9;
+ }
else {
- *dstParam = *srcParam;
- dstParam++;
- srcParam++;
- }
- }
- *dstParam = 0;
- strcpy(pref.menu[i].menuItem[j].param, param);
- } /* cmd==cmd_exec */
- } /* for all menuitems */
- } /* for all menus */
+ *dstParam = *srcParam;
+ dstParam++;
+ srcParam++;
+ }
+ }
+ *dstParam = 0;
+ strcpy (pref.menu[i].menuItem[j].param, param);
+ } /* cmd==cmd_exec */
+ } /* for all menuitems */
+ } /* for all menus */
}
@@ -775,19 +879,19 @@ LoadPreferences(void)
* STYLES{} section in the prefs file, and return the style type
*/
unsigned long
-winOverrideStyle(char *res_name, char *res_class, char *wmName)
+winOverrideStyle (char *res_name, char *res_class, char *wmName)
{
- int i;
+ int i;
- for (i = 0; i < pref.styleItems; i++) {
- if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
- (res_class && !strcmp(pref.style[i].match, res_class)) ||
+ for (i=0; i<pref.styleItems; i++) {
+ if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
+ (res_class && !strcmp(pref.style[i].match, res_class)) ||
(wmName && strstr(wmName, pref.style[i].match))) {
- if (pref.style[i].type)
- return pref.style[i].type;
- }
- }
+ if (pref.style[i].type)
+ return pref.style[i].type;
+ }
+ }
- /* Didn't find the style, fail gracefully */
- return STYLE_NONE;
+ /* Didn't find the style, fail gracefully */
+ return STYLE_NONE;
}
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index fcce8d840..f73438801 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -45,100 +45,100 @@
#ifndef NAME_MAX
#define NAME_MAX PATH_MAX
#endif
-#define MENU_MAX 128 /* Maximum string length of a menu name or item */
+#define MENU_MAX 128 /* Maximum string length of a menu name or item */
#define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */
/* Supported commands in a MENU {} statement */
typedef enum MENUCOMMANDTYPE {
- CMD_EXEC, /* /bin/sh -c the parameter */
- CMD_MENU, /* Display a popup menu named param */
- CMD_SEPARATOR, /* Menu separator */
- CMD_ALWAYSONTOP, /* Toggle always-on-top mode */
- CMD_RELOAD /* Reparse the .XWINRC file */
+ CMD_EXEC, /* /bin/sh -c the parameter */
+ CMD_MENU, /* Display a popup menu named param */
+ CMD_SEPARATOR, /* Menu separator */
+ CMD_ALWAYSONTOP, /* Toggle always-on-top mode */
+ CMD_RELOAD /* Reparse the .XWINRC file */
} MENUCOMMANDTYPE;
-#define STYLE_NONE (0L) /* Dummy the first entry */
-#define STYLE_NOTITLE (1L) /* Force window style no titlebar */
-#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */
-#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */
-#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */
-#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */
-#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */
-#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */
+#define STYLE_NONE (0L) /* Dummy the first entry */
+#define STYLE_NOTITLE (1L) /* Force window style no titlebar */
+#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */
+#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */
+#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */
+#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */
+#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */
+#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */
/* Where to place a system menu */
typedef enum MENUPOSITION {
- AT_START, /* Place menu at the top of the system menu */
- AT_END /* Put it at the bottom of the menu (default) */
+ AT_START, /* Place menu at the top of the system menu */
+ AT_END /* Put it at the bottom of the menu (default) */
} MENUPOSITION;
/* Menu item definitions */
typedef struct MENUITEM {
- char text[MENU_MAX + 1]; /* To be displayed in menu */
- MENUCOMMANDTYPE cmd; /* What should it do? */
- char param[PARAM_MAX + 1]; /* Any parameters? */
- unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */
+ char text[MENU_MAX+1]; /* To be displayed in menu */
+ MENUCOMMANDTYPE cmd; /* What should it do? */
+ char param[PARAM_MAX+1]; /* Any parameters? */
+ unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */
} MENUITEM;
/* A completely read in menu... */
typedef struct MENUPARSED {
- char menuName[MENU_MAX + 1]; /* What's it called in the text? */
- MENUITEM *menuItem; /* Array of items */
- int menuItems; /* How big's the array? */
+ char menuName[MENU_MAX+1]; /* What's it called in the text? */
+ MENUITEM *menuItem; /* Array of items */
+ int menuItems; /* How big's the array? */
} MENUPARSED;
/* To map between a window and a system menu to add for it */
typedef struct SYSMENUITEM {
- char match[MENU_MAX + 1]; /* String to look for to apply this sysmenu */
- char menuName[MENU_MAX + 1]; /* Which menu to show? Used to set *menu */
- MENUPOSITION menuPos; /* Where to place it (ignored in root) */
+ char match[MENU_MAX+1]; /* String to look for to apply this sysmenu */
+ char menuName[MENU_MAX+1]; /* Which menu to show? Used to set *menu */
+ MENUPOSITION menuPos; /* Where to place it (ignored in root) */
} SYSMENUITEM;
/* To redefine icons for certain window types */
typedef struct ICONITEM {
- char match[MENU_MAX + 1]; /* What string to search for? */
- char iconFile[PATH_MAX + NAME_MAX + 2]; /* Icon location, WIN32 path */
- HICON hicon; /* LoadImage() result */
+ char match[MENU_MAX+1]; /* What string to search for? */
+ char iconFile[PATH_MAX+NAME_MAX+2]; /* Icon location, WIN32 path */
+ HICON hicon; /* LoadImage() result */
} ICONITEM;
/* To redefine styles for certain window types */
typedef struct STYLEITEM {
- char match[MENU_MAX + 1]; /* What string to search for? */
- unsigned long type; /* What should it do? */
+ char match[MENU_MAX+1]; /* What string to search for? */
+ unsigned long type; /* What should it do? */
} STYLEITEM;
typedef struct WINPREFS {
- /* Menu information */
- MENUPARSED *menu; /* Array of created menus */
- int menuItems; /* How big? */
+ /* Menu information */
+ MENUPARSED *menu; /* Array of created menus */
+ int menuItems; /* How big? */
- /* Taskbar menu settings */
- char rootMenuName[MENU_MAX + 1]; /* Menu for taskbar icon */
+ /* Taskbar menu settings */
+ char rootMenuName[MENU_MAX+1]; /* Menu for taskbar icon */
- /* System menu addition menus */
- SYSMENUITEM *sysMenu;
- int sysMenuItems;
+ /* System menu addition menus */
+ SYSMENUITEM *sysMenu;
+ int sysMenuItems;
- /* Which menu to add to unmatched windows? */
- char defaultSysMenuName[MENU_MAX + 1];
- MENUPOSITION defaultSysMenuPos; /* Where to place it */
+ /* Which menu to add to unmatched windows? */
+ char defaultSysMenuName[MENU_MAX+1];
+ MENUPOSITION defaultSysMenuPos; /* Where to place it */
- /* Icon information */
- char iconDirectory[PATH_MAX + 1]; /* Where do the .icos lie? (Win32 path) */
- char defaultIconName[NAME_MAX + 1]; /* Replacement for x.ico */
- char trayIconName[NAME_MAX + 1]; /* Replacement for tray icon */
+ /* Icon information */
+ char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */
+ char defaultIconName[NAME_MAX+1]; /* Replacement for x.ico */
+ char trayIconName[NAME_MAX+1]; /* Replacement for tray icon */
- ICONITEM *icon;
- int iconItems;
+ ICONITEM *icon;
+ int iconItems;
- STYLEITEM *style;
- int styleItems;
+ STYLEITEM *style;
+ int styleItems;
- /* Force exit flag */
- Bool fForceExit;
+ /* Force exit flag */
+ Bool fForceExit;
- /* Silent exit flag */
- Bool fSilentExit;
+ /* Silent exit flag */
+ Bool fSilentExit;
} WINPREFS;
@@ -147,13 +147,13 @@ extern WINPREFS pref;
/* Functions */
void
- LoadPreferences(void);
+LoadPreferences(void);
void
- SetupRootMenu(unsigned long hmenuRoot);
+SetupRootMenu (unsigned long hmenuRoot);
void
- SetupSysMenu(unsigned long hwndIn);
+SetupSysMenu (unsigned long hwndIn);
void
HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn);
@@ -162,12 +162,13 @@ Bool
HandleCustomWM_COMMAND(unsigned long hwndIn, int command);
int
- winIconIsOverride(unsigned hiconIn);
+winIconIsOverride (unsigned hiconIn);
-HICON winOverrideIcon(unsigned long longpWin);
+HICON
+winOverrideIcon (char *res_name, char *res_class, char *wmName);
unsigned long
- winOverrideStyle(char *res_name, char *res_class, char *wmName);
+winOverrideStyle (char *res_name, char *res_class, char *wmName);
HICON winTaskbarIcon(void);
diff --git a/hw/xwin/winprefslex.l b/hw/xwin/winprefslex.l
index ba8aea696..f3d988c5b 100644
--- a/hw/xwin/winprefslex.l
+++ b/hw/xwin/winprefslex.l
@@ -92,6 +92,12 @@ DEBUG { return DEBUGOUTPUT; }
RELOAD { return RELOAD; }
TRAYICON { return TRAYICON; }
SILENTEXIT { return SILENTEXIT; }
+DPI { return DPI; }
+XKBLAYOUT { return XKBLAYOUT; }
+XKBMODEL { return XKBMODEL; }
+XKBOPTIONS { return XKBOPTIONS; }
+XKBRULES { return XKBRULES; }
+XKBVARIANT { return XKBVARIANT; }
"{" { return LB; }
"}" { return RB; }
"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y
index 0acf160e4..f71969746 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -38,6 +38,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "globals.h"
+#include "winconfig.h"
#include "winprefs.h"
/* The following give better error messages in bison at the cost of a few KB */
@@ -56,6 +58,13 @@ static MENUPARSED menu;
/* Functions for parsing the tokens into out structure */
/* Defined at the end section of this file */
+static void SetDPI (char *dpi);
+static void SetXKBLayout (char *layout);
+static void SetXKBModel (char *model);
+static void SetXKBOptions (char *options);
+static void SetXKBRules (char *rules);
+static void SetXKBVariant (char *variant);
+
static void SetIconDirectory (char *path);
static void SetDefaultIcon (char *fname);
static void SetRootMenu (char *menu);
@@ -120,6 +129,12 @@ extern int yylex(void);
%token TRAYICON
%token FORCEEXIT
%token SILENTEXIT
+%token DPI
+%token XKBLAYOUT
+%token XKBMODEL
+%token XKBOPTIONS
+%token XKBRULES
+%token XKBVARIANT
%token <sVal> STRING
%type <uVal> group1
@@ -154,6 +169,30 @@ command: defaulticon
| trayicon
| forceexit
| silentexit
+ | dpi
+ | xkblayout
+ | xkbmodel
+ | xkboptions
+ | xkbrules
+ | xkbvariant
+ ;
+
+dpi: DPI STRING NEWLINE { SetDPI($2); free($2); }
+ ;
+
+xkblayout: XKBLAYOUT STRING NEWLINE { SetXKBLayout($2); }
+ ;
+
+xkbmodel: XKBMODEL STRING NEWLINE { SetXKBModel($2); }
+ ;
+
+xkboptions: XKBOPTIONS STRING NEWLINE { SetXKBOptions($2); }
+ ;
+
+xkbrules: XKBRULES STRING NEWLINE { SetXKBRules($2); }
+ ;
+
+xkbvariant: XKBVARIANT STRING NEWLINE { SetXKBVariant($2); }
;
trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
@@ -260,6 +299,58 @@ yyerror (char *s)
return 1;
}
+static void
+SetDPI (char *dpi)
+{
+ if (!g_cmdline.customDPI)
+ monitorResolution = atoi (dpi);
+}
+
+static void
+SetXKBLayout (char *layout)
+{
+ if (!g_cmdline.xkbLayout)
+ g_cmdline.xkbLayout = layout;
+ else
+ free (layout);
+}
+
+static void
+SetXKBModel (char *model)
+{
+ if (!g_cmdline.xkbModel)
+ g_cmdline.xkbModel = model;
+ else
+ free (model);
+}
+
+static void
+SetXKBOptions (char *options)
+{
+ if (!g_cmdline.xkbOptions)
+ g_cmdline.xkbOptions = options;
+ else
+ free (options);
+}
+
+static void
+SetXKBRules (char *rules)
+{
+ if (!g_cmdline.xkbRules)
+ g_cmdline.xkbRules = rules;
+ else
+ free (rules);
+}
+
+static void
+SetXKBVariant (char *variant)
+{
+ if (!g_cmdline.xkbVariant)
+ g_cmdline.xkbVariant = variant;
+ else
+ free (variant);
+}
+
/* Miscellaneous functions to store TOKENs into the structure */
static void
SetIconDirectory (char *path)
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 0f789f09d..86ad3e0fd 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -31,6 +31,10 @@ from The Open Group.
#include <xwin-config.h>
#endif
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
#include <../xfree86/common/xorgVersion.h>
#include "win.h"
#include "winconfig.h"
@@ -42,8 +46,8 @@ from The Open Group.
*/
#ifdef XWIN_CLIPBOARD
-extern Bool g_fUnicodeClipboard;
-extern Bool g_fClipboard;
+extern Bool g_fUnicodeClipboard;
+extern Bool g_fClipboard;
#endif
/*
@@ -51,13 +55,13 @@ extern Bool g_fClipboard;
*/
void
- winLogCommandLine(int argc, char *argv[]);
+winLogCommandLine (int argc, char *argv[]);
void
- winLogVersionInfo(void);
+winLogVersionInfo (void);
#ifdef DDXOSVERRORF
-void OsVendorVErrorF(const char *pszFormat, va_list va_args);
+void OsVendorVErrorF (const char *pszFormat, va_list va_args);
#endif
/*
@@ -70,125 +74,122 @@ static winScreenInfo defaultScreenInfo;
static void
winInitializeScreenDefaults(void)
{
- DWORD dwWidth, dwHeight;
- static Bool fInitializedScreenDefaults = FALSE;
+ DWORD dwWidth, dwHeight;
+ static Bool fInitializedScreenDefaults = FALSE;
- /* Bail out early if default screen has already been initialized */
- if (fInitializedScreenDefaults)
- return;
+ /* Bail out early if default screen has already been initialized */
+ if (fInitializedScreenDefaults)
+ return;
- /* Zero the memory used for storing the screen info */
- memset(&defaultScreenInfo, 0, sizeof(winScreenInfo));
+ /* Zero the memory used for storing the screen info */
+ memset(&defaultScreenInfo, 0, sizeof(winScreenInfo));
- /* Get default width and height */
- /*
- * NOTE: These defaults will cause the window to cover only
- * the primary monitor in the case that we have multiple monitors.
- */
- dwWidth = GetSystemMetrics(SM_CXSCREEN);
- dwHeight = GetSystemMetrics(SM_CYSCREEN);
+ /* Get default width and height */
+ /*
+ * NOTE: These defaults will cause the window to cover only
+ * the primary monitor in the case that we have multiple monitors.
+ */
+ dwWidth = GetSystemMetrics (SM_CXSCREEN);
+ dwHeight = GetSystemMetrics (SM_CYSCREEN);
winErrorFVerb(2,
"winInitializeScreenDefaults - primary monitor w %d h %d\n",
(int) dwWidth, (int) dwHeight);
- /* Set a default DPI, if no '-dpi' option was used */
+ /* Set a default DPI, if no '-dpi' option was used */
if (monitorResolution == 0) {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(NULL);
if (hdc) {
- int dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
- int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
+ int dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
+ int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
- winErrorFVerb(2,
- "winInitializeDefaultScreens - native DPI x %d y %d\n",
- dpiX, dpiY);
- monitorResolution = dpiY;
- ReleaseDC(NULL, hdc);
+ winErrorFVerb(2, "winInitializeScreenDefaults - native DPI x %d y %d\n", dpiX, dpiY);
+ monitorResolution = dpiY;
+ ReleaseDC(NULL, hdc);
}
- else {
- winErrorFVerb(1,
- "winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n",
- WIN_DEFAULT_DPI);
- monitorResolution = WIN_DEFAULT_DPI;
+ else
+ {
+ winErrorFVerb(1, "winInitializeScreenDefaults - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI);
+ monitorResolution = WIN_DEFAULT_DPI;
}
}
- defaultScreenInfo.iMonitor = 1;
- defaultScreenInfo.dwWidth = dwWidth;
- defaultScreenInfo.dwHeight = dwHeight;
- defaultScreenInfo.dwUserWidth = dwWidth;
- defaultScreenInfo.dwUserHeight = dwHeight;
+ defaultScreenInfo.iMonitor = 1;
+ defaultScreenInfo.hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
+ defaultScreenInfo.dwWidth = dwWidth;
+ defaultScreenInfo.dwHeight = dwHeight;
+ defaultScreenInfo.dwUserWidth = dwWidth;
+ defaultScreenInfo.dwUserHeight = dwHeight;
defaultScreenInfo.fUserGaveHeightAndWidth =
WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
- defaultScreenInfo.fUserGavePosition = FALSE;
- defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP;
- defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
+ defaultScreenInfo.fUserGavePosition = FALSE;
+ defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP;
+ defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
#ifdef XWIN_EMULATEPSEUDO
- defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
+ defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
#endif
- defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH;
- defaultScreenInfo.pfb = NULL;
- defaultScreenInfo.fFullScreen = FALSE;
- defaultScreenInfo.fDecoration = TRUE;
+ defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH;
+ defaultScreenInfo.pfb = NULL;
+ defaultScreenInfo.fFullScreen = FALSE;
+ defaultScreenInfo.fDecoration = TRUE;
#ifdef XWIN_MULTIWINDOWEXTWM
- defaultScreenInfo.fMWExtWM = FALSE;
- defaultScreenInfo.fInternalWM = FALSE;
+ defaultScreenInfo.fMWExtWM = FALSE;
+ defaultScreenInfo.fInternalWM = FALSE;
#endif
- defaultScreenInfo.fRootless = FALSE;
+ defaultScreenInfo.fRootless = FALSE;
#ifdef XWIN_MULTIWINDOW
- defaultScreenInfo.fMultiWindow = FALSE;
+ defaultScreenInfo.fMultiWindow = FALSE;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- defaultScreenInfo.fMultiMonitorOverride = FALSE;
+ defaultScreenInfo.fMultiMonitorOverride = FALSE;
#endif
- defaultScreenInfo.fMultipleMonitors = FALSE;
- defaultScreenInfo.fLessPointer = FALSE;
- defaultScreenInfo.iResizeMode = notAllowed;
- defaultScreenInfo.fNoTrayIcon = FALSE;
- defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
- defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
- defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
- defaultScreenInfo.fIgnoreInput = FALSE;
- defaultScreenInfo.fExplicitScreen = FALSE;
-
- /* Note that the default screen has been initialized */
- fInitializedScreenDefaults = TRUE;
+ defaultScreenInfo.fMultipleMonitors = FALSE;
+ defaultScreenInfo.fLessPointer = FALSE;
+ defaultScreenInfo.iResizeMode = resizeWithRandr;
+ defaultScreenInfo.fNoTrayIcon = FALSE;
+ defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
+ defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
+ defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
+ defaultScreenInfo.fIgnoreInput = FALSE;
+ defaultScreenInfo.fExplicitScreen = FALSE;
+
+ /* Note that the default screen has been initialized */
+ fInitializedScreenDefaults = TRUE;
}
static void
winInitializeScreen(int i)
{
- winErrorFVerb(2, "winInitializeScreen - %d\n", i);
+ winErrorFVerb (3, "winInitializeScreen - %d\n",i);
- /* Initialize default screen values, if needed */
- winInitializeScreenDefaults();
+ /* Initialize default screen values, if needed */
+ winInitializeScreenDefaults();
- /* Copy the default screen info */
- g_ScreenInfo[i] = defaultScreenInfo;
+ /* Copy the default screen info */
+ g_ScreenInfo[i] = defaultScreenInfo;
- /* Set the screen number */
- g_ScreenInfo[i].dwScreen = i;
+ /* Set the screen number */
+ g_ScreenInfo[i].dwScreen = i;
}
void
winInitializeScreens(int maxscreens)
{
- int i;
-
- winErrorFVerb(2, "winInitializeScreens - %i\n", maxscreens);
+ int i;
+ winErrorFVerb (3, "winInitializeScreens - %i\n", maxscreens);
if (maxscreens > g_iNumScreens) {
- /* Reallocate the memory for DDX-specific screen info */
+ /* Reallocate the memory for DDX-specific screen info */
g_ScreenInfo =
realloc(g_ScreenInfo, maxscreens * sizeof(winScreenInfo));
- /* Set default values for any new screens */
- for (i = g_iNumScreens; i < maxscreens; i++)
- winInitializeScreen(i);
+ /* Set default values for any new screens */
+ for (i = g_iNumScreens; i < maxscreens ; i++)
+ winInitializeScreen(i);
- /* Keep a count of the number of screens */
- g_iNumScreens = maxscreens;
+ /* Keep a count of the number of screens */
+ g_iNumScreens = maxscreens;
}
}
@@ -214,112 +215,112 @@ winInitializeScreens(int maxscreens)
/* Check if enough arguments are given for the option */
#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; }
-/* Compare the current option with the string. */
+/* Compare the current option with the string. */
#define IS_OPTION(name) (strcmp (argv[i], name) == 0)
int
-ddxProcessArgument(int argc, char *argv[], int i)
+ddxProcessArgument (int argc, char *argv[], int i)
{
- static Bool s_fBeenHere = FALSE;
- winScreenInfo *screenInfoPtr = NULL;
+ static Bool s_fBeenHere = FALSE;
+ winScreenInfo *screenInfoPtr = NULL;
- /* Initialize once */
+ /* Initialize once */
if (!s_fBeenHere) {
#ifdef DDXOSVERRORF
- /*
- * This initialises our hook into VErrorF () for catching log messages
- * that are generated before OsInit () is called.
- */
- OsVendorVErrorFProc = OsVendorVErrorF;
+ /*
+ * This initialises our hook into VErrorF () for catching log messages
+ * that are generated before OsInit () is called.
+ */
+ OsVendorVErrorFProc = OsVendorVErrorF;
#endif
- s_fBeenHere = TRUE;
+ s_fBeenHere = TRUE;
- /* Initialize only if option is not -help */
- if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") &&
+ /* Initialize only if option is not -help */
+ if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") &&
!IS_OPTION("-version") && !IS_OPTION("--version")) {
- /* Log the version information */
- winLogVersionInfo();
-
- /* Log the command line */
- winLogCommandLine(argc, argv);
-
- /*
- * Initialize default screen settings. We have to do this before
- * OsVendorInit () gets called, otherwise we will overwrite
- * settings changed by parameters such as -fullscreen, etc.
- */
- winErrorFVerb(2, "ddxProcessArgument - Initializing default "
- "screens\n");
- winInitializeScreenDefaults();
- }
+ /* Log the version information */
+ winLogVersionInfo ();
+
+ /* Log the command line */
+ winLogCommandLine (argc, argv);
+
+ /*
+ * Initialize default screen settings. We have to do this before
+ * OsVendorInit () gets called, otherwise we will overwrite
+ * settings changed by parameters such as -fullscreen, etc.
+ */
+ winErrorFVerb (2, "ddxProcessArgument - Initializing default "
+ "screens\n");
+ winInitializeScreenDefaults();
+ }
}
#if CYGDEBUG
- winDebug("ddxProcessArgument - arg: %s\n", argv[i]);
+ winDebug ("ddxProcessArgument - arg: %s\n", argv[i]);
#endif
- /*
- * Look for the '-help' and similar options
- */
+ /*
+ * Look for the '-help' and similar options
+ */
if (IS_OPTION("-help") || IS_OPTION("-h") || IS_OPTION("--help")) {
- /* Reset logfile. We don't need that helpmessage in the logfile */
- g_pszLogFile = NULL;
- g_fNoHelpMessageBox = TRUE;
- UseMsg();
- exit(0);
- return 1;
+ /* Reset logfile. We don't need that helpmessage in the logfile */
+ g_pszLogFile = NULL;
+ g_fNoHelpMessageBox = TRUE;
+ UseMsg();
+ exit (0);
+ return 1;
}
if (IS_OPTION("-version") || IS_OPTION("--version")) {
- /* Reset logfile. We don't need that versioninfo in the logfile */
- g_pszLogFile = NULL;
- winLogVersionInfo();
- exit(0);
- return 1;
+ /* Reset logfile. We don't need that versioninfo in the logfile */
+ g_pszLogFile = NULL;
+ winLogVersionInfo ();
+ exit (0);
+ return 1;
}
- /*
- * Look for the '-screen scr_num [width height]' argument
- */
+ /*
+ * Look for the '-screen scr_num [width height]' argument
+ */
if (IS_OPTION("-screen")) {
- int iArgsProcessed = 1;
- int nScreenNum;
- int iWidth, iHeight, iX, iY;
- int iMonitor;
+ int iArgsProcessed = 1;
+ int nScreenNum;
+ int iWidth, iHeight, iX, iY;
+ int iMonitor;
#if CYGDEBUG
winDebug("ddxProcessArgument - screen - argc: %d i: %d\n", argc, i);
#endif
- /* Display the usage message if the argument is malformed */
+ /* Display the usage message if the argument is malformed */
if (i + 1 >= argc) {
- return 0;
- }
+ return 0;
+ }
+
+ /* Grab screen number */
+ nScreenNum = atoi (argv[i + 1]);
- /* Grab screen number */
- nScreenNum = atoi(argv[i + 1]);
-
- /* Validate the specified screen number */
+ /* Validate the specified screen number */
if (nScreenNum < 0) {
- ErrorF("ddxProcessArgument - screen - Invalid screen number %d\n",
- nScreenNum);
- UseMsg();
- return 0;
+ ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n",
+ nScreenNum);
+ UseMsg ();
+ return 0;
}
- /*
- Initialize default values for any new screens
+ /*
+ Initialize default values for any new screens
- Note that default values can't change after a -screen option is
- seen, so it's safe to do this for each screen as it is introduced
- */
- winInitializeScreens(nScreenNum + 1);
+ Note that default values can't change after a -screen option is
+ seen, so it's safe to do this for each screen as it is introduced
+ */
+ winInitializeScreens(nScreenNum+1);
- /* look for @m where m is monitor number */
+ /* look for @m where m is monitor number */
if (i + 2 < argc && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) {
- struct GetMonitorInfoData data;
+ struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data)) {
ErrorF
@@ -329,81 +330,81 @@ ddxProcessArgument(int argc, char *argv[], int i)
winErrorFVerb(2,
"ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n",
iMonitor);
- iArgsProcessed = 3;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
- g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
- g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
- g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
- g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
- g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
- g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
- }
+ iArgsProcessed = 3;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
+ g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
+ g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
+ g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
+ }
else {
- /* monitor does not exist, error out */
+ /* monitor does not exist, error out */
ErrorF
("ddxProcessArgument - screen - Invalid monitor number %d\n",
- iMonitor);
- UseMsg();
- exit(0);
- return 0;
- }
- }
-
- /* Look for 'WxD' or 'W D' */
- else if (i + 2 < argc
- && 2 == sscanf(argv[i + 2], "%dx%d",
+ iMonitor);
+ UseMsg ();
+ exit (0);
+ return 0;
+ }
+ }
+
+ /* Look for 'WxD' or 'W D' */
+ else if (i + 2 < argc
+ && 2 == sscanf (argv[i + 2], "%dx%d",
(int *) &iWidth, (int *) &iHeight)) {
winErrorFVerb(2,
"ddxProcessArgument - screen - Found ``WxD'' arg\n");
- iArgsProcessed = 3;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
- g_ScreenInfo[nScreenNum].dwWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwHeight = iHeight;
- g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
- /* Look for WxD+X+Y */
- if (2 == sscanf(argv[i + 2], "%*dx%*d+%d+%d",
+ iArgsProcessed = 3;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = iHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
+ /* Look for WxD+X+Y */
+ if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d",
(int *) &iX, (int *) &iY)) {
winErrorFVerb(2,
"ddxProcessArgument - screen - Found ``X+Y'' arg\n");
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].dwInitialX = iX;
- g_ScreenInfo[nScreenNum].dwInitialY = iY;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = iX;
+ g_ScreenInfo[nScreenNum].dwInitialY = iY;
- /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
- if (1 == sscanf(argv[i + 2], "%*dx%*d+%*d+%*d@%d",
+ /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
+ if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d",
(int *) &iMonitor)) {
- struct GetMonitorInfoData data;
+ struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data)) {
ErrorF
("ddxProcessArgument - screen - Querying monitors failed\n");
}
else if (data.bMonitorSpecifiedExists == TRUE) {
- g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
- g_ScreenInfo[nScreenNum].dwInitialX +=
- data.monitorOffsetX;
- g_ScreenInfo[nScreenNum].dwInitialY +=
- data.monitorOffsetY;
- }
+ g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
+ g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
+ g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY;
+ }
else {
- /* monitor does not exist, error out */
+ /* monitor does not exist, error out */
ErrorF
("ddxProcessArgument - screen - Invalid monitor number %d\n",
- iMonitor);
- UseMsg();
- exit(0);
- return 0;
- }
+ iMonitor);
+ UseMsg ();
+ exit (0);
+ return 0;
+ }
- }
- }
+ }
+ }
- /* look for WxD@m where m is monitor number */
+ /* look for WxD@m where m is monitor number */
else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", (int *) &iMonitor)) {
- struct GetMonitorInfoData data;
+ struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data)) {
ErrorF
@@ -413,667 +414,682 @@ ddxProcessArgument(int argc, char *argv[], int i)
winErrorFVerb(2,
"ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n",
iMonitor);
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
- g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
- g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
- }
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
+ g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
+ g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
+ }
else {
- /* monitor does not exist, error out */
+ /* monitor does not exist, error out */
ErrorF
("ddxProcessArgument - screen - Invalid monitor number %d\n",
- iMonitor);
- UseMsg();
- exit(0);
- return 0;
- }
-
- }
- }
+ iMonitor);
+ UseMsg ();
+ exit (0);
+ return 0;
+ }
+
+ }
+ }
else if (i + 3 < argc && 1 == sscanf(argv[i + 2], "%d", (int *) &iWidth)
&& 1 == sscanf(argv[i + 3], "%d", (int *) &iHeight)) {
winErrorFVerb(2,
"ddxProcessArgument - screen - Found ``W D'' arg\n");
- iArgsProcessed = 4;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
- g_ScreenInfo[nScreenNum].dwWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwHeight = iHeight;
- g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
+ iArgsProcessed = 4;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = iHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
if (i + 5 < argc && 1 == sscanf(argv[i + 4], "%d", (int *) &iX)
&& 1 == sscanf(argv[i + 5], "%d", (int *) &iY)) {
winErrorFVerb(2,
"ddxProcessArgument - screen - Found ``X Y'' arg\n");
- iArgsProcessed = 6;
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].dwInitialX = iX;
- g_ScreenInfo[nScreenNum].dwInitialY = iY;
- }
- }
+ iArgsProcessed = 6;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = iX;
+ g_ScreenInfo[nScreenNum].dwInitialY = iY;
+ }
+ }
else {
winErrorFVerb(2,
"ddxProcessArgument - screen - Did not find size arg. "
- "dwWidth: %d dwHeight: %d\n",
- (int) g_ScreenInfo[nScreenNum].dwWidth,
- (int) g_ScreenInfo[nScreenNum].dwHeight);
- iArgsProcessed = 2;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
- }
-
- /* Flag that this screen was explicity specified by the user */
- g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;
-
- /*
- * Keep track of the last screen number seen, as parameters seen
- * before a screen number apply to all screens, whereas parameters
- * seen after a screen number apply to that screen number only.
- */
- iLastScreen = nScreenNum;
-
- return iArgsProcessed;
+ "dwWidth: %d dwHeight: %d\n",
+ (int) g_ScreenInfo[nScreenNum].dwWidth,
+ (int) g_ScreenInfo[nScreenNum].dwHeight);
+ iArgsProcessed = 2;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
+ }
+
+ /* Flag that this screen was explicity specified by the user */
+ g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;
+
+ /*
+ * Keep track of the last screen number seen, as parameters seen
+ * before a screen number apply to all screens, whereas parameters
+ * seen after a screen number apply to that screen number only.
+ */
+ iLastScreen = nScreenNum;
+
+ return iArgsProcessed;
}
- /*
- * Is this parameter attached to a screen or global?
- *
- * If the parameter is for all screens (appears before
- * any -screen option), store it in the default screen
- * info
- *
- * If the parameter is for a single screen (appears
- * after a -screen option), store it in the screen info
- * for that screen
- *
- */
+ /*
+ * Is this parameter attached to a screen or global?
+ *
+ * If the parameter is for all screens (appears before
+ * any -screen option), store it in the default screen
+ * info
+ *
+ * If the parameter is for a single screen (appears
+ * after a -screen option), store it in the screen info
+ * for that screen
+ *
+ */
if (iLastScreen == -1) {
- screenInfoPtr = &defaultScreenInfo;
+ screenInfoPtr = &defaultScreenInfo;
}
else {
- screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
+ screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
}
- /*
- * Look for the '-engine n' argument
- */
+ /*
+ * Look for the '-engine n' argument
+ */
if (IS_OPTION("-engine")) {
- DWORD dwEngine = 0;
- CARD8 c8OnBits = 0;
-
- /* Display the usage message if the argument is malformed */
+ DWORD dwEngine = 0;
+ CARD8 c8OnBits = 0;
+
+ /* Display the usage message if the argument is malformed */
if (++i >= argc) {
- UseMsg();
- return 0;
- }
+ UseMsg ();
+ return 0;
+ }
- /* Grab the argument */
- dwEngine = atoi(argv[i]);
+ /* Grab the argument */
+ dwEngine = atoi (argv[i]);
- /* Count the one bits in the engine argument */
- c8OnBits = winCountBits(dwEngine);
+ /* Count the one bits in the engine argument */
+ c8OnBits = winCountBits (dwEngine);
- /* Argument should only have a single bit on */
+ /* Argument should only have a single bit on */
if (c8OnBits != 1) {
- UseMsg();
- return 0;
- }
-
- screenInfoPtr->dwEnginePreferred = dwEngine;
-
- /* Indicate that we have processed the argument */
- return 2;
+ UseMsg ();
+ return 0;
+ }
+
+ screenInfoPtr->dwEnginePreferred = dwEngine;
+
+ /* Indicate that we have processed the argument */
+ return 2;
}
- /*
- * Look for the '-fullscreen' argument
- */
+ /*
+ * Look for the '-fullscreen' argument
+ */
if (IS_OPTION("-fullscreen")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
+ if (!screenInfoPtr->fMultiMonitorOverride)
screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- screenInfoPtr->fFullScreen = TRUE;
+ screenInfoPtr->fFullScreen = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-lesspointer' argument
- */
+ /*
+ * Look for the '-lesspointer' argument
+ */
if (IS_OPTION("-lesspointer")) {
- screenInfoPtr->fLessPointer = TRUE;
+ screenInfoPtr->fLessPointer = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-nodecoration' argument
- */
+ /*
+ * Look for the '-nodecoration' argument
+ */
if (IS_OPTION("-nodecoration")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- screenInfoPtr->fDecoration = FALSE;
+ screenInfoPtr->fDecoration = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#ifdef XWIN_MULTIWINDOWEXTWM
- /*
- * Look for the '-mwextwm' argument
- */
+ /*
+ * Look for the '-mwextwm' argument
+ */
if (IS_OPTION("-mwextwm")) {
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = TRUE;
- screenInfoPtr->fMWExtWM = TRUE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMWExtWM = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-internalwm' argument
- */
+ /*
+ * Look for the '-internalwm' argument
+ */
if (IS_OPTION("-internalwm")) {
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = TRUE;
- screenInfoPtr->fMWExtWM = TRUE;
- screenInfoPtr->fInternalWM = TRUE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMWExtWM = TRUE;
+ screenInfoPtr->fInternalWM = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-rootless' argument
- */
+ /*
+ * Look for the '-rootless' argument
+ */
if (IS_OPTION("-rootless")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- screenInfoPtr->fRootless = TRUE;
+ screenInfoPtr->fRootless = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#ifdef XWIN_MULTIWINDOW
- /*
- * Look for the '-multiwindow' argument
- */
+ /*
+ * Look for the '-multiwindow' argument
+ */
if (IS_OPTION("-multiwindow")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = TRUE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
#endif
- screenInfoPtr->fMultiWindow = TRUE;
+ screenInfoPtr->fMultiWindow = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-multiplemonitors' argument
- */
- if (IS_OPTION("-multiplemonitors")
+ /*
+ * Look for the '-multiplemonitors' argument
+ */
+ if (IS_OPTION ("-multiplemonitors")
|| IS_OPTION("-multimonitors")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- screenInfoPtr->fMultiMonitorOverride = TRUE;
+ screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
- screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMultipleMonitors = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-nomultiplemonitors' argument
- */
- if (IS_OPTION("-nomultiplemonitors")
+ /*
+ * Look for the '-nomultiplemonitors' argument
+ */
+ if (IS_OPTION ("-nomultiplemonitors")
|| IS_OPTION("-nomultimonitors")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- screenInfoPtr->fMultiMonitorOverride = TRUE;
+ screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
- screenInfoPtr->fMultipleMonitors = FALSE;
+ screenInfoPtr->fMultipleMonitors = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-scrollbars' argument
- */
+ /*
+ * Look for the '-scrollbars' argument
+ */
if (IS_OPTION("-scrollbars")) {
- screenInfoPtr->iResizeMode = resizeWithScrollbars;
+ screenInfoPtr->iResizeMode = resizeWithScrollbars;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-resize' argument
- */
- if (IS_OPTION("-resize") || IS_OPTION("-noresize") ||
+ /*
+ * Look for the '-resize' argument
+ */
+ if (IS_OPTION ("-resize") || IS_OPTION ("-noresize") ||
(strncmp(argv[i], "-resize=", strlen("-resize=")) == 0)) {
- winResizeMode mode;
+ winResizeMode mode;
+
+ if (IS_OPTION ("-resize"))
+ mode = resizeWithRandr;
+ else if (IS_OPTION ("-noresize"))
+ mode = notAllowed;
+ else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) {
+ char *option = argv[i] + strlen("-resize=");
- if (IS_OPTION("-resize"))
+ if (strcmp(option, "randr") == 0)
mode = resizeWithRandr;
- else if (IS_OPTION("-noresize"))
+ else if (strcmp(option, "scrollbars") == 0)
+ mode = resizeWithScrollbars;
+ else if (strcmp(option, "none") == 0)
mode = notAllowed;
- else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) {
- char *option = argv[i] + strlen("-resize=");
-
- if (strcmp(option, "randr") == 0)
- mode = resizeWithRandr;
- else if (strcmp(option, "scrollbars") == 0)
- mode = resizeWithScrollbars;
- else if (strcmp(option, "none") == 0)
- mode = notAllowed;
else {
ErrorF("ddxProcessArgument - resize - Invalid resize mode %s\n",
option);
- return 0;
+ return 0;
}
}
else {
ErrorF("ddxProcessArgument - resize - Invalid resize option %s\n",
argv[i]);
- return 0;
+ return 0;
}
- screenInfoPtr->iResizeMode = mode;
+ screenInfoPtr->iResizeMode = mode;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#ifdef XWIN_CLIPBOARD
- /*
- * Look for the '-clipboard' argument
- */
+ /*
+ * Look for the '-clipboard' argument
+ */
if (IS_OPTION("-clipboard")) {
- /* Now the default, we still accept the arg for backwards compatibility */
- g_fClipboard = TRUE;
+ /* Now the default, we still accept the arg for backwards compatibility */
+ g_fClipboard = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-noclipboard' argument
- */
+ /*
+ * Look for the '-noclipboard' argument
+ */
if (IS_OPTION("-noclipboard")) {
- g_fClipboard = FALSE;
+ g_fClipboard = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-ignoreinput' argument
- */
+ /*
+ * Look for the '-ignoreinput' argument
+ */
if (IS_OPTION("-ignoreinput")) {
- screenInfoPtr->fIgnoreInput = TRUE;
+ screenInfoPtr->fIgnoreInput = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-emulate3buttons' argument
- */
+ /*
+ * Look for the '-emulate3buttons' argument
+ */
if (IS_OPTION("-emulate3buttons")) {
- int iArgsProcessed = 1;
- int iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+ int iArgsProcessed = 1;
+ int iE3BTimeout = WIN_DEFAULT_E3B_TIME;
- /* Grab the optional timeout value */
+ /* Grab the optional timeout value */
if (i + 1 < argc && 1 == sscanf(argv[i + 1], "%d", &iE3BTimeout)) {
- /* Indicate that we have processed the next argument */
- iArgsProcessed++;
+ /* Indicate that we have processed the next argument */
+ iArgsProcessed++;
}
else {
- /*
- * sscanf () won't modify iE3BTimeout if it doesn't find
- * the specified format; however, I want to be explicit
- * about setting the default timeout in such cases to
- * prevent some programs (me) from getting confused.
- */
- iE3BTimeout = WIN_DEFAULT_E3B_TIME;
- }
-
- screenInfoPtr->iE3BTimeout = iE3BTimeout;
-
- /* Indicate that we have processed this argument */
- return iArgsProcessed;
+ /*
+ * sscanf () won't modify iE3BTimeout if it doesn't find
+ * the specified format; however, I want to be explicit
+ * about setting the default timeout in such cases to
+ * prevent some programs (me) from getting confused.
+ */
+ iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+ }
+
+ screenInfoPtr->iE3BTimeout = iE3BTimeout;
+
+ /* Indicate that we have processed this argument */
+ return iArgsProcessed;
}
- /*
- * Look for the '-noemulate3buttons' argument
- */
+ /*
+ * Look for the '-noemulate3buttons' argument
+ */
if (IS_OPTION("-noemulate3buttons")) {
- screenInfoPtr->iE3BTimeout = WIN_E3B_OFF;
+ screenInfoPtr->iE3BTimeout = WIN_E3B_OFF;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-depth n' argument
- */
+ /*
+ * Look for the '-depth n' argument
+ */
if (IS_OPTION("-depth")) {
- DWORD dwBPP = 0;
-
- /* Display the usage message if the argument is malformed */
+ DWORD dwBPP = 0;
+
+ /* Display the usage message if the argument is malformed */
if (++i >= argc) {
- UseMsg();
- return 0;
- }
+ UseMsg ();
+ return 0;
+ }
- /* Grab the argument */
- dwBPP = atoi(argv[i]);
+ /* Grab the argument */
+ dwBPP = atoi (argv[i]);
- screenInfoPtr->dwBPP = dwBPP;
+ screenInfoPtr->dwBPP = dwBPP;
- /* Indicate that we have processed the argument */
- return 2;
+ /* Indicate that we have processed the argument */
+ return 2;
}
- /*
- * Look for the '-refresh n' argument
- */
+ /*
+ * Look for the '-refresh n' argument
+ */
if (IS_OPTION("-refresh")) {
- DWORD dwRefreshRate = 0;
-
- /* Display the usage message if the argument is malformed */
+ DWORD dwRefreshRate = 0;
+
+ /* Display the usage message if the argument is malformed */
if (++i >= argc) {
- UseMsg();
- return 0;
- }
+ UseMsg ();
+ return 0;
+ }
- /* Grab the argument */
- dwRefreshRate = atoi(argv[i]);
+ /* Grab the argument */
+ dwRefreshRate = atoi (argv[i]);
- screenInfoPtr->dwRefreshRate = dwRefreshRate;
+ screenInfoPtr->dwRefreshRate = dwRefreshRate;
- /* Indicate that we have processed the argument */
- return 2;
+ /* Indicate that we have processed the argument */
+ return 2;
}
- /*
- * Look for the '-clipupdates num_boxes' argument
- */
+ /*
+ * Look for the '-clipupdates num_boxes' argument
+ */
if (IS_OPTION("-clipupdates")) {
- DWORD dwNumBoxes = 0;
-
- /* Display the usage message if the argument is malformed */
+ DWORD dwNumBoxes = 0;
+
+ /* Display the usage message if the argument is malformed */
if (++i >= argc) {
- UseMsg();
- return 0;
- }
+ UseMsg ();
+ return 0;
+ }
- /* Grab the argument */
- dwNumBoxes = atoi(argv[i]);
+ /* Grab the argument */
+ dwNumBoxes = atoi (argv[i]);
- screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;
+ screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;
- /* Indicate that we have processed the argument */
- return 2;
+ /* Indicate that we have processed the argument */
+ return 2;
}
#ifdef XWIN_EMULATEPSEUDO
- /*
- * Look for the '-emulatepseudo' argument
- */
+ /*
+ * Look for the '-emulatepseudo' argument
+ */
if (IS_OPTION("-emulatepseudo")) {
- screenInfoPtr->fEmulatePseudo = TRUE;
+ screenInfoPtr->fEmulatePseudo = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-nowinkill' argument
- */
+ /*
+ * Look for the '-nowinkill' argument
+ */
if (IS_OPTION("-nowinkill")) {
- screenInfoPtr->fUseWinKillKey = FALSE;
+ screenInfoPtr->fUseWinKillKey = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-winkill' argument
- */
+ /*
+ * Look for the '-winkill' argument
+ */
if (IS_OPTION("-winkill")) {
- screenInfoPtr->fUseWinKillKey = TRUE;
+ screenInfoPtr->fUseWinKillKey = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-nounixkill' argument
- */
+ /*
+ * Look for the '-nounixkill' argument
+ */
if (IS_OPTION("-nounixkill")) {
- screenInfoPtr->fUseUnixKillKey = FALSE;
+ screenInfoPtr->fUseUnixKillKey = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-unixkill' argument
- */
+ /*
+ * Look for the '-unixkill' argument
+ */
if (IS_OPTION("-unixkill")) {
- screenInfoPtr->fUseUnixKillKey = TRUE;
+ screenInfoPtr->fUseUnixKillKey = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-notrayicon' argument
- */
+ /*
+ * Look for the '-notrayicon' argument
+ */
if (IS_OPTION("-notrayicon")) {
- screenInfoPtr->fNoTrayIcon = TRUE;
+ screenInfoPtr->fNoTrayIcon = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-trayicon' argument
- */
+ /*
+ * Look for the '-trayicon' argument
+ */
if (IS_OPTION("-trayicon")) {
- screenInfoPtr->fNoTrayIcon = FALSE;
+ screenInfoPtr->fNoTrayIcon = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-fp' argument
- */
+ /*
+ * Look for the '-fp' argument
+ */
if (IS_OPTION("-fp")) {
- CHECK_ARGS(1);
- g_cmdline.fontPath = argv[++i];
- return 0; /* Let DIX parse this again */
+ CHECK_ARGS (1);
+ g_cmdline.fontPath = argv[++i];
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-query' argument
- */
+ /*
+ * Look for the '-query' argument
+ */
if (IS_OPTION("-query")) {
- CHECK_ARGS(1);
- g_fXdmcpEnabled = TRUE;
- g_pszQueryHost = argv[++i];
- return 0; /* Let DIX parse this again */
+ CHECK_ARGS (1);
+ g_fXdmcpEnabled = TRUE;
+ g_pszQueryHost = argv[++i];
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-auth' argument
- */
+ /*
+ * Look for the '-auth' argument
+ */
if (IS_OPTION("-auth")) {
- g_fAuthEnabled = TRUE;
- return 0; /* Let DIX parse this again */
+ g_fAuthEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-indirect' or '-broadcast' arguments
- */
- if (IS_OPTION("-indirect")
+ /*
+ * Look for the '-indirect' or '-broadcast' arguments
+ */
+ if (IS_OPTION ("-indirect")
|| IS_OPTION("-broadcast")) {
- g_fXdmcpEnabled = TRUE;
- return 0; /* Let DIX parse this again */
+ g_fXdmcpEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-config' argument
- */
- if (IS_OPTION("-config")
+ /*
+ * Look for the '-dpi' argument
+ */
+ if (IS_OPTION("-dpi")) {
+ g_cmdline.customDPI = TRUE;
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
+ * Look for the '-config' argument
+ */
+ if (IS_OPTION ("-config")
|| IS_OPTION("-xf86config")) {
- CHECK_ARGS(1);
+ CHECK_ARGS (1);
#ifdef XWIN_XF86CONFIG
- g_cmdline.configFile = argv[++i];
+ g_cmdline.configFile = argv[++i];
#else
- winMessageBoxF("The %s option is not supported in this "
- "release.\n"
- "Ignoring this option and continuing.\n",
+ winMessageBoxF ("The %s option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
MB_ICONINFORMATION, argv[i]);
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-configdir' argument
- */
+ /*
+ * Look for the '-configdir' argument
+ */
if (IS_OPTION("-configdir")) {
- CHECK_ARGS(1);
+ CHECK_ARGS (1);
#ifdef XWIN_XF86CONFIG
- g_cmdline.configDir = argv[++i];
+ g_cmdline.configDir = argv[++i];
#else
- winMessageBoxF("The %s option is not supported in this "
- "release.\n"
- "Ignoring this option and continuing.\n",
+ winMessageBoxF ("The %s option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
MB_ICONINFORMATION, argv[i]);
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-keyboard' argument
- */
+ /*
+ * Look for the '-keyboard' argument
+ */
if (IS_OPTION("-keyboard")) {
#ifdef XWIN_XF86CONFIG
- CHECK_ARGS(1);
- g_cmdline.keyboard = argv[++i];
+ CHECK_ARGS (1);
+ g_cmdline.keyboard = argv[++i];
#else
- winMessageBoxF("The -keyboard option is not supported in this "
- "release.\n"
- "Ignoring this option and continuing.\n",
- MB_ICONINFORMATION);
+ winMessageBoxF ("The -keyboard option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
+ MB_ICONINFORMATION);
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-logfile' argument
- */
+ /*
+ * Look for the '-logfile' argument
+ */
if (IS_OPTION("-logfile")) {
- CHECK_ARGS(1);
- g_pszLogFile = argv[++i];
+ CHECK_ARGS (1);
+ g_pszLogFile = argv[++i];
#ifdef RELOCATE_PROJECTROOT
- g_fLogFileChanged = TRUE;
+ g_fLogFileChanged = TRUE;
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-logverbose' argument
- */
+ /*
+ * Look for the '-logverbose' argument
+ */
if (IS_OPTION("-logverbose")) {
- CHECK_ARGS(1);
- g_iLogVerbose = atoi(argv[++i]);
- return 2;
+ CHECK_ARGS (1);
+ g_iLogVerbose = atoi(argv[++i]);
+ return 2;
}
#ifdef XWIN_CLIPBOARD
- /*
- * Look for the '-nounicodeclipboard' argument
- */
+ /*
+ * Look for the '-nounicodeclipboard' argument
+ */
if (IS_OPTION("-nounicodeclipboard")) {
- g_fUnicodeClipboard = FALSE;
- /* Indicate that we have processed the argument */
- return 1;
+ g_fUnicodeClipboard = FALSE;
+ /* Indicate that we have processed the argument */
+ return 1;
}
#endif
if (IS_OPTION("-xkbrules")) {
- CHECK_ARGS(1);
- g_cmdline.xkbRules = argv[++i];
- return 2;
+ CHECK_ARGS (1);
+ g_cmdline.xkbRules = argv[++i];
+ return 2;
}
if (IS_OPTION("-xkbmodel")) {
- CHECK_ARGS(1);
- g_cmdline.xkbModel = argv[++i];
- return 2;
+ CHECK_ARGS (1);
+ g_cmdline.xkbModel = argv[++i];
+ return 2;
}
if (IS_OPTION("-xkblayout")) {
- CHECK_ARGS(1);
- g_cmdline.xkbLayout = argv[++i];
- return 2;
+ CHECK_ARGS (1);
+ g_cmdline.xkbLayout = argv[++i];
+ return 2;
}
if (IS_OPTION("-xkbvariant")) {
- CHECK_ARGS(1);
- g_cmdline.xkbVariant = argv[++i];
- return 2;
+ CHECK_ARGS (1);
+ g_cmdline.xkbVariant = argv[++i];
+ return 2;
}
if (IS_OPTION("-xkboptions")) {
- CHECK_ARGS(1);
- g_cmdline.xkbOptions = argv[++i];
- return 2;
+ CHECK_ARGS (1);
+ g_cmdline.xkbOptions = argv[++i];
+ return 2;
}
if (IS_OPTION("-keyhook")) {
- g_fKeyboardHookLL = TRUE;
- return 1;
+ g_fKeyboardHookLL = TRUE;
+ return 1;
}
-
+
if (IS_OPTION("-nokeyhook")) {
- g_fKeyboardHookLL = FALSE;
- return 1;
+ g_fKeyboardHookLL = FALSE;
+ return 1;
}
-
+
if (IS_OPTION("-swcursor")) {
- g_fSoftwareCursor = TRUE;
- return 1;
+ g_fSoftwareCursor = TRUE;
+ return 1;
}
-
+
if (IS_OPTION("-silent-dup-error")) {
- g_fSilentDupError = TRUE;
- return 1;
+ g_fSilentDupError = TRUE;
+ return 1;
}
if (IS_OPTION("-wgl")) {
- g_fNativeGl = TRUE;
- return 1;
+ g_fNativeGl = TRUE;
+ return 1;
}
if (IS_OPTION("-nowgl")) {
- g_fNativeGl = FALSE;
- return 1;
+ g_fNativeGl = FALSE;
+ return 1;
}
- return 0;
+ if (IS_OPTION("-hostintitle"))
+ {
+ g_fHostInTitle = TRUE;
+ return 1;
+ }
+
+ return 0;
}
/*
@@ -1081,66 +1097,168 @@ ddxProcessArgument(int argc, char *argv[], int i)
*/
void
-winLogCommandLine(int argc, char *argv[])
+winLogCommandLine (int argc, char *argv[])
{
- int i;
- int iSize = 0;
- int iCurrLen = 0;
+ int i;
+ int iSize = 0;
+ int iCurrLen = 0;
#define CHARS_PER_LINE 60
- /* Bail if command line has already been logged */
- if (g_pszCommandLine)
- return;
+ /* Bail if command line has already been logged */
+ if (g_pszCommandLine)
+ return;
- /* Count how much memory is needed for concatenated command line */
- for (i = 0, iCurrLen = 0; i < argc; ++i)
+ /* Count how much memory is needed for concatenated command line */
+ for (i = 0, iCurrLen = 0; i < argc; ++i)
if (argv[i]) {
- /* Adds two characters for lines that overflow */
- if ((strlen(argv[i]) < CHARS_PER_LINE
- && iCurrLen + strlen(argv[i]) > CHARS_PER_LINE)
+ /* Adds two characters for lines that overflow */
+ if ((strlen (argv[i]) < CHARS_PER_LINE
+ && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
|| strlen(argv[i]) > CHARS_PER_LINE) {
- iCurrLen = 0;
- iSize += 2;
- }
-
- /* Add space for item and trailing space */
- iSize += strlen(argv[i]) + 1;
-
- /* Update current line length */
- iCurrLen += strlen(argv[i]);
- }
+ iCurrLen = 0;
+ iSize += 2;
+ }
+
+ /* Add space for item and trailing space */
+ iSize += strlen (argv[i]) + 1;
+
+ /* Update current line length */
+ iCurrLen += strlen (argv[i]);
+ }
+
+ /* Allocate memory for concatenated command line */
+ g_pszCommandLine = malloc (iSize + 1);
+ if (!g_pszCommandLine)
+ FatalError ("winLogCommandLine - Could not allocate memory for "
+ "command line string. Exiting.\n");
+
+ /* Set first character to concatenated command line to null */
+ g_pszCommandLine[0] = '\0';
+
+ /* Loop through all args */
+ for (i = 0, iCurrLen = 0; i < argc; ++i) {
+ /* Add a character for lines that overflow */
+ if ((strlen (argv[i]) < CHARS_PER_LINE
+ && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
+ || strlen(argv[i]) > CHARS_PER_LINE) {
+ iCurrLen = 0;
+
+ /* Add line break if it fits */
+ strncat (g_pszCommandLine, "\n ", iSize - strlen (g_pszCommandLine));
+ }
+
+ strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine));
+ strncat (g_pszCommandLine, " ", iSize - strlen (g_pszCommandLine));
+
+ /* Save new line length */
+ iCurrLen += strlen (argv[i]);
+ }
- /* Allocate memory for concatenated command line */
- g_pszCommandLine = malloc(iSize + 1);
- if (!g_pszCommandLine)
- FatalError("winLogCommandLine - Could not allocate memory for "
- "command line string. Exiting.\n");
+ ErrorF ("XWin was started with the following command line:\n\n"
+ "%s\n\n", g_pszCommandLine);
+}
- /* Set first character to concatenated command line to null */
- g_pszCommandLine[0] = '\0';
+/*
+ * Detect the OS
+ */
- /* Loop through all args */
- for (i = 0, iCurrLen = 0; i < argc; ++i) {
- /* Add a character for lines that overflow */
- if ((strlen(argv[i]) < CHARS_PER_LINE
- && iCurrLen + strlen(argv[i]) > CHARS_PER_LINE)
- || strlen(argv[i]) > CHARS_PER_LINE) {
- iCurrLen = 0;
+typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
- /* Add line break if it fits */
- strncat(g_pszCommandLine, "\n ", iSize - strlen(g_pszCommandLine));
+static void
+winOS(void)
+{
+ OSVERSIONINFOEX osvi = {0};
+ char *windowstype = "Unknown";
+ char *prodName = "Unknown";
+ char *isWow = "Unknown";
+ LPFN_ISWOW64PROCESS fnIsWow64Process;
+
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx((LPOSVERSIONINFO)&osvi);
+
+ /* Branch on platform ID */
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_NT:
+ windowstype = "Windows NT";
+
+ if (osvi.dwMajorVersion <= 4)
+ prodName = "Windows NT";
+ else if (osvi.dwMajorVersion == 6)
+ {
+ if (osvi.dwMinorVersion == 2)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ prodName = "Windows 8";
+ else
+ prodName = "Windows Server 2012";
}
+ else if (osvi.dwMinorVersion == 1)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ prodName = "Windows 7";
+ else
+ prodName = "Windows Server 2008 R2";
+ }
+ else if (osvi.dwMinorVersion == 0)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ prodName = "Windows Vista";
+ else
+ prodName = "Windows Server 2008";
+ }
+ } else if (osvi.dwMajorVersion == 5)
+ {
+ if (osvi.dwMinorVersion == 2)
+ {
+ if (GetSystemMetrics(SM_SERVERR2))
+ prodName = "Windows Server 2003 R2";
+ else
+ prodName = "Windows Server 2003";
+ }
+ else if (osvi.dwMinorVersion == 1)
+ prodName = "Windows XP";
+ else if (osvi.dwMinorVersion == 0)
+ {
+ prodName = "Windows 2000";
+ break;
+ }
+ }
+
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ windowstype = "Windows";
+ break;
+ }
- strncat(g_pszCommandLine, argv[i], iSize - strlen(g_pszCommandLine));
- strncat(g_pszCommandLine, " ", iSize - strlen(g_pszCommandLine));
-
- /* Save new line length */
- iCurrLen += strlen(argv[i]);
+ /* Check if we are running under WoW64 */
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"),"IsWow64Process");
+ if (NULL != fnIsWow64Process)
+ {
+ wBOOL bIsWow64 = FALSE;
+ if (fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
+ {
+ isWow = bIsWow64 ? " (WoW64)" : " (Win32)";
+ }
+ else
+ {
+ /* IsWow64Process() failed */
+ isWow = " (WoWUnknown)";
+ }
+ }
+ else
+ {
+ /* OS doesn't support IsWow64Process() */
+ isWow = "";
}
- ErrorF("XWin was started with the following command line:\n\n"
- "%s\n\n", g_pszCommandLine);
+ ErrorF("OS: %s %s [%s %ld.%ld build %ld]%s\n",
+ prodName, osvi.szCSDVersion,
+ windowstype, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber,
+ isWow);
}
/*
@@ -1148,19 +1266,26 @@ winLogCommandLine(int argc, char *argv[])
*/
void
-winLogVersionInfo(void)
+winLogVersionInfo (void)
{
- static Bool s_fBeenHere = FALSE;
-
- if (s_fBeenHere)
- return;
- s_fBeenHere = TRUE;
-
- ErrorF("Welcome to the XWin X Server\n");
- ErrorF("Vendor: %s\n", XVENDORNAME);
- ErrorF("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP,
- XORG_VERSION_CURRENT);
- ErrorF("%s\n\n", BUILDERSTRING);
- ErrorF("Contact: %s\n", BUILDERADDR);
+ static Bool s_fBeenHere = FALSE;
+
+ if (s_fBeenHere)
+ return;
+ s_fBeenHere = TRUE;
+
+ ErrorF ("Welcome to the XWin X Server\n");
+ ErrorF ("Vendor: %s\n", XVENDORNAME);
+ ErrorF ("Release: %d.%d.%d.%d\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
+#ifdef HAVE_SYS_UTSNAME_H
+ {
+ struct utsname name;
+ if (uname(&name) >= 0) {
+ ErrorF("OS: %s %s %s %s %s\n", name.sysname, name.nodename, name.release, name.version, name.machine);
+ }
+ }
+#endif
+ winOS();
+ if (strlen(BUILDERSTRING)) ErrorF ("%s\n", BUILDERSTRING);
+ ErrorF("\n");
}
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index cf7d2c0f8..3b018aff5 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -40,26 +40,26 @@
#ifdef XWIN_MULTIWINDOWEXTWM
static RootlessFrameProcsRec winMWExtWMProcs = {
- winMWExtWMCreateFrame,
- winMWExtWMDestroyFrame,
-
- winMWExtWMMoveFrame,
- winMWExtWMResizeFrame,
- winMWExtWMRestackFrame,
- winMWExtWMReshapeFrame,
- winMWExtWMUnmapFrame,
-
- winMWExtWMStartDrawing,
- winMWExtWMStopDrawing,
- winMWExtWMUpdateRegion,
- winMWExtWMDamageRects,
- winMWExtWMRootlessSwitchWindow,
- NULL, //winMWExtWMDoReorderWindow,
- NULL, //winMWExtWMHideWindow,
- NULL, //winMWExtWMUpdateColorMap,
-
- NULL, //winMWExtWMCopyBytes,
- winMWExtWMCopyWindow
+ winMWExtWMCreateFrame,
+ winMWExtWMDestroyFrame,
+
+ winMWExtWMMoveFrame,
+ winMWExtWMResizeFrame,
+ winMWExtWMRestackFrame,
+ winMWExtWMReshapeFrame,
+ winMWExtWMUnmapFrame,
+
+ winMWExtWMStartDrawing,
+ winMWExtWMStopDrawing,
+ winMWExtWMUpdateRegion,
+ winMWExtWMDamageRects,
+ winMWExtWMRootlessSwitchWindow,
+ NULL,//winMWExtWMDoReorderWindow,
+ NULL,//winMWExtWMHideWindow,
+ NULL,//winMWExtWMUpdateColorMap,
+
+ NULL,//winMWExtWMCopyBytes,
+ winMWExtWMCopyWindow
};
#endif
@@ -72,7 +72,7 @@ static RootlessFrameProcsRec winMWExtWMProcs = {
*/
static Bool
- winSaveScreen(ScreenPtr pScreen, int on);
+winSaveScreen (ScreenPtr pScreen, int on);
/*
* Determine what type of screen we are initializing
@@ -83,59 +83,59 @@ static Bool
Bool
winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
{
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
- winPrivScreenPtr pScreenPriv;
- HDC hdc;
- DWORD dwInitialBPP;
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ winPrivScreenPtr pScreenPriv;
+ HDC hdc;
+ DWORD dwInitialBPP;
#if CYGDEBUG || YES
- winDebug("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight);
+ winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight);
#endif
- /* Allocate privates for this screen */
+ /* Allocate privates for this screen */
if (!winAllocatePrivates(pScreen)) {
- ErrorF("winScreenInit - Couldn't allocate screen privates\n");
- return FALSE;
+ ErrorF ("winScreenInit - Couldn't allocate screen privates\n");
+ return FALSE;
}
- /* Get a pointer to the privates structure that was allocated */
- pScreenPriv = winGetScreenPriv(pScreen);
+ /* Get a pointer to the privates structure that was allocated */
+ pScreenPriv = winGetScreenPriv (pScreen);
- /* Save a pointer to this screen in the screen info structure */
- pScreenInfo->pScreen = pScreen;
+ /* Save a pointer to this screen in the screen info structure */
+ pScreenInfo->pScreen = pScreen;
- /* Save a pointer to the screen info in the screen privates structure */
- /* This allows us to get back to the screen info from a screen pointer */
- pScreenPriv->pScreenInfo = pScreenInfo;
+ /* Save a pointer to the screen info in the screen privates structure */
+ /* This allows us to get back to the screen info from a screen pointer */
+ pScreenPriv->pScreenInfo = pScreenInfo;
- /*
- * Determine which engine to use.
- *
- * NOTE: This is done once per screen because each screen possibly has
- * a preferred engine specified on the command line.
- */
+ /*
+ * Determine which engine to use.
+ *
+ * NOTE: This is done once per screen because each screen possibly has
+ * a preferred engine specified on the command line.
+ */
if (!winSetEngine(pScreen)) {
- ErrorF("winScreenInit - winSetEngine () failed\n");
- return FALSE;
+ ErrorF ("winScreenInit - winSetEngine () failed\n");
+ return FALSE;
}
- /* Horribly misnamed function: Allow engine to adjust BPP for screen */
- dwInitialBPP = pScreenInfo->dwBPP;
+ /* Horribly misnamed function: Allow engine to adjust BPP for screen */
+ dwInitialBPP = pScreenInfo->dwBPP;
if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) {
- ErrorF("winScreenInit - winAdjustVideoMode () failed\n");
- return FALSE;
+ ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
+ return FALSE;
}
if (dwInitialBPP == WIN_DEFAULT_BPP) {
- /* No -depth parameter was passed, let the user know the depth being used */
+ /* No -depth parameter was passed, let the user know the depth being used */
ErrorF
("winScreenInit - Using Windows display depth of %d bits per pixel\n",
(int) pScreenInfo->dwBPP);
}
else if (dwInitialBPP != pScreenInfo->dwBPP) {
- /* Warn user if engine forced a depth different to -depth parameter */
+ /* Warn user if engine forced a depth different to -depth parameter */
ErrorF
("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n",
(int) dwInitialBPP, (int) pScreenInfo->dwBPP);
@@ -145,581 +145,584 @@ winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
(int) pScreenInfo->dwBPP);
}
- /* Check for supported display depth */
+ /* Check for supported display depth */
if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) {
ErrorF("winScreenInit - Unsupported display depth: %d\n"
- "Change your Windows display depth to 15, 16, 24, or 32 bits "
+ "Change your Windows display depth to 15, 16, 24, or 32 bits "
"per pixel.\n", (int) pScreenInfo->dwBPP);
ErrorF("winScreenInit - Supported depths: %08x\n", WIN_SUPPORTED_BPPS);
#if WIN_CHECK_DEPTH
- return FALSE;
+ return FALSE;
#endif
}
- /*
- * Check that all monitors have the same display depth if we are using
- * multiple monitors
- */
- if (pScreenInfo->fMultipleMonitors
+ /*
+ * Check that all monitors have the same display depth if we are using
+ * multiple monitors
+ */
+ if (pScreenInfo->fMultipleMonitors
&& !GetSystemMetrics(SM_SAMEDISPLAYFORMAT)) {
- ErrorF("winScreenInit - Monitors do not all have same pixel format / "
- "display depth.\n");
+ ErrorF ("winScreenInit - Monitors do not all have same pixel format / "
+ "display depth.\n");
if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) {
ErrorF
("winScreenInit - Performance may suffer off primary display.\n");
}
else {
- ErrorF("winScreenInit - Using primary display only.\n");
- pScreenInfo->fMultipleMonitors = FALSE;
+ ErrorF ("winScreenInit - Using primary display only.\n");
+ pScreenInfo->fMultipleMonitors = FALSE;
}
}
- /* Create display window */
+ /* Create display window */
if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) {
ErrorF("winScreenInit - pwinCreateBoundingWindow () " "failed\n");
- return FALSE;
+ return FALSE;
}
- /* Get a device context */
- hdc = GetDC(pScreenPriv->hwndScreen);
+ /* Get a device context */
+ hdc = GetDC (pScreenPriv->hwndScreen);
- /* Are we using multiple monitors? */
+ /* Are we using multiple monitors? */
if (pScreenInfo->fMultipleMonitors) {
- /*
- * In this case, some of the defaults set in
- * winInitializeScreenDefaults() are not correct ...
- */
+ /*
+ * In this case, some of the defaults set in
+ * winInitializeScreenDefaults() are not correct ...
+ */
if (!pScreenInfo->fUserGaveHeightAndWidth) {
- pScreenInfo->dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- pScreenInfo->dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
- }
+ pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ }
}
- /* Release the device context */
- ReleaseDC(pScreenPriv->hwndScreen, hdc);
-
- /* Clear the visuals list */
- miClearVisualTypes();
+ /* Release the device context */
+ ReleaseDC (pScreenPriv->hwndScreen, hdc);
+
+ /* Clear the visuals list */
+ miClearVisualTypes ();
- /* Call the engine dependent screen initialization procedure */
+ /* Call the engine dependent screen initialization procedure */
if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) {
- ErrorF("winScreenInit - winFinishScreenInit () failed\n");
+ ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
- /* call the engine dependent screen close procedure to clean up from a failure */
- pScreenPriv->pwinCloseScreen(index, pScreen);
+ /* call the engine dependent screen close procedure to clean up from a failure */
+ pScreenPriv->pwinCloseScreen(index, pScreen);
- return FALSE;
+ return FALSE;
}
- if (!g_fSoftwareCursor)
- winInitCursor(pScreen);
- else
- winErrorFVerb(2, "winScreenInit - Using software cursor\n");
+ if (!g_fSoftwareCursor)
+ winInitCursor(pScreen);
+ else
+ winErrorFVerb(2, "winScreenInit - Using software cursor\n");
- /*
- Note the screen origin in a normalized coordinate space where (0,0) is at the top left
- of the native virtual desktop area
- */
- pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
- pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+ if (!noPanoramiXExtension)
+ {
+ /*
+ Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+ of the native virtual desktop area
+ */
+ pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
- ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n",
- index, pScreen->x, pScreen->y);
+ ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n",
+ index, pScreen->x, pScreen->y);
+ }
#if CYGDEBUG || YES
- winDebug("winScreenInit - returning\n");
+ winDebug ("winScreenInit - returning\n");
#endif
- return TRUE;
+ return TRUE;
}
static Bool
winCreateScreenResources(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- Bool result;
+ winScreenPriv(pScreen);
+ Bool result;
- result = pScreenPriv->pwinCreateScreenResources(pScreen);
+ result = pScreenPriv->pwinCreateScreenResources(pScreen);
- /* Now the screen bitmap has been wrapped in a pixmap,
- add that to the Shadow framebuffer */
- if (!shadowAdd(pScreen, pScreen->devPrivate,
+ /* Now the screen bitmap has been wrapped in a pixmap,
+ add that to the Shadow framebuffer */
+ if (!shadowAdd(pScreen, pScreen->devPrivate,
pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) {
- ErrorF("winCreateScreenResources - shadowAdd () failed\n");
- return FALSE;
+ ErrorF ("winCreateScreenResources - shadowAdd () failed\n");
+ return FALSE;
}
- return result;
+ return result;
}
/* See Porting Layer Definition - p. 20 */
Bool
winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- VisualPtr pVisual = NULL;
- char *pbits = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ VisualPtr pVisual = NULL;
+ char *pbits = NULL;
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- int iReturn;
+ int iReturn;
#endif
- /* Create framebuffer */
+ /* Create framebuffer */
if (!(*pScreenPriv->pwinInitScreen) (pScreen)) {
- ErrorF("winFinishScreenInitFB - Could not allocate framebuffer\n");
- return FALSE;
- }
-
- /*
- * Calculate the number of bits that are used to represent color in each pixel,
- * the color depth for the screen
- */
- if (pScreenInfo->dwBPP == 8)
- pScreenInfo->dwDepth = 8;
- else
- pScreenInfo->dwDepth = winCountBits(pScreenPriv->dwRedMask)
- + winCountBits(pScreenPriv->dwGreenMask)
- + winCountBits(pScreenPriv->dwBlueMask);
-
- winErrorFVerb(2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask);
-
- /* Init visuals */
+ ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n");
+ return FALSE;
+ }
+
+ /*
+ * Calculate the number of bits that are used to represent color in each pixel,
+ * the color depth for the screen
+ */
+ if (pScreenInfo->dwBPP == 8)
+ pScreenInfo->dwDepth = 8;
+ else
+ pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask)
+ + winCountBits (pScreenPriv->dwGreenMask)
+ + winCountBits (pScreenPriv->dwBlueMask);
+
+ winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask);
+
+ /* Init visuals */
if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) {
- ErrorF("winFinishScreenInitFB - winInitVisuals failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n");
+ return FALSE;
}
- /* Setup a local variable to point to the framebuffer */
- pbits = pScreenInfo->pfb;
+ /* Setup a local variable to point to the framebuffer */
+ pbits = pScreenInfo->pfb;
+
+ /* Apparently we need this for the render extension */
+ miSetPixmapDepths ();
- /* Apparently we need this for the render extension */
- miSetPixmapDepths();
-
- /* Start fb initialization */
- if (!fbSetupScreen(pScreen,
- pScreenInfo->pfb,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
+ /* Start fb initialization */
+ if (!fbSetupScreen (pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
pScreenInfo->dwStride, pScreenInfo->dwBPP)) {
- ErrorF("winFinishScreenInitFB - fbSetupScreen failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n");
+ return FALSE;
}
- /* Override default colormap routines if visual class is dynamic */
- if (pScreenInfo->dwDepth == 8
- && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
- && pScreenInfo->fFullScreen)
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ /* Override default colormap routines if visual class is dynamic */
+ if (pScreenInfo->dwDepth == 8
+ && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ && pScreenInfo->fFullScreen)
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
&& pScreenInfo->fFullScreen))) {
- winSetColormapFunctions(pScreen);
-
- /*
- * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
- * own colormap, as it cannot allocate 7 planes in the default
- * colormap. Setting whitePixel to 1 allows Magic to get 7
- * planes in the default colormap, so it doesn't create its
- * own colormap. This latter situation is highly desireable,
- * as it keeps the Magic window viewable when switching to
- * other X clients that use the default colormap.
- */
- pScreen->blackPixel = 0;
- pScreen->whitePixel = 1;
- }
-
- /* Place our save screen function */
- pScreen->SaveScreen = winSaveScreen;
-
- /* Finish fb initialization */
- if (!fbFinishScreenInit(pScreen,
- pScreenInfo->pfb,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
+ winSetColormapFunctions (pScreen);
+
+ /*
+ * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
+ * own colormap, as it cannot allocate 7 planes in the default
+ * colormap. Setting whitePixel to 1 allows Magic to get 7
+ * planes in the default colormap, so it doesn't create its
+ * own colormap. This latter situation is highly desireable,
+ * as it keeps the Magic window viewable when switching to
+ * other X clients that use the default colormap.
+ */
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+ }
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Finish fb initialization */
+ if (!fbFinishScreenInit (pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
pScreenInfo->dwStride, pScreenInfo->dwBPP)) {
- ErrorF("winFinishScreenInitFB - fbFinishScreenInit failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n");
+ return FALSE;
}
- /* Save a pointer to the root visual */
- for (pVisual = pScreen->visuals;
+ /* Save a pointer to the root visual */
+ for (pVisual = pScreen->visuals;
pVisual->vid != pScreen->rootVisual; pVisual++);
- pScreenPriv->pRootVisual = pVisual;
-
- /*
- * Setup points to the block and wakeup handlers. Pass a pointer
- * to the current screen as pWakeupdata.
- */
- pScreen->BlockHandler = winBlockHandler;
- pScreen->WakeupHandler = winWakeupHandler;
- pScreen->blockData = pScreen;
- pScreen->wakeupData = pScreen;
-
- /* Render extension initialization, calls miPictureInit */
+ pScreenPriv->pRootVisual = pVisual;
+
+ /*
+ * Setup points to the block and wakeup handlers. Pass a pointer
+ * to the current screen as pWakeupdata.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Render extension initialization, calls miPictureInit */
if (!fbPictureInit(pScreen, NULL, 0)) {
- ErrorF("winFinishScreenInitFB - fbPictureInit () failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n");
+ return FALSE;
}
#ifdef RANDR
- /* Initialize resize and rotate support */
+ /* Initialize resize and rotate support */
if (!winRandRInit(pScreen)) {
- ErrorF("winFinishScreenInitFB - winRandRInit () failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
+ return FALSE;
}
#endif
- /* Setup the cursor routines */
+ /* Setup the cursor routines */
#if CYGDEBUG
- winDebug("winFinishScreenInitFB - Calling miDCInitialize ()\n");
+ winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
#endif
- miDCInitialize(pScreen, &g_winPointerCursorFuncs);
+ miDCInitialize (pScreen, &g_winPointerCursorFuncs);
- /* KDrive does winCreateDefColormap right after miDCInitialize */
- /* Create a default colormap */
+ /* KDrive does winCreateDefColormap right after miDCInitialize */
+ /* Create a default colormap */
#if CYGDEBUG
- winDebug("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
+ winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
#endif
if (!winCreateDefColormap(pScreen)) {
- ErrorF("winFinishScreenInitFB - Could not create colormap\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - Could not create colormap\n");
+ return FALSE;
}
- /* Initialize the shadow framebuffer layer */
- if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
+ /* Initialize the shadow framebuffer layer */
+ if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
) {
#if CYGDEBUG
- winDebug("winFinishScreenInitFB - Calling shadowSetup ()\n");
+ winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n");
#endif
if (!shadowSetup(pScreen)) {
- ErrorF("winFinishScreenInitFB - shadowSetup () failed\n");
- return FALSE;
- }
+ ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n");
+ return FALSE;
+ }
- /* Wrap CreateScreenResources so we can add the screen pixmap
- to the Shadow framebuffer after it's been created */
- pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = winCreateScreenResources;
+ /* Wrap CreateScreenResources so we can add the screen pixmap
+ to the Shadow framebuffer after it's been created */
+ pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = winCreateScreenResources;
}
#ifdef XWIN_MULTIWINDOWEXTWM
- /* Handle multi-window external window manager mode */
+ /* Handle multi-window external window manager mode */
if (pScreenInfo->fMWExtWM) {
- winDebug("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
-
- RootlessInit(pScreen, &winMWExtWMProcs);
-
- winDebug("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
-
- rootless_CopyBytes_threshold = 0;
- /* FIXME: How many? Profiling needed? */
- rootless_CopyWindow_threshold = 1;
-
- winWindowsWMExtensionInit();
+ winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
+
+ RootlessInit(pScreen, &winMWExtWMProcs);
+
+ winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
+
+ rootless_CopyBytes_threshold = 0;
+ /* FIXME: How many? Profiling needed? */
+ rootless_CopyWindow_threshold = 1;
+
+ winWindowsWMExtensionInit ();
}
#endif
- /* Handle rootless mode */
+ /* Handle rootless mode */
if (pScreenInfo->fRootless) {
- /* Define the WRAP macro temporarily for local use */
+ /* Define the WRAP macro temporarily for local use */
#define WRAP(a) \
if (pScreen->a) { \
pScreenPriv->a = pScreen->a; \
} else { \
- ErrorF("null screen fn " #a "\n"); \
+ winDebug("winScreenInit - null screen fn " #a "\n"); \
pScreenPriv->a = NULL; \
}
- /* Save a pointer to each lower-level window procedure */
- WRAP(CreateWindow);
- WRAP(DestroyWindow);
- WRAP(RealizeWindow);
- WRAP(UnrealizeWindow);
- WRAP(PositionWindow);
- WRAP(ChangeWindowAttributes);
- WRAP(SetShape);
-
- /* Assign rootless window procedures to be top level procedures */
- pScreen->CreateWindow = winCreateWindowRootless;
- pScreen->DestroyWindow = winDestroyWindowRootless;
- pScreen->PositionWindow = winPositionWindowRootless;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless; */
- pScreen->RealizeWindow = winMapWindowRootless;
- pScreen->UnrealizeWindow = winUnmapWindowRootless;
- pScreen->SetShape = winSetShapeRootless;
-
- /* Undefine the WRAP macro, as it is not needed elsewhere */
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(SetShape);
+
+ /* Assign rootless window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowRootless;
+ pScreen->DestroyWindow = winDestroyWindowRootless;
+ pScreen->PositionWindow = winPositionWindowRootless;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/
+ pScreen->RealizeWindow = winMapWindowRootless;
+ pScreen->UnrealizeWindow = winUnmapWindowRootless;
+ pScreen->SetShape = winSetShapeRootless;
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
#undef WRAP
}
#ifdef XWIN_MULTIWINDOW
- /* Handle multi window mode */
+ /* Handle multi window mode */
else if (pScreenInfo->fMultiWindow) {
- /* Define the WRAP macro temporarily for local use */
+ /* Define the WRAP macro temporarily for local use */
#define WRAP(a) \
if (pScreen->a) { \
pScreenPriv->a = pScreen->a; \
} else { \
- ErrorF("null screen fn " #a "\n"); \
+ winDebug("null screen fn " #a "\n"); \
pScreenPriv->a = NULL; \
}
- /* Save a pointer to each lower-level window procedure */
- WRAP(CreateWindow);
- WRAP(DestroyWindow);
- WRAP(RealizeWindow);
- WRAP(UnrealizeWindow);
- WRAP(PositionWindow);
- WRAP(ChangeWindowAttributes);
- WRAP(ReparentWindow);
- WRAP(RestackWindow);
- WRAP(ResizeWindow);
- WRAP(MoveWindow);
- WRAP(CopyWindow);
- WRAP(SetShape);
-
- /* Assign multi-window window procedures to be top level procedures */
- pScreen->CreateWindow = winCreateWindowMultiWindow;
- pScreen->DestroyWindow = winDestroyWindowMultiWindow;
- pScreen->PositionWindow = winPositionWindowMultiWindow;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow; */
- pScreen->RealizeWindow = winMapWindowMultiWindow;
- pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
- pScreen->ReparentWindow = winReparentWindowMultiWindow;
- pScreen->RestackWindow = winRestackWindowMultiWindow;
- pScreen->ResizeWindow = winResizeWindowMultiWindow;
- pScreen->MoveWindow = winMoveWindowMultiWindow;
- pScreen->CopyWindow = winCopyWindowMultiWindow;
- pScreen->SetShape = winSetShapeMultiWindow;
-
- /* Undefine the WRAP macro, as it is not needed elsewhere */
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(ReparentWindow);
+ WRAP(RestackWindow);
+ WRAP(ResizeWindow);
+ WRAP(MoveWindow);
+ WRAP(CopyWindow);
+ WRAP(SetShape);
+
+ /* Assign multi-window window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowMultiWindow;
+ pScreen->DestroyWindow = winDestroyWindowMultiWindow;
+ pScreen->PositionWindow = winPositionWindowMultiWindow;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/
+ pScreen->RealizeWindow = winMapWindowMultiWindow;
+ pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
+ pScreen->ReparentWindow = winReparentWindowMultiWindow;
+ pScreen->RestackWindow = winRestackWindowMultiWindow;
+ pScreen->ResizeWindow = winResizeWindowMultiWindow;
+ pScreen->MoveWindow = winMoveWindowMultiWindow;
+ pScreen->CopyWindow = winCopyWindowMultiWindow;
+ pScreen->SetShape = winSetShapeMultiWindow;
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
#undef WRAP
}
#endif
- /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+ /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Create a mutex for modules in separate threads to wait for */
- iReturn = pthread_mutex_init(&pScreenPriv->pmServerStarted, NULL);
+ /* Create a mutex for modules in separate threads to wait for */
+ iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL);
if (iReturn != 0) {
- ErrorF("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
- iReturn);
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
+ iReturn);
+ return FALSE;
}
- /* Own the mutex for modules in separate threads */
- iReturn = pthread_mutex_lock(&pScreenPriv->pmServerStarted);
+ /* Own the mutex for modules in separate threads */
+ iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted);
if (iReturn != 0) {
- ErrorF("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
- iReturn);
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
+ iReturn);
+ return FALSE;
}
- /* Set the ServerStarted flag to false */
- pScreenPriv->fServerStarted = FALSE;
+ /* Set the ServerStarted flag to false */
+ pScreenPriv->fServerStarted = FALSE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fRestacking = FALSE;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (FALSE
+ if (FALSE
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fInternalWM
+ || pScreenInfo->fInternalWM
#endif
) {
#if CYGDEBUG || YES
- winDebug("winFinishScreenInitFB - Calling winInitWM.\n");
+ winDebug ("winFinishScreenInitFB - Calling winInitWM.\n");
#endif
- /* Initialize multi window mode */
- if (!winInitWM(&pScreenPriv->pWMInfo,
- &pScreenPriv->ptWMProc,
- &pScreenPriv->ptXMsgProc,
- &pScreenPriv->pmServerStarted,
+ /* Initialize multi window mode */
+ if (!winInitWM (&pScreenPriv->pWMInfo,
+ &pScreenPriv->ptWMProc,
+ &pScreenPriv->ptXMsgProc,
+ &pScreenPriv->pmServerStarted,
pScreenInfo->dwScreen, (HWND) & pScreenPriv->hwndScreen,
#ifdef XWIN_MULTIWINDOWEXTWM
- pScreenInfo->fInternalWM ||
+ pScreenInfo->fInternalWM ||
#endif
FALSE)) {
- ErrorF("winFinishScreenInitFB - winInitWM () failed.\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
+ return FALSE;
}
- }
+ }
#endif
- /* Tell the server that we are enabled */
- pScreenPriv->fEnabled = TRUE;
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
- /* Tell the server that we have a valid depth */
- pScreenPriv->fBadDepth = FALSE;
+ /* Tell the server that we have a valid depth */
+ pScreenPriv->fBadDepth = FALSE;
#if CYGDEBUG || YES
- winDebug("winFinishScreenInitFB - returning\n");
+ winDebug ("winFinishScreenInitFB - returning\n");
#endif
- return TRUE;
+ return TRUE;
}
#ifdef XWIN_NATIVEGDI
/* See Porting Layer Definition - p. 20 */
Bool
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI (int index,
ScreenPtr pScreen, int argc, char **argv)
{
- winScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
- VisualPtr pVisuals = NULL;
- DepthPtr pDepths = NULL;
- VisualID rootVisual = 0;
- int nVisuals = 0, nDepths = 0, nRootDepth = 0;
-
- /* Ignore user input (mouse, keyboard) */
- pScreenInfo->fIgnoreInput = FALSE;
-
- /* Get device contexts for the screen and shadow bitmap */
- pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
- if (pScreenPriv->hdcScreen == NULL)
- FatalError("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
-
- /* Init visuals */
+ winScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ VisualPtr pVisuals = NULL;
+ DepthPtr pDepths = NULL;
+ VisualID rootVisual = 0;
+ int nVisuals = 0, nDepths = 0, nRootDepth = 0;
+
+ /* Ignore user input (mouse, keyboard) */
+ pScreenInfo->fIgnoreInput = FALSE;
+
+ /* Get device contexts for the screen and shadow bitmap */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+ if (pScreenPriv->hdcScreen == NULL)
+ FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
+
+ /* Init visuals */
if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) {
- ErrorF("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
+ return FALSE;
}
- /* Initialize the mi visuals */
- if (!miInitVisuals(&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
- &rootVisual,
- ((unsigned long) 1 << (pScreenInfo->dwDepth - 1)), 8,
+ /* Initialize the mi visuals */
+ if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
+ &rootVisual,
+ ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8,
TrueColor)) {
- ErrorF("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
+ return FALSE;
}
- /* Initialize the CloseScreen procedure pointer */
- pScreen->CloseScreen = NULL;
+ /* Initialize the CloseScreen procedure pointer */
+ pScreen->CloseScreen = NULL;
- /* Initialize the mi code */
+ /* Initialize the mi code */
if (!miScreenInit(pScreen, NULL, /* No framebuffer */
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- nRootDepth, nDepths, pDepths, rootVisual,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ nRootDepth, nDepths, pDepths, rootVisual,
nVisuals, pVisuals)) {
- ErrorF("winFinishScreenInitNativeGDI - miScreenInit failed\n");
- return FALSE;
- }
-
- pScreen->defColormap = FakeClientID(0);
-
- /*
- * Register our block and wakeup handlers; these procedures
- * process messages in our Windows message queue; specifically,
- * they process mouse and keyboard input.
- */
- pScreen->BlockHandler = winBlockHandler;
- pScreen->WakeupHandler = winWakeupHandler;
- pScreen->blockData = pScreen;
- pScreen->wakeupData = pScreen;
-
- /* Place our save screen function */
- pScreen->SaveScreen = winSaveScreen;
-
- /* Pixmaps */
- pScreen->CreatePixmap = winCreatePixmapNativeGDI;
- pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
-
- /* Other Screen Routines */
- pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
- pScreen->SaveScreen = winSaveScreen;
- pScreen->GetImage = miGetImage;
- pScreen->GetSpans = winGetSpansNativeGDI;
-
- /* Window Procedures */
- pScreen->CreateWindow = winCreateWindowNativeGDI;
- pScreen->DestroyWindow = winDestroyWindowNativeGDI;
- pScreen->PositionWindow = winPositionWindowNativeGDI;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; */
- pScreen->RealizeWindow = winMapWindowNativeGDI;
- pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
-
- /* Paint window */
- pScreen->CopyWindow = winCopyWindowNativeGDI;
-
- /* Fonts */
- pScreen->RealizeFont = winRealizeFontNativeGDI;
- pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
-
- /* GC */
- pScreen->CreateGC = winCreateGCNativeGDI;
-
- /* Colormap Routines */
- pScreen->CreateColormap = miInitializeColormap;
+ ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n");
+ return FALSE;
+ }
+
+ pScreen->defColormap = FakeClientID(0);
+
+ /*
+ * Register our block and wakeup handlers; these procedures
+ * process messages in our Windows message queue; specifically,
+ * they process mouse and keyboard input.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Pixmaps */
+ pScreen->CreatePixmap = winCreatePixmapNativeGDI;
+ pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
+
+ /* Other Screen Routines */
+ pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
+ pScreen->SaveScreen = winSaveScreen;
+ pScreen->GetImage = miGetImage;
+ pScreen->GetSpans = winGetSpansNativeGDI;
+
+ /* Window Procedures */
+ pScreen->CreateWindow = winCreateWindowNativeGDI;
+ pScreen->DestroyWindow = winDestroyWindowNativeGDI;
+ pScreen->PositionWindow = winPositionWindowNativeGDI;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/
+ pScreen->RealizeWindow = winMapWindowNativeGDI;
+ pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
+
+ /* Paint window */
+ pScreen->CopyWindow = winCopyWindowNativeGDI;
+
+ /* Fonts */
+ pScreen->RealizeFont = winRealizeFontNativeGDI;
+ pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
+
+ /* GC */
+ pScreen->CreateGC = winCreateGCNativeGDI;
+
+ /* Colormap Routines */
+ pScreen->CreateColormap = miInitializeColormap;
pScreen->DestroyColormap =
(DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
- pScreen->InstallColormap = miInstallColormap;
- pScreen->UninstallColormap = miUninstallColormap;
- pScreen->ListInstalledColormaps = miListInstalledColormaps;
- pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
- pScreen->ResolveColor = miResolveColor;
+ pScreen->InstallColormap = miInstallColormap;
+ pScreen->UninstallColormap = miUninstallColormap;
+ pScreen->ListInstalledColormaps = miListInstalledColormaps;
+ pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->ResolveColor = miResolveColor;
- /* Bitmap */
- pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
+ /* Bitmap */
+ pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
- ErrorF("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
+ ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
- /* Set the default white and black pixel positions */
- pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
+ /* Set the default white and black pixel positions */
+ pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
- /* Initialize the cursor */
+ /* Initialize the cursor */
if (!miDCInitialize(pScreen, &g_winPointerCursorFuncs)) {
- ErrorF("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
+ return FALSE;
}
-
- /* Create a default colormap */
+
+ /* Create a default colormap */
if (!miCreateDefColormap(pScreen)) {
- ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
- "failed\n");
- return FALSE;
+ ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "failed\n");
+ return FALSE;
}
- ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
- "returned\n");
-
- /* mi doesn't use a CloseScreen procedure, so no need to wrap */
- pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+ ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "returned\n");
+
+ /* mi doesn't use a CloseScreen procedure, so no need to wrap */
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
- /* Tell the server that we are enabled */
- pScreenPriv->fEnabled = TRUE;
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
- ErrorF("winFinishScreenInitNativeGDI - Successful addition of "
+ ErrorF ("winFinishScreenInitNativeGDI - Successful addition of "
"screen %08x\n", (unsigned int) pScreen);
- return TRUE;
+ return TRUE;
}
#endif
/* See Porting Layer Definition - p. 33 */
static Bool
-winSaveScreen(ScreenPtr pScreen, int on)
+winSaveScreen (ScreenPtr pScreen, int on)
{
- return TRUE;
+ return TRUE;
}
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 6e71dd24c..f748c4d1d 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -43,7 +43,7 @@
#ifdef DEFINE_GUID
#undef DEFINE_GUID
#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#endif /* DEFINE_GUID */
+#endif /* DEFINE_GUID */
/*
* FIXME: Headers are broken, IID_IDirectDraw4 has to be defined
@@ -52,7 +52,7 @@
#ifndef IID_IDirectDraw4
DEFINE_GUID(IID_IDirectDraw4, 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00,
0xc0, 0x4f, 0xd9, 0x30, 0xc5);
-#endif /* IID_IDirectDraw4 */
+#endif /* IID_IDirectDraw4 */
#define FAIL_MSG_MAX_BLT 10
@@ -61,49 +61,49 @@ DEFINE_GUID(IID_IDirectDraw4, 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00,
*/
static Bool
- winAllocateFBShadowDDNL(ScreenPtr pScreen);
+winAllocateFBShadowDDNL (ScreenPtr pScreen);
static void
winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf);
static Bool
- winCloseScreenShadowDDNL(int nIndex, ScreenPtr pScreen);
+winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen);
static Bool
- winInitVisualsShadowDDNL(ScreenPtr pScreen);
+winInitVisualsShadowDDNL (ScreenPtr pScreen);
static Bool
- winAdjustVideoModeShadowDDNL(ScreenPtr pScreen);
+winAdjustVideoModeShadowDDNL (ScreenPtr pScreen);
static Bool
- winBltExposedRegionsShadowDDNL(ScreenPtr pScreen);
+winBltExposedRegionsShadowDDNL (ScreenPtr pScreen);
static Bool
- winActivateAppShadowDDNL(ScreenPtr pScreen);
+winActivateAppShadowDDNL (ScreenPtr pScreen);
static Bool
- winRedrawScreenShadowDDNL(ScreenPtr pScreen);
+winRedrawScreenShadowDDNL (ScreenPtr pScreen);
static Bool
- winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen);
+winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen);
static Bool
- winInstallColormapShadowDDNL(ColormapPtr pColormap);
+winInstallColormapShadowDDNL (ColormapPtr pColormap);
static Bool
winStoreColorsShadowDDNL(ColormapPtr pmap, int ndef, xColorItem * pdefs);
static Bool
- winCreateColormapShadowDDNL(ColormapPtr pColormap);
+winCreateColormapShadowDDNL (ColormapPtr pColormap);
static Bool
- winDestroyColormapShadowDDNL(ColormapPtr pColormap);
+winDestroyColormapShadowDDNL (ColormapPtr pColormap);
static Bool
- winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen);
+winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
static Bool
- winReleasePrimarySurfaceShadowDDNL(ScreenPtr pScreen);
+winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
/*
* Create the primary surface and attach the clipper.
@@ -112,59 +112,59 @@ static Bool
*/
static Bool
-winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen)
+winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC2 ddsd;
-
- winDebug("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
-
- /* Describe the primary surface */
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- /* Create the primary surface */
- ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
- &ddsd,
+ winScreenPriv(pScreen);
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsd;
+
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
+
+ /* Describe the primary surface */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
+ &ddsd,
&pScreenPriv->pddsPrimary4, NULL);
- pScreenPriv->fRetryCreateSurface = FALSE;
+ pScreenPriv->fRetryCreateSurface = FALSE;
if (FAILED(ddrval)) {
if (ddrval == DDERR_NOEXCLUSIVEMODE) {
- /* Recreating the surface failed. Mark screen to retry later */
- pScreenPriv->fRetryCreateSurface = TRUE;
- winDebug("winCreatePrimarySurfaceShadowDDNL - Could not create "
- "primary surface: DDERR_NOEXCLUSIVEMODE\n");
+ /* Recreating the surface failed. Mark screen to retry later */
+ pScreenPriv->fRetryCreateSurface = TRUE;
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create "
+ "primary surface: DDERR_NOEXCLUSIVEMODE\n");
}
else {
- ErrorF("winCreatePrimarySurfaceShadowDDNL - Could not create "
- "primary surface: %08x\n", (unsigned int) ddrval);
+ ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create "
+ "primary surface: %08x\n", (unsigned int) ddrval);
}
- return FALSE;
+ return FALSE;
}
-
+
#if 1
- winDebug("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
#endif
- /* Attach our clipper to our primary surface handle */
- ddrval = IDirectDrawSurface4_SetClipper(pScreenPriv->pddsPrimary4,
- pScreenPriv->pddcPrimary);
+ /* Attach our clipper to our primary surface handle */
+ ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
+ pScreenPriv->pddcPrimary);
if (FAILED(ddrval)) {
- ErrorF("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper "
+ ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper "
"failed: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ return FALSE;
}
#if 1
- winDebug("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
- "surface\n");
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
+ "surface\n");
#endif
- /* Everything was correct */
- return TRUE;
+ /* Everything was correct */
+ return TRUE;
}
/*
@@ -173,30 +173,30 @@ winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winReleasePrimarySurfaceShadowDDNL(ScreenPtr pScreen)
+winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
- winDebug("winReleasePrimarySurfaceShadowDDNL - Hello\n");
+ winDebug ("winReleasePrimarySurfaceShadowDDNL - Hello\n");
- /* Release the primary surface and clipper, if they exist */
+ /* Release the primary surface and clipper, if they exist */
if (pScreenPriv->pddsPrimary4) {
- /*
- * Detach the clipper from the primary surface.
- * NOTE: We do this explicity for clarity. The Clipper is not released.
- */
+ /*
+ * Detach the clipper from the primary surface.
+ * NOTE: We do this explicity for clarity. The Clipper is not released.
+ */
IDirectDrawSurface4_SetClipper(pScreenPriv->pddsPrimary4, NULL);
+
+ winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
- winDebug("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
-
- /* Release the primary surface */
- IDirectDrawSurface4_Release(pScreenPriv->pddsPrimary4);
- pScreenPriv->pddsPrimary4 = NULL;
+ /* Release the primary surface */
+ IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
+ pScreenPriv->pddsPrimary4 = NULL;
}
- winDebug("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
-
- return TRUE;
+ winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
+
+ return TRUE;
}
/*
@@ -208,322 +208,322 @@ winReleasePrimarySurfaceShadowDDNL(ScreenPtr pScreen)
*/
Bool
-winAllocateFBShadowDDNL(ScreenPtr pScreen)
+winAllocateFBShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC2 ddsdShadow;
- char *lpSurface = NULL;
- DDPIXELFORMAT ddpfPrimary;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsdShadow;
+ char *lpSurface = NULL;
+ DDPIXELFORMAT ddpfPrimary;
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - w %d h %d d %d\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
+ winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
#endif
- /* Set the padded screen width */
- pScreenInfo->dwPaddedWidth = PixmapBytePad(pScreenInfo->dwWidth,
- pScreenInfo->dwBPP);
+ /* Set the padded screen width */
+ pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
+ pScreenInfo->dwBPP);
- /* Allocate memory for our shadow surface */
- lpSurface = malloc(pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
+ /* Allocate memory for our shadow surface */
+ lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
if (lpSurface == NULL) {
- ErrorF("winAllocateFBShadowDDNL - Could not allocate bits\n");
- return FALSE;
+ ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n");
+ return FALSE;
}
- /*
- * Initialize the framebuffer memory so we don't get a
- * strange display at startup
- */
- ZeroMemory(lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
-
- /* Create a clipper */
- ddrval = (*g_fpDirectDrawCreateClipper) (0,
+ /*
+ * Initialize the framebuffer memory so we don't get a
+ * strange display at startup
+ */
+ ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
+
+ /* Create a clipper */
+ ddrval = (*g_fpDirectDrawCreateClipper) (0,
&pScreenPriv->pddcPrimary, NULL);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - Created a clipper\n");
+ winDebug ("winAllocateFBShadowDDNL - Created a clipper\n");
#endif
- /* Attach the clipper to our display window */
- ddrval = IDirectDrawClipper_SetHWnd(pScreenPriv->pddcPrimary,
+ /* Attach the clipper to our display window */
+ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
0, pScreenPriv->hwndScreen);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Clipper not attached "
+ ErrorF ("winAllocateFBShadowDDNL - Clipper not attached "
"to window: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ return FALSE;
}
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - Attached clipper to window\n");
+ winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n");
#endif
- /* Create a DirectDraw object, store the address at lpdd */
- ddrval = (*g_fpDirectDrawCreate) (NULL,
- (LPDIRECTDRAW *) & pScreenPriv->pdd,
- NULL);
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL,
+ (LPDIRECTDRAW*) &pScreenPriv->pdd,
+ NULL);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not start "
+ ErrorF ("winAllocateFBShadowDDNL - Could not start "
"DirectDraw: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ return FALSE;
}
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - Created and initialized DD\n");
+ winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n");
#endif
- /* Get a DirectDraw4 interface pointer */
- ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
- &IID_IDirectDraw4,
- (LPVOID *) & pScreenPriv->pdd4);
+ /* Get a DirectDraw4 interface pointer */
+ ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
+ &IID_IDirectDraw4,
+ (LPVOID*) &pScreenPriv->pdd4);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
- /* Are we full screen? */
+ /* Are we full screen? */
if (pScreenInfo->fFullScreen) {
- DDSURFACEDESC2 ddsdCurrent;
- DWORD dwRefreshRateCurrent = 0;
- HDC hdc = NULL;
-
- /* Set the cooperative level to full screen */
- ddrval = IDirectDraw4_SetCooperativeLevel(pScreenPriv->pdd4,
- pScreenPriv->hwndScreen,
- DDSCL_EXCLUSIVE
- | DDSCL_FULLSCREEN);
+ DDSURFACEDESC2 ddsdCurrent;
+ DWORD dwRefreshRateCurrent = 0;
+ HDC hdc = NULL;
+
+ /* Set the cooperative level to full screen */
+ ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
+ pScreenPriv->hwndScreen,
+ DDSCL_EXCLUSIVE
+ | DDSCL_FULLSCREEN);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not set "
+ ErrorF ("winAllocateFBShadowDDNL - Could not set "
"cooperative level: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
+ return FALSE;
+ }
- /*
- * We only need to get the current refresh rate for comparison
- * if a refresh rate has been passed on the command line.
- */
+ /*
+ * We only need to get the current refresh rate for comparison
+ * if a refresh rate has been passed on the command line.
+ */
if (pScreenInfo->dwRefreshRate != 0) {
- ZeroMemory(&ddsdCurrent, sizeof(ddsdCurrent));
- ddsdCurrent.dwSize = sizeof(ddsdCurrent);
+ ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent));
+ ddsdCurrent.dwSize = sizeof (ddsdCurrent);
- /* Get information about current display settings */
- ddrval = IDirectDraw4_GetDisplayMode(pScreenPriv->pdd4,
- &ddsdCurrent);
+ /* Get information about current display settings */
+ ddrval = IDirectDraw4_GetDisplayMode (pScreenPriv->pdd4,
+ &ddsdCurrent);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not get current "
- "refresh rate: %08x. Continuing.\n",
- (unsigned int) ddrval);
- dwRefreshRateCurrent = 0;
- }
+ ErrorF ("winAllocateFBShadowDDNL - Could not get current "
+ "refresh rate: %08x. Continuing.\n",
+ (unsigned int) ddrval);
+ dwRefreshRateCurrent = 0;
+ }
else {
- /* Grab the current refresh rate */
- dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
- }
- }
+ /* Grab the current refresh rate */
+ dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
+ }
+ }
- /* Clean up the refresh rate */
+ /* Clean up the refresh rate */
if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) {
- /*
- * Refresh rate is non-specified or equal to current.
- */
- pScreenInfo->dwRefreshRate = 0;
- }
-
- /* Grab a device context for the screen */
- hdc = GetDC(NULL);
+ /*
+ * Refresh rate is non-specified or equal to current.
+ */
+ pScreenInfo->dwRefreshRate = 0;
+ }
+
+ /* Grab a device context for the screen */
+ hdc = GetDC (NULL);
if (hdc == NULL) {
- ErrorF("winAllocateFBShadowDDNL - GetDC () failed\n");
- return FALSE;
- }
-
- /* Only change the video mode when different than current mode */
- if (!pScreenInfo->fMultipleMonitors
- && (pScreenInfo->dwWidth != GetSystemMetrics(SM_CXSCREEN)
- || pScreenInfo->dwHeight != GetSystemMetrics(SM_CYSCREEN)
- || pScreenInfo->dwBPP != GetDeviceCaps(hdc, BITSPIXEL)
+ ErrorF ("winAllocateFBShadowDDNL - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Only change the video mode when different than current mode */
+ if (!pScreenInfo->fMultipleMonitors
+ && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN)
+ || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN)
+ || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL)
|| pScreenInfo->dwRefreshRate != 0)) {
- winDebug("winAllocateFBShadowDDNL - Changing video mode\n");
+ winDebug ("winAllocateFBShadowDDNL - Changing video mode\n");
- /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
- ddrval = IDirectDraw4_SetDisplayMode(pScreenPriv->pdd4,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
+ /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
+ ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
pScreenInfo->dwRefreshRate, 0);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not set "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
+ ErrorF ("winAllocateFBShadowDDNL - Could not set "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
ErrorF
("winAllocateFBShadowDDNL - Using default driver refresh rate\n");
ddrval =
IDirectDraw4_SetDisplayMode(pScreenPriv->pdd4,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
pScreenInfo->dwBPP, 0, 0);
if (FAILED(ddrval)) {
ErrorF
("winAllocateFBShadowDDNL - Could not set default refresh rate "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
- }
- }
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+ }
else {
- winDebug("winAllocateFBShadowDDNL - Not changing video mode\n");
- }
+ winDebug ("winAllocateFBShadowDDNL - Not changing video mode\n");
+ }
- /* Release our DC */
- ReleaseDC(NULL, hdc);
- hdc = NULL;
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
}
else {
- /* Set the cooperative level for windowed mode */
- ddrval = IDirectDraw4_SetCooperativeLevel(pScreenPriv->pdd4,
- pScreenPriv->hwndScreen,
- DDSCL_NORMAL);
+ /* Set the cooperative level for windowed mode */
+ ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not set "
+ ErrorF ("winAllocateFBShadowDDNL - Could not set "
"cooperative level: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
+ return FALSE;
+ }
}
- /* Create the primary surface */
+ /* Create the primary surface */
if (!winCreatePrimarySurfaceShadowDDNL(pScreen)) {
- ErrorF("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL "
- "failed\n");
- return FALSE;
+ ErrorF ("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL "
+ "failed\n");
+ return FALSE;
}
- /* Get primary surface's pixel format */
- ZeroMemory(&ddpfPrimary, sizeof(ddpfPrimary));
- ddpfPrimary.dwSize = sizeof(ddpfPrimary);
- ddrval = IDirectDrawSurface4_GetPixelFormat(pScreenPriv->pddsPrimary4,
- &ddpfPrimary);
+ /* Get primary surface's pixel format */
+ ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary));
+ ddpfPrimary.dwSize = sizeof (ddpfPrimary);
+ ddrval = IDirectDrawSurface4_GetPixelFormat (pScreenPriv->pddsPrimary4,
+ &ddpfPrimary);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not get primary "
+ ErrorF ("winAllocateFBShadowDDNL - Could not get primary "
"pixformat: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ return FALSE;
}
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
- "dwRGBBitCount: %d\n",
- ddpfPrimary.u2.dwRBitMask,
- ddpfPrimary.u3.dwGBitMask,
+ winDebug ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
+ "dwRGBBitCount: %d\n",
+ ddpfPrimary.u2.dwRBitMask,
+ ddpfPrimary.u3.dwGBitMask,
ddpfPrimary.u4.dwBBitMask, ddpfPrimary.u1.dwRGBBitCount);
#endif
- /* Describe the shadow surface to be created */
- /*
- * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
- * as drawing, locking, and unlocking take forever
- * with video memory surfaces. In addition,
- * video memory is a somewhat scarce resource,
- * so you shouldn't be allocating video memory when
- * you have the option of using system memory instead.
- */
- ZeroMemory(&ddsdShadow, sizeof(ddsdShadow));
- ddsdShadow.dwSize = sizeof(ddsdShadow);
- ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH
- | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT;
- ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
- ddsdShadow.dwHeight = pScreenInfo->dwHeight;
- ddsdShadow.dwWidth = pScreenInfo->dwWidth;
- ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth;
- ddsdShadow.lpSurface = lpSurface;
- ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary;
-
- winDebug("winAllocateFBShadowDDNL - lPitch: %d\n",
- (int) pScreenInfo->dwPaddedWidth);
-
- /* Create the shadow surface */
- ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
- &ddsdShadow,
+ /* Describe the shadow surface to be created */
+ /*
+ * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory (&ddsdShadow, sizeof (ddsdShadow));
+ ddsdShadow.dwSize = sizeof (ddsdShadow);
+ ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH
+ | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT;
+ ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsdShadow.dwHeight = pScreenInfo->dwHeight;
+ ddsdShadow.dwWidth = pScreenInfo->dwWidth;
+ ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth;
+ ddsdShadow.lpSurface = lpSurface;
+ ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary;
+
+ winDebug ("winAllocateFBShadowDDNL - lPitch: %d\n",
+ (int) pScreenInfo->dwPaddedWidth);
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
+ &ddsdShadow,
&pScreenPriv->pddsShadow4, NULL);
if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDDNL - Could not create shadow "
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ ErrorF ("winAllocateFBShadowDDNL - Could not create shadow "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
-
+
#if CYGDEBUG || YES
- winDebug("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
- (int) ddsdShadow.u1.lPitch);
+ winDebug ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
+ (int) ddsdShadow.u1.lPitch);
#endif
- /* Grab the pitch from the surface desc */
- pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8)
- / pScreenInfo->dwBPP;
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
#if CYGDEBUG || YES
- winDebug("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
- (int) pScreenInfo->dwStride);
+ winDebug ("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
+ (int) pScreenInfo->dwStride);
#endif
- /* Save the pointer to our surface memory */
- pScreenInfo->pfb = lpSurface;
-
- /* Grab the masks from the surface description */
- pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask;
- pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask;
- pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask;
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = lpSurface;
+
+ /* Grab the masks from the surface description */
+ pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask;
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - Returning\n");
+ winDebug ("winAllocateFBShadowDDNL - Returning\n");
#endif
- return TRUE;
+ return TRUE;
}
static void
winFreeFBShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- /* Free the shadow surface, if there is one */
+ /* Free the shadow surface, if there is one */
if (pScreenPriv->pddsShadow4) {
- IDirectDrawSurface4_Release(pScreenPriv->pddsShadow4);
- free(pScreenInfo->pfb);
- pScreenInfo->pfb = NULL;
- pScreenPriv->pddsShadow4 = NULL;
+ IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
+ free (pScreenInfo->pfb);
+ pScreenInfo->pfb = NULL;
+ pScreenPriv->pddsShadow4 = NULL;
}
- /* Detach the clipper from the primary surface and release the primary surface, if there is one */
- winReleasePrimarySurfaceShadowDDNL(pScreen);
+ /* Detach the clipper from the primary surface and release the primary surface, if there is one */
+ winReleasePrimarySurfaceShadowDDNL(pScreen);
- /* Release the clipper object */
+ /* Release the clipper object */
if (pScreenPriv->pddcPrimary) {
- IDirectDrawClipper_Release(pScreenPriv->pddcPrimary);
- pScreenPriv->pddcPrimary = NULL;
+ IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
+ pScreenPriv->pddcPrimary = NULL;
}
- /* Free the DirectDraw4 object, if there is one */
+ /* Free the DirectDraw4 object, if there is one */
if (pScreenPriv->pdd4) {
- IDirectDraw4_RestoreDisplayMode(pScreenPriv->pdd4);
- IDirectDraw4_Release(pScreenPriv->pdd4);
- pScreenPriv->pdd4 = NULL;
+ IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4);
+ IDirectDraw4_Release (pScreenPriv->pdd4);
+ pScreenPriv->pdd4 = NULL;
}
- /* Free the DirectDraw object, if there is one */
+ /* Free the DirectDraw object, if there is one */
if (pScreenPriv->pdd) {
- IDirectDraw_Release(pScreenPriv->pdd);
- pScreenPriv->pdd = NULL;
+ IDirectDraw_Release (pScreenPriv->pdd);
+ pScreenPriv->pdd = NULL;
}
- /* Invalidate the ScreenInfo's fb pointer */
- pScreenInfo->pfb = NULL;
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
}
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
@@ -532,41 +532,41 @@ winFreeFBShadowDDNL(ScreenPtr pScreen)
*/
static
- Bool
-winFinishCreateWindowsWindowDDNL(WindowPtr pWin)
+Bool
+winFinishCreateWindowsWindowDDNL (WindowPtr pWin)
{
- winWindowPriv(pWin);
- winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC2 ddsd;
- int iWidth, iHeight;
- int iX, iY;
-
- winDebug("winFinishCreateWindowsWindowDDNL!\n\n");
-
- iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
-
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
-
- /* Describe the primary surface */
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- ddsd.dwHeight = iHeight;
- ddsd.dwWidth = iWidth;
-
- /* Create the primary surface */
- ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
+ winWindowPriv(pWin);
+ winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsd;
+ int iWidth, iHeight;
+ int iX, iY;
+
+ winDebug ("winFinishCreateWindowsWindowDDNL!\n\n");
+
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Describe the primary surface */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+ ddsd.dwHeight = iHeight;
+ ddsd.dwWidth = iWidth;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
&ddsd, &pWinPriv->pddsPrimary4, NULL);
if (FAILED(ddrval)) {
- ErrorF("winFinishCreateWindowsWindowDDNL - Could not create primary "
+ ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary "
"surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
#endif
@@ -577,139 +577,131 @@ winFinishCreateWindowsWindowDDNL(WindowPtr pWin)
static void
winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = shadowDamage(pBuf);
- HRESULT ddrval = DD_OK;
- RECT rcDest, rcSrc;
- POINT ptOrigin;
- DWORD dwBox = RegionNumRects(damage);
- BoxPtr pBox = RegionRects(damage);
- HRGN hrgnTemp = NULL, hrgnCombined = NULL;
-
- /*
- * Return immediately if the app is not active
- * and we are fullscreen, or if we have a bad display depth
- */
- if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = shadowDamage(pBuf);
+ HRESULT ddrval = DD_OK;
+ RECT rcDest, rcSrc;
+ POINT ptOrigin;
+ DWORD dwBox = RegionNumRects (damage);
+ BoxPtr pBox = RegionRects (damage);
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
|| pScreenPriv->fBadDepth)
return;
- /* Return immediately if we didn't get needed surfaces */
- if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
- return;
+ /* Return immediately if we didn't get needed surfaces */
+ if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
+ return;
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints(pScreenPriv->hwndScreen,
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints (pScreenPriv->hwndScreen,
HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
- /*
- * Handle small regions with multiple blits,
- * handle large regions by creating a clipping region and
- * doing a single blit constrained to that clipping region.
- */
- if (pScreenInfo->dwClipUpdatesNBoxes == 0
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (pScreenInfo->dwClipUpdatesNBoxes == 0
|| dwBox < pScreenInfo->dwClipUpdatesNBoxes) {
- /* Loop through all boxes in the damaged region */
+ /* Loop through all boxes in the damaged region */
while (dwBox--) {
- /* Assign damage box to source rectangle */
- rcSrc.left = pBox->x1;
- rcSrc.top = pBox->y1;
- rcSrc.right = pBox->x2;
- rcSrc.bottom = pBox->y2;
-
- /* Calculate destination rectangle */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Blit the damaged areas */
- ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4,
- &rcDest,
- pScreenPriv->pddsShadow4,
+ /* Assign damage box to source rectangle */
+ rcSrc.left = pBox->x1;
+ rcSrc.top = pBox->y1;
+ rcSrc.right = pBox->x2;
+ rcSrc.bottom = pBox->y2;
+
+ /* Calculate destination rectangle */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Blit the damaged areas */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
&rcSrc, DDBLT_WAIT, NULL);
if (FAILED(ddrval)) {
- static int s_iFailCount = 0;
-
+ static int s_iFailCount = 0;
+
if (s_iFailCount < FAIL_MSG_MAX_BLT) {
- ErrorF("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () "
+ ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () "
"failed: %08x\n", (unsigned int) ddrval);
-
- ++s_iFailCount;
+
+ ++s_iFailCount;
if (s_iFailCount == FAIL_MSG_MAX_BLT) {
- ErrorF("winShadowUpdateDDNL - IDirectDrawSurface4_Blt "
- "failure message maximum (%d) reached. No "
- "more failure messages will be printed.\n",
- FAIL_MSG_MAX_BLT);
- }
- }
- }
-
- /* Get a pointer to the next box */
- ++pBox;
- }
+ ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt "
+ "failure message maximum (%d) reached. No "
+ "more failure messages will be printed.\n",
+ FAIL_MSG_MAX_BLT);
+ }
+ }
+ }
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
}
else {
- BoxPtr pBoxExtents = RegionExtents(damage);
+ BoxPtr pBoxExtents = RegionExtents(damage);
- /* Compute a GDI region from the damaged region */
- hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- dwBox--;
- pBox++;
- while (dwBox--) {
- hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
- DeleteObject(hrgnTemp);
- pBox++;
- }
+ /* Compute a GDI region from the damaged region extent */
+ hrgnCombined = CreateRectRgn (pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, pBoxExtents->y2);
- /* Install the GDI region as a clipping region */
- SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
- DeleteObject(hrgnCombined);
- hrgnCombined = NULL;
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject (hrgnCombined);
+ hrgnCombined = NULL;
#if CYGDEBUG
- winDebug("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
- pBoxExtents->x1, pBoxExtents->y1,
- pBoxExtents->x2, pBoxExtents->y2);
+ winDebug ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
+ pBoxExtents->x1, pBoxExtents->y1,
+ pBoxExtents->x2, pBoxExtents->y2);
#endif
- /* Calculating a bounding box for the source is easy */
- rcSrc.left = pBoxExtents->x1;
- rcSrc.top = pBoxExtents->y1;
- rcSrc.right = pBoxExtents->x2;
- rcSrc.bottom = pBoxExtents->y2;
-
- /* Calculating a bounding box for the destination is trickier */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Our Blt should be clipped to the invalidated region */
- ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4,
- &rcDest,
- pScreenPriv->pddsShadow4,
+ /* Calculating a bounding box for the source is easy */
+ rcSrc.left = pBoxExtents->x1;
+ rcSrc.top = pBoxExtents->y1;
+ rcSrc.right = pBoxExtents->x2;
+ rcSrc.bottom = pBoxExtents->y2;
+
+ /* Calculating a bounding box for the destination is trickier */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
&rcSrc, DDBLT_WAIT, NULL);
- /* Reset the clip region */
- SelectClipRgn(pScreenPriv->hdcScreen, NULL);
+ /* Reset the clip region */
+ SelectClipRgn (pScreenPriv->hdcScreen, NULL);
}
}
static Bool
winInitScreenShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
- /* Get a device context for the screen */
- pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
+ /* Get a device context for the screen */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
- return winAllocateFBShadowDDNL(pScreen);
+ return winAllocateFBShadowDDNL(pScreen);
}
/*
@@ -719,61 +711,61 @@ winInitScreenShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winCloseScreenShadowDDNL(int nIndex, ScreenPtr pScreen)
+winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
#if CYGDEBUG
- winDebug("winCloseScreenShadowDDNL - Freeing screen resources\n");
+ winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n");
#endif
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
- /* Call the wrapped CloseScreen procedure */
- WIN_UNWRAP(CloseScreen);
- if (pScreen->CloseScreen)
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
- winFreeFBShadowDDNL(pScreen);
+ winFreeFBShadowDDNL(pScreen);
- /* Free the screen DC */
- ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+ /* Free the screen DC */
+ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
- /* Delete the window property */
- RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
+ /* Delete the window property */
+ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon(pScreenPriv);
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon (pScreenPriv);
- /* Free the exit confirmation dialog box, if it exists */
+ /* Free the exit confirmation dialog box, if it exists */
if (g_hDlgExit != NULL) {
- DestroyWindow(g_hDlgExit);
- g_hDlgExit = NULL;
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
}
- /* Kill our window */
+ /* Kill our window */
if (pScreenPriv->hwndScreen) {
- DestroyWindow(pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
+ DestroyWindow (pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
}
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Destroy the thread startup mutex */
- pthread_mutex_destroy(&pScreenPriv->pmServerStarted);
+ /* Destroy the thread startup mutex */
+ pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
- /* Kill our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
- /* Free the screen privates for this screen */
- free((pointer) pScreenPriv);
+ /* Free the screen privates for this screen */
+ free ((pointer) pScreenPriv);
- return fReturn;
+ return fReturn;
}
/*
@@ -785,92 +777,92 @@ winCloseScreenShadowDDNL(int nIndex, ScreenPtr pScreen)
*/
static Bool
-winInitVisualsShadowDDNL(ScreenPtr pScreen)
+winInitVisualsShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
- /* Count the number of ones in each color mask */
- dwRedBits = winCountBits(pScreenPriv->dwRedMask);
- dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
- dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
-
- /* Store the maximum number of ones in a color mask as the bitsPerRGB */
- if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
- pScreenPriv->dwBitsPerRGB = 8;
- else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwRedBits;
- else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwGreenBits;
- else
- pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
- winDebug("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
- "bpp %d\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask,
- (int) pScreenPriv->dwBitsPerRGB,
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits (pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
+ pScreenPriv->dwBitsPerRGB = 8;
+ else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
(int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP);
- /* Create a single visual according to the Windows screen depth */
+ /* Create a single visual according to the Windows screen depth */
switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
- /* Setup the real visual */
- if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- -1,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
+ /* Setup the real visual */
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ -1,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
pScreenPriv->dwBlueMask)) {
- ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
- "failed for TrueColor\n");
- return FALSE;
- }
+ ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
#ifdef XWIN_EMULATEPSEUDO
- if (!pScreenInfo->fEmulatePseudo)
- break;
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
- /* Setup a pseudocolor visual */
+ /* Setup a pseudocolor visual */
if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) {
- ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
- "failed for PseudoColor\n");
- return FALSE;
- }
+ ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
#endif
- break;
+ break;
case 8:
- if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
- pScreenInfo->fFullScreen
- ? PseudoColorMask : StaticColorMask,
- pScreenPriv->dwBitsPerRGB,
- pScreenInfo->fFullScreen
- ? PseudoColor : StaticColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenInfo->fFullScreen
+ ? PseudoColor : StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
pScreenPriv->dwBlueMask)) {
- ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
- "failed\n");
- return FALSE;
- }
- break;
+ ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+ break;
default:
- ErrorF("winInitVisualsShadowDDNL - Unknown screen depth\n");
- return FALSE;
+ ErrorF ("winInitVisualsShadowDDNL - Unknown screen depth\n");
+ return FALSE;
}
#if CYGDEBUG
- winDebug("winInitVisualsShadowDDNL - Returning\n");
+ winDebug ("winInitVisualsShadowDDNL - Returning\n");
#endif
- return TRUE;
+ return TRUE;
}
/*
@@ -878,33 +870,33 @@ winInitVisualsShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winAdjustVideoModeShadowDDNL(ScreenPtr pScreen)
+winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc = NULL;
- DWORD dwBPP;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
- /* We're in serious trouble if we can't get a DC */
- hdc = GetDC(NULL);
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC (NULL);
if (hdc == NULL) {
- ErrorF("winAdjustVideoModeShadowDDNL - GetDC () failed\n");
- return FALSE;
+ ErrorF ("winAdjustVideoModeShadowDDNL - GetDC () failed\n");
+ return FALSE;
}
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
- /* DirectDraw can only change the depth in fullscreen mode */
+ /* DirectDraw can only change the depth in fullscreen mode */
if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
- /* Otherwise, We'll use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
+ /* Otherwise, We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
}
- /* Release our DC */
- ReleaseDC(NULL, hdc);
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
- return TRUE;
+ return TRUE;
}
/*
@@ -912,110 +904,110 @@ winAdjustVideoModeShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winBltExposedRegionsShadowDDNL(ScreenPtr pScreen)
+winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
- HDC hdcUpdate;
- PAINTSTRUCT ps;
- HRESULT ddrval = DD_OK;
- Bool fReturn = TRUE;
- int i;
-
- /* Quite common case. The primary surface was lost (maybe because of depth
- * change). Try to create a new primary surface. Bail out if this fails */
- if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface &&
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ HRESULT ddrval = DD_OK;
+ Bool fReturn = TRUE;
+ int i;
+
+ /* Quite common case. The primary surface was lost (maybe because of depth
+ * change). Try to create a new primary surface. Bail out if this fails */
+ if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface &&
!winCreatePrimarySurfaceShadowDDNL(pScreen)) {
- Sleep(100);
- return FALSE;
+ Sleep(100);
+ return FALSE;
}
- if (pScreenPriv->pddsPrimary4 == NULL)
- return FALSE;
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps);
+ if (pScreenPriv->pddsPrimary4 == NULL)
+ return FALSE;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
if (hdcUpdate == NULL) {
- fReturn = FALSE;
- ErrorF("winBltExposedRegionsShadowDDNL - BeginPaint () returned "
- "a NULL device context handle. Aborting blit attempt.\n");
- goto winBltExposedRegionsShadowDDNL_Exit;
+ fReturn = FALSE;
+ ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned "
+ "a NULL device context handle. Aborting blit attempt.\n");
+ goto winBltExposedRegionsShadowDDNL_Exit;
}
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints(pScreenPriv->hwndScreen,
+ MapWindowPoints (pScreenPriv->hwndScreen,
HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be entire shadow surface, as Blt should clip for us */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Try to regain the primary surface and blit again if we've lost it */
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Try to regain the primary surface and blit again if we've lost it */
for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) {
- /* Our Blt should be clipped to the invalidated region */
- ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4,
- &rcDest,
- pScreenPriv->pddsShadow4,
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
&rcSrc, DDBLT_WAIT, NULL);
if (ddrval == DDERR_SURFACELOST) {
- /* Surface was lost */
- winErrorFVerb(1, "winBltExposedRegionsShadowDDNL - "
- "IDirectDrawSurface4_Blt reported that the primary "
+ /* Surface was lost */
+ winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
+ "IDirectDrawSurface4_Blt reported that the primary "
"surface was lost, trying to restore, retry: %d\n",
i + 1);
- /* Try to restore the surface, once */
-
- ddrval = IDirectDrawSurface4_Restore(pScreenPriv->pddsPrimary4);
- winDebug("winBltExposedRegionsShadowDDNL - "
- "IDirectDrawSurface4_Restore returned: ");
- if (ddrval == DD_OK)
- winDebug("DD_OK\n");
- else if (ddrval == DDERR_WRONGMODE)
- winDebug("DDERR_WRONGMODE\n");
- else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
- winDebug("DDERR_INCOMPATIBLEPRIMARY\n");
- else if (ddrval == DDERR_UNSUPPORTED)
- winDebug("DDERR_UNSUPPORTED\n");
- else if (ddrval == DDERR_INVALIDPARAMS)
- winDebug("DDERR_INVALIDPARAMS\n");
- else if (ddrval == DDERR_INVALIDOBJECT)
- winDebug("DDERR_INVALIDOBJECT\n");
- else
- winDebug("unknown error: %08x\n", (unsigned int) ddrval);
-
- /* Loop around to try the blit one more time */
- continue;
- }
+ /* Try to restore the surface, once */
+
+ ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
+ winDebug ("winBltExposedRegionsShadowDDNL - "
+ "IDirectDrawSurface4_Restore returned: ");
+ if (ddrval == DD_OK)
+ winDebug ("DD_OK\n");
+ else if (ddrval == DDERR_WRONGMODE)
+ winDebug ("DDERR_WRONGMODE\n");
+ else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
+ winDebug ("DDERR_INCOMPATIBLEPRIMARY\n");
+ else if (ddrval == DDERR_UNSUPPORTED)
+ winDebug ("DDERR_UNSUPPORTED\n");
+ else if (ddrval == DDERR_INVALIDPARAMS)
+ winDebug ("DDERR_INVALIDPARAMS\n");
+ else if (ddrval == DDERR_INVALIDOBJECT)
+ winDebug ("DDERR_INVALIDOBJECT\n");
+ else
+ winDebug ("unknown error: %08x\n", (unsigned int) ddrval);
+
+ /* Loop around to try the blit one more time */
+ continue;
+ }
else if (FAILED(ddrval)) {
- fReturn = FALSE;
- winErrorFVerb(1, "winBltExposedRegionsShadowDDNL - "
- "IDirectDrawSurface4_Blt failed, but surface not "
- "lost: %08x %d\n",
- (unsigned int) ddrval, (int) ddrval);
- goto winBltExposedRegionsShadowDDNL_Exit;
- }
+ fReturn = FALSE;
+ winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
+ "IDirectDrawSurface4_Blt failed, but surface not "
+ "lost: %08x %d\n",
+ (unsigned int) ddrval, (int) ddrval);
+ goto winBltExposedRegionsShadowDDNL_Exit;
+ }
else {
- /* Success, stop looping */
- break;
- }
+ /* Success, stop looping */
+ break;
+ }
}
winBltExposedRegionsShadowDDNL_Exit:
- /* EndPaint frees the DC */
- if (hdcUpdate != NULL)
- EndPaint(pScreenPriv->hwndScreen, &ps);
- return fReturn;
+ /* EndPaint frees the DC */
+ if (hdcUpdate != NULL)
+ EndPaint (pScreenPriv->hwndScreen, &ps);
+ return fReturn;
}
/*
@@ -1023,22 +1015,22 @@ winBltExposedRegionsShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winActivateAppShadowDDNL(ScreenPtr pScreen)
+winActivateAppShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
-
- /*
- * Do we have a surface?
- * Are we active?
- * Are we full screen?
- */
- if (pScreenPriv != NULL
+ winScreenPriv(pScreen);
+
+ /*
+ * Do we have a surface?
+ * Are we active?
+ * Are we full screen?
+ */
+ if (pScreenPriv != NULL
&& pScreenPriv->pddsPrimary4 != NULL && pScreenPriv->fActive) {
- /* Primary surface was lost, restore it */
- IDirectDrawSurface4_Restore(pScreenPriv->pddsPrimary4);
+ /* Primary surface was lost, restore it */
+ IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
}
- return TRUE;
+ return TRUE;
}
/*
@@ -1046,41 +1038,41 @@ winActivateAppShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winRedrawScreenShadowDDNL(ScreenPtr pScreen)
+winRedrawScreenShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints(pScreenPriv->hwndScreen,
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints (pScreenPriv->hwndScreen,
HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be entire shadow surface, as Blt should clip for us */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Redraw the whole window, to take account for the new colors */
- ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4,
- &rcDest,
- pScreenPriv->pddsShadow4,
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Redraw the whole window, to take account for the new colors */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
&rcSrc, DDBLT_WAIT, NULL);
if (FAILED(ddrval)) {
- ErrorF("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () "
+ ErrorF ("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () "
"failed: %08x\n", (unsigned int) ddrval);
}
- return TRUE;
+ return TRUE;
}
/*
@@ -1088,9 +1080,9 @@ winRedrawScreenShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen)
+winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen)
{
- return TRUE;
+ return TRUE;
}
/*
@@ -1098,27 +1090,27 @@ winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winInstallColormapShadowDDNL(ColormapPtr pColormap)
+winInstallColormapShadowDDNL (ColormapPtr pColormap)
{
- ScreenPtr pScreen = pColormap->pScreen;
+ ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
- /* Install the DirectDraw palette on the primary surface */
- ddrval = IDirectDrawSurface4_SetPalette(pScreenPriv->pddsPrimary4,
- pCmapPriv->lpDDPalette);
+ /* Install the DirectDraw palette on the primary surface */
+ ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4,
+ pCmapPriv->lpDDPalette);
if (FAILED(ddrval)) {
- ErrorF("winInstallColormapShadowDDNL - Failed installing the "
- "DirectDraw palette.\n");
- return FALSE;
+ ErrorF ("winInstallColormapShadowDDNL - Failed installing the "
+ "DirectDraw palette.\n");
+ return FALSE;
}
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
- return TRUE;
+ return TRUE;
}
/*
@@ -1128,37 +1120,37 @@ winInstallColormapShadowDDNL(ColormapPtr pColormap)
static Bool
winStoreColorsShadowDDNL(ColormapPtr pColormap, int ndef, xColorItem * pdefs)
{
- ScreenPtr pScreen = pColormap->pScreen;
-
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
- HRESULT ddrval = DD_OK;
-
- /* Put the X colormap entries into the Windows logical palette */
- ddrval = IDirectDrawPalette_SetEntries(pCmapPriv->lpDDPalette,
- 0,
- pdefs[0].pixel,
- ndef,
- pCmapPriv->peColors
- + pdefs[0].pixel);
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+ HRESULT ddrval = DD_OK;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette,
+ 0,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->peColors
+ + pdefs[0].pixel);
if (FAILED(ddrval)) {
ErrorF("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n",
(unsigned int) ddrval);
- return FALSE;
+ return FALSE;
}
- /* Don't install the DirectDraw palette if the colormap is not installed */
+ /* Don't install the DirectDraw palette if the colormap is not installed */
if (pColormap != curpmap) {
- return TRUE;
+ return TRUE;
}
if (!winInstallColormapShadowDDNL(pColormap)) {
- ErrorF("winStoreColorsShadowDDNL - Failed installing colormap\n");
- return FALSE;
+ ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
/*
@@ -1166,25 +1158,25 @@ winStoreColorsShadowDDNL(ColormapPtr pColormap, int ndef, xColorItem * pdefs)
*/
static Bool
-winCreateColormapShadowDDNL(ColormapPtr pColormap)
+winCreateColormapShadowDDNL (ColormapPtr pColormap)
{
- HRESULT ddrval = DD_OK;
- ScreenPtr pScreen = pColormap->pScreen;
-
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
-
- /* Create a DirectDraw palette */
- ddrval = IDirectDraw4_CreatePalette(pScreenPriv->pdd4,
- DDPCAPS_8BIT | DDPCAPS_ALLOW256,
- pCmapPriv->peColors,
+ HRESULT ddrval = DD_OK;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+
+ /* Create a DirectDraw palette */
+ ddrval = IDirectDraw4_CreatePalette (pScreenPriv->pdd4,
+ DDPCAPS_8BIT | DDPCAPS_ALLOW256,
+ pCmapPriv->peColors,
&pCmapPriv->lpDDPalette, NULL);
if (FAILED(ddrval)) {
- ErrorF("winCreateColormapShadowDDNL - CreatePalette failed\n");
- return FALSE;
+ ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
/*
@@ -1192,51 +1184,51 @@ winCreateColormapShadowDDNL(ColormapPtr pColormap)
*/
static Bool
-winDestroyColormapShadowDDNL(ColormapPtr pColormap)
+winDestroyColormapShadowDDNL (ColormapPtr pColormap)
{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /*
- * Is colormap to be destroyed the default?
- *
- * Non-default colormaps should have had winUninstallColormap
- * called on them before we get here. The default colormap
- * will not have had winUninstallColormap called on it. Thus,
- * we need to handle the default colormap in a special way.
- */
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
if (pColormap->flags & IsDefault) {
#if CYGDEBUG
winDebug
("winDestroyColormapShadowDDNL - Destroying default colormap\n");
#endif
-
- /*
- * FIXME: Walk the list of all screens, popping the default
- * palette out of each screen device context.
- */
-
- /* Pop the palette out of the primary surface */
- ddrval = IDirectDrawSurface4_SetPalette(pScreenPriv->pddsPrimary4,
- NULL);
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the primary surface */
+ ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4,
+ NULL);
if (FAILED(ddrval)) {
- ErrorF("winDestroyColormapShadowDDNL - Failed freeing the "
- "default colormap DirectDraw palette.\n");
- return FALSE;
- }
+ ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the "
+ "default colormap DirectDraw palette.\n");
+ return FALSE;
+ }
- /* Clear our private installed colormap pointer */
- pScreenPriv->pcmapInstalled = NULL;
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
}
-
- /* Release the palette */
- IDirectDrawPalette_Release(pCmapPriv->lpDDPalette);
-
- /* Invalidate the colormap privates */
- pCmapPriv->lpDDPalette = NULL;
-
- return TRUE;
+
+ /* Release the palette */
+ IDirectDrawPalette_Release (pCmapPriv->lpDDPalette);
+
+ /* Invalidate the colormap privates */
+ pCmapPriv->lpDDPalette = NULL;
+
+ return TRUE;
}
/*
@@ -1244,42 +1236,42 @@ winDestroyColormapShadowDDNL(ColormapPtr pColormap)
*/
Bool
-winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL;
- pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL;
- pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL;
- pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL;
- pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL;
- pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL;
- if (pScreenInfo->fFullScreen)
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL;
+ pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL;
+ pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL;
+ if (pScreenInfo->fFullScreen)
pScreenPriv->pwinCreateBoundingWindow =
winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
- pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
- pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;
- pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL;
- pScreenPriv->pwinRealizeInstalledPalette
- = winRealizeInstalledPaletteShadowDDNL;
- pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL;
- pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
- pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
- pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL;
+ pScreenPriv->pwinRealizeInstalledPalette
+ = winRealizeInstalledPaletteShadowDDNL;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
pScreenPriv->pwinHotKeyAltTab =
(winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
- pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
- pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
+ pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
+ pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
#ifdef XWIN_MULTIWINDOW
- pScreenPriv->pwinFinishCreateWindowsWindow
- = winFinishCreateWindowsWindowDDNL;
+ pScreenPriv->pwinFinishCreateWindowsWindow
+ = winFinishCreateWindowsWindowDDNL;
#endif
- return TRUE;
+ return TRUE;
}
diff --git a/hw/xwin/wintaskbar.c b/hw/xwin/wintaskbar.c
new file mode 100644
index 000000000..4c0aace25
--- /dev/null
+++ b/hw/xwin/wintaskbar.c
@@ -0,0 +1,87 @@
+/*
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include <windows.h>
+
+const GUID CLSID_TaskbarList = {0x56fdf344,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}};
+const GUID IID_ITaskbarList = {0x56fdf342,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}};
+
+#ifdef INTERFACE
+#undef INTERFACE
+#endif
+
+#define INTERFACE ITaskbarList
+DECLARE_INTERFACE_(ITaskbarList, IUnknown)
+{
+ /* IUnknown methods */
+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
+ STDMETHOD_(ULONG, AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG, Release) (THIS) PURE;
+
+ /* ITaskbarList methods */
+ STDMETHOD(HrInit) (THIS) PURE;
+ STDMETHOD(AddTab) (THIS_ HWND hWnd) PURE;
+ STDMETHOD(DeleteTab) (THIS_ HWND hWnd) PURE;
+ STDMETHOD(ActivateTab) (THIS_ HWND hWnd) PURE;
+ STDMETHOD(SetActiveAlt) (THIS_ HWND hWnd) PURE;
+};
+#undef INTERFACE
+
+/*
+ The stuff above needs to be in win32api headers, not defined here,
+ or at least generated from the MIDL :-)
+*/
+
+/*
+ This is unnecessarily heavyweight, we could just call CoInitialize() once at
+ startup and CoUninitialize() once at shutdown
+*/
+
+/*
+ The documentation for ITaskbarList::AddTab says that we are responsible for
+ deleting the tab ourselves when the window is deleted, but that doesn't actually
+ seem to be the case
+*/
+
+void wintaskbar(HWND hWnd, BOOL show)
+{
+ ITaskbarList* pTaskbarList = NULL;
+
+ if (SUCCEEDED(CoInitialize(NULL)))
+ {
+ if (SUCCEEDED(CoCreateInstance((const CLSID *)&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, (const IID *)&IID_ITaskbarList, (void**)&pTaskbarList)))
+ {
+ if (SUCCEEDED(pTaskbarList->lpVtbl->HrInit(pTaskbarList)))
+ {
+ if (show)
+ {
+ pTaskbarList->lpVtbl->AddTab(pTaskbarList,hWnd);
+ }
+ else
+ {
+ pTaskbarList->lpVtbl->DeleteTab(pTaskbarList,hWnd);
+ }
+ }
+ pTaskbarList->lpVtbl->Release(pTaskbarList);
+ }
+ CoUninitialize();
+ }
+}
diff --git a/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c
index 1d2bfedbe..c91a2ffaf 100644
--- a/hw/xwin/winwakeup.c
+++ b/hw/xwin/winwakeup.c
@@ -38,18 +38,19 @@
/* See Porting Layer Definition - p. 7 */
void
-winWakeupHandler(int nScreen,
+winWakeupHandler (int nScreen,
pointer pWakeupData, unsigned long ulResult, pointer pReadmask)
{
- MSG msg;
+ MSG msg;
- /* Process all messages on our queue */
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- if ((g_hDlgDepthChange == 0
- || !IsDialogMessage(g_hDlgDepthChange, &msg))
+ /* Process one message from our queue */
+ if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ if ((g_hDlgDepthChange == 0
+ || !IsDialogMessage (g_hDlgDepthChange, &msg))
&& (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg))
&& (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) {
- DispatchMessage(&msg);
- }
+ DispatchMessage (&msg);
+ }
}
}
diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index cef49b57c..23e5396b2 100644
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -64,13 +64,13 @@
DEFINE_ATOM_HELPER(AtmWindowsWmNativeHwnd, WINDOWSWM_NATIVE_HWND)
static void
-winMWExtWMSetNativeProperty(RootlessWindowPtr pFrame);
+winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame);
/*
* Global variables
*/
-Bool g_fNoConfigureWindow = FALSE;
+Bool g_fNoConfigureWindow = FALSE;
/*
* Internal function to get the DIB format that is compatible with the screen
@@ -82,326 +82,326 @@ Bool
winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv,
BITMAPINFOHEADER * pbmih)
{
- HBITMAP hbmp;
+ HBITMAP hbmp;
#if CYGMULTIWINDOW_DEBUG
- LPDWORD pdw = NULL;
+ LPDWORD pdw = NULL;
#endif
-
- /* Create a memory bitmap compatible with the screen */
- hbmp = CreateCompatibleBitmap(pRLWinPriv->hdcScreen, 1, 1);
+
+ /* Create a memory bitmap compatible with the screen */
+ hbmp = CreateCompatibleBitmap (pRLWinPriv->hdcScreen, 1, 1);
if (hbmp == NULL) {
- ErrorF("winMWExtWMQueryDIBFormat - CreateCompatibleBitmap failed\n");
- return FALSE;
+ ErrorF ("winMWExtWMQueryDIBFormat - CreateCompatibleBitmap failed\n");
+ return FALSE;
}
+
+ /* Initialize our bitmap info header */
+ ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
+ pbmih->biSize = sizeof (BITMAPINFOHEADER);
- /* Initialize our bitmap info header */
- ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
- pbmih->biSize = sizeof(BITMAPINFOHEADER);
-
- /* Get the biBitCount */
- if (!GetDIBits(pRLWinPriv->hdcScreen,
+ /* Get the biBitCount */
+ if (!GetDIBits (pRLWinPriv->hdcScreen,
hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) {
- ErrorF("winMWExtWMQueryDIBFormat - First call to GetDIBits failed\n");
- DeleteObject(hbmp);
- return FALSE;
+ ErrorF ("winMWExtWMQueryDIBFormat - First call to GetDIBits failed\n");
+ DeleteObject (hbmp);
+ return FALSE;
}
#if CYGMULTIWINDOW_DEBUG
- /* Get a pointer to bitfields */
- pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
+ /* Get a pointer to bitfields */
+ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
- winDebug("winMWExtWMQueryDIBFormat - First call masks: %08x %08x %08x\n",
+ winDebug ("winMWExtWMQueryDIBFormat - First call masks: %08x %08x %08x\n",
(unsigned int) pdw[0], (unsigned int) pdw[1],
(unsigned int) pdw[2]);
#endif
- /* Get optimal color table, or the optimal bitfields */
- if (!GetDIBits(pRLWinPriv->hdcScreen,
+ /* Get optimal color table, or the optimal bitfields */
+ if (!GetDIBits (pRLWinPriv->hdcScreen,
hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) {
- ErrorF("winMWExtWMQueryDIBFormat - Second call to GetDIBits "
- "failed\n");
- DeleteObject(hbmp);
- return FALSE;
+ ErrorF ("winMWExtWMQueryDIBFormat - Second call to GetDIBits "
+ "failed\n");
+ DeleteObject (hbmp);
+ return FALSE;
}
- /* Free memory */
- DeleteObject(hbmp);
-
- return TRUE;
+ /* Free memory */
+ DeleteObject (hbmp);
+
+ return TRUE;
}
static HRGN
-winMWExtWMCreateRgnFromRegion(RegionPtr pShape)
+winMWExtWMCreateRgnFromRegion (RegionPtr pShape)
{
- int nRects;
- BoxPtr pRects, pEnd;
- HRGN hRgn, hRgnRect;
+ int nRects;
+ BoxPtr pRects, pEnd;
+ HRGN hRgn, hRgnRect;
if (pShape == NULL)
return NULL;
- nRects = RegionNumRects(pShape);
- pRects = RegionRects(pShape);
-
- hRgn = CreateRectRgn(0, 0, 0, 0);
+ nRects = RegionNumRects(pShape);
+ pRects = RegionRects(pShape);
+
+ hRgn = CreateRectRgn (0, 0, 0, 0);
if (hRgn == NULL) {
- ErrorF("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
+ ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
"failed: %d\n", 0, 0, 0, 0, (int) GetLastError());
}
- /* Loop through all rectangles in the X region */
+ /* Loop through all rectangles in the X region */
for (pEnd = pRects + nRects; pRects < pEnd; pRects++) {
- /* Create a Windows region for the X rectangle */
- hRgnRect = CreateRectRgn(pRects->x1,
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn (pRects->x1,
pRects->y1, pRects->x2, pRects->y2);
if (hRgnRect == NULL) {
- ErrorF("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
- "failed: %d\n",
- pRects->x1,
+ ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n",
+ pRects->x1,
pRects->y1, pRects->x2, pRects->y2, (int) GetLastError());
- }
-
- /* Merge the Windows region with the accumulated region */
+ }
+
+ /* Merge the Windows region with the accumulated region */
if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) {
- ErrorF("winReshape - CombineRgn () failed: %d\n",
- (int) GetLastError());
- }
-
- /* Delete the temporary Windows region */
- DeleteObject(hRgnRect);
+ ErrorF ("winReshape - CombineRgn () failed: %d\n",
+ (int) GetLastError ());
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject (hRgnRect);
}
-
- return hRgn;
+
+ return hRgn;
}
static void
-InitWin32RootlessEngine(win32RootlessWindowPtr pRLWinPriv)
+InitWin32RootlessEngine (win32RootlessWindowPtr pRLWinPriv)
{
- pRLWinPriv->hdcScreen = GetDC(pRLWinPriv->hWnd);
- pRLWinPriv->hdcShadow = CreateCompatibleDC(pRLWinPriv->hdcScreen);
- pRLWinPriv->hbmpShadow = NULL;
+ pRLWinPriv->hdcScreen = GetDC (pRLWinPriv->hWnd);
+ pRLWinPriv->hdcShadow = CreateCompatibleDC (pRLWinPriv->hdcScreen);
+ pRLWinPriv->hbmpShadow = NULL;
- /* Allocate bitmap info header */
+ /* Allocate bitmap info header */
pRLWinPriv->pbmihShadow =
(BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
- + 256 * sizeof(RGBQUAD));
+ + 256 * sizeof (RGBQUAD));
if (pRLWinPriv->pbmihShadow == NULL) {
- ErrorF("InitWin32RootlessEngine - malloc () failed\n");
- return;
+ ErrorF ("InitWin32RootlessEngine - malloc () failed\n");
+ return;
}
-
- /* Query the screen format */
+
+ /* Query the screen format */
winMWExtWMQueryDIBFormat(pRLWinPriv, pRLWinPriv->pbmihShadow);
}
Bool
-winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape)
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape)
{
#define CLASS_NAME_LENGTH 512
- Bool fResult = TRUE;
- win32RootlessWindowPtr pRLWinPriv;
- WNDCLASSEX wc;
- char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
- HICON hIcon;
- HICON hIconSmall;
- char *res_name, *res_class, *res_role;
- static int s_iWindowID = 0;
-
+ Bool fResult = TRUE;
+ win32RootlessWindowPtr pRLWinPriv;
+ WNDCLASSEX wc;
+ char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
+ HICON hIcon;
+ HICON hIconSmall;
+ char *res_name, *res_class, *res_role;
+ static int s_iWindowID = 0;
+
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMCreateFrame %d %d - %d %d\n",
- newX, newY, pFrame->width, pFrame->height);
+ winDebug ("winMWExtWMCreateFrame %d %d - %d %d\n",
+ newX, newY, pFrame->width, pFrame->height);
#endif
pRLWinPriv =
(win32RootlessWindowPtr) malloc(sizeof(win32RootlessWindowRec));
- pRLWinPriv->pFrame = pFrame;
- pRLWinPriv->pfb = NULL;
- pRLWinPriv->hbmpShadow = NULL;
- pRLWinPriv->hdcShadow = NULL;
- pRLWinPriv->hdcScreen = NULL;
- pRLWinPriv->pbmihShadow = NULL;
- pRLWinPriv->fResized = TRUE;
- pRLWinPriv->fClose = FALSE;
- pRLWinPriv->fRestackingNow = FALSE;
- pRLWinPriv->fDestroyed = FALSE;
- pRLWinPriv->fMovingOrSizing = FALSE;
-
- // Store the implementation private frame ID
- pFrame->wid = (RootlessFrameID) pRLWinPriv;
-
- winSelectIcons(pFrame->win, &hIcon, &hIconSmall);
-
- /* Set standard class name prefix so we can identify window easily */
- strncpy(pszClass, WINDOW_CLASS_X, sizeof(pszClass));
+ pRLWinPriv->pFrame = pFrame;
+ pRLWinPriv->pfb = NULL;
+ pRLWinPriv->hbmpShadow = NULL;
+ pRLWinPriv->hdcShadow = NULL;
+ pRLWinPriv->hdcScreen = NULL;
+ pRLWinPriv->pbmihShadow = NULL;
+ pRLWinPriv->fResized = TRUE;
+ pRLWinPriv->fClose = FALSE;
+ pRLWinPriv->fRestackingNow = FALSE;
+ pRLWinPriv->fDestroyed = FALSE;
+ pRLWinPriv->fMovingOrSizing = FALSE;
+
+ // Store the implementation private frame ID
+ pFrame->wid = (RootlessFrameID) pRLWinPriv;
+
+ winSelectIcons(&hIcon, &hIconSmall);
+
+ /* Set standard class name prefix so we can identify window easily */
+ strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass));
if (winMultiWindowGetClassHint(pFrame->win, &res_name, &res_class)) {
- strncat(pszClass, "-", 1);
- strncat(pszClass, res_name, CLASS_NAME_LENGTH - strlen(pszClass));
- strncat(pszClass, "-", 1);
- strncat(pszClass, res_class, CLASS_NAME_LENGTH - strlen(pszClass));
-
- /* Check if a window class is provided by the WM_WINDOW_ROLE property,
- * if not use the WM_CLASS information.
- * For further information see:
- * http://tronche.com/gui/x/icccm/sec-5.html
- */
+ strncat (pszClass, "-", 1);
+ strncat (pszClass, res_name, CLASS_NAME_LENGTH - strlen (pszClass));
+ strncat (pszClass, "-", 1);
+ strncat (pszClass, res_class, CLASS_NAME_LENGTH - strlen (pszClass));
+
+ /* Check if a window class is provided by the WM_WINDOW_ROLE property,
+ * if not use the WM_CLASS information.
+ * For further information see:
+ * http://tronche.com/gui/x/icccm/sec-5.html
+ */
if (winMultiWindowGetWindowRole(pFrame->win, &res_role)) {
- strcat(pszClass, "-");
- strcat(pszClass, res_role);
- free(res_role);
- }
+ strcat (pszClass, "-");
+ strcat (pszClass, res_role);
+ free (res_role);
+ }
- free(res_name);
- free(res_class);
+ free (res_name);
+ free (res_class);
}
- /* Add incrementing window ID to make unique class name */
- snprintf(pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++);
- pszWindowID[sizeof(pszWindowID) - 1] = 0;
- strcat(pszClass, pszWindowID);
+ /* Add incrementing window ID to make unique class name */
+ snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++);
+ pszWindowID[sizeof(pszWindowID)-1] = 0;
+ strcat (pszClass, pszWindowID);
#if CYGMULTIWINDOW_DEBUG
- winDebug("winCreateWindowsWindow - Creating class: %s\n", pszClass);
+ winDebug ("winMWExtWMCreateFrame - Creating class: %s\n", pszClass);
#endif
- /* Setup our window class */
- wc.cbSize = sizeof(wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winMWExtWMWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
- wc.hIcon = hIcon;
- wc.hIconSm = hIconSmall;
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = pszClass;
- RegisterClassEx(&wc);
-
- /* Create the window */
- g_fNoConfigureWindow = TRUE;
- pRLWinPriv->hWnd = CreateWindowExA(WS_EX_TOOLWINDOW, /* Extended styles */
- pszClass, /* Class name */
- WINDOW_TITLE_X, /* Window name */
+ /* Setup our window class */
+ wc.cbSize = sizeof(wc);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winMWExtWMWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = hIcon;
+ wc.hIconSm = hIconSmall;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = pszClass;
+ RegisterClassEx (&wc);
+
+ /* Create the window */
+ g_fNoConfigureWindow = TRUE;
+ pRLWinPriv->hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */
+ pszClass, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
WS_POPUP | WS_CLIPCHILDREN, newX, /* Horizontal position */
- newY, /* Vertical position */
- pFrame->width, /* Right edge */
- pFrame->height, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle(NULL), /* Instance handle */
- pRLWinPriv); /* ScreenPrivates */
+ newY, /* Vertical position */
+ pFrame->width, /* Right edge */
+ pFrame->height, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL), /* Instance handle */
+ pRLWinPriv); /* ScreenPrivates */
if (pRLWinPriv->hWnd == NULL) {
- ErrorF("winMWExtWMCreateFrame - CreateWindowExA () failed: %d\n",
- (int) GetLastError());
- fResult = FALSE;
+ ErrorF ("winMWExtWMCreateFrame - CreateWindowExA () failed: %d\n",
+ (int) GetLastError ());
+ fResult = FALSE;
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMCreateFrame - ShowWindow\n");
+ winDebug ("winMWExtWMCreateFrame - ShowWindow\n");
#endif
- //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
- g_fNoConfigureWindow = FALSE;
-
+ //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ g_fNoConfigureWindow = FALSE;
+
if (pShape != NULL) {
- winMWExtWMReshapeFrame(pFrame->wid, pShape);
+ winMWExtWMReshapeFrame (pFrame->wid, pShape);
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMCreateFrame - (%08x) %08x\n",
- (int) pFrame->wid, (int) pRLWinPriv->hWnd);
+ winDebug ("winMWExtWMCreateFrame - (%08x) %08x\n",
+ (int) pFrame->wid, (int) pRLWinPriv->hWnd);
#if 0
- {
- WindowPtr pWin2 = NULL;
- win32RootlessWindowPtr pRLWinPriv2 = NULL;
+ {
+ WindowPtr pWin2 = NULL;
+ win32RootlessWindowPtr pRLWinPriv2 = NULL;
- /* Check if the Windows window property for our X window pointer is valid */
+ /* Check if the Windows window property for our X window pointer is valid */
if ((pWin2 =
(WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) {
pRLWinPriv2 =
(win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE);
- }
- winDebug("winMWExtWMCreateFrame2 (%08x) %08x\n",
- pRLWinPriv2, pRLWinPriv2->hWnd);
+ }
+ winDebug ("winMWExtWMCreateFrame2 (%08x) %08x\n",
+ pRLWinPriv2, pRLWinPriv2->hWnd);
if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) {
- winDebug("Error param missmatch\n");
- }
- }
+ winDebug ("Error param missmatch\n");
+ }
+ }
#endif
#endif
- winMWExtWMSetNativeProperty(pFrame);
+ winMWExtWMSetNativeProperty (pFrame);
- return fResult;
+ return fResult;
}
void
-winMWExtWMDestroyFrame(RootlessFrameID wid)
+winMWExtWMDestroyFrame (RootlessFrameID wid)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- HICON hIcon;
- HICON hIconSm;
- HMODULE hInstance;
- int iReturn;
- char pszClass[CLASS_NAME_LENGTH];
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ HICON hIcon;
+ HICON hIconSm;
+ HMODULE hInstance;
+ int iReturn;
+ char pszClass[CLASS_NAME_LENGTH];
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMDestroyFrame (%08x) %08x\n",
- (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+ winDebug ("winMWExtWMDestroyFrame (%08x) %08x\n",
+ (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
#if 0
- {
- WindowPtr pWin2 = NULL;
- win32RootlessWindowPtr pRLWinPriv2 = NULL;
+ {
+ WindowPtr pWin2 = NULL;
+ win32RootlessWindowPtr pRLWinPriv2 = NULL;
- /* Check if the Windows window property for our X window pointer is valid */
+ /* Check if the Windows window property for our X window pointer is valid */
if ((pWin2 =
(WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) {
pRLWinPriv2 =
(win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE);
- }
- winDebug("winMWExtWMDestroyFrame2 (%08x) %08x\n",
- pRLWinPriv2, pRLWinPriv2->hWnd);
+ }
+ winDebug ("winMWExtWMDestroyFrame2 (%08x) %08x\n",
+ pRLWinPriv2, pRLWinPriv2->hWnd);
if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) {
- winDebug("Error param missmatch\n");
- *(int *) 0 = 1; //raise exseption
- }
- }
+ winDebug ("Error param missmatch\n");
+ *(int*)0 = 1;//raise exseption
+ }
+ }
#endif
#endif
- /* Store the info we need to destroy after this window is gone */
- hInstance = (HINSTANCE) GetClassLongPtr(pRLWinPriv->hWnd, GCLP_HMODULE);
- hIcon = (HICON) SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
- hIconSm = (HICON) SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
- iReturn = GetClassName(pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
+ /* Store the info we need to destroy after this window is gone */
+ hInstance = (HINSTANCE) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HMODULE);
+ hIcon = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
+ hIconSm = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
+ iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
- pRLWinPriv->fClose = TRUE;
- pRLWinPriv->fDestroyed = TRUE;
+ pRLWinPriv->fClose = TRUE;
+ pRLWinPriv->fDestroyed = TRUE;
- /* Destroy the Windows window */
- DestroyWindow(pRLWinPriv->hWnd);
+ /* Destroy the Windows window */
+ DestroyWindow (pRLWinPriv->hWnd);
- /* Only if we were able to get the name */
+ /* Only if we were able to get the name */
if (iReturn) {
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
+ winDebug ("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
#endif
- iReturn = UnregisterClass(pszClass, hInstance);
+ iReturn = UnregisterClass (pszClass, hInstance);
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMDestroyFramew - Deleting Icon\n");
+ winDebug ("winMWExtWMDestroyFramew - Deleting Icon\n");
#endif
- winDestroyIcon(hIcon);
- winDestroyIcon(hIconSm);
+ winDestroyIcon(hIcon);
+ winDestroyIcon(hIconSm);
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMDestroyFrame - done\n");
+ winDebug ("winMWExtWMDestroyFrame - done\n");
#endif
}
@@ -409,124 +409,124 @@ void
winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX,
int iNewY)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- RECT rcNew;
- DWORD dwExStyle;
- DWORD dwStyle;
- int iX, iY, iWidth, iHeight;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ RECT rcNew;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ int iX, iY, iWidth, iHeight;
#if CYGMULTIWINDOW_DEBUG
winDebug("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX,
iNewY);
#endif
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
- /* Get the X and Y location of the X window */
- iX = iNewX + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = iNewY + GetSystemMetrics(SM_YVIRTUALSCREEN);
+ /* Get the X and Y location of the X window */
+ iX = iNewX + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = iNewY + GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* Get the height and width of the X window */
- iWidth = pRLWinPriv->pFrame->width;
- iHeight = pRLWinPriv->pFrame->height;
+ /* Get the height and width of the X window */
+ iWidth = pRLWinPriv->pFrame->width;
+ iHeight = pRLWinPriv->pFrame->height;
- /* Store the origin, height, and width in a rectangle structure */
- SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle);
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- g_fNoConfigureWindow = TRUE;
- SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
- SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
- g_fNoConfigureWindow = FALSE;
+ g_fNoConfigureWindow = TRUE;
+ SetWindowPos (pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
+ SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
+ g_fNoConfigureWindow = FALSE;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
+ winDebug ("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
#endif
}
void
-winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
- int iNewX, int iNewY,
- unsigned int uiNewWidth, unsigned int uiNewHeight,
- unsigned int uiGravity)
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int iNewX, int iNewY,
+ unsigned int uiNewWidth, unsigned int uiNewHeight,
+ unsigned int uiGravity)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- RECT rcNew;
- RECT rcOld;
- DWORD dwExStyle;
- DWORD dwStyle;
- int iX, iY;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ RECT rcNew;
+ RECT rcOld;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ int iX, iY;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
- (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
+ winDebug ("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
+ (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
#endif
- pRLWinPriv->fResized = TRUE;
+ pRLWinPriv->fResized = TRUE;
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
- /* Get the X and Y location of the X window */
- iX = iNewX + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = iNewY + GetSystemMetrics(SM_YVIRTUALSCREEN);
+ /* Get the X and Y location of the X window */
+ iX = iNewX + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = iNewY + GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* Store the origin, height, and width in a rectangle structure */
- SetRect(&rcNew, iX, iY, iX + uiNewWidth, iY + uiNewHeight);
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, iX, iY, iX + uiNewWidth, iY + uiNewHeight);
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle);
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
- /* Get a rectangle describing the old Windows window */
- GetWindowRect(pRLWinPriv->hWnd, &rcOld);
+ /* Get a rectangle describing the old Windows window */
+ GetWindowRect (pRLWinPriv->hWnd, &rcOld);
- /* Check if the old rectangle and new rectangle are the same */
+ /* Check if the old rectangle and new rectangle are the same */
if (!EqualRect(&rcNew, &rcOld)) {
- g_fNoConfigureWindow = TRUE;
- MoveWindow(pRLWinPriv->hWnd,
- rcNew.left, rcNew.top,
+ g_fNoConfigureWindow = TRUE;
+ MoveWindow (pRLWinPriv->hWnd,
+ rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, TRUE);
- g_fNoConfigureWindow = FALSE;
+ g_fNoConfigureWindow = FALSE;
}
}
void
-winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- win32RootlessWindowPtr pRLNextWinPriv = (win32RootlessWindowPtr) nextWid;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ win32RootlessWindowPtr pRLNextWinPriv = (win32RootlessWindowPtr) nextWid;
- winScreenPriv(pRLWinPriv->pFrame->win->drawable.pScreen);
- winScreenInfo *pScreenInfo = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId();
- DWORD dwWindowProcessID = 0;
- HWND hWnd;
- Bool fFirst = TRUE;
- Bool fNeedRestack = TRUE;
+ winScreenPriv(pRLWinPriv->pFrame->win->drawable.pScreen);
+ winScreenInfo *pScreenInfo = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+ HWND hWnd;
+ Bool fFirst = TRUE;
+ Bool fNeedRestack = TRUE;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug ("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
#endif
if (pScreenPriv && pScreenPriv->fRestacking)
@@ -535,149 +535,149 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
if (pScreenPriv)
pScreenInfo = pScreenPriv->pScreenInfo;
- pRLWinPriv->fRestackingNow = TRUE;
+ pRLWinPriv->fRestackingNow = TRUE;
- /* Show window */
- if (!IsWindowVisible(pRLWinPriv->hWnd))
- ShowWindow(pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ /* Show window */
+ if(!IsWindowVisible (pRLWinPriv->hWnd))
+ ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
if (pRLNextWinPriv == NULL) {
#if CYGMULTIWINDOW_DEBUG
- winDebug("Win %08x is top\n", pRLWinPriv);
+ winDebug ("Win %08x is top\n", pRLWinPriv);
#endif
- pScreenPriv->widTop = wid;
- SetWindowPos(pRLWinPriv->hWnd, HWND_TOP,
- 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ pScreenPriv->widTop = wid;
+ SetWindowPos (pRLWinPriv->hWnd, HWND_TOP,
+ 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
}
else if (winIsInternalWMRunning(pScreenInfo)) {
- /* using mulwinidow wm */
+ /* using mulwinidow wm */
#if CYGMULTIWINDOW_DEBUG
- winDebug("Win %08x is not top\n", pRLWinPriv);
+ winDebug ("Win %08x is not top\n", pRLWinPriv);
#endif
- for (hWnd = GetNextWindow(pRLWinPriv->hWnd, GW_HWNDPREV);
- fNeedRestack && hWnd != NULL;
+ for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDPREV);
+ fNeedRestack && hWnd != NULL;
hWnd = GetNextWindow(hWnd, GW_HWNDPREV)) {
- GetWindowThreadProcessId(hWnd, &dwWindowProcessID);
+ GetWindowThreadProcessId (hWnd, &dwWindowProcessID);
- if ((dwWindowProcessID == dwCurrentProcessID)
+ if ((dwWindowProcessID == dwCurrentProcessID)
&& GetProp(hWnd, WIN_WINDOW_PROP)) {
if (hWnd == pRLNextWinPriv->hWnd) {
- /* Enable interleave X window and Windows window */
+ /* Enable interleave X window and Windows window */
if (!fFirst) {
#if CYGMULTIWINDOW_DEBUG
winDebug("raise: Insert after Win %08x\n",
pRLNextWinPriv);
#endif
- SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
- 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- }
+ SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ }
else {
#if CYGMULTIWINDOW_DEBUG
- winDebug("No change\n");
+ winDebug ("No change\n");
#endif
- }
- fNeedRestack = FALSE;
- break;
- }
+ }
+ fNeedRestack = FALSE;
+ break;
+ }
if (fFirst)
fFirst = FALSE;
- }
- }
+ }
+ }
- for (hWnd = GetNextWindow(pRLWinPriv->hWnd, GW_HWNDNEXT);
- fNeedRestack && hWnd != NULL;
+ for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDNEXT);
+ fNeedRestack && hWnd != NULL;
hWnd = GetNextWindow(hWnd, GW_HWNDNEXT)) {
- GetWindowThreadProcessId(hWnd, &dwWindowProcessID);
+ GetWindowThreadProcessId (hWnd, &dwWindowProcessID);
- if ((dwWindowProcessID == dwCurrentProcessID)
+ if ((dwWindowProcessID == dwCurrentProcessID)
&& GetProp(hWnd, WIN_WINDOW_PROP)) {
if (hWnd == pRLNextWinPriv->hWnd) {
#if CYGMULTIWINDOW_DEBUG
- winDebug("lower: Insert after Win %08x\n", pRLNextWinPriv);
+ winDebug ("lower: Insert after Win %08x\n", pRLNextWinPriv);
#endif
- SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
- 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- fNeedRestack = FALSE;
- break;
- }
- }
- }
+ SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ fNeedRestack = FALSE;
+ break;
+ }
+ }
+ }
}
else {
- /* using general wm like twm, wmaker etc.
- Interleave X window and Windows window will cause problem. */
- SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ /* using general wm like twm, wmaker etc.
+ Interleave X window and Windows window will cause problem. */
+ SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
+ winDebug ("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
#endif
- pRLWinPriv->fRestackingNow = FALSE;
+ pRLWinPriv->fRestackingNow = FALSE;
}
void
-winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- HRGN hRgn, hRgnWindow, hRgnClient;
- RECT rcWindow, rcClient;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ HRGN hRgn, hRgnWindow, hRgnClient;
+ RECT rcWindow, rcClient;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug ("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
#endif
- hRgn = winMWExtWMCreateRgnFromRegion(pShape);
-
- /* Create region for non-client area */
- GetWindowRect(pRLWinPriv->hWnd, &rcWindow);
- GetClientRect(pRLWinPriv->hWnd, &rcClient);
- MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
- OffsetRgn(hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
- OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top);
- OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
- hRgnWindow = CreateRectRgnIndirect(&rcWindow);
- hRgnClient = CreateRectRgnIndirect(&rcClient);
- CombineRgn(hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF);
- CombineRgn(hRgn, hRgnWindow, hRgn, RGN_OR);
-
- SetWindowRgn(pRLWinPriv->hWnd, hRgn, TRUE);
-
- DeleteObject(hRgnWindow);
- DeleteObject(hRgnClient);
+ hRgn = winMWExtWMCreateRgnFromRegion (pShape);
+
+ /* Create region for non-client area */
+ GetWindowRect (pRLWinPriv->hWnd, &rcWindow);
+ GetClientRect (pRLWinPriv->hWnd, &rcClient);
+ MapWindowPoints (pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
+ OffsetRgn (hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
+ OffsetRect (&rcClient, -rcWindow.left, -rcWindow.top);
+ OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
+ hRgnWindow = CreateRectRgnIndirect (&rcWindow);
+ hRgnClient = CreateRectRgnIndirect (&rcClient);
+ CombineRgn (hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF);
+ CombineRgn (hRgn, hRgnWindow, hRgn, RGN_OR);
+
+ SetWindowRgn (pRLWinPriv->hWnd, hRgn, TRUE);
+
+ DeleteObject (hRgnWindow);
+ DeleteObject (hRgnClient);
}
void
-winMWExtWMUnmapFrame(RootlessFrameID wid)
+winMWExtWMUnmapFrame (RootlessFrameID wid)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug ("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
#endif
- g_fNoConfigureWindow = TRUE;
- //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE);
- ShowWindow(pRLWinPriv->hWnd, SW_HIDE);
- g_fNoConfigureWindow = FALSE;
+ g_fNoConfigureWindow = TRUE;
+ //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE);
+ ShowWindow (pRLWinPriv->hWnd, SW_HIDE);
+ g_fNoConfigureWindow = FALSE;
}
/*
* Fixme: Code sharing with winshadgdi.c and other engine support
*/
void
-winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
- ScreenPtr pScreen = NULL;
- DIBSECTION dibsection;
- Bool fReturn = TRUE;
- HDC hdcNew;
- HBITMAP hbmpNew;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+ ScreenPtr pScreen = NULL;
+ DIBSECTION dibsection;
+ Bool fReturn = TRUE;
+ HDC hdcNew;
+ HBITMAP hbmpNew;
#if CYGMULTIWINDOW_DEBUG
winDebug("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv,
@@ -685,209 +685,209 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
#endif
if (!pRLWinPriv->fDestroyed) {
- pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
+ pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
if (pScreen)
pScreenPriv = winGetScreenPriv(pScreen);
if (pScreenPriv)
pScreenInfo = pScreenPriv->pScreenInfo;
-
+
#if CYGMULTIWINDOW_DEBUG
- winDebug("\tpScreenPriv %08X\n", (int) pScreenPriv);
- winDebug("\tpScreenInfo %08X\n", (int) pScreenInfo);
- winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width,
- (int) pRLWinPriv->pFrame->height);
+ winDebug ("\tpScreenPriv %08X\n", (int) pScreenPriv);
+ winDebug ("\tpScreenInfo %08X\n", (int) pScreenInfo);
+ winDebug ("\t(%d, %d)\n", (int)pRLWinPriv->pFrame->width,
+ (int) pRLWinPriv->pFrame->height);
#endif
if (pRLWinPriv->hdcScreen == NULL) {
- InitWin32RootlessEngine(pRLWinPriv);
- }
-
+ InitWin32RootlessEngine (pRLWinPriv);
+ }
+
if (pRLWinPriv->fResized) {
- /* width * bpp must be multiple of 4 to match 32bit alignment */
- int stridesize;
- int misalignment;
-
- pRLWinPriv->pbmihShadow->biWidth = pRLWinPriv->pFrame->width;
- pRLWinPriv->pbmihShadow->biHeight = -pRLWinPriv->pFrame->height;
-
- stridesize = pRLWinPriv->pFrame->width * (pScreenInfo->dwBPP >> 3);
- misalignment = stridesize & 3;
+ /* width * bpp must be multiple of 4 to match 32bit alignment */
+ int stridesize;
+ int misalignment;
+
+ pRLWinPriv->pbmihShadow->biWidth = pRLWinPriv->pFrame->width;
+ pRLWinPriv->pbmihShadow->biHeight = -pRLWinPriv->pFrame->height;
+
+ stridesize = pRLWinPriv->pFrame->width * (pScreenInfo->dwBPP >> 3);
+ misalignment = stridesize & 3;
if (misalignment != 0) {
- stridesize += 4 - misalignment;
+ stridesize += 4 - misalignment;
pRLWinPriv->pbmihShadow->biWidth =
stridesize / (pScreenInfo->dwBPP >> 3);
- winDebug("\tresizing to %d (was %d)\n",
+ winDebug("\tresizing to %d (was %d)\n",
pRLWinPriv->pbmihShadow->biWidth,
pRLWinPriv->pFrame->width);
- }
-
- hdcNew = CreateCompatibleDC(pRLWinPriv->hdcScreen);
- /* Create a DI shadow bitmap with a bit pointer */
- hbmpNew = CreateDIBSection(pRLWinPriv->hdcScreen,
- (BITMAPINFO *) pRLWinPriv->pbmihShadow,
- DIB_RGB_COLORS,
+ }
+
+ hdcNew = CreateCompatibleDC (pRLWinPriv->hdcScreen);
+ /* Create a DI shadow bitmap with a bit pointer */
+ hbmpNew = CreateDIBSection (pRLWinPriv->hdcScreen,
+ (BITMAPINFO *) pRLWinPriv->pbmihShadow,
+ DIB_RGB_COLORS,
(VOID **) & pRLWinPriv->pfb, NULL, 0);
if (hbmpNew == NULL || pRLWinPriv->pfb == NULL) {
- ErrorF("winMWExtWMStartDrawing - CreateDIBSection failed\n");
- //return FALSE;
- }
+ ErrorF ("winMWExtWMStartDrawing - CreateDIBSection failed\n");
+ //return FALSE;
+ }
else {
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMStartDrawing - Shadow buffer allocated\n");
+ winDebug ("winMWExtWMStartDrawing - Shadow buffer allocated\n");
#endif
- }
-
- /* Get information about the bitmap that was allocated */
- GetObject(hbmpNew, sizeof(dibsection), &dibsection);
-
+ }
+
+ /* Get information about the bitmap that was allocated */
+ GetObject (hbmpNew, sizeof (dibsection), &dibsection);
+
#if CYGMULTIWINDOW_DEBUG
- /* Print information about bitmap allocated */
- winDebug("winMWExtWMStartDrawing - Dibsection width: %d height: %d "
- "depth: %d size image: %d\n",
- (unsigned int) dibsection.dsBmih.biWidth,
- (unsigned int) dibsection.dsBmih.biHeight,
- (unsigned int) dibsection.dsBmih.biBitCount,
- (unsigned int) dibsection.dsBmih.biSizeImage);
+ /* Print information about bitmap allocated */
+ winDebug ("winMWExtWMStartDrawing - Dibsection width: %d height: %d "
+ "depth: %d size image: %d\n",
+ (unsigned int)dibsection.dsBmih.biWidth,
+ (unsigned int)dibsection.dsBmih.biHeight,
+ (unsigned int)dibsection.dsBmih.biBitCount,
+ (unsigned int)dibsection.dsBmih.biSizeImage);
#endif
-
- /* Select the shadow bitmap into the shadow DC */
- SelectObject(hdcNew, hbmpNew);
-
+
+ /* Select the shadow bitmap into the shadow DC */
+ SelectObject (hdcNew, hbmpNew);
+
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMStartDrawing - Attempting a shadow blit\n");
+ winDebug ("winMWExtWMStartDrawing - Attempting a shadow blit\n");
#endif
-
- /* Blit from the old shadow to the new shadow */
- fReturn = BitBlt(hdcNew,
- 0, 0,
+
+ /* Blit from the old shadow to the new shadow */
+ fReturn = BitBlt (hdcNew,
+ 0, 0,
pRLWinPriv->pFrame->width,
pRLWinPriv->pFrame->height, pRLWinPriv->hdcShadow,
0, 0, SRCCOPY);
if (fReturn) {
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMStartDrawing - Shadow blit success\n");
+ winDebug ("winMWExtWMStartDrawing - Shadow blit success\n");
#endif
- }
+ }
else {
- ErrorF("winMWExtWMStartDrawing - Shadow blit failure\n");
- }
-
- /* Look for height weirdness */
+ ErrorF ("winMWExtWMStartDrawing - Shadow blit failure\n");
+ }
+
+ /* Look for height weirdness */
if (dibsection.dsBmih.biHeight < 0) {
- /* FIXME: Figure out why biHeight is sometimes negative */
- ErrorF("winMWExtWMStartDrawing - WEIRDNESS - "
- "biHeight still negative: %d\n",
- (int) dibsection.dsBmih.biHeight);
- ErrorF("winMWExtWMStartDrawing - WEIRDNESS - "
- "Flipping biHeight sign\n");
- dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
- }
-
- pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes;
-
+ /* FIXME: Figure out why biHeight is sometimes negative */
+ ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
+ "biHeight still negative: %d\n",
+ (int) dibsection.dsBmih.biHeight);
+ ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
+ "Flipping biHeight sign\n");
+ dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
+ }
+
+ pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes;
+
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMStartDrawing - bytesPerRow: %d\n",
- (unsigned int) dibsection.dsBm.bmWidthBytes);
+ winDebug ("winMWExtWMStartDrawing - bytesPerRow: %d\n",
+ (unsigned int)dibsection.dsBm.bmWidthBytes);
#endif
-
- /* Free the old shadow bitmap */
- DeleteObject(pRLWinPriv->hdcShadow);
- DeleteObject(pRLWinPriv->hbmpShadow);
-
- pRLWinPriv->hdcShadow = hdcNew;
- pRLWinPriv->hbmpShadow = hbmpNew;
-
- pRLWinPriv->fResized = FALSE;
+
+ /* Free the old shadow bitmap */
+ DeleteObject (pRLWinPriv->hdcShadow);
+ DeleteObject (pRLWinPriv->hbmpShadow);
+
+ pRLWinPriv->hdcShadow = hdcNew;
+ pRLWinPriv->hbmpShadow = hbmpNew;
+
+ pRLWinPriv->fResized = FALSE;
#if CYGMULTIWINDOW_DEBUG && FALSE
- winDebug("winMWExtWMStartDrawing - 0x%08x %d\n",
- (unsigned int) pRLWinPriv->pfb,
- (unsigned int) dibsection.dsBm.bmWidthBytes);
+ winDebug ("winMWExtWMStartDrawing - 0x%08x %d\n",
+ (unsigned int)pRLWinPriv->pfb,
+ (unsigned int)dibsection.dsBm.bmWidthBytes);
#endif
- }
+ }
}
else {
- ErrorF("winMWExtWMStartDrawing - Already window was destroyed \n");
+ ErrorF ("winMWExtWMStartDrawing - Already window was destroyed \n");
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
- (int) pRLWinPriv,
+ winDebug ("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
+ (int) pRLWinPriv,
(unsigned int) pRLWinPriv->pfb,
(unsigned int) pRLWinPriv->dwWidthBytes);
#endif
- *pixelData = pRLWinPriv->pfb;
- *bytesPerRow = pRLWinPriv->dwWidthBytes;
+ *pixelData = pRLWinPriv->pfb;
+ *bytesPerRow = pRLWinPriv->dwWidthBytes;
}
void
-winMWExtWMStopDrawing(RootlessFrameID wid, Bool fFlush)
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool fFlush)
{
#if 0
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- BLENDFUNCTION bfBlend;
- SIZE szWin;
- POINT ptSrc;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ BLENDFUNCTION bfBlend;
+ SIZE szWin;
+ POINT ptSrc;
#if CYGMULTIWINDOW_DEBUG || TRUE
- winDebug("winMWExtWMStopDrawing (%08x)\n", pRLWinPriv);
+ winDebug ("winMWExtWMStopDrawing (%08x)\n", pRLWinPriv);
#endif
- szWin.cx = pRLWinPriv->dwWidth;
- szWin.cy = pRLWinPriv->dwHeight;
- ptSrc.x = 0;
- ptSrc.y = 0;
- bfBlend.BlendOp = AC_SRC_OVER;
- bfBlend.BlendFlags = 0;
- bfBlend.SourceConstantAlpha = 255;
- bfBlend.AlphaFormat = AC_SRC_ALPHA;
-
- if (!UpdateLayeredWindow(pRLWinPriv->hWnd,
- NULL, NULL, &szWin,
- pRLWinPriv->hdcShadow, &ptSrc,
+ szWin.cx = pRLWinPriv->dwWidth;
+ szWin.cy = pRLWinPriv->dwHeight;
+ ptSrc.x = 0;
+ ptSrc.y = 0;
+ bfBlend.BlendOp = AC_SRC_OVER;
+ bfBlend.BlendFlags = 0;
+ bfBlend.SourceConstantAlpha = 255;
+ bfBlend.AlphaFormat = AC_SRC_ALPHA;
+
+ if (!UpdateLayeredWindow (pRLWinPriv->hWnd,
+ NULL, NULL, &szWin,
+ pRLWinPriv->hdcShadow, &ptSrc,
0, &bfBlend, ULW_ALPHA)) {
- ErrorF("winMWExtWMStopDrawing - UpdateLayeredWindow failed\n");
+ ErrorF ("winMWExtWMStopDrawing - UpdateLayeredWindow failed\n");
}
#endif
}
void
-winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
#if 0
- BLENDFUNCTION bfBlend;
- SIZE szWin;
- POINT ptSrc;
+ BLENDFUNCTION bfBlend;
+ SIZE szWin;
+ POINT ptSrc;
#endif
#if CYGMULTIWINDOW_DEBUG && 0
- winDebug("winMWExtWMUpdateRegion (%08x)\n", pRLWinPriv);
+ winDebug ("winMWExtWMUpdateRegion (%08x)\n", pRLWinPriv);
#endif
#if 0
- szWin.cx = pRLWinPriv->dwWidth;
- szWin.cy = pRLWinPriv->dwHeight;
- ptSrc.x = 0;
- ptSrc.y = 0;
- bfBlend.BlendOp = AC_SRC_OVER;
- bfBlend.BlendFlags = 0;
- bfBlend.SourceConstantAlpha = 255;
- bfBlend.AlphaFormat = AC_SRC_ALPHA;
-
- if (!UpdateLayeredWindow(pRLWinPriv->hWnd,
- NULL, NULL, &szWin,
- pRLWinPriv->hdcShadow, &ptSrc,
+ szWin.cx = pRLWinPriv->dwWidth;
+ szWin.cy = pRLWinPriv->dwHeight;
+ ptSrc.x = 0;
+ ptSrc.y = 0;
+ bfBlend.BlendOp = AC_SRC_OVER;
+ bfBlend.BlendFlags = 0;
+ bfBlend.SourceConstantAlpha = 255;
+ bfBlend.AlphaFormat = AC_SRC_ALPHA;
+
+ if (!UpdateLayeredWindow (pRLWinPriv->hWnd,
+ NULL, NULL, &szWin,
+ pRLWinPriv->hdcShadow, &ptSrc,
0, &bfBlend, ULW_ALPHA)) {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError (),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) & lpMsgBuf, 0, NULL);
-
- ErrorF("winMWExtWMUpdateRegion - UpdateLayeredWindow failed: %s\n",
- (LPSTR) lpMsgBuf);
- LocalFree(lpMsgBuf);
+
+ ErrorF ("winMWExtWMUpdateRegion - UpdateLayeredWindow failed: %s\n",
+ (LPSTR)lpMsgBuf);
+ LocalFree (lpMsgBuf);
}
#endif
if (!g_fNoConfigureWindow)
@@ -895,18 +895,18 @@ winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
}
void
-winMWExtWMDamageRects(RootlessFrameID wid, int nCount, const BoxRec * pRects,
- int shift_x, int shift_y)
+winMWExtWMDamageRects (RootlessFrameID wid, int nCount, const BoxRec *pRects,
+ int shift_x, int shift_y)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- const BoxRec *pEnd;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ const BoxRec *pEnd;
#if CYGMULTIWINDOW_DEBUG && 0
- winDebug("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n",
- pRLWinPriv, nCount, pRects, shift_x, shift_y);
+ winDebug ("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n",
+ pRLWinPriv, nCount, pRects, shift_x, shift_y);
#endif
- for (pEnd = pRects + nCount; pRects < pEnd; pRects++) {
+ for (pEnd = pRects + nCount; pRects < pEnd; pRects++) {
RECT rcDmg;
rcDmg.left = pRects->x1 + shift_x;
@@ -914,59 +914,59 @@ winMWExtWMDamageRects(RootlessFrameID wid, int nCount, const BoxRec * pRects,
rcDmg.right = pRects->x2 + shift_x;
rcDmg.bottom = pRects->y2 + shift_y;
- InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE);
+ InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE);
}
}
void
-winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
- (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+ winDebug ("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
+ (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
#endif
- pRLWinPriv->pFrame = pFrame;
- pRLWinPriv->fResized = TRUE;
+ pRLWinPriv->pFrame = pFrame;
+ pRLWinPriv->fResized = TRUE;
- /* Set the window extended style flags */
- SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+ /* Set the window extended style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
- /* Set the window standard style flags */
+ /* Set the window standard style flags */
SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN);
- DeleteProperty(serverClient, oldWin, AtmWindowsWmNativeHwnd());
- winMWExtWMSetNativeProperty(pFrame);
+ DeleteProperty (serverClient, oldWin, AtmWindowsWmNativeHwnd ());
+ winMWExtWMSetNativeProperty (pFrame);
#if CYGMULTIWINDOW_DEBUG
#if 0
- {
- WindowPtr pWin2 = NULL;
- win32RootlessWindowPtr pRLWinPriv2 = NULL;
+ {
+ WindowPtr pWin2 = NULL;
+ win32RootlessWindowPtr pRLWinPriv2 = NULL;
- /* Check if the Windows window property for our X window pointer is valid */
+ /* Check if the Windows window property for our X window pointer is valid */
if ((pWin2 =
(WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) {
pRLWinPriv2 =
(win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE);
- }
- winDebug("winMWExtWMSwitchFrame2 (%08x) %08x\n",
- pRLWinPriv2, pRLWinPriv2->hWnd);
+ }
+ winDebug ("winMWExtWMSwitchFrame2 (%08x) %08x\n",
+ pRLWinPriv2, pRLWinPriv2->hWnd);
if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) {
- winDebug("Error param missmatch\n");
- }
- }
+ winDebug ("Error param missmatch\n");
+ }
+ }
#endif
#endif
}
void
-winMWExtWMCopyBytes(unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes)
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes)
{
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMCopyBytes - Not implemented\n");
+ winDebug ("winMWExtWMCopyBytes - Not implemented\n");
#endif
}
@@ -974,42 +974,42 @@ void
winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects,
const BoxRec * pDstRects, int nDx, int nDy)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- const BoxRec *pEnd;
- RECT rcDmg;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ const BoxRec *pEnd;
+ RECT rcDmg;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
- (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
+ winDebug ("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
+ (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
#endif
for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++) {
#if CYGMULTIWINDOW_DEBUG
- winDebug("BitBlt (%d, %d, %d, %d) (%d, %d)\n",
- pDstRects->x1, pDstRects->y1,
- pDstRects->x2 - pDstRects->x1,
- pDstRects->y2 - pDstRects->y1,
+ winDebug ("BitBlt (%d, %d, %d, %d) (%d, %d)\n",
+ pDstRects->x1, pDstRects->y1,
+ pDstRects->x2 - pDstRects->x1,
+ pDstRects->y2 - pDstRects->y1,
pDstRects->x1 + nDx, pDstRects->y1 + nDy);
#endif
- if (!BitBlt(pRLWinPriv->hdcShadow,
- pDstRects->x1, pDstRects->y1,
- pDstRects->x2 - pDstRects->x1,
- pDstRects->y2 - pDstRects->y1,
- pRLWinPriv->hdcShadow,
+ if (!BitBlt (pRLWinPriv->hdcShadow,
+ pDstRects->x1, pDstRects->y1,
+ pDstRects->x2 - pDstRects->x1,
+ pDstRects->y2 - pDstRects->y1,
+ pRLWinPriv->hdcShadow,
pDstRects->x1 + nDx, pDstRects->y1 + nDy, SRCCOPY)) {
- ErrorF("winMWExtWMCopyWindow - BitBlt failed.\n");
- }
-
- rcDmg.left = pDstRects->x1;
- rcDmg.top = pDstRects->y1;
- rcDmg.right = pDstRects->x2;
- rcDmg.bottom = pDstRects->y2;
-
- InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE);
+ ErrorF ("winMWExtWMCopyWindow - BitBlt failed.\n");
+ }
+
+ rcDmg.left = pDstRects->x1;
+ rcDmg.top = pDstRects->y1;
+ rcDmg.right = pDstRects->x2;
+ rcDmg.bottom = pDstRects->y2;
+
+ InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE);
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMCopyWindow - done\n");
+ winDebug ("winMWExtWMCopyWindow - done\n");
#endif
}
@@ -1018,14 +1018,14 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects,
*/
static void
-winMWExtWMSetNativeProperty(RootlessWindowPtr pFrame)
+winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
- long lData;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
+ long lData;
- /* FIXME: move this to WindowsWM extension */
+ /* FIXME: move this to WindowsWM extension */
- lData = (long) pRLWinPriv->hWnd;
- dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
- XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
+ lData = (long) pRLWinPriv->hWnd;
+ dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
+ XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
}
diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c
index bfba1bfd0..e5cb43de3 100644
--- a/hw/xwin/winwin32rootlesswindow.c
+++ b/hw/xwin/winwin32rootlesswindow.c
@@ -42,59 +42,59 @@
*/
void
-winMWExtWMReorderWindows(ScreenPtr pScreen)
+winMWExtWMReorderWindows (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- HWND hwnd = NULL;
- win32RootlessWindowPtr pRLWin = NULL;
- win32RootlessWindowPtr pRLWinSib = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId();
- DWORD dwWindowProcessID = 0;
- XID vlist[2];
+ winScreenPriv(pScreen);
+ HWND hwnd = NULL;
+ win32RootlessWindowPtr pRLWin = NULL;
+ win32RootlessWindowPtr pRLWinSib = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+ XID vlist[2];
#if CYGMULTIWINDOW_DEBUG && FALSE
- winDebug("winMWExtWMReorderWindows\n");
+ winDebug ("winMWExtWMReorderWindows\n");
#endif
- pScreenPriv->fRestacking = TRUE;
+ pScreenPriv->fRestacking = TRUE;
if (pScreenPriv->fWindowOrderChanged) {
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMReorderWindows - Need to restack\n");
+ winDebug ("winMWExtWMReorderWindows - Need to restack\n");
#endif
- hwnd = GetTopWindow(NULL);
+ hwnd = GetTopWindow (NULL);
while (hwnd) {
- GetWindowThreadProcessId(hwnd, &dwWindowProcessID);
+ GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
- if ((dwWindowProcessID == dwCurrentProcessID)
+ if ((dwWindowProcessID == dwCurrentProcessID)
&& GetProp(hwnd, WIN_WINDOW_PROP)) {
- pRLWinSib = pRLWin;
+ pRLWinSib = pRLWin;
pRLWin =
(win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP);
-
+
if (pRLWinSib) {
- vlist[0] = pRLWinSib->pFrame->win->drawable.id;
- vlist[1] = Below;
+ vlist[0] = pRLWinSib->pFrame->win->drawable.id;
+ vlist[1] = Below;
ConfigureWindow(pRLWin->pFrame->win,
CWSibling | CWStackMode, vlist,
wClient(pRLWin->pFrame->win));
- }
+ }
else {
- /* 1st window - raise to the top */
- vlist[0] = Above;
-
- ConfigureWindow(pRLWin->pFrame->win, CWStackMode,
- vlist, wClient(pRLWin->pFrame->win));
- }
- }
- hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
- }
+ /* 1st window - raise to the top */
+ vlist[0] = Above;
+
+ ConfigureWindow (pRLWin->pFrame->win, CWStackMode,
+ vlist, wClient(pRLWin->pFrame->win));
+ }
+ }
+ hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
+ }
}
- pScreenPriv->fRestacking = FALSE;
- pScreenPriv->fWindowOrderChanged = FALSE;
+ pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fWindowOrderChanged = FALSE;
}
#endif
@@ -103,14 +103,14 @@ winMWExtWMReorderWindows(ScreenPtr pScreen)
*/
void
-winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y)
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y)
{
- CARD32 *vlist = malloc(sizeof(CARD32) * 2);
+ CARD32 *vlist = malloc(sizeof(CARD32)*2);
- vlist[0] = x;
- vlist[1] = y;
- ConfigureWindow(pWin, CWX | CWY, vlist, wClient(pWin));
- free(vlist);
+ vlist[0] = x;
+ vlist[1] = y;
+ ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
+ free(vlist);
}
/*
@@ -118,14 +118,14 @@ winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y)
*/
void
-winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h)
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h)
{
- CARD32 *vlist = malloc(sizeof(CARD32) * 2);
+ CARD32 *vlist = malloc(sizeof(CARD32)*2);
- vlist[0] = w;
- vlist[1] = h;
- ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
- free(vlist);
+ vlist[0] = w;
+ vlist[1] = h;
+ ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
+ free(vlist);
}
/*
@@ -133,50 +133,17 @@ winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h)
*/
void
-winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h)
-{
- CARD32 *vlist = malloc(sizeof(long) * 4);
-
- vlist[0] = x;
- vlist[1] = y;
- vlist[2] = w;
- vlist[3] = h;
-
- ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
- free(vlist);
-}
-
-/*
- * winMWExtWMUpdateIcon
- * Change the Windows window icon
- */
-
-void
-winMWExtWMUpdateIcon(Window id)
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
{
- WindowPtr pWin;
- HICON hIcon, hiconOld;
-
- dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
- DixUnknownAccess);
- hIcon = winOverrideIcon((unsigned long) pWin);
+ CARD32 *vlist = malloc(sizeof(long)*4);
- if (!hIcon)
- hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));
+ vlist[0] = x;
+ vlist[1] = y;
+ vlist[2] = w;
+ vlist[3] = h;
- if (hIcon) {
- win32RootlessWindowPtr pRLWinPriv
- = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
-
- if (pRLWinPriv->hWnd) {
-
- hiconOld = (HICON) SendMessage(pRLWinPriv->hWnd,
- WM_SETICON, ICON_BIG,
- (LPARAM) hIcon);
- winDestroyIcon(hiconOld);
- }
- hIcon = NULL;
- }
+ ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
+ free(vlist);
}
/*
@@ -184,19 +151,19 @@ winMWExtWMUpdateIcon(Window id)
*/
wBOOL CALLBACK
-winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam)
+winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam)
{
- win32RootlessWindowPtr pRLWinPriv = NULL;
- ScreenPtr pScreen = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
+ win32RootlessWindowPtr pRLWinPriv = NULL;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
- /* Check if the Windows window property for our X window pointer is valid */
+ /* Check if the Windows window property for our X window pointer is valid */
if ((pRLWinPriv =
(win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
if (pRLWinPriv != NULL && pRLWinPriv->pFrame != NULL &&
pRLWinPriv->pFrame->win != NULL)
- pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
+ pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
if (pScreen)
pScreenPriv = winGetScreenPriv(pScreen);
if (pScreenPriv)
@@ -204,7 +171,7 @@ winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam)
if (pRLWinPriv && pScreenInfo)
winMWExtWMUpdateWindowDecoration(pRLWinPriv, pScreenInfo);
}
- return TRUE;
+ return TRUE;
}
/*
@@ -212,168 +179,168 @@ winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam)
*/
void
-winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo)
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo)
{
- Bool fDecorate = FALSE;
- DWORD dwExStyle = 0;
- DWORD dwStyle = 0;
- WINDOWPLACEMENT wndPlace;
- UINT showCmd = 0;
+ Bool fDecorate = FALSE;
+ DWORD dwExStyle = 0;
+ DWORD dwStyle = 0;
+ WINDOWPLACEMENT wndPlace;
+ UINT showCmd = 0;
- wndPlace.length = sizeof(WINDOWPLACEMENT);
+ wndPlace.length = sizeof (WINDOWPLACEMENT);
- /* Get current window placement */
- GetWindowPlacement(pRLWinPriv->hWnd, &wndPlace);
+ /* Get current window placement */
+ GetWindowPlacement (pRLWinPriv->hWnd, &wndPlace);
if (winIsInternalWMRunning(pScreenInfo)) {
- if (!pRLWinPriv->pFrame->win->overrideRedirect)
- fDecorate = TRUE;
+ if (!pRLWinPriv->pFrame->win->overrideRedirect)
+ fDecorate = TRUE;
}
#if 0
- if (wndPlace.showCmd == SW_HIDE)
- return; //showCmd = SWP_HIDEWINDOW;
- else
- showCmd = SWP_SHOWWINDOW;
+ if (wndPlace.showCmd == SW_HIDE)
+ return;//showCmd = SWP_HIDEWINDOW;
+ else
+ showCmd = SWP_SHOWWINDOW;
#else
- if (wndPlace.showCmd == SW_HIDE)
- return;
+ if (wndPlace.showCmd == SW_HIDE)
+ return;
- if (IsWindowVisible(pRLWinPriv->hWnd))
- showCmd = SWP_SHOWWINDOW;
+ if (IsWindowVisible (pRLWinPriv->hWnd))
+ showCmd = SWP_SHOWWINDOW;
#endif
- showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
+ showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
- winDebug("winMWExtWMUpdateWindowDecoration %08x %s\n",
- (int) pRLWinPriv, fDecorate ? "Decorate" : "Bare");
+ winDebug ("winMWExtWMUpdateWindowDecoration %08x %s\n",
+ (int)pRLWinPriv, fDecorate?"Decorate":"Bare");
- /* Get the standard and extended window style information */
- dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
+ /* Get the standard and extended window style information */
+ dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
if (fDecorate) {
- RECT rcNew;
- int iDx, iDy;
- winWMMessageRec wmMsg;
+ RECT rcNew;
+ int iDx, iDy;
+ winWMMessageRec wmMsg;
- winScreenPriv(pScreenInfo->pScreen);
+ winScreenPriv(pScreenInfo->pScreen);
- /* */
+ /* */
if (!(dwExStyle & WS_EX_APPWINDOW)) {
- winDebug("\tBare=>Decorate\n");
- /* Setup a rectangle with the X window position and size */
- SetRect(&rcNew,
- pRLWinPriv->pFrame->x,
- pRLWinPriv->pFrame->y,
- pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
- pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
+ winDebug ("\tBare=>Decorate\n");
+ /* Setup a rectangle with the X window position and size */
+ SetRect (&rcNew,
+ pRLWinPriv->pFrame->x,
+ pRLWinPriv->pFrame->y,
+ pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- /* */
- AdjustWindowRectEx(&rcNew,
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ /* */
+ AdjustWindowRectEx (&rcNew,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
FALSE, WS_EX_APPWINDOW);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- /* Calculate position deltas */
- iDx = pRLWinPriv->pFrame->x - rcNew.left;
- iDy = pRLWinPriv->pFrame->y - rcNew.top;
+ /* Calculate position deltas */
+ iDx = pRLWinPriv->pFrame->x - rcNew.left;
+ iDy = pRLWinPriv->pFrame->y - rcNew.top;
- /* Calculate new rectangle */
- rcNew.left += iDx;
- rcNew.right += iDx;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
- /* Set the window extended style flags */
- SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
+ /* Set the window extended style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
- /* Set the window standard style flags */
- SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE,
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
+ /* Set the window standard style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindowStyle: %08x %08x\n",
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
- WS_EX_APPWINDOW);
+ winDebug("\tWindowStyle: %08x %08x\n",
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ WS_EX_APPWINDOW);
#endif
- /* Position the Windows window */
+ /* Position the Windows window */
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- SetWindowPos(pRLWinPriv->hWnd, NULL,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- showCmd);
-
- wmMsg.hwndWindow = pRLWinPriv->hWnd;
- wmMsg.iWindow = (Window) pRLWinPriv->pFrame->win->drawable.id;
- wmMsg.msg = WM_WM_NAME_EVENT;
- winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
-
- winMWExtWMReshapeFrame((RootlessFrameID) pRLWinPriv,
- wBoundingShape(pRLWinPriv->pFrame->win));
- }
+ SetWindowPos (pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ showCmd);
+
+ wmMsg.hwndWindow = pRLWinPriv->hWnd;
+ wmMsg.iWindow = (Window)pRLWinPriv->pFrame->win->drawable.id;
+ wmMsg.msg = WM_WM_NAME_EVENT;
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+
+ winMWExtWMReshapeFrame ((RootlessFrameID)pRLWinPriv ,
+ wBoundingShape(pRLWinPriv->pFrame->win));
+ }
}
else {
- RECT rcNew;
+ RECT rcNew;
- /* */
+ /* */
if (dwExStyle & WS_EX_APPWINDOW) {
- winDebug("\tDecorate=>Bare\n");
- /* Setup a rectangle with the X window position and size */
- SetRect(&rcNew,
- pRLWinPriv->pFrame->x,
- pRLWinPriv->pFrame->y,
- pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
- pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
+ winDebug ("\tDecorate=>Bare\n");
+ /* Setup a rectangle with the X window position and size */
+ SetRect (&rcNew,
+ pRLWinPriv->pFrame->x,
+ pRLWinPriv->pFrame->y,
+ pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
#if 0
- /* */
- AdjustWindowRectEx(&rcNew,
- WS_POPUP | WS_CLIPCHILDREN,
+ /* */
+ AdjustWindowRectEx (&rcNew,
+ WS_POPUP | WS_CLIPCHILDREN,
FALSE, WS_EX_TOOLWINDOW);
- /* Calculate position deltas */
- iDx = pRLWinPriv->pFrame->x - rcNew.left;
- iDy = pRLWinPriv->pFrame->y - rcNew.top;
+ /* Calculate position deltas */
+ iDx = pRLWinPriv->pFrame->x - rcNew.left;
+ iDy = pRLWinPriv->pFrame->y - rcNew.top;
- /* Calculate new rectangle */
- rcNew.left += iDx;
- rcNew.right += iDx;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
#endif
- /* Hide window temporary to remove from taskbar. */
- ShowWindow(pRLWinPriv->hWnd, SW_HIDE);
+ /* Hide window temporary to remove from taskbar. */
+ ShowWindow( pRLWinPriv->hWnd, SW_HIDE );
- /* Set the window extended style flags */
- SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+ /* Set the window extended style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
- /* Set the window standard style flags */
- SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE,
- WS_POPUP | WS_CLIPCHILDREN);
+ /* Set the window standard style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_CLIPCHILDREN);
- /* Position the Windows window */
- SetWindowPos(pRLWinPriv->hWnd, NULL,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- showCmd);
+ /* Position the Windows window */
+ SetWindowPos (pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ showCmd);
- winMWExtWMReshapeFrame((RootlessFrameID) pRLWinPriv,
- wBoundingShape(pRLWinPriv->pFrame->win));
- }
+ winMWExtWMReshapeFrame ((RootlessFrameID)pRLWinPriv ,
+ wBoundingShape(pRLWinPriv->pFrame->win));
+ }
}
}
@@ -381,9 +348,9 @@ winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
* winIsInternalWMRunning (winScreenInfoPtr pScreenInfo)
*/
Bool
-winIsInternalWMRunning(winScreenInfoPtr pScreenInfo)
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo)
{
- return pScreenInfo->fInternalWM && !pScreenInfo->fAnotherWMRunning;
+ return pScreenInfo->fInternalWM && !pScreenInfo->fAnotherWMRunning;
}
/*
@@ -391,32 +358,32 @@ winIsInternalWMRunning(winScreenInfoPtr pScreenInfo)
*/
void
-winMWExtWMRestackWindows(ScreenPtr pScreen)
+winMWExtWMRestackWindows (ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- WindowPtr pRoot = pScreen->root;
- WindowPtr pWin = NULL;
- WindowPtr pWinPrev = NULL;
- win32RootlessWindowPtr pRLWin = NULL;
- win32RootlessWindowPtr pRLWinPrev = NULL;
- int nWindow = 0;
- HDWP hWinPosInfo = NULL;
+ winScreenPriv(pScreen);
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pWin = NULL;
+ WindowPtr pWinPrev = NULL;
+ win32RootlessWindowPtr pRLWin = NULL;
+ win32RootlessWindowPtr pRLWinPrev = NULL;
+ int nWindow = 0;
+ HDWP hWinPosInfo = NULL;
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMRestackWindows\n");
+ winDebug ("winMWExtWMRestackWindows\n");
#endif
- pScreenPriv->fRestacking = TRUE;
+ pScreenPriv->fRestacking = TRUE;
if (pRoot != NULL) {
- for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
- nWindow++;
+ for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
+ nWindow ++;
- hWinPosInfo = BeginDeferWindowPos(nWindow);
+ hWinPosInfo = BeginDeferWindowPos(nWindow);
for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) {
if (pWin->realized) {
- UINT uFlags;
+ UINT uFlags;
pRLWin =
(win32RootlessWindowPtr) RootlessFrameForWindow(pWin,
@@ -424,12 +391,12 @@ winMWExtWMRestackWindows(ScreenPtr pScreen)
if (pRLWin == NULL)
continue;
- if (pWinPrev)
+ if (pWinPrev)
pRLWinPrev =
(win32RootlessWindowPtr)
RootlessFrameForWindow(pWinPrev, FALSE);
- uFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW;
+ uFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW;
if (pRLWinPrev != NULL)
uFlags |= SWP_NOACTIVATE;
@@ -438,29 +405,29 @@ winMWExtWMRestackWindows(ScreenPtr pScreen)
("winMWExtWMRestackWindows - DeferWindowPos (%08x, %08x)\n",
pRLWin->hWnd, pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP);
#endif
- hWinPosInfo = DeferWindowPos(hWinPosInfo, pRLWin->hWnd,
+ hWinPosInfo = DeferWindowPos (hWinPosInfo, pRLWin->hWnd,
pRLWinPrev ? pRLWinPrev->
hWnd : HWND_TOP, 0, 0, 0, 0,
- uFlags);
+ uFlags);
if (hWinPosInfo == NULL) {
ErrorF
("winMWExtWMRestackWindows - DeferWindowPos () failed: %d\n",
- (int) GetLastError());
- return;
- }
- pWinPrev = pWin;
- }
- }
+ (int) GetLastError ());
+ return;
+ }
+ pWinPrev = pWin;
+ }
+ }
if (!EndDeferWindowPos(hWinPosInfo)) {
ErrorF
("winMWExtWMRestackWindows - EndDeferWindowPos () failed: %d\n",
- (int) GetLastError());
- return;
- }
+ (int) GetLastError ());
+ return;
+ }
}
#if CYGMULTIWINDOW_DEBUG
- winDebug("winMWExtWMRestackWindows - done\n");
+ winDebug ("winMWExtWMRestackWindows - done\n");
#endif
- pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fRestacking = FALSE;
}
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index c357f8d08..ec36c6ae7 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -41,7 +41,7 @@
/* Constant strings */
#ifndef PROJECT_NAME
-#define PROJECT_NAME "Cygwin/X"
+# define PROJECT_NAME "Cygwin/X"
#endif
#define EXECUTABLE_NAME "XWin"
#define WINDOW_CLASS "cygwin/x"
@@ -49,10 +49,12 @@
#define WINDOW_TITLE_XDMCP "%s:%s.%d"
#define WIN_SCR_PROP "cyg_screen_prop rl"
#define WINDOW_CLASS_X "cygwin/x X rl"
+#define WINDOW_CLASS_X_CHILD "cygwin/x X child"
+#define WINDOW_CLASS_X_MSG "cygwin/x X msg"
#define WINDOW_TITLE_X PROJECT_NAME " X"
#define WIN_WINDOW_PROP "cyg_window_prop_rl"
#ifdef HAS_DEVWINDOWS
-#define WIN_MSG_QUEUE_FNAME "/dev/windows"
+# define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_WID_PROP "cyg_wid_prop_rl"
#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl"
@@ -72,34 +74,34 @@ typedef struct _winPrivScreenRec *winPrivScreenPtr;
*/
typedef struct {
- DWORD dwDummy;
- HRGN hRgn;
- HWND hWnd;
- winPrivScreenPtr pScreenPriv;
- Bool fXKilled;
- HDWP hDwp;
+ DWORD dwDummy;
+ HRGN hRgn;
+ HWND hWnd;
+ winPrivScreenPtr pScreenPriv;
+ Bool fXKilled;
+ HDWP hDwp;
#ifdef XWIN_GLX_WINDOWS
- Bool fWglUsed;
+ Bool fWglUsed;
#endif
- /* Privates used by primary fb DirectDraw server */
- LPDDSURFACEDESC pddsdPrimary;
+ /* Privates used by primary fb DirectDraw server */
+ LPDDSURFACEDESC pddsdPrimary;
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
} winPrivWinRec, *winPrivWinPtr;
#ifdef XWIN_MULTIWINDOW
-typedef struct _winWMMessageRec {
- DWORD dwID;
- DWORD msg;
- int iWindow;
- HWND hwndWindow;
- int iX, iY;
- int iWidth, iHeight;
+typedef struct _winWMMessageRec{
+ DWORD dwID;
+ DWORD msg;
+ int iWindow;
+ HWND hwndWindow;
+ int iX, iY;
+ int iWidth, iHeight;
} winWMMessageRec, *winWMMessagePtr;
/*
@@ -115,10 +117,11 @@ typedef struct _winWMMessageRec {
#define WM_WM_KILL (WM_USER + 7)
#define WM_WM_ACTIVATE (WM_USER + 8)
#define WM_WM_NAME_EVENT (WM_USER + 9)
-#define WM_WM_HINTS_EVENT (WM_USER + 10)
+#define WM_WM_ICON_EVENT (WM_USER + 10)
#define WM_WM_CHANGE_STATE (WM_USER + 11)
#define WM_WM_MAP2 (WM_USER + 12)
#define WM_WM_MAP3 (WM_USER + 13)
+#define WM_WM_HINTS_EVENT (WM_USER + 14)
#define WM_MANAGE (WM_USER + 100)
#define WM_UNMANAGE (WM_USER + 102)
@@ -135,40 +138,36 @@ typedef struct _winWMMessageRec {
/* This structure only contains 3 elements... the Motif 2.0 structure
contains 5... we only need the first 3... so that is all we will define */
typedef struct MwmHints {
- unsigned long flags, functions, decorations;
+ unsigned long flags, functions, decorations;
} MwmHints;
#define PropMwmHintsElements 3
void
- winSendMessageToWM(void *pWMInfo, winWMMessagePtr msg);
+winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg);
Bool
-winInitWM(void **ppWMInfo,
- pthread_t * ptWMProc,
- pthread_t * ptXMsgProc,
- pthread_mutex_t * ppmServerStarted,
+winInitWM (void **ppWMInfo,
+ pthread_t *ptWMProc,
+ pthread_t *ptXMsgProc,
+ pthread_mutex_t *ppmServerStarted,
int dwScreen, HWND hwndScreen, BOOL allowOtherWM);
void
- winDeinitMultiWindowWM(void);
+winDeinitMultiWindowWM (void);
void
- winMinimizeWindow(Window id);
-
-/*
- * winmultiwindowicons.c
- */
+winMinimizeWindow (Window id);
void
- winUpdateIcon(Window id);
+winTaskbarInit (void);
void
- winInitGlobalIcons(void);
+winTaskbarDestroy (void);
void
- winDestroyIcon(HICON hIcon);
+winSetAppID (HWND hWnd, const char* AppID);
-#endif /* XWIN_MULTIWINDOW */
+#endif /* XWIN_MULTIWINDOW */
#endif
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index f67c383f3..5c82de4a6 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -47,193 +47,193 @@ static int WMErrorBase;
static unsigned char WMReqCode = 0;
static int WMEventBase = 0;
-static RESTYPE ClientType, eventResourceType; /* resource types for event masks */
+static RESTYPE ClientType, eventResourceType; /* resource types for event masks */
static XID eventResource;
/* Currently selected events */
static unsigned int eventMask = 0;
-static int WMFreeClient(pointer data, XID id);
-static int WMFreeEvents(pointer data, XID id);
+static int WMFreeClient (pointer data, XID id);
+static int WMFreeEvents (pointer data, XID id);
static void SNotifyEvent(xWindowsWMNotifyEvent * from,
xWindowsWMNotifyEvent * to);
typedef struct _WMEvent *WMEventPtr;
typedef struct _WMEvent {
- WMEventPtr next;
- ClientPtr client;
- XID clientResource;
- unsigned int mask;
+ WMEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
} WMEventRec;
static inline BoxRec
-make_box(int x, int y, int w, int h)
+make_box (int x, int y, int w, int h)
{
- BoxRec r;
+ BoxRec r;
- r.x1 = x;
- r.y1 = y;
- r.x2 = x + w;
- r.y2 = y + h;
- return r;
+ r.x1 = x;
+ r.y1 = y;
+ r.x2 = x + w;
+ r.y2 = y + h;
+ return r;
}
static int
ProcWindowsWMQueryVersion(ClientPtr client)
{
- xWindowsWMQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION;
- rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION;
- rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION;
+ xWindowsWMQueryVersionReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION;
+ rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION;
+ rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *) &rep);
- return Success;
+ WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *)&rep);
+ return Success;
}
/* events */
static inline void
-updateEventMask(WMEventPtr * pHead)
+updateEventMask (WMEventPtr *pHead)
{
- WMEventPtr pCur;
+ WMEventPtr pCur;
- eventMask = 0;
- for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
- eventMask |= pCur->mask;
+ eventMask = 0;
+ for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
+ eventMask |= pCur->mask;
}
/*ARGSUSED*/ static int
-WMFreeClient(pointer data, XID id)
+WMFreeClient (pointer data, XID id)
{
- WMEventPtr pEvent;
- WMEventPtr *pHead, pCur, pPrev;
+ WMEventPtr pEvent;
+ WMEventPtr *pHead, pCur, pPrev;
- pEvent = (WMEventPtr) data;
- dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
- NullClient, DixUnknownAccess);
+ pEvent = (WMEventPtr) data;
+ dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+ NullClient, DixUnknownAccess);
if (pHead) {
- pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
- pPrev = pCur;
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
+ pPrev = pCur;
if (pCur) {
- if (pPrev)
- pPrev->next = pEvent->next;
- else
- *pHead = pEvent->next;
- }
- updateEventMask(pHead);
+ if (pPrev)
+ pPrev->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ }
+ updateEventMask (pHead);
}
- free((pointer) pEvent);
- return 1;
+ free((pointer) pEvent);
+ return 1;
}
/*ARGSUSED*/ static int
-WMFreeEvents(pointer data, XID id)
+WMFreeEvents (pointer data, XID id)
{
- WMEventPtr *pHead, pCur, pNext;
-
- pHead = (WMEventPtr *) data;
+ WMEventPtr *pHead, pCur, pNext;
+
+ pHead = (WMEventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
- pNext = pCur->next;
- FreeResource(pCur->clientResource, ClientType);
- free((pointer) pCur);
+ pNext = pCur->next;
+ FreeResource (pCur->clientResource, ClientType);
+ free((pointer) pCur);
}
- free((pointer) pHead);
- eventMask = 0;
- return 1;
+ free((pointer) pHead);
+ eventMask = 0;
+ return 1;
}
static int
-ProcWindowsWMSelectInput(ClientPtr client)
+ProcWindowsWMSelectInput (ClientPtr client)
{
- REQUEST(xWindowsWMSelectInputReq);
- WMEventPtr pEvent, pNewEvent, *pHead;
- XID clientResource;
+ REQUEST(xWindowsWMSelectInputReq);
+ WMEventPtr pEvent, pNewEvent, *pHead;
+ XID clientResource;
- REQUEST_SIZE_MATCH(xWindowsWMSelectInputReq);
+ REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq);
dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
client, DixWriteAccess);
if (stuff->mask != 0) {
if (pHead) {
- /* check for existing entry. */
+ /* check for existing entry. */
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if (pEvent->client == client) {
- pEvent->mask = stuff->mask;
- updateEventMask(pHead);
- return Success;
- }
- }
- }
-
- /* build the entry */
- pNewEvent = (WMEventPtr) malloc(sizeof(WMEventRec));
- if (!pNewEvent)
- return BadAlloc;
- pNewEvent->next = 0;
- pNewEvent->client = client;
- pNewEvent->mask = stuff->mask;
- /*
- * add a resource that will be deleted when
- * the client goes away
- */
- clientResource = FakeClientID(client->index);
- pNewEvent->clientResource = clientResource;
- if (!AddResource(clientResource, ClientType, (pointer) pNewEvent))
- 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.
- */
+ pEvent->mask = stuff->mask;
+ updateEventMask (pHead);
+ return Success;
+ }
+ }
+ }
+
+ /* build the entry */
+ pNewEvent = (WMEventPtr) malloc(sizeof (WMEventRec));
+ if (!pNewEvent)
+ return BadAlloc;
+ pNewEvent->next = 0;
+ pNewEvent->client = client;
+ pNewEvent->mask = stuff->mask;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID (client->index);
+ pNewEvent->clientResource = clientResource;
+ if (!AddResource (clientResource, ClientType, (pointer)pNewEvent))
+ 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 = (WMEventPtr *) malloc(sizeof(WMEventPtr));
- if (!pHead ||
- !AddResource(eventResource, eventResourceType, (pointer) pHead))
- {
- FreeResource(clientResource, RT_NONE);
- return BadAlloc;
- }
- *pHead = 0;
- }
- pNewEvent->next = *pHead;
- *pHead = pNewEvent;
- updateEventMask(pHead);
+ pHead = (WMEventPtr *) malloc(sizeof (WMEventPtr));
+ if (!pHead ||
+ !AddResource (eventResource, eventResourceType, (pointer)pHead))
+ {
+ FreeResource (clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewEvent->next = *pHead;
+ *pHead = pNewEvent;
+ updateEventMask (pHead);
}
else if (stuff->mask == 0) {
- /* delete the interest */
+ /* delete the interest */
if (pHead) {
- pNewEvent = 0;
+ pNewEvent = 0;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
- if (pEvent->client == client)
- break;
- pNewEvent = pEvent;
- }
+ if (pEvent->client == client)
+ break;
+ pNewEvent = pEvent;
+ }
if (pEvent) {
- FreeResource(pEvent->clientResource, ClientType);
- if (pNewEvent)
- pNewEvent->next = pEvent->next;
- else
- *pHead = pEvent->next;
- free(pEvent);
- updateEventMask(pHead);
- }
- }
+ FreeResource (pEvent->clientResource, ClientType);
+ if (pNewEvent)
+ pNewEvent->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ free(pEvent);
+ updateEventMask (pHead);
+ }
+ }
}
else {
- client->errorValue = stuff->mask;
- return BadValue;
+ client->errorValue = stuff->mask;
+ return BadValue;
}
- return Success;
+ return Success;
}
/*
@@ -241,376 +241,376 @@ ProcWindowsWMSelectInput(ClientPtr client)
*/
void
-winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h)
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h)
{
- WMEventPtr *pHead, pEvent;
- ClientPtr client;
- xWindowsWMNotifyEvent se;
+ WMEventPtr *pHead, pEvent;
+ ClientPtr client;
+ xWindowsWMNotifyEvent se;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n",
- type, mask, which, arg, x, y, w, h);
+ ErrorF ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n",
+ type, mask, which, arg, x, y, w, h);
#endif
- dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
- NullClient, DixUnknownAccess);
- if (!pHead)
- return;
+ dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+ NullClient, DixUnknownAccess);
+ if (!pHead)
+ return;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
- client = pEvent->client;
+ client = pEvent->client;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("winWindowsWMSendEvent - x%08x\n", (int) client);
+ ErrorF ("winWindowsWMSendEvent - x%08x\n", (int) client);
#endif
if ((pEvent->mask & mask) == 0) {
- continue;
- }
-#if CYGMULTIWINDOW_DEBUG
- ErrorF("winWindowsWMSendEvent - send\n");
+ continue;
+ }
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winWindowsWMSendEvent - send\n");
#endif
- se.type = type + WMEventBase;
- se.kind = which;
- se.window = window;
- se.arg = arg;
- se.x = x;
- se.y = y;
- se.w = w;
- se.h = h;
- se.time = currentTime.milliseconds;
- WriteEventsToClient(client, 1, (xEvent *) &se);
+ se.type = type + WMEventBase;
+ se.kind = which;
+ se.window = window;
+ se.arg = arg;
+ se.x = x;
+ se.y = y;
+ se.w = w;
+ se.h = h;
+ se.time = currentTime.milliseconds;
+ WriteEventsToClient (client, 1, (xEvent *) &se);
}
}
/* general utility functions */
static int
-ProcWindowsWMDisableUpdate(ClientPtr client)
+ProcWindowsWMDisableUpdate (ClientPtr client)
{
- REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq);
+ REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq);
- //winDisableUpdate();
+ //winDisableUpdate();
- return Success;
+ return Success;
}
static int
-ProcWindowsWMReenableUpdate(ClientPtr client)
+ProcWindowsWMReenableUpdate (ClientPtr client)
{
- REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq);
+ REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq);
- //winEnableUpdate();
+ //winEnableUpdate();
- return Success;
+ return Success;
}
/* window functions */
static int
-ProcWindowsWMSetFrontProcess(ClientPtr client)
+ProcWindowsWMSetFrontProcess (ClientPtr client)
{
- REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq);
-
- //QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0);
-
- return Success;
+ REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq);
+
+ //QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0);
+
+ return Success;
}
/* frame functions */
static int
-ProcWindowsWMFrameGetRect(ClientPtr client)
+ProcWindowsWMFrameGetRect (ClientPtr client)
{
- xWindowsWMFrameGetRectReply rep;
- BoxRec ir;
- RECT rcNew;
+ xWindowsWMFrameGetRectReply rep;
+ BoxRec ir;
+ RECT rcNew;
- REQUEST(xWindowsWMFrameGetRectReq);
+ REQUEST(xWindowsWMFrameGetRectReq);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameGetRect %d %d\n",
- (sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len);
+ ErrorF ("ProcWindowsWMFrameGetRect %d %d\n",
+ (sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len);
#endif
+
+ REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
- REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
if (stuff->frame_rect != 0) {
- ErrorF("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
- return BadValue;
+ ErrorF ("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
+ return BadValue;
}
- /* Store the origin, height, and width in a rectangle structure */
- SetRect(&rcNew, stuff->ix, stuff->iy,
- stuff->ix + stuff->iw, stuff->iy + stuff->ih);
-
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, stuff->ix, stuff->iy,
+ stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
- stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+ ErrorF ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
+ stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih);
#endif
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
AdjustWindowRectEx(&rcNew, stuff->frame_style, FALSE,
stuff->frame_style_ex);
- rep.x = rcNew.left;
- rep.y = rcNew.top;
- rep.w = rcNew.right - rcNew.left;
- rep.h = rcNew.bottom - rcNew.top;
+ rep.x = rcNew.left;
+ rep.y = rcNew.top;
+ rep.w = rcNew.right - rcNew.left;
+ rep.h = rcNew.bottom - rcNew.top;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
- rep.x, rep.y, rep.w, rep.h);
+ ErrorF ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
+ rep.x, rep.y, rep.w, rep.h);
#endif
- WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *) &rep);
- return Success;
+ WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *)&rep);
+ return Success;
}
static int
-ProcWindowsWMFrameDraw(ClientPtr client)
+ProcWindowsWMFrameDraw (ClientPtr client)
{
- REQUEST(xWindowsWMFrameDrawReq);
- WindowPtr pWin;
- win32RootlessWindowPtr pRLWinPriv;
- RECT rcNew;
- int nCmdShow, rc;
- RegionRec newShape;
+ REQUEST(xWindowsWMFrameDrawReq);
+ WindowPtr pWin;
+ win32RootlessWindowPtr pRLWinPriv;
+ RECT rcNew;
+ int nCmdShow, rc;
+ RegionRec newShape;
- REQUEST_SIZE_MATCH(xWindowsWMFrameDrawReq);
+ REQUEST_SIZE_MATCH (xWindowsWMFrameDrawReq);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameDraw\n");
+ ErrorF ("ProcWindowsWMFrameDraw\n");
#endif
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameDraw - Window found\n");
+ ErrorF ("ProcWindowsWMFrameDraw - Window found\n");
#endif
- pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, TRUE);
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, TRUE);
if (pRLWinPriv == 0)
return BadWindow;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
- (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
- (int) stuff->frame_style_ex);
- ErrorF("ProcWindowsWMFrameDraw - %d %d %d %d\n",
- stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ ErrorF ("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
+ (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
+ (int) stuff->frame_style_ex);
+ ErrorF ("ProcWindowsWMFrameDraw - %d %d %d %d\n",
+ stuff->ix, stuff->iy, stuff->iw, stuff->ih);
#endif
- /* Store the origin, height, and width in a rectangle structure */
- SetRect(&rcNew, stuff->ix, stuff->iy,
- stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, stuff->ix, stuff->iy,
+ stuff->ix + stuff->iw, stuff->iy + stuff->ih);
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
AdjustWindowRectEx(&rcNew, stuff->frame_style, FALSE,
stuff->frame_style_ex);
-
- /* Set the window extended style flags */
+
+ /* Set the window extended style flags */
if (!SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, stuff->frame_style_ex)) {
- return BadValue;
+ return BadValue;
}
- /* Set the window standard style flags */
+ /* Set the window standard style flags */
if (!SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, stuff->frame_style)) {
- return BadValue;
+ return BadValue;
}
- /* Flush the window style */
- if (!SetWindowPos(pRLWinPriv->hWnd, NULL,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ /* Flush the window style */
+ if (!SetWindowPos (pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE)) {
- return BadValue;
+ return BadValue;
}
- if (!IsWindowVisible(pRLWinPriv->hWnd))
- nCmdShow = SW_HIDE;
- else
- nCmdShow = SW_SHOWNA;
-
- ShowWindow(pRLWinPriv->hWnd, nCmdShow);
-
- winMWExtWMUpdateIcon(pWin->drawable.id);
-
- if (wBoundingShape(pWin) != NULL) {
- /* wBoundingShape is relative to *inner* origin of window.
- Translate by borderWidth to get the outside-relative position. */
-
- RegionNull(&newShape);
- RegionCopy(&newShape, wBoundingShape(pWin));
- RegionTranslate(&newShape, pWin->borderWidth, pWin->borderWidth);
- winMWExtWMReshapeFrame(pRLWinPriv, &newShape);
- RegionUninit(&newShape);
+ if (!IsWindowVisible(pRLWinPriv->hWnd))
+ nCmdShow = SW_HIDE;
+ else
+ nCmdShow = SW_SHOWNA;
+
+ ShowWindow (pRLWinPriv->hWnd, nCmdShow);
+
+ if (wBoundingShape(pWin) != NULL)
+ {
+
+ /* wBoundingShape is relative to *inner* origin of window.
+ Translate by borderWidth to get the outside-relative position. */
+
+ RegionNull(&newShape);
+ RegionCopy(&newShape, wBoundingShape(pWin));
+ RegionTranslate(&newShape, pWin->borderWidth, pWin->borderWidth);
+ winMWExtWMReshapeFrame (pRLWinPriv, &newShape);
+ RegionUninit(&newShape);
}
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameDraw - done\n");
+ ErrorF ("ProcWindowsWMFrameDraw - done\n");
#endif
- return Success;
+ return Success;
}
static int
ProcWindowsWMFrameSetTitle(ClientPtr client)
{
- unsigned int title_length, title_max;
- char *title_bytes;
+ unsigned int title_length, title_max;
+ char *title_bytes;
- REQUEST(xWindowsWMFrameSetTitleReq);
- WindowPtr pWin;
- win32RootlessWindowPtr pRLWinPriv;
- int rc;
+ REQUEST(xWindowsWMFrameSetTitleReq);
+ WindowPtr pWin;
+ win32RootlessWindowPtr pRLWinPriv;
+ int rc;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameSetTitle\n");
+ ErrorF ("ProcWindowsWMFrameSetTitle\n");
#endif
- REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
+ REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameSetTitle - Window found\n");
+ ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n");
#endif
- title_length = stuff->title_length;
- title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq);
+ title_length = stuff->title_length;
+ title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq);
- if (title_max < title_length)
- return BadValue;
+ if (title_max < title_length)
+ return BadValue;
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameSetTitle - length is valid\n");
+ ErrorF ("ProcWindowsWMFrameSetTitle - length is valid\n");
#endif
- title_bytes = malloc(title_length + 1);
- strncpy(title_bytes, (unsigned char *) &stuff[1], title_length);
- title_bytes[title_length] = '\0';
+ title_bytes = malloc (title_length+1);
+ strncpy (title_bytes, (unsigned char *) &stuff[1], title_length);
+ title_bytes[title_length] = '\0';
- pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
if (pRLWinPriv == 0) {
- free(title_bytes);
- return BadWindow;
+ free (title_bytes);
+ return BadWindow;
}
+
+ /* Flush the window style */
+ SetWindowText (pRLWinPriv->hWnd, title_bytes);
- /* Flush the window style */
- SetWindowText(pRLWinPriv->hWnd, title_bytes);
-
- free(title_bytes);
+ free (title_bytes);
#if CYGMULTIWINDOW_DEBUG
- ErrorF("ProcWindowsWMFrameSetTitle - done\n");
+ ErrorF ("ProcWindowsWMFrameSetTitle - done\n");
#endif
- return Success;
+ return Success;
}
/* dispatch */
static int
-ProcWindowsWMDispatch(ClientPtr client)
+ProcWindowsWMDispatch (ClientPtr client)
{
- REQUEST(xReq);
+ REQUEST(xReq);
switch (stuff->data) {
case X_WindowsWMQueryVersion:
- return ProcWindowsWMQueryVersion(client);
+ return ProcWindowsWMQueryVersion(client);
}
- if (!LocalClient(client))
- return WMErrorBase + WindowsWMClientNotLocal;
+ if (!LocalClient(client))
+ return WMErrorBase + WindowsWMClientNotLocal;
switch (stuff->data) {
case X_WindowsWMSelectInput:
- return ProcWindowsWMSelectInput(client);
+ return ProcWindowsWMSelectInput(client);
case X_WindowsWMDisableUpdate:
- return ProcWindowsWMDisableUpdate(client);
+ return ProcWindowsWMDisableUpdate(client);
case X_WindowsWMReenableUpdate:
- return ProcWindowsWMReenableUpdate(client);
+ return ProcWindowsWMReenableUpdate(client);
case X_WindowsWMSetFrontProcess:
- return ProcWindowsWMSetFrontProcess(client);
+ return ProcWindowsWMSetFrontProcess(client);
case X_WindowsWMFrameGetRect:
- return ProcWindowsWMFrameGetRect(client);
+ return ProcWindowsWMFrameGetRect(client);
case X_WindowsWMFrameDraw:
- return ProcWindowsWMFrameDraw(client);
+ return ProcWindowsWMFrameDraw(client);
case X_WindowsWMFrameSetTitle:
- return ProcWindowsWMFrameSetTitle(client);
+ return ProcWindowsWMFrameSetTitle(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
static void
-SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to)
+SNotifyEvent (xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to)
{
- to->type = from->type;
- to->kind = from->kind;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->window, to->window);
- cpswapl(from->time, to->time);
- cpswapl(from->arg, to->arg);
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->window, to->window);
+ cpswapl (from->time, to->time);
+ cpswapl (from->arg, to->arg);
}
static int
-SProcWindowsWMQueryVersion(ClientPtr client)
+SProcWindowsWMQueryVersion (ClientPtr client)
{
- int n;
+ int n;
- REQUEST(xWindowsWMQueryVersionReq);
- swaps(&stuff->length);
- return ProcWindowsWMQueryVersion(client);
+ REQUEST(xWindowsWMQueryVersionReq);
+ swaps(&stuff->length);
+ return ProcWindowsWMQueryVersion(client);
}
static int
-SProcWindowsWMDispatch(ClientPtr client)
+SProcWindowsWMDispatch (ClientPtr client)
{
- REQUEST(xReq);
+ REQUEST(xReq);
- /* It is bound to be non-local when there is byte swapping */
- if (!LocalClient(client))
- return WMErrorBase + WindowsWMClientNotLocal;
+ /* It is bound to be non-local when there is byte swapping */
+ if (!LocalClient(client))
+ return WMErrorBase + WindowsWMClientNotLocal;
- /* only local clients are allowed WM access */
+ /* only local clients are allowed WM access */
switch (stuff->data) {
case X_WindowsWMQueryVersion:
- return SProcWindowsWMQueryVersion(client);
+ return SProcWindowsWMQueryVersion(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
void
-winWindowsWMExtensionInit(void)
+winWindowsWMExtensionInit (void)
{
- ExtensionEntry *extEntry;
-
- ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
- eventResourceType = CreateNewResourceType(WMFreeEvents, "WMEvent");
- eventResource = FakeClientID(0);
-
- if (ClientType && eventResourceType &&
- (extEntry = AddExtension(WINDOWSWMNAME,
- WindowsWMNumberEvents,
- WindowsWMNumberErrors,
- ProcWindowsWMDispatch,
- SProcWindowsWMDispatch,
+ ExtensionEntry* extEntry;
+
+ ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
+ eventResourceType = CreateNewResourceType(WMFreeEvents, "WMEvent");
+ eventResource = FakeClientID(0);
+
+ if (ClientType && eventResourceType &&
+ (extEntry = AddExtension(WINDOWSWMNAME,
+ WindowsWMNumberEvents,
+ WindowsWMNumberErrors,
+ ProcWindowsWMDispatch,
+ SProcWindowsWMDispatch,
NULL, StandardMinorOpcode))) {
- size_t i;
+ size_t i;
- WMReqCode = (unsigned char) extEntry->base;
- WMErrorBase = extEntry->errorBase;
- WMEventBase = extEntry->eventBase;
- for (i = 0; i < WindowsWMNumberEvents; i++)
- EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent;
+ WMReqCode = (unsigned char)extEntry->base;
+ WMErrorBase = extEntry->errorBase;
+ WMEventBase = extEntry->eventBase;
+ for (i=0; i < WindowsWMNumberEvents; i++)
+ EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent;
}
}
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 3f5d66b96..123c9faee 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -47,8 +47,8 @@
* Global variables
*/
-Bool g_fCursor = TRUE;
-Bool g_fButton[3] = { FALSE, FALSE, FALSE };
+Bool g_fCursor = TRUE;
+Bool g_fButton[3] = { FALSE, FALSE, FALSE };
/*
* Called by winWakeupHandler
@@ -58,179 +58,179 @@ Bool g_fButton[3] = { FALSE, FALSE, FALSE };
LRESULT CALLBACK
winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
- static winScreenInfo *s_pScreenInfo = NULL;
- static ScreenPtr s_pScreen = NULL;
- static HWND s_hwndLastPrivates = NULL;
- static HINSTANCE s_hInstance;
- static Bool s_fTracking = FALSE;
- static unsigned long s_ulServerGeneration = 0;
- static UINT s_uTaskbarRestart = 0;
- int iScanCode;
- int i;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
+ static HWND s_hwndLastPrivates = NULL;
+ static HINSTANCE s_hInstance;
+ static Bool s_fTracking = FALSE;
+ static unsigned long s_ulServerGeneration = 0;
+ static UINT s_uTaskbarRestart = 0;
+ int iScanCode;
+ int i;
#if CYGDEBUG
- winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
+ winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
#endif
-
- /* Watch for server regeneration */
+
+ /* Watch for server regeneration */
if (g_ulServerGeneration != s_ulServerGeneration) {
- /* Store new server generation */
- s_ulServerGeneration = g_ulServerGeneration;
+ /* Store new server generation */
+ s_ulServerGeneration = g_ulServerGeneration;
}
- /* Only retrieve new privates pointers if window handle is null or changed */
- if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates)
+ /* Only retrieve new privates pointers if window handle is null or changed */
+ if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates)
&& (s_pScreenPriv = GetProp(hwnd, WIN_SCR_PROP)) != NULL) {
#if CYGDEBUG
- winDebug("winWindowProc - Setting privates handle\n");
+ winDebug ("winWindowProc - Setting privates handle\n");
#endif
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
- s_hwndLastPrivates = hwnd;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+ s_hwndLastPrivates = hwnd;
}
else if (s_pScreenPriv == NULL) {
- /* For safety, handle case that should never happen */
- s_pScreenInfo = NULL;
- s_pScreen = NULL;
- s_hwndLastPrivates = NULL;
+ /* For safety, handle case that should never happen */
+ s_pScreenInfo = NULL;
+ s_pScreen = NULL;
+ s_hwndLastPrivates = NULL;
}
- /* Branch on message type */
+ /* Branch on message type */
switch (message) {
case WM_TRAYICON:
- return winHandleIconMessage(hwnd, message, wParam, lParam,
- s_pScreenPriv);
+ return winHandleIconMessage (hwnd, message, wParam, lParam,
+ s_pScreenPriv);
case WM_CREATE:
#if CYGDEBUG
- winDebug("winWindowProc - WM_CREATE\n");
+ winDebug ("winWindowProc - WM_CREATE\n");
#endif
-
- /*
- * Add a property to our display window that references
- * this screens' privates.
- *
- * This allows the window procedure to refer to the
- * appropriate window DC and shadow DC for the window that
- * it is processing. We use this to repaint exposed
- * areas of our display window.
- */
- s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams;
- s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
- s_hwndLastPrivates = hwnd;
- s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
- SetProp(hwnd, WIN_SCR_PROP, s_pScreenPriv);
-
- /* Setup tray icon */
+
+ /*
+ * Add a property to our display window that references
+ * this screens' privates.
+ *
+ * This allows the window procedure to refer to the
+ * appropriate window DC and shadow DC for the window that
+ * it is processing. We use this to repaint exposed
+ * areas of our display window.
+ */
+ s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams;
+ s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+ s_hwndLastPrivates = hwnd;
+ s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
+ SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv);
+
+ /* Setup tray icon */
if (!s_pScreenInfo->fNoTrayIcon) {
- /*
- * NOTE: The WM_CREATE message is processed before CreateWindowEx
- * returns, so s_pScreenPriv->hwndScreen is invalid at this point.
- * We go ahead and copy our hwnd parameter over top of the screen
- * privates hwndScreen so that we have a valid value for
- * that member. Otherwise, the tray icon will disappear
- * the first time you move the mouse over top of it.
- */
-
- s_pScreenPriv->hwndScreen = hwnd;
-
- winInitNotifyIcon(s_pScreenPriv);
- }
- return 0;
+ /*
+ * NOTE: The WM_CREATE message is processed before CreateWindowEx
+ * returns, so s_pScreenPriv->hwndScreen is invalid at this point.
+ * We go ahead and copy our hwnd parameter over top of the screen
+ * privates hwndScreen so that we have a valid value for
+ * that member. Otherwise, the tray icon will disappear
+ * the first time you move the mouse over top of it.
+ */
+
+ s_pScreenPriv->hwndScreen = hwnd;
+
+ winInitNotifyIcon (s_pScreenPriv);
+ }
+ return 0;
case WM_DISPLAYCHANGE:
- /*
- WM_DISPLAYCHANGE seems to be sent when the monitor layout or
- any monitor's resolution or depth changes, but it's lParam and
- wParam always indicate the resolution and bpp for the primary
- monitor (so ignore that as we could be on any monitor...)
- */
-
- /* We cannot handle a display mode change during initialization */
- if (s_pScreenInfo == NULL)
- FatalError("winWindowProc - WM_DISPLAYCHANGE - The display "
- "mode changed while we were intializing. This is "
- "very bad and unexpected. Exiting.\n");
-
- /*
- * We do not care about display changes with
- * fullscreen DirectDraw engines, because those engines set
- * their own mode when they become active.
- */
- if (s_pScreenInfo->fFullScreen
- && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ /*
+ WM_DISPLAYCHANGE seems to be sent when the monitor layout or
+ any monitor's resolution or depth changes, but it's lParam and
+ wParam always indicate the resolution and bpp for the primary
+ monitor (so ignore that as we could be on any monitor...)
+ */
+
+ /* We cannot handle a display mode change during initialization */
+ if (s_pScreenInfo == NULL)
+ FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display "
+ "mode changed while we were intializing. This is "
+ "very bad and unexpected. Exiting.\n");
+
+ /*
+ * We do not care about display changes with
+ * fullscreen DirectDraw engines, because those engines set
+ * their own mode when they become active.
+ */
+ if (s_pScreenInfo->fFullScreen
+ && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
#ifdef XWIN_PRIMARYFB
- || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
#endif
)) {
- break;
- }
+ break;
+ }
- ErrorF("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
- "new height: %d new bpp: %d\n",
- LOWORD(lParam), HIWORD(lParam), wParam);
+ ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
+ "new height: %d new bpp: %d\n",
+ LOWORD (lParam), HIWORD (lParam), wParam);
- /* 0 bpp has no defined meaning, ignore this message */
- if (wParam == 0)
- break;
+ /* 0 bpp has no defined meaning, ignore this message */
+ if (wParam == 0)
+ break;
- /*
- * Check for a disruptive change in depth.
- * We can only display a message for a disruptive depth change,
- * we cannot do anything to correct the situation.
- */
- /*
- XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
- has changed as well...
- */
+ /*
+ * Check for a disruptive change in depth.
+ * We can only display a message for a disruptive depth change,
+ * we cannot do anything to correct the situation.
+ */
+ /*
+ XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
+ has changed as well...
+ */
if (s_pScreenInfo->dwBPP !=
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) {
if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
#ifdef XWIN_PRIMARYFB
- || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
#endif
)) {
- /* Cannot display the visual until the depth is restored */
- ErrorF("winWindowProc - Disruptive change in depth\n");
+ /* Cannot display the visual until the depth is restored */
+ ErrorF ("winWindowProc - Disruptive change in depth\n");
- /* Display depth change dialog */
- winDisplayDepthChangeDialog(s_pScreenPriv);
+ /* Display depth change dialog */
+ winDisplayDepthChangeDialog (s_pScreenPriv);
- /* Flag that we have an invalid screen depth */
- s_pScreenPriv->fBadDepth = TRUE;
+ /* Flag that we have an invalid screen depth */
+ s_pScreenPriv->fBadDepth = TRUE;
- /* Minimize the display window */
- ShowWindow(hwnd, SW_MINIMIZE);
+ /* Minimize the display window */
+ ShowWindow (hwnd, SW_MINIMIZE);
}
else {
- /* For GDI, performance may suffer until original depth is restored */
+ /* For GDI, performance may suffer until original depth is restored */
ErrorF
("winWindowProc - Performance may be non-optimal after change in depth\n");
}
}
else {
- /* Flag that we have a valid screen depth */
- s_pScreenPriv->fBadDepth = FALSE;
+ /* Flag that we have a valid screen depth */
+ s_pScreenPriv->fBadDepth = FALSE;
}
- /*
- If we could cheaply check if this WM_DISPLAYCHANGE change
- affects the monitor(s) which this X screen is displayed on
- then we should do so here. For the moment, assume it does.
- (this is probably usually the case so that might be an
- overoptimization)
- */
- {
- /*
- In rootless modes which are monitor or virtual desktop size
- use RandR to resize the X screen
- */
- if ((!s_pScreenInfo->fUserGaveHeightAndWidth) &&
+ /*
+ If we could cheaply check if this WM_DISPLAYCHANGE change
+ affects the monitor(s) which this X screen is displayed on
+ then we should do so here. For the moment, assume it does.
+ (this is probably usually the case so that might be an
+ overoptimization)
+ */
+ {
+ /*
+ In rootless modes which are monitor or virtual desktop size
+ use RandR to resize the X screen
+ */
+ if ((!s_pScreenInfo->fUserGaveHeightAndWidth) &&
(s_pScreenInfo->iResizeMode == resizeWithRandr) && (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
||
@@ -246,25 +246,25 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
fMultiWindow
#endif
)) {
- DWORD dwWidth, dwHeight;
+ DWORD dwWidth, dwHeight;
if (s_pScreenInfo->fMultipleMonitors) {
- /* resize to new virtual desktop size */
- dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ /* resize to new virtual desktop size */
+ dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
else {
- /* resize to new size of specified monitor */
- struct GetMonitorInfoData data;
+ /* resize to new size of specified monitor */
+ struct GetMonitorInfoData data;
if (QueryMonitor(s_pScreenInfo->iMonitor, &data)) {
if (data.bMonitorSpecifiedExists == TRUE) {
- dwWidth = data.monitorWidth;
- dwHeight = data.monitorHeight;
- /*
- XXX: monitor may have changed position,
- so we might need to update xinerama data
- */
+ dwWidth = data.monitorWidth;
+ dwHeight = data.monitorHeight;
+ /*
+ XXX: monitor may have changed position,
+ so we might need to update xinerama data
+ */
}
else {
ErrorF("Monitor number %d no longer exists!\n",
@@ -273,995 +273,1000 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
- /*
- XXX: probably a small bug here: we don't compute the work area
- and allow for task bar
+ /*
+ XXX: probably a small bug here: we don't compute the work area
+ and allow for task bar
- XXX: generally, we don't allow for the task bar being moved after
- the server is started
- */
+ XXX: generally, we don't allow for the task bar being moved after
+ the server is started
+ */
- /* Set screen size to match new size, if it is different to current */
- if ((s_pScreenInfo->dwWidth != dwWidth) ||
+ /* Set screen size to match new size, if it is different to current */
+ if ((s_pScreenInfo->dwWidth != dwWidth) ||
(s_pScreenInfo->dwHeight != dwHeight)) {
- winDoRandRScreenSetSize(s_pScreen,
- dwWidth,
- dwHeight,
+ winDoRandRScreenSetSize(s_pScreen,
+ dwWidth,
+ dwHeight,
(dwWidth * 25.4) /
monitorResolution,
(dwHeight * 25.4) /
monitorResolution);
}
- }
+ }
else {
- /*
- * We can simply recreate the same-sized primary surface when
- * the display dimensions change.
- */
-
- /*
- * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
- * and CreatePrimarySurface function pointers to point
- * to the no operation function, NoopDDA. This allows us
- * to blindly call these functions, even if they are not
- * relevant to the current engine (e.g., Shadow GDI).
- */
+ /*
+ * We can simply recreate the same-sized primary surface when
+ * the display dimensions change.
+ */
+
+ /*
+ * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
+ * and CreatePrimarySurface function pointers to point
+ * to the no operation function, NoopDDA. This allows us
+ * to blindly call these functions, even if they are not
+ * relevant to the current engine (e.g., Shadow GDI).
+ */
winDebug
("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n");
- /* Release the old primary surface */
- (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
+ /* Release the old primary surface */
+ (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
- /* Create the new primary surface */
- (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
+ /* Create the new primary surface */
+ (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
}
- }
+ }
- break;
+ break;
case WM_SIZE:
- {
- SCROLLINFO si;
- RECT rcWindow;
- int iWidth, iHeight;
+ {
+ SCROLLINFO si;
+ RECT rcWindow;
+ int iWidth, iHeight;
#if CYGDEBUG
- winDebug("winWindowProc - WM_SIZE\n");
+ winDebug ("winWindowProc - WM_SIZE\n");
#endif
- /* Break if we do not allow resizing */
- if ((s_pScreenInfo->iResizeMode == notAllowed)
- || !s_pScreenInfo->fDecoration
+ /* Break if we do not allow resizing */
+ if ((s_pScreenInfo->iResizeMode == notAllowed)
+ || !s_pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- || s_pScreenInfo->fRootless
+ || s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || s_pScreenInfo->fMultiWindow
+ || s_pScreenInfo->fMultiWindow
#endif
- || s_pScreenInfo->fFullScreen)
- break;
+ || s_pScreenInfo->fFullScreen)
+ break;
- /* No need to resize if we get minimized */
- if (wParam == SIZE_MINIMIZED)
- return 0;
+ /* No need to resize if we get minimized */
+ if (wParam == SIZE_MINIMIZED)
+ return 0;
- ErrorF("winWindowProc - WM_SIZE - new client area w: %d h: %d\n",
- LOWORD(lParam), HIWORD(lParam));
+ ErrorF ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n",
+ LOWORD (lParam), HIWORD (lParam));
if (s_pScreenInfo->iResizeMode == resizeWithRandr) {
/* Actual resizing is done on WM_EXITSIZEMOVE */
return 0;
- }
+ }
/* Otherwise iResizeMode == resizeWithScrollbars */
- /*
- * Get the size of the whole window, including client area,
- * scrollbars, and non-client area decorations (caption, borders).
- * We do this because we need to check if the client area
- * without scrollbars is large enough to display the whole visual.
- * The new client area size passed by lParam already subtracts
- * the size of the scrollbars if they are currently displayed.
- * So checking is LOWORD(lParam) == visual_width and
- * HIWORD(lParam) == visual_height will never tell us to hide
- * the scrollbars because the client area would always be too small.
- * GetClientRect returns the same sizes given by lParam, so we
- * cannot use GetClientRect either.
- */
- GetWindowRect(hwnd, &rcWindow);
- iWidth = rcWindow.right - rcWindow.left;
- iHeight = rcWindow.bottom - rcWindow.top;
-
- /* Subtract the frame size from the window size. */
- iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight -= (2 * GetSystemMetrics(SM_CYSIZEFRAME)
- + GetSystemMetrics(SM_CYCAPTION));
-
- /*
- * Update scrollbar page sizes.
- * NOTE: If page size == range, then the scrollbar is
- * automatically hidden.
- */
-
- /* Is the naked client area large enough to show the whole visual? */
- if (iWidth < s_pScreenInfo->dwWidth
+ /*
+ * Get the size of the whole window, including client area,
+ * scrollbars, and non-client area decorations (caption, borders).
+ * We do this because we need to check if the client area
+ * without scrollbars is large enough to display the whole visual.
+ * The new client area size passed by lParam already subtracts
+ * the size of the scrollbars if they are currently displayed.
+ * So checking is LOWORD(lParam) == visual_width and
+ * HIWORD(lParam) == visual_height will never tell us to hide
+ * the scrollbars because the client area would always be too small.
+ * GetClientRect returns the same sizes given by lParam, so we
+ * cannot use GetClientRect either.
+ */
+ GetWindowRect (hwnd, &rcWindow);
+ iWidth = rcWindow.right - rcWindow.left;
+ iHeight = rcWindow.bottom - rcWindow.top;
+
+ /* Subtract the frame size from the window size. */
+ iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME);
+ iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME)
+ + GetSystemMetrics (SM_CYCAPTION));
+
+ /*
+ * Update scrollbar page sizes.
+ * NOTE: If page size == range, then the scrollbar is
+ * automatically hidden.
+ */
+
+ /* Is the naked client area large enough to show the whole visual? */
+ if (iWidth < s_pScreenInfo->dwWidth
|| iHeight < s_pScreenInfo->dwHeight) {
- /* Client area too small to display visual, use scrollbars */
- iWidth -= GetSystemMetrics(SM_CXVSCROLL);
- iHeight -= GetSystemMetrics(SM_CYHSCROLL);
- }
-
- /* Set the horizontal scrollbar page size */
- si.cbSize = sizeof(si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- si.nMin = 0;
- si.nMax = s_pScreenInfo->dwWidth - 1;
- si.nPage = iWidth;
- SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
-
- /* Set the vertical scrollbar page size */
- si.cbSize = sizeof(si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- si.nMin = 0;
- si.nMax = s_pScreenInfo->dwHeight - 1;
- si.nPage = iHeight;
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
-
- /*
- * NOTE: Scrollbars may have moved if they were at the
- * far right/bottom, so we query their current position.
- */
-
- /* Get the horizontal scrollbar position and set the offset */
- si.cbSize = sizeof(si);
- si.fMask = SIF_POS;
- GetScrollInfo(hwnd, SB_HORZ, &si);
- s_pScreenInfo->dwXOffset = -si.nPos;
-
- /* Get the vertical scrollbar position and set the offset */
- si.cbSize = sizeof(si);
- si.fMask = SIF_POS;
- GetScrollInfo(hwnd, SB_VERT, &si);
- s_pScreenInfo->dwYOffset = -si.nPos;
- }
- return 0;
+ /* Client area too small to display visual, use scrollbars */
+ iWidth -= GetSystemMetrics (SM_CXVSCROLL);
+ iHeight -= GetSystemMetrics (SM_CYHSCROLL);
+ }
+
+ /* Set the horizontal scrollbar page size */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMin = 0;
+ si.nMax = s_pScreenInfo->dwWidth - 1;
+ si.nPage = iWidth;
+ SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
+
+ /* Set the vertical scrollbar page size */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMin = 0;
+ si.nMax = s_pScreenInfo->dwHeight - 1;
+ si.nPage = iHeight;
+ SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
+
+ /*
+ * NOTE: Scrollbars may have moved if they were at the
+ * far right/bottom, so we query their current position.
+ */
+
+ /* Get the horizontal scrollbar position and set the offset */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_POS;
+ GetScrollInfo (hwnd, SB_HORZ, &si);
+ s_pScreenInfo->dwXOffset = -si.nPos;
+
+ /* Get the vertical scrollbar position and set the offset */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_POS;
+ GetScrollInfo (hwnd, SB_VERT, &si);
+ s_pScreenInfo->dwYOffset = -si.nPos;
+ }
+ return 0;
+
+ case WM_SYSCOMMAND:
+ if (s_pScreenInfo->iResizeMode == resizeWithRandr &&
+ ((wParam & 0xfff0) == SC_MAXIMIZE || (wParam & 0xfff0) == SC_RESTORE))
+ PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0);
+ break;
case WM_ENTERSIZEMOVE:
- ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n");
- break;
+ ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n");
+ break;
case WM_EXITSIZEMOVE:
- ErrorF("winWindowProc - WM_EXITSIZEMOVE\n");
+ ErrorF("winWindowProc - WM_EXITSIZEMOVE\n");
if (s_pScreenInfo->iResizeMode == resizeWithRandr) {
- /* Set screen size to match new client area, if it is different to current */
- RECT rcClient;
- DWORD dwWidth, dwHeight;
+ /* Set screen size to match new client area, if it is different to current */
+ RECT rcClient;
+ DWORD dwWidth, dwHeight;
- GetClientRect(hwnd, &rcClient);
- dwWidth = rcClient.right - rcClient.left;
- dwHeight = rcClient.bottom - rcClient.top;
+ GetClientRect (hwnd, &rcClient);
+ dwWidth = rcClient.right - rcClient.left;
+ dwHeight = rcClient.bottom - rcClient.top;
- if ((s_pScreenInfo->dwWidth != dwWidth) ||
+ if ((s_pScreenInfo->dwWidth != dwWidth) ||
(s_pScreenInfo->dwHeight != dwHeight)) {
- /* mm = dots * (25.4 mm / inch) / (dots / inch) */
- winDoRandRScreenSetSize(s_pScreen,
- dwWidth,
- dwHeight,
- (dwWidth * 25.4) / monitorResolution,
- (dwHeight * 25.4) / monitorResolution);
+ /* mm = dots * (25.4 mm / inch) / (dots / inch) */
+ winDoRandRScreenSetSize(s_pScreen,
+ dwWidth,
+ dwHeight,
+ (dwWidth * 25.4) / monitorResolution,
+ (dwHeight * 25.4) / monitorResolution);
}
}
- break;
+ break;
case WM_VSCROLL:
- {
- SCROLLINFO si;
- int iVertPos;
+ {
+ SCROLLINFO si;
+ int iVertPos;
#if CYGDEBUG
- winDebug("winWindowProc - WM_VSCROLL\n");
+ winDebug ("winWindowProc - WM_VSCROLL\n");
#endif
-
- /* Get vertical scroll bar info */
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- GetScrollInfo(hwnd, SB_VERT, &si);
-
- /* Save the vertical position for comparison later */
- iVertPos = si.nPos;
-
- /*
- * Don't forget:
- * moving the scrollbar to the DOWN, scroll the content UP
- */
+
+ /* Get vertical scroll bar info */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo (hwnd, SB_VERT, &si);
+
+ /* Save the vertical position for comparison later */
+ iVertPos = si.nPos;
+
+ /*
+ * Don't forget:
+ * moving the scrollbar to the DOWN, scroll the content UP
+ */
switch (LOWORD(wParam)) {
- case SB_TOP:
- si.nPos = si.nMin;
- break;
-
- case SB_BOTTOM:
- si.nPos = si.nMax - si.nPage + 1;
- break;
-
- case SB_LINEUP:
- si.nPos -= 1;
- break;
-
- case SB_LINEDOWN:
- si.nPos += 1;
- break;
-
- case SB_PAGEUP:
- si.nPos -= si.nPage;
- break;
-
- case SB_PAGEDOWN:
- si.nPos += si.nPage;
- break;
-
- case SB_THUMBTRACK:
- si.nPos = si.nTrackPos;
- break;
-
- default:
- break;
- }
-
- /*
- * We retrieve the position after setting it,
- * because Windows may adjust it.
- */
- si.fMask = SIF_POS;
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- GetScrollInfo(hwnd, SB_VERT, &si);
-
- /* Scroll the window if the position has changed */
+ case SB_TOP:
+ si.nPos = si.nMin;
+ break;
+
+ case SB_BOTTOM:
+ si.nPos = si.nMax - si.nPage + 1;
+ break;
+
+ case SB_LINEUP:
+ si.nPos -= 1;
+ break;
+
+ case SB_LINEDOWN:
+ si.nPos += 1;
+ break;
+
+ case SB_PAGEUP:
+ si.nPos -= si.nPage;
+ break;
+
+ case SB_PAGEDOWN:
+ si.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ si.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * We retrieve the position after setting it,
+ * because Windows may adjust it.
+ */
+ si.fMask = SIF_POS;
+ SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
+ GetScrollInfo (hwnd, SB_VERT, &si);
+
+ /* Scroll the window if the position has changed */
if (si.nPos != iVertPos) {
- /* Save the new offset for bit block transfers, etc. */
- s_pScreenInfo->dwYOffset = -si.nPos;
+ /* Save the new offset for bit block transfers, etc. */
+ s_pScreenInfo->dwYOffset = -si.nPos;
- /* Change displayed region in the window */
- ScrollWindowEx(hwnd,
- 0,
- iVertPos - si.nPos,
+ /* Change displayed region in the window */
+ ScrollWindowEx (hwnd,
+ 0,
+ iVertPos - si.nPos,
NULL, NULL, NULL, NULL, SW_INVALIDATE);
-
- /* Redraw the window contents */
- UpdateWindow(hwnd);
- }
- }
- return 0;
+
+ /* Redraw the window contents */
+ UpdateWindow (hwnd);
+ }
+ }
+ return 0;
case WM_HSCROLL:
- {
- SCROLLINFO si;
- int iHorzPos;
+ {
+ SCROLLINFO si;
+ int iHorzPos;
#if CYGDEBUG
- winDebug("winWindowProc - WM_HSCROLL\n");
+ winDebug ("winWindowProc - WM_HSCROLL\n");
#endif
-
- /* Get horizontal scroll bar info */
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- GetScrollInfo(hwnd, SB_HORZ, &si);
-
- /* Save the horizontal position for comparison later */
- iHorzPos = si.nPos;
-
- /*
- * Don't forget:
- * moving the scrollbar to the RIGHT, scroll the content LEFT
- */
+
+ /* Get horizontal scroll bar info */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo (hwnd, SB_HORZ, &si);
+
+ /* Save the horizontal position for comparison later */
+ iHorzPos = si.nPos;
+
+ /*
+ * Don't forget:
+ * moving the scrollbar to the RIGHT, scroll the content LEFT
+ */
switch (LOWORD(wParam)) {
- case SB_LEFT:
- si.nPos = si.nMin;
- break;
-
- case SB_RIGHT:
- si.nPos = si.nMax - si.nPage + 1;
- break;
-
- case SB_LINELEFT:
- si.nPos -= 1;
- break;
-
- case SB_LINERIGHT:
- si.nPos += 1;
- break;
-
- case SB_PAGELEFT:
- si.nPos -= si.nPage;
- break;
-
- case SB_PAGERIGHT:
- si.nPos += si.nPage;
- break;
-
- case SB_THUMBTRACK:
- si.nPos = si.nTrackPos;
- break;
-
- default:
- break;
- }
-
- /*
- * We retrieve the position after setting it,
- * because Windows may adjust it.
- */
- si.fMask = SIF_POS;
- SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- GetScrollInfo(hwnd, SB_HORZ, &si);
-
- /* Scroll the window if the position has changed */
+ case SB_LEFT:
+ si.nPos = si.nMin;
+ break;
+
+ case SB_RIGHT:
+ si.nPos = si.nMax - si.nPage + 1;
+ break;
+
+ case SB_LINELEFT:
+ si.nPos -= 1;
+ break;
+
+ case SB_LINERIGHT:
+ si.nPos += 1;
+ break;
+
+ case SB_PAGELEFT:
+ si.nPos -= si.nPage;
+ break;
+
+ case SB_PAGERIGHT:
+ si.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ si.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * We retrieve the position after setting it,
+ * because Windows may adjust it.
+ */
+ si.fMask = SIF_POS;
+ SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
+ GetScrollInfo (hwnd, SB_HORZ, &si);
+
+ /* Scroll the window if the position has changed */
if (si.nPos != iHorzPos) {
- /* Save the new offset for bit block transfers, etc. */
- s_pScreenInfo->dwXOffset = -si.nPos;
+ /* Save the new offset for bit block transfers, etc. */
+ s_pScreenInfo->dwXOffset = -si.nPos;
- /* Change displayed region in the window */
- ScrollWindowEx(hwnd,
- iHorzPos - si.nPos,
+ /* Change displayed region in the window */
+ ScrollWindowEx (hwnd,
+ iHorzPos - si.nPos,
0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
-
- /* Redraw the window contents */
- UpdateWindow(hwnd);
- }
- }
- return 0;
+
+ /* Redraw the window contents */
+ UpdateWindow (hwnd);
+ }
+ }
+ return 0;
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam;
- int iCaptionHeight;
- int iBorderHeight, iBorderWidth;
-
-#if CYGDEBUG
- winDebug("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
- s_pScreenInfo);
+ {
+ MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam;
+ int iCaptionHeight;
+ int iBorderHeight, iBorderWidth;
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
+ s_pScreenInfo);
#endif
- /* Can't do anything without screen info */
- if (s_pScreenInfo == NULL
- || (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
+ /* Can't do anything without screen info */
+ if (s_pScreenInfo == NULL
+ || (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
|| s_pScreenInfo->fFullScreen || !s_pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- || s_pScreenInfo->fRootless
+ || s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || s_pScreenInfo->fMultiWindow
+ || s_pScreenInfo->fMultiWindow
#endif
- )
- break;
-
- /*
- * Here we can override the maximum tracking size, which
- * is the largest size that can be assigned to our window
- * via the sizing border.
- */
-
- /*
- * FIXME: Do we only need to do this once, since our visual size
- * does not change? Does Windows store this value statically
- * once we have set it once?
- */
-
- /* Get the border and caption sizes */
- iCaptionHeight = GetSystemMetrics(SM_CYCAPTION);
- iBorderWidth = 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iBorderHeight = 2 * GetSystemMetrics(SM_CYSIZEFRAME);
-
- /* Allow the full visual to be displayed */
+ )
+ break;
+
+ /*
+ * Here we can override the maximum tracking size, which
+ * is the largest size that can be assigned to our window
+ * via the sizing border.
+ */
+
+ /*
+ * FIXME: Do we only need to do this once, since our visual size
+ * does not change? Does Windows store this value statically
+ * once we have set it once?
+ */
+
+ /* Get the border and caption sizes */
+ iCaptionHeight = GetSystemMetrics (SM_CYCAPTION);
+ iBorderWidth = 2 * GetSystemMetrics (SM_CXSIZEFRAME);
+ iBorderHeight = 2 * GetSystemMetrics (SM_CYSIZEFRAME);
+
+ /* Allow the full visual to be displayed */
pMinMaxInfo->ptMaxTrackSize.x = s_pScreenInfo->dwWidth + iBorderWidth;
- pMinMaxInfo->ptMaxTrackSize.y
- = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight;
- }
- return 0;
+ pMinMaxInfo->ptMaxTrackSize.y
+ = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight;
+ }
+ return 0;
case WM_ERASEBKGND:
#if CYGDEBUG
- winDebug("winWindowProc - WM_ERASEBKGND\n");
+ winDebug ("winWindowProc - WM_ERASEBKGND\n");
#endif
- /*
- * Pretend that we did erase the background but we don't care,
- * the application uses the full window estate. This avoids some
- * flickering when resizing.
- */
- return TRUE;
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * the application uses the full window estate. This avoids some
+ * flickering when resizing.
+ */
+ return TRUE;
case WM_PAINT:
#if CYGDEBUG
- winDebug("winWindowProc - WM_PAINT\n");
+ winDebug ("winWindowProc - WM_PAINT\n");
#endif
- /* Only paint if we have privates and the server is enabled */
- if (s_pScreenPriv == NULL
- || !s_pScreenPriv->fEnabled
- || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive)
+ /* Only paint if we have privates and the server is enabled */
+ if (s_pScreenPriv == NULL
+ || !s_pScreenPriv->fEnabled
+ || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive)
|| s_pScreenPriv->fBadDepth) {
- /* We don't want to paint */
- break;
- }
-
- /* Break out here if we don't have a valid paint routine */
- if (s_pScreenPriv->pwinBltExposedRegions == NULL)
- break;
-
- /* Call the engine dependent repainter */
- (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen);
- return 0;
+ /* We don't want to paint */
+ break;
+ }
+
+ /* Break out here if we don't have a valid paint routine */
+ if (s_pScreenPriv->pwinBltExposedRegions == NULL)
+ break;
+
+ /* Call the engine dependent repainter */
+ (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen);
+ return 0;
case WM_PALETTECHANGED:
- {
+ {
#if CYGDEBUG
- winDebug("winWindowProc - WM_PALETTECHANGED\n");
+ winDebug ("winWindowProc - WM_PALETTECHANGED\n");
#endif
- /*
- * Don't process if we don't have privates or a colormap,
- * or if we have an invalid depth.
- */
- if (s_pScreenPriv == NULL
- || s_pScreenPriv->pcmapInstalled == NULL
- || s_pScreenPriv->fBadDepth)
- break;
-
- /* Return if we caused the palette to change */
+ /*
+ * Don't process if we don't have privates or a colormap,
+ * or if we have an invalid depth.
+ */
+ if (s_pScreenPriv == NULL
+ || s_pScreenPriv->pcmapInstalled == NULL
+ || s_pScreenPriv->fBadDepth)
+ break;
+
+ /* Return if we caused the palette to change */
if ((HWND) wParam == hwnd) {
- /* Redraw the screen */
- (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
- return 0;
- }
-
- /* Reinstall the windows palette */
- (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen);
-
- /* Redraw the screen */
- (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
- return 0;
- }
+ /* Redraw the screen */
+ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
+ return 0;
+ }
+
+ /* Reinstall the windows palette */
+ (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen);
+
+ /* Redraw the screen */
+ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
+ return 0;
+ }
case WM_MOUSEMOVE:
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* We can't do anything without g_pwinPointer */
- if (g_pwinPointer == NULL)
- break;
+ /* We can't do anything without g_pwinPointer */
+ if (g_pwinPointer == NULL)
+ break;
- /* Has the mouse pointer crossed screens? */
- if (s_pScreen != miPointerGetScreen(g_pwinPointer))
- miPointerSetScreen(g_pwinPointer, s_pScreenInfo->dwScreen,
- GET_X_LPARAM(lParam) - s_pScreenInfo->dwXOffset,
- GET_Y_LPARAM(lParam) - s_pScreenInfo->dwYOffset);
+ /* Has the mouse pointer crossed screens? */
+ if (s_pScreen != miPointerGetScreen(g_pwinPointer))
+ miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen,
+ GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
- /* Are we tracking yet? */
+ /* Are we tracking yet? */
if (!s_fTracking) {
- TRACKMOUSEEVENT tme;
-
- /* Setup data structure */
- ZeroMemory(&tme, sizeof(tme));
- tme.cbSize = sizeof(tme);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
-
- /* Call the tracking function */
- if (!TrackMouseEvent(&tme))
- ErrorF("winWindowProc - TrackMouseEvent failed\n");
-
- /* Flag that we are tracking now */
- s_fTracking = TRUE;
- }
-
- /* Hide or show the Windows mouse cursor */
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory (&tme, sizeof (tme));
+ tme.cbSize = sizeof (tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!TrackMouseEvent(&tme))
+ ErrorF ("winWindowProc - TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Hide or show the Windows mouse cursor */
if (g_fSoftwareCursor && g_fCursor &&
(s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer)) {
- /* Hide Windows cursor */
- g_fCursor = FALSE;
- ShowCursor(FALSE);
- }
- else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
+ /* Hide Windows cursor */
+ g_fCursor = FALSE;
+ ShowCursor (FALSE);
+ }
+ else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
&& !s_pScreenInfo->fLessPointer) {
- /* Show Windows cursor */
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
-
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(GET_X_LPARAM(lParam) - s_pScreenInfo->dwXOffset,
- GET_Y_LPARAM(lParam) - s_pScreenInfo->dwYOffset);
- return 0;
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
+ return 0;
case WM_NCMOUSEMOVE:
- /*
- * We break instead of returning 0 since we need to call
- * DefWindowProc to get the mouse cursor changes
- * and min/max/close button highlighting in Windows XP.
- * The Platform SDK says that you should return 0 if you
- * process this message, but it fails to mention that you
- * will give up any default functionality if you do return 0.
- */
-
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* Non-client mouse movement, show Windows cursor */
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Non-client mouse movement, show Windows cursor */
if (g_fSoftwareCursor && !g_fCursor) {
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
- break;
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ break;
case WM_MOUSELEAVE:
- /* Mouse has left our client area */
+ /* Mouse has left our client area */
- /* Flag that we are no longer tracking */
- s_fTracking = FALSE;
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
- /* Show the mouse cursor, if necessary */
+ /* Show the mouse cursor, if necessary */
if (g_fSoftwareCursor && !g_fCursor) {
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
- return 0;
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return 0;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, Button1, wParam);
-
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
+
case WM_LBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture();
- return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button1, wParam);
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, Button2, wParam);
-
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
+
case WM_MBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture();
- return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button2, wParam);
-
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
+
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, Button3, wParam);
-
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
+
case WM_RBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture();
- return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button3, wParam);
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture(hwnd);
+ )
+ SetCapture (hwnd);
return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
wParam);
case WM_XBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture();
+ )
+ ReleaseCapture ();
return winMouseButtonsHandle(s_pScreen, ButtonRelease,
HIWORD(wParam) + 5, wParam);
case WM_TIMER:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* Branch on the timer id */
+ /* Branch on the timer id */
switch (wParam) {
- case WIN_E3B_TIMER_ID:
- /* Send delayed button press */
- winMouseButtonsSendEvent(ButtonPress,
- s_pScreenPriv->iE3BCachedPress);
-
- /* Kill this timer */
- KillTimer(s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
-
- /* Clear screen privates flags */
- s_pScreenPriv->iE3BCachedPress = 0;
- break;
-
- case WIN_POLLING_MOUSE_TIMER_ID:
- {
- POINT point;
- WPARAM wL, wM, wR, wShift, wCtrl;
- LPARAM lPos;
-
- /* Get the current position of the mouse cursor */
- GetCursorPos(&point);
-
- /* Map from screen (-X, -Y) to root (0, 0) */
- point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
- point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
-
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(point.x, point.y);
-
- /* Check if a button was released but we didn't see it */
- GetCursorPos(&point);
- wL = (GetKeyState(VK_LBUTTON) & 0x8000) ? MK_LBUTTON : 0;
- wM = (GetKeyState(VK_MBUTTON) & 0x8000) ? MK_MBUTTON : 0;
- wR = (GetKeyState(VK_RBUTTON) & 0x8000) ? MK_RBUTTON : 0;
- wShift = (GetKeyState(VK_SHIFT) & 0x8000) ? MK_SHIFT : 0;
- wCtrl = (GetKeyState(VK_CONTROL) & 0x8000) ? MK_CONTROL : 0;
- lPos = MAKELPARAM(point.x, point.y);
- if (g_fButton[0] & !wL)
- PostMessage(hwnd, WM_LBUTTONUP, wCtrl | wM | wR | wShift, lPos);
- if (g_fButton[1] & !wM)
- PostMessage(hwnd, WM_MBUTTONUP, wCtrl | wL | wR | wShift, lPos);
- if (g_fButton[2] & !wR)
- PostMessage(hwnd, WM_RBUTTONUP, wCtrl | wL | wM | wShift, lPos);
- }
- }
- return 0;
+ case WIN_E3B_TIMER_ID:
+ /* Send delayed button press */
+ winMouseButtonsSendEvent (ButtonPress,
+ s_pScreenPriv->iE3BCachedPress);
+
+ /* Kill this timer */
+ KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+
+ /* Clear screen privates flags */
+ s_pScreenPriv->iE3BCachedPress = 0;
+ break;
+
+ case WIN_POLLING_MOUSE_TIMER_ID:
+ {
+ POINT point;
+ WPARAM wL, wM, wR, wShift, wCtrl;
+ LPARAM lPos;
+
+ /* Get the current position of the mouse cursor */
+ GetCursorPos (&point);
+
+ /* Map from screen (-X, -Y) to root (0, 0) */
+ point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(point.x , point.y);
+
+ /* Check if a button was released but we didn't see it */
+ GetCursorPos (&point);
+ wL = (GetKeyState (VK_LBUTTON) & 0x8000)?MK_LBUTTON:0;
+ wM = (GetKeyState (VK_MBUTTON) & 0x8000)?MK_MBUTTON:0;
+ wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0;
+ wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0;
+ wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0;
+ lPos = MAKELPARAM(point.x, point.y);
+ if (g_fButton[0] & !wL)
+ PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos);
+ if (g_fButton[1] & !wM)
+ PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos);
+ if (g_fButton[2] & !wR)
+ PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos);
+ }
+ }
+ return 0;
case WM_CTLCOLORSCROLLBAR:
- FatalError("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not "
- "supposed to get this message. Exiting.\n");
- return 0;
+ FatalError ("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not "
+ "supposed to get this message. Exiting.\n");
+ return 0;
case WM_MOUSEWHEEL:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
#if CYGDEBUG
- winDebug("winWindowProc - WM_MOUSEWHEEL\n");
+ winDebug ("winWindowProc - WM_MOUSEWHEEL\n");
#endif
- winMouseWheel(s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
- break;
+ winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
+ break;
case WM_SETFOCUS:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* Restore the state of all mode keys */
- winRestoreModeKeyStates();
+ /* Restore the state of all mode keys */
+ winRestoreModeKeyStates ();
- /* Add the keyboard hook if possible */
- if (g_fKeyboardHookLL)
- g_fKeyboardHookLL = winInstallKeyboardHookLL();
- return 0;
+ /* Add the keyboard hook if possible */
+ if (g_fKeyboardHookLL)
+ g_fKeyboardHookLL = winInstallKeyboardHookLL ();
+ return 0;
case WM_KILLFOCUS:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* Release any pressed keys */
- winKeybdReleaseKeys();
+ /* Release any pressed keys */
+ winKeybdReleaseKeys ();
- /* Remove our keyboard hook if it is installed */
- winRemoveKeyboardHookLL();
- return 0;
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL ();
+ return 0;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /*
- * FIXME: Catching Alt-F4 like this is really terrible. This should
- * be generalized to handle other Windows keyboard signals. Actually,
- * the list keys to catch and the actions to perform when caught should
- * be configurable; that way user's can customize the keys that they
- * need to have passed through to their window manager or apps, or they
- * can remap certain actions to new key codes that do not conflict
- * with the X apps that they are using. Yeah, that'll take awhile.
- */
- if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4
- && (GetKeyState(VK_MENU) & 0x8000))
- || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK
- && (GetKeyState(VK_MENU) & 0x8000)
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * FIXME: Catching Alt-F4 like this is really terrible. This should
+ * be generalized to handle other Windows keyboard signals. Actually,
+ * the list keys to catch and the actions to perform when caught should
+ * be configurable; that way user's can customize the keys that they
+ * need to have passed through to their window manager or apps, or they
+ * can remap certain actions to new key codes that do not conflict
+ * with the X apps that they are using. Yeah, that'll take awhile.
+ */
+ if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4
+ && (GetKeyState (VK_MENU) & 0x8000))
+ || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK
+ && (GetKeyState (VK_MENU) & 0x8000)
&& (GetKeyState(VK_CONTROL) & 0x8000))) {
- /*
- * Better leave this message here, just in case some unsuspecting
- * user enters Alt + F4 and is surprised when the application
- * quits.
- */
- ErrorF("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n");
-
- /* Display Exit dialog */
- winDisplayExitDialog(s_pScreenPriv);
- return 0;
- }
-
- /*
- * Don't do anything for the Windows keys, as focus will soon
- * be returned to Windows. We may be able to trap the Windows keys,
- * but we should determine if that is desirable before doing so.
- */
- if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
- break;
-
- /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */
- if (winIsFakeCtrl_L(message, wParam, lParam))
- return 0;
-
- /*
- * Discard presses generated from Windows auto-repeat
- */
+ /*
+ * Better leave this message here, just in case some unsuspecting
+ * user enters Alt + F4 and is surprised when the application
+ * quits.
+ */
+ ErrorF ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n");
+
+ /* Display Exit dialog */
+ winDisplayExitDialog (s_pScreenPriv);
+ return 0;
+ }
+
+ /*
+ * Don't do anything for the Windows keys, as focus will soon
+ * be returned to Windows. We may be able to trap the Windows keys,
+ * but we should determine if that is desirable before doing so.
+ */
+ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
+ break;
+
+ /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */
+ if (winIsFakeCtrl_L (message, wParam, lParam))
+ return 0;
+
+ /*
+ * Discard presses generated from Windows auto-repeat
+ */
if (lParam & (1 << 30)) {
switch (wParam) {
- /* ago: Pressing LControl while RControl is pressed is
- * Indicated as repeat. Fix this!
- */
- case VK_CONTROL:
- case VK_SHIFT:
- if (winCheckKeyPressed(wParam, lParam))
- return 0;
- break;
- default:
- return 0;
- }
+ /* ago: Pressing LControl while RControl is pressed is
+ * Indicated as repeat. Fix this!
+ */
+ case VK_CONTROL:
+ case VK_SHIFT:
+ if (winCheckKeyPressed(wParam, lParam))
+ return 0;
+ break;
+ default:
+ return 0;
}
+ }
+
+ /* Translate Windows key code to X scan code */
+ winTranslateKey (wParam, lParam, &iScanCode);
- /* Translate Windows key code to X scan code */
- winTranslateKey(wParam, lParam, &iScanCode);
-
- /* Ignore repeats for CapsLock */
- if (wParam == VK_CAPITAL)
- lParam = 1;
+ /* Ignore repeats for CapsLock */
+ if (wParam == VK_CAPITAL)
+ lParam = 1;
- /* Send the key event(s) */
- for (i = 0; i < LOWORD(lParam); ++i)
- winSendKeyEvent(iScanCode, TRUE);
- return 0;
+ /* Send the key event(s) */
+ for (i = 0; i < LOWORD(lParam); ++i)
+ winSendKeyEvent (iScanCode, TRUE);
+ return 0;
case WM_SYSKEYUP:
case WM_KEYUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /*
- * Don't do anything for the Windows keys, as focus will soon
- * be returned to Windows. We may be able to trap the Windows keys,
- * but we should determine if that is desirable before doing so.
- */
- if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
- break;
-
- /* Ignore the fake Ctrl_L that follows an AltGr release */
- if (winIsFakeCtrl_L(message, wParam, lParam))
- return 0;
-
- /* Enqueue a keyup event */
- winTranslateKey(wParam, lParam, &iScanCode);
- winSendKeyEvent(iScanCode, FALSE);
-
- /* Release all pressed shift keys */
- if (wParam == VK_SHIFT)
- winFixShiftKeys(iScanCode);
- return 0;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * Don't do anything for the Windows keys, as focus will soon
+ * be returned to Windows. We may be able to trap the Windows keys,
+ * but we should determine if that is desirable before doing so.
+ */
+ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
+ break;
+
+ /* Ignore the fake Ctrl_L that follows an AltGr release */
+ if (winIsFakeCtrl_L (message, wParam, lParam))
+ return 0;
+
+ /* Enqueue a keyup event */
+ winTranslateKey (wParam, lParam, &iScanCode);
+ winSendKeyEvent (iScanCode, FALSE);
+
+ /* Release all pressed shift keys */
+ if (wParam == VK_SHIFT)
+ winFixShiftKeys (iScanCode);
+ return 0;
case WM_HOTKEY:
- if (s_pScreenPriv == NULL)
- break;
+ if (s_pScreenPriv == NULL)
+ break;
- /* Call the engine-specific hot key handler */
- (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen);
- return 0;
+ /* Call the engine-specific hot key handler */
+ (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen);
+ return 0;
case WM_ACTIVATE:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ break;
- /* TODO: Override display of window when we have a bad depth */
+ /* TODO: Override display of window when we have a bad depth */
if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) {
- ErrorF("winWindowProc - WM_ACTIVATE - Bad depth, trying "
- "to override window activation\n");
+ ErrorF ("winWindowProc - WM_ACTIVATE - Bad depth, trying "
+ "to override window activation\n");
- /* Minimize the window */
- ShowWindow(hwnd, SW_MINIMIZE);
+ /* Minimize the window */
+ ShowWindow (hwnd, SW_MINIMIZE);
- /* Display dialog box */
+ /* Display dialog box */
if (g_hDlgDepthChange != NULL) {
- /* Make the existing dialog box active */
- SetActiveWindow(g_hDlgDepthChange);
- }
+ /* Make the existing dialog box active */
+ SetActiveWindow (g_hDlgDepthChange);
+ }
else {
- /* TODO: Recreate the dialog box and bring to the top */
- ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT);
- }
+ /* TODO: Recreate the dialog box and bring to the top */
+ ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT);
+ }
- /* Don't do any other processing of this message */
- return 0;
- }
+ /* Don't do any other processing of this message */
+ return 0;
+ }
#if CYGDEBUG
- winDebug("winWindowProc - WM_ACTIVATE\n");
+ winDebug ("winWindowProc - WM_ACTIVATE\n");
#endif
- /*
- * Focus is being changed to another window.
- * The other window may or may not belong to
- * our process.
- */
+ /*
+ * Focus is being changed to another window.
+ * The other window may or may not belong to
+ * our process.
+ */
- /* Clear any lingering wheel delta */
- s_pScreenPriv->iDeltaZ = 0;
+ /* Clear any lingering wheel delta */
+ s_pScreenPriv->iDeltaZ = 0;
- /* Reshow the Windows mouse cursor if we are being deactivated */
+ /* Reshow the Windows mouse cursor if we are being deactivated */
if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE && !g_fCursor) {
- /* Show Windows cursor */
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
- return 0;
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return 0;
case WM_ACTIVATEAPP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ break;
#if CYGDEBUG || TRUE
- winDebug("winWindowProc - WM_ACTIVATEAPP\n");
+ winDebug ("winWindowProc - WM_ACTIVATEAPP\n");
#endif
- /* Activate or deactivate */
- s_pScreenPriv->fActive = wParam;
+ /* Activate or deactivate */
+ s_pScreenPriv->fActive = wParam;
- /* Reshow the Windows mouse cursor if we are being deactivated */
+ /* Reshow the Windows mouse cursor if we are being deactivated */
if (g_fSoftwareCursor && !s_pScreenPriv->fActive && !g_fCursor) {
- /* Show Windows cursor */
- g_fCursor = TRUE;
- ShowCursor(TRUE);
- }
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
#ifdef XWIN_CLIPBOARD
- /* Make sure the clipboard chain is ok. */
- winFixClipboardChain();
+ /* Make sure the clipboard chain is ok. */
+ winFixClipboardChain ();
#endif
- /* Call engine specific screen activation/deactivation function */
- (*s_pScreenPriv->pwinActivateApp) (s_pScreen);
+ /* Call engine specific screen activation/deactivation function */
+ (*s_pScreenPriv->pwinActivateApp) (s_pScreen);
#ifdef XWIN_MULTIWINDOWEXTWM
if (s_pScreenPriv->fActive) {
- /* Restack all window unless using built-in wm. */
- if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning)
- winMWExtWMRestackWindows(s_pScreen);
- }
+ /* Restack all window unless using built-in wm. */
+ if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning)
+ winMWExtWMRestackWindows (s_pScreen);
+ }
#endif
- return 0;
+ return 0;
case WM_COMMAND:
switch (LOWORD(wParam)) {
- case ID_APP_EXIT:
- /* Display Exit dialog */
- winDisplayExitDialog(s_pScreenPriv);
- return 0;
+ case ID_APP_EXIT:
+ /* Display Exit dialog */
+ winDisplayExitDialog (s_pScreenPriv);
+ return 0;
#ifdef XWIN_MULTIWINDOW
- case ID_APP_HIDE_ROOT:
- if (s_pScreenPriv->fRootWindowShown)
- ShowWindow(s_pScreenPriv->hwndScreen, SW_HIDE);
- else
- ShowWindow(s_pScreenPriv->hwndScreen, SW_SHOW);
- s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown;
- return 0;
+ case ID_APP_HIDE_ROOT:
+ if (s_pScreenPriv->fRootWindowShown)
+ ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE);
+ else
+ ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW);
+ s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown;
+ return 0;
#endif
- case ID_APP_ABOUT:
- /* Display the About box */
- winDisplayAboutDialog(s_pScreenPriv);
- return 0;
+ case ID_APP_ABOUT:
+ /* Display the About box */
+ winDisplayAboutDialog (s_pScreenPriv);
+ return 0;
- default:
- /* It's probably one of the custom menus... */
- if (HandleCustomWM_COMMAND(0, LOWORD(wParam)))
- return 0;
- }
- break;
+ default:
+ /* It's probably one of the custom menus... */
+ if (HandleCustomWM_COMMAND (0, LOWORD (wParam)))
+ return 0;
+ }
+ break;
- case WM_ENDSESSION:
case WM_GIVEUP:
- /* Tell X that we are giving up */
+ /* Tell X that we are giving up */
#ifdef XWIN_MULTIWINDOW
- if (s_pScreenInfo->fMultiWindow)
- winDeinitMultiWindowWM();
+ if (s_pScreenInfo->fMultiWindow)
+ winDeinitMultiWindowWM ();
#endif
- GiveUp(0);
- return 0;
+ GiveUp (0);
+ return 0;
case WM_CLOSE:
- /* Display Exit dialog */
- winDisplayExitDialog(s_pScreenPriv);
- return 0;
+ /* Display Exit dialog */
+ winDisplayExitDialog (s_pScreenPriv);
+ return 0;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
if (!g_fSoftwareCursor)
SetCursor(s_pScreenPriv->cursor.handle);
- return TRUE;
- }
- break;
+ return TRUE;
+ }
+ break;
#ifdef XWIN_MULTIWINDOWEXTWM
case WM_MANAGE:
- ErrorF("winWindowProc - WM_MANAGE\n");
- s_pScreenInfo->fAnotherWMRunning = FALSE;
+ ErrorF ("winWindowProc - WM_MANAGE\n");
+ s_pScreenInfo->fAnotherWMRunning = FALSE;
if (s_pScreenInfo->fInternalWM) {
- EnumThreadWindows(g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
- //RootlessRepositionWindows (s_pScreen);
- }
- break;
+ EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
+ //RootlessRepositionWindows (s_pScreen);
+ }
+ break;
case WM_UNMANAGE:
- ErrorF("winWindowProc - WM_UNMANAGE\n");
- s_pScreenInfo->fAnotherWMRunning = TRUE;
+ ErrorF ("winWindowProc - WM_UNMANAGE\n");
+ s_pScreenInfo->fAnotherWMRunning = TRUE;
if (s_pScreenInfo->fInternalWM) {
- EnumThreadWindows(g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
- winMWExtWMRestackWindows(s_pScreen);
- }
- break;
+ EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
+ winMWExtWMRestackWindows (s_pScreen);
+ }
+ break;
#endif
default:
if (message == s_uTaskbarRestart) {
- winInitNotifyIcon(s_pScreenPriv);
- }
- break;
+ winInitNotifyIcon (s_pScreenPriv);
+ }
+ break;
}
- return DefWindowProc(hwnd, message, wParam, lParam);
+ return DefWindowProc (hwnd, message, wParam, lParam);
}
diff --git a/include/ddxhooks.h b/include/ddxhooks.h
new file mode 100644
index 000000000..c67f9e05b
--- /dev/null
+++ b/include/ddxhooks.h
@@ -0,0 +1,37 @@
+/*
+ Copyright © 2009 Jon TURNEY
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef DDXHOOKS_H
+#define DDXHOOKS_H
+
+struct _DdxHooks
+{
+ void (*ddxBeforeReset)(void);
+ void (*ddxPushProviders)(void);
+};
+
+typedef struct _DdxHooks DdxHooks;
+
+extern DdxHooks ddxHooks;
+
+#endif /* DDXHOOKS_H */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 3fb641367..67a9c6aee 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -33,8 +33,8 @@
/* Use OsVendorVErrorF */
#undef DDXOSVERRORF
-/* Use ddxBeforeReset */
-#undef DDXBEFORERESET
+/* Use ddxMain */
+#undef DDXMAIN
/* Build DPMS extension */
#undef DPMSExtension
diff --git a/include/opaque.h b/include/opaque.h
index 9ca408ae1..e7f833cbc 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -42,7 +42,7 @@ extern _X_EXPORT volatile char dispatchException;
/* bit values for dispatchException */
#define DE_RESET 1
#define DE_TERMINATE 2
-#define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */
+#define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */
extern _X_EXPORT CARD32 TimeOutValue;
extern _X_EXPORT int ScreenSaverBlanking;
@@ -50,6 +50,7 @@ extern _X_EXPORT int ScreenSaverAllowExposures;
extern _X_EXPORT int defaultScreenSaverBlanking;
extern _X_EXPORT int defaultScreenSaverAllowExposures;
extern _X_EXPORT char *display;
+extern _X_EXPORT int displayfd;
extern _X_EXPORT int defaultBackingStore;
extern _X_EXPORT Bool disableBackingStore;
@@ -74,4 +75,4 @@ extern _X_EXPORT Bool bgNoneRoot;
extern _X_EXPORT Bool CoreDump;
-#endif /* OPAQUE_H */
+#endif /* OPAQUE_H */
diff --git a/include/os.h b/include/os.h
index 4b5b4403f..6e2f62cad 100644
--- a/include/os.h
+++ b/include/os.h
@@ -82,24 +82,24 @@ typedef struct _NewClientRec *NewClientPtr;
#include <stdio.h>
#include <stdarg.h>
-#ifdef DDXBEFORERESET
-extern void ddxBeforeReset(void);
+#ifdef DDXMAIN
+extern _X_HIDDEN void ddxMain(void);
#endif
#ifdef DDXOSVERRORF
-extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args);
+extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args);
#endif
extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
- );
+);
-extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
+extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client*/);
extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
- char * /*data */ ,
- int /*count */ );
+ char* /*data*/,
+ int /*count*/);
-extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client */ );
+extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client*/);
extern _X_EXPORT void FlushAllOutput(void);
@@ -112,6 +112,8 @@ extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ ,
extern _X_EXPORT void ResetOsBuffers(void);
+extern _X_EXPORT int TransIsListening(char *protocol);
+
extern _X_EXPORT void InitConnectionLimits(void);
extern _X_EXPORT void NotifyParentProcess(void);
@@ -122,87 +124,87 @@ extern _X_EXPORT void ResetWellKnownSockets(void);
extern _X_EXPORT void CloseWellKnownConnections(void);
-extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client */ );
+extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/);
extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
- unsigned int /*proto_n */ ,
- char * /*auth_proto */ ,
- unsigned int /*string_n */ ,
- char * /*auth_string */ );
+ unsigned int /*proto_n*/,
+ char* /*auth_proto*/,
+ unsigned int /*string_n*/,
+ char* /*auth_string*/);
extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ ,
- pointer /*closure */ );
+ pointer /*closure*/);
extern _X_EXPORT void CheckConnections(void);
-extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
+extern _X_EXPORT void CloseDownConnection(ClientPtr /*client*/);
-extern _X_EXPORT void AddGeneralSocket(int /*fd */ );
+extern _X_EXPORT void AddGeneralSocket(int /*fd*/);
-extern _X_EXPORT void RemoveGeneralSocket(int /*fd */ );
+extern _X_EXPORT void RemoveGeneralSocket(int /*fd*/);
-extern _X_EXPORT void AddEnabledDevice(int /*fd */ );
+extern _X_EXPORT void AddEnabledDevice(int /*fd*/);
-extern _X_EXPORT void RemoveEnabledDevice(int /*fd */ );
+extern _X_EXPORT void RemoveEnabledDevice(int /*fd*/);
-extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client */ );
+extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client*/);
extern _X_EXPORT void ListenToAllClients(void);
-extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ );
+extern _X_EXPORT void IgnoreClient(ClientPtr /*client*/);
-extern _X_EXPORT void AttendClient(ClientPtr /*client */ );
+extern _X_EXPORT void AttendClient(ClientPtr /*client*/);
-extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ );
+extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client*/);
-extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ );
+extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client*/);
#ifdef XQUARTZ
-extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
+extern void ListenOnOpenFD(int /* fd */, int /* noxauth */);
#endif
extern _X_EXPORT CARD32 GetTimeInMillis(void);
extern _X_EXPORT void AdjustWaitForDelay(pointer /*waitTime */ ,
- unsigned long /*newdelay */ );
+ unsigned long /*newdelay*/);
-typedef struct _OsTimerRec *OsTimerPtr;
+typedef struct _OsTimerRec *OsTimerPtr;
typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ ,
- CARD32 /* time */ ,
- pointer /* arg */ );
+ CARD32 /* time */,
+ pointer /* arg */);
extern _X_EXPORT void TimerInit(void);
-extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ );
+extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */);
#define TimerAbsolute (1<<0)
#define TimerForceOld (1<<1)
extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ ,
- int /* flags */ ,
- CARD32 /* millis */ ,
- OsTimerCallback /* func */ ,
- pointer /* arg */ );
+ int /* flags */,
+ CARD32 /* millis */,
+ OsTimerCallback /* func */,
+ pointer /* arg */);
extern _X_EXPORT void TimerCheck(void);
-extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
-extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ );
+extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */);
+extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */);
extern _X_EXPORT void SetScreenSaverTimer(void);
extern _X_EXPORT void FreeScreenSaverTimer(void);
-extern _X_EXPORT void AutoResetServer(int /*sig */ );
+extern _X_EXPORT void AutoResetServer(int /*sig*/);
-extern _X_EXPORT void GiveUp(int /*sig */ );
+extern _X_EXPORT void GiveUp(int /*sig*/);
extern _X_EXPORT void UseMsg(void);
-extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
+extern _X_EXPORT void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ ,
- int * /*authlen */ ,
- pointer /* client */ );
+ int * /*authlen */,
+ pointer /* client */);
#ifndef _HAVE_XALLOC_DECLS
#define _HAVE_XALLOC_DECLS
@@ -224,7 +226,7 @@ Xcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
*/
extern _X_EXPORT void *
Xrealloc(void * /*ptr */ , unsigned long /*amount */ )
- _X_DEPRECATED;
+ _X_DEPRECATED;
/*
* Use free(3) instead
@@ -291,8 +293,8 @@ XNFvprintf(const char *fmt, va_list va)
_X_ATTRIBUTE_PRINTF(1, 0)
_X_DEPRECATED;
-typedef void (*OsSigHandlerPtr) (int /* sig */ );
-typedef int (*OsSigWrapperPtr) (int /* sig */ );
+typedef void (*OsSigHandlerPtr)(int /* sig */);
+typedef int (*OsSigWrapperPtr)(int /* sig */);
extern _X_EXPORT OsSigHandlerPtr
OsSignal(int /* sig */ , OsSigHandlerPtr /* handler */ );
@@ -308,11 +310,11 @@ UnlockServer(void);
extern _X_EXPORT int
OsLookupColor(int /*screen */ ,
- char * /*name */ ,
- unsigned /*len */ ,
- unsigned short * /*pred */ ,
- unsigned short * /*pgreen */ ,
- unsigned short * /*pblue */ );
+ char * /*name*/,
+ unsigned /*len*/,
+ unsigned short * /*pred*/,
+ unsigned short * /*pgreen*/,
+ unsigned short * /*pblue*/);
extern _X_EXPORT void
OsInit(void);
@@ -362,31 +364,31 @@ CheckUserAuthorization(void);
extern _X_EXPORT int
AddHost(ClientPtr /*client */ ,
- int /*family */ ,
- unsigned /*length */ ,
- const void * /*pAddr */ );
+ int /*family*/,
+ unsigned /*length*/,
+ const void */*pAddr*/);
extern _X_EXPORT Bool
ForEachHostInFamily(int /*family */ ,
- Bool (* /*func */ )(
- unsigned char * /* addr */ ,
- short /* len */ ,
- pointer /* closure */ ),
- pointer /*closure */ );
+ Bool (* /*func*/ )(
+ unsigned char * /* addr */,
+ short /* len */,
+ pointer /* closure */),
+ pointer /*closure*/);
extern _X_EXPORT int
RemoveHost(ClientPtr /*client */ ,
- int /*family */ ,
- unsigned /*length */ ,
- pointer /*pAddr */ );
+ int /*family*/,
+ unsigned /*length*/,
+ pointer /*pAddr*/);
extern _X_EXPORT int
GetHosts(pointer * /*data */ ,
- int * /*pnHosts */ ,
- int * /*pLen */ ,
- BOOL * /*pEnabled */ );
+ int * /*pnHosts*/,
+ int * /*pLen*/,
+ BOOL * /*pEnabled*/);
-typedef struct sockaddr *sockaddrPtr;
+typedef struct sockaddr * sockaddrPtr;
extern _X_EXPORT int
InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
@@ -403,13 +405,13 @@ LocalClientCred(ClientPtr, int *, int *);
#define LCC_ZID_SET (1 << 3)
typedef struct {
- int fieldsSet; /* Bit mask of fields set */
- int euid; /* Effective uid */
- int egid; /* Primary effective group id */
- int nSuppGids; /* Number of supplementary group ids */
- int *pSuppGids; /* Array of supplementary group ids */
- int pid; /* Process id */
- int zoneid; /* Only set on Solaris 10 & later */
+ int fieldsSet; /* Bit mask of fields set */
+ int euid; /* Effective uid */
+ int egid; /* Primary effective group id */
+ int nSuppGids; /* Number of supplementary group ids */
+ int *pSuppGids; /* Array of supplementary group ids */
+ int pid; /* Process id */
+ int zoneid; /* Only set on Solaris 10 & later */
} LocalClientCredRec;
extern _X_EXPORT int
@@ -456,41 +458,41 @@ InitAuthorization(char * /*filename */ );
extern _X_EXPORT int
AuthorizationFromID(XID id,
- unsigned short *name_lenp,
- const char **namep,
+ unsigned short *name_lenp,
+ const char **namep,
unsigned short *data_lenp, char **datap);
extern _X_EXPORT XID
CheckAuthorization(unsigned int /*namelength */ ,
- const char * /*name */ ,
- unsigned int /*datalength */ ,
- const char * /*data */ ,
- ClientPtr /*client */ ,
- const char ** /*reason */
- );
+ const char * /*name*/,
+ unsigned int /*datalength*/,
+ const char * /*data*/,
+ ClientPtr /*client*/,
+ const char ** /*reason*/
+);
extern _X_EXPORT void
ResetAuthorization(void);
extern _X_EXPORT int
RemoveAuthorization(unsigned short name_length,
- const char *name,
+ const char *name,
unsigned short data_length, const char *data);
extern _X_EXPORT int
AddAuthorization(unsigned int /*name_length */ ,
- const char * /*name */ ,
- unsigned int /*data_length */ ,
- char * /*data */ );
+ const char * /*name*/,
+ unsigned int /*data_length*/,
+ char * /*data*/);
#ifdef XCSECURITY
extern _X_EXPORT XID
GenerateAuthorization(unsigned int /* name_length */ ,
- const char * /* name */ ,
- unsigned int /* data_length */ ,
- const char * /* data */ ,
- unsigned int * /* data_length_return */ ,
- char ** /* data_return */ );
+ const char * /* name */,
+ unsigned int /* data_length */,
+ const char * /* data */,
+ unsigned int * /* data_length_return */,
+ char ** /* data_return */);
#endif
extern _X_EXPORT int
@@ -514,10 +516,10 @@ typedef struct {
extern _X_EXPORT CallbackListPtr FlushCallback;
enum ExitCode {
- EXIT_NO_ERROR = 0,
- EXIT_ERR_ABORT = 1,
- EXIT_ERR_CONFIGURE = 2,
- EXIT_ERR_DRIVERS = 3,
+ EXIT_NO_ERROR = 0,
+ EXIT_ERR_ABORT = 1,
+ EXIT_ERR_CONFIGURE = 2,
+ EXIT_ERR_DRIVERS = 3,
};
extern _X_EXPORT void
@@ -568,17 +570,17 @@ typedef enum _LogParameter {
/* Flags for log messages. */
typedef enum {
- X_PROBED, /* Value was probed */
- X_CONFIG, /* Value was given in the config file */
- X_DEFAULT, /* Value is a default */
- X_CMDLINE, /* Value was given on the command line */
- X_NOTICE, /* Notice */
- X_ERROR, /* Error message */
- X_WARNING, /* Warning message */
- X_INFO, /* Informational message */
- X_NONE, /* No prefix */
- X_NOT_IMPLEMENTED, /* Not implemented */
- X_UNKNOWN = -1 /* unknown -- this must always be last */
+ X_PROBED, /* Value was probed */
+ X_CONFIG, /* Value was given in the config file */
+ X_DEFAULT, /* Value is a default */
+ X_CMDLINE, /* Value was given on the command line */
+ X_NOTICE, /* Notice */
+ X_ERROR, /* Error message */
+ X_WARNING, /* Warning message */
+ X_INFO, /* Informational message */
+ X_NONE, /* No prefix */
+ X_NOT_IMPLEMENTED, /* Not implemented */
+ X_UNKNOWN = -1 /* unknown -- this must always be last */
} MessageType;
extern _X_EXPORT const char *
@@ -601,23 +603,23 @@ LogMessageVerb(MessageType type, int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
LogMessage(MessageType type, const char *format, ...)
-_X_ATTRIBUTE_PRINTF(2, 3);
+ _X_ATTRIBUTE_PRINTF(2,3);
extern _X_EXPORT void
LogVHdrMessageVerb(MessageType type, int verb,
- const char *msg_format, va_list msg_args,
- const char *hdr_format, va_list hdr_args)
+ const char *msg_format, va_list msg_args,
+ const char *hdr_format, va_list hdr_args)
_X_ATTRIBUTE_PRINTF(3, 0)
_X_ATTRIBUTE_PRINTF(5, 0);
extern _X_EXPORT void
LogHdrMessageVerb(MessageType type, int verb,
- const char *msg_format, va_list msg_args,
- const char *hdr_format, ...)
+ const char *msg_format, va_list msg_args,
+ const char *hdr_format, ...)
_X_ATTRIBUTE_PRINTF(3, 0)
_X_ATTRIBUTE_PRINTF(5, 6);
extern _X_EXPORT void
LogHdrMessage(MessageType type, const char *msg_format,
- va_list msg_args, const char *hdr_format, ...)
+ va_list msg_args, const char *hdr_format, ...)
_X_ATTRIBUTE_PRINTF(2, 0)
_X_ATTRIBUTE_PRINTF(4, 5);
@@ -637,7 +639,7 @@ _X_ATTRIBUTE_PRINTF(1, 2)
#ifdef DEBUG
#define DebugF ErrorF
#else
-#define DebugF(...) /* */
+#define DebugF(...) /* */
#endif
extern _X_EXPORT void
@@ -652,4 +654,4 @@ LogPrintMarkers(void);
extern _X_EXPORT void
xorg_backtrace(void);
-#endif /* OS_H */
+#endif /* OS_H */
diff --git a/man/Xserver.man b/man/Xserver.man
index 0cd9b941c..a4020139b 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -127,6 +127,13 @@ Not obeyed by all servers.
.B \-core
causes the server to generate a core dump on fatal errors.
.TP 8
+.B \-displayfd \fIfd\fP
+specifies a file descriptor in the launching process. Rather than specify
+a display number, the X server will attempt to listen on successively higher
+display numbers, and upon finding a free one, will write the display number back
+on this file descriptor as a newline-terminated string. The \-pn option is
+ignored when using \-displayfd.
+.TP 8
.B \-deferglyphs \fIwhichfonts\fP
specifies the types of fonts for which the server should attempt to use
deferred glyph loading. \fIwhichfonts\fP can be all (all fonts),
@@ -556,9 +563,6 @@ Outline font directories
.I /tmp/.X11-unix/X\fBn\fP
Unix domain socket for display number \fBn\fP
.TP 30
-.I /usr/adm/X\fBn\fPmsgs
-Error log file for display number \fBn\fP if run from \fIinit\fP(__adminmansuffix__)
-.TP 30
.I __projectroot__/lib/X11/xdm/xdm-errors
Default error log file if the server is run from \fIxdm\fP(1)
.SH "SEE ALSO"
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 6ceae0537..641f796be 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -92,6 +92,7 @@ SOFTWARE.
#include "extension.h"
#include "micmap.h"
#include "globals.h"
+#include "ddxhooks.h"
extern Bool noTestExtensions;
@@ -155,8 +156,8 @@ extern Bool noGEExtension;
#ifndef XFree86LOADER
#define INITARGS void
-typedef void (*InitExtension) (INITARGS);
-#else /* XFree86Loader */
+typedef void (*InitExtension)(INITARGS);
+#else /* XFree86Loader */
#include "loaderProcs.h"
#endif
@@ -202,7 +203,7 @@ extern void XTestExtensionInit(INITARGS);
extern void BigReqExtensionInit(INITARGS);
#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit(INITARGS);
+extern void ScreenSaverExtensionInit (INITARGS);
#endif
#ifdef XV
extern void XvExtensionInit(INITARGS);
@@ -236,7 +237,7 @@ extern void XFree86DGAExtensionInit(INITARGS);
#ifdef GLXEXT
typedef struct __GLXprovider __GLXprovider;
extern __GLXprovider __glXDRISWRastProvider;
-extern void GlxPushProvider(__GLXprovider * impl);
+extern void GlxPushProvider(__GLXprovider *impl);
extern void GlxExtensionInit(INITARGS);
#endif
#ifdef XF86DRI
@@ -277,66 +278,66 @@ typedef struct {
static ExtensionToggle ExtensionToggleList[] = {
/* sort order is extension name string as shown in xdpyinfo */
- {"Generic Events", &noGEExtension},
+ { "Generic Events", &noGEExtension },
#ifdef COMPOSITE
- {"Composite", &noCompositeExtension},
+ { "Composite", &noCompositeExtension },
#endif
#ifdef DAMAGE
- {"DAMAGE", &noDamageExtension},
+ { "DAMAGE", &noDamageExtension },
#endif
#ifdef DBE
- {"DOUBLE-BUFFER", &noDbeExtension},
+ { "DOUBLE-BUFFER", &noDbeExtension },
#endif
#ifdef DPMSExtension
- {"DPMS", &noDPMSExtension},
+ { "DPMS", &noDPMSExtension },
#endif
#ifdef GLXEXT
- {"GLX", &noGlxExtension},
+ { "GLX", &noGlxExtension },
#endif
#ifdef SCREENSAVER
- {"MIT-SCREEN-SAVER", &noScreenSaverExtension},
+ { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
#endif
#ifdef MITSHM
- {SHMNAME, &noMITShmExtension},
+ { SHMNAME, &noMITShmExtension },
#endif
#ifdef RANDR
- {"RANDR", &noRRExtension},
+ { "RANDR", &noRRExtension },
#endif
- {"RENDER", &noRenderExtension},
+ { "RENDER", &noRenderExtension },
#ifdef XCSECURITY
- {"SECURITY", &noSecurityExtension},
+ { "SECURITY", &noSecurityExtension },
#endif
#ifdef RES
- {"X-Resource", &noResExtension},
+ { "X-Resource", &noResExtension },
#endif
#ifdef XF86BIGFONT
- {"XFree86-Bigfont", &noXFree86BigfontExtension},
+ { "XFree86-Bigfont", &noXFree86BigfontExtension },
#endif
#ifdef XFreeXDGA
- {"XFree86-DGA", &noXFree86DGAExtension},
+ { "XFree86-DGA", &noXFree86DGAExtension },
#endif
#ifdef XF86DRI
- {"XFree86-DRI", &noXFree86DRIExtension},
+ { "XFree86-DRI", &noXFree86DRIExtension },
#endif
#ifdef XF86VIDMODE
- {"XFree86-VidModeExtension", &noXFree86VidModeExtension},
+ { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
#endif
#ifdef XFIXES
- {"XFIXES", &noXFixesExtension},
+ { "XFIXES", &noXFixesExtension },
#endif
#ifdef PANORAMIX
- {"XINERAMA", &noPanoramiXExtension},
+ { "XINERAMA", &noPanoramiXExtension },
#endif
- {"XInputExtension", NULL},
- {"XKEYBOARD", NULL},
+ { "XInputExtension", NULL },
+ { "XKEYBOARD", NULL },
#ifdef XSELINUX
- {"SELinux", &noSELinuxExtension},
+ { "SELinux", &noSELinuxExtension },
#endif
- {"XTEST", &noTestExtensions},
+ { "XTEST", &noTestExtensions },
#ifdef XV
- {"XVideo", &noXvExtension},
+ { "XVideo", &noXvExtension },
#endif
- {NULL, NULL}
+ { NULL, NULL }
};
Bool
@@ -345,17 +346,17 @@ EnableDisableExtension(const char *name, Bool enable)
ExtensionToggle *ext = &ExtensionToggleList[0];
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
- if (strcmp(name, ext->name) == 0) {
- if (ext->disablePtr != NULL) {
- *ext->disablePtr = !enable;
- return TRUE;
+ if (strcmp(name, ext->name) == 0) {
+ if (ext->disablePtr != NULL) {
+ *ext->disablePtr = !enable;
+ return TRUE;
}
else {
- /* Extension is always on, impossible to disable */
- return enable; /* okay if they wanted to enable,
- fail if they tried to disable */
- }
- }
+ /* Extension is always on, impossible to disable */
+ return enable; /* okay if they wanted to enable,
+ fail if they tried to disable */
+ }
+ }
}
return FALSE;
@@ -368,20 +369,20 @@ EnableDisableExtensionError(const char *name, Bool enable)
Bool found = FALSE;
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
- if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
- ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
- found = TRUE;
- break;
- }
+ if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
+ ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
+ found = TRUE;
+ break;
+ }
}
if (found == FALSE)
- ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
+ ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
ErrorF("[mi] Only the following extensions can be run-time %s:\n",
- enable ? "enabled" : "disabled");
+ enable ? "enabled" : "disabled");
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
- if (ext->disablePtr != NULL) {
- ErrorF("[mi] %s\n", ext->name);
- }
+ if (ext->disablePtr != NULL) {
+ ErrorF("[mi] %s\n", ext->name);
+ }
}
}
@@ -418,8 +419,8 @@ InitExtensions(int argc, char *argv[])
#endif
#ifdef XV
if (!noXvExtension) {
- XvExtensionInit();
- XvMCExtensionInit();
+ XvExtensionInit();
+ XvMCExtensionInit();
}
#endif
SyncExtensionInit();
@@ -479,7 +480,7 @@ InitExtensions(int argc, char *argv[])
ResExtensionInit();
#endif
#ifdef DMXEXT
- DMXExtensionInit(); /* server-specific extension, cannot be disabled */
+ DMXExtensionInit(); /* server-specific extension, cannot be disabled */
#endif
#ifdef COMPOSITE
if (!noCompositeExtension)
@@ -492,28 +493,35 @@ InitExtensions(int argc, char *argv[])
#ifdef GLXEXT
if (serverGeneration == 1)
+ {
GlxPushProvider(&__glXDRISWRastProvider);
- if (!noGlxExtension)
- GlxExtensionInit();
+
+ if (ddxHooks.ddxPushProviders)
+ {
+ /* a chance for DDX to install providers better than swrast... */
+ ddxHooks.ddxPushProviders();
+ }
+ }
+ if (!noGlxExtension) GlxExtensionInit();
#endif
}
-#else /* XFree86LOADER */
+#else /* XFree86LOADER */
/* List of built-in (statically linked) extensions */
static ExtensionModule staticExtensions[] = {
- {GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL},
- {ShapeExtensionInit, "SHAPE", NULL, NULL, NULL},
+ { GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL},
+ { ShapeExtensionInit, "SHAPE", NULL, NULL, NULL },
#ifdef MITSHM
- {ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL},
+ { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
#endif
- {XInputExtensionInit, "XInputExtension", NULL, NULL, NULL},
+ { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
#ifdef XTEST
- {XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL},
+ { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
#endif
- {BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL},
- {SyncExtensionInit, "SYNC", NULL, NULL, NULL},
- {XkbExtensionInit, XkbName, NULL, NULL, NULL},
- {XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL},
+ { BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL },
+ { SyncExtensionInit, "SYNC", NULL, NULL, NULL },
+ { XkbExtensionInit, XkbName, NULL, NULL, NULL },
+ { XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL },
#ifdef XCSECURITY
{SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL,
NULL},
@@ -524,25 +532,25 @@ static ExtensionModule staticExtensions[] = {
#endif
#ifdef XFIXES
/* must be before Render to layer DisplayCursor correctly */
- {XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL},
+ { XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL },
#endif
#ifdef XF86BIGFONT
{XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension,
NULL, NULL},
#endif
- {RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL},
+ { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
#ifdef RANDR
- {RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL},
+ { RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
#endif
#ifdef COMPOSITE
- {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL},
+ { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL },
#endif
#ifdef DAMAGE
- {DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL},
+ { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
#endif
- {NULL, NULL, NULL, NULL, NULL}
+ { NULL, NULL, NULL, NULL, NULL }
};
-
+
/*ARGSUSED*/ void
InitExtensions(int argc, char *argv[])
{
@@ -551,22 +559,22 @@ InitExtensions(int argc, char *argv[])
static Bool listInitialised = FALSE;
if (!listInitialised) {
- /* Add built-in extensions to the list. */
- for (i = 0; staticExtensions[i].name; i++)
- LoadExtension(&staticExtensions[i], TRUE);
+ /* Add built-in extensions to the list. */
+ for (i = 0; staticExtensions[i].name; i++)
+ LoadExtension(&staticExtensions[i], TRUE);
- /* Sort the extensions according the init dependencies. */
- LoaderSortExtensions();
- listInitialised = TRUE;
+ /* Sort the extensions according the init dependencies. */
+ LoaderSortExtensions();
+ listInitialised = TRUE;
}
for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
- ext = &ExtensionModuleList[i];
- if (ext->initFunc != NULL &&
- (ext->disablePtr == NULL || !*ext->disablePtr)) {
- (ext->initFunc) ();
- }
+ ext = &ExtensionModuleList[i];
+ if (ext->initFunc != NULL &&
+ (ext->disablePtr == NULL || !*ext->disablePtr)) {
+ (ext->initFunc)();
+ }
}
}
-#endif /* XFree86LOADER */
+#endif /* XFree86LOADER */
diff --git a/os/Makefile.am b/os/Makefile.am
index 88914852f..30ce9e1be 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libos.la
-AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS) -DBINDIR=\"$(bindir)\"
SECURERPC_SRCS = rpcauth.c
XDMCP_SRCS = xdmcp.c
diff --git a/os/backtrace.c b/os/backtrace.c
index 81348f417..9d525b545 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -30,6 +30,13 @@
#include <errno.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
#ifdef HAVE_BACKTRACE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
@@ -138,9 +145,12 @@ xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
}
#endif /* HAVE_WALKCONTEXT */
-#ifdef HAVE_PSTACK
+/*
+ fork/exec a program to create a backtrace
+ Returns 0 if successful.
+*/
static int
-xorg_backtrace_pstack(void)
+xorg_backtrace_exec_wrapper(const char *path)
{
pid_t kidpid;
int pipefd[2];
@@ -149,7 +159,7 @@ xorg_backtrace_pstack(void)
return -1;
}
- kidpid = fork1();
+ kidpid = fork();
if (kidpid == -1) {
/* ERROR */
@@ -162,11 +172,13 @@ xorg_backtrace_pstack(void)
seteuid(0);
close(STDIN_FILENO);
close(STDOUT_FILENO);
+ close(STDERR_FILENO);
dup2(pipefd[1], STDOUT_FILENO);
- closefrom(STDERR_FILENO);
+ dup2(pipefd[1], STDERR_FILENO);
+ close(pipefd[1]);
snprintf(parent, sizeof(parent), "%d", getppid());
- execle("/usr/bin/pstack", "pstack", parent, NULL);
+ execle(path, path, parent, NULL, NULL);
exit(1);
}
else {
@@ -185,17 +197,33 @@ xorg_backtrace_pstack(void)
btline[bytesread] = 0;
ErrorF("%s", btline);
}
- else if ((bytesread < 0) || ((errno != EINTR) && (errno != EAGAIN)))
+ else if ((bytesread == 0) || ((errno != EINTR) && (errno != EAGAIN)))
done = 1;
}
close(pipefd[0]);
waitpid(kidpid, &kidstat, 0);
- if (kidstat != 0)
+ if (!(WIFEXITED(kidstat) && WEXITSTATUS(kidstat) == 0)) {
+ ErrorF("%s failed with returncode %d\n", path,
+ WEXITSTATUS(kidstat));
return -1;
+ }
}
return 0;
}
-#endif /* HAVE_PSTACK */
+
+#ifdef HAVE_PSTACK
+static int
+xorg_backtrace_pstack(void)
+{
+ return xorg_backtrace_exec_wrapper("/usr/bin/pstack");
+}
+#endif
+
+static int
+xorg_backtrace_script(void)
+{
+ return xorg_backtrace_exec_wrapper(BINDIR "/xorg-backtrace");
+}
#if defined(HAVE_PSTACK) || defined(HAVE_WALKCONTEXT)
@@ -232,7 +260,8 @@ xorg_backtrace(void)
void
xorg_backtrace(void)
{
- return;
+ if (xorg_backtrace_script() == 0)
+ return;
}
#endif
diff --git a/os/connection.c b/os/connection.c
index d7e21f362..6982b1f10 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -83,25 +83,25 @@ SOFTWARE.
#include <sys/socket.h>
#if defined(TCPCONN) || defined(STREAMSCONN)
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifdef apollo
-#ifndef NO_TCP_H
-#include <netinet/tcp.h>
-#endif
-#else
-#ifdef CSRG_BASED
-#include <sys/param.h>
-#endif
-#include <netinet/tcp.h>
-#endif
-#include <arpa/inet.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# ifdef apollo
+# ifndef NO_TCP_H
+# include <netinet/tcp.h>
+# endif
+# else
+# ifdef CSRG_BASED
+# include <sys/param.h>
+# endif
+# include <netinet/tcp.h>
+# endif
+# include <arpa/inet.h>
#endif
#include <sys/uio.h>
-#endif /* WIN32 */
-#include "misc.h" /* for typedef of pointer */
+#endif /* WIN32 */
+#include "misc.h" /* for typedef of pointer */
#include "osdep.h"
#include <X11/Xpoll.h>
#include "opaque.h"
@@ -111,38 +111,39 @@ SOFTWARE.
#define Pid_t pid_t
#ifdef HAVE_GETPEERUCRED
-#include <ucred.h>
-#include <zone.h>
+# include <ucred.h>
+# include <zone.h>
#endif
#ifdef XSERVER_DTRACE
-#include <sys/types.h>
+# include <sys/types.h>
typedef const char *string;
-#ifndef HAVE_GETPEERUCRED
-#define zoneid_t int
-#endif
-#include "../dix/Xserver-dtrace.h"
+# ifndef HAVE_GETPEERUCRED
+# define zoneid_t int
+# endif
+# include "../dix/Xserver-dtrace.h"
#endif
-static int lastfdesc; /* maximum file descriptor */
+static int lastfdesc; /* maximum file descriptor */
-fd_set WellKnownConnections; /* Listener mask */
-fd_set EnabledDevices; /* mask for input devices that are on */
-fd_set AllSockets; /* select on this */
-fd_set AllClients; /* available clients */
-fd_set LastSelectMask; /* mask returned from last select call */
-fd_set ClientsWithInput; /* clients with FULL requests in buffer */
-fd_set ClientsWriteBlocked; /* clients who cannot receive output */
-fd_set OutputPending; /* clients with reply/event data ready to go */
+fd_set WellKnownConnections; /* Listener mask */
+fd_set EnabledDevices; /* mask for input devices that are on */
+fd_set AllSockets; /* select on this */
+fd_set AllClients; /* available clients */
+fd_set LastSelectMask; /* mask returned from last select call */
+fd_set ClientsWithInput; /* clients with FULL requests in buffer */
+fd_set ClientsWriteBlocked; /* clients who cannot receive output */
+fd_set OutputPending; /* clients with reply/event data ready to go */
int MaxClients = 0;
-Bool NewOutputPending; /* not yet attempted to write some new output */
-Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
-
-static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
-Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or
- equivalent) will send SIGCONT back. */
-Bool PartialNetwork; /* continue even if unable to bind all addrs */
+Bool NewOutputPending; /* not yet attempted to write some new output */
+Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
+
+static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
+Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or
+ equivalent) will send SIGCONT back. */
+static char dynamic_display[7];
+Bool PartialNetwork; /* continue even if unable to bind all addrs */
static Pid_t ParentProcess;
static Bool debug_conns = FALSE;
@@ -248,26 +249,43 @@ ClearConnectionTranslation(void)
}
#endif
-static XtransConnInfo *ListenTransConns = NULL;
-static int *ListenTransFds = NULL;
-static int ListenTransCount;
+static XtransConnInfo *ListenTransConns = NULL;
+static int *ListenTransFds = NULL;
+static int ListenTransCount;
-static void ErrorConnMax(XtransConnInfo /* trans_conn */ );
+static void ErrorConnMax(XtransConnInfo /* trans_conn */);
static XtransConnInfo
-lookup_trans_conn(int fd)
+lookup_trans_conn (int fd)
{
if (ListenTransFds) {
- int i;
+ int i;
- for (i = 0; i < ListenTransCount; i++)
- if (ListenTransFds[i] == fd)
- return ListenTransConns[i];
+ for (i = 0; i < ListenTransCount; i++)
+ if (ListenTransFds[i] == fd)
+ return ListenTransConns[i];
}
return NULL;
}
+int
+TransIsListening(char *protocol)
+{
+ /* look for this transport in the list of listeners */
+ int i;
+ for (i = 0; i < ListenTransCount; i++)
+ {
+ if (!strcmp(protocol, ListenTransConns[i]->transptr->TransName))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
/* Set MaxClients and lastfdesc, and allocate ConnectionTranslation */
void
@@ -283,27 +301,27 @@ InitConnectionLimits(void)
#ifdef HAVE_GETDTABLESIZE
if (lastfdesc < 0)
- lastfdesc = getdtablesize() - 1;
+ lastfdesc = getdtablesize() - 1;
#endif
#ifdef _NFILE
if (lastfdesc < 0)
- lastfdesc = _NFILE - 1;
+ lastfdesc = _NFILE - 1;
#endif
-#endif /* __CYGWIN__ */
+#endif /* __CYGWIN__ */
/* This is the fallback */
if (lastfdesc < 0)
- lastfdesc = MAXSOCKS;
+ lastfdesc = MAXSOCKS;
if (lastfdesc > MAXSELECT)
- lastfdesc = MAXSELECT;
+ lastfdesc = MAXSELECT;
if (lastfdesc > MAXCLIENTS) {
- lastfdesc = MAXCLIENTS;
- if (debug_conns)
- ErrorF("REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
+ lastfdesc = MAXCLIENTS;
+ if (debug_conns)
+ ErrorF( "REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
}
MaxClients = lastfdesc;
@@ -313,7 +331,7 @@ InitConnectionLimits(void)
#if !defined(WIN32)
if (!ConnectionTranslation)
- ConnectionTranslation = (int *) xnfalloc(sizeof(int) * (lastfdesc + 1));
+ ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
#else
InitConnectionTranslation();
#endif
@@ -338,11 +356,11 @@ InitParentProcess(void)
#if !defined(WIN32)
OsSigHandlerPtr handler;
- handler = OsSignal(SIGUSR1, SIG_IGN);
- if (handler == SIG_IGN)
- RunFromSmartParent = TRUE;
+ handler = OsSignal (SIGUSR1, SIG_IGN);
+ if ( handler == SIG_IGN)
+ RunFromSmartParent = TRUE;
OsSignal(SIGUSR1, handler);
- ParentProcess = getppid();
+ ParentProcess = getppid ();
#endif
}
@@ -351,15 +369,31 @@ NotifyParentProcess(void)
{
#if !defined(WIN32)
if (RunFromSmartParent) {
- if (ParentProcess > 1) {
- kill(ParentProcess, SIGUSR1);
- }
+ if (ParentProcess > 1) {
+ kill (ParentProcess, SIGUSR1);
+ }
}
if (RunFromSigStopParent)
- raise(SIGSTOP);
+ raise (SIGSTOP);
+ if (dynamic_display[0]) {
+ write(displayfd, dynamic_display, strlen(dynamic_display));
+ write(displayfd, "\n", 1);
+ }
#endif
}
+static Bool
+TryCreateSocket(int num, int *partial)
+{
+ char port[20];
+
+ snprintf (port, sizeof(port), "%d", atoi (display));
+
+ return _XSERVTransMakeAllCOTSServerListeners(port, partial,
+ &ListenTransCount,
+ &ListenTransConns);
+}
+
/*****************
* CreateWellKnownSockets
* At initialization, create the sockets to listen on for new clients.
@@ -368,9 +402,8 @@ NotifyParentProcess(void)
void
CreateWellKnownSockets(void)
{
- int i;
- int partial;
- char port[20];
+ int i;
+ int partial;
FD_ZERO(&AllSockets);
FD_ZERO(&AllClients);
@@ -384,96 +417,111 @@ CreateWellKnownSockets(void)
ClearConnectionTranslation();
#endif
- FD_ZERO(&WellKnownConnections);
+ FD_ZERO (&WellKnownConnections);
- snprintf(port, sizeof(port), "%d", atoi(display));
+ if (display)
+ {
+ if (TryCreateSocket(atoi(display), &partial) &&
+ (ListenTransCount >= 1))
+ if (!PartialNetwork && partial)
+ FatalError ("Failed to establish all listening sockets");
+ }
+ else /* -displayfd */
+ {
+ Bool found = 0;
+ for (i = 0; i < 65535 - 1024; i++)
+ {
+ ErrorF("Trying to create socket for display number %d\n", i);
+ if (!TryCreateSocket(i, &partial) && !partial)
+ {
+ found = 1;
+ break;
+ }
+ else
+ CloseWellKnownConnections();
+ }
+ if (!found)
+ FatalError("Failed to find a socket to listen on");
+ sprintf(dynamic_display, "%d", i);
+ display = dynamic_display;
+ }
- if ((_XSERVTransMakeAllCOTSServerListeners(port, &partial,
- &ListenTransCount,
- &ListenTransConns) >= 0) &&
- (ListenTransCount >= 1)) {
- if (!PartialNetwork && partial) {
- FatalError("Failed to establish all listening sockets");
- }
- else {
- ListenTransFds = malloc(ListenTransCount * sizeof(int));
+ ListenTransFds = malloc(ListenTransCount * sizeof (int));
for (i = 0; i < ListenTransCount; i++) {
- int fd = _XSERVTransGetConnectionNumber(ListenTransConns[i]);
+ int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i]);
- ListenTransFds[i] = fd;
- FD_SET(fd, &WellKnownConnections);
+ ListenTransFds[i] = fd;
+ FD_SET (fd, &WellKnownConnections);
if (!_XSERVTransIsLocal(ListenTransConns[i])) {
- DefineSelf(fd);
- }
- }
- }
+ DefineSelf (fd);
+ }
}
- if (!XFD_ANYSET(&WellKnownConnections))
+ if (!XFD_ANYSET (&WellKnownConnections))
FatalError
("Cannot establish any listening sockets - Make sure an X server isn't already running");
#if !defined(WIN32)
- OsSignal(SIGPIPE, SIG_IGN);
- OsSignal(SIGHUP, AutoResetServer);
+ OsSignal (SIGPIPE, SIG_IGN);
+ OsSignal (SIGHUP, AutoResetServer);
#endif
- OsSignal(SIGINT, GiveUp);
- OsSignal(SIGTERM, GiveUp);
- XFD_COPYSET(&WellKnownConnections, &AllSockets);
+ OsSignal (SIGINT, GiveUp);
+ OsSignal (SIGTERM, GiveUp);
+ XFD_COPYSET (&WellKnownConnections, &AllSockets);
ResetHosts(display);
InitParentProcess();
#ifdef XDMCP
- XdmcpInit();
+ XdmcpInit ();
#endif
}
void
-ResetWellKnownSockets(void)
+ResetWellKnownSockets (void)
{
int i;
ResetOsBuffers();
for (i = 0; i < ListenTransCount; i++) {
- int status = _XSERVTransResetListener(ListenTransConns[i]);
+ int status = _XSERVTransResetListener (ListenTransConns[i]);
if (status != TRANS_RESET_NOOP) {
if (status == TRANS_RESET_FAILURE) {
- /*
- * ListenTransConns[i] freed by xtrans.
- * Remove it from out list.
- */
-
- FD_CLR(ListenTransFds[i], &WellKnownConnections);
- ListenTransFds[i] = ListenTransFds[ListenTransCount - 1];
- ListenTransConns[i] = ListenTransConns[ListenTransCount - 1];
- ListenTransCount -= 1;
- i -= 1;
- }
+ /*
+ * ListenTransConns[i] freed by xtrans.
+ * Remove it from out list.
+ */
+
+ FD_CLR (ListenTransFds[i], &WellKnownConnections);
+ ListenTransFds[i] = ListenTransFds[ListenTransCount - 1];
+ ListenTransConns[i] = ListenTransConns[ListenTransCount - 1];
+ ListenTransCount -= 1;
+ i -= 1;
+ }
else if (status == TRANS_RESET_NEW_FD) {
- /*
- * A new file descriptor was allocated (the old one was closed)
- */
+ /*
+ * A new file descriptor was allocated (the old one was closed)
+ */
- int newfd = _XSERVTransGetConnectionNumber(ListenTransConns[i]);
+ int newfd = _XSERVTransGetConnectionNumber (ListenTransConns[i]);
- FD_CLR(ListenTransFds[i], &WellKnownConnections);
- ListenTransFds[i] = newfd;
- FD_SET(newfd, &WellKnownConnections);
- }
- }
+ FD_CLR (ListenTransFds[i], &WellKnownConnections);
+ ListenTransFds[i] = newfd;
+ FD_SET(newfd, &WellKnownConnections);
+ }
+ }
}
- ResetAuthorization();
+ ResetAuthorization ();
ResetHosts(display);
/*
* restart XDMCP
*/
#ifdef XDMCP
- XdmcpReset();
+ XdmcpReset ();
#endif
}
@@ -483,13 +531,13 @@ CloseWellKnownConnections(void)
int i;
for (i = 0; i < ListenTransCount; i++)
- _XSERVTransClose(ListenTransConns[i]);
+ _XSERVTransClose (ListenTransConns[i]);
}
static void
-AuthAudit(ClientPtr client, Bool letin,
- struct sockaddr *saddr, int len,
- unsigned int proto_n, char *auth_proto, int auth_id)
+AuthAudit (ClientPtr client, Bool letin,
+ struct sockaddr *saddr, int len,
+ unsigned int proto_n, char *auth_proto, int auth_id)
{
char addr[128];
char client_uid_string[64];
@@ -504,92 +552,92 @@ AuthAudit(ClientPtr client, Bool letin,
strlcpy(addr, "local host", sizeof(addr));
else
switch (saddr->sa_family) {
- case AF_UNSPEC:
+ case AF_UNSPEC:
#if defined(UNIXCONN) || defined(LOCALCONN)
- case AF_UNIX:
+ case AF_UNIX:
#endif
- strlcpy(addr, "local host", sizeof(addr));
- break;
+ strlcpy(addr, "local host", sizeof(addr));
+ break;
#if defined(TCPCONN) || defined(STREAMSCONN)
- case AF_INET:
- snprintf(addr, sizeof(addr), "IP %s",
- inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr));
- break;
+ case AF_INET:
+ snprintf(addr, sizeof(addr), "IP %s",
+ inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr));
+ break;
#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6:{
- char ipaddr[INET6_ADDRSTRLEN];
-
- inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr,
- ipaddr, sizeof(ipaddr));
- snprintf(addr, sizeof(addr), "IP %s", ipaddr);
- }
- break;
+ case AF_INET6: {
+ char ipaddr[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr,
+ ipaddr, sizeof(ipaddr));
+ snprintf(addr, sizeof(addr), "IP %s", ipaddr);
+ }
+ break;
#endif
#endif
- default:
- strlcpy(addr, "unknown address", sizeof(addr));
- }
+ default:
+ strlcpy(addr, "unknown address", sizeof(addr));
+ }
if (GetLocalClientCreds(client, &lcc) != -1) {
- int slen; /* length written to client_uid_string */
-
- strcpy(client_uid_string, " ( ");
- slen = 3;
-
- if (lcc->fieldsSet & LCC_UID_SET) {
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "uid=%ld ", (long) lcc->euid);
- slen = strlen(client_uid_string);
- }
-
- if (lcc->fieldsSet & LCC_GID_SET) {
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "gid=%ld ", (long) lcc->egid);
- slen = strlen(client_uid_string);
- }
-
- if (lcc->fieldsSet & LCC_PID_SET) {
-#ifdef XSERVER_DTRACE
- client_pid = lcc->pid;
+ int slen; /* length written to client_uid_string */
+
+ strcpy(client_uid_string, " ( ");
+ slen = 3;
+
+ if (lcc->fieldsSet & LCC_UID_SET) {
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "uid=%ld ", (long) lcc->euid);
+ slen = strlen(client_uid_string);
+ }
+
+ if (lcc->fieldsSet & LCC_GID_SET) {
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "gid=%ld ", (long) lcc->egid);
+ slen = strlen(client_uid_string);
+ }
+
+ if (lcc->fieldsSet & LCC_PID_SET) {
+#ifdef XSERVER_DTRACE
+ client_pid = lcc->pid;
#endif
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "pid=%ld ", (long) lcc->pid);
- slen = strlen(client_uid_string);
- }
-
- if (lcc->fieldsSet & LCC_ZID_SET) {
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "pid=%ld ", (long) lcc->pid);
+ slen = strlen(client_uid_string);
+ }
+
+ if (lcc->fieldsSet & LCC_ZID_SET) {
#ifdef XSERVER_DTRACE
- client_zid = lcc->zoneid;
-#endif
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "zoneid=%ld ", (long) lcc->zoneid);
- slen = strlen(client_uid_string);
- }
-
- snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen,
- ")");
- FreeLocalClientCreds(lcc);
+ client_zid = lcc->zoneid;
+#endif
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "zoneid=%ld ", (long) lcc->zoneid);
+ slen = strlen(client_uid_string);
+ }
+
+ snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen,
+ ")");
+ FreeLocalClientCreds(lcc);
}
else {
- client_uid_string[0] = '\0';
+ client_uid_string[0] = '\0';
}
-
+
#ifdef XSERVER_DTRACE
XSERVER_CLIENT_AUTH(client->index, addr, client_pid, client_zid);
#endif
if (auditTrailLevel > 1) {
- if (proto_n)
- AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
- client->index, letin ? "connected" : "rejected", addr,
- client_uid_string, (int) proto_n, auth_proto, auth_id);
- else
- AuditF("client %d %s from %s%s\n",
- client->index, letin ? "connected" : "rejected", addr,
- client_uid_string);
+ if (proto_n)
+ AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
+ client->index, letin ? "connected" : "rejected", addr,
+ client_uid_string, (int)proto_n, auth_proto, auth_id);
+ else
+ AuditF("client %d %s from %s%s\n",
+ client->index, letin ? "connected" : "rejected", addr,
+ client_uid_string);
}
}
@@ -598,9 +646,9 @@ XID
AuthorizationIDOfClient(ClientPtr client)
{
if (client->osPrivate)
- return ((OsCommPtr) client->osPrivate)->auth_id;
+ return ((OsCommPtr)client->osPrivate)->auth_id;
else
- return None;
+ return None;
}
/*****************************************************************
@@ -623,24 +671,24 @@ AuthorizationIDOfClient(ClientPtr client)
*****************************************************************/
const char *
-ClientAuthorized(ClientPtr client,
- unsigned int proto_n, char *auth_proto,
- unsigned int string_n, char *auth_string)
+ClientAuthorized(ClientPtr client,
+ unsigned int proto_n, char *auth_proto,
+ unsigned int string_n, char *auth_string)
{
- OsCommPtr priv;
- Xtransaddr *from = NULL;
- int family;
- int fromlen;
- XID auth_id;
- const char *reason = NULL;
- XtransConnInfo trans_conn;
-
- priv = (OsCommPtr) client->osPrivate;
+ OsCommPtr priv;
+ Xtransaddr *from = NULL;
+ int family;
+ int fromlen;
+ XID auth_id;
+ const char *reason = NULL;
+ XtransConnInfo trans_conn;
+
+ priv = (OsCommPtr)client->osPrivate;
trans_conn = priv->trans_conn;
/* Allow any client to connect without authorization on a launchd socket,
because it is securely created -- this prevents a race condition on launch */
- if (trans_conn->flags & TRANS_NOXAUTH) {
+ if(trans_conn->flags & TRANS_NOXAUTH) {
auth_id = (XID) 0L;
}
else {
@@ -651,30 +699,30 @@ ClientAuthorized(ClientPtr client,
if (auth_id == (XID) ~0L) {
if (_XSERVTransGetPeerAddr(trans_conn, &family, &fromlen, &from) != -1) {
- if (InvalidHost((struct sockaddr *) from, fromlen, client))
- AuthAudit(client, FALSE, (struct sockaddr *) from,
- fromlen, proto_n, auth_proto, auth_id);
+ if (InvalidHost ((struct sockaddr *) from, fromlen, client))
+ AuthAudit(client, FALSE, (struct sockaddr *) from,
+ fromlen, proto_n, auth_proto, auth_id);
else {
- auth_id = (XID) 0;
+ auth_id = (XID) 0;
#ifdef XSERVER_DTRACE
- if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
+ if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
#else
- if (auditTrailLevel > 1)
+ if (auditTrailLevel > 1)
#endif
- AuthAudit(client, TRUE,
- (struct sockaddr *) from, fromlen,
- proto_n, auth_proto, auth_id);
- }
-
- free(from);
- }
-
- if (auth_id == (XID) ~0L) {
- if (reason)
- return reason;
- else
- return "Client is not authorized to connect to Server";
- }
+ AuthAudit(client, TRUE,
+ (struct sockaddr *) from, fromlen,
+ proto_n, auth_proto, auth_id);
+ }
+
+ free(from);
+ }
+
+ if (auth_id == (XID) ~0L) {
+ if (reason)
+ return reason;
+ else
+ return "Client is not authorized to connect to Server";
+ }
}
#ifdef XSERVER_DTRACE
else if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
@@ -683,11 +731,11 @@ ClientAuthorized(ClientPtr client,
#endif
{
if (_XSERVTransGetPeerAddr(trans_conn, &family, &fromlen, &from) != -1) {
- AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
- proto_n, auth_proto, auth_id);
+ AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
+ proto_n, auth_proto, auth_id);
- free(from);
- }
+ free(from);
+ }
}
priv->auth_id = auth_id;
priv->conn_time = 0;
@@ -695,7 +743,7 @@ ClientAuthorized(ClientPtr client,
#ifdef XDMCP
/* indicate to Xdmcp protocol that we've opened new client */
XdmcpOpenDisplay(priv->fd);
-#endif /* XDMCP */
+#endif /* XDMCP */
XaceHook(XACE_AUTH_AVAIL, client, auth_id);
@@ -705,35 +753,35 @@ ClientAuthorized(ClientPtr client,
* true purpose of the selfhosts list is to see who may change the
* access control list.
*/
- return ((char *) NULL);
+ return((char *)NULL);
}
static ClientPtr
-AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
+AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
{
- OsCommPtr oc;
- ClientPtr client;
-
+ OsCommPtr oc;
+ ClientPtr client;
+
if (
#ifndef WIN32
- fd >= lastfdesc
+ fd >= lastfdesc
#else
- XFD_SETCOUNT(&AllClients) >= MaxClients
+ XFD_SETCOUNT(&AllClients) >= MaxClients
#endif
- )
- return NullClient;
+ )
+ return NullClient;
oc = malloc(sizeof(OsCommRec));
if (!oc)
- return NullClient;
+ return NullClient;
oc->trans_conn = trans_conn;
oc->fd = fd;
- oc->input = (ConnectionInputPtr) NULL;
- oc->output = (ConnectionOutputPtr) NULL;
+ oc->input = (ConnectionInputPtr)NULL;
+ oc->output = (ConnectionOutputPtr)NULL;
oc->auth_id = None;
oc->conn_time = conn_time;
if (!(client = NextAvailableClient((pointer) oc))) {
- free(oc);
- return NullClient;
+ free(oc);
+ return NullClient;
}
oc->local_client = ComputeLocalClient(client);
#if !defined(WIN32)
@@ -752,11 +800,11 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
#ifdef DEBUG
ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n",
- client->index, fd);
+ client->index, fd);
#endif
#ifdef XSERVER_DTRACE
XSERVER_CLIENT_CONNECT(client->index, fd);
-#endif
+#endif
return client;
}
@@ -771,82 +819,82 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
/*ARGSUSED*/ Bool
EstablishNewConnections(ClientPtr clientUnused, pointer closure)
{
- fd_set readyconnections; /* set of listeners that are ready */
- int curconn; /* fd of listener that's ready */
- register int newconn; /* fd of new client */
+ fd_set readyconnections; /* set of listeners that are ready */
+ int curconn; /* fd of listener that's ready */
+ register int newconn; /* fd of new client */
CARD32 connect_time;
register int i;
register ClientPtr client;
register OsCommPtr oc;
fd_set tmask;
- XFD_ANDSET(&tmask, (fd_set *) closure, &WellKnownConnections);
+ XFD_ANDSET (&tmask, (fd_set*)closure, &WellKnownConnections);
XFD_COPYSET(&tmask, &readyconnections);
if (!XFD_ANYSET(&readyconnections))
- return TRUE;
+ return TRUE;
connect_time = GetTimeInMillis();
/* kill off stragglers */
for (i = 1; i < currentMaxClients; i++) {
if ((client = clients[i])) {
- oc = (OsCommPtr) (client->osPrivate);
- if ((oc && (oc->conn_time != 0) &&
- (connect_time - oc->conn_time) >= TimeOutValue) ||
- (client->noClientException != Success && !client->clientGone))
- CloseDownClient(client);
- }
+ oc = (OsCommPtr)(client->osPrivate);
+ if ((oc && (oc->conn_time != 0) &&
+ (connect_time - oc->conn_time) >= TimeOutValue) ||
+ (client->noClientException != Success && !client->clientGone))
+ CloseDownClient(client);
+ }
}
#ifndef WIN32
for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
- while (readyconnections.fds_bits[i])
+ while (readyconnections.fds_bits[i])
#else
- for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
+ for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
#endif
- {
- XtransConnInfo trans_conn, new_trans_conn;
- int status;
+ {
+ XtransConnInfo trans_conn, new_trans_conn;
+ int status;
#ifndef WIN32
- curconn = mffs(readyconnections.fds_bits[i]) - 1;
- readyconnections.fds_bits[i] &= ~((fd_mask) 1 << curconn);
- curconn += (i * (sizeof(fd_mask) * 8));
+ curconn = mffs (readyconnections.fds_bits[i]) - 1;
+ readyconnections.fds_bits[i] &= ~((fd_mask)1 << curconn);
+ curconn += (i * (sizeof(fd_mask)*8));
#else
- curconn = XFD_FD(&readyconnections, i);
+ curconn = XFD_FD(&readyconnections, i);
#endif
- if ((trans_conn = lookup_trans_conn(curconn)) == NULL)
- continue;
+ if ((trans_conn = lookup_trans_conn (curconn)) == NULL)
+ continue;
- if ((new_trans_conn = _XSERVTransAccept(trans_conn, &status)) == NULL)
- continue;
+ if ((new_trans_conn = _XSERVTransAccept (trans_conn, &status)) == NULL)
+ continue;
- newconn = _XSERVTransGetConnectionNumber(new_trans_conn);
+ newconn = _XSERVTransGetConnectionNumber (new_trans_conn);
if (newconn < lastfdesc) {
- int clientid;
+ int clientid;
#if !defined(WIN32)
- clientid = ConnectionTranslation[newconn];
+ clientid = ConnectionTranslation[newconn];
#else
- clientid = GetConnectionTranslation(newconn);
+ clientid = GetConnectionTranslation(newconn);
#endif
- if (clientid && (client = clients[clientid]))
- CloseDownClient(client);
- }
+ if(clientid && (client = clients[clientid]))
+ CloseDownClient(client);
+ }
- _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
+ _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
- if (trans_conn->flags & TRANS_NOXAUTH)
- new_trans_conn->flags = new_trans_conn->flags | TRANS_NOXAUTH;
+ if(trans_conn->flags & TRANS_NOXAUTH)
+ new_trans_conn->flags = new_trans_conn->flags | TRANS_NOXAUTH;
if (!AllocNewConnection(new_trans_conn, newconn, connect_time)) {
- ErrorConnMax(new_trans_conn);
- _XSERVTransClose(new_trans_conn);
- }
- }
+ ErrorConnMax(new_trans_conn);
+ _XSERVTransClose(new_trans_conn);
+ }
+ }
#ifndef WIN32
-}
+ }
#endif
-return TRUE;
+ return TRUE;
}
#define NOROOM "Maximum number of clients reached"
@@ -856,12 +904,12 @@ return TRUE;
* Fail a connection due to lack of client or file descriptor space
************/
-#define BOTIMEOUT 200 /* in milliseconds */
+#define BOTIMEOUT 200 /* in milliseconds */
static void
ErrorConnMax(XtransConnInfo trans_conn)
{
- int fd = _XSERVTransGetConnectionNumber(trans_conn);
+ int fd = _XSERVTransGetConnectionNumber (trans_conn);
xConnSetupPrefix csp;
char pad[3] = { 0, 0, 0 };
struct iovec iov[3];
@@ -873,31 +921,31 @@ ErrorConnMax(XtransConnInfo trans_conn)
/* if these seems like a lot of trouble to go to, it probably is */
waittime.tv_sec = BOTIMEOUT / MILLI_PER_SECOND;
waittime.tv_usec = (BOTIMEOUT % MILLI_PER_SECOND) *
- (1000000 / MILLI_PER_SECOND);
+ (1000000 / MILLI_PER_SECOND);
FD_ZERO(&mask);
FD_SET(fd, &mask);
- (void) Select(fd + 1, &mask, NULL, NULL, &waittime);
+ (void)Select(fd + 1, &mask, NULL, NULL, &waittime);
/* try to read the byte-order of the connection */
- (void) _XSERVTransRead(trans_conn, &byteOrder, 1);
+ (void)_XSERVTransRead(trans_conn, &byteOrder, 1);
if ((byteOrder == 'l') || (byteOrder == 'B')) {
- csp.success = xFalse;
- csp.lengthReason = sizeof(NOROOM) - 1;
- csp.length = (sizeof(NOROOM) + 2) >> 2;
- csp.majorVersion = X_PROTOCOL;
- csp.minorVersion = X_PROTOCOL_REVISION;
- if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
+ csp.success = xFalse;
+ csp.lengthReason = sizeof(NOROOM) - 1;
+ csp.length = (sizeof(NOROOM) + 2) >> 2;
+ csp.majorVersion = X_PROTOCOL;
+ csp.minorVersion = X_PROTOCOL_REVISION;
+ if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
(!(*(char *) &whichbyte) && (byteOrder == 'l'))) {
- swaps(&csp.majorVersion);
- swaps(&csp.minorVersion);
- swaps(&csp.length);
- }
- iov[0].iov_len = sz_xConnSetupPrefix;
- iov[0].iov_base = (char *) &csp;
- iov[1].iov_len = csp.lengthReason;
- iov[1].iov_base = NOROOM;
- iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3;
- iov[2].iov_base = pad;
- (void) _XSERVTransWritev(trans_conn, iov, 3);
+ swaps(&csp.majorVersion);
+ swaps(&csp.minorVersion);
+ swaps(&csp.length);
+ }
+ iov[0].iov_len = sz_xConnSetupPrefix;
+ iov[0].iov_base = (char *) &csp;
+ iov[1].iov_len = csp.lengthReason;
+ iov[1].iov_base = NOROOM;
+ iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3;
+ iov[2].iov_base = pad;
+ (void)_XSERVTransWritev(trans_conn, iov, 3);
}
}
@@ -912,26 +960,26 @@ CloseDownFileDescriptor(OsCommPtr oc)
int connection = oc->fd;
if (oc->trans_conn) {
- _XSERVTransDisconnect(oc->trans_conn);
- _XSERVTransClose(oc->trans_conn);
+ _XSERVTransDisconnect(oc->trans_conn);
+ _XSERVTransClose(oc->trans_conn);
}
#ifndef WIN32
ConnectionTranslation[connection] = 0;
#else
SetConnectionTranslation(connection, 0);
-#endif
+#endif
FD_CLR(connection, &AllSockets);
FD_CLR(connection, &AllClients);
FD_CLR(connection, &ClientsWithInput);
FD_CLR(connection, &GrabImperviousClients);
if (GrabInProgress) {
- FD_CLR(connection, &SavedAllSockets);
- FD_CLR(connection, &SavedAllClients);
- FD_CLR(connection, &SavedClientsWithInput);
+ FD_CLR(connection, &SavedAllSockets);
+ FD_CLR(connection, &SavedAllClients);
+ FD_CLR(connection, &SavedClientsWithInput);
}
FD_CLR(connection, &ClientsWriteBlocked);
if (!XFD_ANYSET(&ClientsWriteBlocked))
- AnyClientsWriteBlocked = FALSE;
+ AnyClientsWriteBlocked = FALSE;
FD_CLR(connection, &OutputPending);
}
@@ -948,12 +996,12 @@ void
CheckConnections(void)
{
#ifndef WIN32
- fd_mask mask;
+ fd_mask mask;
#endif
- fd_set tmask;
- int curclient, curoff;
- int i;
- struct timeval notime;
+ fd_set tmask;
+ int curclient, curoff;
+ int i;
+ struct timeval notime;
int r;
#ifdef WIN32
@@ -965,34 +1013,34 @@ CheckConnections(void)
#ifndef WIN32
for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
- mask = AllClients.fds_bits[i];
+ mask = AllClients.fds_bits[i];
while (mask) {
- curoff = mffs(mask) - 1;
- curclient = curoff + (i * (sizeof(fd_mask) * 8));
+ curoff = mffs (mask) - 1;
+ curclient = curoff + (i * (sizeof(fd_mask)*8));
FD_ZERO(&tmask);
FD_SET(curclient, &tmask);
do {
- r = Select(curclient + 1, &tmask, NULL, NULL, &notime);
+ r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
} while (r < 0 && (errno == EINTR || errno == EAGAIN));
if (r < 0)
if (ConnectionTranslation[curclient] > 0)
CloseDownClient(clients[ConnectionTranslation[curclient]]);
- mask &= ~((fd_mask) 1 << curoff);
- }
- }
+ mask &= ~((fd_mask)1 << curoff);
+ }
+ }
#else
XFD_COPYSET(&AllClients, &savedAllClients);
for (i = 0; i < XFD_SETCOUNT(&savedAllClients); i++) {
- curclient = XFD_FD(&savedAllClients, i);
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
+ curclient = XFD_FD(&savedAllClients, i);
+ FD_ZERO(&tmask);
+ FD_SET(curclient, &tmask);
do {
- r = Select(curclient + 1, &tmask, NULL, NULL, &notime);
+ r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
} while (r < 0 && (errno == EINTR || errno == EAGAIN));
- if (r < 0)
+ if (r < 0)
if (GetConnectionTranslation(curclient) > 0)
CloseDownClient(clients[GetConnectionTranslation(curclient)]);
- }
+ }
#endif
}
@@ -1004,22 +1052,22 @@ CheckConnections(void)
void
CloseDownConnection(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ OsCommPtr oc = (OsCommPtr)client->osPrivate;
if (FlushCallback)
- CallCallbacks(&FlushCallback, NULL);
+ CallCallbacks(&FlushCallback, NULL);
if (oc->output && oc->output->count)
- FlushClient(client, oc, (char *) NULL, 0);
+ FlushClient(client, oc, (char *)NULL, 0);
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
#endif
CloseDownFileDescriptor(oc);
FreeOsBuffers(oc);
free(client->osPrivate);
- client->osPrivate = (pointer) NULL;
+ client->osPrivate = (pointer)NULL;
if (auditTrailLevel > 1)
- AuditF("client %d disconnected\n", client->index);
+ AuditF("client %d disconnected\n", client->index);
}
void
@@ -1027,7 +1075,7 @@ AddGeneralSocket(int fd)
{
FD_SET(fd, &AllSockets);
if (GrabInProgress)
- FD_SET(fd, &SavedAllSockets);
+ FD_SET(fd, &SavedAllSockets);
}
void
@@ -1042,7 +1090,7 @@ RemoveGeneralSocket(int fd)
{
FD_CLR(fd, &AllSockets);
if (GrabInProgress)
- FD_CLR(fd, &SavedAllSockets);
+ FD_CLR(fd, &SavedAllSockets);
}
void
@@ -1065,29 +1113,29 @@ RemoveEnabledDevice(int fd)
int
OnlyListenToOneClient(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ OsCommPtr oc = (OsCommPtr)client->osPrivate;
int rc, connection = oc->fd;
rc = XaceHook(XACE_SERVER_ACCESS, client, DixGrabAccess);
if (rc != Success)
- return rc;
+ return rc;
if (!GrabInProgress) {
- XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput);
- XFD_ANDSET(&ClientsWithInput,
- &ClientsWithInput, &GrabImperviousClients);
+ XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput);
+ XFD_ANDSET(&ClientsWithInput,
+ &ClientsWithInput, &GrabImperviousClients);
if (FD_ISSET(connection, &SavedClientsWithInput)) {
- FD_CLR(connection, &SavedClientsWithInput);
- FD_SET(connection, &ClientsWithInput);
- }
- XFD_UNSET(&SavedClientsWithInput, &GrabImperviousClients);
- XFD_COPYSET(&AllSockets, &SavedAllSockets);
- XFD_COPYSET(&AllClients, &SavedAllClients);
- XFD_UNSET(&AllSockets, &AllClients);
- XFD_ANDSET(&AllClients, &AllClients, &GrabImperviousClients);
- FD_SET(connection, &AllClients);
- XFD_ORSET(&AllSockets, &AllSockets, &AllClients);
- GrabInProgress = client->index;
+ FD_CLR(connection, &SavedClientsWithInput);
+ FD_SET(connection, &ClientsWithInput);
+ }
+ XFD_UNSET(&SavedClientsWithInput, &GrabImperviousClients);
+ XFD_COPYSET(&AllSockets, &SavedAllSockets);
+ XFD_COPYSET(&AllClients, &SavedAllClients);
+ XFD_UNSET(&AllSockets, &AllClients);
+ XFD_ANDSET(&AllClients, &AllClients, &GrabImperviousClients);
+ FD_SET(connection, &AllClients);
+ XFD_ORSET(&AllSockets, &AllSockets, &AllClients);
+ GrabInProgress = client->index;
}
return rc;
}
@@ -1101,11 +1149,11 @@ void
ListenToAllClients(void)
{
if (GrabInProgress) {
- XFD_ORSET(&AllSockets, &AllSockets, &SavedAllSockets);
- XFD_ORSET(&AllClients, &AllClients, &SavedAllClients);
- XFD_ORSET(&ClientsWithInput, &ClientsWithInput, &SavedClientsWithInput);
- GrabInProgress = 0;
- }
+ XFD_ORSET(&AllSockets, &AllSockets, &SavedAllSockets);
+ XFD_ORSET(&AllClients, &AllClients, &SavedAllClients);
+ XFD_ORSET(&ClientsWithInput, &ClientsWithInput, &SavedClientsWithInput);
+ GrabInProgress = 0;
+ }
}
/****************
@@ -1115,34 +1163,34 @@ ListenToAllClients(void)
****************/
void
-IgnoreClient(ClientPtr client)
+IgnoreClient (ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
client->ignoreCount++;
if (client->ignoreCount > 1)
- return;
+ return;
isItTimeToYield = TRUE;
if (!GrabInProgress || FD_ISSET(connection, &AllClients)) {
- if (FD_ISSET(connection, &ClientsWithInput))
- FD_SET(connection, &IgnoredClientsWithInput);
- else
- FD_CLR(connection, &IgnoredClientsWithInput);
- FD_CLR(connection, &ClientsWithInput);
- FD_CLR(connection, &AllSockets);
- FD_CLR(connection, &AllClients);
- FD_CLR(connection, &LastSelectMask);
+ if (FD_ISSET (connection, &ClientsWithInput))
+ FD_SET(connection, &IgnoredClientsWithInput);
+ else
+ FD_CLR(connection, &IgnoredClientsWithInput);
+ FD_CLR(connection, &ClientsWithInput);
+ FD_CLR(connection, &AllSockets);
+ FD_CLR(connection, &AllClients);
+ FD_CLR(connection, &LastSelectMask);
}
else {
- if (FD_ISSET(connection, &SavedClientsWithInput))
- FD_SET(connection, &IgnoredClientsWithInput);
- else
- FD_CLR(connection, &IgnoredClientsWithInput);
- FD_CLR(connection, &SavedClientsWithInput);
- FD_CLR(connection, &SavedAllSockets);
- FD_CLR(connection, &SavedAllClients);
+ if (FD_ISSET (connection, &SavedClientsWithInput))
+ FD_SET(connection, &IgnoredClientsWithInput);
+ else
+ FD_CLR(connection, &IgnoredClientsWithInput);
+ FD_CLR(connection, &SavedClientsWithInput);
+ FD_CLR(connection, &SavedAllSockets);
+ FD_CLR(connection, &SavedAllClients);
}
}
@@ -1152,28 +1200,28 @@ IgnoreClient(ClientPtr client)
****************/
void
-AttendClient(ClientPtr client)
+AttendClient (ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
client->ignoreCount--;
if (client->ignoreCount)
- return;
+ return;
if (!GrabInProgress || GrabInProgress == client->index ||
FD_ISSET(connection, &GrabImperviousClients)) {
- FD_SET(connection, &AllClients);
- FD_SET(connection, &AllSockets);
- FD_SET(connection, &LastSelectMask);
- if (FD_ISSET(connection, &IgnoredClientsWithInput))
- FD_SET(connection, &ClientsWithInput);
+ FD_SET(connection, &AllClients);
+ FD_SET(connection, &AllSockets);
+ FD_SET(connection, &LastSelectMask);
+ if (FD_ISSET (connection, &IgnoredClientsWithInput))
+ FD_SET(connection, &ClientsWithInput);
}
else {
- FD_SET(connection, &SavedAllClients);
- FD_SET(connection, &SavedAllSockets);
- if (FD_ISSET(connection, &IgnoredClientsWithInput))
- FD_SET(connection, &SavedClientsWithInput);
+ FD_SET(connection, &SavedAllClients);
+ FD_SET(connection, &SavedAllSockets);
+ if (FD_ISSET(connection, &IgnoredClientsWithInput))
+ FD_SET(connection, &SavedClientsWithInput);
}
}
@@ -1182,17 +1230,17 @@ AttendClient(ClientPtr client)
void
MakeClientGrabImpervious(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
FD_SET(connection, &GrabImperviousClients);
if (ServerGrabCallback) {
- ServerGrabInfoRec grabinfo;
+ ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = CLIENT_IMPERVIOUS;
- CallCallbacks(&ServerGrabCallback, &grabinfo);
+ grabinfo.client = client;
+ grabinfo.grabstate = CLIENT_IMPERVIOUS;
+ CallCallbacks(&ServerGrabCallback, &grabinfo);
}
}
@@ -1201,26 +1249,26 @@ MakeClientGrabImpervious(ClientPtr client)
void
MakeClientGrabPervious(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
FD_CLR(connection, &GrabImperviousClients);
if (GrabInProgress && (GrabInProgress != client->index)) {
if (FD_ISSET(connection, &ClientsWithInput)) {
- FD_SET(connection, &SavedClientsWithInput);
- FD_CLR(connection, &ClientsWithInput);
- }
- FD_CLR(connection, &AllSockets);
- FD_CLR(connection, &AllClients);
- isItTimeToYield = TRUE;
+ FD_SET(connection, &SavedClientsWithInput);
+ FD_CLR(connection, &ClientsWithInput);
+ }
+ FD_CLR(connection, &AllSockets);
+ FD_CLR(connection, &AllClients);
+ isItTimeToYield = TRUE;
}
if (ServerGrabCallback) {
- ServerGrabInfoRec grabinfo;
+ ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = CLIENT_PERVIOUS;
- CallCallbacks(&ServerGrabCallback, &grabinfo);
+ grabinfo.client = client;
+ grabinfo.grabstate = CLIENT_PERVIOUS;
+ CallCallbacks(&ServerGrabCallback, &grabinfo);
}
}
@@ -1233,7 +1281,7 @@ ListenOnOpenFD(int fd, int noxauth)
XtransConnInfo ciptr;
const char *display_env = getenv("DISPLAY");
- if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
+ if(display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
/* Make the path the launchd socket if our DISPLAY is set right */
strcpy(port, display_env);
}
@@ -1246,12 +1294,12 @@ ListenOnOpenFD(int fd, int noxauth)
* TRANS_SOCKET_LOCAL_INDEX = 5 from Xtrans.c
*/
ciptr = _XSERVTransReopenCOTSServer(5, fd, port);
- if (ciptr == NULL) {
+ if(ciptr == NULL) {
ErrorF("Got NULL while trying to Reopen launchd port.\n");
return;
}
-
- if (noxauth)
+
+ if(noxauth)
ciptr->flags = ciptr->flags | TRANS_NOXAUTH;
/* Allocate space to store it */
@@ -1261,14 +1309,14 @@ ListenOnOpenFD(int fd, int noxauth)
(XtransConnInfo *) realloc(ListenTransConns,
(ListenTransCount +
1) * sizeof(XtransConnInfo));
-
+
/* Store it */
ListenTransConns[ListenTransCount] = ciptr;
ListenTransFds[ListenTransCount] = fd;
FD_SET(fd, &WellKnownConnections);
FD_SET(fd, &AllSockets);
-
+
/* Increment the count */
ListenTransCount++;
diff --git a/os/log.c b/os/log.c
index 0e4957295..6f558806c 100644
--- a/os/log.c
+++ b/os/log.c
@@ -84,7 +84,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <time.h>
#include <sys/stat.h>
#include <stdarg.h>
-#include <stdlib.h> /* for malloc() */
+#include <stdlib.h> /* for malloc() */
#include "input.h"
#include "site.h"
@@ -104,7 +104,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#ifdef DDXOSVERRORF
-void (*OsVendorVErrorFProc) (const char *, va_list args) = NULL;
+void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
#endif
static FILE *logFile = NULL;
@@ -121,7 +121,7 @@ static Bool needBuffer = TRUE;
#ifdef __APPLE__
#include <AvailabilityMacros.h>
-static char __crashreporter_info_buff__[4096] = { 0 };
+static char __crashreporter_info_buff__[4096] = {0};
static const char *__crashreporter_info__ __attribute__ ((__used__)) =
&__crashreporter_info_buff__[0];
@@ -129,7 +129,7 @@ static const char *__crashreporter_info__ __attribute__ ((__used__)) =
// This is actually a toolchain requirement, but I'm not sure the correct check,
// but it should be fine to just only include it for Leopard and later. This line
// just tells the linker to never strip this symbol (such as for space optimization)
-asm(".desc ___crashreporter_info__, 0x10");
+asm (".desc ___crashreporter_info__, 0x10");
#endif
#endif
@@ -183,39 +183,41 @@ LogInit(const char *fname, const char *backup)
char *logFileName = NULL;
if (fname && *fname) {
- if (asprintf(&logFileName, fname, display) == -1)
- FatalError("Cannot allocate space for the log file name\n");
-
- if (backup && *backup) {
- struct stat buf;
-
- if (!stat(logFileName, &buf) && S_ISREG(buf.st_mode)) {
- char *suffix;
- char *oldLog;
-
- if ((asprintf(&suffix, backup, display) == -1) ||
- (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
- FatalError("Cannot allocate space for the log file name\n");
- free(suffix);
- if (rename(logFileName, oldLog) == -1) {
- FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
- logFileName, oldLog);
- }
- free(oldLog);
- }
- }
- if ((logFile = fopen(logFileName, "w")) == NULL)
- FatalError("Cannot open log file \"%s\"\n", logFileName);
- setvbuf(logFile, NULL, _IONBF, 0);
-
- /* Flush saved log information. */
- if (saveBuffer && bufferSize > 0) {
- fwrite(saveBuffer, bufferPos, 1, logFile);
- fflush(logFile);
+ if (asprintf(&logFileName, fname, display) == -1)
+ FatalError("Cannot allocate space for the log file name\n");
+
+ if (backup && *backup) {
+ struct stat buf;
+
+ if (!stat(logFileName, &buf) && S_ISREG(buf.st_mode)) {
+ char *suffix;
+ char *oldLog;
+
+ if ((asprintf(&suffix, backup, display) == -1) ||
+ (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
+ FatalError("Cannot allocate space for the log file name\n");
+ free(suffix);
+ if (rename(logFileName, oldLog) == -1) {
+ FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
+ logFileName, oldLog);
+ }
+ free(oldLog);
+ }
+ } else {
+ unlink(logFileName);
+ }
+ if ((logFile = fopen(logFileName, "w")) == NULL)
+ FatalError("Cannot open log file \"%s\"\n", logFileName);
+ setvbuf(logFile, NULL, _IONBF, 0);
+
+ /* Flush saved log information. */
+ if (saveBuffer && bufferSize > 0) {
+ fwrite(saveBuffer, bufferPos, 1, logFile);
+ fflush(logFile);
#ifndef WIN32
- fsync(fileno(logFile));
+ fsync(fileno(logFile));
#endif
- }
+ }
}
/*
@@ -236,10 +238,10 @@ void
LogClose(enum ExitCode error)
{
if (logFile) {
- ErrorF("Server terminated %s (%d). Closing log file.\n",
- (error == EXIT_NO_ERROR) ? "successfully" : "with error", error);
- fclose(logFile);
- logFile = NULL;
+ ErrorF("Server terminated %s (%d). Closing log file.\n",
+ (error == EXIT_NO_ERROR) ? "successfully" : "with error", error);
+ fclose(logFile);
+ logFile = NULL;
}
}
@@ -248,19 +250,19 @@ LogSetParameter(LogParameter param, int value)
{
switch (param) {
case XLOG_FLUSH:
- logFlush = value ? TRUE : FALSE;
- return TRUE;
+ logFlush = value ? TRUE : FALSE;
+ return TRUE;
case XLOG_SYNC:
- logSync = value ? TRUE : FALSE;
- return TRUE;
+ logSync = value ? TRUE : FALSE;
+ return TRUE;
case XLOG_VERBOSITY:
- logVerbosity = value;
- return TRUE;
+ logVerbosity = value;
+ return TRUE;
case XLOG_FILE_VERBOSITY:
- logFileVerbosity = value;
- return TRUE;
+ logFileVerbosity = value;
+ return TRUE;
default:
- return FALSE;
+ return FALSE;
}
}
@@ -281,10 +283,10 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
if (logFlush) {
fflush(logFile);
#ifndef WIN32
- if (logSync)
- fsync(fileno(logFile));
+ if (logSync)
+ fsync(fileno(logFile));
#endif
- }
+ }
}
else if (needBuffer) {
if (len > bufferUnused) {
@@ -323,36 +325,36 @@ static const char *
LogMessageTypeVerbString(MessageType type, int verb)
{
if (type == X_ERROR)
- verb = 0;
+ verb = 0;
if (logVerbosity < verb && logFileVerbosity < verb)
- return NULL;
+ return NULL;
switch (type) {
case X_PROBED:
- return X_PROBE_STRING;
+ return X_PROBE_STRING;
case X_CONFIG:
- return X_CONFIG_STRING;
+ return X_CONFIG_STRING;
case X_DEFAULT:
- return X_DEFAULT_STRING;
+ return X_DEFAULT_STRING;
case X_CMDLINE:
- return X_CMDLINE_STRING;
+ return X_CMDLINE_STRING;
case X_NOTICE:
- return X_NOTICE_STRING;
+ return X_NOTICE_STRING;
case X_ERROR:
- return X_ERROR_STRING;
+ return X_ERROR_STRING;
case X_WARNING:
- return X_WARNING_STRING;
+ return X_WARNING_STRING;
case X_INFO:
- return X_INFO_STRING;
+ return X_INFO_STRING;
case X_NOT_IMPLEMENTED:
- return X_NOT_IMPLEMENTED_STRING;
+ return X_NOT_IMPLEMENTED_STRING;
case X_UNKNOWN:
- return X_UNKNOWN_STRING;
+ return X_UNKNOWN_STRING;
case X_NONE:
- return X_NONE_STRING;
+ return X_NONE_STRING;
default:
- return X_UNKNOWN_STRING;
+ return X_UNKNOWN_STRING;
}
}
@@ -367,7 +369,7 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
type_str = LogMessageTypeVerbString(type, verb);
if (!type_str)
- return;
+ return;
/* if type_str is not "", prepend it and ' ', to message */
if (type_str[0] != '\0')
@@ -408,7 +410,7 @@ LogMessage(MessageType type, const char *format, ...)
void
LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
- va_list msg_args, const char *hdr_format, va_list hdr_args)
+ va_list msg_args, const char *hdr_format, va_list hdr_args)
{
const char *type_str;
char buf[1024];
@@ -418,7 +420,7 @@ LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
type_str = LogMessageTypeVerbString(type, verb);
if (!type_str)
- return;
+ return;
/* if type_str is not "", prepend it and ' ', to message */
if (type_str[0] != '\0')
@@ -440,7 +442,7 @@ LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
void
LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
- va_list msg_args, const char *hdr_format, ...)
+ va_list msg_args, const char *hdr_format, ...)
{
va_list hdr_args;
@@ -451,7 +453,7 @@ LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
void
LogHdrMessage(MessageType type, const char *msg_format, va_list msg_args,
- const char *hdr_format, ...)
+ const char *hdr_format, ...)
{
va_list hdr_args;
@@ -476,13 +478,13 @@ AbortServer(void)
AbortDDX(EXIT_ERR_ABORT);
fflush(stderr);
if (CoreDump)
- OsAbort();
- exit(1);
+ OsAbort();
+ exit (1);
}
#define AUDIT_PREFIX "AUDIT: %s: %ld: "
#ifndef AUDIT_TIMEOUT
-#define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */
+#define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */
#endif
static int nrepeat = 0;
@@ -493,10 +495,10 @@ void
FreeAuditTimer(void)
{
if (auditTimer != NULL) {
- /* Force output of pending messages */
- TimerForce(auditTimer);
- TimerFree(auditTimer);
- auditTimer = NULL;
+ /* Force output of pending messages */
+ TimerForce(auditTimer);
+ TimerFree(auditTimer);
+ auditTimer = NULL;
}
}
@@ -511,17 +513,17 @@ AuditPrefix(void)
time(&tm);
autime = ctime(&tm);
if ((s = strchr(autime, '\n')))
- *s = '\0';
+ *s = '\0';
len = strlen(AUDIT_PREFIX) + strlen(autime) + 10 + 1;
tmpBuf = malloc(len);
if (!tmpBuf)
- return NULL;
- snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long) getpid());
+ return NULL;
+ snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long)getpid());
return tmpBuf;
}
void
-AuditF(const char *f, ...)
+AuditF(const char * f, ...)
{
va_list args;
@@ -537,17 +539,17 @@ AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
char *prefix;
if (nrepeat > 0) {
- prefix = AuditPrefix();
- ErrorF("%slast message repeated %d times\n",
- prefix != NULL ? prefix : "", nrepeat);
- nrepeat = 0;
- free(prefix);
- return AUDIT_TIMEOUT;
+ prefix = AuditPrefix();
+ ErrorF("%slast message repeated %d times\n",
+ prefix != NULL ? prefix : "", nrepeat);
+ nrepeat = 0;
+ free(prefix);
+ return AUDIT_TIMEOUT;
}
else {
- /* if the timer expires without anything to print, flush the message */
- oldlen = -1;
- return 0;
+ /* if the timer expires without anything to print, flush the message */
+ oldlen = -1;
+ return 0;
}
}
@@ -563,18 +565,18 @@ VAuditF(const char *f, va_list args)
len = vsnprintf(buf, sizeof(buf), f, args);
if (len == oldlen && strcmp(buf, oldbuf) == 0) {
- /* Message already seen */
- nrepeat++;
+ /* Message already seen */
+ nrepeat++;
}
else {
- /* new message */
- if (auditTimer != NULL)
- TimerForce(auditTimer);
- ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
- strlcpy(oldbuf, buf, sizeof(oldbuf));
- oldlen = len;
- nrepeat = 0;
- auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
+ /* new message */
+ if (auditTimer != NULL)
+ TimerForce(auditTimer);
+ ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
+ strlcpy(oldbuf, buf, sizeof(oldbuf));
+ oldlen = len;
+ nrepeat = 0;
+ auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
}
free(prefix);
}
@@ -586,9 +588,9 @@ FatalError(const char *f, ...)
static Bool beenhere = FALSE;
if (beenhere)
- ErrorF("\nFatalError re-entered, aborting\n");
+ ErrorF("FatalError re-entered, aborting\n");
else
- ErrorF("\nFatal server error:\n");
+ ErrorF("Fatal server error: ");
va_start(args, f);
#ifdef __APPLE__
@@ -603,13 +605,14 @@ FatalError(const char *f, ...)
#endif
VErrorF(f, args);
va_end(args);
- ErrorF("\n");
+ if (f[strlen(f)-1] != '\n')
+ ErrorF("\n");
if (!beenhere)
- OsVendorFatalError();
+ OsVendorFatalError();
if (!beenhere) {
- beenhere = TRUE;
- AbortServer();
- }
+ beenhere = TRUE;
+ AbortServer();
+}
else
OsAbort();
/*NOTREACHED*/}
@@ -619,16 +622,16 @@ VErrorF(const char *f, va_list args)
{
#ifdef DDXOSVERRORF
if (OsVendorVErrorFProc)
- OsVendorVErrorFProc(f, args);
+ OsVendorVErrorFProc(f, args);
else
- LogVWrite(-1, f, args);
+ LogVWrite(-1, f, args);
#else
LogVWrite(-1, f, args);
#endif
}
void
-ErrorF(const char *f, ...)
+ErrorF(const char * f, ...)
{
va_list args;
diff --git a/os/osinit.c b/os/osinit.c
index e2a220886..b292ae34f 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -56,7 +56,7 @@ SOFTWARE.
#include <signal.h>
#include <errno.h>
#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
+# include <dlfcn.h>
#endif
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
@@ -66,14 +66,10 @@ SOFTWARE.
#include "dixstruct.h"
-#if !defined(SYSV) && !defined(WIN32)
+#if !defined(SYSV) && !defined(WIN32)
#include <sys/resource.h>
#endif
-#ifndef ADMPATH
-#define ADMPATH "/usr/adm/X%smsgs"
-#endif
-
extern char *display;
#ifdef RLIMIT_DATA
@@ -85,6 +81,7 @@ int limitStackSpace = -1;
#ifdef RLIMIT_NOFILE
int limitNoFile = -1;
#endif
+extern Bool install_os_signal_handler;
static OsSigWrapperPtr OsSigWrapper = NULL;
@@ -104,187 +101,158 @@ OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
*/
static void
#ifdef SA_SIGINFO
-OsSigHandler(int signo, siginfo_t * sip, void *unused)
+OsSigHandler(int signo, siginfo_t *sip, void *unused)
#else
OsSigHandler(int signo)
#endif
{
#ifdef RTLD_DI_SETSIGNAL
- const char *dlerr = dlerror();
+ const char *dlerr = dlerror();
- if (dlerr) {
- LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr);
- }
-#endif /* RTLD_DI_SETSIGNAL */
+ if (dlerr) {
+ LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr);
+ }
+#endif /* RTLD_DI_SETSIGNAL */
- if (OsSigWrapper != NULL) {
- if (OsSigWrapper(signo) == 0) {
- /* ddx handled signal and wants us to continue */
- return;
- }
- }
+ if (OsSigWrapper != NULL) {
+ if (OsSigWrapper(signo) == 0) {
+ /* ddx handled signal and wants us to continue */
+ return;
+ }
+ }
- /* log, cleanup, and abort */
- xorg_backtrace();
+ ErrorF("Fatal signal received in thread 0x%x\n", pthread_self());
#ifdef SA_SIGINFO
- if (sip->si_code == SI_USER) {
- ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
- signo, (long) sip->si_pid, (long) sip->si_uid);
+ if (sip->si_code == SI_USER) {
+ ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
+ signo, (long) sip->si_pid, (long) sip->si_uid);
}
else {
- switch (signo) {
- case SIGSEGV:
- case SIGBUS:
- case SIGILL:
- case SIGFPE:
- ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
- }
- }
+ switch (signo) {
+ case SIGSEGV:
+ case SIGBUS:
+ case SIGILL:
+ case SIGFPE:
+ ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
+ }
+ }
#endif
- FatalError("Caught signal %d (%s). Server aborting\n",
- signo, strsignal(signo));
+ /* log, cleanup, and abort */
+ xorg_backtrace();
+
+ FatalError("Caught signal %d (%s). Server aborting\n",
+ signo, strsignal(signo));
}
void
OsInit(void)
{
static Bool been_here = FALSE;
- static const char *devnull = "/dev/null";
+ static const char* devnull = "/dev/null";
char fname[PATH_MAX];
if (!been_here) {
- struct sigaction act, oact;
- int i;
-
- int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
- SIGSYS,
- SIGXCPU,
- SIGXFSZ,
+ if (install_os_signal_handler)
+ {
+ struct sigaction act, oact;
+ int i;
+ int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
+ SIGSYS,
+ SIGXCPU,
+ SIGXFSZ,
#ifdef SIGEMT
- SIGEMT,
+ SIGEMT,
#endif
- 0 /* must be last */
- };
- sigemptyset(&act.sa_mask);
+ 0 /* must be last */ };
+ sigemptyset(&act.sa_mask);
#ifdef SA_SIGINFO
- act.sa_sigaction = OsSigHandler;
- act.sa_flags = SA_SIGINFO;
+ act.sa_sigaction = OsSigHandler;
+ act.sa_flags = SA_SIGINFO;
#else
- act.sa_handler = OsSigHandler;
- act.sa_flags = 0;
+ act.sa_handler = OsSigHandler;
+ act.sa_flags = 0;
#endif
- for (i = 0; siglist[i] != 0; i++) {
- if (sigaction(siglist[i], &act, &oact)) {
- ErrorF("failed to install signal handler for signal %d: %s\n",
- siglist[i], strerror(errno));
- }
+ for (i = 0; siglist[i] != 0; i++) {
+ if (sigaction(siglist[i], &act, &oact)) {
+ ErrorF("failed to install signal handler for signal %d: %s\n",
+ siglist[i], strerror(errno));
+ }
+ }
}
+
#ifdef HAVE_BACKTRACE
- /*
- * initialize the backtracer, since the ctor calls dlopen(), which
- * calls malloc(), which isn't signal-safe.
- */
- do {
- void *array;
-
- backtrace(&array, 1);
- } while (0);
+ /*
+ * initialize the backtracer, since the ctor calls dlopen(), which
+ * calls malloc(), which isn't signal-safe.
+ */
+ do {
+ void *array;
+
+ backtrace(&array, 1);
+ } while (0);
#endif
#ifdef RTLD_DI_SETSIGNAL
- /* Tell runtime linker to send a signal we can catch instead of SIGKILL
- * for failures to load libraries/modules at runtime so we can clean up
- * after ourselves.
- */
- int failure_signal = SIGQUIT;
+ /* Tell runtime linker to send a signal we can catch instead of SIGKILL
+ * for failures to load libraries/modules at runtime so we can clean up
+ * after ourselves.
+ */
+ int failure_signal = SIGQUIT;
- dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
+ dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
#endif
-#if !defined(__CYGWIN__)
- fclose(stdin);
- fclose(stdout);
-#endif
- /*
- * If a write of zero bytes to stderr returns non-zero, i.e. -1,
- * then writing to stderr failed, and we'll write somewhere else
- * instead. (Apparently this never happens in the Real World.)
- */
- if (write(2, fname, 0) == -1) {
- FILE *err;
-
- if (strlen(display) + strlen(ADMPATH) + 1 < sizeof fname)
- snprintf(fname, sizeof(fname), ADMPATH, display);
- else
- strcpy(fname, devnull);
- /*
- * uses stdio to avoid os dependencies here,
- * a real os would use
- * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666)
- */
- if (!(err = fopen(fname, "a+")))
- err = fopen(devnull, "w");
- if (err && (fileno(err) != 2)) {
- dup2(fileno(err), 2);
- fclose(err);
- }
-#if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN__)
- {
- static char buf[BUFSIZ];
-
- setvbuf(stderr, buf, _IOLBF, BUFSIZ);
- }
-#else
- setlinebuf(stderr);
+#if !defined(__CYGWIN__)
+ fclose(stdin);
+ fclose(stdout);
#endif
- }
- if (getpgrp() == 0)
- setpgid(0, 0);
+ if (getpgrp () == 0)
+ setpgid (0, 0);
#ifdef RLIMIT_DATA
if (limitDataSpace >= 0) {
- struct rlimit rlim;
+ struct rlimit rlim;
if (!getrlimit(RLIMIT_DATA, &rlim)) {
- if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max))
- rlim.rlim_cur = limitDataSpace;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void) setrlimit(RLIMIT_DATA, &rlim);
- }
- }
+ if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max))
+ rlim.rlim_cur = limitDataSpace;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void)setrlimit(RLIMIT_DATA, &rlim);
+ }
+ }
#endif
#ifdef RLIMIT_STACK
if (limitStackSpace >= 0) {
- struct rlimit rlim;
+ struct rlimit rlim;
if (!getrlimit(RLIMIT_STACK, &rlim)) {
- if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max))
- rlim.rlim_cur = limitStackSpace;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void) setrlimit(RLIMIT_STACK, &rlim);
- }
- }
+ if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max))
+ rlim.rlim_cur = limitStackSpace;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void)setrlimit(RLIMIT_STACK, &rlim);
+ }
+ }
#endif
#ifdef RLIMIT_NOFILE
if (limitNoFile >= 0) {
- struct rlimit rlim;
+ struct rlimit rlim;
if (!getrlimit(RLIMIT_NOFILE, &rlim)) {
- if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max))
- rlim.rlim_cur = limitNoFile;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void) setrlimit(RLIMIT_NOFILE, &rlim);
- }
- }
+ if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max))
+ rlim.rlim_cur = limitNoFile;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void)setrlimit(RLIMIT_NOFILE, &rlim);
+ }
+ }
#endif
- LockServer();
- been_here = TRUE;
+ LockServer();
+ been_here = TRUE;
}
TimerInit();
OsVendorInit();
@@ -293,13 +261,13 @@ OsInit(void)
* log file name if logging to a file is desired.
*/
LogInit(NULL, NULL);
- SmartScheduleInit();
+ SmartScheduleInit ();
}
void
OsCleanup(Bool terminating)
{
if (terminating) {
- UnlockServer();
+ UnlockServer();
}
}
diff --git a/os/utils.c b/os/utils.c
index e33e4d22e..e2486bb0c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -98,19 +98,19 @@ __stdcall unsigned long GetTickCount(void);
#ifndef WIN32
#include <sys/wait.h>
#endif
-#if !defined(SYSV) && !defined(WIN32)
+#if !defined(SYSV) && !defined(WIN32)
#include <sys/resource.h>
#endif
#include <sys/stat.h>
-#include <ctype.h> /* for isspace */
+#include <ctype.h> /* for isspace */
#include <stdarg.h>
-#include <stdlib.h> /* for malloc() */
+#include <stdlib.h> /* for malloc() */
#if defined(TCPCONN) || defined(STREAMSCONN)
-#ifndef WIN32
-#include <netdb.h>
-#endif
+# ifndef WIN32
+# include <netdb.h>
+# endif
#endif
#include "opaque.h"
@@ -121,6 +121,8 @@ __stdcall unsigned long GetTickCount(void);
#include "picture.h"
+Bool install_os_signal_handler = TRUE;
+
Bool noTestExtensions;
#ifdef COMPOSITE
@@ -215,11 +217,11 @@ OsSignal(int sig, OsSigHandlerPtr handler)
sigemptyset(&act.sa_mask);
if (handler != SIG_IGN)
- sigaddset(&act.sa_mask, sig);
+ sigaddset(&act.sa_mask, sig);
act.sa_flags = 0;
act.sa_handler = handler;
if (sigaction(sig, &act, &oact))
- perror("sigaction");
+ perror("sigaction");
return oact.sa_handler;
}
@@ -236,7 +238,7 @@ OsSignal(int sig, OsSigHandlerPtr handler)
static Bool StillLocking = FALSE;
static char LockFile[PATH_MAX];
-static Bool nolock = FALSE;
+Bool nolock = FALSE;
/*
* LockServer --
@@ -247,123 +249,123 @@ static Bool nolock = FALSE;
void
LockServer(void)
{
- char tmp[PATH_MAX], pid_str[12];
- int lfd, i, haslock, l_pid, t;
- const char *tmppath = LOCK_DIR;
- int len;
- char port[20];
+ char tmp[PATH_MAX], pid_str[12];
+ int lfd, i, haslock, l_pid, t;
+ const char *tmppath = LOCK_DIR;
+ int len;
+ char port[20];
if (nolock)
return;
- /*
- * Path names
- */
- snprintf(port, sizeof(port), "%d", atoi(display));
- len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
- strlen(LOCK_TMP_PREFIX);
- len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
- if (len > sizeof(LockFile))
- FatalError("Display name `%s' is too long\n", port);
- (void) sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
- (void) sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
-
- /*
- * Create a temporary file containing our PID. Attempt three times
- * to create the file.
- */
- StillLocking = TRUE;
+ /*
+ * Path names
+ */
+ snprintf(port, sizeof(port), "%d", atoi(display));
+ len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
+ strlen(LOCK_TMP_PREFIX);
+ len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
+ if (len > sizeof(LockFile))
+ FatalError("Display name `%s' is too long\n", port);
+ (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+ (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+
+ /*
+ * Create a temporary file containing our PID. Attempt three times
+ * to create the file.
+ */
+ StillLocking = TRUE;
+ i = 0;
+ do {
+ i++;
+ lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (lfd < 0)
+ sleep(2);
+ else
+ break;
+ } while (i < 3);
+ if (lfd < 0) {
+ unlink(tmp);
i = 0;
do {
- i++;
- lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
- if (lfd < 0)
- sleep(2);
- else
- break;
+ i++;
+ lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (lfd < 0)
+ sleep(2);
+ else
+ break;
} while (i < 3);
- if (lfd < 0) {
- unlink(tmp);
- i = 0;
- do {
- i++;
- lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
- if (lfd < 0)
- sleep(2);
- else
- break;
- } while (i < 3);
+ }
+ if (lfd < 0)
+ FatalError("Could not create lock file in %s\n", tmp);
+ snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long)getpid());
+ (void) write(lfd, pid_str, 11);
+ (void) fchmod(lfd, 0444);
+ (void) close(lfd);
+
+ /*
+ * OK. Now the tmp file exists. Try three times to move it in place
+ * for the lock.
+ */
+ i = 0;
+ haslock = 0;
+ while ((!haslock) && (i++ < 3)) {
+ haslock = (link(tmp,LockFile) == 0);
+ if (haslock) {
+ /*
+ * We're done.
+ */
+ break;
}
- if (lfd < 0)
- FatalError("Could not create lock file in %s\n", tmp);
- snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
- (void) write(lfd, pid_str, 11);
- (void) fchmod(lfd, 0444);
- (void) close(lfd);
-
- /*
- * OK. Now the tmp file exists. Try three times to move it in place
- * for the lock.
- */
- i = 0;
- haslock = 0;
- while ((!haslock) && (i++ < 3)) {
- haslock = (link(tmp, LockFile) == 0);
- if (haslock) {
- /*
- * We're done.
- */
- break;
- }
- else {
- /*
- * Read the pid from the existing file
- */
- lfd = open(LockFile, O_RDONLY | O_NOFOLLOW);
- if (lfd < 0) {
- unlink(tmp);
- FatalError("Can't read lock file %s\n", LockFile);
- }
- pid_str[0] = '\0';
- if (read(lfd, pid_str, 11) != 11) {
- /*
- * Bogus lock file.
- */
- unlink(LockFile);
- close(lfd);
- continue;
- }
- pid_str[11] = '\0';
- sscanf(pid_str, "%d", &l_pid);
- close(lfd);
-
- /*
- * Now try to kill the PID to see if it exists.
- */
- errno = 0;
- t = kill(l_pid, 0);
- if ((t < 0) && (errno == ESRCH)) {
- /*
- * Stale lock file.
- */
- unlink(LockFile);
- continue;
- }
- else if (((t < 0) && (errno == EPERM)) || (t == 0)) {
- /*
- * Process is still active.
- */
- unlink(tmp);
+ else {
+ /*
+ * Read the pid from the existing file
+ */
+ lfd = open(LockFile, O_RDONLY|O_NOFOLLOW);
+ if (lfd < 0) {
+ unlink(tmp);
+ FatalError("Can't read lock file %s\n", LockFile);
+ }
+ pid_str[0] = '\0';
+ if (read(lfd, pid_str, 11) != 11) {
+ /*
+ * Bogus lock file.
+ */
+ unlink(LockFile);
+ close(lfd);
+ continue;
+ }
+ pid_str[11] = '\0';
+ sscanf(pid_str, "%d", &l_pid);
+ close(lfd);
+
+ /*
+ * Now try to kill the PID to see if it exists.
+ */
+ errno = 0;
+ t = kill(l_pid, 0);
+ if ((t< 0) && (errno == ESRCH)) {
+ /*
+ * Stale lock file.
+ */
+ unlink(LockFile);
+ continue;
+ }
+ else if (((t < 0) && (errno == EPERM)) || (t == 0)) {
+ /*
+ * Process is still active.
+ */
+ unlink(tmp);
FatalError
("Server is already active for display %s\n%s %s\n%s\n",
- port, "\tIf this server is no longer running, remove",
- LockFile, "\tand start again.");
- }
- }
+ port, "\tIf this server is no longer running, remove",
+ LockFile, "\tand start again.");
+ }
}
- unlink(tmp);
- if (!haslock)
- FatalError("Could not create server lock file: %s\n", LockFile);
- StillLocking = FALSE;
+ }
+ unlink(tmp);
+ if (!haslock)
+ FatalError("Could not create server lock file: %s\n", LockFile);
+ StillLocking = FALSE;
}
/*
@@ -376,16 +378,16 @@ UnlockServer(void)
if (nolock)
return;
- if (!StillLocking) {
+ if (!StillLocking){
- (void) unlink(LockFile);
- }
+ (void) unlink(LockFile);
+ }
}
/* Force connections to close on SIGHUP from init */
void
-AutoResetServer(int sig)
+AutoResetServer (int sig)
{
int olderrno = errno;
@@ -408,9 +410,9 @@ GiveUp(int sig)
#if (defined WIN32 && defined __MINGW32__) || defined(__CYGWIN__)
CARD32
-GetTimeInMillis(void)
+GetTimeInMillis (void)
{
- return GetTickCount();
+ return GetTickCount ();
}
#else
CARD32
@@ -440,28 +442,28 @@ GetTimeInMillis(void)
#endif
X_GETTIMEOFDAY(&tv);
- return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+ return(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
#endif
void
-AdjustWaitForDelay(pointer waitTime, unsigned long newdelay)
+AdjustWaitForDelay (pointer waitTime, unsigned long newdelay)
{
- static struct timeval delay_val;
- struct timeval **wt = (struct timeval **) waitTime;
- unsigned long olddelay;
+ static struct timeval delay_val;
+ struct timeval **wt = (struct timeval **) waitTime;
+ unsigned long olddelay;
if (*wt == NULL) {
- delay_val.tv_sec = newdelay / 1000;
- delay_val.tv_usec = 1000 * (newdelay % 1000);
- *wt = &delay_val;
+ delay_val.tv_sec = newdelay / 1000;
+ delay_val.tv_usec = 1000 * (newdelay % 1000);
+ *wt = &delay_val;
}
else {
- olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000;
+ olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000;
if (newdelay < olddelay) {
- (*wt)->tv_sec = newdelay / 1000;
- (*wt)->tv_usec = 1000 * (newdelay % 1000);
- }
+ (*wt)->tv_sec = newdelay / 1000;
+ (*wt)->tv_usec = 1000 * (newdelay % 1000);
+ }
}
}
@@ -471,8 +473,8 @@ UseMsg(void)
ErrorF("use: X [:<display>] [option]\n");
ErrorF("-a # default pointer acceleration (factor)\n");
ErrorF("-ac disable access control restrictions\n");
- ErrorF("-audit int set audit trail level\n");
- ErrorF("-auth file select authorization file\n");
+ ErrorF("-audit int set audit trail level\n");
+ ErrorF("-auth file select authorization file\n");
ErrorF("-br create root window with black background\n");
ErrorF("+bs enable any backing store support\n");
ErrorF("-bs disable any backing store support\n");
@@ -502,6 +504,7 @@ UseMsg(void)
#ifdef RLIMIT_STACK
ErrorF("-ls int limit stack space to N Kb\n");
#endif
+ ErrorF("-notrapsignals disable catching of fatal signals\n");
ErrorF("-nolock disable the locking mechanism\n");
ErrorF("-nolisten string don't listen on protocol\n");
ErrorF("-noreset don't reset after last client exists\n");
@@ -550,7 +553,7 @@ UseMsg(void)
* not contain a "/" and not start with a "-".
* --kvajk
*/
-static int
+static int
VerifyDisplayName(const char *d)
{
if (d == (char *) 0)
@@ -585,164 +588,180 @@ ProcessCommandLine(int argc, char *argv[])
#endif
for (i = 1; i < argc; i++) {
- /* call ddx first, so it can peek/override if it wants */
+ /* call ddx first, so it can peek/override if it wants */
if ((skip = ddxProcessArgument(argc, argv, i))) {
- i += (skip - 1);
- }
+ i += (skip - 1);
+ }
else if (argv[i][0] == ':') {
- /* initialize display */
- display = argv[i];
- display++;
- if (!VerifyDisplayName(display)) {
+ /* initialize display */
+ display = argv[i];
+ display++;
+ if( ! VerifyDisplayName( display ) ) {
ErrorF("Bad display name: %s\n", display);
UseMsg();
- FatalError("Bad display name, exiting: %s\n", display);
+ FatalError("Bad display name, exiting: %s\n", display);
}
- }
+ }
else if (strcmp(argv[i], "-a") == 0) {
- if (++i < argc)
- defaultPointerControl.num = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultPointerControl.num = atoi(argv[i]);
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-ac") == 0) {
- defeatAccessControl = TRUE;
- }
+ defeatAccessControl = TRUE;
+ }
else if (strcmp(argv[i], "-audit") == 0) {
- if (++i < argc)
- auditTrailLevel = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ auditTrailLevel = atoi(argv[i]);
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-auth") == 0) {
- if (++i < argc)
- InitAuthorization(argv[i]);
- else
- UseMsg();
- }
- else if (strcmp(argv[i], "-br") == 0); /* default */
- else if (strcmp(argv[i], "+bs") == 0)
- enableBackingStore = TRUE;
- else if (strcmp(argv[i], "-bs") == 0)
- disableBackingStore = TRUE;
+ if(++i < argc)
+ InitAuthorization (argv[i]);
+ else
+ UseMsg();
+ }
+ else if ( strcmp( argv[i], "-br") == 0) ; /* default */
+ else if ( strcmp( argv[i], "+bs") == 0)
+ enableBackingStore = TRUE;
+ else if ( strcmp( argv[i], "-bs") == 0)
+ disableBackingStore = TRUE;
else if (strcmp(argv[i], "c") == 0) {
- if (++i < argc)
- defaultKeyboardControl.click = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultKeyboardControl.click = atoi(argv[i]);
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-c") == 0) {
- defaultKeyboardControl.click = 0;
- }
+ defaultKeyboardControl.click = 0;
+ }
else if (strcmp(argv[i], "-cc") == 0) {
- if (++i < argc)
- defaultColorVisualClass = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultColorVisualClass = atoi(argv[i]);
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-core") == 0) {
#if !defined(WIN32) || !defined(__MINGW32__)
- struct rlimit core_limit;
+ struct rlimit core_limit;
- getrlimit(RLIMIT_CORE, &core_limit);
- core_limit.rlim_cur = core_limit.rlim_max;
- setrlimit(RLIMIT_CORE, &core_limit);
+ getrlimit (RLIMIT_CORE, &core_limit);
+ core_limit.rlim_cur = core_limit.rlim_max;
+ setrlimit (RLIMIT_CORE, &core_limit);
#endif
- CoreDump = TRUE;
- }
+ CoreDump = TRUE;
+ }
else if (strcmp(argv[i], "-nocursor") == 0) {
EnableCursor = FALSE;
}
else if (strcmp(argv[i], "-dpi") == 0) {
- if (++i < argc)
- monitorResolution = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ monitorResolution = atoi(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-displayfd") == 0)
+ {
+ if (++i < argc)
+ {
+ displayfd = atoi(argv[i]);
+ display = NULL;
+ nolock = TRUE;
+ }
+ else
+ UseMsg();
+ }
#ifdef DPMSExtension
- else if (strcmp(argv[i], "dpms") == 0)
- /* ignored for compatibility */ ;
- else if (strcmp(argv[i], "-dpms") == 0)
- DPMSDisabledSwitch = TRUE;
+ else if ( strcmp( argv[i], "dpms") == 0)
+ /* ignored for compatibility */ ;
+ else if ( strcmp( argv[i], "-dpms") == 0)
+ DPMSDisabledSwitch = TRUE;
#endif
else if (strcmp(argv[i], "-deferglyphs") == 0) {
- if (++i >= argc || !ParseGlyphCachingMode(argv[i]))
- UseMsg();
- }
+ if(++i >= argc || !ParseGlyphCachingMode(argv[i]))
+ UseMsg();
+ }
else if (strcmp(argv[i], "-f") == 0) {
- if (++i < argc)
- defaultKeyboardControl.bell = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultKeyboardControl.bell = atoi(argv[i]);
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-fc") == 0) {
- if (++i < argc)
- defaultCursorFont = argv[i];
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultCursorFont = argv[i];
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-fn") == 0) {
- if (++i < argc)
- defaultTextFont = argv[i];
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultTextFont = argv[i];
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-fp") == 0) {
if (++i < argc) {
- defaultFontPath = argv[i];
- }
- else
- UseMsg();
- }
+ defaultFontPath = argv[i];
+ }
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-help") == 0) {
- UseMsg();
- exit(0);
- }
- else if ((skip = XkbProcessArguments(argc, argv, i)) != 0) {
- if (skip > 0)
- i += skip - 1;
+ UseMsg();
+ exit(0);
+ }
+ else if ( (skip=XkbProcessArguments(argc,argv,i))!=0 ) {
+ if (skip>0)
+ i+= skip-1;
else
UseMsg();
- }
+ }
#ifdef RLIMIT_DATA
else if (strcmp(argv[i], "-ld") == 0) {
if (++i < argc) {
- limitDataSpace = atoi(argv[i]);
- if (limitDataSpace > 0)
- limitDataSpace *= 1024;
- }
- else
- UseMsg();
- }
+ limitDataSpace = atoi(argv[i]);
+ if (limitDataSpace > 0)
+ limitDataSpace *= 1024;
+ }
+ else
+ UseMsg();
+ }
#endif
#ifdef RLIMIT_NOFILE
else if (strcmp(argv[i], "-lf") == 0) {
- if (++i < argc)
- limitNoFile = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ limitNoFile = atoi(argv[i]);
+ else
+ UseMsg();
+ }
#endif
#ifdef RLIMIT_STACK
else if (strcmp(argv[i], "-ls") == 0) {
if (++i < argc) {
- limitStackSpace = atoi(argv[i]);
- if (limitStackSpace > 0)
- limitStackSpace *= 1024;
- }
- else
- UseMsg();
- }
-#endif
- else if (strcmp(argv[i], "-nolock") == 0) {
+ limitStackSpace = atoi(argv[i]);
+ if (limitStackSpace > 0)
+ limitStackSpace *= 1024;
+ }
+ else
+ UseMsg();
+ }
+#endif
+ else if ( strcmp ( argv[i], "-notrapsignals") == 0)
+ {
+ install_os_signal_handler = FALSE;
+ }
+ else if ( strcmp ( argv[i], "-nolock") == 0)
+ {
#if !defined(WIN32) && !defined(__CYGWIN__)
- if (getuid() != 0)
+ if (getuid() != 0)
ErrorF
("Warning: the -nolock option can only be used by root\n");
- else
+ else
#endif
- nolock = TRUE;
- }
+ nolock = TRUE;
+ }
else if (strcmp(argv[i], "-nolisten") == 0) {
if (++i < argc) {
if (_XSERVTransNoListen(argv[i]))
@@ -750,173 +769,179 @@ ProcessCommandLine(int argc, char *argv[])
argv[i]);
}
else
- UseMsg();
- }
+ UseMsg();
+ }
else if (strcmp(argv[i], "-noreset") == 0) {
- dispatchExceptionAtReset = 0;
- }
+ dispatchExceptionAtReset = 0;
+ }
else if (strcmp(argv[i], "-reset") == 0) {
- dispatchExceptionAtReset = DE_RESET;
- }
+ dispatchExceptionAtReset = DE_RESET;
+ }
else if (strcmp(argv[i], "-p") == 0) {
- if (++i < argc)
- defaultScreenSaverInterval = ((CARD32) atoi(argv[i])) *
- MILLI_PER_MIN;
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultScreenSaverInterval = ((CARD32)atoi(argv[i])) *
+ MILLI_PER_MIN;
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-pogo") == 0) {
- dispatchException = DE_TERMINATE;
- }
- else if (strcmp(argv[i], "-pn") == 0)
- PartialNetwork = TRUE;
- else if (strcmp(argv[i], "-nopn") == 0)
- PartialNetwork = FALSE;
- else if (strcmp(argv[i], "r") == 0)
- defaultKeyboardControl.autoRepeat = TRUE;
- else if (strcmp(argv[i], "-r") == 0)
- defaultKeyboardControl.autoRepeat = FALSE;
- else if (strcmp(argv[i], "-retro") == 0)
- party_like_its_1989 = TRUE;
+ dispatchException = DE_TERMINATE;
+ }
+ else if ( strcmp( argv[i], "-pn") == 0)
+ PartialNetwork = TRUE;
+ else if ( strcmp( argv[i], "-nopn") == 0)
+ PartialNetwork = FALSE;
+ else if ( strcmp( argv[i], "r") == 0)
+ defaultKeyboardControl.autoRepeat = TRUE;
+ else if ( strcmp( argv[i], "-r") == 0)
+ defaultKeyboardControl.autoRepeat = FALSE;
+ else if ( strcmp( argv[i], "-retro") == 0)
+ party_like_its_1989 = TRUE;
else if (strcmp(argv[i], "-s") == 0) {
- if (++i < argc)
- defaultScreenSaverTime = ((CARD32) atoi(argv[i])) *
- MILLI_PER_MIN;
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultScreenSaverTime = ((CARD32)atoi(argv[i])) *
+ MILLI_PER_MIN;
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-seat") == 0) {
- if (++i < argc)
- SeatId = argv[i];
- else
- UseMsg();
- }
+ if(++i < argc)
+ SeatId = argv[i];
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-t") == 0) {
- if (++i < argc)
- defaultPointerControl.threshold = atoi(argv[i]);
- else
- UseMsg();
- }
+ if(++i < argc)
+ defaultPointerControl.threshold = atoi(argv[i]);
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-terminate") == 0) {
- dispatchExceptionAtReset = DE_TERMINATE;
- }
+ dispatchExceptionAtReset = DE_TERMINATE;
+ }
else if (strcmp(argv[i], "-to") == 0) {
- if (++i < argc)
- TimeOutValue = ((CARD32) atoi(argv[i])) * MILLI_PER_SECOND;
- else
- UseMsg();
- }
+ if(++i < argc)
+ TimeOutValue = ((CARD32)atoi(argv[i])) * MILLI_PER_SECOND;
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-tst") == 0) {
- noTestExtensions = TRUE;
- }
- else if (strcmp(argv[i], "v") == 0)
- defaultScreenSaverBlanking = PreferBlanking;
- else if (strcmp(argv[i], "-v") == 0)
- defaultScreenSaverBlanking = DontPreferBlanking;
- else if (strcmp(argv[i], "-wm") == 0)
- defaultBackingStore = WhenMapped;
- else if (strcmp(argv[i], "-wr") == 0)
+ noTestExtensions = TRUE;
+ }
+ else if ( strcmp( argv[i], "v") == 0)
+ defaultScreenSaverBlanking = PreferBlanking;
+ else if ( strcmp( argv[i], "-v") == 0)
+ defaultScreenSaverBlanking = DontPreferBlanking;
+ else if ( strcmp( argv[i], "-wm") == 0)
+ defaultBackingStore = WhenMapped;
+ else if ( strcmp( argv[i], "-wr") == 0)
whiteRoot = TRUE;
- else if (strcmp(argv[i], "-background") == 0) {
- if (++i < argc) {
- if (!strcmp(argv[i], "none"))
+ else if ( strcmp( argv[i], "-background") == 0) {
+ if(++i < argc) {
+ if (!strcmp ( argv[i], "none"))
bgNoneRoot = TRUE;
else
UseMsg();
}
}
- else if (strcmp(argv[i], "-maxbigreqsize") == 0) {
- if (++i < argc) {
- long reqSizeArg = atol(argv[i]);
+ else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
+ if(++i < argc) {
+ long reqSizeArg = atol(argv[i]);
- /* Request size > 128MB does not make much sense... */
- if (reqSizeArg > 0L && reqSizeArg < 128L) {
- maxBigRequestSize = (reqSizeArg * 1048576L) - 1L;
- }
+ /* Request size > 128MB does not make much sense... */
+ if( reqSizeArg > 0L && reqSizeArg < 128L ) {
+ maxBigRequestSize = (reqSizeArg * 1048576L) - 1L;
+ }
else {
- UseMsg();
- }
- }
+ UseMsg();
+ }
+ }
else {
- UseMsg();
- }
- }
+ UseMsg();
+ }
+ }
#ifdef PANORAMIX
- else if (strcmp(argv[i], "+xinerama") == 0) {
- noPanoramiXExtension = FALSE;
- }
- else if (strcmp(argv[i], "-xinerama") == 0) {
- noPanoramiXExtension = TRUE;
- }
- else if (strcmp(argv[i], "-disablexineramaextension") == 0) {
- PanoramiXExtensionDisabledHack = TRUE;
- }
+ else if ( strcmp( argv[i], "+xinerama") == 0){
+ noPanoramiXExtension = FALSE;
+ }
+ else if ( strcmp( argv[i], "-xinerama") == 0){
+ noPanoramiXExtension = TRUE;
+ }
+ else if ( strcmp( argv[i], "-disablexineramaextension") == 0){
+ PanoramiXExtensionDisabledHack = TRUE;
+ }
#endif
else if (strcmp(argv[i], "-I") == 0) {
- /* ignore all remaining arguments */
- break;
- }
+ /* ignore all remaining arguments */
+ break;
+ }
else if (strncmp(argv[i], "tty", 3) == 0) {
/* init supplies us with this useless information */
- }
+ }
#ifdef XDMCP
else if ((skip = XdmcpOptions(argc, argv, i)) != i) {
- i = skip - 1;
- }
+ i = skip - 1;
+ }
#endif
else if (strcmp(argv[i], "-dumbSched") == 0) {
- SmartScheduleDisable = TRUE;
- }
- else if (strcmp(argv[i], "-schedInterval") == 0) {
- if (++i < argc) {
- SmartScheduleInterval = atoi(argv[i]);
- SmartScheduleSlice = SmartScheduleInterval;
- }
- else
- UseMsg();
- }
- else if (strcmp(argv[i], "-schedMax") == 0) {
- if (++i < argc) {
- SmartScheduleMaxSlice = atoi(argv[i]);
- }
- else
- UseMsg();
- }
+ SmartScheduleDisable = TRUE;
+ }
+ else if ( strcmp( argv[i], "-schedInterval") == 0)
+ {
+ if (++i < argc)
+ {
+ SmartScheduleDisable = FALSE;
+ SmartScheduleInterval = atoi(argv[i]);
+ SmartScheduleSlice = SmartScheduleInterval;
+ }
+ else
+ UseMsg();
+ }
+ else if ( strcmp( argv[i], "-schedMax") == 0)
+ {
+ if (++i < argc)
+ {
+ SmartScheduleDisable = FALSE;
+ SmartScheduleMaxSlice = atoi(argv[i]);
+ }
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-render") == 0) {
if (++i < argc) {
- int policy = PictureParseCmapPolicy(argv[i]);
-
- if (policy != PictureCmapPolicyInvalid)
- PictureCmapPolicy = policy;
- else
- UseMsg();
- }
- else
- UseMsg();
- }
+ int policy = PictureParseCmapPolicy (argv[i]);
+
+ if (policy != PictureCmapPolicyInvalid)
+ PictureCmapPolicy = policy;
+ else
+ UseMsg ();
+ }
+ else
+ UseMsg ();
+ }
else if (strcmp(argv[i], "-sigstop") == 0) {
- RunFromSigStopParent = TRUE;
- }
+ RunFromSigStopParent = TRUE;
+ }
else if (strcmp(argv[i], "+extension") == 0) {
if (++i < argc) {
- if (!EnableDisableExtension(argv[i], TRUE))
- EnableDisableExtensionError(argv[i], TRUE);
- }
- else
- UseMsg();
- }
+ if (!EnableDisableExtension(argv[i], TRUE))
+ EnableDisableExtensionError(argv[i], TRUE);
+ }
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-extension") == 0) {
if (++i < argc) {
- if (!EnableDisableExtension(argv[i], FALSE))
- EnableDisableExtensionError(argv[i], FALSE);
- }
- else
- UseMsg();
- }
+ if (!EnableDisableExtension(argv[i], FALSE))
+ EnableDisableExtensionError(argv[i], FALSE);
+ }
+ else
+ UseMsg();
+ }
else {
- ErrorF("Unrecognized option: %s\n", argv[i]);
- UseMsg();
- FatalError("Unrecognized option: %s\n", argv[i]);
+ ErrorF("Unrecognized option: %s\n", argv[i]);
+ UseMsg();
+ FatalError("Unrecognized option: %s\n", argv[i]);
}
}
}
@@ -932,62 +957,62 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client)
static char *p = NULL;
if (p == NULL) {
- char hname[1024], *hnameptr;
- unsigned int len;
+ char hname[1024], *hnameptr;
+ unsigned int len;
#if defined(IPv6) && defined(AF_INET6)
- struct addrinfo hints, *ai = NULL;
+ struct addrinfo hints, *ai = NULL;
#else
- struct hostent *host;
+ struct hostent *host;
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
+ _Xgethostbynameparams hparams;
#endif
#endif
- gethostname(hname, 1024);
+ gethostname(hname, 1024);
#if defined(IPv6) && defined(AF_INET6)
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_CANONNAME;
- if (getaddrinfo(hname, NULL, &hints, &ai) == 0) {
- hnameptr = ai->ai_canonname;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_CANONNAME;
+ if (getaddrinfo(hname, NULL, &hints, &ai) == 0) {
+ hnameptr = ai->ai_canonname;
}
else {
- hnameptr = hname;
- }
+ hnameptr = hname;
+ }
#else
- host = _XGethostbyname(hname, hparams);
- if (host == NULL)
- hnameptr = hname;
- else
- hnameptr = host->h_name;
+ host = _XGethostbyname(hname, hparams);
+ if (host == NULL)
+ hnameptr = hname;
+ else
+ hnameptr = host->h_name;
#endif
- len = strlen(hnameptr) + 1;
- result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
+ len = strlen(hnameptr) + 1;
+ result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
- p = result;
+ p = result;
*p++ = sizeof(AUTHORIZATION_NAME) >> 8;
*p++ = sizeof(AUTHORIZATION_NAME) & 0xff;
*p++ = (len) >> 8;
*p++ = (len & 0xff);
- memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
- p += sizeof(AUTHORIZATION_NAME);
- memmove(p, hnameptr, len);
- p += len;
+ memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
+ p += sizeof(AUTHORIZATION_NAME);
+ memmove(p, hnameptr, len);
+ p += len;
#if defined(IPv6) && defined(AF_INET6)
- if (ai) {
- freeaddrinfo(ai);
- }
+ if (ai) {
+ freeaddrinfo(ai);
+ }
#endif
}
*authlen = p - result;
*authorizations = result;
return 1;
-#else /* TCPCONN */
+#else /* TCPCONN */
return 0;
-#endif /* TCPCONN */
+#endif /* TCPCONN */
}
void *
@@ -1000,9 +1025,9 @@ Xalloc(unsigned long amount)
*
* -- Mikhail Gusarov
*/
- if ((long) amount <= 0)
- ErrorF("Warning: Xalloc: "
- "requesting unpleasantly large amount of memory: %lu bytes.\n",
+ if ((long)amount <= 0)
+ ErrorF("Warning: Xalloc: "
+ "requesting unpleasantly large amount of memory: %lu bytes.\n",
amount);
return malloc(amount);
@@ -1044,9 +1069,9 @@ Xrealloc(void *ptr, unsigned long amount)
*
* -- Mikhail Gusarov
*/
- if ((long) amount <= 0)
- ErrorF("Warning: Xrealloc: "
- "requesting unpleasantly large amount of memory: %lu bytes.\n",
+ if ((long)amount <= 0)
+ ErrorF("Warning: Xrealloc: "
+ "requesting unpleasantly large amount of memory: %lu bytes.\n",
amount);
return realloc(ptr, amount);
@@ -1058,7 +1083,7 @@ XNFrealloc(void *ptr, unsigned long amount)
void *ret = realloc(ptr, amount);
if (!ret)
- FatalError("XNFrealloc: Out of memory");
+ FatalError("XNFrealloc: Out of memory");
return ret;
}
@@ -1072,7 +1097,7 @@ char *
Xstrdup(const char *s)
{
if (s == NULL)
- return NULL;
+ return NULL;
return strdup(s);
}
@@ -1082,104 +1107,104 @@ XNFstrdup(const char *s)
char *ret;
if (s == NULL)
- return NULL;
+ return NULL;
ret = strdup(s);
if (!ret)
- FatalError("XNFstrdup: Out of memory");
+ FatalError("XNFstrdup: Out of memory");
return ret;
}
void
-SmartScheduleStopTimer(void)
+SmartScheduleStopTimer (void)
{
- struct itimerval timer;
-
+ struct itimerval timer;
+
if (SmartScheduleDisable)
- return;
+ return;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = 0;
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = 0;
- (void) setitimer(ITIMER_REAL, &timer, 0);
+ (void) setitimer (ITIMER_REAL, &timer, 0);
}
void
-SmartScheduleStartTimer(void)
+SmartScheduleStartTimer (void)
{
- struct itimerval timer;
-
+ struct itimerval timer;
+
if (SmartScheduleDisable)
- return;
+ return;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = SmartScheduleInterval * 1000;
- setitimer(ITIMER_REAL, &timer, 0);
+ setitimer (ITIMER_REAL, &timer, 0);
}
static void
-SmartScheduleTimer(int sig)
+SmartScheduleTimer (int sig)
{
SmartScheduleTime += SmartScheduleInterval;
}
void
-SmartScheduleInit(void)
+SmartScheduleInit (void)
{
- struct sigaction act;
+ struct sigaction act;
if (SmartScheduleDisable)
- return;
+ return;
memset((char *) &act, 0, sizeof(struct sigaction));
/* Set up the timer signal function */
act.sa_handler = SmartScheduleTimer;
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask, SIGALRM);
+ sigemptyset (&act.sa_mask);
+ sigaddset (&act.sa_mask, SIGALRM);
if (sigaction(SIGALRM, &act, 0) < 0) {
- perror("sigaction for smart scheduler");
- SmartScheduleDisable = TRUE;
+ perror ("sigaction for smart scheduler");
+ SmartScheduleDisable = TRUE;
}
}
#ifdef SIG_BLOCK
-static sigset_t PreviousSignalMask;
-static int BlockedSignalCount;
+static sigset_t PreviousSignalMask;
+static int BlockedSignalCount;
#endif
void
-OsBlockSignals(void)
+OsBlockSignals (void)
{
#ifdef SIG_BLOCK
if (BlockedSignalCount++ == 0) {
- sigset_t set;
-
- sigemptyset(&set);
- sigaddset(&set, SIGALRM);
- sigaddset(&set, SIGVTALRM);
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGALRM);
+ sigaddset (&set, SIGVTALRM);
#ifdef SIGWINCH
- sigaddset(&set, SIGWINCH);
+ sigaddset (&set, SIGWINCH);
#endif
#ifdef SIGIO
- sigaddset(&set, SIGIO);
+ sigaddset (&set, SIGIO);
#endif
- sigaddset(&set, SIGTSTP);
- sigaddset(&set, SIGTTIN);
- sigaddset(&set, SIGTTOU);
- sigaddset(&set, SIGCHLD);
- sigprocmask(SIG_BLOCK, &set, &PreviousSignalMask);
+ sigaddset (&set, SIGTSTP);
+ sigaddset (&set, SIGTTIN);
+ sigaddset (&set, SIGTTOU);
+ sigaddset (&set, SIGCHLD);
+ sigprocmask (SIG_BLOCK, &set, &PreviousSignalMask);
}
#endif
}
void
-OsReleaseSignals(void)
+OsReleaseSignals (void)
{
#ifdef SIG_BLOCK
if (--BlockedSignalCount == 0) {
- sigprocmask(SIG_SETMASK, &PreviousSignalMask, 0);
+ sigprocmask (SIG_SETMASK, &PreviousSignalMask, 0);
}
#endif
}
@@ -1190,7 +1215,7 @@ OsReleaseSignals(void)
*/
void
-OsAbort(void)
+OsAbort (void)
{
#ifndef __APPLE__
OsBlockSignals();
@@ -1209,47 +1234,67 @@ OsAbort(void)
* as well. As it is now, xkbcomp messages don't end up in the log file.
*/
+#ifdef __CYGWIN__
+#include <process.h>
+int
+System(const char *command)
+{
+ int status;
+ if (!command)
+ return 1;
+
+ DebugF("System: `%s'\n", command);
+
+ /*
+ Use spawnl() rather than execl() to implement System() on cygwin to
+ avoid fork emulation overhead and brittleness
+ */
+ status = spawnl(_P_WAIT, "/bin/sh", "sh", "-c", command, (char *)NULL);
+ return status;
+}
+#else
int
System(const char *command)
{
int pid, p;
- void (*csig) (int);
+ void (*csig)(int);
int status;
if (!command)
- return 1;
+ return 1;
csig = signal(SIGCHLD, SIG_DFL);
if (csig == SIG_ERR) {
- perror("signal");
- return -1;
+ perror("signal");
+ return -1;
}
DebugF("System: `%s'\n", command);
switch (pid = fork()) {
- case -1: /* error */
- p = -1;
- case 0: /* child */
- if (setgid(getgid()) == -1)
- _exit(127);
- if (setuid(getuid()) == -1)
- _exit(127);
- execl("/bin/sh", "sh", "-c", command, (char *) NULL);
- _exit(127);
- default: /* parent */
- do {
- p = waitpid(pid, &status, 0);
- } while (p == -1 && errno == EINTR);
-
+ case -1: /* error */
+ p = -1;
+ case 0: /* child */
+ if (setgid(getgid()) == -1)
+ _exit(127);
+ if (setuid(getuid()) == -1)
+ _exit(127);
+ execl("/bin/sh", "sh", "-c", command, (char *)NULL);
+ _exit(127);
+ default: /* parent */
+ do {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && errno == EINTR);
+
}
if (signal(SIGCHLD, csig) == SIG_ERR) {
- perror("signal");
- return -1;
+ perror("signal");
+ return -1;
}
return p == -1 ? -1 : status;
}
+#endif
static struct pid {
struct pid *next;
@@ -1257,7 +1302,7 @@ static struct pid {
int pid;
} *pidlist;
-OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
+OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
pointer
Popen(const char *command, const char *type)
@@ -1267,73 +1312,73 @@ Popen(const char *command, const char *type)
int pdes[2], pid;
if (command == NULL || type == NULL)
- return NULL;
+ return NULL;
if ((*type != 'r' && *type != 'w') || type[1])
- return NULL;
+ return NULL;
if ((cur = malloc(sizeof(struct pid))) == NULL)
- return NULL;
+ return NULL;
if (pipe(pdes) < 0) {
- free(cur);
- return NULL;
+ free(cur);
+ return NULL;
}
/* Ignore the smart scheduler while this is going on */
old_alarm = OsSignal(SIGALRM, SIG_IGN);
if (old_alarm == SIG_ERR) {
- close(pdes[0]);
- close(pdes[1]);
- free(cur);
- perror("signal");
- return NULL;
+ close(pdes[0]);
+ close(pdes[1]);
+ free(cur);
+ perror("signal");
+ return NULL;
}
switch (pid = fork()) {
- case -1: /* error */
- close(pdes[0]);
- close(pdes[1]);
- free(cur);
- if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
- perror("signal");
- return NULL;
- case 0: /* child */
- if (setgid(getgid()) == -1)
- _exit(127);
- if (setuid(getuid()) == -1)
- _exit(127);
- if (*type == 'r') {
- if (pdes[1] != 1) {
- /* stdout */
- dup2(pdes[1], 1);
- close(pdes[1]);
- }
- close(pdes[0]);
+ case -1: /* error */
+ close(pdes[0]);
+ close(pdes[1]);
+ free(cur);
+ if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
+ perror("signal");
+ return NULL;
+ case 0: /* child */
+ if (setgid(getgid()) == -1)
+ _exit(127);
+ if (setuid(getuid()) == -1)
+ _exit(127);
+ if (*type == 'r') {
+ if (pdes[1] != 1) {
+ /* stdout */
+ dup2(pdes[1], 1);
+ close(pdes[1]);
+ }
+ close(pdes[0]);
}
else {
- if (pdes[0] != 0) {
- /* stdin */
- dup2(pdes[0], 0);
- close(pdes[0]);
- }
- close(pdes[1]);
- }
- execl("/bin/sh", "sh", "-c", command, (char *) NULL);
- _exit(127);
+ if (pdes[0] != 0) {
+ /* stdin */
+ dup2(pdes[0], 0);
+ close(pdes[0]);
+ }
+ close(pdes[1]);
+ }
+ execl("/bin/sh", "sh", "-c", command, (char *)NULL);
+ _exit(127);
}
/* Avoid EINTR during stdio calls */
- OsBlockSignals();
-
+ OsBlockSignals ();
+
/* parent */
if (*type == 'r') {
- iop = fdopen(pdes[0], type);
- close(pdes[1]);
+ iop = fdopen(pdes[0], type);
+ close(pdes[1]);
}
else {
- iop = fdopen(pdes[1], type);
- close(pdes[0]);
+ iop = fdopen(pdes[1], type);
+ close(pdes[0]);
}
cur->fp = iop;
@@ -1357,61 +1402,61 @@ Fopen(const char *file, const char *type)
int pdes[2], pid;
if (file == NULL || type == NULL)
- return NULL;
+ return NULL;
if ((*type != 'r' && *type != 'w') || type[1])
- return NULL;
+ return NULL;
if ((cur = malloc(sizeof(struct pid))) == NULL)
- return NULL;
+ return NULL;
if (pipe(pdes) < 0) {
- free(cur);
- return NULL;
+ free(cur);
+ return NULL;
}
switch (pid = fork()) {
- case -1: /* error */
- close(pdes[0]);
- close(pdes[1]);
- free(cur);
- return NULL;
- case 0: /* child */
- if (setgid(getgid()) == -1)
- _exit(127);
- if (setuid(getuid()) == -1)
- _exit(127);
- if (*type == 'r') {
- if (pdes[1] != 1) {
- /* stdout */
- dup2(pdes[1], 1);
- close(pdes[1]);
- }
- close(pdes[0]);
+ case -1: /* error */
+ close(pdes[0]);
+ close(pdes[1]);
+ free(cur);
+ return NULL;
+ case 0: /* child */
+ if (setgid(getgid()) == -1)
+ _exit(127);
+ if (setuid(getuid()) == -1)
+ _exit(127);
+ if (*type == 'r') {
+ if (pdes[1] != 1) {
+ /* stdout */
+ dup2(pdes[1], 1);
+ close(pdes[1]);
+ }
+ close(pdes[0]);
}
else {
- if (pdes[0] != 0) {
- /* stdin */
- dup2(pdes[0], 0);
- close(pdes[0]);
- }
- close(pdes[1]);
- }
- execl("/bin/cat", "cat", file, (char *) NULL);
- _exit(127);
+ if (pdes[0] != 0) {
+ /* stdin */
+ dup2(pdes[0], 0);
+ close(pdes[0]);
+ }
+ close(pdes[1]);
+ }
+ execl("/bin/cat", "cat", file, (char *)NULL);
+ _exit(127);
}
/* Avoid EINTR during stdio calls */
- OsBlockSignals();
-
+ OsBlockSignals ();
+
/* parent */
if (*type == 'r') {
- iop = fdopen(pdes[0], type);
- close(pdes[1]);
+ iop = fdopen(pdes[0], type);
+ close(pdes[1]);
}
else {
- iop = fdopen(pdes[1], type);
- close(pdes[0]);
+ iop = fdopen(pdes[1], type);
+ close(pdes[0]);
}
cur->fp = iop;
@@ -1427,18 +1472,18 @@ Fopen(const char *file, const char *type)
ruid = getuid();
euid = geteuid();
-
+
if (seteuid(ruid) == -1) {
- return NULL;
+ return NULL;
}
iop = fopen(file, type);
if (seteuid(euid) == -1) {
- fclose(iop);
- return NULL;
+ fclose(iop);
+ return NULL;
}
return iop;
-#endif /* HAS_SAVED_IDS_AND_SETEUID */
+#endif /* HAS_SAVED_IDS_AND_SETEUID */
}
int
@@ -1452,27 +1497,27 @@ Pclose(pointer iop)
fclose(iop);
for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next)
- if (cur->fp == iop)
- break;
+ if (cur->fp == iop)
+ break;
if (cur == NULL)
- return -1;
+ return -1;
do {
- pid = waitpid(cur->pid, &pstat, 0);
+ pid = waitpid(cur->pid, &pstat, 0);
} while (pid == -1 && errno == EINTR);
if (last == NULL)
- pidlist = cur->next;
+ pidlist = cur->next;
else
- last->next = cur->next;
+ last->next = cur->next;
free(cur);
/* allow EINTR again */
- OsReleaseSignals();
-
+ OsReleaseSignals ();
+
if (old_alarm && OsSignal(SIGALRM, old_alarm) == SIG_ERR) {
- perror("signal");
- return -1;
+ perror("signal");
+ return -1;
}
return pid == -1 ? -1 : pstat;
@@ -1488,7 +1533,7 @@ Fclose(pointer iop)
#endif
}
-#endif /* !WIN32 */
+#endif /* !WIN32 */
/*
* CheckUserParameters: check for long command line arguments and long
@@ -1536,7 +1581,7 @@ Fclose(pointer iop)
#define MAX_ARG_LENGTH 128
#define MAX_ENV_LENGTH 256
-#define MAX_ENV_PATH_LENGTH 2048 /* Limit for *PATH and TERMCAP */
+#define MAX_ENV_PATH_LENGTH 2048 /* Limit for *PATH and TERMCAP */
#if USE_ISPRINT
#include <ctype.h>
@@ -1574,116 +1619,116 @@ CheckUserParameters(int argc, char **argv, char **envp)
if (geteuid() == 0 && getuid() != geteuid())
#endif
{
- /* Check each argv[] */
- for (i = 1; i < argc; i++) {
+ /* Check each argv[] */
+ for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fp") == 0) {
- i++; /* continue with next argument. skip the length check */
- if (i >= argc)
- break;
+ i++; /* continue with next argument. skip the length check */
+ if (i >= argc)
+ break;
}
else {
- if (strlen(argv[i]) > MAX_ARG_LENGTH) {
- bad = ArgTooLong;
- break;
- }
- }
- a = argv[i];
- while (*a) {
- if (checkPrintable(*a) == 0) {
- bad = UnprintableArg;
- break;
- }
- a++;
- }
- if (bad)
- break;
- }
- if (!bad) {
- /* Check each envp[] */
- for (i = 0; envp[i]; i++) {
-
- /* Check for bad environment variables and values */
+ if (strlen(argv[i]) > MAX_ARG_LENGTH) {
+ bad = ArgTooLong;
+ break;
+ }
+ }
+ a = argv[i];
+ while (*a) {
+ if (checkPrintable(*a) == 0) {
+ bad = UnprintableArg;
+ break;
+ }
+ a++;
+ }
+ if (bad)
+ break;
+ }
+ if (!bad) {
+ /* Check each envp[] */
+ for (i = 0; envp[i]; i++) {
+
+ /* Check for bad environment variables and values */
#if REMOVE_ENV_LD
- while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
- for (j = i; envp[j]; j++) {
- envp[j] = envp[j + 1];
- }
- }
-#endif
- if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
+ while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
+ for (j = i; envp[j]; j++) {
+ envp[j] = envp[j+1];
+ }
+ }
+#endif
+ if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
#if REMOVE_LONG_ENV
- for (j = i; envp[j]; j++) {
- envp[j] = envp[j + 1];
- }
- i--;
+ for (j = i; envp[j]; j++) {
+ envp[j] = envp[j+1];
+ }
+ i--;
#else
- char *eq;
- int len;
-
- eq = strchr(envp[i], '=');
- if (!eq)
- continue;
- len = eq - envp[i];
- e = strndup(envp[i], len);
- if (!e) {
- bad = InternalError;
- break;
- }
- if (len >= 4 &&
- (strcmp(e + len - 4, "PATH") == 0 ||
- strcmp(e, "TERMCAP") == 0)) {
- if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
- bad = EnvTooLong;
- break;
+ char *eq;
+ int len;
+
+ eq = strchr(envp[i], '=');
+ if (!eq)
+ continue;
+ len = eq - envp[i];
+ e = strndup(envp[i], len);
+ if (!e) {
+ bad = InternalError;
+ break;
+ }
+ if (len >= 4 &&
+ (strcmp(e + len - 4, "PATH") == 0 ||
+ strcmp(e, "TERMCAP") == 0)) {
+ if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
+ bad = EnvTooLong;
+ break;
}
else {
- free(e);
- }
+ free(e);
+ }
}
else {
- bad = EnvTooLong;
- break;
- }
+ bad = EnvTooLong;
+ break;
+ }
#endif
- }
- }
- }
+ }
+ }
+ }
#if NO_OUTPUT_PIPES
- if (!bad) {
- struct stat buf;
+ if (!bad) {
+ struct stat buf;
- if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode))
- bad = OutputIsPipe;
- if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode))
- bad = OutputIsPipe;
- }
+ if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode))
+ bad = OutputIsPipe;
+ if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode))
+ bad = OutputIsPipe;
+ }
#endif
}
switch (bad) {
case NotBad:
- return;
+ return;
case UnsafeArg:
- ErrorF("Command line argument number %d is unsafe\n", i);
- break;
+ ErrorF("Command line argument number %d is unsafe\n", i);
+ break;
case ArgTooLong:
- ErrorF("Command line argument number %d is too long\n", i);
- break;
+ ErrorF("Command line argument number %d is too long\n", i);
+ break;
case UnprintableArg:
- ErrorF("Command line argument number %d contains unprintable"
- " characters\n", i);
- break;
+ ErrorF("Command line argument number %d contains unprintable"
+ " characters\n", i);
+ break;
case EnvTooLong:
- ErrorF("Environment variable `%s' is too long\n", e);
- break;
+ ErrorF("Environment variable `%s' is too long\n", e);
+ break;
case OutputIsPipe:
- ErrorF("Stdout and/or stderr is a pipe\n");
- break;
+ ErrorF("Stdout and/or stderr is a pipe\n");
+ break;
case InternalError:
- ErrorF("Internal Error\n");
- break;
+ ErrorF("Internal Error\n");
+ break;
default:
- ErrorF("Unknown error\n");
- break;
+ ErrorF("Unknown error\n");
+ break;
}
FatalError("X server aborted because of unsafe environment\n");
}
@@ -1698,15 +1743,15 @@ CheckUserParameters(int argc, char **argv, char **envp)
#include <security/pam_appl.h>
#include <security/pam_misc.h>
#include <pwd.h>
-#endif /* USE_PAM */
+#endif /* USE_PAM */
void
CheckUserAuthorization(void)
{
#ifdef USE_PAM
static struct pam_conv conv = {
- misc_conv,
- NULL
+ misc_conv,
+ NULL
};
pam_handle_t *pamh = NULL;
@@ -1714,31 +1759,31 @@ CheckUserAuthorization(void)
int retval;
if (getuid() != geteuid()) {
- pw = getpwuid(getuid());
- if (pw == NULL)
- FatalError("getpwuid() failed for uid %d\n", getuid());
-
- retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
- if (retval != PAM_SUCCESS)
- FatalError("pam_start() failed.\n"
- "\tMissing or mangled PAM config file or module?\n");
-
- retval = pam_authenticate(pamh, 0);
- if (retval != PAM_SUCCESS) {
- pam_end(pamh, retval);
- FatalError("PAM authentication failed, cannot start X server.\n"
- "\tPerhaps you do not have console ownership?\n");
- }
-
- retval = pam_acct_mgmt(pamh, 0);
- if (retval != PAM_SUCCESS) {
- pam_end(pamh, retval);
- FatalError("PAM authentication failed, cannot start X server.\n"
- "\tPerhaps you do not have console ownership?\n");
- }
-
- /* this is not a session, so do not do session management */
- pam_end(pamh, PAM_SUCCESS);
+ pw = getpwuid(getuid());
+ if (pw == NULL)
+ FatalError("getpwuid() failed for uid %d\n", getuid());
+
+ retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
+ if (retval != PAM_SUCCESS)
+ FatalError("pam_start() failed.\n"
+ "\tMissing or mangled PAM config file or module?\n");
+
+ retval = pam_authenticate(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ FatalError("PAM authentication failed, cannot start X server.\n"
+ "\tPerhaps you do not have console ownership?\n");
+ }
+
+ retval = pam_acct_mgmt(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ FatalError("PAM authentication failed, cannot start X server.\n"
+ "\tPerhaps you do not have console ownership?\n");
+ }
+
+ /* this is not a session, so do not do session management */
+ pam_end(pamh, PAM_SUCCESS);
}
#endif
}
@@ -1747,7 +1792,7 @@ CheckUserAuthorization(void)
* Tokenize a string into a NULL terminated array of strings. Always returns
* an allocated array unless an error occurs.
*/
-char **
+char**
xstrtokenize(const char *str, const char *separators)
{
char **list, **nlist;
@@ -1775,7 +1820,7 @@ xstrtokenize(const char *str, const char *separators)
free(tmp);
return list;
- error:
+error:
free(tmp);
for (n = 0; n < num; n++)
free(list[n]);
diff --git a/pseudoramiX/Makefile.am b/pseudoramiX/Makefile.am
new file mode 100644
index 000000000..17b664b9e
--- /dev/null
+++ b/pseudoramiX/Makefile.am
@@ -0,0 +1,7 @@
+# Fake Xinerama extension
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+noinst_LTLIBRARIES = libPseudoramiX.la
+
+libPseudoramiX_la_SOURCES = pseudoramiX.c pseudoramiX.h
diff --git a/hw/xquartz/pseudoramiX.c b/pseudoramiX/pseudoramiX.c
index 0f591d5ca..a707438ae 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/pseudoramiX/pseudoramiX.c
@@ -9,35 +9,34 @@
* following copyright notice:
*/
/*****************************************************************
- 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.
- ******************************************************************/
+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.
+******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include "darwin.h"
#include "pseudoramiX.h"
#include "extnsionst.h"
#include "dixstruct.h"
@@ -45,6 +44,9 @@
#include <X11/extensions/panoramiXproto.h>
#include "globals.h"
+#define TRACE PseudoramiXTrace("TRACE " __FILE__ ":%s",__FUNCTION__)
+#define DEBUG_LOG PseudoramiXDebug
+
Bool noPseudoramiXExtension = FALSE;
extern int
@@ -95,6 +97,24 @@ static int pseudoramiXScreensAllocated = 0;
static int pseudoramiXNumScreens = 0;
static unsigned long pseudoramiXGeneration = 0;
+static void
+PseudoramiXTrace(const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(X_NONE, 10, format, ap);
+ va_end (ap);
+}
+
+static void
+PseudoramiXDebug(const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(X_NONE, 3, format, ap);
+ va_end (ap);
+}
+
// Add a PseudoramiX screen.
// The rest of the X server will know nothing about this screen.
// Can be called before or after extension init.
@@ -109,8 +129,8 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
pseudoramiXScreens = realloc(pseudoramiXScreens,
- pseudoramiXScreensAllocated *
- sizeof(PseudoramiXScreenRec));
+ pseudoramiXScreensAllocated *
+ sizeof(PseudoramiXScreenRec));
}
DEBUG_LOG("x: %d, y: %d, w: %d, h: %d\n", x, y, w, h);
@@ -127,12 +147,12 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
void
PseudoramiXExtensionInit(void)
{
- Bool success = FALSE;
- ExtensionEntry *extEntry;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
if (noPseudoramiXExtension) return;
- TRACE();
+ TRACE;
/* Even with only one screen we need to enable PseudoramiX to allow
dynamic screen configuration changes. */
@@ -169,7 +189,7 @@ PseudoramiXExtensionInit(void)
void
PseudoramiXResetScreens(void)
{
- TRACE();
+ TRACE;
pseudoramiXNumScreens = 0;
}
@@ -177,7 +197,7 @@ PseudoramiXResetScreens(void)
static void
PseudoramiXResetProc(ExtensionEntry *extEntry)
{
- TRACE();
+ TRACE;
PseudoramiXResetScreens();
}
@@ -186,7 +206,7 @@ PseudoramiXResetProc(ExtensionEntry *extEntry)
static int
ProcPseudoramiXQueryVersion(ClientPtr client)
{
- TRACE();
+ TRACE;
return ProcPanoramiXQueryVersion(client);
}
@@ -200,12 +220,12 @@ ProcPseudoramiXGetState(ClientPtr client)
xPanoramiXGetStateReply rep;
register int rc;
- TRACE();
-
+ TRACE;
+
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -217,7 +237,7 @@ ProcPseudoramiXGetState(ClientPtr client)
swapl(&rep.length);
swapl(&rep.window);
}
- WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
+ WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
return Success;
}
@@ -230,12 +250,12 @@ ProcPseudoramiXGetScreenCount(ClientPtr client)
xPanoramiXGetScreenCountReply rep;
register int rc;
- TRACE();
-
+ TRACE;
+
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -247,7 +267,7 @@ ProcPseudoramiXGetScreenCount(ClientPtr client)
swapl(&rep.length);
swapl(&rep.window);
}
- WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ WriteToClient (client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
return Success;
}
@@ -260,7 +280,10 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
xPanoramiXGetScreenSizeReply rep;
register int rc;
- TRACE();
+ TRACE;
+
+ if (stuff->screen >= pseudoramiXNumScreens)
+ return BadMatch;
if (stuff->screen >= pseudoramiXNumScreens)
return BadMatch;
@@ -268,13 +291,13 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* screen dimensions */
- rep.width = pseudoramiXScreens[stuff->screen].w;
+ rep.width = pseudoramiXScreens[stuff->screen].w;
// was screenInfo.screens[stuff->screen]->width;
rep.height = pseudoramiXScreens[stuff->screen].h;
// was screenInfo.screens[stuff->screen]->height;
@@ -288,7 +311,7 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
swapl(&rep.window);
swapl(&rep.screen);
}
- WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ WriteToClient (client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
return Success;
}
@@ -297,10 +320,10 @@ static int
ProcPseudoramiXIsActive(ClientPtr client)
{
/* REQUEST(xXineramaIsActiveReq); */
- xXineramaIsActiveReply rep;
-
- TRACE();
+ xXineramaIsActiveReply rep;
+ TRACE;
+
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
rep.type = X_Reply;
@@ -308,11 +331,11 @@ ProcPseudoramiXIsActive(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.state = !noPseudoramiXExtension;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.state);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.state);
}
- WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *)&rep);
+ WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
return Success;
}
@@ -321,12 +344,12 @@ static int
ProcPseudoramiXQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
- xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReply rep;
DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n",
noPseudoramiXExtension,
pseudoramiXNumScreens);
-
+
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
rep.type = X_Reply;
@@ -334,160 +357,159 @@ ProcPseudoramiXQueryScreens(ClientPtr client)
rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.number);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.number);
}
- WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep);
+ WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
if (!noPseudoramiXExtension) {
- xXineramaScreenInfo scratch;
- int i;
-
- for (i = 0; i < pseudoramiXNumScreens; i++) {
- scratch.x_org = pseudoramiXScreens[i].x;
- scratch.y_org = pseudoramiXScreens[i].y;
- scratch.width = pseudoramiXScreens[i].w;
- scratch.height = pseudoramiXScreens[i].h;
-
- if (client->swapped) {
- swaps(&scratch.x_org);
- swaps(&scratch.y_org);
- swaps(&scratch.width);
- swaps(&scratch.height);
- }
- WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
- }
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for(i = 0; i < pseudoramiXNumScreens; i++) {
+ scratch.x_org = pseudoramiXScreens[i].x;
+ scratch.y_org = pseudoramiXScreens[i].y;
+ scratch.width = pseudoramiXScreens[i].w;
+ scratch.height = pseudoramiXScreens[i].h;
+
+ if(client->swapped) {
+ swaps(&scratch.x_org);
+ swaps(&scratch.y_org);
+ swaps(&scratch.width);
+ swaps(&scratch.height);
+ }
+ WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
}
return Success;
}
// was PanoramiX
-static int
-ProcPseudoramiXDispatch(ClientPtr client)
+static int ProcPseudoramiXDispatch (ClientPtr client)
{
REQUEST(xReq);
- TRACE();
+ TRACE;
switch (stuff->data) {
- case X_PanoramiXQueryVersion:
- return ProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXQueryVersion:
+ return ProcPseudoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return ProcPseudoramiXGetState(client);
+ case X_PanoramiXGetState:
+ return ProcPseudoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return ProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenCount:
+ return ProcPseudoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return ProcPseudoramiXGetScreenSize(client);
+ case X_PanoramiXGetScreenSize:
+ return ProcPseudoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return ProcPseudoramiXIsActive(client);
+ case X_XineramaIsActive:
+ return ProcPseudoramiXIsActive(client);
- case X_XineramaQueryScreens:
- return ProcPseudoramiXQueryScreens(client);
+ case X_XineramaQueryScreens:
+ return ProcPseudoramiXQueryScreens(client);
}
return BadRequest;
}
static int
-SProcPseudoramiXQueryVersion(ClientPtr client)
+SProcPseudoramiXQueryVersion (ClientPtr client)
{
- REQUEST(xPanoramiXQueryVersionReq);
+ REQUEST(xPanoramiXQueryVersionReq);
- TRACE();
+ TRACE;
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
- return ProcPseudoramiXQueryVersion(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return ProcPseudoramiXQueryVersion(client);
}
static int
SProcPseudoramiXGetState(ClientPtr client)
{
- REQUEST(xPanoramiXGetStateReq);
+ REQUEST(xPanoramiXGetStateReq);
- TRACE();
+ TRACE;
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
- return ProcPseudoramiXGetState(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return ProcPseudoramiXGetState(client);
}
static int
SProcPseudoramiXGetScreenCount(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenCountReq);
+ REQUEST(xPanoramiXGetScreenCountReq);
- TRACE();
+ TRACE;
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
- return ProcPseudoramiXGetScreenCount(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return ProcPseudoramiXGetScreenCount(client);
}
static int
SProcPseudoramiXGetScreenSize(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenSizeReq);
+ REQUEST(xPanoramiXGetScreenSizeReq);
- TRACE();
+ TRACE;
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
- return ProcPseudoramiXGetScreenSize(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return ProcPseudoramiXGetScreenSize(client);
}
static int
SProcPseudoramiXIsActive(ClientPtr client)
{
- REQUEST(xXineramaIsActiveReq);
+ REQUEST(xXineramaIsActiveReq);
- TRACE();
+ TRACE;
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
- return ProcPseudoramiXIsActive(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcPseudoramiXIsActive(client);
}
static int
SProcPseudoramiXQueryScreens(ClientPtr client)
{
- REQUEST(xXineramaQueryScreensReq);
+ REQUEST(xXineramaQueryScreensReq);
- TRACE();
+ TRACE;
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- return ProcPseudoramiXQueryScreens(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcPseudoramiXQueryScreens(client);
}
static int
-SProcPseudoramiXDispatch(ClientPtr client)
+SProcPseudoramiXDispatch (ClientPtr client)
{
REQUEST(xReq);
- TRACE();
+ TRACE;
switch (stuff->data) {
- case X_PanoramiXQueryVersion:
- return SProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXQueryVersion:
+ return SProcPseudoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return SProcPseudoramiXGetState(client);
+ case X_PanoramiXGetState:
+ return SProcPseudoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return SProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcPseudoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return SProcPseudoramiXGetScreenSize(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcPseudoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return SProcPseudoramiXIsActive(client);
+ case X_XineramaIsActive:
+ return SProcPseudoramiXIsActive(client);
- case X_XineramaQueryScreens:
- return SProcPseudoramiXQueryScreens(client);
+ case X_XineramaQueryScreens:
+ return SProcPseudoramiXQueryScreens(client);
}
return BadRequest;
}
diff --git a/hw/xquartz/pseudoramiX.h b/pseudoramiX/pseudoramiX.h
index 7e08749df..7e08749df 100644
--- a/hw/xquartz/pseudoramiX.h
+++ b/pseudoramiX/pseudoramiX.h
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index aa8a61eee..032b1bd3a 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -84,6 +84,8 @@ static int ProcRRXineramaIsActive(ClientPtr client);
static int ProcRRXineramaQueryScreens(ClientPtr client);
static int SProcRRXineramaDispatch(ClientPtr client);
+Bool noRRXineramaExtension = FALSE;
+
/* Proc */
int
@@ -449,6 +451,9 @@ RRXineramaExtensionInit(void)
return;
#endif
+ if (noRRXineramaExtension)
+ return;
+
/*
* Xinerama isn't capable enough to have multiple protocol screens each
* with their own output geometry. So if there's more than one protocol
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 9b69b2b82..98efa95c0 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef WIN32
/* from ddxLoad.c */
-extern const char *Win32TempDir(void);
+extern const char* Win32TempDir(void);
extern int Win32System(const char *cmdline);
#undef System
@@ -55,62 +55,72 @@ extern int Win32System(const char *cmdline);
#define W32_tmplen strlen(tmpname)+3
#else
#define W32_tmparg
-#define W32_tmpfile
+#define W32_tmpfile
#define W32_tmplen 0
+#endif
+
+#ifdef __CYGWIN__
+extern const char* Win32TempDir(void);
+#endif
+
+#if defined(WIN32)
+#define PATHSEPARATOR "\\"
+#else
+#define PATHSEPARATOR "/"
#endif
/***====================================================================***/
static const char *componentDirs[_XkbListNumComponents] = {
- "keycodes", "types", "compat", "symbols", "geometry"
+ "keycodes", "types", "compat", "symbols", "geometry"
};
/***====================================================================***/
static Status
-_AddListComponent(XkbSrvListInfoPtr list,
+_AddListComponent( XkbSrvListInfoPtr list,
int what, unsigned flags, char *str, ClientPtr client)
{
- int slen, wlen;
- unsigned char *wire8;
- unsigned short *wire16;
- char *tmp;
+int slen,wlen;
+unsigned char * wire8;
+unsigned short *wire16;
+char * tmp;
- if (list->nTotal >= list->maxRtrn) {
- list->nTotal++;
- return Success;
+ if (list->nTotal>=list->maxRtrn) {
+ list->nTotal++;
+ return Success;
}
- tmp = strchr(str, ')');
- if ((tmp == NULL) && ((tmp = strchr(str, '(')) == NULL)) {
- slen = strlen(str);
- while ((slen > 0) && isspace(str[slen - 1])) {
- slen--;
- }
+ tmp= strchr(str,')');
+ if ((tmp==NULL)&&((tmp=strchr(str,'('))==NULL)) {
+ slen= strlen(str);
+ while ((slen>0) && isspace(str[slen-1])) {
+ slen--;
+ }
}
else {
- slen = (tmp - str + 1);
+ slen= (tmp-str+1);
}
- wlen = (((slen + 1) / 2) * 2) + 4; /* four bytes for flags and length, pad to */
- /* 2-byte boundary */
- if ((list->szPool - list->nPool) < wlen) {
+ wlen= (((slen+1)/2)*2)+4; /* four bytes for flags and length, pad to */
+ /* 2-byte boundary */
+ if ((list->szPool-list->nPool)<wlen) {
if (wlen > 1024)
list->szPool += XkbPaddedSize(wlen * 2);
else
list->szPool += 1024;
- list->pool = realloc(list->pool, list->szPool * sizeof(char));
- if (!list->pool)
- return BadAlloc;
+ list->pool= realloc(list->pool, list->szPool * sizeof(char));
+ if (!list->pool)
+ return BadAlloc;
}
- wire16 = (unsigned short *) &list->pool[list->nPool];
- wire8 = (unsigned char *) &wire16[2];
- wire16[0] = flags;
- wire16[1] = slen;
- memcpy(wire8, str, slen);
+ wire16= (unsigned short *)&list->pool[list->nPool];
+ wire8= (unsigned char *)&wire16[2];
+ wire16[0]= flags;
+ wire16[1]= slen;
+ memcpy(wire8,str,slen);
if (client->swapped) {
- swaps(&wire16[0]);
- swaps(&wire16[1]);
+ swaps(&wire16[0]);
+ swaps(&wire16[1]);
}
- list->nPool += wlen;
+ list->nPool+= wlen;
list->nFound[what]++;
list->nTotal++;
return Success;
@@ -118,168 +128,168 @@ _AddListComponent(XkbSrvListInfoPtr list,
/***====================================================================***/
static Status
-XkbDDXListComponent(DeviceIntPtr dev,
+XkbDDXListComponent( DeviceIntPtr dev,
int what, XkbSrvListInfoPtr list, ClientPtr client)
{
- char *file, *map, *tmp, *buf = NULL;
- FILE *in;
- Status status;
- Bool haveDir;
-
-#ifdef WIN32
- char tmpname[PATH_MAX];
+char *file,*map,*tmp,*buf=NULL;
+FILE *in;
+Status status;
+Bool haveDir;
+#if defined(WIN32) || defined(__CYGWIN__)
+char tmpname[PATH_MAX];
#else
- int rval;
+int rval;
#endif
- if ((list->pattern[what] == NULL) || (list->pattern[what][0] == '\0'))
- return Success;
- file = list->pattern[what];
- map = strrchr(file, '(');
- if (map != NULL) {
- char *tmp;
+ if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0'))
+ return Success;
+ file= list->pattern[what];
+ map= strrchr(file,'(');
+ if (map!=NULL) {
+ char *tmp;
- map++;
- tmp = strrchr(map, ')');
- if ((tmp == NULL) || (tmp[1] != '\0')) {
- /* illegal pattern. No error, but no match */
- return Success;
- }
+ map++;
+ tmp= strrchr(map,')');
+ if ((tmp==NULL)||(tmp[1]!='\0')) {
+ /* illegal pattern. No error, but no match */
+ return Success;
+ }
}
- in = NULL;
- haveDir = TRUE;
-#ifdef WIN32
+ in= NULL;
+ haveDir= TRUE;
+#if defined(WIN32) || defined(__CYGWIN__)
strcpy(tmpname, Win32TempDir());
- strcat(tmpname, "\\xkb_XXXXXX");
+ strcat(tmpname, PATHSEPARATOR "xkb_XXXXXX");
(void) mktemp(tmpname);
#endif
- if (XkbBaseDirectory != NULL) {
- if ((list->pattern[what][0] == '*') && (list->pattern[what][1] == '\0')) {
- if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
- componentDirs[what]) == -1)
- buf = NULL;
- else
- in = fopen(buf, "r");
- }
- if (!in) {
- haveDir = FALSE;
- free(buf);
- if (asprintf
- (&buf,
- "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
- XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
- (long) ((xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
+ if (XkbBaseDirectory!=NULL) {
+ if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
+ if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
+ componentDirs[what]) == -1)
+ buf = NULL;
+ else
+ in = fopen(buf,"r");
+ }
+ if (!in) {
+ haveDir= FALSE;
+ free(buf);
+ if (asprintf
+ (&buf,
+ "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
+ XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
+ (long) ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
file W32_tmpfile) == -1)
- buf = NULL;
- }
+ buf = NULL;
+ }
}
else {
- if ((list->pattern[what][0] == '*') && (list->pattern[what][1] == '\0')) {
- if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
- buf = NULL;
- else
- in = fopen(buf, "r");
- }
- if (!in) {
- haveDir = FALSE;
- free(buf);
- if (asprintf
- (&buf,
- "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
- componentDirs[what],
- (long) ((xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
+ if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
+ if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
+ buf = NULL;
+ else
+ in = fopen(buf,"r");
+ }
+ if (!in) {
+ haveDir= FALSE;
+ free(buf);
+ if (asprintf
+ (&buf,
+ "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
+ componentDirs[what],
+ (long) ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
file W32_tmpfile) == -1)
- buf = NULL;
- }
+ buf = NULL;
+ }
}
- status = Success;
- if (!haveDir) {
-#ifndef WIN32
- in = Popen(buf, "r");
+ status= Success;
+ if (!haveDir)
+ {
+#if !defined(WIN32) && !defined(__CYGWIN__)
+ in= Popen(buf,"r");
#else
if (xkbDebugFlags)
- DebugF("[xkb] xkbList executes: %s\n", buf);
- if (System(buf) < 0)
- ErrorF("[xkb] Could not invoke keymap compiler\n");
- else
- in = fopen(tmpname, "r");
+ DebugF("[xkb] xkbList executes: %s\n",buf);
+ if (System(buf) < 0)
+ ErrorF("[xkb] Could not invoke keymap compiler\n");
+ else
+ in= fopen(tmpname, "r");
#endif
}
if (!in) {
- free(buf);
-#ifdef WIN32
- unlink(tmpname);
+ free(buf);
+#if defined(WIN32) || defined(__CYGWIN__)
+ unlink(tmpname);
#endif
- return BadImplementation;
+ return BadImplementation;
}
- list->nFound[what] = 0;
+ list->nFound[what]= 0;
free(buf);
buf = malloc(PATH_MAX * sizeof(char));
if (!buf) {
fclose(in);
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
unlink(tmpname);
#endif
return BadAlloc;
}
- while ((status == Success) && ((tmp = fgets(buf, PATH_MAX, in)) != NULL)) {
- unsigned flags;
- register unsigned int i;
+ while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
+ unsigned flags;
+ register unsigned int i;
- if (*tmp == '#') /* comment, skip it */
- continue;
- if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, " ", 8))
- /* skip warnings too */
- continue;
- flags = 0;
- /* each line in the listing is supposed to start with two */
- /* groups of eight characters, which specify the general */
- /* flags and the flags that are specific to the component */
- /* if they're missing, fail with BadImplementation */
- for (i = 0; (i < 8) && (status == Success); i++) { /* read the general flags */
+ if (*tmp=='#') /* comment, skip it */
+ continue;
+ if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, " ", 8))
+ /* skip warnings too */
+ continue;
+ flags= 0;
+ /* each line in the listing is supposed to start with two */
+ /* groups of eight characters, which specify the general */
+ /* flags and the flags that are specific to the component */
+ /* if they're missing, fail with BadImplementation */
+ for (i=0;(i<8)&&(status==Success);i++) { /* read the general flags */
if (isalpha(*tmp))
flags |= (1L << i);
else if (*tmp != '-')
status = BadImplementation;
- tmp++;
- }
+ tmp++;
+ }
if (status != Success)
break;
- if (!isspace(*tmp)) {
- status = BadImplementation;
- break;
- }
+ if (!isspace(*tmp)) {
+ status= BadImplementation;
+ break;
+ }
else
tmp++;
- for (i = 0; (i < 8) && (status == Success); i++) { /* read the component flags */
+ for (i=0;(i<8)&&(status==Success);i++) { /* read the component flags */
if (isalpha(*tmp))
flags |= (1L << (i + 8));
else if (*tmp != '-')
status = BadImplementation;
- tmp++;
- }
+ tmp++;
+ }
if (status != Success)
break;
- if (isspace(*tmp)) {
- while (isspace(*tmp)) {
- tmp++;
- }
- }
- else {
- status = BadImplementation;
- break;
- }
- status = _AddListComponent(list, what, flags, tmp, client);
+ if (isspace(*tmp)) {
+ while (isspace(*tmp)) {
+ tmp++;
+ }
+ }
+ else {
+ status= BadImplementation;
+ break;
+ }
+ status= _AddListComponent(list,what,flags,tmp,client);
}
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__CYGWIN__)
if (haveDir)
- fclose(in);
- else if ((rval = Pclose(in)) != 0) {
- if (xkbDebugFlags)
- ErrorF("[xkb] xkbcomp returned exit code %d\n", rval);
+ fclose(in);
+ else if ((rval=Pclose(in))!=0) {
+ if (xkbDebugFlags)
+ ErrorF("[xkb] xkbcomp returned exit code %d\n",rval);
}
#else
fclose(in);
@@ -293,18 +303,18 @@ XkbDDXListComponent(DeviceIntPtr dev,
/* ARGSUSED */
Status
-XkbDDXList(DeviceIntPtr dev, XkbSrvListInfoPtr list, ClientPtr client)
+XkbDDXList(DeviceIntPtr dev,XkbSrvListInfoPtr list,ClientPtr client)
{
- Status status;
+Status status;
- status = XkbDDXListComponent(dev, _XkbListKeycodes, list, client);
- if (status == Success)
- status = XkbDDXListComponent(dev, _XkbListTypes, list, client);
- if (status == Success)
- status = XkbDDXListComponent(dev, _XkbListCompat, list, client);
- if (status == Success)
- status = XkbDDXListComponent(dev, _XkbListSymbols, list, client);
- if (status == Success)
- status = XkbDDXListComponent(dev, _XkbListGeometry, list, client);
+ status= XkbDDXListComponent(dev,_XkbListKeycodes,list,client);
+ if (status==Success)
+ status= XkbDDXListComponent(dev,_XkbListTypes,list,client);
+ if (status==Success)
+ status= XkbDDXListComponent(dev,_XkbListCompat,list,client);
+ if (status==Success)
+ status= XkbDDXListComponent(dev,_XkbListSymbols,list,client);
+ if (status==Success)
+ status= XkbDDXListComponent(dev,_XkbListGeometry,list,client);
return status;
}
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index cb2dfc31c..edf9c4983 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -45,14 +45,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XI.h>
#include "xkb.h"
- /*
- * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
- * relative to the top-level XKB configuration directory.
- * Making the server write to a subdirectory of that directory
- * requires some work in the general case (install procedure
- * has to create links to /var or somesuch on many machines),
- * so we just compile into /usr/tmp for now.
- */
+ /*
+ * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
+ * relative to the top-level XKB configuration directory.
+ * Making the server write to a subdirectory of that directory
+ * requires some work in the general case (install procedure
+ * has to create links to /var or somesuch on many machines),
+ * so we just compile into /usr/tmp for now.
+ */
#ifndef XKM_OUTPUT_DIR
#define XKM_OUTPUT_DIR "compiled/"
#endif
@@ -71,7 +71,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef WIN32
#include <X11/Xwindows.h>
-const char *
+const char*
Win32TempDir()
{
static char buffer[PATH_MAX];
@@ -79,11 +79,11 @@ Win32TempDir()
if (GetTempPath(sizeof(buffer), buffer)) {
int len;
- buffer[sizeof(buffer) - 1] = 0;
+ buffer[sizeof(buffer)-1] = 0;
len = strlen(buffer);
if (len > 0)
- if (buffer[len - 1] == '\\')
- buffer[len - 1] = 0;
+ if (buffer[len-1] == '\\')
+ buffer[len-1] = 0;
return buffer;
}
if (getenv("TEMP") != NULL)
@@ -94,7 +94,7 @@ Win32TempDir()
return "/tmp";
}
-int
+int
Win32System(const char *cmdline)
{
STARTUPINFO si;
@@ -102,38 +102,38 @@ Win32System(const char *cmdline)
DWORD dwExitCode;
char *cmd = strdup(cmdline);
- ZeroMemory(&si, sizeof(si));
+ ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
- ZeroMemory(&pi, sizeof(pi));
+ ZeroMemory( &pi, sizeof(pi) );
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
- LPVOID buffer;
+ LPVOID buffer;
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) & buffer, 0, NULL)) {
- ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
- }
+ ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
+ }
else {
- ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *) buffer);
- LocalFree(buffer);
- }
+ ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *)buffer);
+ LocalFree(buffer);
+ }
- free(cmd);
- return -1;
+ free(cmd);
+ return -1;
}
/* Wait until child process exits. */
- WaitForSingleObject(pi.hProcess, INFINITE);
-
- GetExitCodeProcess(pi.hProcess, &dwExitCode);
+ WaitForSingleObject( pi.hProcess, INFINITE );
+ GetExitCodeProcess( pi.hProcess, &dwExitCode);
+
/* Close process and thread handles. */
- CloseHandle(pi.hProcess);
- CloseHandle(pi.hThread);
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
free(cmd);
return dwExitCode;
@@ -141,6 +141,17 @@ Win32System(const char *cmdline)
#undef System
#define System(x) Win32System(x)
+#elif defined(__CYGWIN__)
+const char*
+Win32TempDir(void)
+{
+ if (getenv("TEMP") != NULL)
+ return getenv("TEMP");
+ else if (getenv("TMP") != NULL)
+ return getenv("TEMP");
+ else
+ return "/tmp";
+}
#endif
static void
@@ -150,36 +161,36 @@ OutputDirectory(char *outdir, size_t size)
/* Can we write an xkm and then open it too? */
if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 &&
(strlen(XKM_OUTPUT_DIR) < size)) {
- (void) strcpy(outdir, XKM_OUTPUT_DIR);
+ (void) strcpy (outdir, XKM_OUTPUT_DIR);
}
else
#else
if (strlen(Win32TempDir()) + 1 < size) {
- (void) strcpy(outdir, Win32TempDir());
- (void) strcat(outdir, "\\");
+ (void) strcpy(outdir, Win32TempDir());
+ (void) strcat(outdir, "\\");
}
else
#endif
if (strlen("/tmp/") < size) {
- (void) strcpy(outdir, "/tmp/");
+ (void) strcpy (outdir, "/tmp/");
}
}
static Bool
-XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- unsigned want,
+XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
+ XkbComponentNamesPtr names,
+ unsigned want,
unsigned need, char *nameRtrn, int nameRtrnLen)
{
- FILE *out;
- char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+ FILE * out;
+ char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
- const char *emptystring = "";
+ const char *emptystring = "";
char *xkbbasedirflag = NULL;
- const char *xkbbindir = emptystring;
- const char *xkbbindirsep = emptystring;
+ const char *xkbbindir = emptystring;
+ const char *xkbbindirsep = emptystring;
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
/* WIN32 has no popen. The input must be stored in a file which is
used as input for xkbcomp. xkbcomp does not read from stdin. */
char tmpname[PATH_MAX];
@@ -192,38 +203,38 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
strcpy(tmpname, Win32TempDir());
- strcat(tmpname, "\\xkb_XXXXXX");
+ strcat(tmpname, PATHSEPARATOR "xkb_XXXXXX");
(void) mktemp(tmpname);
#endif
if (XkbBaseDirectory != NULL) {
- if (asprintf(&xkbbasedirflag, "\"-R%s\"", XkbBaseDirectory) == -1)
- xkbbasedirflag = NULL;
+ if (asprintf(&xkbbasedirflag, "\"-R%s\"", XkbBaseDirectory) == -1)
+ xkbbasedirflag = NULL;
}
if (XkbBinDirectory != NULL) {
- int ld = strlen(XkbBinDirectory);
- int lps = strlen(PATHSEPARATOR);
+ int ld = strlen(XkbBinDirectory);
+ int lps = strlen(PATHSEPARATOR);
- xkbbindir = XkbBinDirectory;
+ xkbbindir = XkbBinDirectory;
if ((ld >= lps) && (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
- xkbbindirsep = PATHSEPARATOR;
- }
+ xkbbindirsep = PATHSEPARATOR;
+ }
}
if (asprintf(&buf,
- "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
- "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
- xkbbindir, xkbbindirsep,
- ((xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
- xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
- PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
- xkm_output_dir, keymap) == -1)
- buf = NULL;
+ "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
+ "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+ xkbbindir, xkbbindirsep,
+ ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
+ xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
+ PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
+ xkm_output_dir, keymap) == -1)
+ buf = NULL;
free(xkbbasedirflag);
@@ -232,158 +243,158 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
"XKB: Could not invoke xkbcomp: not enough memory\n");
return FALSE;
}
-
-#ifndef WIN32
- out = Popen(buf, "w");
+
+#if !defined(WIN32) && !defined(__CYGWIN__)
+ out= Popen(buf,"w");
#else
- out = fopen(tmpname, "w");
+ out= fopen(tmpname, "w");
#endif
-
- if (out != NULL) {
+
+ if (out!=NULL) {
#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
- }
+ if (xkbDebugFlags) {
+ ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+ XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
+ }
#endif
- XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
-#ifndef WIN32
- if (Pclose(out) == 0)
+ XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
+#if !defined(WIN32) && !defined(__CYGWIN__)
+ if (Pclose(out)==0)
#else
- if (fclose(out) == 0 && System(buf) >= 0)
+ if (fclose(out)==0 && System(buf) >= 0)
#endif
- {
+ {
if (xkbDebugFlags)
- DebugF("[xkb] xkb executes: %s\n", buf);
- if (nameRtrn) {
- strlcpy(nameRtrn, keymap, nameRtrnLen);
- }
+ DebugF("[xkb] xkb executes: %s\n",buf);
+ if (nameRtrn) {
+ strlcpy(nameRtrn,keymap,nameRtrnLen);
+ }
free(buf);
-#ifdef WIN32
- unlink(tmpname);
+#if defined(WIN32) || defined(__CYGWIN__)
+ unlink(tmpname);
#endif
- return TRUE;
- }
- else
- LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
-#ifdef WIN32
+ return TRUE;
+ }
+ else
+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+#if defined(WIN32) || defined(__CYGWIN__)
/* remove the temporary file */
unlink(tmpname);
#endif
}
else {
#ifndef WIN32
- LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
+ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
- LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
+ LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
#endif
}
if (nameRtrn)
- nameRtrn[0] = '\0';
+ nameRtrn[0]= '\0';
free(buf);
return FALSE;
}
static FILE *
-XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
+XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen)
{
- char buf[PATH_MAX], xkm_output_dir[PATH_MAX];
- FILE *file;
+char buf[PATH_MAX],xkm_output_dir[PATH_MAX];
+FILE * file;
- buf[0] = '\0';
- if (mapName != NULL) {
- OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
- if ((XkbBaseDirectory != NULL) && (xkm_output_dir[0] != '/')
+ buf[0]= '\0';
+ if (mapName!=NULL) {
+ OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
+ if ((XkbBaseDirectory!=NULL)&&(xkm_output_dir[0]!='/')
#ifdef WIN32
- && (!isalpha(xkm_output_dir[0]) || xkm_output_dir[1] != ':')
+ &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
#endif
- ) {
+ ) {
if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
xkm_output_dir, mapName) >= PATH_MAX)
buf[0] = '\0';
- }
+ }
else {
if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
>= PATH_MAX)
buf[0] = '\0';
- }
- if (buf[0] != '\0')
- file = fopen(buf, "rb");
+ }
+ if (buf[0] != '\0')
+ file= fopen(buf,"rb");
else
file = NULL;
}
else
file = NULL;
- if ((fileNameRtrn != NULL) && (fileNameRtrnLen > 0)) {
- strlcpy(fileNameRtrn, buf, fileNameRtrnLen);
+ if ((fileNameRtrn!=NULL)&&(fileNameRtrnLen>0)) {
+ strlcpy(fileNameRtrn,buf,fileNameRtrnLen);
}
return file;
}
unsigned
-XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need,
+XkbDDXLoadKeymapByNames( DeviceIntPtr keybd,
+ XkbComponentNamesPtr names,
+ unsigned want,
+ unsigned need,
XkbDescPtr *xkbRtrn, char *nameRtrn, int nameRtrnLen)
{
- XkbDescPtr xkb;
- FILE *file;
- char fileName[PATH_MAX];
- unsigned missing;
+XkbDescPtr xkb;
+FILE * file;
+char fileName[PATH_MAX];
+unsigned missing;
*xkbRtrn = NULL;
if ((keybd == NULL) || (keybd->key == NULL) ||
(keybd->key->xkbInfo == NULL))
- xkb = NULL;
+ xkb= NULL;
else
xkb = keybd->key->xkbInfo->desc;
- if ((names->keycodes == NULL) && (names->types == NULL) &&
- (names->compat == NULL) && (names->symbols == NULL) &&
- (names->geometry == NULL)) {
+ if ((names->keycodes==NULL)&&(names->types==NULL)&&
+ (names->compat==NULL)&&(names->symbols==NULL)&&
+ (names->geometry==NULL)) {
LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
keybd->name ? keybd->name : "(unnamed keyboard)");
return 0;
}
- else if (!XkbDDXCompileKeymapByNames(xkb, names, want, need,
- nameRtrn, nameRtrnLen)) {
- LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
- return 0;
+ else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
+ nameRtrn,nameRtrnLen)){
+ LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
+ return 0;
}
- file = XkbDDXOpenConfigFile(nameRtrn, fileName, PATH_MAX);
- if (file == NULL) {
+ file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
+ if (file==NULL) {
LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
fileName);
- return 0;
+ return 0;
}
- missing = XkmReadFile(file, need, want, xkbRtrn);
- if (*xkbRtrn == NULL) {
- LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
- fclose(file);
- (void) unlink(fileName);
- return 0;
+ missing= XkmReadFile(file,need,want,xkbRtrn);
+ if (*xkbRtrn==NULL) {
+ LogMessage(X_ERROR, "Error loading keymap %s\n",fileName);
+ fclose(file);
+ (void) unlink (fileName);
+ return 0;
}
else {
DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
(*xkbRtrn)->defined);
}
fclose(file);
- (void) unlink(fileName);
- return (need | want) & (~missing);
+ (void) unlink (fileName);
+ return (need|want)&(~missing);
}
Bool
-XkbDDXNamesFromRules(DeviceIntPtr keybd,
- char *rules_name,
+XkbDDXNamesFromRules( DeviceIntPtr keybd,
+ char * rules_name,
XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names)
{
- char buf[PATH_MAX];
- FILE *file;
- Bool complete;
- XkbRF_RulesPtr rules;
+char buf[PATH_MAX];
+FILE * file;
+Bool complete;
+XkbRF_RulesPtr rules;
if (!rules_name)
- return FALSE;
+ return FALSE;
if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name)
>= PATH_MAX) {
@@ -394,25 +405,25 @@ XkbDDXNamesFromRules(DeviceIntPtr keybd,
file = fopen(buf, "r");
if (!file) {
LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", buf);
- return FALSE;
+ return FALSE;
}
rules = XkbRF_Create();
if (!rules) {
LogMessage(X_ERROR, "XKB: Couldn't create rules struct\n");
- fclose(file);
- return FALSE;
+ fclose(file);
+ return FALSE;
}
if (!XkbRF_LoadRules(file, rules)) {
LogMessage(X_ERROR, "XKB: Couldn't parse rules file %s\n", rules_name);
- fclose(file);
- XkbRF_Free(rules, TRUE);
- return FALSE;
+ fclose(file);
+ XkbRF_Free(rules,TRUE);
+ return FALSE;
}
memset(names, 0, sizeof(*names));
- complete = XkbRF_GetComponents(rules, defs, names);
+ complete = XkbRF_GetComponents(rules,defs,names);
fclose(file);
XkbRF_Free(rules, TRUE);
@@ -442,11 +453,11 @@ XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
* or equal to need, the compiliation is treated as failure.
*/
static XkbDescPtr
-XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
+XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
{
XkbDescPtr xkb = NULL;
unsigned int provided;
- XkbComponentNamesRec kccgst = { 0 };
+ XkbComponentNamesRec kccgst = {0};
char name[PATH_MAX];
if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
@@ -466,7 +477,7 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
}
XkbDescPtr
-XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
+XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
{
XkbDescPtr xkb;
unsigned int need;
@@ -478,7 +489,7 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
/* These are the components we really really need */
need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
- XkmKeyNamesMask | XkmVirtualModsMask;
+ XkmKeyNamesMask | XkmVirtualModsMask;
xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
diff --git a/xorg-server.pc.in b/xorg-server.pc.in
index a98eca8f9..1de1c6c50 100644
--- a/xorg-server.pc.in
+++ b/xorg-server.pc.in
@@ -17,4 +17,4 @@ Description: Modular X.Org X Server
Version: @PACKAGE_VERSION@
Requires.private: @SDK_REQUIRED_MODULES@
Cflags: -I${sdkdir} @symbol_visibility@
-Libs: -L${libdir}
+Libs: -L${libdir} @XORG_DRIVER_LIBS@