diff options
author | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
commit | a915739887477b28d924ecc8417ee107d125bd6c (patch) | |
tree | c02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/hw/xwin | |
parent | 6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff) | |
download | vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2 vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip |
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/hw/xwin')
53 files changed, 2967 insertions, 1564 deletions
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c index 550c5a04e..1e9bcad7a 100644 --- a/xorg-server/hw/xwin/InitInput.c +++ b/xorg-server/hw/xwin/InitInput.c @@ -31,6 +31,7 @@ #endif #include "win.h" #include "dixstruct.h" +#include "inputstr.h" /* @@ -48,7 +49,8 @@ DISPATCH_PROC(winProcSetSelectionOwner); * Local global declarations */ -CARD32 g_c32LastInputEventTime = 0; +DeviceIntPtr g_pwinPointer; +DeviceIntPtr g_pwinKeyboard; /* @@ -94,7 +96,6 @@ ProcessInputEvents (void) #endif mieqProcessInputEvents (); - miPointerUpdate (); #if 0 ErrorF ("ProcessInputEvents - returning\n"); @@ -102,12 +103,10 @@ ProcessInputEvents (void) } -int -TimeSinceLastInputEvent () +void DDXRingBell(int volume, int pitch, int duration) { - if (g_c32LastInputEventTime == 0) - g_c32LastInputEventTime = GetTickCount (); - return GetTickCount () - g_c32LastInputEventTime; + /* winKeybdBell is used instead */ + return; } @@ -115,8 +114,6 @@ TimeSinceLastInputEvent () void InitInput (int argc, char *argv[]) { - DeviceIntPtr pMouse, pKeyboard; - #if CYGDEBUG winDebug ("InitInput\n"); #endif @@ -138,14 +135,16 @@ InitInput (int argc, char *argv[]) } #endif - pMouse = AddInputDevice (winMouseProc, TRUE); - pKeyboard = AddInputDevice (winKeybdProc, TRUE); + g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE); + g_pwinKeyboard = AddInputDevice (serverClient, winKeybdProc, TRUE); - RegisterPointerDevice (pMouse); - RegisterKeyboardDevice (pKeyboard); + RegisterPointerDevice (g_pwinPointer); + RegisterKeyboardDevice (g_pwinKeyboard); + + g_pwinPointer->name = strdup("Windows mouse"); + g_pwinKeyboard->name = strdup("Windows keyboard"); - miRegisterPointerDevice (screenInfo.screens[0], pMouse); - mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse); + mieqInit (); /* Initialize the mode key states */ winInitializeModeKeyStates (); diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index abc35b943..2f4b0d222 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -42,8 +42,8 @@ from The Open Group. #ifdef __CYGWIN__ #include <mntent.h> #endif -#if defined(XKB) && defined(WIN32) -#include <xkbsrv.h> +#if defined(WIN32) +#include "xkbsrv.h" #endif #ifdef RELOCATE_PROJECTROOT #include <shlobj.h> @@ -667,7 +667,6 @@ winFixupPaths (void) winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile); } } -#ifdef XKB { static char xkbbasedir[MAX_PATH]; @@ -677,7 +676,6 @@ winFixupPaths (void) XkbBaseDirectory = xkbbasedir; XkbBinDirectory = basedir; } -#endif /* XKB */ #endif /* RELOCATE_PROJECTROOT */ } @@ -857,7 +855,6 @@ winUseMsg (void) "\tSpecify a keyboard device from the configuration file.\n"); #endif -#ifdef XKB ErrorF ("-xkbrules XKBRules\n" "\tEquivalent to XKBRules in XF86Config files.\n"); @@ -874,7 +871,6 @@ winUseMsg (void) ErrorF ("-xkboptions XKBOptions\n" "\tEquivalent to XKBOptions in XF86Config files.\n"); -#endif ErrorF ("-logfile filename\n" "\tWrite logmessages to <filename> instead of /tmp/Xwin.log.\n"); @@ -960,7 +956,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) if (!winReadConfigfile ()) winErrorFVerb (1, "InitOutput - Error reading config file\n"); #else - winMsg(X_INFO, "XF86Config is not supported\n"); + winMsg(X_INFO, "xorg.conf is not supported\n"); winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " "for more information\n"); winConfigFiles (); @@ -1056,7 +1052,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) */ static Bool -winCheckDisplayNumber () +winCheckDisplayNumber (void) { int nDisp; HANDLE mutex; @@ -1120,20 +1116,3 @@ winCheckDisplayNumber () return TRUE; } - -#ifdef DPMSExtension -Bool DPMSSupported(void) -{ - return FALSE; -} - -void DPMSSet(int level) -{ - return; -} - -int DPMSGet(int *plevel) -{ - return 0; -} -#endif diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am index 00d425544..2c7972a7f 100644 --- a/xorg-server/hw/xwin/Makefile.am +++ b/xorg-server/hw/xwin/Makefile.am @@ -34,6 +34,7 @@ SRCS_MULTIWINDOWEXTWM = \ winwin32rootlesswndproc.c \ winwindowswm.c DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM +MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la endif if XWIN_NATIVEGDI @@ -119,8 +120,11 @@ SRCS = InitInput.c \ winpriv.h \ winresource.h \ winwindow.h \ + XWin.rc \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/fb/fbcmap.c \ + $(top_srcdir)/fb/fbcmap_mi.c \ $(SRCS_CLIPBOARD) \ $(SRCS_GLX_WINDOWS) \ $(SRCS_MULTIWINDOW) \ @@ -141,15 +145,13 @@ SRCS = InitInput.c \ XWin_SOURCES = $(SRCS) -INCLUDES = -I$(top_srcdir)/miext/rootless \ - -I$(top_srcdir)/miext/rootless/safeAlpha - -XWIN_LIBS = \ - $(top_builddir)/fb/libfb.la \ - $(XSERVER_LIBS) +INCLUDES = -I$(top_srcdir)/miext/rootless XWin_DEPENDENCIES = $(XWIN_LIBS) -XWin_LDADD = $(XWIN_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) +XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) + +.rc.o: + $(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -DPROJECT_NAME=\"$(VENDOR_NAME_SHORT)\" XWin_LDFLAGS = -mwindows -static @@ -157,23 +159,42 @@ winprefsyacc.h: winprefsyacc.c winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c -CLEANFILES = $(BUILT_SOURCES) +CLEANFILES = $(BUILT_SOURCES) $(appman_DATA) $(fileman_DATA) XWin.man XWinrc.man AM_YFLAGS = -d AM_LFLAGS = -i AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ - $(XWINMODULES_CFLAGS) - -dist_man1_MANS = XWin.man XWinrc.man + $(XWINMODULES_CFLAGS) \ + -DXFree86Server GLX_EXTRAS = \ - glx/ChangeLog \ glx/glwindows.h \ glx/glwrap.c \ glx/indirect.c +MAN_SRCS = XWin.man.pre XWinrc.man.pre + +appmandir = $(APP_MAN_DIR) +appman_DATA = XWin.$(APP_MAN_SUFFIX) + +filemandir = $(FILE_MAN_DIR) +fileman_DATA = XWinrc.$(FILE_MAN_SUFFIX) + +XWin.$(APP_MAN_SUFFIX): XWin.man + -rm -f XWin.$(APP_MAN_SUFFIX) + $(LN_S) XWin.man XWin.$(APP_MAN_SUFFIX) + +XWinrc.$(FILE_MAN_SUFFIX): XWinrc.man + -rm -f XWinrc.$(FILE_MAN_SUFFIX) + $(LN_S) XWinrc.man XWinrc.$(FILE_MAN_SUFFIX) + +EXTRAMANDEFS = -D__logdir__=$(logdir) -D__sysconfdir__=$(sysconfdir) -D__datadir__=$(datadir) + +include $(top_srcdir)/cpprules.in + EXTRA_DIST = \ $(GLX_EXTRAS) \ + $(MAN_SRCS) \ _usr_X11R6_lib_X11_system.XWinrc \ X-boxed.ico \ X.ico \ @@ -200,4 +221,4 @@ EXTRA_DIST = \ xlaunch/window/wizard.h relink: - rm -f XWin && $(MAKE) XWin + rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT) diff --git a/xorg-server/hw/xwin/Makefile.in b/xorg-server/hw/xwin/Makefile.in index 8b92bbdc6..24ec9f509 100644 --- a/xorg-server/hw/xwin/Makefile.in +++ b/xorg-server/hw/xwin/Makefile.in @@ -15,6 +15,11 @@ @SET_MAKE@ +# -*- Makefile -*- +# Rules for generating files using the C pre-processor +# (Replaces CppFileTarget from Imake) + + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -35,13 +40,16 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = XWin$(EXEEXT) -subdir = hw/xwin -DIST_COMMON = README $(dist_man1_MANS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in ChangeLog winprefslex.c winprefsyacc.c \ +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/cpprules.in winprefslex.c winprefsyacc.c \ winprefsyacc.h +subdir = hw/xwin ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -51,10 +59,12 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ - $(top_builddir)/include/kdrive-config.h + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" \ + "$(DESTDIR)$(filemandir)" PROGRAMS = $(bin_PROGRAMS) am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \ winauth.c winblock.c wincmap.c winconfig.c wincreatewnd.c \ @@ -67,8 +77,9 @@ am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \ winwndproc.c ddraw.h winclipboard.h winconfig.h win.h \ winkeybd.h winkeymap.h winkeynames.h winlayouts.h \ winmessages.h winmsg.h winms.h winmultiwindowclass.h \ - winprefs.h winpriv.h winresource.h winwindow.h \ - $(top_srcdir)/mi/miinitext.c $(top_srcdir)/fb/fbcmap.c \ + winprefs.h winpriv.h winresource.h winwindow.h XWin.rc \ + $(top_srcdir)/Xext/dpmsstubs.c $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/mi/miinitext.c $(top_srcdir)/fb/fbcmap_mi.c \ winclipboardinit.c winclipboardtextconv.c winclipboardthread.c \ winclipboardunicode.c winclipboardwndproc.c \ winclipboardwrappers.c winclipboardxevents.c winpriv.c \ @@ -117,14 +128,14 @@ am__objects_9 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \ winscrinit.$(OBJEXT) winshaddd.$(OBJEXT) winshadddnl.$(OBJEXT) \ winshadgdi.$(OBJEXT) wintrayicon.$(OBJEXT) \ winvalargs.$(OBJEXT) winwakeup.$(OBJEXT) winwindow.$(OBJEXT) \ - winwndproc.$(OBJEXT) miinitext.$(OBJEXT) fbcmap.$(OBJEXT) \ + winwndproc.$(OBJEXT) XWin.$(OBJEXT) dpmsstubs.$(OBJEXT) \ + stubs.$(OBJEXT) miinitext.$(OBJEXT) fbcmap_mi.$(OBJEXT) \ $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) \ $(am__objects_7) $(am__objects_8) am_XWin_OBJECTS = $(am__objects_9) XWin_OBJECTS = $(am_XWin_OBJECTS) am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(top_builddir)/fb/libfb.la $(am__DEPENDENCIES_1) XWin_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(XWin_LDFLAGS) \ $(LDFLAGS) -o $@ @@ -170,9 +181,7 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -man1dir = $(mandir)/man1 -NROFF = nroff -MANS = $(dist_man1_MANS) +DATA = $(appman_DATA) $(fileman_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -181,6 +190,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_MAKEFLAGS = @AM_MAKEFLAGS@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ @@ -201,9 +211,12 @@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CXX = @CXX@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -240,7 +253,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -249,9 +264,13 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -290,12 +309,13 @@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAIN_LIB = @MAIN_LIB@ +MAKEFLAGS = @MAKEFLAGS@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ -MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ @@ -315,7 +335,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ @@ -325,10 +344,11 @@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PROJECTROOT = @PROJECTROOT@ PS2PDF = @PS2PDF@ +Q = @Q@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ -SED = @SED@ +SED = sed SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -338,11 +358,10 @@ STRIP = @STRIP@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ -VENDOR_NAME = @VENDOR_NAME@ +V = @V@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -378,6 +397,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -394,10 +414,7 @@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ -XWIN_LIBS = \ - $(top_builddir)/fb/libfb.la \ - $(XSERVER_LIBS) - +XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ @@ -405,7 +422,6 @@ YFLAGS = @YFLAGS@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ -abi_font = @abi_font@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ @@ -428,6 +444,7 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ @@ -459,7 +476,9 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ +shavedir = @shavedir@ srcdir = @srcdir@ +symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -493,6 +512,7 @@ top_srcdir = @top_srcdir@ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwindowswm.c @XWIN_MULTIWINDOWEXTWM_TRUE@DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM +@XWIN_MULTIWINDOWEXTWM_TRUE@MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la @XWIN_NATIVEGDI_TRUE@SRCS_NATIVEGDI = \ @XWIN_NATIVEGDI_TRUE@ winclip.c \ @XWIN_NATIVEGDI_TRUE@ winfillsp.c \ @@ -568,8 +588,11 @@ SRCS = InitInput.c \ winpriv.h \ winresource.h \ winwindow.h \ + XWin.rc \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/fb/fbcmap.c \ + $(top_srcdir)/fb/fbcmap_mi.c \ $(SRCS_CLIPBOARD) \ $(SRCS_GLX_WINDOWS) \ $(SRCS_MULTIWINDOW) \ @@ -580,28 +603,66 @@ SRCS = InitInput.c \ $(SRCS_XV) XWin_SOURCES = $(SRCS) -INCLUDES = -I$(top_srcdir)/miext/rootless \ - -I$(top_srcdir)/miext/rootless/safeAlpha - +INCLUDES = -I$(top_srcdir)/miext/rootless XWin_DEPENDENCIES = $(XWIN_LIBS) -XWin_LDADD = $(XWIN_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) +XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) XWin_LDFLAGS = -mwindows -static BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c -CLEANFILES = $(BUILT_SOURCES) +CLEANFILES = $(BUILT_SOURCES) $(appman_DATA) $(fileman_DATA) XWin.man XWinrc.man AM_YFLAGS = -d AM_LFLAGS = -i AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ - $(XWINMODULES_CFLAGS) + $(XWINMODULES_CFLAGS) \ + -DXFree86Server -dist_man1_MANS = XWin.man XWinrc.man GLX_EXTRAS = \ - glx/ChangeLog \ glx/glwindows.h \ glx/glwrap.c \ glx/indirect.c +MAN_SRCS = XWin.man.pre XWinrc.man.pre +appmandir = $(APP_MAN_DIR) +appman_DATA = XWin.$(APP_MAN_SUFFIX) +filemandir = $(FILE_MAN_DIR) +fileman_DATA = XWinrc.$(FILE_MAN_SUFFIX) +EXTRAMANDEFS = -D__logdir__=$(logdir) -D__sysconfdir__=$(sysconfdir) -D__datadir__=$(datadir) +SUFFIXES = .pre .man .man.pre + +# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM +# to cpp, because that trick does not work on all ANSI C preprocessors. +# Delete line numbers from the cpp output (-P is not portable, I guess). +# Allow XCOMM to be preceded by whitespace and provide a means of generating +# output lines with trailing backslashes. +# Allow XHASH to always be substituted, even in cases where XCOMM isn't. +CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ + -e '/^\#line *[0-9][0-9]* *.*$$/d' \ + -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ + -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ + -e '/^[ ]*XHASH/s/XHASH/\#/' \ + -e '/\@\@$$/s/\@\@$$/\\/' + + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ +XORGMANNAME = X Version 11 +XSERVERNAME = Xorg +MANDEFS = \ + -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ + -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ + -D__appmansuffix__=$(APP_MAN_SUFFIX) \ + -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ + -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ + -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ + -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \ + -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \ + -D__mandir__=$(mandir) \ + -D__projectroot__=$(prefix) \ + -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \ + -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME) + EXTRA_DIST = \ $(GLX_EXTRAS) \ + $(MAN_SRCS) \ _usr_X11R6_lib_X11_system.XWinrc \ X-boxed.ico \ X.ico \ @@ -631,8 +692,8 @@ all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .l .lo .o .obj .y -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +.SUFFIXES: .pre .man .man.pre .c .l .lo .o .obj .rc .y +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -717,8 +778,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winallpriv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winauth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winblock.Po@am__quote@ @@ -802,6 +865,34 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c + +dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` + +stubs.o: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c + +stubs.obj: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` + miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @@ -816,19 +907,19 @@ miinitext.obj: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` -fbcmap.o: $(top_srcdir)/fb/fbcmap.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.o -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.o' libtool=no @AMDEPBACKSLASH@ +fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.o -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -fbcmap.obj: $(top_srcdir)/fb/fbcmap.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.obj -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.obj' libtool=no @AMDEPBACKSLASH@ +fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` .l.c: $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) @@ -841,40 +932,46 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -install-man1: $(dist_man1_MANS) +install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)" + @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ + done -uninstall-man1: +uninstall-appmanDATA: @$(NORMAL_UNINSTALL) - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } + @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(appmandir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(appmandir)" && rm -f $$files +install-filemanDATA: $(fileman_DATA) + @$(NORMAL_INSTALL) + test -z "$(filemandir)" || $(MKDIR_P) "$(DESTDIR)$(filemandir)" + @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ + done + +uninstall-filemanDATA: + @$(NORMAL_UNINSTALL) + @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(filemandir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(filemandir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -929,19 +1026,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -974,9 +1058,9 @@ distdir: $(DISTFILES) check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(PROGRAMS) $(MANS) +all-am: Makefile $(PROGRAMS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -1032,7 +1116,7 @@ info: info-am info-am: -install-data-am: install-man +install-data-am: install-appmanDATA install-filemanDATA install-dvi: install-dvi-am @@ -1048,7 +1132,7 @@ install-info: install-info-am install-info-am: -install-man: install-man1 +install-man: install-pdf: install-pdf-am @@ -1078,9 +1162,8 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-man - -uninstall-man: uninstall-man1 +uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS \ + uninstall-filemanDATA .MAKE: all check install install-am install-strip @@ -1088,23 +1171,41 @@ uninstall-man: uninstall-man1 clean-generic clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ + install-appmanDATA install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-filemanDATA install-html \ install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-man \ - uninstall-man1 + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-appmanDATA uninstall-binPROGRAMS \ + uninstall-filemanDATA +.rc.o: + $(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -DPROJECT_NAME=\"$(VENDOR_NAME_SHORT)\" + winprefsyacc.h: winprefsyacc.c winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h +XWin.$(APP_MAN_SUFFIX): XWin.man + -rm -f XWin.$(APP_MAN_SUFFIX) + $(LN_S) XWin.man XWin.$(APP_MAN_SUFFIX) + +XWinrc.$(FILE_MAN_SUFFIX): XWinrc.man + -rm -f XWinrc.$(FILE_MAN_SUFFIX) + $(LN_S) XWinrc.man XWinrc.$(FILE_MAN_SUFFIX) + +.pre: + $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ + +.man.pre.man: + $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ + relink: - rm -f XWin && $(MAKE) XWin + rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/xorg-server/hw/xwin/X.ico b/xorg-server/hw/xwin/X.ico Binary files differindex d47168fca..5d69818b5 100644 --- a/xorg-server/hw/xwin/X.ico +++ b/xorg-server/hw/xwin/X.ico diff --git a/xorg-server/hw/xwin/XWin.man.pre b/xorg-server/hw/xwin/XWin.man.pre new file mode 100644 index 000000000..9649e2e60 --- /dev/null +++ b/xorg-server/hw/xwin/XWin.man.pre @@ -0,0 +1,288 @@ +.TH XWIN 1 __vendorversion__ +.SH NAME +XWin \- X Server for the Cygwin environment on Microsoft Windows + + +.SH SYNOPSIS +.B XWin +[ options ] ... + + +.SH DESCRIPTION +.I XWin is an X Server for the X Window System on the Cygwin environment +running on Microsoft Windows. + + +.SH MODES +\fIXWin\fP can operate in five different and incompatible modes: +.br +* \fISingle Window\fP: This is the default option. The X server +appears as a single Windows window and all X windows are contained +within this window. This mode requires an external window manager. +.br +* \fINo Decoration\fP: This mode is like single window mode except +that the X server window does not have a title bar or border, thus +maximizing the amount of space available for X windows within the X +server window. This mode requires an external window manager. +.br +* \fIFull Screen\fP: This mode is like single window mode except that +the X server window takes the full screen, covering completely the +Windows desktop. This mode requires an external window manager. +.br +* \fIRootless\fP: The X server works on a window covering the whole +screen but the root window (traditionally covered with an X hatch +pattern) is hidden from view. This mode requires an external window +manager. +.br +* \fIMulti-Window\fP: In this mode \fIXWin\fP uses its own integrated +window manager in order to handle the top-level X windows, in such a +way that they appear as normal Windows windows. +.PP +NOTE: \fIMulti-Window\fP mode will crash if an external window manager +such as \fItwm\fP or \fIfvwm\fP is launched since \fIMulti-Window\fP +uses its own internal window manager; all other modes require an +external window manager in order to move, resize, and perform other +operations on the individual X windows. + + +.SH LOG +As it runs \fIXWin\fP writes messages indicating the most relevant events +to the console +from which it was called and to a log file that by default is located at \fI +__logdir__/XWin.0.log\fP. This file is mainly for debugging purposes. + + +.SH PREFERENCES FILE +On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if +the previous file does not exist, \fI +__sysconfdir__/X11/system.XWinrc\fP. \fI.XWinrc\fP allows setting +preferences for the following: +.br +1- To include items into the menu associated with the \fIXWin\fP icon +which is in the \fIWindows\fP system tray. This functions in all +modes that have a tray icon. +.br +2- To include items in the menu which is associated with the Windows +window that \fIXWin -multiwindow\fP produces for each top-level X +window. That can be done both for the generic case and for particular +programs. +.br +3- To change the icon that is associated to the Windows window that +\fIXWin -multiwindow\fP produces for each top-level X-window. Again, +that can be done both for the generic case and for particular +programs. +.PP +The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5). + + +.SH OPTIONS +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXWin\fP accepts the following command line switches, +\fIall\fP of which are optional: +.TP 8 +.B \-clipboard +Enables the integration +between the Cygwin/X clipboard and Windows clipboard. Do not use in +conjunction with the \fIxwinclip\fP program. +.TP 8 +.B "\-clipupdates \fInum_boxes\fP" +Specify an optional threshold, above which the boxes in a shadow +update operation will be collected into a GDI clipping region. The +clipping region is then used to do a single bit block transfer that is +constrained to the updated area by the clipping region. There is some +overhead involved in creating, installing, destroying, and removing +the clipping region, thus there may not be much benefit for a small +number of boxes (less than 10). It is even possible that this +functionality does not provide a benefit at any number of boxes; we +can only determine the usefulness of this feature through testing. +This parameter works in conjunction with engines 1, 2, and 4 (Shadow +GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking, +respectively). +.TP 8 +.B "\-emulate3buttons \fItimeout\fP" +Emulate a three button mouse; pressing both buttons within +.I timeout +milliseconds causes an emulated middle button press. The default +.I timeout +is 50 milliseconds. Note that most mice with scroll wheel have middle +button functionality, usually you will need this option only if you have +a two button mouse without scroll wheel. +.TP 8 +.B \-emulatepseudo +Create a depth 8 PseudoColor visual when running in depths 15, 16, 24, +or 32, collectively known as TrueColor depths. + At this date (April 2004) this option is not still operative. +.TP 8 +.B "\-engine \fIengine_type_id\fP" +This option, which is intended for Cygwin/X developers, +overrides the server's automatically supported engine type. This +parameter will be ignored if the specified engine type is not +supported on the current system. The supported engine type ids are 1 +- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw4. +Additionally, there is a barely functional experimental engine type id +16 - Native GDI. +.TP 8 +.B "\-fullscreen [-depth \fIdepth\fP] [-refresh \fIrate_in_Hz\fP]" +Run the server in fullscreen mode, as opposed to the default windowed +mode. +.TP 8 +.B "\-depth \fIdepth\fP" +Specify the color depth, in bits per pixel, to use when running in +fullscreen with a DirectDraw engine. This parameter is ignored if +\fB\-fullscreen\fP is not specified. +.TP 8 +.B "\-refresh \fIrate_in_Hz\fP" +Specify an optional refresh rate to use when running in +fullscreen with a DirectDraw engine. This parameter is ignored if +\fB\-fullscreen\fP is not specified. +.TP 8 +.B \-help +Write a help text to the console and to the log file. +.TP 8 +.B \-ignoreinput +Ignore keyboard and mouse input. This is usually only used for testing +and debugging purposes. +.TP 8 +.B \-[no]keyhook +Enable [disable] a low-level keyboard hook for catching +special key combinations like Alt+Tab and passing them to the X +Server instead of letting \fIWindows\fP handle them. +.TP 8 +.B \-lesspointer +Hide the Windows mouse cursor when the mouse is over any Cygwin/X +window (regardless of whether that window is active or inactive). This +prevents the Windows mouse cursor from being placed overtop of the X +cursor. +.TP 8 +.B "\-logfile \fIFile_Name\fP" +Change the log file from the default located at \fI +__logdir__/XWin.0.log\fP to the one indicated by \fIFile_Name\fP. +.TP 8 +.B "\-logverbose \fIlevel\fP" +Control the degree of verbosity of the log messages with the integer +parameter \fIlevel\fP. For \fIlevel\fP=0 only fatal errors are +reported, for \fIlevel\fP=1 (default) simple information about +configuration is also given, for \fIlevel\fP=2 a detailed log +information (including trace and debug output) is produced. Bigger +values will yield a still more detailed debug output. At this date +(April 2004) the option is still not fully operative; the default +value is 2 and the output is insensitive to the level value. +.TP 8 +.B \-multimonitors +Create a root window that covers all monitors on a system with +multiple monitors. +.TP 8 +.B \-multiwindow +Start the integrated \fIWindowsi\fP-based window manager, which launches each +top-level X window in its own \fIWindows\fP window. Not to be used together +with \fB\-rootless\fP nor \fB\-fullscreen\fP. +.TP 8 +.B \-nodecoration +Do not give the Cygwin/X window a Windows window border, title bar, +etc. This parameter only applies to windowed mode screens, i.e., this +parameter is ignored when the \fB\-fullscreen\fP parameter is specified. +.TP 8 +.B \-nounicodeclipboard +Do not use Unicode clipboard even if NT-based platform. +.TP 8 +.B \-rootless +Run the server in rootless mode. Not to be used with \fB\-multiwindow\fP +nor with \fB\-fullscreen\fP. +.TP 8 +.B "\-screen \fIscreen_number\fP \fIwidth\fP \fIheight\fP" +This parameter may be used to specify the +.I screen_number, +.I height, +and +.I width +of one or several Cygwin/X screens; each Cygwin/X screen will be +opened in its own window. When using multiple screens, be sure not to +duplicate any screen numbers. +.I XWin +default behavior is to create a single screen that is roughly +the size of the current Windows display area. +Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a +default to all screens by placing those screen specific parameters +before any \fB\-screen\fP parameter. Screen specific parameters placed after +the first \fB\-screen\fP parameter will apply only to the immediately +preceeding \fB\-screen\fP parameter. +.TP 8 +.B \-scrollbars +In windowed mode, allow screens bigger than the Windows desktop. +Moreover, if the window has decorations, one can now resize it. +.TP 8 +.B \-[no]trayicon +Do not create a tray icon. Default is to create one +icon per screen. You can globally disable tray icons with +\fB\-notrayicon\fP, then enable it for specific screens with +\fB\-trayicon\fP for those screens. +.TP 8 +.B \-[no]unixkill +Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a +signal to exit the X Server. The \fICtrl-Alt-Backspace\fP key combination +is disabled by default. +.TP 8 +.B \-[no]winkill +Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the +X Server. +The \fIAlt-F4\fP key combination is enabled by default. +.TP 8 +.B \-swcursor +Disable the usage of the windows cursor and use the X11 software cursor instead. +.TP 8 +.B \-silent-dup-error +If another instance of XWin is found running, exit silently and don't display +the error message. +.TP 8 +.B "\-xkblayout \fIlayout\fP" +.TP 8 +.B "\-xkbmodel \fImodel\fP" +.TP 8 +.B "\-xkboptions \fIoption\fP" +.TP 8 +.B "\-xkbrules \fIrule\fP" +.TP 8 +.B "\-xkbvariant \fIvariant\fp" +These options implement the xkeyboard extension for loading +a particular keyboard map as the X server starts. The behavior is similar +to the \fIsetxkbmap\fP program. The layout data is located at \fI +__datadir__/X11/xkb/\fP. Additional information is found in the +README files therein and in the man page of \fIsetxkbmap\fP. For example +in order to load a German layout for a pc105 keyboard one uses +the options: +.br +.I " \-xkblayout de \-xkbmodel pc105" +.PP +Alternatively one may use the \fIsetxkbmap\fP program after XWin is +running or even the \fIxmodmap\fP program for loading the old-style +keyboard maps. + + +.SH "SEE ALSO" +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__), setxkbmap(1) + + +.SH BUGS +.I XWin +and this man page still have many limitations. Some of the more obvious +ones are: +.br +- The display mode can not be changed once the X server has started. +.br +- The XWin software is developing rapidly; it is therefore likely that +this man page is not up to date. It is always prudent to +look also at the output of \fIXWin -help\fP and to the Cygwin/X User Guide +at /usr/share/doc/cygwin-x-doc-x.x.x/ug/cygwin-x-ug.xxx in order to +check the options that are operative. + + +.SH AUTHORS +This list is by no means complete, but direct contributors to the +Cygwin/X project include (in alphabetical order by last name): Stuart +Adamson, Michael Bax, Jehan Bing, Lev Bishop, Dr. Peter Busch, Biju G +C, Robert Collins, Nick Crabtree, Early Ehlinger, Christopher Faylor, +John Fortin, Brian Genisio, Fabrizio Gennari, Alexander Gottwald, Ralf +Habacker, Colin Harrison, Matthieu Herrb, Alan Hourihane, Pierre A +Humblet, Harold L Hunt II, Dakshinamurthy Karra, Kensuke Matsuzaki, +Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Suhaib +Siddiqi, Jack Tanner, and Nicholas Wourms. diff --git a/xorg-server/hw/xwin/XWin.rc b/xorg-server/hw/xwin/XWin.rc index 749c0f5f5..5a254e1ab 100644 --- a/xorg-server/hw/xwin/XWin.rc +++ b/xorg-server/hw/xwin/XWin.rc @@ -50,9 +50,9 @@ BEGIN CONTROL "FAQ", ID_ABOUT_FAQ, "Button", BS_OWNERDRAW | WS_TABSTOP, 135, 65, 75, 15 - DEFPUSHBUTTON "Dismiss", IDOK, 95, 85, 50, 15 + DEFPUSHBUTTON "&OK", IDOK, 95, 85, 50, 15 - CTEXT "Welcome to the preliminary About box for the " PROJECT_NAME " X Server. This dialog was created on 2004/03/25 and will eventually be filled with more useful information. For now, use the links below to learn more about the " PROJECT_NAME " project.", IDC_STATIC, 5, 5, 230, 35 + CTEXT PROJECT_NAME " X Server. Use the links below to learn more about the " PROJECT_NAME " project.", IDC_STATIC, 5, 5, 230, 35 END @@ -75,11 +75,11 @@ END EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE FONT 8, "MS Sans Serif" -CAPTION PROJECT_NAME " - Exit?" +CAPTION "Exit " PROJECT_NAME "?" BEGIN PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14 DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14 - CTEXT "Exiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8 + CTEXT "E&xiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8 CTEXT "No information about connected clients available.", IDC_CLIENTS_CONNECTED, 7, 24, 166, 8 CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 36, 166, 8 END diff --git a/xorg-server/hw/xwin/XWinrc.man.pre b/xorg-server/hw/xwin/XWinrc.man.pre new file mode 100644 index 000000000..4fb436ddd --- /dev/null +++ b/xorg-server/hw/xwin/XWinrc.man.pre @@ -0,0 +1,248 @@ +.TH XWIN 5 __vendorversion__ + + +.SH NAME +XWinrc\- XWin Server Resource Configuration File. + + +.SH DESCRIPTION +The X Server for the X Window System on the Cygwin/X environment +running on Microsoft Windows, \fIXWin\fP can be optionally configured +with the \fIXWinrc\fP file. A system-wide configuration file should +be placed in \fI +__sysconfdir__/X11/system.XWinrc\fP, a per-user file +should be put at \fI$HOME/.XWinrc\fP. The \fIsystem.XWinrc\fP file is +read only if no \fI$HOME/.XWinrc\fP exist. +.PP +With the \fI.XWinrc\fP configuration file it is possible to do the +following: +.PP +1- To include items into the menu associated with the \fIXWin\fP icon +which is in the \fIWindows\fP system tray. This feature functions in +all XWin modes that have such tray icon. +.PP +2- To include items into the menu which is associated with the +\fIWindows\fP window that \fIXWin -multiwindow\fP produces for each +top-level X-window. That can be done both for the generic case and +for particular programs. +.PP +3- To change the icon that is associated to the \fIWindows\fP window +that \fIXWin -multiwindow\fP produces for each top-level X-window. +Again, that can be done both for the generic case and for particular +programs. The new icons associated should be \fIWindows\fP format +icons \fI.ico\fP. +.PP +4- To change the style that is associated to the \fIWindows\fP window +that \fI-multiwindow\fP produces for each top-level X window. Again, +that can be done both for the generic case and for particular programs. + + +.SH FILE FORMAT +.B Keywords +are case insensitive, but in this document they will be written +completely capitalized. +.PP +.B Comments +are legal pretty much anywhere you can have an end-of-line; they +begin with "#" or "//" and go to the end-of-line. +.PP +Quote marks in strings are optional unless the string has included spaces, +or could be parsed, ambiguously, as a misplaced keyword. +.PP +There are four kinds of instructions: miscellaneous, menu, icon and style. + + +.SH Miscellaneous instruction +.TP 8 +.B DEBUG \fIString\fP +The \fIString\fP is printed to the XWin log file. + +.TP 8 +.B TRAYICON \fIicon-specifier\fB +The \fBTRAYICON\fP keyword changes the icon \fIXWin\fP displays in the +system tray area. + +.TP 8 +.B SILENTEXIT +The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the +exit confirmation dialog. + + +.SH Menu instructions +.TP 8 +.B MENU \fIMenu_Name\fP { +.br +.B \fIMenu_Item_Line\fP +.br +.B \fIMenu_Item_Line\fP +.br +.B \fI...\fP +.br +.B } +.br +This instruction defines a menu and asigns a \fIMenu_Name\fP to it. +\fIMenu_Item_Line\fP are lines of any of the following types: +.TP 8 +.B \t SEPARATOR +.TP 8 +.B \t \fIItem_Label\fP EXEC \fICommand\fP +.TP 8 +.B \t \fIItem_Label\fP MENU \fIpreviously-defined-menu-name\fP +.TP 8 +.B \t \fIItem_Label\fP ALWAYSONTOP +.TP 8 +.B \t \fIItem_Label\fP RELOAD +.br +The \fIItem_Label\fP is the string that is written in the menu item. +.br +\fICommand\fP is a string with the command that will be executed by /bin/sh. +Here paths should be \fICYGWIN\fP style (e.g. /usr/local/bin/myprogram). +A string "%display%" appearing in the \fICommand\fP will be replaced +with the proper display variable (i.e. 127.0.0.1:<display>.0). +.br +\fBALWAYSONTOP\fP sets the window to which the menu is associated to +display above all others. +.br +\fBRELOAD\fP causes the XWinrc file to be reloaded and icons and menus +regenerated. +.TP 8 +.B ROOTMENU \fIpreviously-defined-menu-name\fP +Includes the items in the indicated menu into the menu associated with +\fIXWin\fP that appears in the system tray. +.TP 8 +.B DEFAULTSYSMENU \fIpreviously-defined-menu-name\fP ATSTART|ATEND +Includes the items in the indicated menu into the menu associated with +generic top-level X-Windows in the \fIXWin\fP \fImultiwindow\fP mode. The +keywords \fBATSTART\fP and \fBATEND\fP indicate if such items should be +included at the start or at the end of the menu. +.TP 8 +.B SYSMENU { + \fIclass-or-name-of-window\fP \fIdefined-menu-name\fP \fBATSTART|ATEND\fP +.br + \fI...\fP +.br + \fB}\fP +.br +Associates a specific menu to a specified window class or name +in \fI-multiwindow\fP mode. The keywords ATSTART or ATEND indicate if +such items should be included at the start or at the end of the menu. + + +.SH Icon Instructions +When specifying an \fIicon-file\fP in the following commands several different formats are allowed: +.br +\fB"NAME.ICO"\fP\fI of an .ico format file\fP +.br +\t \t ("cygwin.ico", "apple.ico") +.br +\fB"NAME.DLL,nn"\fP\fI of a .DLL and icon index\fP +.br +\t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon) +.br +\fB",nnn"\fP\fI index into XWin.EXE internal ICON resources\fP +.br +\t \t (",101" is the 1st icon inside \fIXWin.EXE\fP) +.TP 8 +.B ICONDIRECTORY \fIWindows-path-to-icon-directory\fP +Defines the default directory to search for \ficon-file\fP files. +It should be a \fIWindows\fP style path (e.g. C:\\cygwin\\usr\\local\\icons). +.TP 8 +.B DEFAULTICON \fIicon-file\fP +Defines a replacement for the standard X icon for applications without +specified icons. +.TP 8 +.B ICONS { +.br + \fIclass-or-name-of-window\fP \fIicon-file\fP +.br + \fI...\fP +.br + \fB}\fP +.br +Defines icon replacements windows matching the specified window class or names. +If multiple name or class matches occur for a window, only the first one +will be used. + +.SH Style Instructions +.TP 8 +.B STYLES { +\fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP +.br + \fI...\fP +.br +\fB}\fP + +Associates specific styles to a specified window class or name +in \fI-multiwindow\fP mode. If multiple class or name matches occur, +for a window, only the first one will be used. + +The style keywords indicate the following: + +\fIstyle-keyword-1\fP + +\fBTOPMOST\fP +.br +Open the class or name above all NOTOPMOST Microsoft Windows +.br +\fBMAXIMIZE\fP +.br +Start the class or name fullscreen. +.br +\fBMINIMIZE\fP +.br +Start the class or name iconic. +.br +\fBBOTTOM\fP +.br +Open the class or name below all Windows windows. +.br + +\fIstyle-keyword-2\fP + +\fBNOTITLE\fP +.br +No Windows title bar, for the class or name. +.br +\fBOUTLINE\fP +.br +No Windows title bar and just a thin-line border, for the class or name. +.br +\fBNOFRAME\fP +.br +No Windows title bar or border, for the class or name. + +One keyword in \fIstyle-keyword-1\fP can be used with one keyword in \fIstyle-keyword-2\fP, +or any keyword can be used singly. + + +.SH EXAMPLE +.TP 8 +This example adds an Xterm menu item to the system tray icon +\fBMENU systray { +.br +\t xterm EXEC "xterm -display %display% -sb -sl 999" +.br +\t SEPARATOR +.br +} +.br +ROOTMENU systray +\fP + +.TP 8 +This example makes an oclock window frameless in \fI-multiwindow\fP mode +\fBSTYLES { +.br +\t oclock NOFRAME +.br +} + + + +.SH "SEE ALSO" + XWin(1) + + +.SH AUTHOR +The XWinrc feature of XWin was written primarily by Earle F. Philhower +III. Extended for style configuration by Colin Harrison. diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index ea54b997c..9009df29b 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -58,7 +58,6 @@ # define WM_XBUTTONDBLCLK 525 #endif -#define NEED_EVENTS #define WIN_DEFAULT_BPP 0 #define WIN_DEFAULT_WHITEPIXEL 255 @@ -103,6 +102,7 @@ #define WIN_E3B_TIMER_ID 1 #define WIN_POLLING_MOUSE_TIMER_ID 2 +#define MOUSE_POLLING_INTERVAL 50 #define WIN_E3B_OFF -1 #define WIN_FD_INVALID -1 @@ -314,6 +314,7 @@ typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr); typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin); +typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr); /* Typedef for DIX wrapper functions */ typedef int (*winDispatchProcPtr) (ClientPtr); @@ -564,6 +565,8 @@ typedef struct _winPrivScreenRec winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; + winCreateScreenResourcesProc pwinCreateScreenResources; + #ifdef XWIN_MULTIWINDOW /* Window Procedures for MultiWindow mode */ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow; @@ -633,12 +636,13 @@ extern DevPrivateKey g_iGCPrivateKey; extern DevPrivateKey g_iPixmapPrivateKey; extern DevPrivateKey g_iWindowPrivateKey; extern unsigned long g_ulServerGeneration; -extern CARD32 g_c32LastInputEventTime; extern DWORD g_dwEnginesSupported; extern HINSTANCE g_hInstance; extern int g_copyROP[]; extern int g_patternROP[]; extern const char * g_pszQueryHost; +extern DeviceIntPtr g_pwinPointer; +extern DeviceIntPtr g_pwinKeyboard; /* @@ -952,6 +956,11 @@ winKeybdReleaseKeys (void); void winSendKeyEvent (DWORD dwKey, Bool fDown); +BOOL +winCheckKeyPressed(WPARAM wParam, LPARAM lParam); + +void +winFixShiftKeys (int iScanCode); /* * winkeyhook.c @@ -1004,6 +1013,9 @@ winMouseButtonsHandle (ScreenPtr pScreen, int iEventType, int iButton, WPARAM wParam); +void +winEnqueueMotion(int x, int y); + #ifdef XWIN_NATIVEGDI /* * winnativegdi.c @@ -1205,6 +1217,8 @@ winSetShapeRootless (WindowPtr pWindow); HICON winXIconToHICON (WindowPtr pWin, int iconSize); +void +winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon); #ifdef XWIN_MULTIWINDOW /* diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h index 445c01b27..089c2913b 100644 --- a/xorg-server/hw/xwin/winclipboard.h +++ b/xorg-server/hw/xwin/winclipboard.h @@ -38,7 +38,7 @@ #ifdef __CYGWIN__ #include <sys/select.h> #else -#include "Xwinsock.h" +#include <X11/Xwinsock.h> #define HAS_WINSOCK #endif #include <fcntl.h> @@ -48,27 +48,12 @@ /* X headers */ #include <X11/X.h> #include <X11/Xatom.h> -/* NOTE: For some unknown reason, including Xproto.h solves - * tons of problems with including windows.h. Unknowns reasons - * are usually bad, so someone should investigate this. - */ #include <X11/Xproto.h> -#include "X11/Xutil.h" -#include "X11/Xlocale.h" - -/* Fixups to prevent collisions between Windows and X headers */ -#define ATOM DWORD - -#ifndef __CYGWIN__ -#define sleep(x) Sleep (1000 * (x)) -#endif +#include <X11/Xutil.h> +#include <X11/Xlocale.h> /* Windows headers */ -#ifndef XFree86Server -#define XFree86Server -#endif -#include <windows.h> -#undef XFree86Server +#include <X11/Xwindows.h> /* Clipboard module constants */ diff --git a/xorg-server/hw/xwin/winclipboardinit.c b/xorg-server/hw/xwin/winclipboardinit.c index 6a0cbaf2c..bec63ac8e 100644 --- a/xorg-server/hw/xwin/winclipboardinit.c +++ b/xorg-server/hw/xwin/winclipboardinit.c @@ -59,7 +59,7 @@ extern HWND g_hwndClipboard; */ Bool -winInitClipboard () +winInitClipboard (void) { ErrorF ("winInitClipboard ()\n"); @@ -90,12 +90,13 @@ winInitClipboard () */ HWND -winClipboardCreateMessagingWindow () +winClipboardCreateMessagingWindow (void) { - WNDCLASS wc; + WNDCLASSEX wc; HWND hwnd; /* Setup our window class */ + wc.cbSize=sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winClipboardWindowProc; wc.cbClsExtra = 0; @@ -106,7 +107,8 @@ winClipboardCreateMessagingWindow () wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS; - RegisterClass (&wc); + wc.hIconSm = 0; + RegisterClassEx (&wc); /* Create the window */ hwnd = CreateWindowExA (0, /* Extended styles */ diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index 081abd5e7..8eb825fa8 100644 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) 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 copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -37,6 +39,7 @@ #include <errno.h> #endif #include "X11/Xauth.h" +#include "misc.h" /* @@ -231,15 +234,6 @@ winClipboardProc (void *pvNotUsed) iMaxDescriptor = iConnectionNumber + 1; #endif - /* Select event types to watch */ - if (XSelectInput (pDisplay, - DefaultRootWindow (pDisplay), - SubstructureNotifyMask | - StructureNotifyMask | - PropertyChangeMask) == BadWindow) - ErrorF ("winClipboardProc - XSelectInput generated BadWindow " - "on RootWindow\n\n"); - /* Create atoms */ atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False); atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False); @@ -258,6 +252,13 @@ winClipboardProc (void *pvNotUsed) pthread_exit (NULL); } + /* Select event types to watch */ + if (XSelectInput (pDisplay, + iWindow, + PropertyChangeMask) == BadWindow) + ErrorF ("winClipboardProc - XSelectInput generated BadWindow " + "on messaging window\n"); + /* Save the window in the screen privates */ g_iClipboardWindow = iWindow; @@ -273,7 +274,8 @@ winClipboardProc (void *pvNotUsed) /* PRIMARY */ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow) { ErrorF ("winClipboardProc - Could not set PRIMARY owner\n"); pthread_exit (NULL); @@ -282,7 +284,8 @@ winClipboardProc (void *pvNotUsed) /* CLIPBOARD */ iReturn = XSetSelectionOwner (pDisplay, atomClipboard, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, atomClipboard) != iWindow) { ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n"); pthread_exit (NULL); diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c index 802a74035..292ca872b 100644 --- a/xorg-server/hw/xwin/winclipboardwndproc.c +++ b/xorg-server/hw/xwin/winclipboardwndproc.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) 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 copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -34,9 +36,7 @@ #include <sys/types.h> #include <sys/time.h> #include "winclipboard.h" - -extern void winFixClipboardChain(); - +#include "misc.h" /* * Constants @@ -63,7 +63,7 @@ extern HWND g_hwndClipboard; * Local function prototypes */ -static Bool +static int winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay, Bool fUseUnicode, int iTimeoutSec); @@ -259,6 +259,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, case WM_DRAWCLIPBOARD: { + static Atom atomClipboard; + static int generation; static Bool s_fProcessingDrawClipboard = FALSE; Display *pDisplay = g_pClipboardDisplay; Window iWindow = g_iClipboardWindow; @@ -266,6 +268,12 @@ winClipboardWindowProc (HWND hwnd, UINT message, winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n"); + if (generation != serverGeneration) + { + generation = serverGeneration; + atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False); + } + /* * We've occasionally seen a loop in the clipboard chain. * Try and fix it on the first hint of recursion. @@ -353,17 +361,13 @@ winClipboardWindowProc (HWND hwnd, UINT message, /* Release CLIPBOARD selection if owned */ iReturn = XGetSelectionOwner (pDisplay, - XInternAtom (pDisplay, - "CLIPBOARD", - False)); + atomClipboard); if (iReturn == g_iClipboardWindow) { winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "CLIPBOARD selection is owned by us.\n"); XSetSelectionOwner (pDisplay, - XInternAtom (pDisplay, - "CLIPBOARD", - False), + atomClipboard, None, CurrentTime); } @@ -383,7 +387,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, XA_PRIMARY, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow) { winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Could not reassert ownership of PRIMARY\n"); @@ -396,12 +401,12 @@ winClipboardWindowProc (HWND hwnd, UINT message, /* Reassert ownership of the CLIPBOARD */ iReturn = XSetSelectionOwner (pDisplay, - XInternAtom (pDisplay, - "CLIPBOARD", - False), + atomClipboard, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, atomClipboard) != iWindow) { winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Could not reassert ownership of CLIPBOARD\n"); diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index 2cfe0ffce..c68d78aa3 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/hw/xwin/winclipboardwrappers.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) 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 copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -40,6 +42,7 @@ * Constants */ +#define CLIP_NUM_CALLS 4 #define CLIP_NUM_SELECTIONS 2 #define CLIP_OWN_PRIMARY 0 #define CLIP_OWN_CLIPBOARD 1 @@ -85,6 +88,8 @@ winProcQueryTree (ClientPtr client) { int iReturn; + ErrorF ("winProcQueryTree - Hello\n"); + /* * This procedure is only used for initialization. * We can unwrap the original procedure at this point @@ -184,7 +189,7 @@ winProcEstablishConnection (ClientPtr client) static int s_iCallCount = 0; static unsigned long s_ulServerGeneration = 0; - ErrorF ("winProcEstablishConnection - Hello\n"); + if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n"); /* Do nothing if clipboard is not enabled */ if (!g_fClipboard) @@ -212,13 +217,15 @@ winProcEstablishConnection (ClientPtr client) /* Increment call count */ ++s_iCallCount; - /* Wait for second call when Xdmcp is enabled */ + /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */ if (g_fXdmcpEnabled && !g_fClipboardLaunched - && s_iCallCount < 4) + && s_iCallCount < CLIP_NUM_CALLS) { - ErrorF ("winProcEstablishConnection - Xdmcp enabled, waiting to " - "start clipboard client until fourth call.\n"); + if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to " + "start clipboard client until %dth call", CLIP_NUM_CALLS); + if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n"); + else ErrorF ("."); return (*winProcEstablishConnectionOrig) (client); } @@ -275,7 +282,7 @@ winProcEstablishConnection (ClientPtr client) * 8) Unfortunately, there is another problem. * 9) XDM walks the list of windows with XQueryTree, * killing any client it finds with a window. - * 10)Thus, when using XDMCP we wait until the second call + * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS * to ProcEstablishCeonnection before we startup the clipboard * client. This should prevent XDM from finding the clipboard * client, since it has not yet created a window. @@ -335,8 +342,8 @@ winProcSetSelectionOwner (ClientPtr client) /* Abort if clipboard not completely initialized yet */ if (!g_fClipboardStarted) { - ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, " - "aborting.\n"); + /* ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, " + "aborting.\n"); */ goto winProcSetSelectionOwner_Done; } @@ -430,11 +437,9 @@ winProcSetSelectionOwner (ClientPtr client) * an owned to not owned transition was detected, * and we currently own the Win32 clipboard. */ - if (None == stuff->window - && (None == s_iOwners[CLIP_OWN_PRIMARY] - || g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY]) - && (None == s_iOwners[CLIP_OWN_CLIPBOARD] - || g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD]) + if (stuff->window == None + && s_iOwners[CLIP_OWN_PRIMARY] == None + && s_iOwners[CLIP_OWN_CLIPBOARD] == None && fOwnedToNotOwned && g_hwndClipboard != NULL && g_hwndClipboard == GetClipboardOwner ()) @@ -451,10 +456,6 @@ winProcSetSelectionOwner (ClientPtr client) EmptyClipboard (); CloseClipboard (); - /* Clear X selection ownership (might still be marked as us owning) */ - s_iOwners[CLIP_OWN_PRIMARY] = None; - s_iOwners[CLIP_OWN_CLIPBOARD] = None; - goto winProcSetSelectionOwner_Done; } diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c index d4c617bec..ec40814db 100644 --- a/xorg-server/hw/xwin/winclipboardxevents.c +++ b/xorg-server/hw/xwin/winclipboardxevents.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,18 +21,20 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) 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 copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include <xwin-config.h> #endif #include "winclipboard.h" +#include "misc.h" /* @@ -51,18 +54,20 @@ winClipboardFlushXEvents (HWND hwnd, Display *pDisplay, Bool fUseUnicode) { - Atom atomLocalProperty = XInternAtom (pDisplay, - WIN_LOCAL_PROPERTY, - False); - Atom atomUTF8String = XInternAtom (pDisplay, - "UTF8_STRING", - False); - Atom atomCompoundText = XInternAtom (pDisplay, - "COMPOUND_TEXT", - False); - Atom atomTargets = XInternAtom (pDisplay, - "TARGETS", - False); + static Atom atomLocalProperty; + static Atom atomCompoundText; + static Atom atomUTF8String; + static Atom atomTargets; + static int generation; + + if (generation != serverGeneration) + { + generation = serverGeneration; + atomLocalProperty = XInternAtom (pDisplay, WIN_LOCAL_PROPERTY, False); + atomUTF8String = XInternAtom (pDisplay, "UTF8_STRING", False); + atomCompoundText = XInternAtom (pDisplay, "COMPOUND_TEXT", False); + atomTargets = XInternAtom (pDisplay, "TARGETS", False); + } /* Process all pending events */ while (XPending (pDisplay)) @@ -186,8 +191,13 @@ winClipboardFlushXEvents (HWND hwnd, if (fUseUnicode && !IsClipboardFormatAvailable (CF_UNICODETEXT)) { - ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not " - "available from Win32 clipboard. Aborting.\n"); + static int count; /* Hack to stop acroread spamming the log */ + static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */ + if (hwnd != lasthwnd) count = 0; + count++; + if (count < 6) ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not " + "available from Win32 clipboard. Aborting %d.\n", count); + lasthwnd = hwnd; /* Abort */ fAbort = TRUE; @@ -301,6 +311,7 @@ winClipboardFlushXEvents (HWND hwnd, /* Initialize the text property */ xtpText.value = NULL; + xtpText.nitems = 0; /* Create the text property from the text list */ if (fUseUnicode) @@ -361,10 +372,13 @@ winClipboardFlushXEvents (HWND hwnd, /* Release the clipboard data */ GlobalUnlock (hGlobal); pszGlobalData = NULL; + fCloseClipboard = FALSE; + CloseClipboard (); /* Clean up */ XFree (xtpText.value); xtpText.value = NULL; + xtpText.nitems = 0; /* Setup selection notify event */ eventSelection.type = SelectionNotify; @@ -395,7 +409,11 @@ winClipboardFlushXEvents (HWND hwnd, winClipboardFlushXEvents_SelectionRequest_Done: /* Free allocated resources */ if (xtpText.value) + { XFree (xtpText.value); + xtpText.value = NULL; + xtpText.nitems = 0; + } if (pszConvertData) free (pszConvertData); if (hGlobal && pszGlobalData) @@ -436,7 +454,10 @@ winClipboardFlushXEvents (HWND hwnd, /* Close clipboard if it was opened */ if (fCloseClipboard) + { + fCloseClipboard = FALSE; CloseClipboard (); + } break; @@ -618,6 +639,7 @@ winClipboardFlushXEvents (HWND hwnd, /* Conversion succeeded or some unconvertible characters */ if (ppszTextList != NULL) { + iReturnDataLen = 0; for (i = 0; i < iCount; i++) { iReturnDataLen += strlen(ppszTextList[i]); @@ -663,6 +685,7 @@ winClipboardFlushXEvents (HWND hwnd, ppszTextList = NULL; XFree (xtpText.value); xtpText.value = NULL; + xtpText.nitems = 0; /* Convert the X clipboard string to DOS format */ winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData)); @@ -711,6 +734,8 @@ winClipboardFlushXEvents (HWND hwnd, hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen); } + free (pszReturnData); + /* Check that global memory was allocated */ if (!hGlobal) { @@ -774,7 +799,11 @@ winClipboardFlushXEvents (HWND hwnd, if (ppszTextList) XFreeStringList (ppszTextList); if (xtpText.value) + { XFree (xtpText.value); + xtpText.value = NULL; + xtpText.nitems = 0; + } if (pszConvertData) free (pszConvertData); if (pwszUnicodeStr) diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c index 38966bf96..3e1908c90 100644 --- a/xorg-server/hw/xwin/winconfig.c +++ b/xorg-server/hw/xwin/winconfig.c @@ -36,12 +36,7 @@ #include "winmsg.h" #include "globals.h" -#ifdef XKB -#ifndef XKB_IN_SERVER -#define XKB_IN_SERVER -#endif -#include <xkbsrv.h> -#endif +#include "xkbsrv.h" #ifdef XWIN_XF86CONFIG #ifndef CONFIGPATH @@ -67,15 +62,11 @@ WinCmdlineRec g_cmdline = { #ifdef XWIN_XF86CONFIG NULL, /* keyboard */ #endif -#ifdef XKB - FALSE, /* noXkbExtension */ - NULL, /* xkbMap */ NULL, /* xkbRules */ NULL, /* xkbModel */ NULL, /* xkbLayout */ NULL, /* xkbVariant */ NULL, /* xkbOptions */ -#endif NULL, /* screenname */ NULL, /* mousename */ FALSE, /* emulate3Buttons */ @@ -87,24 +78,14 @@ winInfoRec g_winInfo = { 0, /* leds */ 500, /* delay */ 30 /* rate */ -#ifdef XKB } , { /* xkb */ - FALSE, /* disable */ NULL, /* rules */ NULL, /* model */ NULL, /* layout */ NULL, /* variant */ NULL, /* options */ - NULL, /* initialMap */ - NULL, /* keymap */ - NULL, /* types */ - NULL, /* compat */ - NULL, /* keycodes */ - NULL, /* symbols */ - NULL /* geometry */ -#endif } , { @@ -228,11 +209,9 @@ winReadConfigfile () Bool winConfigKeyboard (DeviceIntPtr pDevice) { -#ifdef XKB char layoutName[KL_NAMELENGTH]; static unsigned int layoutNum = 0; int keyboardType; -#endif #ifdef XWIN_XF86CONFIG XF86ConfInputPtr kbd = NULL; XF86ConfInputPtr input_list = NULL; @@ -242,26 +221,10 @@ winConfigKeyboard (DeviceIntPtr pDevice) char *s = NULL; /* Setup defaults */ -#ifdef XKB - g_winInfo.xkb.disable = FALSE; -# ifdef PC98 /* japanese */ /* not implemented */ - g_winInfo.xkb.rules = "xfree98"; - g_winInfo.xkb.model = "pc98"; - g_winInfo.xkb.layout = "nex/jp"; - g_winInfo.xkb.variant = NULL; - g_winInfo.xkb.options = NULL; -# else - g_winInfo.xkb.rules = "xorg"; - g_winInfo.xkb.model = "pc101"; - g_winInfo.xkb.layout = "us"; - g_winInfo.xkb.variant = NULL; - g_winInfo.xkb.options = NULL; -# endif /* PC98 */ + XkbGetRulesDflts(&g_winInfo.xkb); /* * Query the windows autorepeat settings and change the xserver defaults. - * If XKB is disabled then windows handles the autorepeat and the special - * treatment is not needed */ { int kbd_delay; @@ -358,15 +321,6 @@ winConfigKeyboard (DeviceIntPtr pDevice) } } - g_winInfo.xkb.initialMap = NULL; - g_winInfo.xkb.keymap = NULL; - g_winInfo.xkb.types = NULL; - g_winInfo.xkb.compat = NULL; - g_winInfo.xkb.keycodes = NULL; - g_winInfo.xkb.symbols = NULL; - g_winInfo.xkb.geometry = NULL; -#endif /* XKB */ - /* parse the configuration */ #ifdef XWIN_XF86CONFIG if (g_cmdline.keyboard) @@ -418,169 +372,101 @@ winConfigKeyboard (DeviceIntPtr pDevice) } #endif -#ifdef XKB - from = X_DEFAULT; - if (g_cmdline.noXkbExtension) - { - from = X_CMDLINE; - g_winInfo.xkb.disable = TRUE; - } -#ifdef XWIN_XF86CONFIG - else if (kbd->inp_option_lst) - { - int b = winSetBoolOption (kbd->inp_option_lst, "XkbDisable", FALSE); - if (b) - { - from = X_CONFIG; - g_winInfo.xkb.disable = TRUE; - } - } -#endif - if (g_winInfo.xkb.disable) - { - winMsg (from, "XkbExtension disabled\n"); - } - else - { - s = NULL; - if (g_cmdline.xkbRules) - { - s = g_cmdline.xkbRules; - from = X_CMDLINE; - } + s = NULL; + if (g_cmdline.xkbRules) + { + s = g_cmdline.xkbRules; + from = X_CMDLINE; + } #ifdef XWIN_XF86CONFIG - else - { - s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL); - from = X_CONFIG; - } + else + { + s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL); + from = X_CONFIG; + } #endif - if (s) - { - g_winInfo.xkb.rules = NULL_IF_EMPTY (s); - winMsg (from, "XKB: rules: \"%s\"\n", s); - } + if (s) + { + g_winInfo.xkb.rules = NULL_IF_EMPTY (s); + winMsg (from, "XKB: rules: \"%s\"\n", s); + } - s = NULL; - if (g_cmdline.xkbModel) - { - s = g_cmdline.xkbModel; - from = X_CMDLINE; - } + s = NULL; + if (g_cmdline.xkbModel) + { + s = g_cmdline.xkbModel; + from = X_CMDLINE; + } #ifdef XWIN_XF86CONFIG - else - { - s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL); - from = X_CONFIG; - } + else + { + s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL); + from = X_CONFIG; + } #endif - if (s) - { - g_winInfo.xkb.model = NULL_IF_EMPTY (s); - winMsg (from, "XKB: model: \"%s\"\n", s); - } + if (s) + { + g_winInfo.xkb.model = NULL_IF_EMPTY (s); + winMsg (from, "XKB: model: \"%s\"\n", s); + } - s = NULL; - if (g_cmdline.xkbLayout) - { - s = g_cmdline.xkbLayout; - from = X_CMDLINE; - } + s = NULL; + if (g_cmdline.xkbLayout) + { + s = g_cmdline.xkbLayout; + from = X_CMDLINE; + } #ifdef XWIN_XF86CONFIG - else - { - s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL); - from = X_CONFIG; - } + else + { + s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL); + from = X_CONFIG; + } #endif - if (s) - { - g_winInfo.xkb.layout = NULL_IF_EMPTY (s); - winMsg (from, "XKB: layout: \"%s\"\n", s); - } + if (s) + { + g_winInfo.xkb.layout = NULL_IF_EMPTY (s); + winMsg (from, "XKB: layout: \"%s\"\n", s); + } - s = NULL; - if (g_cmdline.xkbVariant) - { - s = g_cmdline.xkbVariant; - from = X_CMDLINE; - } + s = NULL; + if (g_cmdline.xkbVariant) + { + s = g_cmdline.xkbVariant; + from = X_CMDLINE; + } #ifdef XWIN_XF86CONFIG - else - { - s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL); - from = X_CONFIG; - } + else + { + s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL); + from = X_CONFIG; + } #endif - if (s) - { - g_winInfo.xkb.variant = NULL_IF_EMPTY (s); - winMsg (from, "XKB: variant: \"%s\"\n", s); - } + if (s) + { + g_winInfo.xkb.variant = NULL_IF_EMPTY (s); + winMsg (from, "XKB: variant: \"%s\"\n", s); + } - s = NULL; - if (g_cmdline.xkbOptions) - { - s = g_cmdline.xkbOptions; - from = X_CMDLINE; - } + s = NULL; + if (g_cmdline.xkbOptions) + { + s = g_cmdline.xkbOptions; + from = X_CMDLINE; + } #ifdef XWIN_XF86CONFIG - else - { - s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL); - from = X_CONFIG; - } + else + { + s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL); + from = X_CONFIG; + } #endif - if (s) - { - g_winInfo.xkb.options = NULL_IF_EMPTY (s); - winMsg (from, "XKB: options: \"%s\"\n", s); - } - -#ifdef XWIN_XF86CONFIG - from = X_CMDLINE; - - if ((s = winSetStrOption (kbd->inp_option_lst, "XkbKeymap", NULL))) - { - g_winInfo.xkb.keymap = NULL_IF_EMPTY (s); - winMsg (X_CONFIG, "XKB: keymap: \"%s\" " - " (overrides other XKB settings)\n", s); - } - - if ((s = winSetStrOption (kbd->inp_option_lst, "XkbCompat", NULL))) - { - g_winInfo.xkb.compat = NULL_IF_EMPTY (s); - winMsg (X_CONFIG, "XKB: compat: \"%s\"\n", s); - } - - if ((s = winSetStrOption (kbd->inp_option_lst, "XkbTypes", NULL))) - { - g_winInfo.xkb.types = NULL_IF_EMPTY (s); - winMsg (X_CONFIG, "XKB: types: \"%s\"\n", s); - } - - if ((s = - winSetStrOption (kbd->inp_option_lst, "XkbKeycodes", NULL))) - { - g_winInfo.xkb.keycodes = NULL_IF_EMPTY (s); - winMsg (X_CONFIG, "XKB: keycodes: \"%s\"\n", s); - } - - if ((s = - winSetStrOption (kbd->inp_option_lst, "XkbGeometry", NULL))) - { - g_winInfo.xkb.geometry = NULL_IF_EMPTY (s); - winMsg (X_CONFIG, "XKB: geometry: \"%s\"\n", s); - } + if (s) + { + g_winInfo.xkb.options = NULL_IF_EMPTY (s); + winMsg (from, "XKB: options: \"%s\"\n", s); + } - if ((s = winSetStrOption (kbd->inp_option_lst, "XkbSymbols", NULL))) - { - g_winInfo.xkb.symbols = NULL_IF_EMPTY (s); - winMsg (X_CONFIG, "XKB: symbols: \"%s\"\n", s); - } -#endif -#endif - } #ifdef XWIN_XF86CONFIG } #endif @@ -675,10 +561,8 @@ winConfigFiles () } #else Bool -winConfigFiles () +winConfigFiles (void) { - MessageType from; - /* Fontpath */ if (g_cmdline.fontPath) { @@ -692,14 +576,14 @@ winConfigFiles () Bool -winConfigOptions () +winConfigOptions (void) { return TRUE; } Bool -winConfigScreens () +winConfigScreens (void) { return TRUE; } diff --git a/xorg-server/hw/xwin/winconfig.h b/xorg-server/hw/xwin/winconfig.h index 4b56d639c..63d621112 100644 --- a/xorg-server/hw/xwin/winconfig.h +++ b/xorg-server/hw/xwin/winconfig.h @@ -194,15 +194,11 @@ typedef struct #ifdef XWIN_XF86CONFIG char *keyboard; #endif -#ifdef XKB - Bool noXkbExtension; - char *xkbMap; char *xkbRules; char *xkbModel; char *xkbLayout; char *xkbVariant; char *xkbOptions; -#endif /* layout */ char *screenname; /* mouse settings */ @@ -309,25 +305,7 @@ typedef struct long rate; } keyboard; -#ifdef XKB - struct - { - Bool disable; - char *rules; - char *model; - char *layout; - char *variant; - char *options; - char *initialMap; - char *keymap; - char *types; - char *compat; - char *keycodes; - char *symbols; - char *geometry; - } - xkb; -#endif + XkbRMLVOSet xkb; struct { Bool emulate3Buttons; diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c index 796a08593..0c342e1ae 100644 --- a/xorg-server/hw/xwin/wincreatewnd.c +++ b/xorg-server/hw/xwin/wincreatewnd.c @@ -63,7 +63,7 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) int iWidth = pScreenInfo->dwWidth; int iHeight = pScreenInfo->dwHeight; HWND *phwnd = &pScreenPriv->hwndScreen; - WNDCLASS wc; + WNDCLASSEX wc; char szTitle[256]; #if CYGDEBUG @@ -71,24 +71,30 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) #endif /* Setup our window class */ + wc.cbSize=sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; - wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); + wc.hIcon = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); wc.hCursor = 0; wc.hbrBackground = 0; wc.lpszMenuName = NULL; wc.lpszClassName = WINDOW_CLASS; - RegisterClass (&wc); + wc.hIconSm = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); + RegisterClassEx (&wc); /* Set display and screen-specific tooltip text */ if (g_pszQueryHost != NULL) snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE_XDMCP, - g_pszQueryHost); + g_pszQueryHost, + display, + (int) pScreenInfo->dwScreen); else snprintf (szTitle, sizeof (szTitle), @@ -150,7 +156,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) int iPosX; int iPosY; HWND *phwnd = &pScreenPriv->hwndScreen; - WNDCLASS wc; + WNDCLASSEX wc; RECT rcClient, rcWorkArea; DWORD dwWindowStyle; BOOL fForceShowWindow = FALSE; @@ -193,17 +199,21 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) dwWindowStyle |= WS_POPUP; /* Setup our window class */ + wc.cbSize=sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; - wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); + wc.hIcon = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = WINDOW_CLASS; - RegisterClass (&wc); + wc.hIconSm = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); + RegisterClassEx (&wc); /* Get size of work area */ winGetWorkArea (&rcWorkArea, pScreenInfo); @@ -331,7 +341,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE_XDMCP, - g_pszQueryHost); + g_pszQueryHost, + display, + (int) pScreenInfo->dwScreen); else snprintf (szTitle, sizeof (szTitle), diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index 92775e404..ce98162ef 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -39,16 +39,10 @@ #include <cursorstr.h> #include <mipointrst.h> #include <servermd.h> +#include "misc.h" extern Bool g_fSoftwareCursor; - -#ifndef MIN -#define MIN(x,y) ((x)<(y)?(x):(y)) -#endif - -#define BYTE_COUNT(x) (((x) + 7) / 8) - #define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114) #if 0 @@ -62,7 +56,7 @@ extern Bool g_fSoftwareCursor; */ static void -winPointerWarpCursor (ScreenPtr pScreen, int x, int y); +winPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static Bool winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y); @@ -79,7 +73,7 @@ miPointerScreenFuncRec g_winPointerCursorFuncs = static void -winPointerWarpCursor (ScreenPtr pScreen, int x, int y) +winPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { winScreenPriv(pScreen); RECT rcClient; @@ -99,8 +93,16 @@ winPointerWarpCursor (ScreenPtr pScreen, int x, int y) return; } - /* Only update the Windows cursor position if we are active */ - if (pScreenPriv->hwndScreen == GetForegroundWindow ()) + /* + Only update the Windows cursor position if root window is active, + or we are in a rootless mode + */ + if ((pScreenPriv->hwndScreen == GetForegroundWindow ()) + || pScreenPriv->pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || pScreenPriv->pScreenInfo->fMultiWindow +#endif + ) { /* Get the client area coordinates */ GetClientRect (pScreenPriv->hwndScreen, &rcClient); @@ -119,7 +121,7 @@ winPointerWarpCursor (ScreenPtr pScreen, int x, int y) } /* Call the mi warp procedure to do the actual warping in X. */ - miPointerWarpCursor (pScreen, x, y); + miPointerWarpCursor (pDev, pScreen, x, y); } static Bool @@ -195,11 +197,11 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) /* Get the number of bytes required to store the whole cursor image * This is roughly (sm_cx * sm_cy) / 8 * round up to 8 pixel boundary so we can convert whole bytes */ - nBytes = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy; + nBytes = bits_to_bytes(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy; /* Get the effective width and height */ - nCX = MIN(pScreenPriv->cursor.sm_cx, pCursor->bits->width); - nCY = MIN(pScreenPriv->cursor.sm_cy, pCursor->bits->height); + nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width); + nCY = min(pScreenPriv->cursor.sm_cy, pCursor->bits->height); /* Allocate memory for the bitmaps */ pAnd = malloc (nBytes); @@ -210,11 +212,11 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) * The first is for an empty mask */ if (pCursor->bits->emptyMask) { - int x, y, xmax = BYTE_COUNT(nCX); + int x, y, xmax = bits_to_bytes(nCX); for (y = 0; y < nCY; ++y) for (x = 0; x < xmax; ++x) { - int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x; + int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x; int nXPix = BitmapBytePad(pCursor->bits->width) * y + x; pAnd[nWinPix] = 0; @@ -226,11 +228,11 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) } else { - int x, y, xmax = BYTE_COUNT(nCX); + int x, y, xmax = bits_to_bytes(nCX); for (y = 0; y < nCY; ++y) for (x = 0; x < xmax; ++x) { - int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x; + int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x; int nXPix = BitmapBytePad(pCursor->bits->width) * y + x; unsigned char mask = pCursor->bits->mask[nXPix]; @@ -319,7 +321,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) (*pCur++) = 0; else /* Within X11 icon bounds */ { - int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + (x/8); + int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + (x/8); bit = pAnd[nWinPix]; bit = bit & (1<<(7-(x&7))); @@ -436,7 +438,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) * Convert the X cursor representation to native format if possible. */ static Bool -winRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +winRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { if(pCursor == NULL || pCursor->bits == NULL) return FALSE; @@ -452,7 +454,7 @@ winRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) * Free the storage space associated with a realized cursor. */ static Bool -winUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +winUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } @@ -463,7 +465,7 @@ winUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) * Set the cursor sprite and position. */ static void -winSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +winSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { POINT ptCurPos, ptTemp; HWND hwnd; @@ -537,20 +539,35 @@ winSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) /* - * QuartzMoveCursor + * winMoveCursor * Move the cursor. This is a noop for us. */ static void -winMoveCursor (ScreenPtr pScreen, int x, int y) +winMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) +{ +} + +static Bool +winDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr) { + winScreenPriv(pScr); + return pScreenPriv->cursor.spriteFuncs->DeviceCursorInitialize(pDev, pScr); } +static void +winDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr) +{ + winScreenPriv(pScr); + return pScreenPriv->cursor.spriteFuncs->DeviceCursorCleanup(pDev, pScr); +} static miPointerSpriteFuncRec winSpriteFuncsRec = { winRealizeCursor, winUnrealizeCursor, winSetCursor, - winMoveCursor + winMoveCursor, + winDeviceCursorInitialize, + winDeviceCursorCleanup }; diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c index ab06b0d00..31a3766a6 100644 --- a/xorg-server/hw/xwin/windialogs.c +++ b/xorg-server/hw/xwin/windialogs.c @@ -54,6 +54,10 @@ extern Bool g_fClipboardStarted; #endif extern Bool g_fSoftwareCursor; +#if defined(XWIN_MULTIWINDOW) +extern HICON g_hIconX; +extern HICON g_hSmallIconX; +#endif /* * Local function prototypes @@ -146,7 +150,7 @@ winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetCursor (cursor); return TRUE; } - origCB = (WNDPROC)GetWindowLong (hwnd, GWL_USERDATA); + origCB = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA); /* Otherwise fall through to original WndProc */ if (origCB) return CallWindowProc (origCB, hwnd, msg, wParam, lParam); @@ -163,50 +167,90 @@ static void winOverrideURLButton (HWND hwnd, int id) { WNDPROC origCB; - origCB = (WNDPROC)SetWindowLong (GetDlgItem (hwnd, id), - GWL_WNDPROC, (LONG)winURLWndProc); - SetWindowLong (GetDlgItem (hwnd, id), GWL_USERDATA, (LONG)origCB); + origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id), + GWLP_WNDPROC, (LONG_PTR)winURLWndProc); + SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_USERDATA, (LONG_PTR)origCB); } static void winUnoverrideURLButton (HWND hwnd, int id) { WNDPROC origCB; - origCB = (WNDPROC)SetWindowLong (GetDlgItem (hwnd, id), - GWL_USERDATA, 0); + origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id), + GWLP_USERDATA, 0); if (origCB) - SetWindowLong (GetDlgItem (hwnd, id), GWL_WNDPROC, (LONG)origCB); + SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_WNDPROC, (LONG_PTR)origCB); } /* * Center a dialog window in the desktop window + * and set small and large icons to X icons. */ static void -winCenterDialog (HWND hwndDlg) +winInitDialog (HWND hwndDlg) { HWND hwndDesk; - RECT rc, rcDlg, rcDesk; + RECT rc, rcDlg, rcDesk; + HICON hIcon, hIconSmall; hwndDesk = GetParent (hwndDlg); if (!hwndDesk || IsIconic (hwndDesk)) hwndDesk = GetDesktopWindow (); - GetWindowRect (hwndDesk, &rcDesk); - GetWindowRect (hwndDlg, &rcDlg); - CopyRect (&rc, &rcDesk); - - OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); - OffsetRect (&rc, -rc.left, -rc.top); - OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); - - SetWindowPos (hwndDlg, - HWND_TOP, - rcDesk.left + (rc.right / 2), - rcDesk.top + (rc.bottom / 2), + /* Remove minimize and maximize buttons */ + SetWindowLongPtr(hwndDlg, GWL_STYLE, + GetWindowLongPtr(hwndDlg, GWL_STYLE) + & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); + + /* Set Window not to show in the task bar */ + SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, + GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); + + /* Center dialog window in the screen. Not done for multi-monitor systems, where + * it is likely to end up split across the screens. In that case, it appears + * near the Tray icon. + */ + if (GetSystemMetrics(SM_CMONITORS)>1) { + /* Still need to refresh the frame change. */ + SetWindowPos (hwndDlg, HWND_TOPMOST, 0,0,0,0, + SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } else { + GetWindowRect (hwndDesk, &rcDesk); + GetWindowRect (hwndDlg, &rcDlg); + CopyRect (&rc, &rcDesk); + + OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); + OffsetRect (&rc, -rc.left, -rc.top); + OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); + + SetWindowPos (hwndDlg, + HWND_TOPMOST, + rcDesk.left + (rc.right / 2), + rcDesk.top + (rc.bottom / 2), 0, 0, - SWP_NOSIZE | SWP_NOZORDER); + SWP_NOSIZE | SWP_FRAMECHANGED); + } + +#ifdef XWIN_MULTIWINDOW + if (g_hIconX) hIcon=g_hIconX; + else +#endif + hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); + +#ifdef XWIN_MULTIWINDOW + if (g_hSmallIconX) hIconSmall=g_hSmallIconX; + else +#endif + hIconSmall = LoadImage (g_hInstance, + MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_SHARED); + + PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); + PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); } @@ -220,7 +264,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) int i; int liveClients = 0; - /* Count up running clinets (clients[0] is serverClient) */ + /* Count up running clients (clients[0] is serverClient) */ for (i = 1; i < currentMaxClients; i++) if (clients[i] != NullClient) liveClients++; @@ -271,15 +315,6 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) winExitDlgProc, (int) pScreenPriv); - /* Drop minimize and maximize buttons */ - SetWindowLong (g_hDlgExit, GWL_STYLE, - GetWindowLong (g_hDlgExit, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - SetWindowLong (g_hDlgExit, GWL_EXSTYLE, - GetWindowLong (g_hDlgExit, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); - SetWindowPos (g_hDlgExit, HWND_TOPMOST, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); - /* Show the dialog box */ ShowWindow (g_hDlgExit, SW_SHOW); @@ -288,7 +323,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) /* Set focus to the Cancel button */ PostMessage (g_hDlgExit, WM_NEXTDLGCTL, - (int) GetDlgItem (g_hDlgExit, IDCANCEL), TRUE); + GetDlgItem (g_hDlgExit, IDCANCEL), TRUE); } #define CONNECTED_CLIENTS_FORMAT "There are currently %d clients connected." @@ -314,14 +349,7 @@ winExitDlgProc (HWND hDialog, UINT message, /* Store pointers to private structures for future use */ s_pScreenPriv = (winPrivScreenPtr) lParam; - winCenterDialog (hDialog); - - /* Set icon to standard app icon */ - PostMessage (hDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, - MAKEINTRESOURCE(IDI_XWIN))); + winInitDialog (hDialog); /* Format the connected clients string */ pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT, @@ -413,17 +441,6 @@ winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv) pScreenPriv->hwndScreen, winChangeDepthDlgProc, (int) pScreenPriv); - - /* Drop minimize and maximize buttons */ - SetWindowLong (g_hDlgDepthChange, GWL_STYLE, - GetWindowLong (g_hDlgDepthChange, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - SetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE, - GetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE) - & ~WS_EX_APPWINDOW ); - SetWindowPos (g_hDlgDepthChange, 0, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE); - /* Show the dialog box */ ShowWindow (g_hDlgDepthChange, SW_SHOW); @@ -480,13 +497,7 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message, s_pScreenPriv->dwLastWindowsBitsPixel); #endif - winCenterDialog( hwndDialog ); - - /* Set icon to standard app icon */ - PostMessage (hwndDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); + winInitDialog( hwndDialog ); return TRUE; @@ -572,15 +583,6 @@ winDisplayAboutDialog (winPrivScreenPtr pScreenPriv) winAboutDlgProc, (int) pScreenPriv); - /* Drop minimize and maximize buttons */ - SetWindowLong (g_hDlgAbout, GWL_STYLE, - GetWindowLong (g_hDlgAbout, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - SetWindowLong (g_hDlgAbout, GWL_EXSTYLE, - GetWindowLong (g_hDlgAbout, GWL_EXSTYLE) & ~WS_EX_APPWINDOW); - SetWindowPos (g_hDlgAbout, 0, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); - /* Show the dialog box */ ShowWindow (g_hDlgAbout, SW_SHOW); @@ -589,7 +591,7 @@ winDisplayAboutDialog (winPrivScreenPtr pScreenPriv) /* Set focus to the OK button */ PostMessage (g_hDlgAbout, WM_NEXTDLGCTL, - (int) GetDlgItem (g_hDlgAbout, IDOK), TRUE); + GetDlgItem (g_hDlgAbout, IDOK), TRUE); } @@ -622,13 +624,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message, s_pScreenInfo = s_pScreenPriv->pScreenInfo; s_pScreen = s_pScreenInfo->pScreen; - winCenterDialog (hwndDialog); - - /* Set icon to standard app icon */ - PostMessage (hwndDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); + winInitDialog (hwndDialog); /* Override the URL buttons */ winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); @@ -676,7 +672,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message, case ID_ABOUT_CHANGELOG: { - int iReturn; + HINSTANCE iReturn; #ifdef __CYGWIN__ const char * pszCygPath = "/usr/X11R6/share/doc/" "xorg-x11-xwin/changelog.html"; @@ -689,12 +685,12 @@ winAboutDlgProc (HWND hwndDialog, UINT message, "devel/server/changelog.html"; #endif - iReturn = (int) ShellExecute (NULL, - "open", - pszWinPath, - NULL, - NULL, - SW_MAXIMIZE); + iReturn = ShellExecute (NULL, + "open", + pszWinPath, + NULL, + NULL, + SW_MAXIMIZE); if (iReturn < 32) { ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - " @@ -709,12 +705,12 @@ winAboutDlgProc (HWND hwndDialog, UINT message, const char * pszPath = "http://x.cygwin.com/"; int iReturn; - iReturn = (int) ShellExecute (NULL, - "open", - pszPath, - NULL, - NULL, - SW_MAXIMIZE); + iReturn = ShellExecute (NULL, + "open", + pszPath, + NULL, + NULL, + SW_MAXIMIZE); if (iReturn < 32) { ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - " @@ -729,12 +725,12 @@ winAboutDlgProc (HWND hwndDialog, UINT message, const char * pszPath = "http://x.cygwin.com/docs/ug/"; int iReturn; - iReturn = (int) ShellExecute (NULL, - "open", - pszPath, - NULL, - NULL, - SW_MAXIMIZE); + iReturn = ShellExecute (NULL, + "open", + pszPath, + NULL, + NULL, + SW_MAXIMIZE); if (iReturn < 32) { ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - " @@ -749,12 +745,12 @@ winAboutDlgProc (HWND hwndDialog, UINT message, const char * pszPath = "http://x.cygwin.com/docs/faq/"; int iReturn; - iReturn = (int) ShellExecute (NULL, - "open", - pszPath, - NULL, - NULL, - SW_MAXIMIZE); + iReturn = ShellExecute (NULL, + "open", + pszPath, + NULL, + NULL, + SW_MAXIMIZE); if (iReturn < 32) { ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - " diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c index f0bc671e2..fb9aed8a0 100644 --- a/xorg-server/hw/xwin/winengine.c +++ b/xorg-server/hw/xwin/winengine.c @@ -48,7 +48,7 @@ extern const GUID _IID_IDirectDraw4; */ void -winDetectSupportedEngines () +winDetectSupportedEngines (void) { OSVERSIONINFO osvi; @@ -285,7 +285,7 @@ winSetEngine (ScreenPtr pScreen) */ Bool -winGetDDProcAddresses () +winGetDDProcAddresses (void) { Bool fReturn = TRUE; diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c index 7d292134f..72ee2cfb7 100644 --- a/xorg-server/hw/xwin/winerror.c +++ b/xorg-server/hw/xwin/winerror.c @@ -33,10 +33,10 @@ #endif #ifdef XVENDORNAME #define VENDOR_STRING XVENDORNAME -#define VERSION_STRING XORG_RELEASE #define VENDOR_CONTACT BUILDERADDR #endif +#include <../xfree86/common/xorgVersion.h> #include "win.h" /* References to external symbols */ @@ -80,7 +80,6 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args) * * Attempt to do last-ditch, safe, important cleanup here. */ -#ifdef DDXOSFATALERROR void OsVendorFatalError (void) { @@ -93,7 +92,6 @@ OsVendorFatalError (void) "Please open %s for more information.\n", MB_ICONERROR, (g_pszLogFile?g_pszLogFile:"the logfile")); } -#endif /* @@ -117,13 +115,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...) #define MESSAGEBOXF \ "%s\n" \ "Vendor: %s\n" \ - "Release: %s\n" \ + "Release: %d.%d.%d.%d (%d)\n" \ "Contact: %s\n" \ "XWin was started with the following command-line:\n\n" \ "%s\n" pszMsgBox = Xprintf (MESSAGEBOXF, - pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, + pszErrorF, VENDOR_STRING, + XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT, + VENDOR_CONTACT, g_pszCommandLine); if (!pszMsgBox) goto winMessageBoxF_Cleanup; diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index d574f2053..611ea5d55 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -40,19 +40,10 @@ #include "winconfig.h" #include "winmsg.h" -#ifdef XKB -#ifndef XKB_IN_SERVER -#define XKB_IN_SERVER -#endif -#include <xkbsrv.h> -#endif +#include "xkbsrv.h" static Bool g_winKeyState[NUM_KEYCODES]; -/* Stored to get internal mode key states. Must be read-only. */ -static unsigned short const *g_winInternalModeKeyStatesPtr = NULL; - - /* * Local prototypes */ @@ -209,7 +200,6 @@ winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, static void winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) { - g_winInternalModeKeyStatesPtr = &(pDevice->key->state); } @@ -221,93 +211,52 @@ winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) int winKeybdProc (DeviceIntPtr pDeviceInt, int iState) { - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; DevicePtr pDevice = (DevicePtr) pDeviceInt; -#ifdef XKB - XkbComponentNamesRec names; XkbSrvInfoPtr xkbi; XkbControlsPtr ctrl; -#endif switch (iState) { case DEVICE_INIT: winConfigKeyboard (pDeviceInt); - winGetKeyMappings (&keySyms, modMap); - -#ifdef XKB /* FIXME: Maybe we should use winGetKbdLeds () here? */ defaultKeyboardControl.leds = g_winInfo.keyboard.leds; -#else - defaultKeyboardControl.leds = g_winInfo.keyboard.leds; -#endif - -#ifdef XKB - if (g_winInfo.xkb.disable) - { -#endif - InitKeyboardDeviceStruct (pDevice, - &keySyms, - modMap, - winKeybdBell, - winKeybdCtrl); -#ifdef XKB - } - else - { - - names.keymap = g_winInfo.xkb.keymap; - names.keycodes = g_winInfo.xkb.keycodes; - names.types = g_winInfo.xkb.types; - names.compat = g_winInfo.xkb.compat; - names.symbols = g_winInfo.xkb.symbols; - names.geometry = g_winInfo.xkb.geometry; - - winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\"" - " Variant = \"%s\" Options = \"%s\"\n", - g_winInfo.xkb.rules, g_winInfo.xkb.model, - g_winInfo.xkb.layout, g_winInfo.xkb.variant, - g_winInfo.xkb.options); - - XkbSetRulesDflts (g_winInfo.xkb.rules, g_winInfo.xkb.model, - g_winInfo.xkb.layout, g_winInfo.xkb.variant, - g_winInfo.xkb.options); - XkbInitKeyboardDeviceStruct (pDeviceInt, &names, &keySyms, - modMap, winKeybdBell, winKeybdCtrl); - } -#endif -#ifdef XKB - if (!g_winInfo.xkb.disable) - { - xkbi = pDeviceInt->key->xkbInfo; - if (xkbi != NULL) - { - ctrl = xkbi->desc->ctrls; - ctrl->repeat_delay = g_winInfo.keyboard.delay; - ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate; - } - else - { - winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n"); - } + winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\"" + " Variant = \"%s\" Options = \"%s\"\n", + g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none", + g_winInfo.xkb.model ? g_winInfo.xkb.model : "none", + g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none", + g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none", + g_winInfo.xkb.options ? g_winInfo.xkb.options : "none"); + + InitKeyboardDeviceStruct (pDeviceInt, + &g_winInfo.xkb, + winKeybdBell, + winKeybdCtrl); + + xkbi = pDeviceInt->key->xkbInfo; + if ((xkbi != NULL) && (xkbi->desc != NULL)) + { + ctrl = xkbi->desc->ctrls; + ctrl->repeat_delay = g_winInfo.keyboard.delay; + ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate; + } + else + { + winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat\n"); } -#endif - g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state); break; case DEVICE_ON: pDevice->on = TRUE; - g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state); break; case DEVICE_CLOSE: case DEVICE_OFF: pDevice->on = FALSE; - g_winInternalModeKeyStatesPtr = NULL; break; } @@ -362,14 +311,14 @@ winInitializeModeKeyStates (void) */ void -winRestoreModeKeyStates () +winRestoreModeKeyStates (void) { DWORD dwKeyState; BOOL processEvents = TRUE; unsigned short internalKeyStates; /* X server is being initialized */ - if (!g_winInternalModeKeyStatesPtr) + if (!inputInfo.keyboard) return; /* Only process events if the rootwindow is mapped. The keyboard events @@ -382,7 +331,9 @@ winRestoreModeKeyStates () mieqProcessInputEvents (); /* Read the mode key states of our X server */ - internalKeyStates = *g_winInternalModeKeyStatesPtr; + /* (stored in the virtual core keyboard) */ + internalKeyStates = XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state); + winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates); /* * NOTE: The C XOR operator, ^, will not work here because it is @@ -548,7 +499,7 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) */ void -winKeybdReleaseKeys () +winKeybdReleaseKeys (void) { int i; @@ -580,7 +531,8 @@ winKeybdReleaseKeys () void winSendKeyEvent (DWORD dwKey, Bool fDown) { - xEvent xCurrentEvent; + EventListPtr events; + int i, nevents; /* * When alt-tabing between screens we can get phantom key up messages @@ -590,14 +542,17 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) /* Update the keyState map */ g_winKeyState[dwKey] = fDown; - - ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); - xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = - g_c32LastInputEventTime = GetTickCount (); - xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE; - mieqEnqueue (&xCurrentEvent); + GetEventList(&events); + nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinKeyboard, events[i].event); + +#if CYGDEBUG + ErrorF("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", + dwKey, fDown, nevents); +#endif } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) diff --git a/xorg-server/hw/xwin/winkeyhook.c b/xorg-server/hw/xwin/winkeyhook.c index 53d91e6ee..2d6ed18b7 100644 --- a/xorg-server/hw/xwin/winkeyhook.c +++ b/xorg-server/hw/xwin/winkeyhook.c @@ -149,7 +149,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam) */ Bool -winInstallKeyboardHookLL () +winInstallKeyboardHookLL (void) { OSVERSIONINFO osvi = {0}; @@ -186,7 +186,7 @@ winInstallKeyboardHookLL () */ void -winRemoveKeyboardHookLL () +winRemoveKeyboardHookLL (void) { if (g_hhookKeyboardLL) UnhookWindowsHookEx (g_hhookKeyboardLL); diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h index cc0752430..d1d21a12d 100644 --- a/xorg-server/hw/xwin/winlayouts.h +++ b/xorg-server/hw/xwin/winlayouts.h @@ -38,34 +38,50 @@ typedef struct char *layoutname; } WinKBLayoutRec, *WinKBLayoutPtr; +/* + This table is sorted by low byte of winlayout, then by next byte, etc. +*/ + WinKBLayoutRec winKBLayouts[] = { + { 0x404, -1, "pc105", "zh_TW", NULL, NULL, "Chinese (Taiwan)"}, { 0x405, -1, "pc105", "cz", NULL, NULL, "Czech"}, {0x10405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"}, { 0x406, -1, "pc105", "dk", NULL, NULL, "Danish"}, { 0x407, -1, "pc105", "de", NULL, NULL, "German (Germany)"}, {0x10407, -1, "pc105", "de", NULL, NULL, "German (Germany, IBM)"}, - { 0x807, -1, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"}, + { 0x807, -1, "pc105", "ch", "de", NULL, "German (Switzerland)"}, { 0x409, -1, "pc105", "us", NULL, NULL, "English (USA)"}, {0x10409, -1, "pc105", "dvorak", NULL, NULL, "English (USA, Dvorak)"}, {0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"}, { 0x809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"}, { 0x1809, -1, "pc105", "ie", NULL, NULL, "Irish"}, { 0x40a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"}, + { 0x80a, -1, "pc105", "latam", NULL, NULL, "Latin American"}, { 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"}, { 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"}, { 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"}, - { 0xc0c, -1, "pc105", "ca_enhanced", NULL, NULL, "French (Canada)"}, - { 0x100c, -1, "pc105", "fr_CH", NULL, NULL, "French (Switzerland)"}, + { 0xc0c, -1, "pc105", "ca", "fr", NULL, "French (Canada)"}, + { 0x100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"}, + { 0x40d, -1, "pc105", "il", NULL, NULL, "Hebrew"}, { 0x40e, -1, "pc105", "hu", NULL, NULL, "Hungarian"}, + { 0x40f, -1, "pc105", "is", NULL, NULL, "Icelandic"}, { 0x410, -1, "pc105", "it", NULL, NULL, "Italian"}, + {0x10410, -1, "pc105", "it", NULL, NULL, "Italian (142)"}, + {0xa0000410,-1, "macbook79","it", "mac",NULL, "Italiano (Apple)"}, { 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"}, + { 0x413, -1, "pc105", "nl", NULL, NULL, "Dutch"}, { 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"}, { 0x414, -1, "pc105", "no", NULL, NULL, "Norwegian"}, + { 0x415, -1, "pc105", "pl", NULL, NULL, "Polish (Programmers)"}, { 0x416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil, ABNT)"}, {0x10416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil, ABNT2)"}, { 0x816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"}, + { 0x41a, -1, "pc105", "hr", NULL, NULL, "Croatian"}, { 0x41d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"}, + { 0x424, -1, "pc105", "si", NULL, NULL, "Slovenian"}, + { 0x425, -1, "pc105", "ee", NULL, NULL, "Estonian"}, + { 0x452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"}, { -1, -1, NULL, NULL, NULL, NULL, NULL} }; diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index be2b66a08..b537d3213 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -38,6 +38,8 @@ #if defined(XFree86Server) #include "inputstr.h" +#include "exevents.h" /* for button/axes labels */ +#include "xserver-properties.h" /* Peek the internal button mapping */ static CARD8 const *g_winMouseButtonMap = NULL; @@ -70,6 +72,8 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) int lngWheelEvents = 2; CARD8 *map; DevicePtr pDevice = (DevicePtr) pDeviceInt; + Atom *btn_labels; + Atom axes_labels[2]; switch (iState) { @@ -97,14 +101,27 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) map[0] = 0; for (i=1; i <= lngMouseButtons + lngWheelEvents; i++) map[i] = i; + + btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom)); + btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); + btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); + btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); + btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); + btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); + + axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); + axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); + InitPointerDeviceStruct (pDevice, map, lngMouseButtons + lngWheelEvents, - GetMotionHistory, + btn_labels, winMouseCtrl, GetMotionHistorySize(), - 2); + 2, + axes_labels); free(map); + free(btn_labels); #if defined(XFree86Server) g_winMouseButtonMap = pDeviceInt->button->map; @@ -221,19 +238,25 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ) void winMouseButtonsSendEvent (int iEventType, int iButton) { - xEvent xCurrentEvent; + EventListPtr events; + int i, nevents; - /* Load an xEvent and enqueue the event */ - xCurrentEvent.u.u.type = iEventType; #if defined(XFree86Server) if (g_winMouseButtonMap) - xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton]; - else + iButton = g_winMouseButtonMap[iButton]; +#endif + + GetEventList(&events); + nevents = GetPointerEvents(events, g_pwinPointer, iEventType, iButton, + POINTER_RELATIVE, 0, 0, NULL); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinPointer, events[i].event); + +#if CYGDEBUG + ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n", + iEventType, iButton, nevents); #endif - xCurrentEvent.u.u.detail = iButton; - xCurrentEvent.u.keyButtonPointer.time - = g_c32LastInputEventTime = GetTickCount (); - mieqEnqueue (&xCurrentEvent); } @@ -339,3 +362,28 @@ winMouseButtonsHandle (ScreenPtr pScreen, return 0; } + +/** + * Enqueue a motion event. + * + * XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer) + * + */ +void winEnqueueMotion(int x, int y) +{ + miPointerSetPosition(g_pwinPointer, &x, &y); + + int i, nevents; + int valuators[2]; + + EventListPtr events; + GetEventList(&events); + + valuators[0] = x; + valuators[1] = y; + nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0, + POINTER_ABSOLUTE, 0, 2, valuators); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinPointer, events[i].event); +} diff --git a/xorg-server/hw/xwin/winms.h b/xorg-server/hw/xwin/winms.h index 1ad30dc0b..60f7eb906 100644 --- a/xorg-server/hw/xwin/winms.h +++ b/xorg-server/hw/xwin/winms.h @@ -35,6 +35,9 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif +#ifndef WINVER +#define WINVER 0x0500 +#endif #include <X11/Xwindows.h> #include <windowsx.h> diff --git a/xorg-server/hw/xwin/winmultiwindowclass.c b/xorg-server/hw/xwin/winmultiwindowclass.c index 5b47c3976..a5cf2120a 100644 --- a/xorg-server/hw/xwin/winmultiwindowclass.c +++ b/xorg-server/hw/xwin/winmultiwindowclass.c @@ -263,7 +263,7 @@ winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy) if (prop->propertyName == XA_WM_TRANSIENT_FOR) { if (ppDaddy) - memcpy (*ppDaddy, prop->data, sizeof (WindowPtr)); + memcpy (ppDaddy, prop->data, sizeof (WindowPtr)); return 1; } else diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c index fbc516cde..e16b2a3c8 100644 --- a/xorg-server/hw/xwin/winmultiwindowicons.c +++ b/xorg-server/hw/xwin/winmultiwindowicons.c @@ -36,6 +36,10 @@ #include "winmultiwindowclass.h" #include "winprefs.h" +#include "propertyst.h" + +#include "propertyst.h" +#include "windowstr.h" /* * External global variables @@ -66,7 +70,7 @@ winScaleXBitmapToWindows (int iconSize, { int row, column, effXBPP, effXDepth; unsigned char *outPtr; - unsigned char *iconData = 0; + char *iconData = 0; int stride, xStride; float factX, factY; int posX, posY; @@ -83,8 +87,8 @@ winScaleXBitmapToWindows (int iconSize, if (pixmap->drawable.depth == 15) effXDepth = 16; - /* Need 32-bit aligned rows */ - stride = ((iconSize * effBPP + 31) & (~31)) / 8; + /* Need 16-bit aligned rows for DDBitmaps */ + stride = ((iconSize * effBPP + 15) & (~15)) / 8; xStride = PixmapBytePad (pixmap->drawable.width, pixmap->drawable.depth); if (stride == 0 || xStride == 0) { @@ -126,7 +130,7 @@ winScaleXBitmapToWindows (int iconSize, posX = factX * column; posY = factY * row; - ptr = iconData + posY*xStride; + ptr = (unsigned char*) iconData + posY*xStride; if (effXBPP == 1) { ptr += posX / 8; @@ -187,10 +191,10 @@ winScaleXBitmapToWindows (int iconSize, switch (effBPP) { case 32: - *(outPtr++) = *(ptr++); // b - *(outPtr++) = *(ptr++); // g - *(outPtr++) = *(ptr++); // r - *(outPtr++) = 0; // resvd + *(outPtr++) = *(ptr++); /* b */ + *(outPtr++) = *(ptr++); /* g */ + *(outPtr++) = *(ptr++); /* r */ + *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; /* alpha */ break; case 24: *(outPtr++) = *(ptr++); @@ -231,7 +235,7 @@ winScaleXBitmapToWindows (int iconSize, *(outPtr++) = (color & 31) << 2; *(outPtr++) = ((color >> 5) & 31) << 2; *(outPtr++) = ((color >> 10) & 31) << 2; - *(outPtr++) = 0; // resvd + *(outPtr++) = 0; /* resvd */ break; case 24: *(outPtr++) = (color & 31) << 2; @@ -260,6 +264,144 @@ winScaleXBitmapToWindows (int iconSize, free (iconData); } +static HICON +NetWMToWinIconAlpha(uint32_t *icon) +{ + int width = icon[0]; + int height = icon[1]; + uint32_t *pixels = &icon[2]; + HICON result; + HDC hdc = GetDC(NULL); + uint32_t *DIB_pixels; + ICONINFO ii = {TRUE}; + BITMAPV4HEADER bmh = {sizeof(bmh)}; + + /* Define an ARGB pixel format used for Color+Alpha icons */ + bmh.bV4Width = width; + bmh.bV4Height = -height; /* Invert the image */ + bmh.bV4Planes = 1; + bmh.bV4BitCount = 32; + bmh.bV4V4Compression = BI_BITFIELDS; + bmh.bV4AlphaMask = 0xFF000000; + bmh.bV4RedMask = 0x00FF0000; + bmh.bV4GreenMask = 0x0000FF00; + bmh.bV4BlueMask = 0x000000FF; + + ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh, + DIB_RGB_COLORS, (void**)&DIB_pixels, NULL, 0); + ReleaseDC(NULL, hdc); + ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL); + memcpy(DIB_pixels, pixels, height*width*4); + + /* CreateIconIndirect() traditionally required DDBitmaps */ + /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */ + /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */ + result = CreateIconIndirect(&ii); + + DeleteObject(ii.hbmColor); + DeleteObject(ii.hbmMask); + + winDebug("NetWMToWinIconAlpha - %d x %d = %p\n", icon[0], icon[1], result); + return result; +} + +static HICON +NetWMToWinIconThreshold(uint32_t *icon) +{ + int width = icon[0]; + int height = icon[1]; + uint32_t *pixels = &icon[2]; + int row, col; + HICON result; + ICONINFO ii = {TRUE}; + + HDC hdc = GetDC(NULL); + HDC xorDC = CreateCompatibleDC(hdc); + HDC andDC = CreateCompatibleDC(hdc); + ii.hbmColor = CreateCompatibleBitmap(hdc, width, height); + ii.hbmMask = CreateCompatibleBitmap(hdc, width, height); + ReleaseDC(NULL, hdc); + SelectObject(xorDC, ii.hbmColor); + SelectObject(andDC, ii.hbmMask); + + for (row = 0; row < height; row++) { + for (col = 0; col < width; col++) { + if ((*pixels & 0xFF000000) > 31<<24) { /* 31 alpha threshold, i.e. opaque above, transparent below */ + SetPixelV(xorDC, col, row, RGB(((char*)pixels)[2], ((char*)pixels)[1], + ((char*)pixels)[0])); + SetPixelV(andDC, col, row, RGB(0, 0, 0)); /* black mask */ + } + else { + SetPixelV(xorDC, col, row, RGB(0, 0, 0)); + SetPixelV(andDC, col, row, RGB(255, 255, 255)); /* white mask */ + } + pixels++; + } + } + DeleteDC(xorDC); + DeleteDC(andDC); + + result = CreateIconIndirect(&ii); + + DeleteObject(ii.hbmColor); + DeleteObject(ii.hbmMask ); + + winDebug("NetWMToWinIconThreshold - %d x %d = %p\n", icon[0], icon[1], result); + return result; +} + +static HICON +NetWMToWinIcon(int bpp, uint32_t *icon) +{ + static Bool hasIconAlphaChannel = FALSE; + static BOOL versionChecked = FALSE; + + if (!versionChecked) + { + OSVERSIONINFOEX osvi = {0}; + ULONGLONG dwlConditionMask = 0; + + osvi.dwOSVersionInfoSize = sizeof (osvi); + osvi.dwMajorVersion = 5; + osvi.dwMinorVersion = 1; + + /* Windows versions later than XP have icon alpha channel suport, 2000 does not */ + VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); + hasIconAlphaChannel = VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask); + versionChecked = TRUE; + + ErrorF("OS has icon alpha channel support: %s\n", hasIconAlphaChannel ? "yes" : "no"); + } + + if (hasIconAlphaChannel && (bpp==32)) + return NetWMToWinIconAlpha(icon); + else + return NetWMToWinIconThreshold(icon); +} + +static pointer +GetWindowProp(WindowPtr pWin, Atom name, long int *size_return) +{ + struct _Window *pwin; + struct _Property *prop; + + if (!pWin || !name) { + ErrorF ("GetWindowProp - pWin or name was NULL\n"); + return 0; + } + pwin = (struct _Window*) pWin; + if (!pwin->optional) return NULL; + for (prop = (struct _Property *) pwin->optional->userProps; + prop; + prop=prop->next){ + if (prop->propertyName == name) { + *size_return=prop->size; + return prop->data; + } + } + return NULL; +} /* * Attempt to create a custom icon from the WM_HINTS bitmaps @@ -273,34 +415,68 @@ winXIconToHICON (WindowPtr pWin, int iconSize) PixmapPtr iconPtr; PixmapPtr maskPtr; int planes, bpp, effBPP, stride, maskStride, i; + int biggest_size = 0; HDC hDC; ICONINFO ii; WinXWMHints hints; - HICON hIcon; + HICON hIcon = NULL; + uint32_t *biggest_icon = NULL; - winMultiWindowGetWMHints (pWin, &hints); - if (!hints.icon_pixmap) return NULL; + /* Try to get _NET_WM_ICON icons first */ + static Atom _XA_NET_WM_ICON; + static int generation; + uint32_t *icon, *icon_data = NULL; + long int size=0; - iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP); - - if (!iconPtr) return NULL; - hDC = GetDC (GetDesktopWindow ()); planes = GetDeviceCaps (hDC, PLANES); bpp = GetDeviceCaps (hDC, BITSPIXEL); ReleaseDC (GetDesktopWindow (), hDC); + + if (generation != serverGeneration) { + generation = serverGeneration; + _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, TRUE); + } + + if (_XA_NET_WM_ICON) icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size); + if (icon_data) + { + for(icon = icon_data; + icon < &icon_data[size] && *icon; + icon = &icon[icon[0]*icon[1]+2]) + { + if (icon[0]==iconSize && icon[1]==iconSize) + return NetWMToWinIcon(bpp, icon); + /* Find the biggest icon and let Windows scale the size */ + else if (biggest_size < icon[0]) + { + biggest_icon = icon; + biggest_size = icon[0]; + } + } + if (biggest_icon) + return NetWMToWinIcon(bpp, biggest_icon); + } + winDebug("winXIconToHICON - pWin %x: no suitable NetIcon\n",(int)pWin, iconSize); + + winMultiWindowGetWMHints (pWin, &hints); + if (!hints.icon_pixmap) return NULL; + + iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP); + if (!iconPtr) return NULL; + /* 15 BPP is really 16BPP as far as we care */ if (bpp == 15) effBPP = 16; else effBPP = bpp; - /* Need 32-bit aligned rows */ - stride = ((iconSize * effBPP + 31) & (~31)) / 8; + /* Need 16-bit aligned rows for DDBitmaps */ + stride = ((iconSize * effBPP + 15) & (~15)) / 8; /* Mask is 1-bit deep */ - maskStride = ((iconSize * 1 + 31) & (~31)) / 8; + maskStride = ((iconSize * 1 + 15) & (~15)) / 8; image = malloc (stride * iconSize); imageMask = malloc (stride * iconSize); @@ -364,43 +540,37 @@ void winUpdateIcon (Window id) { WindowPtr pWin; - HICON hIcon, hiconOld; + HICON hIcon, hIconSmall=NULL, hIconOld; pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); if (!pWin) return; - hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); + winWindowPriv(pWin); + if (pWinPriv->hWnd) { + hIcon = winOverrideIcon ((unsigned long)pWin); + if (!hIcon) { + hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); + if (!hIcon) { + hIcon = g_hIconX; + hIconSmall = g_hSmallIconX; + } else { + /* Leave undefined if not found */ + hIconSmall = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); + } + } - if (!hIcon) - hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); + /* Set the large icon */ + hIconOld = (HICON) SendMessage (pWinPriv->hWnd, + WM_SETICON, ICON_BIG, (LPARAM) hIcon); - if (hIcon) - { - winWindowPriv(pWin); + /* Delete the icon if its not the default */ + winDestroyIcon(hIconOld); - if (pWinPriv->hWnd) - { - hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, - GCL_HICON, - (int) hIcon); - - /* Delete the icon if its not the default */ - winDestroyIcon(hiconOld); - } - } - - hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); - if (hIcon) - { - winWindowPriv(pWin); + /* Same for the small icon */ + hIconOld = (HICON) SendMessage (pWinPriv->hWnd, + WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); + winDestroyIcon(hIconOld); - if (pWinPriv->hWnd) - { - hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, - GCL_HICONSM, - (int) hIcon); - winDestroyIcon (hiconOld); - } - } + } } void winInitGlobalIcons (void) @@ -410,8 +580,8 @@ void winInitGlobalIcons (void) /* Load default X icon in case it's not ready yet */ if (!g_hIconX) { - g_hIconX = (HICON)winOverrideDefaultIcon(sm_cx); - g_hSmallIconX = (HICON)winOverrideDefaultIcon(sm_cxsm); + g_hIconX = winOverrideDefaultIcon(sm_cx); + g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm); } if (!g_hIconX) diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c index 62cddd0a1..44007027a 100644 --- a/xorg-server/hw/xwin/winmultiwindowshape.c +++ b/xorg-server/hw/xwin/winmultiwindowshape.c @@ -44,7 +44,6 @@ void winSetShapeMultiWindow (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 75bef9786..e2b5ed291 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -42,9 +44,9 @@ * External global variables */ -extern HWND g_hDlgDepthChange; - -extern void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon); +extern HICON g_hIconX; +extern HICON g_hSmallIconX; +extern HWND g_hDlgDepthChange; /* * Prototypes for local functions @@ -63,13 +65,6 @@ static void winFindWindow (pointer value, XID id, pointer cdata); /* - * Constant defines - */ - -#define MOUSE_POLLING_INTERVAL 500 - - -/* * Macros */ @@ -81,6 +76,35 @@ winFindWindow (pointer value, XID id, pointer cdata); #define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent)) +static +void winInitMultiWindowClass(void) +{ + static wATOM atomXWinClass=0; + WNDCLASSEX wcx; + + if (atomXWinClass==0) + { + /* Setup our window class */ + wcx.cbSize=sizeof(WNDCLASSEX); + wcx.style = CS_HREDRAW | CS_VREDRAW; + wcx.lpfnWndProc = winTopLevelWindowProc; + wcx.cbClsExtra = 0; + wcx.cbWndExtra = 0; + wcx.hInstance = g_hInstance; + wcx.hIcon = g_hIconX; + wcx.hCursor = 0; + wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); + wcx.lpszMenuName = NULL; + wcx.lpszClassName = WINDOW_CLASS_X; + wcx.hIconSm = g_hSmallIconX; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X); +#endif + + atomXWinClass = RegisterClassEx (&wcx); + } +} /* * CreateWindow - See Porting Layer Definition - p. 37 @@ -275,7 +299,6 @@ winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask) { Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG @@ -368,7 +391,6 @@ void winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG @@ -392,12 +414,13 @@ winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent) void winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) { +#if 0 WindowPtr pPrevWin; UINT uFlags; HWND hInsertAfter; HWND hWnd = NULL; +#endif ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG @@ -484,16 +507,15 @@ winCreateWindowsWindow (WindowPtr pWin) int iWidth; int iHeight; HWND hWnd; - WNDCLASSEX wc; + HWND hFore = NULL; winWindowPriv(pWin); HICON hIcon; HICON hIconSmall; -#define CLASS_NAME_LENGTH 512 - char pszClass[CLASS_NAME_LENGTH], pszWindowID[12]; - char *res_name, *res_class, *res_role; - static int s_iWindowID = 0; winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv; WinXSizeHints hints; + WindowPtr pDaddy; + + winInitMultiWindowClass(); #if CYGMULTIWINDOW_DEBUG ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin); @@ -516,70 +538,27 @@ winCreateWindowsWindow (WindowPtr pWin) iWidth = pWin->drawable.width; iHeight = pWin->drawable.height; - winSelectIcons(pWin, &hIcon, &hIconSmall); - - /* Set standard class name prefix so we can identify window easily */ - strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass)); - - if (winMultiWindowGetClassHint (pWin, &res_name, &res_class)) + if (winMultiWindowGetTransientFor (pWin, &pDaddy)) { - strncat (pszClass, "-", 1); - strncat (pszClass, res_name, CLASS_NAME_LENGTH - strlen (pszClass)); - strncat (pszClass, "-", 1); - strncat (pszClass, res_class, CLASS_NAME_LENGTH - strlen (pszClass)); - - /* Check if a window class is provided by the WM_WINDOW_ROLE property, - * if not use the WM_CLASS information. - * For further information see: - * http://tronche.com/gui/x/icccm/sec-5.html - */ - if (winMultiWindowGetWindowRole (pWin, &res_role) ) - { - strcat (pszClass, "-"); - strcat (pszClass, res_role); - free (res_role); - } - - free (res_name); - free (res_class); + if (pDaddy) + { + hFore = GetForegroundWindow(); + if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL; + } } - /* Add incrementing window ID to make unique class name */ - snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++); - pszWindowID[sizeof(pszWindowID)-1] = 0; - strcat (pszClass, pszWindowID); - -#if CYGMULTIWINDOW_DEBUG - ErrorF ("winCreateWindowsWindow - Creating class: %s\n", pszClass); -#endif - - /* Setup our window class */ - wc.cbSize = sizeof(wc); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = winTopLevelWindowProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = g_hInstance; - wc.hIcon = hIcon; - wc.hIconSm = hIconSmall; - wc.hCursor = 0; - wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = pszClass; - RegisterClassEx (&wc); - /* Create the window */ /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */ /* CW_USEDEFAULT, change back to popup after creation */ hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */ - pszClass, /* Class name */ + WINDOW_CLASS_X, /* Class name */ WINDOW_TITLE_X, /* Window name */ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, iX, /* Horizontal position */ iY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ - (HWND) NULL, /* No parent or owner window */ + hFore, /* Null or Parent window if transient*/ (HMENU) NULL, /* No menu */ GetModuleHandle (NULL), /* Instance handle */ pWin); /* ScreenPrivates */ @@ -588,23 +567,27 @@ winCreateWindowsWindow (WindowPtr pWin) ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n", (int) GetLastError ()); } + pWinPriv->hWnd = hWnd; + + /* Set application or .XWinrc defined Icons */ + winSelectIcons(pWin, &hIcon, &hIconSmall); + if (hIcon) SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); + if (hIconSmall) SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); /* Change style back to popup, already placed... */ - SetWindowLong (hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); SetWindowPos (hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); /* Make sure it gets the proper system menu for a WS_POPUP, too */ GetSystemMenu (hWnd, TRUE); - pWinPriv->hWnd = hWnd; - /* Cause any .XWinrc menus to be added in main WNDPROC */ PostMessage (hWnd, WM_INIT_SYS_MENU, 0, 0); - SetProp (pWinPriv->hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin)); + SetProp (hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin)); /* Flag that this Windows window handles its own activation */ - SetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0); + SetProp (hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0); /* Call engine-specific create window procedure */ (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin); @@ -621,11 +604,6 @@ winDestroyWindowsWindow (WindowPtr pWin) { MSG msg; winWindowPriv(pWin); - HICON hiconClass; - HICON hiconSmClass; - HMODULE hInstance; - int iReturn; - char pszClass[512]; BOOL oldstate = winInDestroyWindowsWindow; #if CYGMULTIWINDOW_DEBUG @@ -638,12 +616,6 @@ winDestroyWindowsWindow (WindowPtr pWin) winInDestroyWindowsWindow = TRUE; - /* Store the info we need to destroy after this window is gone */ - hInstance = (HINSTANCE) GetClassLong (pWinPriv->hWnd, GCL_HMODULE); - hiconClass = (HICON) GetClassLong (pWinPriv->hWnd, GCL_HICON); - hiconSmClass = (HICON) GetClassLong (pWinPriv->hWnd, GCL_HICONSM); - iReturn = GetClassName (pWinPriv->hWnd, pszClass, 512); - SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL); /* Destroy the Windows window */ DestroyWindow (pWinPriv->hWnd); @@ -660,22 +632,6 @@ winDestroyWindowsWindow (WindowPtr pWin) } } - /* Only if we were able to get the name */ - if (iReturn) - { -#if CYGMULTIWINDOW_DEBUG - ErrorF ("winDestroyWindowsWindow - Unregistering %s: ", pszClass); -#endif - iReturn = UnregisterClass (pszClass, hInstance); - -#if CYGMULTIWINDOW_DEBUG - ErrorF ("winDestroyWindowsWindow - %d Deleting Icon: ", iReturn); -#endif - - winDestroyIcon(hiconClass); - winDestroyIcon(hiconSmClass); - } - winInDestroyWindowsWindow = oldstate; #if CYGMULTIWINDOW_DEBUG @@ -854,7 +810,7 @@ winMinimizeWindow (Window id) ErrorF ("winMinimizeWindow\n"); #endif - pWin = LookupIDByType (id, RT_WINDOW); + pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); if (!pWin) { ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__); @@ -892,7 +848,6 @@ winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGWINDOWING_DEBUG @@ -912,7 +867,6 @@ winMoveWindowMultiWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGWINDOWING_DEBUG @@ -933,7 +887,6 @@ winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGWINDOWING_DEBUG diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 5401ecdee..18d9aedc2 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2009 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ *from the XFree86 Project. * * Authors: Kensuke Matsuzaki + * Colin Harrison */ /* X headers */ @@ -50,26 +52,28 @@ #include <X11/Xproto.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> - -/* Windows headers */ -#ifdef __CYGWIN__ -/* Fixups to prevent collisions between Windows and X headers */ -#define ATOM DWORD - -#include <windows.h> -#else -#include <Xwindows.h> -#endif +#include <X11/Xwindows.h> /* Local headers */ #include "objbase.h" #include "ddraw.h" #include "winwindow.h" +#include "winprefs.h" +#include "window.h" +#include "pixmapstr.h" +#include "windowstr.h" + #ifdef XWIN_MULTIWINDOWEXTWM -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> +#else +/* We need the native HWND atom for intWM, so for consistency use the + same name as extWM would if we were building with enabled... */ +#define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND" #endif extern void winDebug(const char *format, ...); +extern void winReshapeMultiWindow(WindowPtr pWin); +extern void winUpdateRgnMultiWindow(WindowPtr pWin); #ifndef CYGDEBUG #define CYGDEBUG NO @@ -191,6 +195,11 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction); static Bool CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen); +static void +winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle); + +void +winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle); /* * Local globals @@ -245,6 +254,12 @@ PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode) case WM_WM_MAP: ErrorF ("\tWM_WM_MAP\n"); break; + case WM_WM_MAP2: + ErrorF ("\tWM_WM_MAP2\n"); + break; + case WM_WM_MAP3: + ErrorF ("\tWM_WM_MAP3\n"); + break; case WM_WM_UNMAP: ErrorF ("\tWM_WM_UNMAP\n"); break; @@ -705,10 +720,42 @@ winMultiWindowWMProc (void *pArg) 1); UpdateName (pWMInfo, pNode->msg.iWindow); winUpdateIcon (pNode->msg.iWindow); -#if 0 - /* Handles the case where there are AOT windows above it in W32 */ - PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV); + break; + + case WM_WM_MAP2: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_MAP2\n"); #endif + XChangeProperty (pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmPrivMap, + XA_INTEGER,//pWMInfo->atmPrivMap, + 32, + PropModeReplace, + (unsigned char *) &(pNode->msg.hwndWindow), + 1); + break; + + case WM_WM_MAP3: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_MAP3\n"); +#endif + /* Put a note as to the HWND associated with this Window */ + XChangeProperty (pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmPrivMap, + XA_INTEGER,//pWMInfo->atmPrivMap, + 32, + PropModeReplace, + (unsigned char *) &(pNode->msg.hwndWindow), + 1); + UpdateName (pWMInfo, pNode->msg.iWindow); + winUpdateIcon (pNode->msg.iWindow); + { + HWND zstyle = HWND_NOTOPMOST; + winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle); + winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle); + } break; case WM_WM_UNMAP: @@ -803,6 +850,7 @@ winMultiWindowWMProc (void *pArg) #if CYGMULTIWINDOW_DEBUG ErrorF("-winMultiWindowWMProc ()\n"); #endif + return NULL; } @@ -1063,7 +1111,7 @@ winMultiWindowXMsgProc (void *pArg) XCloseDisplay (pProcArg->pDisplay); pthread_exit (NULL); - + return NULL; } @@ -1265,11 +1313,10 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay, "WM_DELETE_WINDOW", False); -#ifdef XWIN_MULTIWINDOWEXTWM + pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay, WINDOWSWM_NATIVE_HWND, False); -#endif if (1) { @@ -1364,7 +1411,9 @@ winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr) pErr->error_code, pszErrorMsg, sizeof (pszErrorMsg)); +#if CYGMULTIWINDOW_DEBUG ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg); +#endif return 0; } @@ -1433,8 +1482,187 @@ CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen) */ void -winDeinitMultiWindowWM () +winDeinitMultiWindowWM (void) { ErrorF ("winDeinitMultiWindowWM - Noting shutdown in progress\n"); g_shutdown = TRUE; } + +/* Windows window styles */ +#define HINT_NOFRAME (1l<<0) +#define HINT_BORDER (1L<<1) +#define HINT_SIZEBOX (1l<<2) +#define HINT_CAPTION (1l<<3) +/* These two are used on their own */ +#define HINT_MAX (1L<<0) +#define HINT_MIN (1L<<1) + +static void +winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle) +{ + static Atom windowState, motif_wm_hints, windowType; + static Atom hiddenState, fullscreenState, belowState, aboveState; + static Atom dockWindow; + static int generation; + Atom type, *pAtom = NULL; + int format; + unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0; + WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP); + + if (!hWnd) return; + if (!IsWindow (hWnd)) return; + + if (generation != serverGeneration) { + generation = serverGeneration; + windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False); + motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False); + windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False); + hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False); + fullscreenState = XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False); + belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False); + aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False); + dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False); + } + + if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L, + 1L, False, XA_ATOM, &type, &format, + &nitems, &left, (unsigned char **)&pAtom) == Success) + { + if (pAtom && nitems == 1) + { + if (*pAtom == hiddenState) maxmin |= HINT_MIN; + else if (*pAtom == fullscreenState) maxmin |= HINT_MAX; + if (*pAtom == belowState) *zstyle = HWND_BOTTOM; + else if (*pAtom == aboveState) *zstyle = HWND_TOPMOST; + } + if (pAtom) XFree(pAtom); + } + + nitems = left = 0; + MwmHints *mwm_hint = NULL; + if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L, + PropMwmHintsElements, False, motif_wm_hints, &type, &format, + &nitems, &left, (unsigned char **)&mwm_hint) == Success) + { + if (mwm_hint && nitems == PropMwmHintsElements && (mwm_hint->flags & MwmHintsDecorations)) + { + if (!mwm_hint->decorations) hint |= HINT_NOFRAME; + else if (!(mwm_hint->decorations & MwmDecorAll)) + { + if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER; + if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX; + if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION; + } + } + if (mwm_hint) XFree(mwm_hint); + } + + nitems = left = 0; + pAtom = NULL; + if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L, + 1L, False, XA_ATOM, &type, &format, + &nitems, &left, (unsigned char **)&pAtom) == Success) + { + if (pAtom && nitems == 1) + { + if (*pAtom == dockWindow) + { + hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */ + *zstyle = HWND_TOPMOST; + } + } + if (pAtom) XFree(pAtom); + } + + /* Apply Styles, overriding hint settings from above */ + style = winOverrideStyle((unsigned long)pWin); + if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST; + else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX; + else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN; + else if (style & STYLE_BOTTOM) *zstyle = HWND_BOTTOM; + + if (maxmin & HINT_MAX) SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); + else if (maxmin & HINT_MIN) SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + + if (style & STYLE_NOTITLE) + hint = (hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) | HINT_SIZEBOX; + else if (style & STYLE_OUTLINE) + hint = (hint & ~HINT_NOFRAME & ~HINT_SIZEBOX & ~HINT_CAPTION) | HINT_BORDER; + else if (style & STYLE_NOFRAME) + hint = (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME; + + style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ + if (!style) return; + if (!hint) /* All on, but no resize of children is allowed */ + style = style | WS_CAPTION | (GetParent(hWnd) ? 0 : WS_SIZEBOX); + else if (hint & HINT_NOFRAME); /* All off, so do nothing */ + else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) | + ((hint & HINT_SIZEBOX) ? (GetParent(hWnd) ? 0 : WS_SIZEBOX) : 0) | + ((hint & HINT_CAPTION) ? WS_CAPTION : 0); + SetWindowLongPtr (hWnd, GWL_STYLE, style); +} + +void +winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle) +{ + int iX, iY, iWidth, iHeight; + int iDx, iDy; + RECT rcNew; + WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP); + DrawablePtr pDraw = NULL; + + if (!pWin) return; + pDraw = &pWin->drawable; + if (!pDraw) return; + + /* Get the X and Y location of the X window */ + iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); + iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); + + /* Get the height and width of the X window */ + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Setup a rectangle with the X window position and size */ + SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight); + +#if 0 + ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n", + rcNew.left, rcNew.top, + rcNew.right, rcNew.bottom); +#endif + + AdjustWindowRectEx (&rcNew, GetWindowLongPtr (hWnd, GWL_STYLE), FALSE, WS_EX_APPWINDOW); + + /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */ + if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) + { + iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left; + rcNew.left += iDx; + rcNew.right += iDx; + } + + if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) + { + iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top; + rcNew.top += iDy; + rcNew.bottom += iDy; + } + +#if 0 + ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n", + rcNew.left, rcNew.top, + rcNew.right, rcNew.bottom); +#endif + + /* Position the Windows window */ + SetWindowPos (hWnd, *zstyle, rcNew.left, rcNew.top, + rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, + 0); + + if (reshape) + { + winReshapeMultiWindow(pWin); + winUpdateRgnMultiWindow(pWin); + } +} diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index 20ff9f7db..543a1652f 100644 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -49,6 +51,8 @@ extern Bool g_fKeyboardHookLL; extern Bool g_fSoftwareCursor; extern Bool g_fButton[3]; +extern void winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle); + /* * Local globals @@ -61,7 +65,6 @@ static UINT_PTR g_uipMousePollingTimerID = 0; * Constant defines */ -#define MOUSE_POLLING_INTERVAL 500 #define WIN_MULTIWINDOW_SHAPE YES @@ -206,6 +209,8 @@ ValidateSizing (HWND hwnd, WindowPtr pWin, WinXSizeHints sizeHints; RECT *rect; int iWidth, iHeight; + RECT rcClient, rcWindow; + int iBorderWidthX, iBorderWidthY; /* Invalid input checking */ if (pWin==NULL || lParam==0) @@ -227,19 +232,20 @@ ValidateSizing (HWND hwnd, WindowPtr pWin, iWidth = rect->right - rect->left; iHeight = rect->bottom - rect->top; - /* Now remove size of any borders */ - iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME); - iHeight -= (GetSystemMetrics(SM_CYCAPTION) - + 2 * GetSystemMetrics(SM_CYSIZEFRAME)); - + /* Now remove size of any borders and title bar */ + GetClientRect(hwnd, &rcClient); + GetWindowRect(hwnd, &rcWindow); + iBorderWidthX = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left); + iBorderWidthY = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top); + iWidth -= iBorderWidthX; + iHeight -= iBorderWidthY; /* Constrain the size to legal values */ ConstrainSize (sizeHints, &iWidth, &iHeight); - /* Add back the borders */ - iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); - iHeight += (GetSystemMetrics(SM_CYCAPTION) - + 2 * GetSystemMetrics(SM_CYSIZEFRAME)); + /* Add back the size of borders and title bar */ + iWidth += iBorderWidthX; + iHeight += iBorderWidthY; /* Adjust size according to where we're dragging from */ switch(wParam) { @@ -286,6 +292,20 @@ static void winRaiseWindow(WindowPtr pWin) } } +static +void winStartMousePolling(winPrivScreenPtr s_pScreenPriv) +{ + /* + * Timer to poll mouse position. This is needed to make + * programs like xeyes follow the mouse properly when the + * mouse pointer is outside of any X window. + */ + if (g_uipMousePollingTimerID == 0) + g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen, + WIN_POLLING_MOUSE_TIMER_ID, + MOUSE_POLLING_INTERVAL, + NULL); +} /* * winTopLevelWindowProc - Window procedure for all top-level Windows windows. @@ -403,6 +423,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message, SetWindowRgn (hwnd, hRgnWindow, TRUE); DeleteObject(hRgnWindow); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)XMING_SIGNATURE); + return 0; case WM_INIT_SYS_MENU: @@ -435,6 +457,14 @@ winTopLevelWindowProc (HWND hwnd, UINT message, HandleCustomWM_INITMENU ((unsigned long)hwnd, wParam); break; + case WM_ERASEBKGND: + /* + * Pretend that we did erase the background but we don't care, + * since we repaint the entire region anyhow + * This avoids some flickering when resizing. + */ + return TRUE; + case WM_PAINT: /* Only paint if our window handle is valid */ if (hwndScreen == NULL) @@ -495,8 +525,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message, break; /* Has the mouse pointer crossed screens? */ - if (s_pScreen != miPointerGetScreen(inputInfo.pointer)) - miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen, + if (s_pScreen != miPointerGetScreen(g_pwinPointer)) + miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen, ptMouse.x - s_pScreenInfo->dwXOffset, ptMouse.y - s_pScreenInfo->dwYOffset); @@ -535,9 +565,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset, - ptMouse.y - s_pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset, + ptMouse.y - s_pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: @@ -561,15 +591,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message, ShowCursor (TRUE); } - /* - * Timer to poll mouse events. This is needed to make - * programs like xeyes follow the mouse properly. - */ - if (g_uipMousePollingTimerID == 0) - g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen, - WIN_POLLING_MOUSE_TIMER_ID, - MOUSE_POLLING_INTERVAL, - NULL); + winStartMousePolling(s_pScreenPriv); + break; case WM_MOUSELEAVE: @@ -585,15 +608,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message, ShowCursor (TRUE); } - /* - * Timer to poll mouse events. This is needed to make - * programs like xeyes follow the mouse properly. - */ - if (g_uipMousePollingTimerID == 0) - g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen, - WIN_POLLING_MOUSE_TIMER_ID, - MOUSE_POLLING_INTERVAL, - NULL); + winStartMousePolling(s_pScreenPriv); + return 0; case WM_LBUTTONDBLCLK: @@ -601,12 +617,15 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[0] = TRUE; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); - + case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[0] = FALSE; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: @@ -614,47 +633,66 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[1] = TRUE; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); - + case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[1] = FALSE; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); - + case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[2] = TRUE; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); - + case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[2] = FALSE; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + case WM_XBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); case WM_MOUSEWHEEL: - - /* Pass the message to the root window */ - SendMessage (hwndScreen, message, wParam, lParam); - return 0; + if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT) + { + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, lParam); + return 0; + } + else break; case WM_SETFOCUS: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + { + /* Get the parent window for transient handling */ + HWND hParent = GetParent(hwnd); + if (hParent && IsIconic(hParent)) ShowWindow (hParent, SW_RESTORE); + } + winRestoreModeKeyStates (); /* Add the keyboard hook if possible */ @@ -668,6 +706,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message, /* Remove our keyboard hook if it is installed */ winRemoveKeyboardHookLL (); + if (!wParam) + /* Revert the X focus as well, but only if the Windows focus is going to another window */ + DeleteWindowFromAnyEvents(pWin, FALSE); return 0; case WM_SYSDEADCHAR: @@ -770,6 +811,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (!pWin || !pWin->overrideRedirect) /* for OOo menus */ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); } + /* Prevent the mouse wheel from stalling when another window is minimized */ + if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE && + (HWND)lParam != NULL && (HWND)lParam != (HWND)GetParent(hwnd)) + SetFocus(hwnd); return 0; case WM_ACTIVATEAPP: @@ -824,98 +869,57 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (!wParam) return 0; - /* Tell X to map the window */ - MapWindow (pWin, wClient(pWin)); - /* */ if (!pWin->overrideRedirect) { - DWORD dwExStyle; - DWORD dwStyle; - RECT rcNew; - int iDx, iDy; - /* Flag that this window needs to be made active when clicked */ SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); - /* Get the standard and extended window style information */ - dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE); - dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE); - - /* */ - if (dwExStyle != WS_EX_APPWINDOW) + if (!(GetWindowLongPtr (hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) { - /* Setup a rectangle with the X window position and size */ - SetRect (&rcNew, - pDraw->x, - pDraw->y, - pDraw->x + pDraw->width, - pDraw->y + pDraw->height); - -#if 0 - ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n", - rcNew.left, rcNew.top, - rcNew.right, rcNew.bottom); -#endif - - /* */ - AdjustWindowRectEx (&rcNew, - WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW, - FALSE, - WS_EX_APPWINDOW); - - /* Calculate position deltas */ - iDx = pDraw->x - rcNew.left; - iDy = pDraw->y - rcNew.top; - - /* Calculate new rectangle */ - rcNew.left += iDx; - rcNew.right += iDx; - rcNew.top += iDy; - rcNew.bottom += iDy; - -#if 0 - ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n", - rcNew.left, rcNew.top, - rcNew.right, rcNew.bottom); -#endif + HWND zstyle = HWND_NOTOPMOST; /* Set the window extended style flags */ SetWindowLongPtr (hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW); + /* Set the transient style flags */ + if (GetParent(hwnd)) SetWindowLongPtr (hwnd, GWL_STYLE, + WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); /* Set the window standard style flags */ - SetWindowLongPtr (hwnd, GWL_STYLE, - WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW); - - /* Position the Windows window */ - SetWindowPos (hwnd, HWND_TOP, - rcNew.left, rcNew.top, - rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, - SWP_NOMOVE | SWP_FRAMECHANGED - | SWP_SHOWWINDOW | SWP_NOACTIVATE); + else SetWindowLongPtr (hwnd, GWL_STYLE, + (WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) + & ~WS_CAPTION & ~WS_SIZEBOX); - /* Bring the Windows window to the foreground */ + winUpdateWindowPosition (hwnd, FALSE, &zstyle); SetForegroundWindow (hwnd); } + wmMsg.msg = WM_WM_MAP3; } else /* It is an overridden window so make it top of Z stack */ { #if CYGWINDOWING_DEBUG ErrorF ("overridden window is shown\n"); #endif - SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + HWND forHwnd = GetForegroundWindow(); + if (forHwnd != NULL) + { + if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR)XMING_SIGNATURE) + { + if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) + SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + else + SetWindowPos (hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + } + wmMsg.msg = WM_WM_MAP2; } - /* Setup the Window Manager message */ - wmMsg.msg = WM_WM_MAP; - wmMsg.iWidth = pDraw->width; - wmMsg.iHeight = pDraw->height; - /* Tell our Window Manager thread to map the window */ if (fWMMsgInitialized) winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + winStartMousePolling(s_pScreenPriv); + return 0; case WM_SIZING: diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c index 30e587d4a..d5bceb928 100644 --- a/xorg-server/hw/xwin/winprefs.c +++ b/xorg-server/hw/xwin/winprefs.c @@ -1,5 +1,6 @@ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -187,35 +189,28 @@ ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam) /* It's our baby, either clean or dirty it */ if (lParam==FALSE) { - hicon = (HICON)GetClassLong(hwnd, GCL_HICON); + /* Reset the window's icon to undefined. */ + hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0); - /* 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 the old icon is generated on-the-fly, get rid of it, will regen */ winDestroyIcon (hicon); - - hicon = (HICON)GetClassLong(hwnd, GCL_HICONSM); - - /* Unselect any icon in the class structure */ - SetClassLong (hwnd, GCL_HICONSM, 0); - /* If it's generated on-the-fly, get rid of it, will regen */ + /* Same for the small icon */ + hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0); winDestroyIcon (hicon); - - /* Remove any menu additions, use bRevert flag */ + + /* Remove any menu additions; bRevert=TRUE destroys any modified menus */ GetSystemMenu (hwnd, TRUE); - /* This window is now clean of our taint */ + /* This window is now clean of our taint (but with undefined icons) */ } else { - /* Make the icon default, dynamic, or from xwinrc */ - SetClassLong (hwnd, GCL_HICON, (LONG)g_hIconX); - SetClassLong (hwnd, GCL_HICONSM, (LONG)g_hSmallIconX); + /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */ wid = (Window)GetProp (hwnd, WIN_WID_PROP); if (wid) winUpdateIcon (wid); + /* Update the system menu for this window */ SetupSysMenu ((unsigned long)hwnd); @@ -239,8 +234,12 @@ ReloadPrefs (void) int i; #ifdef XWIN_MULTIWINDOW - /* First, iterate over all windows replacing their icon with system */ - /* default one and deleting any custom system menus */ + /* First, iterate over all windows, deleting their icons and custom menus. + * This is really only needed because winDestroyIcon() will try to + * destroy the old global icons, which will have changed. + * It is probably better to set a windows USER_DATA to flag locally defined + * icons, and use that to accurately know when to destroy old icons. + */ EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE); #endif @@ -314,7 +313,7 @@ HandleCustomWM_INITMENU(unsigned long hwndIn, if (!hwnd || !hmenu) return; - if (GetWindowLong (hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) + if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) dwExStyle = MF_BYCOMMAND | MF_CHECKED; else dwExStyle = MF_BYCOMMAND | MF_UNCHECKED; @@ -409,7 +408,7 @@ HandleCustomWM_COMMAND (unsigned long hwndIn, return FALSE; /* Get extended window style */ - dwExStyle = GetWindowLong (hwnd, GWL_EXSTYLE); + dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE); /* Handle topmost windows */ if (dwExStyle & WS_EX_TOPMOST) @@ -527,7 +526,7 @@ SetupRootMenu (unsigned long hmenuRoot) /* * Check for and return an overridden default ICON specified in the prefs */ -unsigned long +HICON winOverrideDefaultIcon(int size) { HICON hicon; @@ -539,7 +538,7 @@ winOverrideDefaultIcon(int size) ErrorF ("winOverrideDefaultIcon: LoadImageComma(%s) failed\n", pref.defaultIconName); - return (unsigned long)hicon; + return hicon; } return 0; @@ -549,7 +548,7 @@ winOverrideDefaultIcon(int size) /* * Return the HICON to use in the taskbar notification area */ -unsigned long +HICON winTaskbarIcon(void) { HICON hicon; @@ -573,7 +572,7 @@ winTaskbarIcon(void) GetSystemMetrics (SM_CYSMICON), 0); - return (unsigned long)hicon; + return hicon; } @@ -648,7 +647,7 @@ LoadImageComma (char *fname, int sx, int sy, int flags) * 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 +HICON winOverrideIcon (unsigned long longWin) { WindowPtr pWin = (WindowPtr) longWin; @@ -684,8 +683,8 @@ winOverrideIcon (unsigned long longWin) ErrorF ("winOverrideIcon: LoadImageComma(%s) failed\n", pref.icon[i].iconFile); - pref.icon[i].hicon = (unsigned long)hicon; - return (unsigned long)hicon; + pref.icon[i].hicon = hicon; + return hicon; } } @@ -728,7 +727,7 @@ winIconIsOverride(unsigned hiconIn) * Load it into prefs structure for use by other functions */ void -LoadPreferences () +LoadPreferences (void) { char *home; char fname[PATH_MAX+NAME_MAX+2]; @@ -820,3 +819,49 @@ LoadPreferences () } /* for all menus */ } + + +/* + * Check for a match of the window class to one specified in the + * STYLES{} section in the prefs file, and return the style type + */ +unsigned long +winOverrideStyle (unsigned long longpWin) +{ + WindowPtr pWin = (WindowPtr) longpWin; + char *res_name, *res_class; + int i; + char *wmName; + + if (pWin==NULL) + return STYLE_NONE; + + /* If we can't find the class, we can't override from default! */ + if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class)) + return STYLE_NONE; + + winMultiWindowGetWMName (pWin, &wmName); + + for (i=0; i<pref.styleItems; i++) { + if (!strcmp(pref.style[i].match, res_name) || + !strcmp(pref.style[i].match, res_class) || + (wmName && strstr(wmName, pref.style[i].match))) + { + free (res_name); + free (res_class); + if (wmName) + free (wmName); + + if (pref.style[i].type) + return pref.style[i].type; + } + } + + /* Didn't find the style, fail gracefully */ + free (res_name); + free (res_class); + if (wmName) + free (wmName); + + return STYLE_NONE; +} diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h index d9e09deea..6d641da6a 100644 --- a/xorg-server/hw/xwin/winprefs.h +++ b/xorg-server/hw/xwin/winprefs.h @@ -2,6 +2,7 @@ #define WINPREFS_H /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* Need Bool */ @@ -57,6 +59,15 @@ typedef enum MENUCOMMANDTYPE CMD_RELOAD /* Reparse the .XWINRC file */ } MENUCOMMANDTYPE; +#define STYLE_NONE (0L) /* Dummy the first entry */ +#define STYLE_NOTITLE (1L) /* Force window style no titlebar */ +#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */ +#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */ +#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */ +#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */ +#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */ +#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */ + /* Where to place a system menu */ typedef enum MENUPOSITION { @@ -94,9 +105,16 @@ 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 */ + HICON hicon; /* LoadImage() result */ } ICONITEM; +/* To redefine styles for certain window types */ +typedef struct STYLEITEM +{ + char match[MENU_MAX+1]; /* What string to search for? */ + unsigned long type; /* What should it do? */ +} STYLEITEM; + typedef struct WINPREFS { /* Menu information */ @@ -122,6 +140,9 @@ typedef struct WINPREFS ICONITEM *icon; int iconItems; + STYLEITEM *style; + int styleItems; + /* Silent exit flag */ Bool fSilentExit; @@ -151,12 +172,15 @@ HandleCustomWM_COMMAND (unsigned long hwndIn, int winIconIsOverride (unsigned hiconIn); -unsigned long +HICON winOverrideIcon (unsigned long longpWin); unsigned long +winOverrideStyle (unsigned long longpWin); + +HICON winTaskbarIcon(void); -unsigned long +HICON winOverrideDefaultIcon(int size); #endif diff --git a/xorg-server/hw/xwin/winprefslex.c b/xorg-server/hw/xwin/winprefslex.c index f75191886..83d7f8fa8 100644 --- a/xorg-server/hw/xwin/winprefslex.c +++ b/xorg-server/hw/xwin/winprefslex.c @@ -53,6 +53,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -83,8 +84,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -141,15 +140,7 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -381,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 25 -#define YY_END_OF_BUFFER 26 +#define YY_NUM_RULES 33 +#define YY_END_OF_BUFFER 34 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -390,23 +381,28 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[136] = +static yyconst flex_int16_t yy_accept[186] = { 0, - 0, 0, 26, 24, 4, 3, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 21, 22, 24, - 4, 24, 0, 24, 0, 1, 1, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 23, 23, 24, 0, 2, 2, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 15, 24, 5, 24, 24, - 24, 24, 24, 24, 24, 14, 24, 17, 24, 24, - 8, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 18, 24, 24, 24, 24, 24, 24, 13, 24, - - 24, 24, 24, 24, 11, 24, 24, 24, 24, 24, - 9, 24, 24, 19, 24, 24, 24, 24, 12, 24, - 24, 24, 24, 24, 20, 16, 7, 24, 24, 24, - 24, 24, 6, 10, 0 + 0, 0, 34, 32, 4, 3, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 29, 30, 32, 4, 32, 0, 32, 0, 1, 1, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 31, 31, 32, 0, 2, 2, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 23, 32, 32, 5, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + + 32, 22, 32, 32, 25, 32, 32, 8, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 13, 32, 32, 32, 32, 32, 32, + 32, 26, 32, 32, 32, 9, 32, 32, 32, 32, + 21, 32, 32, 32, 32, 16, 14, 15, 32, 32, + 32, 19, 10, 32, 32, 32, 32, 32, 11, 12, + 17, 32, 32, 27, 32, 32, 32, 32, 20, 32, + 32, 32, 32, 32, 28, 24, 7, 32, 32, 32, + 32, 32, 6, 18, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -419,12 +415,12 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 9, 10, 11, 12, 13, 14, 1, 15, 1, 1, 16, 17, 18, 19, 20, - 1, 21, 22, 23, 24, 1, 25, 26, 27, 1, - 1, 1, 1, 1, 1, 1, 28, 29, 30, 31, + 1, 21, 22, 23, 24, 1, 25, 26, 27, 28, + 1, 1, 1, 1, 1, 1, 29, 30, 31, 32, - 32, 33, 34, 1, 35, 1, 1, 36, 37, 38, - 39, 40, 1, 41, 42, 43, 44, 1, 45, 46, - 47, 1, 48, 1, 49, 1, 1, 1, 1, 1, + 33, 34, 35, 1, 36, 1, 1, 37, 38, 39, + 40, 41, 1, 42, 43, 44, 45, 1, 46, 47, + 48, 49, 50, 1, 51, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -441,144 +437,181 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[50] = +static yyconst flex_int32_t yy_meta[52] = { 0, 1, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 } ; -static yyconst flex_int16_t yy_base[143] = +static yyconst flex_int16_t yy_base[193] = { 0, - 0, 0, 267, 0, 264, 301, 48, 52, 258, 35, - 40, 31, 49, 48, 49, 55, 42, 0, 0, 0, - 74, 60, 64, 71, 81, 301, 88, 91, 41, 77, - 87, 85, 79, 83, 87, 85, 85, 90, 85, 100, - 0, 301, 108, 110, 301, 126, 107, 104, 108, 108, - 125, 124, 118, 113, 119, 116, 132, 129, 126, 117, - 118, 135, 139, 134, 125, 0, 151, 0, 142, 138, - 150, 154, 162, 161, 155, 0, 157, 0, 163, 165, - 0, 170, 171, 176, 162, 168, 177, 169, 166, 167, - 174, 0, 184, 188, 200, 189, 195, 198, 0, 202, - - 206, 195, 201, 195, 0, 205, 202, 216, 200, 218, - 0, 208, 215, 0, 216, 223, 229, 229, 0, 230, - 234, 238, 240, 239, 0, 0, 0, 247, 239, 243, - 236, 240, 0, 0, 301, 63, 284, 286, 289, 291, - 294, 297 + 0, 0, 373, 0, 370, 403, 50, 54, 363, 37, + 35, 47, 35, 52, 55, 45, 41, 54, 83, 50, + 0, 0, 0, 367, 74, 362, 97, 74, 403, 93, + 100, 43, 93, 49, 98, 96, 90, 86, 95, 96, + 124, 94, 102, 101, 101, 106, 96, 102, 105, 132, + 0, 403, 146, 148, 403, 150, 147, 138, 134, 136, + 136, 154, 153, 146, 150, 142, 152, 148, 155, 155, + 153, 150, 166, 163, 163, 165, 172, 170, 171, 188, + 193, 183, 190, 181, 0, 195, 190, 0, 191, 201, + 188, 197, 205, 197, 194, 198, 209, 212, 212, 224, + + 218, 0, 220, 226, 0, 228, 231, 0, 232, 233, + 232, 234, 233, 242, 242, 247, 233, 235, 240, 237, + 253, 247, 250, 0, 258, 261, 255, 257, 274, 276, + 277, 0, 272, 268, 280, 0, 269, 272, 277, 279, + 0, 283, 287, 288, 289, 0, 0, 0, 284, 296, + 297, 0, 0, 306, 302, 317, 301, 320, 0, 0, + 0, 310, 317, 0, 314, 315, 313, 314, 0, 315, + 319, 322, 324, 323, 0, 0, 0, 331, 326, 332, + 330, 341, 0, 0, 403, 365, 386, 388, 391, 393, + 396, 399 + } ; -static yyconst flex_int16_t yy_def[143] = +static yyconst flex_int16_t yy_def[193] = { 0, - 135, 1, 135, 136, 135, 135, 137, 138, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 135, 137, 139, 138, 140, 135, 140, 141, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 135, 141, 142, 135, 142, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 0, 135, 135, 135, 135, 135, - 135, 135 + 185, 1, 185, 186, 185, 185, 187, 188, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 185, 187, 189, 188, 190, 185, 190, + 191, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 185, 191, 192, 185, 192, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 0, 185, 185, 185, 185, 185, + 185, 185 + } ; -static yyconst flex_int16_t yy_nxt[351] = +static yyconst flex_int16_t yy_nxt[455] = { 0, - 4, 5, 6, 6, 7, 8, 9, 10, 4, 4, - 11, 12, 4, 4, 13, 4, 14, 4, 4, 4, - 15, 16, 17, 4, 4, 4, 4, 10, 4, 4, - 11, 12, 4, 4, 13, 4, 14, 4, 4, 4, - 15, 16, 17, 4, 4, 4, 4, 18, 19, 23, - 29, 31, 20, 25, 26, 27, 32, 30, 33, 34, - 35, 23, 40, 20, 41, 47, 37, 36, 42, 38, - 29, 31, 25, 26, 27, 21, 32, 30, 33, 34, - 35, 39, 40, 26, 27, 47, 37, 36, 48, 38, - 26, 27, 44, 45, 46, 50, 52, 53, 49, 51, - - 54, 39, 55, 56, 57, 58, 59, 60, 48, 44, - 45, 46, 45, 46, 61, 50, 52, 53, 49, 51, - 54, 62, 55, 56, 57, 58, 59, 60, 45, 46, - 63, 64, 65, 66, 61, 67, 68, 69, 70, 71, - 72, 62, 73, 74, 75, 76, 77, 78, 79, 82, - 63, 64, 65, 66, 83, 67, 68, 69, 70, 71, - 72, 80, 73, 74, 75, 76, 77, 78, 79, 82, - 84, 85, 81, 86, 83, 87, 88, 89, 90, 91, - 92, 80, 93, 94, 95, 96, 97, 98, 99, 100, - 84, 85, 81, 86, 101, 87, 88, 89, 90, 91, - - 92, 102, 93, 94, 95, 96, 97, 98, 99, 100, - 103, 104, 105, 106, 101, 107, 108, 110, 111, 112, - 113, 102, 114, 109, 115, 116, 117, 118, 119, 120, - 103, 104, 105, 106, 121, 107, 108, 110, 111, 112, - 113, 122, 114, 109, 115, 116, 117, 118, 119, 120, - 123, 124, 125, 126, 121, 127, 128, 129, 130, 131, - 132, 122, 133, 134, 28, 21, 135, 135, 135, 135, - 123, 124, 125, 126, 135, 127, 128, 129, 130, 131, - 132, 135, 133, 134, 22, 22, 24, 24, 24, 23, - 23, 25, 25, 25, 43, 43, 43, 44, 44, 44, - - 3, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135 + 4, 5, 6, 6, 7, 8, 9, 10, 11, 4, + 12, 13, 4, 4, 14, 4, 15, 16, 17, 4, + 18, 19, 20, 4, 4, 4, 4, 4, 10, 11, + 4, 12, 13, 4, 4, 14, 4, 15, 16, 17, + 4, 18, 19, 20, 4, 4, 4, 4, 4, 21, + 22, 26, 32, 34, 23, 28, 29, 30, 35, 33, + 36, 37, 38, 41, 42, 43, 39, 57, 49, 40, + 50, 60, 44, 32, 34, 26, 29, 30, 51, 35, + 33, 36, 37, 38, 41, 42, 43, 39, 57, 49, + 40, 50, 60, 44, 45, 29, 30, 46, 28, 29, + + 30, 54, 55, 56, 58, 47, 61, 63, 64, 48, + 62, 65, 66, 67, 59, 45, 70, 71, 46, 72, + 73, 74, 75, 76, 77, 58, 47, 61, 63, 64, + 48, 62, 65, 66, 67, 59, 68, 70, 71, 78, + 72, 73, 74, 75, 76, 77, 69, 54, 55, 56, + 55, 56, 55, 56, 79, 80, 81, 68, 82, 83, + 78, 84, 85, 86, 87, 88, 89, 69, 90, 91, + 92, 93, 94, 95, 96, 79, 80, 81, 97, 82, + 83, 98, 84, 85, 86, 87, 88, 89, 99, 90, + 91, 92, 93, 94, 95, 96, 100, 101, 102, 97, + + 103, 104, 98, 105, 106, 107, 109, 110, 111, 99, + 112, 113, 114, 115, 116, 117, 108, 100, 101, 102, + 118, 103, 104, 119, 105, 106, 107, 109, 110, 111, + 120, 112, 113, 114, 115, 116, 117, 108, 121, 122, + 123, 118, 124, 125, 119, 126, 127, 128, 129, 130, + 131, 120, 132, 133, 134, 135, 136, 137, 138, 121, + 122, 123, 139, 124, 125, 140, 126, 127, 128, 129, + 130, 131, 141, 132, 133, 134, 135, 136, 137, 138, + 142, 143, 144, 139, 145, 146, 140, 147, 148, 149, + 150, 151, 152, 141, 153, 154, 155, 156, 158, 159, + + 160, 142, 143, 144, 157, 145, 146, 161, 147, 148, + 149, 150, 151, 152, 162, 153, 154, 155, 156, 158, + 159, 160, 163, 164, 165, 157, 166, 167, 161, 168, + 169, 170, 171, 172, 173, 162, 174, 175, 176, 177, + 178, 179, 180, 163, 164, 165, 181, 166, 167, 182, + 168, 169, 170, 171, 172, 173, 183, 174, 175, 176, + 177, 178, 179, 180, 184, 23, 52, 181, 24, 31, + 182, 24, 185, 185, 185, 185, 185, 183, 185, 185, + 185, 185, 185, 185, 185, 184, 25, 25, 27, 27, + 27, 26, 26, 28, 28, 28, 53, 53, 53, 54, + + 54, 54, 3, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185 } ; -static yyconst flex_int16_t yy_chk[351] = +static yyconst flex_int16_t yy_chk[455] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, - 10, 11, 7, 8, 8, 8, 12, 10, 13, 14, - 15, 22, 17, 136, 22, 29, 16, 15, 23, 16, - 10, 11, 24, 24, 24, 21, 12, 10, 13, 14, - 15, 16, 17, 25, 25, 29, 16, 15, 30, 16, - 27, 27, 28, 28, 28, 31, 32, 33, 30, 31, - - 34, 16, 35, 36, 37, 38, 39, 40, 30, 43, - 43, 43, 44, 44, 47, 31, 32, 33, 30, 31, - 34, 48, 35, 36, 37, 38, 39, 40, 46, 46, - 49, 50, 51, 52, 47, 53, 54, 55, 56, 57, - 58, 48, 59, 60, 61, 62, 63, 64, 65, 69, - 49, 50, 51, 52, 70, 53, 54, 55, 56, 57, - 58, 67, 59, 60, 61, 62, 63, 64, 65, 69, - 71, 72, 67, 73, 70, 74, 75, 77, 79, 80, - 82, 67, 83, 84, 85, 86, 87, 88, 89, 90, - 71, 72, 67, 73, 91, 74, 75, 77, 79, 80, - - 82, 93, 83, 84, 85, 86, 87, 88, 89, 90, - 94, 95, 96, 97, 91, 98, 100, 101, 102, 103, - 104, 93, 106, 100, 107, 108, 109, 110, 112, 113, - 94, 95, 96, 97, 115, 98, 100, 101, 102, 103, - 104, 116, 106, 100, 107, 108, 109, 110, 112, 113, - 117, 118, 120, 121, 115, 122, 123, 124, 128, 129, - 130, 116, 131, 132, 9, 5, 3, 0, 0, 0, - 117, 118, 120, 121, 0, 122, 123, 124, 128, 129, - 130, 0, 131, 132, 137, 137, 138, 138, 138, 139, - 139, 140, 140, 140, 141, 141, 141, 142, 142, 142, - - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 7, 10, 11, 7, 8, 8, 8, 12, 10, + 13, 14, 15, 16, 17, 18, 15, 32, 20, 15, + 20, 34, 18, 10, 11, 25, 28, 28, 25, 12, + 10, 13, 14, 15, 16, 17, 18, 15, 32, 20, + 15, 20, 34, 18, 19, 30, 30, 19, 27, 27, + + 27, 31, 31, 31, 33, 19, 35, 36, 37, 19, + 35, 38, 39, 40, 33, 19, 42, 43, 19, 44, + 45, 46, 47, 48, 49, 33, 19, 35, 36, 37, + 19, 35, 38, 39, 40, 33, 41, 42, 43, 50, + 44, 45, 46, 47, 48, 49, 41, 53, 53, 53, + 54, 54, 56, 56, 57, 58, 59, 41, 60, 61, + 50, 62, 63, 64, 65, 66, 67, 41, 68, 69, + 70, 71, 72, 73, 74, 57, 58, 59, 75, 60, + 61, 76, 62, 63, 64, 65, 66, 67, 77, 68, + 69, 70, 71, 72, 73, 74, 78, 79, 80, 75, + + 81, 82, 76, 83, 84, 86, 87, 89, 90, 77, + 91, 92, 93, 94, 95, 96, 86, 78, 79, 80, + 97, 81, 82, 98, 83, 84, 86, 87, 89, 90, + 99, 91, 92, 93, 94, 95, 96, 86, 100, 101, + 103, 97, 104, 106, 98, 107, 109, 110, 111, 112, + 113, 99, 114, 115, 116, 117, 118, 119, 120, 100, + 101, 103, 121, 104, 106, 122, 107, 109, 110, 111, + 112, 113, 123, 114, 115, 116, 117, 118, 119, 120, + 125, 126, 127, 121, 128, 129, 122, 130, 131, 133, + 134, 135, 137, 123, 138, 139, 140, 142, 143, 144, + + 145, 125, 126, 127, 142, 128, 129, 149, 130, 131, + 133, 134, 135, 137, 150, 138, 139, 140, 142, 143, + 144, 145, 151, 154, 155, 142, 156, 157, 149, 158, + 162, 163, 165, 166, 167, 150, 168, 170, 171, 172, + 173, 174, 178, 151, 154, 155, 179, 156, 157, 180, + 158, 162, 163, 165, 166, 167, 181, 168, 170, 171, + 172, 173, 174, 178, 182, 186, 26, 179, 24, 9, + 180, 5, 3, 0, 0, 0, 0, 181, 0, 0, + 0, 0, 0, 0, 0, 182, 187, 187, 188, 188, + 188, 189, 189, 190, 190, 190, 191, 191, 191, 192, + + 192, 192, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[26] = +static yyconst flex_int32_t yy_rule_can_match_eol[34] = { 0, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -598,6 +631,7 @@ char *yytext; #line 2 "winprefslex.l" /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -624,6 +658,7 @@ char *yytext; * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* $XFree86: $ */ @@ -654,7 +689,7 @@ static char *makestr(char *str) return ptr; } -#line 658 "winprefslex.c" +#line 693 "winprefslex.c" #define INITIAL 0 @@ -735,12 +770,7 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -748,7 +778,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -759,7 +789,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -841,9 +871,9 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 64 "winprefslex.l" +#line 66 "winprefslex.l" -#line 847 "winprefslex.c" +#line 877 "winprefslex.c" if ( !(yy_init) ) { @@ -896,13 +926,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 136 ) + if ( yy_current_state >= 186 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 301 ); + while ( yy_base[yy_current_state] != 403 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -939,135 +969,175 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 65 "winprefslex.l" +#line 67 "winprefslex.l" { /* comment */ return NEWLINE; } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 66 "winprefslex.l" +#line 68 "winprefslex.l" { /* comment */ return NEWLINE; } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 67 "winprefslex.l" +#line 69 "winprefslex.l" { return NEWLINE; } YY_BREAK case 4: YY_RULE_SETUP -#line 68 "winprefslex.l" +#line 70 "winprefslex.l" { /* ignore whitespace */ } YY_BREAK case 5: YY_RULE_SETUP -#line 69 "winprefslex.l" +#line 71 "winprefslex.l" { return MENU; } YY_BREAK case 6: YY_RULE_SETUP -#line 70 "winprefslex.l" +#line 72 "winprefslex.l" { return ICONDIRECTORY; } YY_BREAK case 7: YY_RULE_SETUP -#line 71 "winprefslex.l" +#line 73 "winprefslex.l" { return DEFAULTICON; } YY_BREAK case 8: YY_RULE_SETUP -#line 72 "winprefslex.l" +#line 74 "winprefslex.l" { return ICONS; } YY_BREAK case 9: YY_RULE_SETUP -#line 73 "winprefslex.l" -{ return ROOTMENU; } +#line 75 "winprefslex.l" +{ return STYLES; } YY_BREAK case 10: YY_RULE_SETUP -#line 74 "winprefslex.l" -{ return DEFAULTSYSMENU; } +#line 76 "winprefslex.l" +{ return TOPMOST; } YY_BREAK case 11: YY_RULE_SETUP -#line 75 "winprefslex.l" -{ return SYSMENU; } +#line 77 "winprefslex.l" +{ return MAXIMIZE; } YY_BREAK case 12: YY_RULE_SETUP -#line 76 "winprefslex.l" -{ return SEPARATOR; } +#line 78 "winprefslex.l" +{ return MINIMIZE; } YY_BREAK case 13: YY_RULE_SETUP -#line 77 "winprefslex.l" -{ return ATSTART; } +#line 79 "winprefslex.l" +{ return BOTTOM; } YY_BREAK case 14: YY_RULE_SETUP -#line 78 "winprefslex.l" -{ return ATEND; } +#line 80 "winprefslex.l" +{ return NOTITLE; } YY_BREAK case 15: YY_RULE_SETUP -#line 79 "winprefslex.l" -{ return EXEC; } +#line 81 "winprefslex.l" +{ return OUTLINE; } YY_BREAK case 16: YY_RULE_SETUP -#line 80 "winprefslex.l" -{ return ALWAYSONTOP; } +#line 82 "winprefslex.l" +{ return NOFRAME; } YY_BREAK case 17: YY_RULE_SETUP -#line 81 "winprefslex.l" -{ return DEBUG; } +#line 83 "winprefslex.l" +{ return ROOTMENU; } YY_BREAK case 18: YY_RULE_SETUP -#line 82 "winprefslex.l" -{ return RELOAD; } +#line 84 "winprefslex.l" +{ return DEFAULTSYSMENU; } YY_BREAK case 19: YY_RULE_SETUP -#line 83 "winprefslex.l" -{ return TRAYICON; } +#line 85 "winprefslex.l" +{ return SYSMENU; } YY_BREAK case 20: YY_RULE_SETUP -#line 84 "winprefslex.l" -{ return SILENTEXIT; } +#line 86 "winprefslex.l" +{ return SEPARATOR; } YY_BREAK case 21: YY_RULE_SETUP -#line 85 "winprefslex.l" -{ return LB; } +#line 87 "winprefslex.l" +{ return ATSTART; } YY_BREAK case 22: YY_RULE_SETUP -#line 86 "winprefslex.l" -{ return RB; } +#line 88 "winprefslex.l" +{ return ATEND; } YY_BREAK case 23: YY_RULE_SETUP -#line 87 "winprefslex.l" +#line 89 "winprefslex.l" +{ return EXEC; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 90 "winprefslex.l" +{ return ALWAYSONTOP; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 91 "winprefslex.l" +{ return DEBUG; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 92 "winprefslex.l" +{ return RELOAD; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 93 "winprefslex.l" +{ return TRAYICON; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 94 "winprefslex.l" +{ return SILENTEXIT; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 95 "winprefslex.l" +{ return LB; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 96 "winprefslex.l" +{ return RB; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 97 "winprefslex.l" { yylval.sVal = makestr(yytext+1); \ yylval.sVal[strlen(yylval.sVal)-1] = 0; \ return STRING; } YY_BREAK -case 24: +case 32: YY_RULE_SETUP -#line 90 "winprefslex.l" +#line 100 "winprefslex.l" { yylval.sVal = makestr(yytext); \ return STRING; } YY_BREAK -case 25: +case 33: YY_RULE_SETUP -#line 92 "winprefslex.l" +#line 102 "winprefslex.l" ECHO; YY_BREAK -#line 1071 "winprefslex.c" +#line 1141 "winprefslex.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1359,7 +1429,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 136 ) + if ( yy_current_state >= 186 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1387,11 +1457,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 136 ) + if ( yy_current_state >= 186 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 135); + yy_is_jam = (yy_current_state == 185); return yy_is_jam ? 0 : yy_current_state; } @@ -1834,8 +1904,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2077,7 +2147,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 92 "winprefslex.l" +#line 102 "winprefslex.l" @@ -2085,7 +2155,7 @@ void yyfree (void * ptr ) * Run-of-the mill requirement for yacc */ int -yywrap () +yywrap (void) { return 1; } diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l index a4c1abc3d..9a384a2cd 100644 --- a/xorg-server/hw/xwin/winprefslex.l +++ b/xorg-server/hw/xwin/winprefslex.l @@ -1,6 +1,7 @@ %{ # -*- C -*- /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,6 +28,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* $XFree86: $ */ @@ -70,6 +72,14 @@ MENU { return MENU; } ICONDIRECTORY { return ICONDIRECTORY; } DEFAULTICON { return DEFAULTICON; } ICONS { return ICONS; } +STYLES { return STYLES; } +TOPMOST { return TOPMOST; } +MAXIMIZE { return MAXIMIZE; } +MINIMIZE { return MINIMIZE; } +BOTTOM { return BOTTOM; } +NOTITLE { return NOTITLE; } +OUTLINE { return OUTLINE; } +NOFRAME { return NOFRAME; } ROOTMENU { return ROOTMENU; } DEFAULTSYSMENU { return DEFAULTSYSMENU; } SYSMENU { return SYSMENU; } @@ -95,7 +105,7 @@ SILENTEXIT { return SILENTEXIT; } * Run-of-the mill requirement for yacc */ int -yywrap () +yywrap (void) { return 1; } diff --git a/xorg-server/hw/xwin/winprefsyacc.c b/xorg-server/hw/xwin/winprefsyacc.c index d92dfdd8b..1255887c3 100644 --- a/xorg-server/hw/xwin/winprefsyacc.c +++ b/xorg-server/hw/xwin/winprefsyacc.c @@ -72,6 +72,7 @@ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -98,6 +99,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* $XFree86: $ */ @@ -112,6 +114,10 @@ /* The following give better error messages in bison at the cost of a few KB */ #define YYERROR_VERBOSE 1 +/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ +#define YYLTYPE_IS_TRIVIAL 1 +#define YYENABLE_NLS 0 + /* The global pref settings */ WINPREFS pref; @@ -135,6 +141,10 @@ static void OpenIcons(void); static void AddIconLine(char *matchstr, char *iconfile); static void CloseIcons(void); +static void OpenStyles(void); +static void AddStyleLine(char *matchstr, unsigned long style); +static void CloseStyles(void); + static void OpenSysMenu(void); static void AddSysMenuLine(char *matchstr, char *menuname, int pos); static void CloseSysMenu(void); @@ -148,7 +158,7 @@ extern int yylex(void); /* Line 189 of yacc.c */ -#line 152 "winprefsyacc.c" +#line 162 "winprefsyacc.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -182,19 +192,27 @@ extern int yylex(void); ICONDIRECTORY = 262, DEFAULTICON = 263, ICONS = 264, - DEFAULTSYSMENU = 265, - SYSMENU = 266, - ROOTMENU = 267, - SEPARATOR = 268, - ATSTART = 269, - ATEND = 270, - EXEC = 271, - ALWAYSONTOP = 272, - DEBUG = 273, - RELOAD = 274, - TRAYICON = 275, - SILENTEXIT = 276, - STRING = 277 + STYLES = 265, + TOPMOST = 266, + MAXIMIZE = 267, + MINIMIZE = 268, + BOTTOM = 269, + NOTITLE = 270, + OUTLINE = 271, + NOFRAME = 272, + DEFAULTSYSMENU = 273, + SYSMENU = 274, + ROOTMENU = 275, + SEPARATOR = 276, + ATSTART = 277, + ATEND = 278, + EXEC = 279, + ALWAYSONTOP = 280, + DEBUG = 281, + RELOAD = 282, + TRAYICON = 283, + SILENTEXIT = 284, + STRING = 285 }; #endif /* Tokens. */ @@ -205,19 +223,27 @@ extern int yylex(void); #define ICONDIRECTORY 262 #define DEFAULTICON 263 #define ICONS 264 -#define DEFAULTSYSMENU 265 -#define SYSMENU 266 -#define ROOTMENU 267 -#define SEPARATOR 268 -#define ATSTART 269 -#define ATEND 270 -#define EXEC 271 -#define ALWAYSONTOP 272 -#define DEBUG 273 -#define RELOAD 274 -#define TRAYICON 275 -#define SILENTEXIT 276 -#define STRING 277 +#define STYLES 265 +#define TOPMOST 266 +#define MAXIMIZE 267 +#define MINIMIZE 268 +#define BOTTOM 269 +#define NOTITLE 270 +#define OUTLINE 271 +#define NOFRAME 272 +#define DEFAULTSYSMENU 273 +#define SYSMENU 274 +#define ROOTMENU 275 +#define SEPARATOR 276 +#define ATSTART 277 +#define ATEND 278 +#define EXEC 279 +#define ALWAYSONTOP 280 +#define DEBUG 281 +#define RELOAD 282 +#define TRAYICON 283 +#define SILENTEXIT 284 +#define STRING 285 @@ -227,15 +253,16 @@ typedef union YYSTYPE { /* Line 214 of yacc.c */ -#line 79 "winprefsyacc.y" +#line 89 "winprefsyacc.y" char *sVal; + unsigned long uVal; int iVal; /* Line 214 of yacc.c */ -#line 239 "winprefsyacc.c" +#line 266 "winprefsyacc.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -247,7 +274,7 @@ typedef union YYSTYPE /* Line 264 of yacc.c */ -#line 251 "winprefsyacc.c" +#line 278 "winprefsyacc.c" #ifdef short # undef short @@ -462,20 +489,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 68 +#define YYLAST 92 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 23 +#define YYNTOKENS 31 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 25 +#define YYNNTS 32 /* YYNRULES -- Number of rules. */ -#define YYNRULES 46 +#define YYNRULES 63 /* YYNRULES -- Number of states. */ -#define YYNSTATES 94 +#define YYNSTATES 118 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 277 +#define YYMAXUTOK 285 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -510,7 +537,8 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22 + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30 }; #if YYDEBUG @@ -519,40 +547,48 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 12, 15, 17, - 19, 21, 23, 25, 27, 29, 31, 33, 35, 39, - 43, 48, 52, 56, 60, 65, 71, 77, 82, 84, - 87, 88, 96, 101, 103, 106, 107, 114, 115, 117, - 119, 125, 127, 130, 131, 139, 142 + 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 41, 45, 50, 54, 58, 62, 67, 73, 79, 84, + 86, 89, 90, 98, 103, 105, 108, 109, 116, 118, + 120, 122, 124, 126, 128, 130, 132, 134, 137, 140, + 145, 147, 150, 151, 158, 159, 161, 163, 169, 171, + 174, 175, 183, 186 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 24, 0, -1, -1, 24, 25, -1, 3, -1, 27, - -1, -1, 3, 26, -1, 31, -1, 32, -1, 35, - -1, 39, -1, 44, -1, 29, -1, 30, -1, 47, - -1, 28, -1, 46, -1, 20, 22, 3, -1, 12, - 22, 3, -1, 10, 22, 41, 3, -1, 8, 22, - 3, -1, 7, 22, 3, -1, 13, 3, 26, -1, - 22, 17, 3, 26, -1, 22, 16, 22, 3, 26, - -1, 22, 4, 22, 3, 26, -1, 22, 19, 3, - 26, -1, 33, -1, 33, 34, -1, -1, 4, 22, - 5, 36, 26, 34, 6, -1, 22, 22, 3, 26, - -1, 37, -1, 37, 38, -1, -1, 9, 5, 40, - 26, 38, 6, -1, -1, 14, -1, 15, -1, 22, - 22, 41, 3, 26, -1, 42, -1, 42, 43, -1, - -1, 11, 5, 3, 45, 26, 43, 6, -1, 21, - 3, -1, 18, 22, 3, -1 + 32, 0, -1, -1, 32, 33, -1, 3, -1, 35, + -1, -1, 3, 34, -1, 39, -1, 40, -1, 43, + -1, 47, -1, 54, -1, 59, -1, 37, -1, 38, + -1, 62, -1, 36, -1, 61, -1, 28, 30, 3, + -1, 20, 30, 3, -1, 18, 30, 56, 3, -1, + 8, 30, 3, -1, 7, 30, 3, -1, 21, 3, + 34, -1, 30, 25, 3, 34, -1, 30, 24, 30, + 3, 34, -1, 30, 4, 30, 3, 34, -1, 30, + 27, 3, 34, -1, 41, -1, 41, 42, -1, -1, + 4, 30, 5, 44, 34, 42, 6, -1, 30, 30, + 3, 34, -1, 45, -1, 45, 46, -1, -1, 9, + 5, 48, 34, 46, 6, -1, 11, -1, 12, -1, + 13, -1, 14, -1, 15, -1, 16, -1, 17, -1, + 49, -1, 50, -1, 49, 50, -1, 50, 49, -1, + 30, 51, 3, 34, -1, 52, -1, 52, 53, -1, + -1, 10, 5, 55, 34, 53, 6, -1, -1, 22, + -1, 23, -1, 30, 30, 56, 3, 34, -1, 57, + -1, 57, 58, -1, -1, 19, 5, 3, 60, 34, + 58, 6, -1, 29, 3, -1, 26, 30, 3, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 93, 93, 94, 97, 98, 102, 103, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 118, 121, - 124, 127, 130, 133, 134, 135, 136, 137, 140, 141, - 144, 144, 147, 150, 151, 154, 154, 157, 158, 159, - 162, 165, 166, 169, 169, 172, 175 + 0, 108, 108, 109, 112, 113, 117, 118, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 134, + 137, 140, 143, 146, 149, 150, 151, 152, 153, 156, + 157, 160, 160, 163, 166, 167, 170, 170, 173, 174, + 175, 176, 179, 180, 181, 184, 185, 186, 187, 190, + 193, 194, 197, 197, 200, 201, 202, 205, 208, 209, + 212, 212, 215, 218 }; #endif @@ -562,13 +598,16 @@ static const yytype_uint8 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "NEWLINE", "MENU", "LB", "RB", - "ICONDIRECTORY", "DEFAULTICON", "ICONS", "DEFAULTSYSMENU", "SYSMENU", - "ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", "ALWAYSONTOP", - "DEBUG", "RELOAD", "TRAYICON", "SILENTEXIT", "STRING", "$accept", - "input", "line", "newline_or_nada", "command", "trayicon", "rootmenu", - "defaultsysmenu", "defaulticon", "icondirectory", "menuline", "menulist", - "menu", "$@1", "iconline", "iconlist", "icons", "$@2", "atspot", - "sysmenuline", "sysmenulist", "sysmenu", "$@3", "silentexit", "debug", 0 + "ICONDIRECTORY", "DEFAULTICON", "ICONS", "STYLES", "TOPMOST", "MAXIMIZE", + "MINIMIZE", "BOTTOM", "NOTITLE", "OUTLINE", "NOFRAME", "DEFAULTSYSMENU", + "SYSMENU", "ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", + "ALWAYSONTOP", "DEBUG", "RELOAD", "TRAYICON", "SILENTEXIT", "STRING", + "$accept", "input", "line", "newline_or_nada", "command", "trayicon", + "rootmenu", "defaultsysmenu", "defaulticon", "icondirectory", "menuline", + "menulist", "menu", "$@1", "iconline", "iconlist", "icons", "$@2", + "group1", "group2", "stylecombo", "styleline", "stylelist", "styles", + "$@3", "atspot", "sysmenuline", "sysmenulist", "sysmenu", "$@4", + "silentexit", "debug", 0 }; #endif @@ -579,28 +618,33 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277 + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 28, 29, - 30, 31, 32, 33, 33, 33, 33, 33, 34, 34, - 36, 35, 37, 38, 38, 40, 39, 41, 41, 41, - 42, 43, 43, 45, 44, 46, 47 + 0, 31, 32, 32, 33, 33, 34, 34, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, + 37, 38, 39, 40, 41, 41, 41, 41, 41, 42, + 42, 44, 43, 45, 46, 46, 48, 47, 49, 49, + 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, + 53, 53, 55, 54, 56, 56, 56, 57, 58, 58, + 60, 59, 61, 62 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 4, 3, 3, 3, 4, 5, 5, 4, 1, 2, - 0, 7, 4, 1, 2, 0, 6, 0, 1, 1, - 5, 1, 2, 0, 7, 2, 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 4, 3, 3, 3, 4, 5, 5, 4, 1, + 2, 0, 7, 4, 1, 2, 0, 6, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 2, 4, + 1, 2, 0, 6, 0, 1, 1, 5, 1, 2, + 0, 7, 2, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -609,48 +653,54 @@ static const yytype_uint8 yyr2[] = static const yytype_uint8 yydefact[] = { 2, 0, 1, 4, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 5, 16, 13, 14, 8, - 9, 10, 11, 12, 17, 15, 0, 0, 0, 35, - 37, 0, 0, 0, 0, 45, 30, 22, 21, 6, - 38, 39, 0, 43, 19, 46, 18, 6, 6, 0, - 20, 6, 0, 7, 0, 33, 0, 0, 0, 0, - 28, 0, 0, 34, 36, 0, 41, 0, 6, 0, - 0, 0, 0, 29, 31, 6, 37, 42, 44, 23, - 0, 0, 6, 6, 32, 0, 6, 6, 24, 27, - 6, 26, 25, 40 + 0, 0, 0, 0, 0, 3, 5, 17, 14, 15, + 8, 9, 10, 11, 12, 13, 18, 16, 0, 0, + 0, 36, 52, 54, 0, 0, 0, 0, 62, 31, + 23, 22, 6, 6, 55, 56, 0, 60, 20, 63, + 19, 6, 6, 0, 0, 21, 6, 0, 7, 0, + 34, 0, 0, 50, 0, 0, 0, 0, 29, 0, + 0, 35, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 0, 51, 53, 0, 58, 0, 6, 0, + 0, 0, 0, 30, 32, 6, 47, 48, 6, 54, + 59, 61, 24, 0, 0, 6, 6, 33, 49, 0, + 6, 6, 25, 28, 6, 27, 26, 57 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 14, 49, 15, 16, 17, 18, 19, 20, - 60, 61, 21, 47, 55, 56, 22, 39, 42, 66, - 67, 23, 51, 24, 25 + -1, 1, 15, 53, 16, 17, 18, 19, 20, 21, + 68, 69, 22, 51, 60, 61, 23, 42, 80, 81, + 82, 63, 64, 24, 43, 46, 86, 87, 25, 56, + 26, 27 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -48 +#define YYPACT_NINF -44 static const yytype_int8 yypact[] = { - -48, 2, -48, -48, -15, -3, 4, 22, 7, 25, - 9, 11, 12, 29, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, 32, 35, 38, -48, - 10, 39, 41, 42, 43, -48, -48, -48, -48, 44, - -48, -48, 45, -48, -48, -48, -48, 44, 44, 27, - -48, 44, -5, -48, 28, 27, 46, 31, 48, -1, - -5, 49, 51, -48, -48, 34, 31, 52, 44, 37, - 40, 54, 57, -48, -48, 44, 10, -48, -48, -48, - 58, 60, 44, 44, -48, 61, 44, 44, -48, -48, - 44, -48, -48, -48 + -44, 7, -44, -44, -28, -10, -7, 27, 29, 14, + 41, 18, 19, 20, 44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, 46, 50, + 51, -44, -44, -4, 53, 54, 55, 56, -44, -44, + -44, -44, 57, 57, -44, -44, 58, -44, -44, -44, + -44, 57, 57, 34, 35, -44, 57, -18, -44, 36, + 34, 63, 26, 35, 64, 42, 70, -3, -18, 68, + 72, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -11, 17, 73, -44, -44, 47, 42, 74, 57, 48, + 49, 78, 79, -44, -44, 57, -44, -44, 57, -4, + -44, -44, -44, 80, 81, 57, 57, -44, -44, 82, + 57, 57, -44, -44, 57, -44, -44, -44 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -48, -48, -48, -47, -48, -48, -48, -48, -48, -48, - -48, 5, -48, -48, -48, 13, -48, -48, -10, -48, - 1, -48, -48, -48, -48 + -44, -44, -44, -43, -44, -44, -44, -44, -44, -44, + -44, 21, -44, -44, -44, 28, -44, -44, 5, 10, + -44, -44, 24, -44, -44, -8, -44, 6, -44, -44, + -44, -44 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -660,40 +710,48 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 52, 53, 2, 69, 57, 3, 4, 26, 58, 5, - 6, 7, 8, 9, 10, 70, 71, 59, 72, 27, - 11, 79, 12, 13, 40, 41, 28, 29, 84, 30, - 31, 32, 35, 33, 34, 88, 89, 36, 37, 91, - 92, 38, 43, 93, 44, 45, 46, 48, 50, 54, - 62, 68, 64, 65, 75, 74, 76, 82, 78, 80, - 83, 86, 81, 87, 90, 73, 85, 77, 63 + 54, 89, 28, 66, 77, 78, 79, 2, 57, 58, + 3, 4, 67, 65, 5, 6, 7, 8, 44, 45, + 29, 90, 91, 30, 92, 9, 10, 11, 73, 74, + 75, 76, 31, 12, 32, 13, 14, 73, 74, 75, + 76, 77, 78, 79, 33, 102, 34, 38, 35, 36, + 37, 39, 107, 40, 41, 108, 47, 48, 49, 50, + 52, 55, 112, 113, 59, 62, 70, 115, 116, 72, + 84, 117, 85, 88, 94, 95, 98, 99, 103, 104, + 101, 105, 106, 110, 111, 114, 97, 83, 71, 93, + 96, 109, 100 }; static const yytype_uint8 yycheck[] = { - 47, 48, 0, 4, 51, 3, 4, 22, 13, 7, - 8, 9, 10, 11, 12, 16, 17, 22, 19, 22, - 18, 68, 20, 21, 14, 15, 22, 5, 75, 22, - 5, 22, 3, 22, 22, 82, 83, 5, 3, 86, - 87, 3, 3, 90, 3, 3, 3, 3, 3, 22, - 22, 3, 6, 22, 3, 6, 22, 3, 6, 22, - 3, 3, 22, 3, 3, 60, 76, 66, 55 + 43, 4, 30, 21, 15, 16, 17, 0, 51, 52, + 3, 4, 30, 56, 7, 8, 9, 10, 22, 23, + 30, 24, 25, 30, 27, 18, 19, 20, 11, 12, + 13, 14, 5, 26, 5, 28, 29, 11, 12, 13, + 14, 15, 16, 17, 30, 88, 5, 3, 30, 30, + 30, 5, 95, 3, 3, 98, 3, 3, 3, 3, + 3, 3, 105, 106, 30, 30, 30, 110, 111, 6, + 6, 114, 30, 3, 6, 3, 3, 30, 30, 30, + 6, 3, 3, 3, 3, 3, 81, 63, 60, 68, + 80, 99, 86 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 24, 0, 3, 4, 7, 8, 9, 10, 11, - 12, 18, 20, 21, 25, 27, 28, 29, 30, 31, - 32, 35, 39, 44, 46, 47, 22, 22, 22, 5, - 22, 5, 22, 22, 22, 3, 5, 3, 3, 40, - 14, 15, 41, 3, 3, 3, 3, 36, 3, 26, - 3, 45, 26, 26, 22, 37, 38, 26, 13, 22, - 33, 34, 22, 38, 6, 22, 42, 43, 3, 4, - 16, 17, 19, 34, 6, 3, 22, 43, 6, 26, - 22, 22, 3, 3, 26, 41, 3, 3, 26, 26, - 3, 26, 26, 26 + 0, 32, 0, 3, 4, 7, 8, 9, 10, 18, + 19, 20, 26, 28, 29, 33, 35, 36, 37, 38, + 39, 40, 43, 47, 54, 59, 61, 62, 30, 30, + 30, 5, 5, 30, 5, 30, 30, 30, 3, 5, + 3, 3, 48, 55, 22, 23, 56, 3, 3, 3, + 3, 44, 3, 34, 34, 3, 60, 34, 34, 30, + 45, 46, 30, 52, 53, 34, 21, 30, 41, 42, + 30, 46, 6, 11, 12, 13, 14, 15, 16, 17, + 49, 50, 51, 53, 6, 30, 57, 58, 3, 4, + 24, 25, 27, 42, 6, 3, 50, 49, 3, 30, + 58, 6, 34, 30, 30, 3, 3, 34, 34, 56, + 3, 3, 34, 34, 3, 34, 34, 34 }; #define yyerrok (yyerrstatus = 0) @@ -1504,171 +1562,269 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 18: + case 19: /* Line 1455 of yacc.c */ -#line 118 "winprefsyacc.y" +#line 134 "winprefsyacc.y" { SetTrayIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; - case 19: + case 20: /* Line 1455 of yacc.c */ -#line 121 "winprefsyacc.y" +#line 137 "winprefsyacc.y" { SetRootMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; - case 20: + case 21: /* Line 1455 of yacc.c */ -#line 124 "winprefsyacc.y" +#line 140 "winprefsyacc.y" { SetDefaultSysMenu((yyvsp[(2) - (4)].sVal), (yyvsp[(3) - (4)].iVal)); free((yyvsp[(2) - (4)].sVal)); } break; - case 21: + case 22: /* Line 1455 of yacc.c */ -#line 127 "winprefsyacc.y" +#line 143 "winprefsyacc.y" { SetDefaultIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; - case 22: + case 23: /* Line 1455 of yacc.c */ -#line 130 "winprefsyacc.y" +#line 146 "winprefsyacc.y" { SetIconDirectory((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; - case 23: + case 24: /* Line 1455 of yacc.c */ -#line 133 "winprefsyacc.y" +#line 149 "winprefsyacc.y" { AddMenuLine("-", CMD_SEPARATOR, ""); } break; - case 24: + case 25: /* Line 1455 of yacc.c */ -#line 134 "winprefsyacc.y" +#line 150 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_ALWAYSONTOP, ""); free((yyvsp[(1) - (4)].sVal)); } break; - case 25: + case 26: /* Line 1455 of yacc.c */ -#line 135 "winprefsyacc.y" +#line 151 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_EXEC, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); } break; - case 26: + case 27: /* Line 1455 of yacc.c */ -#line 136 "winprefsyacc.y" +#line 152 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_MENU, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); } break; - case 27: + case 28: /* Line 1455 of yacc.c */ -#line 137 "winprefsyacc.y" +#line 153 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_RELOAD, ""); free((yyvsp[(1) - (4)].sVal)); } break; - case 30: + case 31: /* Line 1455 of yacc.c */ -#line 144 "winprefsyacc.y" +#line 160 "winprefsyacc.y" { OpenMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; - case 31: + case 32: /* Line 1455 of yacc.c */ -#line 144 "winprefsyacc.y" +#line 160 "winprefsyacc.y" {CloseMenu();} break; - case 32: + case 33: /* Line 1455 of yacc.c */ -#line 147 "winprefsyacc.y" +#line 163 "winprefsyacc.y" { AddIconLine((yyvsp[(1) - (4)].sVal), (yyvsp[(2) - (4)].sVal)); free((yyvsp[(1) - (4)].sVal)); free((yyvsp[(2) - (4)].sVal)); } break; - case 35: + case 36: /* Line 1455 of yacc.c */ -#line 154 "winprefsyacc.y" +#line 170 "winprefsyacc.y" {OpenIcons();} break; - case 36: + case 37: /* Line 1455 of yacc.c */ -#line 154 "winprefsyacc.y" +#line 170 "winprefsyacc.y" {CloseIcons();} break; - case 37: + case 38: + +/* Line 1455 of yacc.c */ +#line 173 "winprefsyacc.y" + { (yyval.uVal)=STYLE_TOPMOST; } + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 174 "winprefsyacc.y" + { (yyval.uVal)=STYLE_MAXIMIZE; } + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 175 "winprefsyacc.y" + { (yyval.uVal)=STYLE_MINIMIZE; } + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 176 "winprefsyacc.y" + { (yyval.uVal)=STYLE_BOTTOM; } + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 179 "winprefsyacc.y" + { (yyval.uVal)=STYLE_NOTITLE; } + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 180 "winprefsyacc.y" + { (yyval.uVal)=STYLE_OUTLINE; } + break; + + case 44: /* Line 1455 of yacc.c */ -#line 157 "winprefsyacc.y" +#line 181 "winprefsyacc.y" + { (yyval.uVal)=STYLE_NOFRAME; } + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 184 "winprefsyacc.y" + { (yyval.uVal)=(yyvsp[(1) - (1)].uVal); } + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 185 "winprefsyacc.y" + { (yyval.uVal)=(yyvsp[(1) - (1)].uVal); } + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 186 "winprefsyacc.y" + { (yyval.uVal)=(yyvsp[(1) - (2)].uVal)|(yyvsp[(2) - (2)].uVal); } + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 187 "winprefsyacc.y" + { (yyval.uVal)=(yyvsp[(1) - (2)].uVal)|(yyvsp[(2) - (2)].uVal); } + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 190 "winprefsyacc.y" + { AddStyleLine((yyvsp[(1) - (4)].sVal), (yyvsp[(2) - (4)].uVal)); free((yyvsp[(1) - (4)].sVal)); } + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 197 "winprefsyacc.y" + {OpenStyles();} + break; + + case 53: + +/* Line 1455 of yacc.c */ +#line 197 "winprefsyacc.y" + {CloseStyles();} + break; + + case 54: + +/* Line 1455 of yacc.c */ +#line 200 "winprefsyacc.y" { (yyval.iVal)=AT_END; } break; - case 38: + case 55: /* Line 1455 of yacc.c */ -#line 158 "winprefsyacc.y" +#line 201 "winprefsyacc.y" { (yyval.iVal)=AT_START; } break; - case 39: + case 56: /* Line 1455 of yacc.c */ -#line 159 "winprefsyacc.y" +#line 202 "winprefsyacc.y" { (yyval.iVal)=AT_END; } break; - case 40: + case 57: /* Line 1455 of yacc.c */ -#line 162 "winprefsyacc.y" +#line 205 "winprefsyacc.y" { AddSysMenuLine((yyvsp[(1) - (5)].sVal), (yyvsp[(2) - (5)].sVal), (yyvsp[(3) - (5)].iVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(2) - (5)].sVal)); } break; - case 43: + case 60: /* Line 1455 of yacc.c */ -#line 169 "winprefsyacc.y" +#line 212 "winprefsyacc.y" {OpenSysMenu();} break; - case 44: + case 61: /* Line 1455 of yacc.c */ -#line 169 "winprefsyacc.y" +#line 212 "winprefsyacc.y" {CloseSysMenu();} break; - case 45: + case 62: /* Line 1455 of yacc.c */ -#line 172 "winprefsyacc.y" +#line 215 "winprefsyacc.y" { pref.fSilentExit = TRUE; } break; - case 46: + case 63: /* Line 1455 of yacc.c */ -#line 175 "winprefsyacc.y" +#line 218 "winprefsyacc.y" { ErrorF("LoadPreferences: %s\n", (yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; /* Line 1455 of yacc.c */ -#line 1672 "winprefsyacc.c" +#line 1828 "winprefsyacc.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1880,7 +2036,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 179 "winprefsyacc.y" +#line 222 "winprefsyacc.y" /* * Errors in parsing abort and print log messages @@ -2021,6 +2177,39 @@ CloseIcons (void) } static void +OpenStyles (void) +{ + if (pref.style != NULL) { + ErrorF("LoadPreferences: Redefining window style\n"); + free(pref.style); + pref.style = NULL; + } + pref.styleItems = 0; +} + +static void +AddStyleLine (char *matchstr, unsigned long style) +{ + if (pref.style==NULL) + pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + else + pref.style = (STYLEITEM*) + realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + + strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); + pref.style[pref.styleItems].match[MENU_MAX] = 0; + + pref.style[pref.styleItems].type = style; + + pref.styleItems++; +} + +static void +CloseStyles (void) +{ +} + +static void OpenSysMenu (void) { if (pref.sysMenu != NULL) { diff --git a/xorg-server/hw/xwin/winprefsyacc.h b/xorg-server/hw/xwin/winprefsyacc.h index 25f6e2ab5..a9e5d0c2b 100644 --- a/xorg-server/hw/xwin/winprefsyacc.h +++ b/xorg-server/hw/xwin/winprefsyacc.h @@ -46,19 +46,27 @@ ICONDIRECTORY = 262, DEFAULTICON = 263, ICONS = 264, - DEFAULTSYSMENU = 265, - SYSMENU = 266, - ROOTMENU = 267, - SEPARATOR = 268, - ATSTART = 269, - ATEND = 270, - EXEC = 271, - ALWAYSONTOP = 272, - DEBUG = 273, - RELOAD = 274, - TRAYICON = 275, - SILENTEXIT = 276, - STRING = 277 + STYLES = 265, + TOPMOST = 266, + MAXIMIZE = 267, + MINIMIZE = 268, + BOTTOM = 269, + NOTITLE = 270, + OUTLINE = 271, + NOFRAME = 272, + DEFAULTSYSMENU = 273, + SYSMENU = 274, + ROOTMENU = 275, + SEPARATOR = 276, + ATSTART = 277, + ATEND = 278, + EXEC = 279, + ALWAYSONTOP = 280, + DEBUG = 281, + RELOAD = 282, + TRAYICON = 283, + SILENTEXIT = 284, + STRING = 285 }; #endif /* Tokens. */ @@ -69,19 +77,27 @@ #define ICONDIRECTORY 262 #define DEFAULTICON 263 #define ICONS 264 -#define DEFAULTSYSMENU 265 -#define SYSMENU 266 -#define ROOTMENU 267 -#define SEPARATOR 268 -#define ATSTART 269 -#define ATEND 270 -#define EXEC 271 -#define ALWAYSONTOP 272 -#define DEBUG 273 -#define RELOAD 274 -#define TRAYICON 275 -#define SILENTEXIT 276 -#define STRING 277 +#define STYLES 265 +#define TOPMOST 266 +#define MAXIMIZE 267 +#define MINIMIZE 268 +#define BOTTOM 269 +#define NOTITLE 270 +#define OUTLINE 271 +#define NOFRAME 272 +#define DEFAULTSYSMENU 273 +#define SYSMENU 274 +#define ROOTMENU 275 +#define SEPARATOR 276 +#define ATSTART 277 +#define ATEND 278 +#define EXEC 279 +#define ALWAYSONTOP 280 +#define DEBUG 281 +#define RELOAD 282 +#define TRAYICON 283 +#define SILENTEXIT 284 +#define STRING 285 @@ -91,15 +107,16 @@ typedef union YYSTYPE { /* Line 1676 of yacc.c */ -#line 79 "winprefsyacc.y" +#line 89 "winprefsyacc.y" char *sVal; + unsigned long uVal; int iVal; /* Line 1676 of yacc.c */ -#line 103 "winprefsyacc.h" +#line 120 "winprefsyacc.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y index 2a54ff28f..0c2775192 100644 --- a/xorg-server/hw/xwin/winprefsyacc.y +++ b/xorg-server/hw/xwin/winprefsyacc.y @@ -1,6 +1,7 @@ %{ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,6 +28,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* $XFree86: $ */ @@ -41,6 +43,10 @@ /* The following give better error messages in bison at the cost of a few KB */ #define YYERROR_VERBOSE 1 +/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ +#define YYLTYPE_IS_TRIVIAL 1 +#define YYENABLE_NLS 0 + /* The global pref settings */ WINPREFS pref; @@ -64,6 +70,10 @@ static void OpenIcons(void); static void AddIconLine(char *matchstr, char *iconfile); static void CloseIcons(void); +static void OpenStyles(void); +static void AddStyleLine(char *matchstr, unsigned long style); +static void CloseStyles(void); + static void OpenSysMenu(void); static void AddSysMenuLine(char *matchstr, char *menuname, int pos); static void CloseSysMenu(void); @@ -78,14 +88,19 @@ extern int yylex(void); %union { char *sVal; + unsigned long uVal; int iVal; } -%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU +%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS STYLES +%token TOPMOST MAXIMIZE MINIMIZE BOTTOM NOTITLE OUTLINE NOFRAME DEFAULTSYSMENU %token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG %token RELOAD TRAYICON SILENTEXIT %token <sVal> STRING +%type <uVal> group1 +%type <uVal> group2 +%type <uVal> stylecombo %type <iVal> atspot %% @@ -107,6 +122,7 @@ command: defaulticon | icondirectory | menu | icons + | styles | sysmenu | rootmenu | defaultsysmenu @@ -154,6 +170,33 @@ iconlist: iconline icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();} ; +group1: TOPMOST { $$=STYLE_TOPMOST; } + | MAXIMIZE { $$=STYLE_MAXIMIZE; } + | MINIMIZE { $$=STYLE_MINIMIZE; } + | BOTTOM { $$=STYLE_BOTTOM; } + ; + +group2: NOTITLE { $$=STYLE_NOTITLE; } + | OUTLINE { $$=STYLE_OUTLINE; } + | NOFRAME { $$=STYLE_NOFRAME; } + ; + +stylecombo: group1 { $$=$1; } + | group2 { $$=$1; } + | group1 group2 { $$=$1|$2; } + | group2 group1 { $$=$1|$2; } + ; + +styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); } + ; + +stylelist: styleline + | styleline stylelist + ; + +styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();} + ; + atspot: { $$=AT_END; } | ATSTART { $$=AT_START; } | ATEND { $$=AT_END; } @@ -316,6 +359,39 @@ CloseIcons (void) } static void +OpenStyles (void) +{ + if (pref.style != NULL) { + ErrorF("LoadPreferences: Redefining window style\n"); + free(pref.style); + pref.style = NULL; + } + pref.styleItems = 0; +} + +static void +AddStyleLine (char *matchstr, unsigned long style) +{ + if (pref.style==NULL) + pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + else + pref.style = (STYLEITEM*) + realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + + strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); + pref.style[pref.styleItems].match[MENU_MAX] = 0; + + pref.style[pref.styleItems].type = style; + + pref.styleItems++; +} + +static void +CloseStyles (void) +{ +} + +static void OpenSysMenu (void) { if (pref.sysMenu != NULL) { diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 7139cbaab..f20598db9 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -31,9 +31,9 @@ from The Open Group. #endif #ifdef XVENDORNAME #define VENDOR_STRING XVENDORNAME -#define VERSION_STRING XORG_RELEASE #define VENDOR_CONTACT BUILDERADDR #endif +#include <../xfree86/common/xorgVersion.h> #include "win.h" #include "winconfig.h" #include "winprefs.h" @@ -1369,16 +1369,6 @@ ddxProcessArgument (int argc, char *argv[], int i) } #endif -#ifdef XKB - /* - * Look for the '-kb' argument - */ - if (IS_OPTION ("-kb")) - { - g_cmdline.noXkbExtension = TRUE; - return 0; /* Let DIX parse this again */ - } - if (IS_OPTION ("-xkbrules")) { CHECK_ARGS (1); @@ -1409,7 +1399,6 @@ ddxProcessArgument (int argc, char *argv[], int i) g_cmdline.xkbOptions = argv[++i]; return 2; } -#endif if (IS_OPTION ("-keyhook")) { @@ -1459,13 +1448,13 @@ winLogCommandLine (int argc, char *argv[]) for (i = 0, iCurrLen = 0; i < argc; ++i) if (argv[i]) { - /* Add a character for lines that overflow */ + /* Adds two characters for lines that overflow */ if ((strlen (argv[i]) < CHARS_PER_LINE && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) || strlen (argv[i]) > CHARS_PER_LINE) { iCurrLen = 0; - ++iSize; + iSize += 2; } /* Add space for item and trailing space */ @@ -1495,7 +1484,7 @@ winLogCommandLine (int argc, char *argv[]) iCurrLen = 0; /* Add line break if it fits */ - strncat (g_pszCommandLine, "\n", iSize - strlen (g_pszCommandLine)); + strncat (g_pszCommandLine, "\n ", iSize - strlen (g_pszCommandLine)); } strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine)); @@ -1525,7 +1514,7 @@ winLogVersionInfo (void) ErrorF ("Welcome to the XWin X Server\n"); ErrorF ("Vendor: %s\n", VENDOR_STRING); - ErrorF ("Release: %s\n\n", VERSION_STRING); + ErrorF ("Release: %d.%d.%d.%d (%d)\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); ErrorF ("Contact: %s\n\n", VENDOR_CONTACT); } diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index 512109500..eab0c6ccf 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -37,7 +37,6 @@ #endif #include "win.h" #include "winmsg.h" -#include "safeAlpha.h" #ifdef XWIN_MULTIWINDOWEXTWM @@ -245,6 +244,25 @@ winScreenInit (int index, return TRUE; } +static Bool +winCreateScreenResources(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + Bool result; + + result = pScreenPriv->pwinCreateScreenResources(pScreen); + + /* Now the screen bitmap has been wrapped in a pixmap, + add that to the Shadow framebuffer */ + if (!shadowAdd(pScreen, pScreen->devPrivate, + pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) + { + ErrorF ("winCreateScreenResources - shadowAdd () failed\n"); + return FALSE; + } + + return result; +} /* See Porting Layer Definition - p. 20 */ Bool @@ -360,22 +378,6 @@ winFinishScreenInitFB (int index, pScreen->blockData = pScreen; pScreen->wakeupData = pScreen; -#ifdef XWIN_MULTIWINDOWEXTWM - /* - * Setup acceleration for multi-window external window manager mode. - * To be compatible with the Damage extension, this must be done - * before calling miDCInitialize, which calls DamageSetup. - */ - if (pScreenInfo->fMWExtWM) - { - if (!RootlessAccelInit (pScreen)) - { - ErrorF ("winFinishScreenInitFB - RootlessAccelInit () failed\n"); - return FALSE; - } - } -#endif - #ifdef RENDER /* Render extension initialization, calls miPictureInit */ if (!fbPictureInit (pScreen, NULL, 0)) @@ -428,15 +430,18 @@ winFinishScreenInitFB (int index, ) { #if CYGDEBUG - winDebug ("winFinishScreenInitFB - Calling shadowInit ()\n"); + winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n"); #endif - if (!shadowInit (pScreen, - pScreenPriv->pwinShadowUpdate, - NULL)) + if (!shadowSetup(pScreen)) { - ErrorF ("winFinishScreenInitFB - shadowInit () failed\n"); + ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n"); return FALSE; } + + /* Wrap CreateScreenResources so we can add the screen pixmap + to the Shadow framebuffer after it's been created */ + pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = winCreateScreenResources; } #ifdef XWIN_MULTIWINDOWEXTWM diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c index a2c1dc9b0..833444177 100644 --- a/xorg-server/hw/xwin/winshaddd.c +++ b/xorg-server/hw/xwin/winshaddd.c @@ -42,7 +42,7 @@ */ extern HWND g_hDlgExit; - +extern char *g_pszLogFile; /* * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, @@ -361,7 +361,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen) { ErrorF ("winAllocateFBShadowDD - Changing video mode\n"); - /* Change the video mode to the mode requested */ + /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, pScreenInfo->dwWidth, pScreenInfo->dwHeight, @@ -373,7 +373,20 @@ winAllocateFBShadowDD (ScreenPtr pScreen) ErrorF ("winAllocateFBShadowDD - Could not set "\ "full screen display mode: %08x\n", (unsigned int) ddrval); - return FALSE; + ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n"); + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + 0, + 0); + if (FAILED(ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + return FALSE; + } } } else @@ -508,7 +521,7 @@ winShadowUpdateDD (ScreenPtr pScreen, { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); HRESULT ddrval = DD_OK; RECT rcDest, rcSrc; POINT ptOrigin; @@ -534,7 +547,7 @@ winShadowUpdateDD (ScreenPtr pScreen, ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); if (FAILED (ddrval)) { - ErrorF ("winShadowUpdateProcDD - Unlock failed\n"); + ErrorF ("winShadowUpdateDD - Unlock failed\n"); return; } @@ -626,19 +639,19 @@ winShadowUpdateDD (ScreenPtr pScreen, NULL); if (FAILED (ddrval)) { - ErrorF ("winShadowUpdateProcDD - Lock failed\n"); + ErrorF ("winShadowUpdateDD - Lock failed\n"); return; } /* Has our memory pointer changed? */ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) { - ErrorF ("winShadowUpdateProcDD - Memory location of the shadow " + ErrorF ("winShadowUpdateDD - Memory location of the shadow " "surface has changed, trying to update the root window " "pixmap header to point to the new address. If you get " "this message and "PROJECT_NAME" freezes or crashes " "after this message then send a problem report and your " - "/tmp/XWin.log file to cygwin-xfree@cygwin.com\n"); + "%s file to " BUILDERADDR, g_pszLogFile); /* Location of shadow framebuffer has changed */ pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; @@ -653,7 +666,7 @@ winShadowUpdateDD (ScreenPtr pScreen, pScreenInfo->dwBPP), pScreenInfo->pfb)) { - ErrorF ("winShadowUpdateProcDD - Bits changed, could not " + ErrorF ("winShadowUpdateDD - Bits changed, could not " "notify fb.\n"); return; } diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c index 47cc382e9..ef5c21469 100644 --- a/xorg-server/hw/xwin/winshadddnl.c +++ b/xorg-server/hw/xwin/winshadddnl.c @@ -391,7 +391,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) { winDebug ("winAllocateFBShadowDDNL - Changing video mode\n"); - /* Change the video mode to the mode requested */ + /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, pScreenInfo->dwWidth, pScreenInfo->dwHeight, @@ -403,7 +403,20 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) ErrorF ("winAllocateFBShadowDDNL - Could not set " "full screen display mode: %08x\n", (unsigned int) ddrval); - return FALSE; + ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n"); + ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + 0, + 0); + if (FAILED(ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + return FALSE; + } } } else @@ -584,7 +597,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen, { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); HRESULT ddrval = DD_OK; RECT rcDest, rcSrc; POINT ptOrigin; @@ -1310,7 +1323,7 @@ winStoreColorsShadowDDNL (ColormapPtr pColormap, + pdefs[0].pixel); if (FAILED (ddrval)) { - ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", ddrval); + ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (unsigned int) ddrval); return FALSE; } diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c index 04cc2f716..d38e4f76b 100644 --- a/xorg-server/hw/xwin/winshadgdi.c +++ b/xorg-server/hw/xwin/winshadgdi.c @@ -498,7 +498,7 @@ winShadowUpdateGDI (ScreenPtr pScreen, { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); DWORD dwBox = REGION_NUM_RECTS (damage); BoxPtr pBox = REGION_RECTS (damage); int x, y, w, h; diff --git a/xorg-server/hw/xwin/wintrayicon.c b/xorg-server/hw/xwin/wintrayicon.c index 054a8e956..895b47caf 100644 --- a/xorg-server/hw/xwin/wintrayicon.c +++ b/xorg-server/hw/xwin/wintrayicon.c @@ -51,7 +51,7 @@ winInitNotifyIcon (winPrivScreenPtr pScreenPriv) nid.uID = pScreenInfo->dwScreen; nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage = WM_TRAYICON; - nid.hIcon = (HICON)winTaskbarIcon (); + nid.hIcon = winTaskbarIcon (); /* Save handle to the icon so it can be freed later */ pScreenPriv->hiconNotifyIcon = nid.hIcon; @@ -59,7 +59,7 @@ winInitNotifyIcon (winPrivScreenPtr pScreenPriv) /* Set display and screen-specific tooltip text */ snprintf (nid.szTip, sizeof (nid.szTip), - PROJECT_NAME " Server - %s:%d", + PROJECT_NAME " Server:%s.%d", display, (int) pScreenInfo->dwScreen); diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index 6f4e2c97e..c225a4495 100644 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -38,7 +38,7 @@ #include "win.h" #include <winuser.h> #define _WINDOWSWM_SERVER_ -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> #include "dixevents.h" #include "winmultiwindowclass.h" #include "winprefs.h" @@ -49,11 +49,15 @@ * Constant defines */ -#define MOUSE_POLLING_INTERVAL 500 - +#ifndef ULW_COLORKEY #define ULW_COLORKEY 0x00000001 +#endif +#ifndef ULW_ALPHA #define ULW_ALPHA 0x00000002 +#endif +#ifndef ULW_OPAQUE #define ULW_OPAQUE 0x00000004 +#endif #define AC_SRC_ALPHA 0x01 /* @@ -70,9 +74,6 @@ winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame); Bool g_fNoConfigureWindow = FALSE; - -extern void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon); - /* * Internal function to get the DIB format that is compatible with the screen * Fixme: Share code with winshadgdi.c @@ -397,9 +398,9 @@ winMWExtWMDestroyFrame (RootlessFrameID wid) #endif /* Store the info we need to destroy after this window is gone */ - hInstance = (HINSTANCE) GetClassLong (pRLWinPriv->hWnd, GCL_HMODULE); - hiconClass = (HICON) GetClassLong (pRLWinPriv->hWnd, GCL_HICON); - hiconSmClass = (HICON) GetClassLong (pRLWinPriv->hWnd, GCL_HICONSM); + hInstance = (HINSTANCE) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HMODULE); + hiconClass = (HICON) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HICON); + hiconSmClass = (HICON) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HICONSM); iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH); pRLWinPriv->fClose = TRUE; diff --git a/xorg-server/hw/xwin/winwin32rootlesswindow.c b/xorg-server/hw/xwin/winwin32rootlesswindow.c index dedcd7a76..2b2f63010 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswindow.c +++ b/xorg-server/hw/xwin/winwin32rootlesswindow.c @@ -165,7 +165,7 @@ winMWExtWMUpdateIcon (Window id) HICON hIcon, hiconOld; pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); - hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); + hIcon = winOverrideIcon ((unsigned long)pWin); if (!hIcon) hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); @@ -177,12 +177,12 @@ winMWExtWMUpdateIcon (Window id) if (pRLWinPriv->hWnd) { - hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd, - GCL_HICON, - (int) hIcon); - + + hiconOld = (HICON) SendMessage (pRLWinPriv->hWnd, + WM_SETICON, ICON_BIG, (LPARAM) hIcon); winDestroyIcon(hiconOld); } + hIcon=NULL; } } diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c index 32db6621b..4d7afee42 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c +++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c @@ -35,7 +35,7 @@ #include "win.h" #include <winuser.h> #define _WINDOWSWM_SERVER_ -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> #include "dixevents.h" #include "propertyst.h" #include <X11/Xatom.h> @@ -48,7 +48,6 @@ * Constant defines */ -#define MOUSE_POLLING_INTERVAL 500 #define MOUSE_ACTIVATE_DEFAULT TRUE #define RAISE_ON_CLICK_DEFAULT FALSE @@ -571,9 +570,9 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (ptMouse.x - pScreenInfo->dwXOffset, - ptMouse.y - pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset, + ptMouse.y - pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: @@ -784,6 +783,17 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, SendMessage (hwndScreen, message, wParam, lParam); return 0; + case WM_ERASEBKGND: +#if CYGDEBUG + winDebug ("winMWExtWMWindowProc - WM_ERASEBKGND\n"); +#endif + /* + * Pretend that we did erase the background but we don't care, + * since we repaint the entire region anyhow + * This avoids some flickering when resizing. + */ + return TRUE; + case WM_PAINT: /* BeginPaint gives us an hdc that clips to the invalidated region */ diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index 285a344f7..0e75a2c6a 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -350,7 +350,6 @@ winPositionWindowRootless (WindowPtr pWin, int x, int y) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); @@ -376,7 +375,6 @@ winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG @@ -434,7 +432,6 @@ winMapWindowRootless (WindowPtr pWin) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG @@ -457,7 +454,6 @@ void winSetShapeRootless (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index 9c49d6482..86c094334 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -2,6 +2,7 @@ #define _WINWINDOW_H_ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2009 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ *from the XFree86 Project. * * Authors: Kensuke Matsuzaki + * Colin Harrison */ #ifndef NO @@ -42,8 +44,8 @@ # define PROJECT_NAME "Cygwin/X" #endif #define WINDOW_CLASS "cygwin/x" -#define WINDOW_TITLE PROJECT_NAME " - %s:%d" -#define WINDOW_TITLE_XDMCP PROJECT_NAME " - %s" +#define WINDOW_TITLE PROJECT_NAME ":%s.%d" +#define WINDOW_TITLE_XDMCP "%s:%s.%d" #define WIN_SCR_PROP "cyg_screen_prop rl" #define WINDOW_CLASS_X "cygwin/x X rl" #define WINDOW_TITLE_X PROJECT_NAME " X" @@ -60,6 +62,8 @@ #define CYGWINDOWING_DEBUG NO #endif +#define XMING_SIGNATURE 0x12345678L + typedef struct _winPrivScreenRec *winPrivScreenPtr; @@ -111,9 +115,25 @@ typedef struct _winWMMessageRec{ #define WM_WM_NAME_EVENT (WM_USER + 9) #define WM_WM_HINTS_EVENT (WM_USER + 10) #define WM_WM_CHANGE_STATE (WM_USER + 11) +#define WM_WM_MAP2 (WM_USER + 12) +#define WM_WM_MAP3 (WM_USER + 13) #define WM_MANAGE (WM_USER + 100) #define WM_UNMANAGE (WM_USER + 102) +#define MwmHintsDecorations (1L << 1) + +#define MwmDecorAll (1l << 0) +#define MwmDecorBorder (1l << 1) +#define MwmDecorHandle (1l << 2) +#define MwmDecorTitle (1l << 3) + +/* This structure only contains 3 elements... the Motif 2.0 structure +contains 5... we only need the first 3... so that is all we will define */ +typedef struct MwmHints { + unsigned long flags, functions, decorations; +} MwmHints; +#define PropMwmHintsElements 3 + void winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg); diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index 28bcb64c8..61972c932 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -31,8 +31,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include "win.h" -#define NEED_REPLIES -#define NEED_EVENTS #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -42,7 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "servermd.h" #include "swaprep.h" #define _WINDOWSWM_SERVER_ -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> static int WMErrorBase; @@ -52,7 +50,7 @@ static DISPATCH_PROC(SProcWindowsWMDispatch); static unsigned char WMReqCode = 0; static int WMEventBase = 0; -static RESTYPE ClientType, EventType; /* resource types for event masks */ +static RESTYPE ClientType, eventResourceType; /* resource types for event masks */ static XID eventResource; /* Currently selected events */ @@ -87,10 +85,10 @@ winWindowsWMExtensionInit () ExtensionEntry* extEntry; ClientType = CreateNewResourceType(WMFreeClient); - EventType = CreateNewResourceType(WMFreeEvents); + eventResourceType = CreateNewResourceType(WMFreeEvents); eventResource = FakeClientID(0); - if (ClientType && EventType && + if (ClientType && eventResourceType && (extEntry = AddExtension(WINDOWSWMNAME, WindowsWMNumberEvents, WindowsWMNumberErrors, @@ -149,7 +147,7 @@ WMFreeClient (pointer data, XID id) WMEventPtr *pHead, pCur, pPrev; pEvent = (WMEventPtr) data; - pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); + pHead = (WMEventPtr *) LookupIDByType(eventResource, eventResourceType); if (pHead) { pPrev = 0; @@ -195,7 +193,7 @@ ProcWindowsWMSelectInput (register ClientPtr client) REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq); pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource, - EventType, DixWriteAccess); + eventResourceType, DixWriteAccess); if (stuff->mask != 0) { if (pHead) @@ -237,7 +235,7 @@ ProcWindowsWMSelectInput (register ClientPtr client) { pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr)); if (!pHead || - !AddResource (eventResource, EventType, (pointer)pHead)) + !AddResource (eventResource, eventResourceType, (pointer)pHead)) { FreeResource (clientResource, RT_NONE); return BadAlloc; @@ -295,7 +293,7 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, ErrorF ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n", type, mask, which, arg, x, y, w, h); #endif - pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); + pHead = (WMEventPtr *) LookupIDByType(eventResource, eventResourceType); if (!pHead) return; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index 29ea81fc1..d72a5f135 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -42,12 +42,6 @@ #include "winmsg.h" #include "inputstr.h" -#ifdef XKB -extern BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam); -#endif -extern void winFixShiftKeys (int iScanCode); - - /* * Global variables */ @@ -724,8 +718,8 @@ winWindowProc (HWND hwnd, UINT message, break; /* Has the mouse pointer crossed screens? */ - if (s_pScreen != miPointerGetScreen(inputInfo.pointer)) - miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen, + if (s_pScreen != miPointerGetScreen(g_pwinPointer)) + miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen, GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); @@ -764,9 +758,8 @@ winWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, - GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); return 0; case WM_NCMOUSEMOVE: @@ -929,8 +922,7 @@ winWindowProc (HWND hwnd, UINT message, point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (point.x, point.y, - g_c32LastInputEventTime = GetTickCount()); + winEnqueueMotion(point.x , point.y); /* Check if a button was released but we didn't see it */ GetCursorPos (&point); @@ -1033,12 +1025,10 @@ winWindowProc (HWND hwnd, UINT message, if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) break; -#ifdef XKB /* * Discard presses generated from Windows auto-repeat - * ago: Only discard them if XKB is not disabled */ - if (!g_winInfo.xkb.disable && (lParam & (1<<30))) + if (lParam & (1<<30)) { switch (wParam) { @@ -1054,7 +1044,6 @@ winWindowProc (HWND hwnd, UINT message, return 0; } } -#endif /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */ if (winIsFakeCtrl_L (message, wParam, lParam)) |