summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreich <eich>2003-10-02 13:29:35 +0000
committereich <eich>2003-10-02 13:29:35 +0000
commit0d775dfa721ede18ab8e11983f65dbb62362e762 (patch)
tree85b87858c8b402981564ee781c9937d03397bb8c
parent5961cf7b40ffb6ce6317373aed5a007f87e198d7 (diff)
475. APM driver:
. improved clock parameter calculation. . Fixed order of initialization of cursor. . Fixed restauration of grapical text mode. . Added YUY2 video format. . Corrected accel framebuffer pitches and max screen height (BugzillaR #528, Egbert Eich). 474. Moved DisableMMIO() out of the unmap() function, added call to EnableMMIO() to EnterVT() to work around lockup problems when switching between two Xserver (BugzillaR #748, Egbert Eich). 473. Fixed problem with text widget in Xaw when widget has a different depth than the default visual (Bugzilla #745, Wolfram Gloger). 472. Fixed Sig11 when calling X -query with no ipv6 support in kernel (BugzillaR #737, Egbert Eich). 471. Added support for Sparc64 and AMD64 on FreeBSD. This patch also disables warnings from system headers, fixes some elf relocations also relevant for other platforms and disables translation of KEY_SysReqest and KEY_Break on sparc64. (Bugzilla #739, Eric Anholt). 470. Switched VIA video driver to fillkey helper function (Bugzilla #525, Alan Cox). 469. Fixed CRT modes > FP panel size for siliconmotion (Bugzilla #727, Hugues Fournier). 468. Fixed xedit coredumps: update counter of free objects when getting an object from the list (BugzillaR #722, Egbert Eich). 467. Fixed definititon of UseInstalledOnCrossCompile so that it never is undefined (Harlod L. Hunt II). 466. Add the 'b' flag to fopen() when opening binary xkm files. This is irrelevant for *nix OSes, but reqired for Cygwin. (Bugzilla #689, Harold L Hunt II). 465. Cygwin: * MultiWindow Mode: Automatically validate the size of windows that are being resized. (Earle F. Philhower III) * Safely shutdown the MultiWindow Mode and Clipboard Manager threads on server shutdown. (Earle F. Philhower III) * MultiWindow Mode - Fix a crash from a string copy bug. (Earle F. Philhower III) * Add lots of defaults for keyboardlayout. (Alexander Gottwald) * Add a system tha allows arbitrary commands to be added to the tray menu icon. (Earle F. Philhower III) * Print the name of the keyboardlayout to aid in adding more layouts. (Alexander Gottwald) * Stop printing the IDirectDrawSurface4_Blt() failure messages after 10 times. (Harold L Hunt II) * Disable check for pc105 keyboard and just assume that it is present. This check was causing problems with certain keyboard drivers that failed to report that a pc105 keyboard was present. (Alexander Gottwald) * MultiWindow Mode - Add handling for WM_CHANGE_STATE IconicState messages; minimize the associated Windows window when these messages are received. (Harold L Hunt II). Submitted: (Bugzilla #704, Harold L. Hunt). 464. cygwin.cf: * removed BuildDPS flag. * Changed Alloca flag as Cygwin 1.5.x supports alloca, now. * Use external expat package by default. * Changed XawI18nDefines to utilize improved wide char suoort in Cygwin 1.5.x. (Bugzilla #699, Harold L. Hunt II). 463. Fixed C&T panel register setting (Akira Taniguchi, Egbert Eich). 462. Fixing crash on ia64 because of wrong setjmp buffer alignment (Bugzilla #596, John Dennis). 461. Changing ImPS/2 mouse Z-axis range to -8 to 7 (Bugzilla #691, Matthew W. S. Bell, Egbert Eich). 460. Making sure the compiled xkb config file is found by Xnest if ProjectRoot is modified (Bugzilla #688, Frank Giessler). 459. Fixing build of machine code .S files on OS/2 (Bugzilla #689, Frank Giessler). - Changed wording of message which is printed by the bigfont extension when shm support doesn't exist (Bugzilla #698, Harold Hunt).
-rw-r--r--config/cf/FreeBSD.cf22
-rw-r--r--config/cf/X11.tmpl8
-rw-r--r--config/cf/cygwin.cf41
-rw-r--r--lib/Xaw/Text.c3
-rw-r--r--programs/Xserver/hw/xfree86/CHANGELOG69
-rw-r--r--programs/Xserver/hw/xfree86/common/Imakefile7
-rw-r--r--programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c56
-rw-r--r--programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c2
-rw-r--r--programs/Xserver/hw/xfree86/drivers/apm/apm_video.c5
-rw-r--r--programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c6
-rw-r--r--programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c12
-rw-r--r--programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c11
-rw-r--r--programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c6
-rw-r--r--programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile2
-rw-r--r--programs/Xserver/hw/xfree86/drivers/via/via_video.c14
-rw-r--r--programs/Xserver/hw/xfree86/input/mouse/mouse.c10
-rw-r--r--programs/Xserver/hw/xfree86/loader/Imakefile2
-rw-r--r--programs/Xserver/hw/xfree86/loader/elfloader.c25
-rw-r--r--programs/Xserver/hw/xfree86/loader/loader.c6
-rw-r--r--programs/Xserver/hw/xfree86/loader/xf86sym.c17
-rw-r--r--programs/Xserver/hw/xfree86/os-support/Imakefile1
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bsd/Imakefile9
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c2
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bus/Imakefile9
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bus/Pci.h14
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bus/Sbus.c2
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c2
-rw-r--r--programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h6
-rw-r--r--programs/Xserver/hw/xfree86/os-support/misc/Imakefile6
-rw-r--r--programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c4
-rw-r--r--programs/Xserver/hw/xnest/Imakefile3
-rw-r--r--programs/Xserver/hw/xwin/Imakefile24
-rw-r--r--programs/Xserver/hw/xwin/InitOutput.c61
-rw-r--r--programs/Xserver/hw/xwin/XWin.man2
-rw-r--r--programs/Xserver/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc105
-rw-r--r--programs/Xserver/hw/xwin/win.h11
-rw-r--r--programs/Xserver/hw/xwin/winclipboard.h2
-rw-r--r--programs/Xserver/hw/xwin/winclipboardthread.c19
-rw-r--r--programs/Xserver/hw/xwin/winclipboardxevents.c81
-rw-r--r--programs/Xserver/hw/xwin/winconfig.c41
-rw-r--r--programs/Xserver/hw/xwin/winerror.c10
-rw-r--r--programs/Xserver/hw/xwin/winmsg.c31
-rw-r--r--programs/Xserver/hw/xwin/winmsg.h25
-rw-r--r--programs/Xserver/hw/xwin/winmultiwindowclass.c93
-rw-r--r--programs/Xserver/hw/xwin/winmultiwindowclass.h48
-rw-r--r--programs/Xserver/hw/xwin/winmultiwindowicons.c10
-rw-r--r--programs/Xserver/hw/xwin/winmultiwindowwindow.c27
-rw-r--r--programs/Xserver/hw/xwin/winmultiwindowwm.c51
-rw-r--r--programs/Xserver/hw/xwin/winmultiwindowwndproc.c272
-rw-r--r--programs/Xserver/hw/xwin/winprefs.c661
-rw-r--r--programs/Xserver/hw/xwin/winprefs.h147
-rw-r--r--programs/Xserver/hw/xwin/winprefslex.l113
-rw-r--r--programs/Xserver/hw/xwin/winprefsyacc.y334
-rw-r--r--programs/Xserver/hw/xwin/winshadddnl.c23
-rw-r--r--programs/Xserver/hw/xwin/wintrayicon.c6
-rw-r--r--programs/Xserver/hw/xwin/winwindow.h8
-rw-r--r--programs/Xserver/hw/xwin/winwndproc.c8
-rw-r--r--programs/Xserver/xkb/ddxLoad.c4
-rw-r--r--programs/xedit/lisp/lisp.c39
59 files changed, 2316 insertions, 322 deletions
diff --git a/config/cf/FreeBSD.cf b/config/cf/FreeBSD.cf
index 2645dfee4..0c5a16576 100644
--- a/config/cf/FreeBSD.cf
+++ b/config/cf/FreeBSD.cf
@@ -182,7 +182,13 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
#if defined(UseInstalled)
#define DefaultCCOptions /**/
#else
-#define DefaultCCOptions -ansi -pedantic -Dasm=__asm GccWarningOptions
+#if defined(HasGcc3) && HasGcc3
+#define NoSystemWarn -Wno-system-headers
+#else
+#define NoSystemWarn
+#endif
+#define DefaultCCOptions -ansi -pedantic NoSystemWarn -Dasm=__asm \
+ GccWarningOptions
#endif
#endif
#ifndef ExtraLibraries
@@ -233,20 +239,24 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
#endif
/*
- * 4.1/i386 and 5.0/i386 have the AGP driver.
+ * 4.1/i386 and 5.0/i386,alpha,ia64,amd64 have the AGP driver.
*/
#ifndef HasAgpGart
#if defined(i386Architecture) && \
(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1))
#define HasAgpGart YES
#endif
+#if (defined(AlphaArchitecture) || defined(ia64Architecture) || \
+ defined(x86_64Architecture)) && (OSMajorVersion >= 5)
+#define HasAgpGart YES
+#endif
#endif
/*
* SSE and 3DNow will be autodetected, so binutils is the only
* requirement for enabling this. By 4.2 they were all supported.
*/
-#if defined(i386Architecture) && \
+#if defined(x86_64Architecture) || defined(i386Architecture) && \
(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 2))
# define HasX86Support YES
# define HasMMXSupport YES
@@ -349,11 +359,13 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
#ifdef i386Architecture
#define ServerExtraDefines GccGasOption XFree86ServerDefines
#endif
-#ifdef AlphaArchitecture
+#if defined(AlphaArchitecture) || defined(Sparc64Architecture) || \
+ defined(ia64Architecture) || defined(x86_64Architecture)
#define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64
#endif
#ifdef Sparc64Architecture
-#define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64
+#define AsVISOption -Av9a
+#define AsOutputArchSize 64
#endif
#define StandardDefines -DCSRG_BASED
diff --git a/config/cf/X11.tmpl b/config/cf/X11.tmpl
index 141fcdd98..89f82c885 100644
--- a/config/cf/X11.tmpl
+++ b/config/cf/X11.tmpl
@@ -5,7 +5,7 @@ XCOMM
XCOMM
XCOMM
XCOMM
-XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.221 2003/09/20 18:03:37 dawes Exp $
+XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.222 2003/09/21 10:54:13 herrb Exp $
/***************************************************************************
* *
@@ -72,9 +72,11 @@ VENDORMANVERSION = XVendorManVersionString
/*
* X-specific things
*/
-#if CrossCompiling
-# if defined UseInstalled && !defined UseInstalledOnCrossCompile
+#if CrossCompiling && !defined(UseInstalledOnCrossCompile)
+# if defined(UseInstalled)
# define UseInstalledOnCrossCompile YES
+# else
+# define UseInstalledOnCrossCompile NO
# endif
#endif
diff --git a/config/cf/cygwin.cf b/config/cf/cygwin.cf
index 2671f7044..c09655d5b 100644
--- a/config/cf/cygwin.cf
+++ b/config/cf/cygwin.cf
@@ -1,4 +1,4 @@
-XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 dawes Exp $
+XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.53 2003/09/21 10:54:13 herrb Exp $
#ifndef OSName
# define OSName Cygwin
@@ -18,6 +18,9 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 daw
#define ProjectRoot /usr/X11R6
+/* We always want to enable server building */
+#define BuildServer YES
+
#ifndef UnixCpp
#define UnixCpp
#endif
@@ -116,6 +119,7 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 daw
#define LexCmd flex -l
#define LexLib -lfl
#define HasFlex YES
+#define HasExpat YES
/*
* Cygwin-specific Windows resource compiler command
@@ -151,16 +155,26 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 daw
# define DefaultCCOptions /* -ansi -pedantic */ GccWarningOptions
#endif
-# ifndef OptimizedCDebugFlags
-# define OptimizedCDebugFlags DefaultGcc2i386Opt
-# endif
+/*
+ * Cygwin 1.5.x now includes alloca
+ */
+#if OSMinorVersion >= 5
+# define AllocateLocalDefines -DINCLUDE_ALLOCA_H
+#else
+# define AllocateLocalDefines -DNO_ALLOCA
+#endif
+
+#ifndef OptimizedCDebugFlags
+# define OptimizedCDebugFlags DefaultGcc2i386Opt
+#endif
#define StandardDefines -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE \
-D_X86_ -D__CYGWIN__ -D_XOPEN_SOURCE \
-D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE \
- -D_SVID_SOURCE -D_GNU_SOURCE -DNO_ALLOCA
+ -D_SVID_SOURCE -D_GNU_SOURCE
-#define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
+#define XawI18nDefines -DHAS_WCHAR_H -DHAS_WCTYPE_H \
+ -DHAS_ISW_FUNCS -DNO_WIDEC_H
#define HasWChar32 YES
#define StandardCppOptions -traditional
@@ -202,7 +216,8 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 daw
-DDDXTIME -DFD_SETSIZE=256 -DDDXOSINIT \
-DDDXOSVERRORF -DDDXOSFATALERROR
#define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT
-#define ServerExtraDefines -DGCCUSESGAS XWinServerDefines
+#define ServerExtraDefines -DGCCUSESGAS XWinServerDefines \
+ AllocateLocalDefines
#define ConnectionFlags -DTCPCONN -DUNIXCONN
#define ExtraLibraries
#define InstUidFlags -m 4711
@@ -289,15 +304,6 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 daw
#define BuildPlugin NO
/*
- * DPS is the Adobe Display Postscript (r) library.
- * It seems that we do not yet have a postscript client library
- * to work in conjunction with DPS; the remedy to this may be
- * as simple as flipping a build switch or instaling Ghostscript.
- * In any case, some work needs to be done before DPS will work.
- */
-#define BuildDPS NO
-
-/*
* Doing a loadable server would probably take some extra work.
*/
#define DoLoadableServer NO
@@ -329,9 +335,6 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.52 2003/09/09 03:20:28 daw
#define XF86CardDrivers /**/
-/* We always want to enable server building */
-#define BuildServer YES
-
/* Server build rules */
#ifndef XnestServer
#define XnestServer YES
diff --git a/lib/Xaw/Text.c b/lib/Xaw/Text.c
index 2b5898214..1698c21da 100644
--- a/lib/Xaw/Text.c
+++ b/lib/Xaw/Text.c
@@ -923,7 +923,7 @@ XawTextInitialize(Widget request, Widget cnew,
ctx->text.file_insert = NULL;
ctx->text.search = NULL;
ctx->text.update = XmuNewScanline(0, 0, 0);
- ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx));
+ ctx->text.gc = XtGetGC(cnew, 0, 0);
ctx->text.hasfocus = False;
ctx->text.margin = ctx->text.r_margin; /* Strucure copy */
ctx->text.left_margin = ctx->text.r_margin.left;
@@ -3619,6 +3619,7 @@ XawTextDestroy(Widget w)
XtFree((char *)ctx->text.lt.info);
XtFree((char *)ctx->text.search);
XmuDestroyScanline(ctx->text.update);
+ XtReleaseGC((Widget)ctx, ctx->text.gc);
}
/*
diff --git a/programs/Xserver/hw/xfree86/CHANGELOG b/programs/Xserver/hw/xfree86/CHANGELOG
index 67cd970c8..dfe49e27d 100644
--- a/programs/Xserver/hw/xfree86/CHANGELOG
+++ b/programs/Xserver/hw/xfree86/CHANGELOG
@@ -1,4 +1,71 @@
XFree86 4.3.99.14 (xx September 2003)
+ 475. APM driver:
+ . improved clock parameter calculation.
+ . Fixed order of initialization of cursor.
+ . Fixed restauration of grapical text mode.
+ . Added YUY2 video format.
+ . Corrected accel framebuffer pitches and max screen height
+ (BugzillaR #528, Egbert Eich).
+ 474. Moved DisableMMIO() out of the unmap() function, added call to
+ EnableMMIO() to EnterVT() to work around lockup problems when
+ switching between two Xserver (BugzillaR #748, Egbert Eich).
+ 473. Fixed problem with text widget in Xaw when widget has a different
+ depth than the default visual (Bugzilla #745, Wolfram Gloger).
+ 472. Fixed Sig11 when calling X -query with no ipv6 support in kernel
+ (BugzillaR #737, Egbert Eich).
+ 471. Added support for Sparc64 and AMD64 on FreeBSD.
+ This patch also disables warnings from system headers, fixes some elf
+ relocations also relevant for other platforms and disables translation of
+ KEY_SysReqest and KEY_Break on sparc64. (Bugzilla #739, Eric Anholt).
+ 470. Switched VIA video driver to fillkey helper function (Bugzilla #525,
+ Alan Cox).
+ 469. Fixed CRT modes > FP panel size for siliconmotion (Bugzilla #727,
+ Hugues Fournier).
+ 468. Fixed xedit coredumps: update counter of free objects when getting an
+ object from the list (BugzillaR #722, Egbert Eich).
+ 467. Fixed definititon of UseInstalledOnCrossCompile so that it never is
+ undefined (Harlod L. Hunt II).
+ 466. Add the 'b' flag to fopen() when opening binary xkm files. This is
+ irrelevant for *nix OSes, but reqired for Cygwin. (Bugzilla #689,
+ Harold L Hunt II).
+ 465. Cygwin:
+ * MultiWindow Mode: Automatically validate the size of windows that are
+ being resized. (Earle F. Philhower III)
+ * Safely shutdown the MultiWindow Mode and Clipboard Manager threads on
+ server shutdown. (Earle F. Philhower III)
+ * MultiWindow Mode - Fix a crash from a string copy bug.
+ (Earle F. Philhower III)
+ * Add lots of defaults for keyboardlayout. (Alexander Gottwald)
+ * Add a system tha allows arbitrary commands to be added to the tray menu
+ icon. (Earle F. Philhower III)
+ * Print the name of the keyboardlayout to aid in adding more layouts.
+ (Alexander Gottwald)
+ * Stop printing the IDirectDrawSurface4_Blt() failure messages after 10
+ times. (Harold L Hunt II)
+ * Disable check for pc105 keyboard and just assume that it is present.
+ This check was causing problems with certain keyboard drivers that
+ failed to report that a pc105 keyboard was present.
+ (Alexander Gottwald)
+ * MultiWindow Mode - Add handling for WM_CHANGE_STATE IconicState
+ messages;
+ minimize the associated Windows window when these messages are
+ received. (Harold L Hunt II).
+ Submitted: (Bugzilla #704, Harold L. Hunt).
+ 464. cygwin.cf:
+ * removed BuildDPS flag.
+ * Changed Alloca flag as Cygwin 1.5.x supports alloca, now.
+ * Use external expat package by default.
+ * Changed XawI18nDefines to utilize improved wide char suoort in
+ Cygwin 1.5.x. (Bugzilla #699, Harold L. Hunt II).
+ 463. Fixed C&T panel register setting (Akira Taniguchi, Egbert Eich).
+ 462. Fixing crash on ia64 because of wrong setjmp buffer alignment (Bugzilla
+ #596, John Dennis).
+ 461. Changing ImPS/2 mouse Z-axis range to -8 to 7 (Bugzilla #691,
+ Matthew W. S. Bell, Egbert Eich).
+ 460. Making sure the compiled xkb config file is found by Xnest if
+ ProjectRoot is modified (Bugzilla #688, Frank Giessler).
+ 459. Fixing build of machine code .S files on OS/2 (Bugzilla #689,
+ Frank Giessler).
458. Import Mesa 5.0.2 (Alan Hourihane).
457. DRI merge (DRI Project)
* details to follow..........
@@ -17769,7 +17836,7 @@ XFree86 3.0a (28 April 1994)
XFree86 3.0 (26 April 1994)
-$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.2867 2003/09/27 13:35:48 pascal Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.2868 2003/09/28 20:15:48 alanh Exp $
diff --git a/programs/Xserver/hw/xfree86/common/Imakefile b/programs/Xserver/hw/xfree86/common/Imakefile
index f55acd52e..dd0c6142e 100644
--- a/programs/Xserver/hw/xfree86/common/Imakefile
+++ b/programs/Xserver/hw/xfree86/common/Imakefile
@@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.151 2003/08/10 16:39:28 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.152 2003/08/24 19:58:02 dawes Exp $
@@ -18,7 +18,8 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.151 2003/08/
#endif /* GNUMachArchitecture */
#else
# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \
- || defined(OpenBSDArchitecture) || defined(NetBSDArchitecture)
+ || defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \
+ || defined(FreeBSDArchitecture)
KBD = xf86KbdBSD
# else
# ifdef LinuxArchitecture
@@ -29,7 +30,7 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.151 2003/08/
# endif
#endif
-#ifdef SparcArchitecture
+#if defined(SparcArchitecture) || defined(Sparc64Architecture)
SBUSSRC = xf86sbusBus.c
SBUSOBJ = xf86sbusBus.o
#endif
diff --git a/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c b/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c
index 665ad512b..5c6650953 100644
--- a/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c
+++ b/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.62 2003/07/25 01:17:05 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.63 2003/08/23 16:09:14 dawes Exp $ */
#include "apm.h"
#include "xf86cmap.h"
@@ -167,6 +167,7 @@ static const char *xaaSymbols[] = {
"XAAScreenIndex",
"XAAStippleScanlineFuncMSBFirst",
"XAAWarpCursor",
+ "XAAPixmapIndex",
NULL
};
@@ -475,7 +476,7 @@ static int *
GetAccelPitchValues(ScrnInfoPtr pScrn)
{
int *linePitches = NULL;
- int linep[] = {640, 800, 1024, 1152, 1280, 1600, 0};
+ int linep[] = {640, 800, 1024, 1152, 1280, 0};
if (sizeof linep > 0) {
linePitches = (int *)xnfalloc(sizeof linep);
@@ -1080,12 +1081,12 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
if (pApm->NoAccel) {
/*
* XXX Assuming min pitch 256, max 2048
- * XXX Assuming min height 128, max 2048
+ * XXX Assuming min height 128, max 1024 (changed EE)
*/
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
NULL, 256, 2048,
- pScrn->bitsPerPixel, 128, 2048,
+ pScrn->bitsPerPixel, 128, 1024,
pScrn->display->virtualX,
pScrn->display->virtualY,
pApm->FbMapSize,
@@ -1097,7 +1098,7 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
GetAccelPitchValues(pScrn), 0, 0,
- pScrn->bitsPerPixel, 128, 2048,
+ pScrn->bitsPerPixel, 128, 1024,
pScrn->display->virtualX,
pScrn->display->virtualY,
pApm->FbMapSize,
@@ -1435,7 +1436,9 @@ comp_lmn(ApmPtr pApm, long clock)
double fref;
double fvco_goal;
double k, c;
-
+ double fout_best = 0;
+ unsigned int best = 0;
+
if (pApm->Chipset >= AT3D)
fmax = 370000.0;
else
@@ -1453,7 +1456,7 @@ comp_lmn(ApmPtr pApm, long clock)
fout = ((double)(n + 1) * fref)/((double)(m + 1) * (1 << l));
fvco_goal = (double)clock * (double)(1 << l);
fvco = fout * (double)(1 << l);
- if (!WITHIN(fvco, 0.995*fvco_goal, 1.005*fvco_goal))
+ if (!WITHIN(fvco, 0.99*fvco_goal, 1.01*fvco_goal))
continue;
if (!WITHIN(fvco, fmin, fmax))
continue;
@@ -1462,6 +1465,16 @@ comp_lmn(ApmPtr pApm, long clock)
if (!WITHIN(fref / (double)(m+1), 300.0, 300000.0))
continue;
+ if (fout_best != 0) {
+ double diff_new = clock - fout;
+ double diff_old = clock - best;
+ diff_new = diff_new < 0 ? -diff_new : diff_new;
+ diff_old = diff_old < 0 ? -diff_old : diff_old;
+ if (diff_new > diff_old)
+ continue;
+ }
+ fout_best = fout;
+
/* The following formula was empirically derived by
matching a number of fvco values with acceptable
values of f.
@@ -1518,11 +1531,15 @@ comp_lmn(ApmPtr pApm, long clock)
if (f > 7) f = 7;
if (f < 0) f = 0;
}
-
- return (n << 16) | (m << 8) | (l << 2) | (f << 4);
+
+ best = (n << 16) | (m << 8) | (l << 2) | (f << 4);
}
}
}
+
+ if (fout_best != 0)
+ return best;
+
xf86DrvMsg(pApm->scrnIndex, X_PROBED,
"Cannot find register values for clock %6.2f MHz. "
"Please use a (slightly) different clock.\n",
@@ -1728,24 +1745,26 @@ ApmRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, ApmRegPtr ApmReg)
ApmWriteCrtc(0x19, ApmReg->CRT[0x19]);
ApmWriteCrtc(0x1A, ApmReg->CRT[0x1A]);
ApmWriteCrtc(0x1B, ApmReg->CRT[0x1B]);
- ApmWriteCrtc(0x1C, ApmReg->CRT[0x1C]);
ApmWriteCrtc(0x1D, ApmReg->CRT[0x1D]);
ApmWriteCrtc(0x1E, ApmReg->CRT[0x1E]);
/* RAMDAC registers. */
WRXL(0xE8, ApmReg->EX[XRE8]);
+
WRXL(0xEC, ApmReg->EX[XREC] & ~(1 << 7));
WRXL(0xEC, ApmReg->EX[XREC] | (1 << 7)); /* Do a PLL resync */
/* Color correction */
WRXL(0xE0, ApmReg->EX[XRE0]);
- WRXB(0x80, ApmReg->EX[XR80]);
-
/*
* This function handles restoring the generic VGA registers.
*/
vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP);
+
+ /* set these after setting the default VGA registers */
+ ApmWriteCrtc(0x1C, ApmReg->CRT[0x1C]);
+ WRXB(0x80, ApmReg->EX[XR80]);
}
else {
/* Set aperture index to 0. */
@@ -1987,6 +2006,13 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
+ /*
+ * Initialize the acceleration interface.
+ */
+ if (!pApm->NoAccel) {
+ ApmAccelInit(pScreen); /* set up XAA interface */
+ }
+
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@@ -2001,12 +2027,6 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
"Hardware cursor initialization failed\n");
}
- /*
- * Initialize the acceleration interface.
- */
- if (!pApm->NoAccel) {
- ApmAccelInit(pScreen); /* set up XAA interface */
- }
/* Initialise default colourmap */
if (!miCreateDefColormap(pScreen))
diff --git a/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c b/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c
index 6b78e8339..fcf5b0208 100644
--- a/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c
+++ b/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c
@@ -38,7 +38,7 @@
# define A(s) Apm##s
# endif
#endif
-#define DPRINTNAME(s) do { xf86DrvMsgVerb(pScrn->pScreen->myNum, X_NOTICE, 4, "Apm" #s APM_SUFF_24 APM_SUFF_IOP "\n"); } while (0)
+#define DPRINTNAME(s) do { xf86DrvMsgVerb(pScrn->pScreen->myNum, X_NOTICE, 6, "Apm" #s APM_SUFF_24 APM_SUFF_IOP "\n"); } while (0)
#if PSZ == 24
#undef SETSOURCEXY
diff --git a/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c b/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c
index c5ac6c51f..2c03e183b 100644
--- a/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c
+++ b/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c
@@ -2,6 +2,7 @@
#if PSZ != 24
#include "dixstruct.h"
+#include "fourcc.h"
/*
* Ported from mga_video.c by Loïc Grenié
@@ -115,7 +116,7 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
{XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
};
-#define NUM_IMAGES 8
+#define NUM_IMAGES 9
typedef char c8;
static XF86ImageRec Images[NUM_IMAGES] =
@@ -171,6 +172,7 @@ static XF86ImageRec Images[NUM_IMAGES] =
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},
XvTopToBottom
},
+ XVIMAGE_YUY2,
{
0x59595959,
XvYUV,
@@ -926,6 +928,7 @@ ApmQueryImageAttributes(ScrnInfoPtr pScrn, int id,
case 0x59565955:
case 0x55595659:
case 0x59555956:
+ case 0x32595559:
size = *w << 1;
goto common;
case 0x59595959:
diff --git a/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c b/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c
index e2be33471..1f5679aaf 100644
--- a/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c
+++ b/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.128 2003/08/23 16:09:15 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.129 2003/09/24 02:43:20 dawes Exp $ */
/*
* Copyright 1993 by Jon Block <block@frc.com>
@@ -6614,9 +6614,9 @@ chipsModeInit655xx(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
if (cPtr->PanelType & ChipsLCD)
- ChipsNew->XR[0x51] |= 0x02;
+ ChipsNew->XR[0x51] |= 0x04;
else
- ChipsNew->XR[0x51] &= ~0x02;
+ ChipsNew->XR[0x51] &= ~0x04;
/* Program the registers */
/*vgaHWProtect(pScrn, TRUE);*/
diff --git a/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c b/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
index eadeccf5d..e20e22d64 100644
--- a/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
+++ b/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
@@ -24,7 +24,7 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
<jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.113 2003/08/23 15:03:10 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.114 2003/08/23 16:09:18 dawes Exp $ */
#include "nv_include.h"
@@ -431,9 +431,13 @@ nvSetup(pointer module, pointer opts, int *errmaj, int *errmin)
static const OptionInfoRec *
NVAvailableOptions(int chipid, int busid)
{
- if(chipid == 0x12D20018)
- return RivaAvailableOptions(chipid, busid);
-
+ if(chipid == 0x12D20018) {
+ if (!xf86LoadOneModule("riva128", NULL)) {
+ return NULL;
+ } else
+ return RivaAvailableOptions(chipid, busid);
+ }
+
return NVOptions;
}
diff --git a/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c b/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
index 89ebbd18a..29398191d 100644
--- a/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
+++ b/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.90 2003/08/23 16:09:19 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.91 2003/09/24 02:43:25 dawes Exp $ */
/*
Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
@@ -1348,8 +1348,9 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
, lcdclk / 1000.0);
}
+ S3VDisableMmio(pScrn);
S3VUnmapMem(pScrn);
-
+
/* And finally set various possible option flags */
ps3v->bankedMono = FALSE;
@@ -1615,6 +1616,8 @@ S3VEnterVT(int scrnIndex, int flags)
#ifdef unmap_always
S3VMapMem(pScrn);
#endif
+ S3VEnableMmio(pScrn);
+
S3VSave(pScrn);
return S3VModeInit(pScrn, pScrn->currentMode);
}
@@ -1644,6 +1647,7 @@ S3VLeaveVT(int scrnIndex, int flags)
S3VWriteMode(pScrn, vgaSavePtr, S3VSavePtr);
/* Restore standard register access */
/* and unmap memory. */
+ S3VDisableMmio(pScrn);
#ifdef unmap_always
S3VUnmapMem(pScrn);
#endif
@@ -2474,8 +2478,6 @@ S3VUnmapMem(ScrnInfoPtr pScrn)
ps3v->PrimaryVidMapped = FALSE;
}
- S3VDisableMmio(pScrn);
-
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)ps3v->MapBase,
S3_NEWMMIO_REGSIZE);
if (ps3v->FBBase)
@@ -3524,6 +3526,7 @@ S3VCloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pScrn->vtSema) {
S3VWriteMode(pScrn, vgaSavePtr, S3VSavePtr);
vgaHWLock(hwp);
+ S3VDisableMmio(pScrn);
S3VUnmapMem(pScrn);
}
diff --git a/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c b/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
index 29b2f3e22..aef198c29 100644
--- a/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
+++ b/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
@@ -26,7 +26,7 @@ Silicon Motion 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 or Silicon Motion.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.32 2003/08/23 15:03:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.33 2003/09/24 02:43:26 dawes Exp $ */
#include "xf86Resources.h"
#include "xf86RAC.h"
@@ -2671,12 +2671,12 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
new->VPR0C = pSmi->FBOffset >> 3;
if (pSmi->rotate)
{
- new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->height) * pSmi->Bpp) >> 3)
+ new->VPR10 = (((( pSmi->height * pSmi->Bpp) >> 3)
+ 2) << 16) | ((pSmi->height * pSmi->Bpp) >> 3);
}
else
{
- new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->width) * pSmi->Bpp) >> 3)
+ new->VPR10 = ((((pSmi->width * pSmi->Bpp) >> 3)
+ 2) << 16) | ((pSmi->width * pSmi->Bpp) >> 3);
}
diff --git a/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile b/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile
index 775fe8352..82e4881e6 100644
--- a/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile
+++ b/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile
@@ -49,7 +49,7 @@ name.o: name.s @@\
#define FFBsObjectRule(name) @@\
name.o: name.s @@\
$(RM) $@ @@\
- $(CPP) $*.s | $(AS) $(GCCVISOPTION) -o $@ -
+ $(CC) -c -x assembler-with-cpp $(GCCVISOPTION) $*.s -o $@
#endif
#else
VISOBJS =
diff --git a/programs/Xserver/hw/xfree86/drivers/via/via_video.c b/programs/Xserver/hw/xfree86/drivers/via/via_video.c
index 9b0b3aa58..bf5dd3d96 100644
--- a/programs/Xserver/hw/xfree86/drivers/via/via_video.c
+++ b/programs/Xserver/hw/xfree86/drivers/via/via_video.c
@@ -1,4 +1,4 @@
-/* $XFree86$ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_video.c,v 1.8 2003/09/11 10:08:38 eich Exp $ */
/*
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
@@ -1231,6 +1231,9 @@ viaPutImageG(
/* BitBlt: Draw the colorkey rectangle */
if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
+
+ xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
+#if 0
/* draw these */
/* FillSolidRects function cause segment fail in SAMM mode
* So I change to use SetupForSolidFill
@@ -1241,14 +1244,7 @@ viaPutImageG(
(CARD32)~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
-#if 0
- pVia->AccelInfoRec->SetupForSolidFill(pScrn,pPriv->colorKey,GXcopy,~0);
- pbox=REGION_RECTS(clipBoxes);
- for(i=REGION_NUM_RECTS(clipBoxes);i;i--,pbox++){
- pVia->AccelInfoRec->SubsequentSolidFillRect(pScrn,pbox->x1,pbox->y1,
- pbox->x2-pbox->x1,pbox->y2-pbox->y1);
- }
-#endif
+#endif
}
/*
diff --git a/programs/Xserver/hw/xfree86/input/mouse/mouse.c b/programs/Xserver/hw/xfree86/input/mouse/mouse.c
index 64feede9a..f0afecc7a 100644
--- a/programs/Xserver/hw/xfree86/input/mouse/mouse.c
+++ b/programs/Xserver/hw/xfree86/input/mouse/mouse.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.75 2003/08/04 10:32:29 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.76 2003/09/17 03:46:32 dawes Exp $ */
/*
*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
@@ -1359,14 +1359,14 @@ MouseReadInput(InputInfoPtr pInfo)
(pBuf[0] & 0x80) >> 3; /* button 5 */
dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
- dz = (signed char)pBuf[3];
- if ((dz >= 7) || (dz <= -8)) {
- if (pMse->autoProbe && !(pBuf[3] & 0xC0)) {
+ dz = (char)(pBuf[3] | ((pBuf[3] & 0x08) ? 0xf8 : 0));
+ if ((pBuf[3] & 0xf8) && ((pBuf[3] & 0xf8) != 0xf8)) {
+ if (pMse->autoProbe) {
SetMouseProto(pMse, PROT_EXPPS2);
xf86Msg(X_INFO,
"Mouse autoprobe: Changing protocol to %s\n",
pMse->protocol);
-
+
goto REDO_INTERPRET;
} else
dz = 0;
diff --git a/programs/Xserver/hw/xfree86/loader/Imakefile b/programs/Xserver/hw/xfree86/loader/Imakefile
index 225af0174..cfaa3c5dd 100644
--- a/programs/Xserver/hw/xfree86/loader/Imakefile
+++ b/programs/Xserver/hw/xfree86/loader/Imakefile
@@ -30,7 +30,7 @@ DLOBJ=dlloader.o
SHM_DEFINES = -DHAS_SHM
#endif
-#if defined (AMD64Architecture)
+#if defined (AMD64Architecture) && defined(linux)
ARCHDEFINES = -DDoMMAPedMerge -DMmapPageAlign
#endif
diff --git a/programs/Xserver/hw/xfree86/loader/elfloader.c b/programs/Xserver/hw/xfree86/loader/elfloader.c
index 1f7c4999e..6d9fdb08b 100644
--- a/programs/Xserver/hw/xfree86/loader/elfloader.c
+++ b/programs/Xserver/hw/xfree86/loader/elfloader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.55 2003/06/18 16:17:41 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.56 2003/08/22 19:27:30 eich Exp $ */
/*
*
@@ -138,7 +138,7 @@
# if !defined(linux)
# error No MAP_ANON?
# endif
-# if !defined (__AMD64__)
+# if !defined (__AMD64__) || !defined(__linux__)
# define MMAP_FLAGS (MAP_PRIVATE | MAP_ANON)
# else
# define MMAP_FLAGS (MAP_PRIVATE | MAP_ANON | MAP_32BIT)
@@ -1235,6 +1235,7 @@ int force;
#endif
#if defined(__sparc__)
unsigned char *dest8; /* address of the 8 bit place being modified */
+ unsigned long *dest64;
#endif
#if defined(__alpha__)
unsigned int *dest32h; /* address of the high 32 bit place being modified */
@@ -2045,7 +2046,6 @@ int force;
break;
case R_SPARC_32: /* 3 */
- case R_SPARC_GLOB_DAT: /* 20 */
case R_SPARC_UA32: /* 23 */
dest32 = (unsigned int *)(secp + rel->r_offset);
symval += rel->r_addend;
@@ -2055,29 +2055,36 @@ int force;
((unsigned char *)dest32)[3] = (unsigned char)(symval );
break;
+ case R_SPARC_GLOB_DAT: /* 20 */
+ case R_SPARC_64: /* 32 */
+ dest64 = (unsigned long *)(secp + rel->r_offset);
+ symval += rel->r_addend;
+ *dest64 = symval;
+ break;
+
case R_SPARC_DISP8: /* 4 */
dest8 = (unsigned char *)(secp + rel->r_offset);
symval += rel->r_addend;
- *dest8 = (symval - (Elf32_Addr) dest8);
+ *dest8 = (symval - (Elf_Addr) dest8);
break;
case R_SPARC_DISP16: /* 5 */
dest16 = (unsigned short *)(secp + rel->r_offset);
symval += rel->r_addend;
- *dest16 = (symval - (Elf32_Addr) dest16);
+ *dest16 = (symval - (Elf_Addr) dest16);
break;
case R_SPARC_DISP32: /* 6 */
dest32 = (unsigned int *)(secp + rel->r_offset);
symval += rel->r_addend;
- *dest32 = (symval - (Elf32_Addr) dest32);
+ *dest32 = (symval - (Elf_Addr) dest32);
break;
case R_SPARC_WDISP30: /* 7 */
dest32 = (unsigned int *)(secp + rel->r_offset);
symval += rel->r_addend;
*dest32 = ((*dest32 & 0xc0000000) |
- ((symval - (Elf32_Addr) dest32) >> 2));
+ (((symval - (Elf_Addr) dest32) >> 2) & 0x3fffffff));
break;
case R_SPARC_HI22: /* 9 */
@@ -2123,8 +2130,8 @@ int force;
break;
case R_SPARC_RELATIVE: /* 22 */
- dest32 = (unsigned int *)(secp + rel->r_offset);
- *dest32 += (unsigned int)secp + rel->r_addend;
+ dest64 = (unsigned long *)(secp + rel->r_offset);
+ *dest64 = (unsigned long)secp + rel->r_addend;
break;
#endif /*__sparc__*/
#ifdef __ia64__
diff --git a/programs/Xserver/hw/xfree86/loader/loader.c b/programs/Xserver/hw/xfree86/loader/loader.c
index 37bd78836..49c619bd6 100644
--- a/programs/Xserver/hw/xfree86/loader/loader.c
+++ b/programs/Xserver/hw/xfree86/loader/loader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.66 2003/09/23 17:55:41 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.67 2003/09/24 02:43:33 dawes Exp $ */
/*
* Copyright 1995-1998 by Metro Link, Inc.
@@ -114,7 +114,7 @@ static char freeHandles[MAX_HANDLE] ;
static int refCount[MAX_HANDLE] ;
#endif
-#if defined(__sparc__) && defined(__GNUC__)
+#if defined(__sparc__) && defined(__GNUC__) && !defined(__FreeBSD__)
# define SYMFUNCDOT(func) { "." #func, (funcptr)&__sparc_dot_ ## func },
# if !defined(__OpenBSD__)
# define SYMFUNCDOT89(func) { "." #func, (funcptr)&func ## _sparcv89 },
@@ -324,7 +324,7 @@ LoaderInit(void)
LoaderAddSymbols(-1, -1, dixLookupTab ) ;
LoaderAddSymbols(-1, -1, fontLookupTab ) ;
LoaderAddSymbols(-1, -1, extLookupTab );
-#ifdef __sparc__
+#if defined(__sparc__) && !defined(__FreeBSD__)
#ifdef linux
if (sparcUseHWMulDiv())
LoaderAddSymbols(-1, -1, SparcV89LookupTab ) ;
diff --git a/programs/Xserver/hw/xfree86/loader/xf86sym.c b/programs/Xserver/hw/xfree86/loader/xf86sym.c
index a34ad7ff9..0a13acf4f 100644
--- a/programs/Xserver/hw/xfree86/loader/xf86sym.c
+++ b/programs/Xserver/hw/xfree86/loader/xf86sym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.234 2003/08/24 17:37:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.235 2003/08/24 19:58:05 dawes Exp $ */
/*
*
@@ -134,6 +134,14 @@ extern void* __remq(long, long);
extern void* __remqu(long, long);
#endif
+#if defined(__sparc__) && defined(__FreeBSD__)
+extern float _Qp_qtos(unsigned int *);
+extern double _Qp_qtod(unsigned int *);
+extern unsigned long long _Qp_qtoux(unsigned int *);
+extern void _Qp_dtoq(unsigned int *, double);
+extern void _Qp_uitoq(unsigned int *, unsigned int);
+#endif
+
#if defined(__GNUC__)
#ifndef __UNIXOS2__
extern long __div64(long, long);
@@ -1074,6 +1082,13 @@ LOOKUP xfree86LookupTab[] = {
#ifdef __FreeBSD__
SYMFUNC(sysctlbyname)
+#if defined(__sparc__)
+ SYMFUNC(_Qp_qtos)
+ SYMFUNC(_Qp_qtod)
+ SYMFUNC(_Qp_qtoux)
+ SYMFUNC(_Qp_uitoq)
+ SYMFUNC(_Qp_dtoq)
+#endif
#endif
/*
diff --git a/programs/Xserver/hw/xfree86/os-support/Imakefile b/programs/Xserver/hw/xfree86/os-support/Imakefile
index d874e36c6..b069a87ea 100644
--- a/programs/Xserver/hw/xfree86/os-support/Imakefile
+++ b/programs/Xserver/hw/xfree86/os-support/Imakefile
@@ -13,6 +13,7 @@ XCOMM $XConsortium: Imakefile /main/9 1996/10/25 15:38:46 kaleb $
#if defined(i386Architecture) || defined(ia64Architecture) || \
(defined(SunArchitecture) && defined(SparcArchitecture)) || \
(defined(FreeBSDArchitecture) && defined(AlphaArchitecture)) || \
+ (defined(FreeBSDArchitecture) && defined(Sparc64Architecture)) || \
(defined(NetBSDArchitecture) && defined(AlphaArchitecture)) || \
(defined(NetBSDArchitecture) && defined(PpcArchitecture)) || \
(defined(NetBSDArchitecture) && defined(SparcArchitecture)) || \
diff --git a/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile b/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile
index 6f92d6eb0..cd8f015a0 100644
--- a/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile
+++ b/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile
@@ -45,10 +45,10 @@ SHARED_CFLAGS = PositionIndependentCFlags
IOPERM_SRC = ioperm_noop.c
IOPERM_OBJ = ioperm_noop.o
# endif
-#elif defined(FreeBSDArchitecture) && !defined(AlphaBsdArchitecture)
+#elif defined(FreeBSDArchitecture)
+# if defined(i386Architecture)
IOPERMDEFINES = -DUSE_DEV_IO
-#else
-# if defined(AlphaBsdArchitecture)
+# elif defined(AlphaBsdArchitecture)
IOPERMDEFINES = -DUSE_ALPHA_PORTS
# else
IOPERM_SRC = ioperm_noop.c
@@ -148,6 +148,9 @@ VIDEO_OBJ = arm_video.o
#elif defined(Sparc64Architecture)
VIDEO_SRC = sparc64_video.c
VIDEO_OBJ = sparc64_video.o
+#elif defined(x86_64Architecture)
+VIDEO_SRC = i386_video.c
+VIDEO_OBJ = i386_video.o
#else
#error Unknown architecture !
#endif
diff --git a/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c b/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c
index e297702ab..9702ff0c7 100644
--- a/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c
+++ b/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c
@@ -18,7 +18,7 @@ resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
#ifdef INCLUDE_XF86_NO_DOMAIN
-#if defined(__alpha__) || defined(__sparc64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
resPtr
xf86BusAccWindowsFromOS(void)
diff --git a/programs/Xserver/hw/xfree86/os-support/bus/Imakefile b/programs/Xserver/hw/xfree86/os-support/bus/Imakefile
index 754be96b3..498a64c4f 100644
--- a/programs/Xserver/hw/xfree86/os-support/bus/Imakefile
+++ b/programs/Xserver/hw/xfree86/os-support/bus/Imakefile
@@ -88,6 +88,15 @@ XCOMM generic FreeBSD PCI driver (using /dev/pci)
PCIDRVRSRC = freebsdPci.c
PCIDRVROBJ = freebsdPci.o
+#elif defined(FreeBSDArchitecture) && defined(Sparc64Architecture)
+
+XCOMM Sparc SBUS & PCI drivers
+
+PCIDRVRSRC = freebsdPci.c
+PCIDRVROBJ = freebsdPci.o
+SBUSDRVSRC = Sbus.c
+SBUSDRVOBJ = Sbus.o
+
#elif defined(NetBSDArchitecture) && defined(AlphaArchitecture)
XCOMM Alpha (NetBSD) PCI driver
diff --git a/programs/Xserver/hw/xfree86/os-support/bus/Pci.h b/programs/Xserver/hw/xfree86/os-support/bus/Pci.h
index e62b02820..524f41082 100644
--- a/programs/Xserver/hw/xfree86/os-support/bus/Pci.h
+++ b/programs/Xserver/hw/xfree86/os-support/bus/Pci.h
@@ -255,6 +255,10 @@
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
+# elif defined(FreeBSD)
+# define ARCH_PCI_INIT freebsdPciInit
+# define INCLUDE_XF86_MAP_PCI_MEM
+# define INCLUDE_XF86_NO_DOMAIN
# endif
# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
#elif defined(__i386__)
@@ -315,14 +319,20 @@
# elif defined(sun)
# define ARCH_PCI_INIT sparcPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
-# elif defined(__OpenBSD__) && defined(__sparc64__)
+# elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__)
# define ARCH_PCI_INIT freebsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
+# if !defined(__FreeBSD__)
# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
+# endif
#elif defined(__AMD64__)
-# define ARCH_PCI_INIT ix86PciInit
+# if defined(__FreeBSD__)
+# define ARCH_PCI_INIT freebsdPciInit
+# else
+# define ARCH_PCI_INIT ix86PciInit
+# endif
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# if defined(linux)
diff --git a/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c b/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c
index 1c1999f58..f81112474 100644
--- a/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c
+++ b/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c
@@ -170,6 +170,8 @@ promIsP1275(void)
promP1275 = TRUE;
else
promP1275 = FALSE;
+#elif defined(__FreeBSD__)
+ promP1275 = TRUE;
#else
#error Missing promIsP1275() function for this OS
#endif
diff --git a/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c b/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c
index bfe4b0f84..3b2bf5a9b 100644
--- a/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c
+++ b/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c
@@ -84,7 +84,7 @@ static pciBusInfo_t freebsdPci0 = {
/* bridge */ NULL
};
-#if !defined(__OpenBSD__)
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
#if X_BYTE_ORDER == X_BIG_ENDIAN
#ifdef __sparc__
#ifndef ASI_PL
diff --git a/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h b/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h
index 3b1d9a83d..dbd17810f 100644
--- a/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h
+++ b/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h
@@ -35,7 +35,13 @@
#elif defined(__OpenBSD__) && defined(__sparc64__)
/* XXX */
#elif defined(CSRG_BASED)
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/fbio.h>
+#include <dev/ofw/openpromio.h>
+#else
#include <machine/fbio.h>
+#endif
#else
#include <sun/fbio.h>
#endif
diff --git a/programs/Xserver/hw/xfree86/os-support/misc/Imakefile b/programs/Xserver/hw/xfree86/os-support/misc/Imakefile
index b5df5c5e9..ffa822693 100644
--- a/programs/Xserver/hw/xfree86/os-support/misc/Imakefile
+++ b/programs/Xserver/hw/xfree86/os-support/misc/Imakefile
@@ -8,7 +8,8 @@ XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:24:12 rws $
#include <Server.tmpl>
-#if defined(i386Architecture) && !defined(cygwinArchitecture)
+#if defined(i386Architecture) && !defined(cygwinArchitecture) \
+ && !defined(OS2Architecture)
XSRCS = BUSmemcpy.S IODelay.S SlowBcopy.S
XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o
#else
@@ -31,7 +32,8 @@ INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
SubdirLibraryRule($(OBJS))
NormalLibraryObjectRule()
-#if defined(i386Architecture) && !defined(cygwinArchitecture)
+#if defined(i386Architecture) && !defined(cygwinArchitecture) \
+ && !defined(OS2Architecture)
ObjectFromAsmSource(BUSmemcpy,NullParameter)
ObjectFromAsmSource(IODelay,NullParameter)
ObjectFromAsmSource(SlowBcopy,NullParameter)
diff --git a/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
index fb8232b41..b052c6cca 100644
--- a/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.95 2003/08/24 17:37:05 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.96 2003/09/09 03:20:41 dawes Exp $ */
/*
* Copyright 1997-2003 by The XFree86 Project, Inc.
*
@@ -484,7 +484,7 @@ xf86mmap(void *start, xf86size_t length, int prot,
if (flags & XF86_MAP_FIXED) f |= MAP_FIXED;
if (flags & XF86_MAP_SHARED) f |= MAP_SHARED;
if (flags & XF86_MAP_PRIVATE) f |= MAP_PRIVATE;
-#ifdef __AMD64__
+#ifdef __AMD64__ && defined(linux)
if (flags & XF86_MAP_32BIT) f |= MAP_32BIT;
#endif
if (prot & XF86_PROT_EXEC) p |= PROT_EXEC;
diff --git a/programs/Xserver/hw/xnest/Imakefile b/programs/Xserver/hw/xnest/Imakefile
index 66ca6fcc8..046669911 100644
--- a/programs/Xserver/hw/xnest/Imakefile
+++ b/programs/Xserver/hw/xnest/Imakefile
@@ -62,12 +62,15 @@ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -DNO_HW_ONLY_EXTS \
-UXFree86LOADER -UMITSHM
+XKB_DEFINES = -DXKB_BASE_DIRECTORY=\"$(LIBDIR)/xkb/\"
+
all:: $(OBJS)
LinkSourceFile(stubs.c,$(SERVERSRC)/Xi)
SpecialCObjectRule(Init,$(ICONFIGFILES),$(_NOOP_))
LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
SpecialCObjectRule(miinitext,$(ICONFIGFILES),-UDPMSExtension)
+SpecialCObjectRule(Keyboard,$(ICONFIGFILES),$(XKB_DEFINES))
NormalLibraryObjectRule()
NormalLibraryTarget(xnest,$(OBJS))
diff --git a/programs/Xserver/hw/xwin/Imakefile b/programs/Xserver/hw/xwin/Imakefile
index fac6a529d..f86f9543a 100644
--- a/programs/Xserver/hw/xwin/Imakefile
+++ b/programs/Xserver/hw/xwin/Imakefile
@@ -9,6 +9,7 @@ SHMDEF = -DHAS_SHM
MMAPDEF = -DHAS_MMAP
+
SRCS = InitInput.c \
InitOutput.c \
stubs.c \
@@ -61,7 +62,23 @@ SRCS = InitInput.c \
wintrayicon.c \
windialogs.c \
winrop.c \
- winpushpxl.c
+ winpushpxl.c \
+ winprefsyacc.y \
+ winprefslex.l \
+ winprefs.c
+
+winprefsyacc.c: winprefsyacc.y
+ bison -d -o winprefsyacc.c winprefsyacc.y
+
+winprefsyacc.h: winprefsyacc.c
+
+winprefslex.c: winprefsyacc.y winprefslex.l winprefsyacc.h
+ flex -owinprefslex.c winprefslex.l
+
+clean::
+ $(RM) winprefslex.c winprefsyacc.h winprefsyacc.c
+
+depend:: winprefslex.c winprefsyacc.h winprefsyacc.c
/*
* NOTE: The XWin.rc file is compiled into XWin.res.
@@ -123,7 +140,10 @@ OBJS = InitInput.o \
wintrayicon.o \
windialogs.o \
winrop.o \
- winpushpxl.o
+ winpushpxl.o \
+ winprefs.o \
+ winprefsyacc.o \
+ winprefslex.o
INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \
diff --git a/programs/Xserver/hw/xwin/InitOutput.c b/programs/Xserver/hw/xwin/InitOutput.c
index 18a1e8fea..02b3c7750 100644
--- a/programs/Xserver/hw/xwin/InitOutput.c
+++ b/programs/Xserver/hw/xwin/InitOutput.c
@@ -30,7 +30,7 @@ from The Open Group.
#include "win.h"
#include "winconfig.h"
-
+#include "winprefs.h"
/*
* General global variables
@@ -47,13 +47,15 @@ int g_iPixmapPrivateIndex = -1;
int g_iWindowPrivateIndex = -1;
unsigned long g_ulServerGeneration = 0;
Bool g_fInitializedDefaultScreens = FALSE;
-FILE *g_pfLog = NULL;
DWORD g_dwEnginesSupported = 0;
HINSTANCE g_hInstance = 0;
HWND g_hDlgDepthChange = NULL;
HWND g_hDlgExit = NULL;
Bool g_fCalledSetLocale = FALSE;
Bool g_fCalledXInitThreads = FALSE;
+int g_iLogVerbose = 4;
+char * g_pszLogFile = WIN_LOG_FNAME;
+Bool g_fLogInited = FALSE;
/*
@@ -180,6 +182,10 @@ ddxGiveUp()
ErrorF ("ddxGiveUp\n");
#endif
+ /* Notify the worker threads we're exiting */
+ winDeinitClipboard ();
+ winDeinitMultiWindowWM ();
+
/* Close our handle to our message queue */
if (g_fdMessageQueue != WIN_FD_INVALID)
{
@@ -190,15 +196,11 @@ ddxGiveUp()
g_fdMessageQueue = WIN_FD_INVALID;
}
- /* Close the log file handle */
- if (g_pfLog != NULL)
- {
- /* Close log file */
- fclose (g_pfLog);
-
- /* Set the file handle to invalid */
- g_pfLog = NULL;
- }
+ if (!g_fLogInited) {
+ LogInit(g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose();
/*
* At this point we aren't creating any new screens, so
@@ -242,12 +244,15 @@ OsVendorInit (void)
#ifdef DDXOSVERRORF
if (!OsVendorVErrorFProc)
OsVendorVErrorFProc = OsVendorVErrorF;
-
- /* Open log file if not yet open */
- if (g_pfLog == NULL)
- g_pfLog = fopen (WIN_LOG_FNAME, "w");
#endif
+ if (!g_fLogInited) {
+ LogInit(g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogSetParameter(XLOG_FLUSH, 1);
+ LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose);
+
/* Add a default screen if no screens were specified */
if (g_iNumScreens == 0)
{
@@ -402,10 +407,6 @@ ddxProcessArgument (int argc, char *argv[], int i)
* that are generated before OsInit () is called.
*/
OsVendorVErrorFProc = OsVendorVErrorF;
-
- /* Open log file if not yet open */
- if (g_pfLog == NULL)
- g_pfLog = fopen (WIN_LOG_FNAME, "w");
#endif
s_fBeenHere = TRUE;
@@ -1208,6 +1209,26 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 2;
}
+ /*
+ * Look for the '-logfile' argument
+ */
+ if (IS_OPTION ("-logfile"))
+ {
+ CHECK_ARGS (1);
+ g_pszLogFile = argv[++i];
+ return 2;
+ }
+
+ /*
+ * Look for the '-logverbose' argument
+ */
+ if (IS_OPTION ("-logverbose"))
+ {
+ CHECK_ARGS (1);
+ g_iLogVerbose = atoi(argv[++i]);
+ return 2;
+ }
+
return 0;
}
@@ -1318,6 +1339,8 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
}
}
+ LoadPreferences();
+
#if CYGDEBUG || YES
ErrorF ("InitOutput - Returning.\n");
#endif
diff --git a/programs/Xserver/hw/xwin/XWin.man b/programs/Xserver/hw/xwin/XWin.man
index b1ef6c27c..8a185f1ca 100644
--- a/programs/Xserver/hw/xwin/XWin.man
+++ b/programs/Xserver/hw/xwin/XWin.man
@@ -87,7 +87,7 @@ Ctrl+Alt+Backspace exits the X Server
Alt+F4 exits the X Server
.SH "SEE ALSO"
.PP
-X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1)
+X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(5)
.SH BUGS
.I XWin
and this man page still have many limitations. Some of the more obvious
diff --git a/programs/Xserver/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc b/programs/Xserver/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
new file mode 100644
index 000000000..dbd79f2bf
--- /dev/null
+++ b/programs/Xserver/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
@@ -0,0 +1,105 @@
+# XWin Server Resource File - EXAMPLE
+# Earle F. Philhower, III
+
+# Place in ~/.XWinrc or in /usr/X11R6/lib/X11/system.XWinrc
+
+# Keywords are case insensitive, comments legal pretty much anywhere
+# you can have an end-of-line
+
+# Comments begin with "#" or "//" and go to the end-of-line
+
+# Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc)
+
+# Paths to icons are **WINDOWS** based (i.e. c:\windows\icons)
+
+# Menus are defined as...
+# MENU <name> {
+# <Menu Text> EXEC <command>
+# ^^ This command will have any "%display%"
+# string replaced with the proper display
+# variable (i.e. 127.0.0.1:<display>.0)
+# or <Menu Text> MENU <name-of-some-prior-defined-menu>
+# or <Menu Text> ALWAYSONTOP
+# ^^ Sets the window to display above all others
+# or <Menu Text> RELOAD
+# ^^ Causes ~/.XWinrc or the system.XWinrc file
+# to be reloaded and icons and menus regenerated
+# or SEPARATOR
+# ...
+# }
+
+# Set the taskmar menu with
+# ROOTMENU <name-of-some-prior-defined-menu>
+
+# If you want a menu to be applied to all popup window's system menu
+# DEFAULTSYSMENU <name-of-some-prior-defined-menu> <atstart|atend>
+
+# To choose a specific menu for a specific WM_CLASS or WM_NAME use ...
+# SYSMENU {
+# <class-or-name-of-window> <name-of-prior-defined-menu> <atstart|atend>
+# ...
+# }
+
+# To define where ICO files live (** Windows path**)
+# ICONDIRECTORY <windows-path i.e. c:\cygwin\usr\icons>
+
+# To define a replacement for the standard X icon for apps w/o specified icons
+# DEFAULTICON <name-of-windows-ico-file-in-icondirectory>
+
+# To define substitute icons on a per-window basis use...
+# ICONS {
+# <class-or-name-of-window> <icon-file-name.ico>
+# ...
+# }
+# In the case where multiple matches occur, the first listed in the ICONS
+# section will be chosen.
+
+# DEBUG <string> prints out the string to the XWin.log file
+
+// Below are just some silly menus to demonstrate writing your
+// own configuration file.
+
+// Make some menus...
+menu apps {
+ xterm exec "xterm"
+ "Emacs" exec "emacs"
+ notepad exec notepad
+ xload exec "xload -display %display%" # Comment
+}
+
+menu root {
+// Comments fit here, too...
+ "Reload .XWinrc" RELOAD
+ "Applications" menu apps
+ SEParATOR
+}
+
+menu aot {
+ Separator
+ "Always on Top" alwaysontop
+}
+
+menu xtermspecial {
+ "Emacs" exec "emacs"
+ "Always on Top" alwaysontop
+ SepArAtor
+}
+
+RootMenu root
+
+DefaultSysMenu aot atend
+
+SysMenu {
+ "xterm" xtermspecial atstart
+}
+
+# IconDirectory "c:\winnt\"
+
+# DefaultIcon "reinstall.ico"
+
+# Icons {
+# "xterm" "uninstall.ico"
+# }
+
+DEBUG "Done parsing the configuration file..."
+
diff --git a/programs/Xserver/hw/xwin/win.h b/programs/Xserver/hw/xwin/win.h
index c5708a1e5..db3e3ecec 100644
--- a/programs/Xserver/hw/xwin/win.h
+++ b/programs/Xserver/hw/xwin/win.h
@@ -578,8 +578,8 @@ extern DWORD g_dwEnginesSupported;
extern HINSTANCE g_hInstance;
extern HWND g_hDlgDepthChange;
extern HWND g_hDlgExit;
-extern int g_copyROP[];
-extern int g_patternROP[];
+extern int g_copyROP[];
+extern int g_patternROP[];
/*
@@ -734,6 +734,13 @@ winInitClipboard (pthread_t *ptClipboardProc,
pthread_mutex_t *ppmServerStarted,
DWORD dwScreen);
+/*
+ * winclipboardthread.c
+ */
+
+void
+winDeinitClipboard ();
+
/*
* wincmap.c
diff --git a/programs/Xserver/hw/xwin/winclipboard.h b/programs/Xserver/hw/xwin/winclipboard.h
index 7503ab08a..3e7c22fa0 100644
--- a/programs/Xserver/hw/xwin/winclipboard.h
+++ b/programs/Xserver/hw/xwin/winclipboard.h
@@ -119,6 +119,8 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
void *
winClipboardProc (void *pArg);
+void
+winDeinitClipboard ();
/*
* winclipboardunicode.c
diff --git a/programs/Xserver/hw/xwin/winclipboardthread.c b/programs/Xserver/hw/xwin/winclipboardthread.c
index ebf588801..7a746a0b3 100644
--- a/programs/Xserver/hw/xwin/winclipboardthread.c
+++ b/programs/Xserver/hw/xwin/winclipboardthread.c
@@ -43,6 +43,7 @@ extern Bool g_fCalledSetLocale;
*/
static jmp_buf g_jmpEntry;
+static Bool g_shutdown = FALSE;
/*
@@ -154,6 +155,12 @@ winClipboardProc (void *pArg)
iReturn);
pthread_exit (NULL);
}
+ else if (g_shutdown)
+ {
+ /* Shutting down, the X server severed out connection! */
+ ErrorF ("winClipboardProc - Detected shutdown in progress\n");
+ pthread_exit (NULL);
+ }
else if (iReturn == WIN_JMP_ERROR_IO)
{
ErrorF ("winClipboardProc - setjmp returned and hwnd: %08x\n", hwnd);
@@ -463,3 +470,15 @@ winClipboardIOErrorHandler (Display *pDisplay)
return 0;
}
+
+
+/*
+ * Notify the clipboard thread we're exiting and not to reconnect
+ */
+
+void
+winDeinitClipboard ()
+{
+ ErrorF ("winDeinitClipboard - Noting shutdown in progress\n");
+ g_shutdown = TRUE;
+}
diff --git a/programs/Xserver/hw/xwin/winclipboardxevents.c b/programs/Xserver/hw/xwin/winclipboardxevents.c
index e34d40c3c..d2cfb2e55 100644
--- a/programs/Xserver/hw/xwin/winclipboardxevents.c
+++ b/programs/Xserver/hw/xwin/winclipboardxevents.c
@@ -81,11 +81,12 @@ winClipboardFlushXEvents (HWND hwnd,
case ClientMessage:
if (event.xclient.data.l[0] == atomDeleteWindow)
{
- ErrorF ("\nReceived WM_DELETE_WINDOW\n\n");
+ ErrorF ("\nwinClipboardFlushXEvents - Received "
+ "WM_DELETE_WINDOW\n\n");
fReturn = FALSE;
}
else
- ErrorF ("\nUnknown ClientMessage\n\n");
+ ErrorF ("\nwinClipboardFlushXEvents - Unknown ClientMessage\n\n");
break;
case SelectionClear:
@@ -98,7 +99,8 @@ winClipboardFlushXEvents (HWND hwnd,
CurrentTime);
if (iReturn == BadAtom || iReturn == BadWindow)
{
- ErrorF ("SelectionClear - XConvertSelection () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionClear - "
+ "XConvertSelection () failed\n");
pthread_exit (NULL);
}
break;
@@ -146,7 +148,8 @@ winClipboardFlushXEvents (HWND hwnd,
(XEvent *) &eventSelection);
if (iReturn == BadValue || iReturn == BadWindow)
{
- ErrorF ("SelectionRequest - XSendEvent () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
pthread_exit (NULL);
}
@@ -176,7 +179,8 @@ winClipboardFlushXEvents (HWND hwnd,
|| iReturn == BadValue
|| iReturn == BadWindow)
{
- ErrorF ("SelectionRequest - XChangeProperty failed: %d\n",
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XChangeProperty failed: %d\n",
iReturn);
}
@@ -201,7 +205,8 @@ winClipboardFlushXEvents (HWND hwnd,
(XEvent *) &eventSelection);
if (iReturn == BadValue || iReturn == BadWindow)
{
- ErrorF ("SelectionRequest - XSendEvent () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
}
break;
}
@@ -209,7 +214,8 @@ winClipboardFlushXEvents (HWND hwnd,
/* Access the clipboard */
if (!OpenClipboard (hwnd))
{
- ErrorF ("SelectionRequest - OpenClipboard () failed: %08x\n",
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "OpenClipboard () failed: %08x\n",
GetLastError ());
pthread_exit (NULL);
}
@@ -235,7 +241,8 @@ winClipboardFlushXEvents (HWND hwnd,
hGlobal = GetClipboardData (CF_TEXT);
if (!hGlobal)
{
- ErrorF ("SelectionRequest - GetClipboardData () failed: %08x\n",
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "GetClipboardData () failed: %08x\n",
GetLastError ());
pthread_exit (NULL);
}
@@ -283,8 +290,8 @@ winClipboardFlushXEvents (HWND hwnd,
&xtpText);
if (iReturn == XNoMemory || iReturn == XLocaleNotSupported)
{
- ErrorF ("SelectionRequest - Xutf8TextListToTextProperty "
- "failed: %d\n",
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "Xutf8TextListToTextProperty failed: %d\n",
iReturn);
exit(1);
}
@@ -324,7 +331,8 @@ winClipboardFlushXEvents (HWND hwnd,
|| iReturn == BadMatch || iReturn == BadValue
|| iReturn == BadWindow)
{
- ErrorF ("SelectionRequest - XChangeProperty failed: %d\n",
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XChangeProperty failed: %d\n",
iReturn);
pthread_exit (NULL);
}
@@ -359,7 +367,8 @@ winClipboardFlushXEvents (HWND hwnd,
(XEvent *) &eventSelection);
if (iReturn == BadValue || iReturn == BadWindow)
{
- ErrorF ("SelectionRequest - XSendEvent () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
pthread_exit (NULL);
}
break;
@@ -379,7 +388,7 @@ winClipboardFlushXEvents (HWND hwnd,
pszAtomName = XGetAtomName (pDisplay,
event.xselection.selection);
- ErrorF ("SelectionNotify - ATOM: %s\n",
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
pszAtomName);
XFree (pszAtomName);
@@ -406,13 +415,15 @@ winClipboardFlushXEvents (HWND hwnd,
if(event.xselection.target == XA_STRING)
{
#if 0
- ErrorF ("SelectionNotify XA_STRING\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XA_STRING\n");
#endif
return fReturn;
}
else if (event.xselection.target == atomUTF8String)
{
- ErrorF ("SelectionNotify UTF8\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify "
+ "UTF8\n");
iReturn = XConvertSelection (pDisplay,
event.xselection.selection,
XA_STRING,
@@ -421,15 +432,16 @@ winClipboardFlushXEvents (HWND hwnd,
CurrentTime);
if (iReturn == BadAtom || iReturn == BadWindow)
{
- ErrorF ("SelectionNotify - XConvertSelection () "
- "failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify "
+ "- XConvertSelection () failed\n");
pthread_exit (NULL);
}
return fReturn;
}
else if (event.xselection.target == atomCompoundText)
{
- ErrorF ("SelectionNotify CompoundText\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify "
+ "CompoundText\n");
iReturn = XConvertSelection (pDisplay,
event.xselection.selection,
atomUTF8String,
@@ -438,15 +450,15 @@ winClipboardFlushXEvents (HWND hwnd,
CurrentTime);
if (iReturn == BadAtom || iReturn == BadWindow)
{
- ErrorF ("SelectionNotify - XConvertSelection () "
- "failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify "
+ "- XConvertSelection () failed\n");
pthread_exit (NULL);
}
return fReturn;
}
else
{
- ErrorF("Unknown format\n");
+ ErrorF ("winClipboardFlushXEvents - Unknown format\n");
return fReturn;
}
}
@@ -481,7 +493,8 @@ winClipboardFlushXEvents (HWND hwnd,
&pszReturnData);
if (iReturn != Success)
{
- ErrorF ("SelectionNotify - XGetWindowProperty () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XGetWindowProperty () failed\n");
pthread_exit (NULL);
}
@@ -523,7 +536,8 @@ winClipboardFlushXEvents (HWND hwnd,
&pszReturnData);
if (iReturn != Success)
{
- ErrorF ("SelectionNotify - XGetWindowProperty () failed\n");
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XGetWindowProperty () failed\n");
pthread_exit (NULL);
}
@@ -591,14 +605,16 @@ winClipboardFlushXEvents (HWND hwnd,
/* Access the Windows clipboard */
if (!OpenClipboard (hwnd))
{
- ErrorF ("OpenClipboard () failed: %08x\n", GetLastError ());
+ ErrorF ("winClipboardFlushXEvents - OpenClipboard () failed: "
+ "%08x\n", GetLastError ());
pthread_exit (NULL);
}
/* Take ownership of the Window clipboard */
if (!EmptyClipboard ())
{
- ErrorF ("EmptyClipboard () failed: %08x\n", GetLastError ());
+ ErrorF ("winClipboardFlushXEvents - EmptyClipboard () failed: "
+ "%08x\n", GetLastError ());
pthread_exit (NULL);
}
@@ -613,7 +629,8 @@ winClipboardFlushXEvents (HWND hwnd,
pszGlobalData = GlobalLock (hGlobal);
if (pszGlobalData == NULL)
{
- ErrorF ("Could not lock global memory for clipboard transfer\n");
+ ErrorF ("winClipboardFlushXEvents - Could not lock global "
+ "memory for clipboard transfer\n");
pthread_exit (NULL);
}
@@ -655,7 +672,9 @@ winClipboardFlushXEvents (HWND hwnd,
/* Release the clipboard */
if (!CloseClipboard ())
{
- ErrorF ("CloseClipboard () failed: %08x\n", GetLastError ());
+ ErrorF ("winClipboardFlushXEvents - CloseClipboard () failed: "
+ "%08x\n",
+ GetLastError ());
pthread_exit (NULL);
}
@@ -669,8 +688,9 @@ winClipboardFlushXEvents (HWND hwnd,
pszAtomName = XGetAtomName (pDisplay,
event.xselection.selection);
- ErrorF ("SelectionNotify - Could not reassert ownership "
- "of selection ATOM: %s\n", pszAtomName);
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "Could not reassert ownership of selection ATOM: %s\n",
+ pszAtomName);
XFree (pszAtomName);
pszAtomName = NULL;
pthread_exit (NULL);
@@ -695,7 +715,8 @@ winClipboardFlushXEvents (HWND hwnd,
iWindow, CurrentTime);
if (iReturn == BadAtom || iReturn == BadWindow)
{
- ErrorF ("Could not reassert ownership of selection\n");
+ ErrorF ("winClipboardFlushXEvents - Could not reassert "
+ "ownership of selection\n");
pthread_exit (NULL);
}
#endif
diff --git a/programs/Xserver/hw/xwin/winconfig.c b/programs/Xserver/hw/xwin/winconfig.c
index 14a10f0a4..b7dab5119 100644
--- a/programs/Xserver/hw/xwin/winconfig.c
+++ b/programs/Xserver/hw/xwin/winconfig.c
@@ -145,16 +145,7 @@ winReadConfigfile ()
}
xf86closeConfigFile ();
- winMsg (X_NONE, "Markers: ");
- winMsg (X_PROBED, "probed, ");
- winMsg (X_CONFIG, "from config file, ");
- winMsg (X_DEFAULT, "default setting,\n ");
- winMsg (X_CMDLINE, "from command line, ");
- winMsg (X_NOTICE, "notice, ");
- winMsg (X_INFO, "informational,\n ");
- winMsg (X_WARNING, "warning, ");
- winMsg (X_ERROR, "error, ");
- winMsg (X_UNKNOWN, "unknown.\n");
+ LogPrintMarkers();
/* set options from data structure */
@@ -223,20 +214,22 @@ typedef struct {
} WinKBLayoutRec, *WinKBLayoutPtr;
WinKBLayoutRec winKBLayouts[] = {
- { 0x405, 4, "pc105", "cz", NULL, NULL, "Czech"},
- { 0x406, 4, "pc105", "dk", NULL, NULL, "Danish"},
- { 0x407, 4, "pc105", "de", NULL, NULL, "German (Germany)"},
- { 0x807, 4, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"},
+ { 0x405, -1, "pc105", "cz", NULL, NULL, "Czech"},
+ { 0x406, -1, "pc105", "dk", NULL, NULL, "Danish"},
+ { 0x407, -1, "pc105", "de", NULL, NULL, "German (Germany)"},
+ { 0x807, -1, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"},
+ {0x10409, -1, "pc105", "dvorak", NULL, NULL, "English (USA, Dvorak)"},
{0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"},
- { 0x809, 4, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
- { 0x40a, 4, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"},
- { 0x40b, 4, "pc105", "fi", NULL, NULL, "Finnish"},
- { 0x40c, 4, "pc105", "fr", NULL, NULL, "French (Standard)"},
- { 0x80c, 4, "pc105", "be", NULL, NULL, "French (Belgian)"},
- { 0x410, 4, "pc105", "it", NULL, NULL, "Italian"},
- { 0x416, 4, "pc105", "pt", NULL, NULL, "Portuguese (Brazil)"},
- { 0x816, 4, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
- { 0x41d, 4, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
+ { 0x809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
+ { 0x40a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"},
+ { 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
+ { 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
+ { 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
+ { 0x410, -1, "pc105", "it", NULL, NULL, "Italian"},
+ { 0x414, -1, "pc105", "no", NULL, NULL, "Norwegian"},
+ { 0x416, -1, "pc105", "pt", NULL, NULL, "Portuguese (Brazil)"},
+ { 0x816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
+ { 0x41d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
{ -1, -1, NULL, NULL, NULL, NULL, NULL}
};
@@ -276,6 +269,8 @@ winConfigKeyboard (DeviceIntPtr pDevice)
{
WinKBLayoutPtr pLayout = winKBLayouts;
+ winMsg (X_DEFAULT, "winConfigKeyboard - Layout: \"%s\" \n", layoutName);
+
layoutNum = strtol (layoutName, (char **)NULL, 16);
for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
diff --git a/programs/Xserver/hw/xwin/winerror.c b/programs/Xserver/hw/xwin/winerror.c
index 3eed51b0e..fa6687c1b 100644
--- a/programs/Xserver/hw/xwin/winerror.c
+++ b/programs/Xserver/hw/xwin/winerror.c
@@ -31,25 +31,17 @@
#include "win.h"
-extern FILE *g_pfLog;
-
#ifdef DDXOSVERRORF
void
OsVendorVErrorF (const char *pszFormat, va_list va_args)
{
static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER;
- /* Check we opened the log file first */
- if (g_pfLog == NULL) return;
-
/* Lock the printing mutex */
pthread_mutex_lock (&s_pmPrinting);
/* Print the error message to a log file, could be stderr */
- vfprintf (g_pfLog, pszFormat, va_args);
-
- /* Flush after every write, to make updates show up quickly */
- fflush (g_pfLog);
+ LogVWrite(0, pszFormat, va_args);
/* Unlock the printing mutex */
pthread_mutex_unlock (&s_pmPrinting);
diff --git a/programs/Xserver/hw/xwin/winmsg.c b/programs/Xserver/hw/xwin/winmsg.c
index cd12b5445..8d42d95a0 100644
--- a/programs/Xserver/hw/xwin/winmsg.c
+++ b/programs/Xserver/hw/xwin/winmsg.c
@@ -45,26 +45,7 @@ void
winVMsg (int scrnIndex, MessageType type, int verb, const char *format,
va_list ap)
{
- const char *prefix = NULL;
-
- if (verb && verb > VERBOSE_LEVEL)
- return;
-
-#undef __msg
-#define __msg(name,string) case name: prefix = string; break;
-#undef _msg
-#define _msg(name,string) __msg(name,string)
- switch (type)
- {
- MESSAGE_STRINGS default:prefix = NULL;
- break;
- }
-#undef __msg
-#undef _msg
-
- if (prefix != NULL)
- ErrorF ("%s ", prefix);
- VErrorF (format, ap);
+ LogVMessageVerb(type, verb, format, ap);
}
@@ -73,7 +54,7 @@ winDrvMsg (int scrnIndex, MessageType type, const char *format, ...)
{
va_list ap;
va_start (ap, format);
- winVMsg (scrnIndex, type, 0, format, ap);
+ LogVMessageVerb(type, 0, format, ap);
va_end (ap);
}
@@ -83,7 +64,7 @@ winMsg (MessageType type, const char *format, ...)
{
va_list ap;
va_start (ap, format);
- winVMsg (0, type, 0, format, ap);
+ LogVMessageVerb(type, 0, format, ap);
va_end (ap);
}
@@ -94,7 +75,7 @@ winDrvMsgVerb (int scrnIndex, MessageType type, int verb, const char *format,
{
va_list ap;
va_start (ap, format);
- winVMsg (scrnIndex, type, verb, format, ap);
+ LogVMessageVerb(type, verb, format, ap);
va_end (ap);
}
@@ -104,7 +85,7 @@ winMsgVerb (MessageType type, int verb, const char *format, ...)
{
va_list ap;
va_start (ap, format);
- winVMsg (0, type, verb, format, ap);
+ LogVMessageVerb(type, verb, format, ap);
va_end (ap);
}
@@ -114,6 +95,6 @@ winErrorFVerb (int verb, const char *format, ...)
{
va_list ap;
va_start (ap, format);
- winVMsg (0, X_NONE, verb, format, ap);
+ LogVMessageVerb(X_NONE, verb, format, ap);
va_end (ap);
}
diff --git a/programs/Xserver/hw/xwin/winmsg.h b/programs/Xserver/hw/xwin/winmsg.h
index 7b9c5987c..136cdc3a8 100644
--- a/programs/Xserver/hw/xwin/winmsg.h
+++ b/programs/Xserver/hw/xwin/winmsg.h
@@ -32,31 +32,6 @@
#ifndef __WIN_MSG_H__
#define __WIN_MSG_H__
-
-#define __msg_name(name,string) name
-#define __msg(name,string) __msg_name(name,string)
-#define _msg(name,string) __msg(name,string),
-
-#define MESSAGE_STRINGS \
- _msg(X_PROBED,"(--)" /* Value was probed */)\
- _msg(X_CONFIG,"(**)" /* Value was given in the config file */)\
- _msg(X_DEFAULT,"(==)" /* Value is a default */)\
- _msg(X_CMDLINE,"(++)" /* Value was given on the command line */)\
- _msg(X_NOTICE,"(!!)" /* Notice */) \
- _msg(X_ERROR,"(EE)" /* Error message */) \
- _msg(X_WARNING,"(WW)" /* Warning message */) \
- _msg(X_INFO,"(II)" /* Informational message */) \
- _msg(X_UNKNOWN,"(?""?)" /* Unknown, trigraph fix */) \
- _msg(X_NONE,NULL /* No prefix */) \
- __msg(X_NOT_IMPLEMENTED,"(NI)" /* Not implemented */)
-
-typedef enum
-{
- MESSAGE_STRINGS
-}
-MessageType;
-
-
/*
* Function prototypes
*/
diff --git a/programs/Xserver/hw/xwin/winmultiwindowclass.c b/programs/Xserver/hw/xwin/winmultiwindowclass.c
index 42604c44a..be65bd153 100644
--- a/programs/Xserver/hw/xwin/winmultiwindowclass.c
+++ b/programs/Xserver/hw/xwin/winmultiwindowclass.c
@@ -74,7 +74,8 @@ winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class)
return 0;
}
- strncpy ((*res_name), prop->data, len_name);
+ /* Add one to len_name to allow copying of trailing 0 */
+ strncpy ((*res_name), prop->data, len_name + 1);
if (len_name == prop->size)
len_name--;
@@ -191,3 +192,93 @@ winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
return 0;
}
+
+
+int
+winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+
+ if (!pWin || !hints)
+ {
+ ErrorF ("winMultiWindowGetWMNormalHints - pWin or hints was NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ memset (hints, 0, sizeof (WinXSizeHints));
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_NORMAL_HINTS
+ && prop->data)
+ {
+ memcpy (hints, prop->data, sizeof (WinXSizeHints));
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
+
+int
+winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_name;
+
+ if (!pWin || !wmName)
+ {
+ ErrorF ("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
+ "NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *wmName = NULL;
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_NAME
+ && prop->type == XA_STRING
+ && prop->data)
+ {
+ len_name = strlen ((char *) prop->data);
+
+ (*wmName) = malloc (len_name + 1);
+
+ if (!*wmName)
+ {
+ ErrorF ("winMultiWindowGetWMName - *wmName was NULL\n");
+ return 0;
+ }
+
+ /* Add one to len_name to allow copying of trailing 0 */
+ strncpy ((*wmName), prop->data, len_name+1);
+
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
diff --git a/programs/Xserver/hw/xwin/winmultiwindowclass.h b/programs/Xserver/hw/xwin/winmultiwindowclass.h
index 79b3a1c5d..f9cfee30f 100644
--- a/programs/Xserver/hw/xwin/winmultiwindowclass.h
+++ b/programs/Xserver/hw/xwin/winmultiwindowclass.h
@@ -49,6 +49,47 @@ typedef struct {
/*
+ * new version containing base_width, base_height, and win_gravity fields;
+ * used with WM_NORMAL_HINTS.
+ */
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ int x, y; /* obsolete for new window mgrs, but clients */
+ int width, height; /* should set so old wm's don't mess up */
+ int min_width, min_height;
+ int max_width, max_height;
+ int width_inc, height_inc;
+ struct {
+ int x; /* numerator */
+ int y; /* denominator */
+ } min_aspect, max_aspect;
+ int base_width, base_height; /* added by ICCCM version 1 */
+ int win_gravity; /* added by ICCCM version 1 */
+} WinXSizeHints;
+
+/*
+ * The next block of definitions are for window manager properties that
+ * clients and applications use for communication.
+ */
+
+/* flags argument in size hints */
+#define USPosition (1L << 0) /* user specified x, y */
+#define USSize (1L << 1) /* user specified width, height */
+
+#define PPosition (1L << 2) /* program specified position */
+#define PSize (1L << 3) /* program specified size */
+#define PMinSize (1L << 4) /* program specified minimum size */
+#define PMaxSize (1L << 5) /* program specified maximum size */
+#define PResizeInc (1L << 6) /* program specified resize increments */
+#define PAspect (1L << 7) /* program specified min and max aspect ratios */
+#define PBaseSize (1L << 8) /* program specified base for incrementing */
+#define PWinGravity (1L << 9) /* program specified window gravity */
+
+/* obsolete */
+#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
+
+
+/*
* Function prototypes
*/
@@ -60,3 +101,10 @@ winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class);
int
winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role);
+
+int
+winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints);
+
+int
+winMultiWindowGetWMName (WindowPtr pWin, char **wmName);
+
diff --git a/programs/Xserver/hw/xwin/winmultiwindowicons.c b/programs/Xserver/hw/xwin/winmultiwindowicons.c
index 62161bb01..33b9391a8 100644
--- a/programs/Xserver/hw/xwin/winmultiwindowicons.c
+++ b/programs/Xserver/hw/xwin/winmultiwindowicons.c
@@ -32,6 +32,7 @@
#include "win.h"
#include "dixevents.h"
#include "winmultiwindowclass.h"
+#include "winprefs.h"
/*
@@ -341,6 +342,7 @@ winXIconToHICON (WindowPtr pWin)
}
+
/*
* Change the Windows window icon
*/
@@ -352,7 +354,10 @@ winUpdateIcon (Window id)
HICON hIcon, hiconOld;
pWin = LookupIDByType (id, RT_WINDOW);
- hIcon = winXIconToHICON (pWin);
+ hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
+
+ if (!hIcon)
+ hIcon = winXIconToHICON (pWin);
if (hIcon)
{
@@ -365,7 +370,8 @@ winUpdateIcon (Window id)
(int) hIcon);
/* Delete the icon if its not the default */
- if (hiconOld != g_hiconX)
+ if (hiconOld != g_hiconX &&
+ !winIconIsOverride((unsigned long)hiconOld))
DeleteObject (hiconOld);
}
}
diff --git a/programs/Xserver/hw/xwin/winmultiwindowwindow.c b/programs/Xserver/hw/xwin/winmultiwindowwindow.c
index bfb3bcbcf..1430b7d88 100644
--- a/programs/Xserver/hw/xwin/winmultiwindowwindow.c
+++ b/programs/Xserver/hw/xwin/winmultiwindowwindow.c
@@ -34,6 +34,7 @@
#include "win.h"
#include "dixevents.h"
#include "winmultiwindowclass.h"
+#include "winprefs.h"
/*
@@ -472,6 +473,9 @@ winCreateWindowsWindow (WindowPtr pWin)
/* Load default X icon in case it's not ready yet */
if (!g_hiconX)
+ g_hiconX = (HICON)winOverrideDefaultIcon();
+
+ if (!g_hiconX)
g_hiconX = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
/* Try and get the icon from WM_HINTS */
@@ -512,7 +516,7 @@ winCreateWindowsWindow (WindowPtr pWin)
strcat (pszClass, pszWindowID);
#if CYGMULTIWINDOW_DEBUG
- ErrorF ("winCreateWindowsWindow - Creating class: %s\n", classStr);
+ ErrorF ("winCreateWindowsWindow - Creating class: %s\n", pszClass);
#endif
/* Setup our window class */
@@ -617,7 +621,8 @@ winDestroyWindowsWindow (WindowPtr pWin)
#endif
/* Only delete if it's not the default */
- if (hiconClass != g_hiconX)
+ if (hiconClass != g_hiconX &&
+ !winIconIsOverride((unsigned long)hiconClass))
{
iReturn = DestroyIcon (hiconClass);
#if CYGMULTIWINDOW_DEBUG
@@ -837,3 +842,21 @@ winReorderWindowsMultiWindow (ScreenPtr pScreen)
pScreenPriv->fRestacking = FALSE;
pScreenPriv->fWindowOrderChanged = FALSE;
}
+
+
+/*
+ * winMinimizeWindow - Minimize in response to WM_CHANGE_STATE
+ */
+
+void
+winMinimizeWindow (Window id)
+{
+ WindowPtr pWin;
+ winPrivWinPtr pWinPriv;
+
+ pWin = LookupIDByType (id, RT_WINDOW);
+
+ pWinPriv = winGetWindowPriv (pWin);
+
+ ShowWindow (pWinPriv->hWnd, SW_MINIMIZE);
+}
diff --git a/programs/Xserver/hw/xwin/winmultiwindowwm.c b/programs/Xserver/hw/xwin/winmultiwindowwm.c
index 91663c532..f77a40476 100644
--- a/programs/Xserver/hw/xwin/winmultiwindowwm.c
+++ b/programs/Xserver/hw/xwin/winmultiwindowwm.c
@@ -157,6 +157,7 @@ winMutliWindowWMIOErrorHandler (Display *pDisplay);
static int g_nQueueSize;
static jmp_buf g_jmpEntry;
+static Bool g_shutdown = FALSE;
@@ -488,7 +489,11 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
iWindow,
&attr);
if (!attr.override_redirect)
- SetWindowText (hWnd, pszName);
+ {
+ SetWindowText (hWnd, pszName);
+ winUpdateIcon (iWindow);
+ }
+
free (pszName);
}
}
@@ -585,7 +590,7 @@ winMultiWindowWMProc (void *pArg)
#endif
/* Unmap the window */
- XUnmapWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
+ XUnmapWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
break;
case WM_WM_KILL:
@@ -641,6 +646,11 @@ winMultiWindowWMProc (void *pArg)
winUpdateIcon (pNode->msg.iWindow);
break;
+ case WM_WM_CHANGE_STATE:
+ /* Minimize the window in Windows */
+ winMinimizeWindow (pNode->msg.iWindow);
+ break;
+
default:
ErrorF ("winMultiWindowWMProc - Unknown Message.\n");
pthread_exit (NULL);
@@ -724,6 +734,7 @@ winMultiWindowXMsgProc (void *pArg)
XEvent event;
Atom atmWmName;
Atom atmWmHints;
+ Atom atmWmChange;
int iReturn;
XIconSize *xis;
@@ -829,7 +840,7 @@ winMultiWindowXMsgProc (void *pArg)
xis,
1);
XFree (xis);
- }
+ }
atmWmName = XInternAtom (pProcArg->pDisplay,
"WM_NAME",
@@ -837,6 +848,9 @@ winMultiWindowXMsgProc (void *pArg)
atmWmHints = XInternAtom (pProcArg->pDisplay,
"WM_HINTS",
False);
+ atmWmChange = XInternAtom (pProcArg->pDisplay,
+ "WM_CHANGE_STATE",
+ False);
/* Loop until we explicitly break out */
while (1)
@@ -873,6 +887,19 @@ winMultiWindowXMsgProc (void *pArg)
/* 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");
+
+ memset (&msg, 0, sizeof (msg));
+
+ msg.msg = WM_WM_CHANGE_STATE;
+ msg.iWindow = event.xclient.window;
+
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
}
}
@@ -1038,6 +1065,12 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
iReturn);
pthread_exit (NULL);
}
+ else if (g_shutdown)
+ {
+ /* Shutting down, the X server severed out connection! */
+ ErrorF ("winInitMultiWindowWM - Detected shutdown in progress\n");
+ pthread_exit (NULL);
+ }
else if (iReturn == WIN_JMP_ERROR_IO)
{
ErrorF ("winInitMultiWindowWM - setjmp returned WIN_JMP_ERROR_IO\n");
@@ -1136,3 +1169,15 @@ winMutliWindowWMIOErrorHandler (Display *pDisplay)
return 0;
}
+
+
+/*
+ * Notify the MWM thread we're exiting and not to reconnect
+ */
+
+void
+winDeinitMultiWindowWM ()
+{
+ ErrorF ("winDeinitMultiWindowWM - Noting shutdown in progress\n");
+ g_shutdown = TRUE;
+}
diff --git a/programs/Xserver/hw/xwin/winmultiwindowwndproc.c b/programs/Xserver/hw/xwin/winmultiwindowwndproc.c
index 8e1882a15..7e5b05d32 100644
--- a/programs/Xserver/hw/xwin/winmultiwindowwndproc.c
+++ b/programs/Xserver/hw/xwin/winmultiwindowwndproc.c
@@ -33,7 +33,8 @@
#include "win.h"
#include "dixevents.h"
-
+#include "winmultiwindowclass.h"
+#include "winprefs.h"
/*
* External global variables
@@ -64,6 +65,215 @@ static UINT_PTR g_uipMousePollingTimerID = 0;
#define WIN_MULTIWINDOW_SHAPE YES
+
+/*
+ * ConstrainSize - Taken from TWM sources - Respects hints for sizing
+ */
+#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
+static void
+ConstrainSize (WinXSizeHints hints, int *widthp, int *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;
+ }
+ else if (hints.flags & PBaseSize)
+ {
+ minWidth = hints.base_width;
+ minHeight = hints.base_height;
+ }
+ else
+ minWidth = minHeight = 1;
+
+ if (hints.flags & PBaseSize)
+ {
+ baseWidth = hints.base_width;
+ baseHeight = hints.base_height;
+ }
+ else if (hints.flags & PMinSize)
+ {
+ baseWidth = hints.min_width;
+ baseHeight = hints.min_height;
+ }
+ else
+ baseWidth = baseHeight = 0;
+
+ if (hints.flags & PMaxSize)
+ {
+ maxWidth = hints.max_width;
+ maxHeight = hints.max_height;
+ }
+ else
+ {
+ maxWidth = MAXINT;
+ maxHeight = MAXINT;
+ }
+
+ if (hints.flags & PResizeInc)
+ {
+ 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
+ *
+ */
+
+ 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;
+ else
+ {
+ delta = makemult(dheight - dwidth*hints.min_aspect.y/hints.min_aspect.x, yinc);
+ 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;
+ else
+ {
+ delta = makemult(dwidth - hints.max_aspect.x*dheight/hints.max_aspect.y, xinc);
+ if (dwidth - delta >= minWidth)
+ dwidth -= delta;
+ }
+ }
+ }
+
+ /* Return computed values */
+ *widthp = dwidth;
+ *heightp = dheight;
+}
+#undef makemult
+
+
+
+/*
+ * ValidateSizing - Ensures size request respects hints
+ */
+static int
+ValidateSizing (HWND hwnd, WindowPtr pWin,
+ WPARAM wParam, LPARAM lParam)
+{
+ WinXSizeHints sizeHints;
+ RECT *rect;
+ int iWidth, iHeight, iTopBorder;
+ POINT pt;
+
+ /* 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;
+
+ /* Get title bar height, there must be an easier way?! */
+ pt.x = pt.y = 0;
+ ClientToScreen(hwnd, &pt);
+ iTopBorder = pt.y - rect->top;
+
+ /* Now remove size of any borders */
+ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight -= GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
+
+ /* Constrain the size to legal values */
+ ConstrainSize (sizeHints, &iWidth, &iHeight);
+
+ /* Add back the borders */
+ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight += GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
+
+ /* 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;
+}
+
+
/*
* winTopLevelWindowProc - Window procedure for all top-level Windows windows.
*/
@@ -168,65 +378,22 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
case WM_INIT_SYS_MENU:
/*
- * Add Always On Top command to system menu
+ * Add whatever the setup file wants to for this window
*/
- {
- HMENU sys;
-
- sys = GetSystemMenu (hwnd, FALSE);
-
- AppendMenu (sys, MF_SEPARATOR, 0, NULL);
- AppendMenu (sys, MF_STRING, ID_APP_ALWAYS_ON_TOP, "Always On Top");
- }
+ SetupSysMenu ((unsigned long)hwnd);
return 0;
case WM_SYSCOMMAND:
/*
- * Any window menu items go through here, presently only Always On Top
+ * Any window menu items go through here
*/
- if (LOWORD(wParam) == ID_APP_ALWAYS_ON_TOP)
- {
- DWORD dwExStyle;
-
- /* Get extended window style */
- dwExStyle = GetWindowLong (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,
- 0, 0,
- 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
-
- return 0;
- }
+ HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam));
break;
case WM_INITMENU:
/* Checks/Unchecks any menu items before they are displayed */
- {
- DWORD dwExStyle;
-
- /* Get extended window style */
- dwExStyle = GetWindowLong (hwnd, GWL_EXSTYLE);
-
- if (dwExStyle & WS_EX_TOPMOST)
- CheckMenuItem ((HMENU)wParam,
- ID_APP_ALWAYS_ON_TOP,
- MF_BYCOMMAND | MF_CHECKED);
- else
- CheckMenuItem ((HMENU)wParam,
- ID_APP_ALWAYS_ON_TOP,
- MF_BYCOMMAND | MF_UNCHECKED);
- }
- return 0;
+ HandleCustomWM_INITMENU ((unsigned long)hwnd, wParam);
+ break;
case WM_PAINT:
/* Only paint if our window handle is valid */
@@ -693,6 +860,11 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
s_pScreenPriv->fWindowOrderChanged = TRUE;
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);
+
case WM_SIZE:
/* see dix/window.c */
diff --git a/programs/Xserver/hw/xwin/winprefs.c b/programs/Xserver/hw/xwin/winprefs.c
new file mode 100644
index 000000000..b0a5d49ee
--- /dev/null
+++ b/programs/Xserver/hw/xwin/winprefs.c
@@ -0,0 +1,661 @@
+/*
+ * 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.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include "win.h"
+
+/* Fixups to prevent collisions between Windows and X headers */
+#define ATOM DWORD
+#include <windows.h>
+
+#include "winprefs.h"
+#include "winmultiwindowclass.h"
+
+/* Where will the custom menu commands start counting from? */
+#define STARTMENUID WM_USER
+
+/* From winmultiwindowflex.l, the real parser */
+extern void parse_file (FILE *fp);
+
+/* From winmultiwindowyacc.y, the pref structure loaded by the parser */
+extern WINMULTIWINDOWPREFS pref;
+
+/* The global X default icon */
+extern HICON g_hiconX;
+
+/* Currently in use command ID, incremented each new menu item created */
+static int g_cmdid = STARTMENUID;
+
+
+/* Defined in DIX */
+extern char *display;
+
+/*
+ * Creates or appends a menu from a MENUPARSED structure
+ */
+static HMENU
+MakeMenu (char *name,
+ HMENU editMenu,
+ int editItem)
+{
+ int i;
+ int item;
+ MENUPARSED *m;
+ HMENU hmenu;
+
+ for (i=0; i<pref.menuItems; i++)
+ {
+ if (!strcmp(name, pref.menu[i].menuName))
+ break;
+ }
+
+ /* Didn't find a match, bummer */
+ if (i==pref.menuItems)
+ {
+ ErrorF("MakeMenu: Can't find menu %s\n", name);
+ return NULL;
+ }
+
+ m = &(pref.menu[i]);
+
+ if (editMenu)
+ {
+ hmenu = editMenu;
+ item = editItem;
+ }
+ else
+ {
+ hmenu = CreatePopupMenu();
+ item = 0;
+ }
+
+ /* 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++;
+
+ switch (m->menuItem[i].cmd)
+ {
+ 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:
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_SEPARATOR,
+ 0,
+ NULL);
+ break;
+
+ case CMD_MENU:
+ /* Recursive! */
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING,
+ (UINT_PTR)MakeMenu (m->menuItem[i].param, 0, 0),
+ m->menuItem[i].text);
+ break;
+ }
+
+ /* If item==-1 (means to add at end of menu) don't increment) */
+ if (item>=0)
+ item++;
+ }
+
+ return hmenu;
+}
+
+
+/*
+ * Callback routine that is executed once per window class.
+ * Removes or creates custom window settings depending on LPARAM
+ */
+static BOOL CALLBACK
+ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
+{
+ char szClassName[1024];
+ HICON hicon;
+
+ if (!GetClassName (hwnd, szClassName, 1024))
+ return TRUE;
+
+ if (strncmp (szClassName, WINDOW_CLASS_X, strlen (WINDOW_CLASS_X)))
+ /* Not one of our windows... */
+ return TRUE;
+
+ /* It's our baby, either clean or dirty it */
+ if (lParam==FALSE)
+ {
+ hicon = (HICON)GetClassLong(hwnd, GCL_HICON);
+
+ /* Unselect any icon in the class structure */
+ SetClassLong (hwnd, GCL_HICON, (LONG)LoadIcon (NULL, IDI_APPLICATION));
+
+ /* If it's generated on-the-fly, get rid of it, will regen */
+ if (!winIconIsOverride((unsigned long)hicon) && hicon!=g_hiconX)
+ DestroyIcon (hicon);
+
+ /* Remove any menu additions, use bRevert flag */
+ GetSystemMenu (hwnd, TRUE);
+
+ /* This window is now clean of our taint */
+ }
+ else
+ {
+ /* Make the icon default, dynamic, of from xwinrc */
+ SetClassLong (hwnd, GCL_HICON, (LONG)g_hiconX);
+ winUpdateIcon ((Window)GetProp (hwnd, WIN_WID_PROP));
+ /* Update the system menu for this window */
+ SetupSysMenu ((unsigned long)hwnd);
+
+ /* That was easy... */
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Removes any custom icons in classes, custom menus, etc.
+ * Frees all members in pref structure.
+ * Reloads the preferences file.
+ * Set custom icons and menus again.
+ */
+static void
+ReloadPrefs ()
+{
+ int i;
+
+ /* First, iterate over all windows replacing their icon with system */
+ /* default one and deleting any custom system menus */
+ EnumWindows (ReloadEnumWindowsProc, FALSE);
+
+ /* 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;
+
+ 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 */
+ DestroyIcon (g_hiconX);
+
+ /* Reset the custom command IDs */
+ g_cmdid = STARTMENUID;
+
+ /* Load the updated resource file */
+ LoadPreferences();
+
+ /* Define global icon, load it */
+ g_hiconX = (HICON)winOverrideDefaultIcon();
+ if (!g_hiconX)
+ g_hiconX = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+
+ /* Rebuild the icons and menus */
+ EnumWindows (ReloadEnumWindowsProc, TRUE);
+
+ /* Whew, done */
+}
+
+/*
+ * Check/uncheck the ALWAYSONTOP items in this menu
+ */
+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 (GetWindowLong (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 );
+
+}
+
+/*
+ * Searches for the custom WM_COMMAND command ID and performs action
+ */
+int
+HandleCustomWM_COMMAND (unsigned long hwndIn,
+ int command)
+{
+ HWND hwnd;
+ int i, j;
+ MENUPARSED *m;
+ DWORD dwExStyle;
+
+ hwnd = (HWND)hwndIn;
+
+ if (!command)
+ return 0;
+
+ for (i=0; i<pref.menuItems; i++)
+ {
+ m = &(pref.menu[i]);
+ for (j=0; j<m->menuItems; j++)
+ {
+ if (command==m->menuItem[j].commandID)
+ {
+ /* Match! */
+ switch(m->menuItem[j].cmd)
+ {
+ 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);
+ }
+ else
+ return 0;
+ break;
+
+ case CMD_ALWAYSONTOP:
+ if (!hwnd)
+ return 0;
+
+ /* Get extended window style */
+ dwExStyle = GetWindowLong (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,
+ 0, 0,
+ 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE);
+ return 0;
+
+ case CMD_RELOAD:
+ ReloadPrefs();
+ return 0;
+
+ default:
+ return 0;
+ }
+ } /* match */
+ } /* for j */
+ } /* for i */
+
+ return 0;
+}
+
+
+/*
+ * Add the default or a custom menu depending on the class match
+ */
+void
+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;
+
+ if (pWin)
+ {
+ /* 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) ||
+ !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 */
+ if (pref.defaultSysMenuName[0])
+ {
+ if (pref.defaultSysMenuPos==AT_START)
+ MakeMenu (pref.defaultSysMenuName, sys, 0);
+ else
+ MakeMenu (pref.defaultSysMenuName, sys, -1);
+ }
+}
+
+
+/*
+ * Possibly add a menu to the toolbar icon
+ */
+void
+SetupRootMenu (unsigned long hmenuRoot)
+{
+ HMENU root;
+
+ root = (HMENU)hmenuRoot;
+ if (!root)
+ return;
+
+ if (pref.rootMenuName[0])
+ {
+ MakeMenu(pref.rootMenuName, root, 0);
+ }
+}
+
+
+/*
+ * Check for and return an overridden default ICON specified in the prefs
+ */
+unsigned long
+winOverrideDefaultIcon()
+{
+ HICON hicon;
+ char fname[PATH_MAX+NAME_MAX+2];
+
+ if (pref.defaultIconName[0])
+ {
+ /* Make sure we have a dir with trailing backslash */
+ /* Note we are using _Windows_ paths here, not cygwin */
+ strcpy (fname, pref.iconDirectory);
+ if (pref.iconDirectory[0])
+ if (fname[strlen(fname)-1]!='\\')
+ strcat (fname, "\\");
+ strcat (fname, pref.defaultIconName);
+
+ hicon = (HICON)LoadImage(NULL,
+ fname,
+ IMAGE_ICON,
+ 0, 0,
+ LR_DEFAULTSIZE|LR_LOADFROMFILE);
+ if (hicon==NULL)
+ ErrorF ("winOverrideDefaultIcon: LoadIcon(%s) failed\n", fname);
+
+ return (unsigned long)hicon;
+ }
+
+ return 0;
+}
+
+
+/*
+ * Check for a match of the window class to one specified in the
+ * ICONS{} section in the prefs file, and load the icon from a file
+ */
+unsigned long
+winOverrideIcon (unsigned long longWin)
+{
+ WindowPtr pWin = (WindowPtr) longWin;
+ char *res_name, *res_class;
+ int i;
+ HICON hicon;
+ char fname[PATH_MAX+NAME_MAX+2];
+ 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);
+ if (wmName)
+ free (wmName);
+
+ if (pref.icon[i].hicon)
+ return pref.icon[i].hicon;
+
+ /* Make sure we have a dir with trailing backslash */
+ /* Note we are using _Windows_ paths here, not cygwin */
+ strcpy (fname, pref.iconDirectory);
+ if (pref.iconDirectory[0])
+ if (fname[strlen(fname)-1]!='\\')
+ strcat (fname, "\\");
+ strcat (fname, pref.icon[i].iconFile);
+
+ hicon = (HICON)LoadImage(NULL,
+ fname,
+ IMAGE_ICON,
+ 0, 0,
+ LR_DEFAULTSIZE|LR_LOADFROMFILE);
+ if (hicon==NULL)
+ ErrorF ("winOverrideIcon: LoadIcon(%s) failed\n", fname);
+
+ pref.icon[i].hicon = (unsigned long)hicon;
+ return (unsigned long)hicon;
+ }
+ }
+
+ /* Didn't find the icon, fail gracefully */
+ free (res_name);
+ free (res_class);
+ if (wmName)
+ free (wmName);
+
+ return 0;
+}
+
+
+/*
+ * Should we free this icon or leave it in memory (is it part of our
+ * ICONS{} overrides)?
+ */
+int
+winIconIsOverride(unsigned hiconIn)
+{
+ HICON hicon;
+ int i;
+
+ 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;
+}
+
+
+
+/*
+ * Try and open ~/.XWinrc and /usr/X11R6/lib/X11/system.XWinrc
+ * Load it into prefs structure for use by other functions
+ */
+void
+LoadPreferences ()
+{
+ char *home;
+ char fname[PATH_MAX+NAME_MAX+2];
+ FILE *prefFile;
+ char szDisplay[512];
+ char *szEnvDisplay;
+ int i, j;
+ char param[PARAM_MAX+1];
+ char *srcParam, *dstParam;
+
+ /* First, clear all preference settings */
+ memset (&pref, 0, sizeof(pref));
+ prefFile = NULL;
+
+ /* 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");
+
+ prefFile = fopen (fname, "r");
+ }
+
+ /* No home file found, check system default */
+ if (!prefFile)
+ prefFile = fopen (PROJECTROOT"/lib/X11/system.XWinrc", "r");
+
+ /* If we could open it, then read the settings and close it */
+ if (prefFile)
+ {
+ parse_file (prefFile);
+ fclose (prefFile);
+ }
+
+ /* 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);
+ }
+
+ /* 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) {
+ if (!strncmp(srcParam, "%display%", 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 */
+
+}
+
diff --git a/programs/Xserver/hw/xwin/winprefs.h b/programs/Xserver/hw/xwin/winprefs.h
new file mode 100644
index 000000000..4ae01c081
--- /dev/null
+++ b/programs/Xserver/hw/xwin/winprefs.h
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+/* Need to know how long paths can be... */
+#include <limits.h>
+
+#ifndef NAME_MAX
+#define NAME_MAX PATH_MAX
+#endif
+#define MENU_MAX 128 /* Maximum string length of a menu name or item */
+#define PARAM_MAX (4*PATH_MAX) /* Maximim 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 */
+} MENUCOMMANDTYPE;
+
+/* 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) */
+} 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 */
+} 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? */
+} 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) */
+} 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 */
+ unsigned long hicon; /* LoadImage() result */
+} ICONITEM;
+
+typedef struct WINMULTIWINDOWPREFS
+{
+ /* Menu information */
+ MENUPARSED *menu; /* Array of created menus */
+ int menuItems; /* How big? */
+
+ /* Taskbar menu settings */
+ char rootMenuName[MENU_MAX+1]; /* Menu for taskbar icon */
+
+ /* 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 */
+
+ /* Icon information */
+ char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */
+ char defaultIconName[NAME_MAX+1]; /* Replacement for x.ico */
+
+ ICONITEM *icon;
+ int iconItems;
+
+} WINMULTIWINDOWPREFS;
+
+
+
+
+/* Functions */
+void
+LoadPreferences();
+
+void
+SetupRootMenu (unsigned long hmenuRoot);
+
+void
+SetupSysMenu (unsigned long hwndIn);
+
+void
+HandleCustomWM_INITMENU(unsigned long hwndIn,
+ unsigned long hmenuIn);
+
+int
+HandleCustomWM_COMMAND (unsigned long hwndIn,
+ int command);
+
+int
+winIconIsOverride (unsigned hiconIn);
+
+unsigned long
+winOverrideIcon (unsigned long longpWin);
+
+unsigned long
+winOverrideDefaultIcon();
+
diff --git a/programs/Xserver/hw/xwin/winprefslex.l b/programs/Xserver/hw/xwin/winprefslex.l
new file mode 100644
index 000000000..960183498
--- /dev/null
+++ b/programs/Xserver/hw/xwin/winprefslex.l
@@ -0,0 +1,113 @@
+%{ # -*- C -*-
+/*
+ * 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.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "winprefsyacc.h"
+
+extern YYSTYPE yylval;
+extern char *yytext;
+extern int yyparse();
+
+extern void ErrorF (const char* /*f*/, ...);
+
+int yylineno;
+
+/* Copy the parsed string, must be free()d in yacc parser */
+static char *makestr(char *str)
+{
+ char *ptr;
+ ptr = (char*)malloc (strlen(str)+1);
+ if (!ptr)
+ {
+ ErrorF ("winMultiWindowLex:makestr() out of memory\n");
+ exit (-1);
+ }
+ strcpy(ptr, str);
+ return ptr;
+}
+
+%}
+
+%option yylineno
+
+%%
+\#.*[\r\n] { /* comment */ return NEWLINE; }
+\/\/.*[\r\n] { /* comment */ return NEWLINE; }
+[\r\n] { return NEWLINE; }
+[ \t]+ { /* ignore whitespace */ }
+[mM][eE][nN][uU] { return MENU; }
+[iI][cC][oO][nN][dD][iI][rR][eE][cC][tT][oO][rR][yY] { return ICONDIRECTORY; }
+[dD][eE][fF][aA][uU][lL][tT][iI][cC][oO][nN] { return DEFAULTICON; }
+[iI][cC][oO][nN][sS] { return ICONS; }
+[rR][oO][oO][tT][mM][eE][nN][uU] { return ROOTMENU; }
+[dD][eE][fF][aA][uU][lL][tT][sS][yY][sS][mM][eE][nN][uU] { return DEFAULTSYSMENU; }
+[sS][yY][sS][mM][eE][nN][uU] { return SYSMENU; }
+[sS][eE][pP][aA][rR][aA][tT][oO][rR] { return SEPARATOR; }
+[aA][tT][sS][tT][aA][rR][tT] { return ATSTART; }
+[aA][tT][eE][nN][dD] { return ATEND; }
+[eE][xX][eE][cC] { return EXEC; }
+[aA][lL][wW][aA][yY][sS][oO][nN][tT][oO][pP] { return ALWAYSONTOP; }
+[dD][eE][bB][uU][gG] { return DEBUG; }
+[rR][eE][lL][oO][aA][dD] { return RELOAD; }
+"{" { return LB; }
+"}" { return RB; }
+"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
+ yylval.sVal[strlen(yylval.sVal)-1] = 0; \
+ return STRING; }
+[^ \t\r\n]+ { yylval.sVal = makestr(yytext); \
+ return STRING; }
+%%
+
+/*
+ * Run-of-the mill requirement for yacc
+ */
+int
+yywrap ()
+{
+ return 1;
+}
+
+/*
+ * Run a file through the yacc parser
+ */
+void
+parse_file (FILE *file)
+{
+ if (!file)
+ return;
+
+ yylineno = 1;
+ yyin = file;
+ yyparse ();
+}
diff --git a/programs/Xserver/hw/xwin/winprefsyacc.y b/programs/Xserver/hw/xwin/winprefsyacc.y
new file mode 100644
index 000000000..5ae33b67e
--- /dev/null
+++ b/programs/Xserver/hw/xwin/winprefsyacc.y
@@ -0,0 +1,334 @@
+%{
+/*
+ * 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.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "winprefs.h"
+
+/* The following give better error messages in bison at the cost of a few KB */
+#define YYERROR_VERBOSE 1
+
+/* The global pref settings */
+WINMULTIWINDOWPREFS pref;
+
+/* The working menu */
+static MENUPARSED menu;
+
+/* Functions for parsing the tokens into out structure */
+/* Defined at the end section of this file */
+
+static void SetIconDirectory (char *path);
+static void SetDefaultIcon (char *fname);
+static void SetRootMenu (char *menu);
+static void SetDefaultSysMenu (char *menu, int pos);
+
+static void OpenMenu(char *menuname);
+static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
+static void CloseMenu();
+
+static void OpenIcons();
+static void AddIconLine(char *matchstr, char *iconfile);
+static void CloseIcons();
+
+static void OpenSysMenu();
+static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
+static void CloseSysMenu();
+
+static int yyerror (char *s);
+
+extern void ErrorF (const char* /*f*/, ...);
+extern char *yytext;
+extern int yylex();
+
+%}
+
+%union {
+ char *sVal;
+ int iVal;
+}
+
+%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU
+%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
+%token RELOAD
+
+%token <sVal> STRING
+%type <iVal> atspot
+
+%%
+
+input: /* empty */
+ | input line
+ ;
+
+line: NEWLINE
+ | command
+ ;
+
+
+newline_or_nada:
+ | NEWLINE newline_or_nada
+ ;
+
+command: defaulticon
+ | icondirectory
+ | menu
+ | icons
+ | sysmenu
+ | rootmenu
+ | defaultsysmenu
+ | debug
+ ;
+
+rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
+ ;
+
+defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
+ ;
+
+defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
+ ;
+
+icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
+ ;
+
+menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); }
+ | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
+ | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
+ | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
+ | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
+ ;
+
+menulist: menuline
+ | menuline menulist
+ ;
+
+menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
+ ;
+
+iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
+ ;
+
+iconlist: iconline
+ | iconline iconlist
+ ;
+
+icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
+ ;
+
+atspot: { $$=AT_END; }
+ | ATSTART { $$=AT_START; }
+ | ATEND { $$=AT_END; }
+ ;
+
+sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
+ ;
+
+sysmenulist: sysmenuline
+ | sysmenuline sysmenulist
+ ;
+
+sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
+ ;
+
+debug: DEBUG STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
+ ;
+
+
+%%
+/*
+ * Errors in parsing abort and print log messages
+ */
+static int
+yyerror (char *s)
+{
+ extern int yylineno; /* Handled by flex internally */
+
+ ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
+ return 1;
+}
+
+/* Miscellaneous functions to store TOKENs into the structure */
+static void
+SetIconDirectory (char *path)
+{
+ strncpy (pref.iconDirectory, path, PATH_MAX);
+ pref.iconDirectory[PATH_MAX] = 0;
+}
+
+static void
+SetDefaultIcon (char *fname)
+{
+ strncpy (pref.defaultIconName, fname, NAME_MAX);
+ pref.defaultIconName[NAME_MAX] = 0;
+}
+
+static void
+SetRootMenu (char *menu)
+{
+ strncpy (pref.rootMenuName, menu, MENU_MAX);
+ pref.rootMenuName[MENU_MAX] = 0;
+}
+
+static void
+SetDefaultSysMenu (char *menu, int pos)
+{
+ strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
+ pref.defaultSysMenuName[MENU_MAX] = 0;
+ pref.defaultSysMenuPos = pos;
+}
+
+static void
+OpenMenu (char *menuname)
+{
+ if (menu.menuItem) free(menu.menuItem);
+ menu.menuItem = NULL;
+ strncpy(menu.menuName, menuname, MENU_MAX);
+ menu.menuName[MENU_MAX] = 0;
+ menu.menuItems = 0;
+}
+
+static void
+AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
+{
+ if (menu.menuItem==NULL)
+ menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
+ else
+ menu.menuItem = (MENUITEM*)
+ realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
+
+ strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
+ menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].cmd = cmd;
+
+ strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
+ menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].commandID = 0;
+
+ menu.menuItems++;
+}
+
+static void
+CloseMenu ()
+{
+ if (menu.menuItem==NULL || menu.menuItems==0)
+ {
+ ErrorF("LoadPreferences: Empty menu detected\n");
+ return;
+ }
+
+ if (pref.menuItems)
+ pref.menu = (MENUPARSED*)
+ realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
+ else
+ pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
+
+ memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
+ pref.menuItems++;
+
+ memset (&menu, 0, sizeof(MENUPARSED));
+}
+
+static void
+OpenIcons ()
+{
+ if (pref.icon != NULL) {
+ ErrorF("LoadPreferences: Redefining icon mappings\n");
+ free(pref.icon);
+ pref.icon = NULL;
+ }
+ pref.iconItems = 0;
+}
+
+static void
+AddIconLine (char *matchstr, char *iconfile)
+{
+ if (pref.icon==NULL)
+ pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
+ else
+ pref.icon = (ICONITEM*)
+ realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
+
+ strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
+ pref.icon[pref.iconItems].match[MENU_MAX] = 0;
+
+ strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
+ pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
+
+ pref.icon[pref.iconItems].hicon = 0;
+
+ pref.iconItems++;
+}
+
+static void
+CloseIcons ()
+{
+}
+
+static void
+OpenSysMenu ()
+{
+ if (pref.sysMenu != NULL) {
+ ErrorF("LoadPreferences: Redefining system menu\n");
+ free(pref.sysMenu);
+ pref.sysMenu = NULL;
+ }
+ pref.sysMenuItems = 0;
+}
+
+static void
+AddSysMenuLine (char *matchstr, char *menuname, int pos)
+{
+ if (pref.sysMenu==NULL)
+ pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
+ else
+ pref.sysMenu = (SYSMENUITEM*)
+ realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
+
+ pref.sysMenu[pref.sysMenuItems].menuPos = pos;
+
+ pref.sysMenuItems++;
+}
+
+static void
+CloseSysMenu ()
+{
+}
+
diff --git a/programs/Xserver/hw/xwin/winshadddnl.c b/programs/Xserver/hw/xwin/winshadddnl.c
index 9c15d064d..a5e09421e 100644
--- a/programs/Xserver/hw/xwin/winshadddnl.c
+++ b/programs/Xserver/hw/xwin/winshadddnl.c
@@ -51,6 +51,8 @@
DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 );
#endif /* IID_IDirectDraw4 */
+#define FAIL_MSG_MAX_BLT 10
+
/*
* Create the primary surface and attach the clipper.
@@ -514,9 +516,24 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
NULL);
if (FAILED (ddrval))
{
- ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () "
- "failed: %08x\n",
- ddrval);
+ static int s_iFailCount = 0;
+
+ if (s_iFailCount < FAIL_MSG_MAX_BLT)
+ {
+ ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () "
+ "failed: %08x\n",
+ ddrval);
+
+ ++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.",
+ FAIL_MSG_MAX_BLT);
+ }
+ }
}
/* Get a pointer to the next box */
diff --git a/programs/Xserver/hw/xwin/wintrayicon.c b/programs/Xserver/hw/xwin/wintrayicon.c
index 143466050..e7d611f81 100644
--- a/programs/Xserver/hw/xwin/wintrayicon.c
+++ b/programs/Xserver/hw/xwin/wintrayicon.c
@@ -32,7 +32,7 @@
#include "win.h"
#include <shellapi.h>
-
+#include "winprefs.h"
/*
* Initialize the tray icon
@@ -176,10 +176,12 @@ winHandleIconMessage (HWND hwnd, UINT message,
/* Remove separator */
RemoveMenu (hmenuTray,
- 1,
+ 0,
MF_BYPOSITION);
}
+ SetupRootMenu ((unsigned long)hmenuTray);
+
/*
* NOTE: This three-step procedure is required for
* proper popup menu operation. Without the
diff --git a/programs/Xserver/hw/xwin/winwindow.h b/programs/Xserver/hw/xwin/winwindow.h
index 7551a76e5..7c6a9cc92 100644
--- a/programs/Xserver/hw/xwin/winwindow.h
+++ b/programs/Xserver/hw/xwin/winwindow.h
@@ -100,6 +100,7 @@ typedef struct _winWMMessageRec{
#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_CHANGE_STATE (WM_USER + 11)
/*
@@ -116,6 +117,13 @@ winInitWM (void **ppWMInfo,
pthread_mutex_t *ppmServerStarted,
int dwScreen);
+void
+winDeinitMultiWindowWM ();
+
+void
+winMinimizeWindow (Window id);
+
+
/*
* winmultiwindowicons.c
*/
diff --git a/programs/Xserver/hw/xwin/winwndproc.c b/programs/Xserver/hw/xwin/winwndproc.c
index 6ff1c4429..535882753 100644
--- a/programs/Xserver/hw/xwin/winwndproc.c
+++ b/programs/Xserver/hw/xwin/winwndproc.c
@@ -35,6 +35,7 @@
#include "win.h"
#include <commctrl.h>
+#include "winprefs.h"
/*
* Global variables
@@ -1046,11 +1047,18 @@ winWindowProc (HWND hwnd, UINT message,
ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW);
s_pScreenPriv->fRootWindowShown = TRUE;
return 0;
+
+ default:
+ /* It's probably one of the custom menus... */
+ return HandleCustomWM_COMMAND (0, LOWORD (wParam));
+
}
break;
case WM_GIVEUP:
/* Tell X that we are giving up */
+ winDeinitClipboard ();
+ winDeinitMultiWindowWM ();
GiveUp (0);
return 0;
diff --git a/programs/Xserver/xkb/ddxLoad.c b/programs/Xserver/xkb/ddxLoad.c
index 1e78bad97..85d41a854 100644
--- a/programs/Xserver/xkb/ddxLoad.c
+++ b/programs/Xserver/xkb/ddxLoad.c
@@ -24,7 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.33 2003/09/08 11:22:14 pascal Exp $ */
+/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.34 2003/09/09 03:20:43 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -414,7 +414,7 @@ FILE * file;
else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
if (buf[0] != '\0')
- file= fopen(buf,"r");
+ file= fopen(buf,"rb");
else file= NULL;
}
else file= NULL;
diff --git a/programs/xedit/lisp/lisp.c b/programs/xedit/lisp/lisp.c
index 0534837fa..da5d1c859 100644
--- a/programs/xedit/lisp/lisp.c
+++ b/programs/xedit/lisp/lisp.c
@@ -2630,7 +2630,8 @@ Lisp__New(LispObj *car, LispObj *cdr)
obj = objseg.freeobj;
objseg.freeobj = CDR(obj);
-
+ --objseg.nfree;
+
return (obj);
}
@@ -2641,9 +2642,11 @@ LispNew(LispObj *car, LispObj *cdr)
if (obj == NIL)
obj = Lisp__New(car, cdr);
- else
+ else {
objseg.freeobj = CDR(obj);
-
+ --objseg.nfree;
+ }
+
return (obj);
}
@@ -2782,9 +2785,10 @@ LispNewDFloat(double value)
if (dfloat == NIL)
dfloat = Lisp__New(NIL, NIL);
- else
+ else {
objseg.freeobj = CDR(dfloat);
-
+ --objseg.nfree;
+ }
dfloat->type = LispDFloat_t;
dfloat->data.dfloat = value;
@@ -2799,9 +2803,10 @@ LispNewString(char *str, long length, int alloced)
if (string == NIL)
string = Lisp__New(NIL, NIL);
- else
+ else {
objseg.freeobj = CDR(string);
-
+ --objseg.nfree;
+ }
if (alloced)
cstring = str;
else {
@@ -2825,9 +2830,10 @@ LispNewComplex(LispObj *realpart, LispObj *imagpart)
if (complexp == NIL)
complexp = Lisp__New(realpart, imagpart);
- else
+ else {
objseg.freeobj = CDR(complexp);
-
+ --objseg.nfree;
+ }
complexp->type = LispComplex_t;
complexp->data.complex.real = realpart;
complexp->data.complex.imag = imagpart;
@@ -2843,9 +2849,10 @@ LispNewInteger(long integer)
if (object == NIL)
object = Lisp__New(NIL, NIL);
- else
+ else {
objseg.freeobj = CDR(object);
-
+ --objseg.nfree;
+ }
object->type = LispInteger_t;
object->data.integer = integer;
@@ -2861,9 +2868,10 @@ LispNewRatio(long num, long den)
if (ratio == NIL)
ratio = Lisp__New(NIL, NIL);
- else
+ else {
objseg.freeobj = CDR(ratio);
-
+ --objseg.nfree;
+ }
ratio->type = LispRatio_t;
ratio->data.ratio.numerator = num;
ratio->data.ratio.denominator = den;
@@ -2936,9 +2944,10 @@ LispNewCons(LispObj *car, LispObj *cdr)
if (cons == NIL)
cons = Lisp__New(car, cdr);
- else
+ else {
objseg.freeobj = CDR(cons);
-
+ --objseg.nfree;
+ }
CAR(cons) = car;
CDR(cons) = cdr;