Merge remote-tracking branch 'jturney/master'
This commit is contained in:
commit
6e438a0e18
|
@ -5,7 +5,6 @@ SRCS_CLIPBOARD = \
|
||||||
winclipboardinit.c \
|
winclipboardinit.c \
|
||||||
winclipboardtextconv.c \
|
winclipboardtextconv.c \
|
||||||
winclipboardthread.c \
|
winclipboardthread.c \
|
||||||
winclipboardunicode.c \
|
|
||||||
winclipboardwndproc.c \
|
winclipboardwndproc.c \
|
||||||
winclipboardwrappers.c \
|
winclipboardwrappers.c \
|
||||||
winclipboardxevents.c
|
winclipboardxevents.c
|
||||||
|
|
141
hw/xwin/README
141
hw/xwin/README
|
@ -1,141 +0,0 @@
|
||||||
Cygwin/X Release Notes
|
|
||||||
======================
|
|
||||||
|
|
||||||
Release X11R6.7
|
|
||||||
===============
|
|
||||||
|
|
||||||
Cygwin/X has continued its rapid pace of development that it has sustained
|
|
||||||
since Spring 2001 and this release shows it, we now have: a stable and fast
|
|
||||||
multi-window mode, seamless clipboard integration, a configurable tray menu
|
|
||||||
icon, popups on error messages pointing users to the log file and our mailing
|
|
||||||
list, the beginnings of indirect 3D acceleration for OpenGL applications,
|
|
||||||
improved non-US keyboard and clipboard support, and only a handful of bugs
|
|
||||||
that continue to be reported.
|
|
||||||
|
|
||||||
Between the XFree86 4.3.0 release and the X.Org X11R6.7 release the Cyg-
|
|
||||||
win/XFree86 project broke away from The XFree86 Project, Inc. due to a lack
|
|
||||||
of support from the XFree86 project. As such, the Cygwin/XFree86 project was
|
|
||||||
renamed to the Cygwin/X project and the upstream source code tree that Cyg-
|
|
||||||
win/X pulls from and pushes to is now the tree managed by the X.Org Founda-
|
|
||||||
tion. The Cygwin/X project has seen a rush of development and interest in
|
|
||||||
the project since the split; one metric showing this is that the number of
|
|
||||||
CVS committers we have has gone from zero to six.
|
|
||||||
|
|
||||||
The most outstanding features of this release are
|
|
||||||
|
|
||||||
o Major multi-window mode improvements. (Takuma Murakami, Earle F.
|
|
||||||
Philhower III)
|
|
||||||
|
|
||||||
o Initial work of accelerated OpenGL using the windows OpenGL drivers.
|
|
||||||
(Alexander Gottwald)
|
|
||||||
|
|
||||||
o Massive rework of clipboard integration with windows. (Harold L Hunt II,
|
|
||||||
Kensuke Matsuzaki)
|
|
||||||
|
|
||||||
o Improved Japanese clipboard and keyboard support. (Kensuke Matsuzaki,
|
|
||||||
Takuma Murakami, Alexander Gottwald)
|
|
||||||
|
|
||||||
o Customizable tray menu icon allowing shortcuts to start programs,
|
|
||||||
etc.(Earle F. Philhower III)
|
|
||||||
|
|
||||||
o New icons. (Jehan Bing, Michael Bax, Benjamin Rienfenstahl)
|
|
||||||
|
|
||||||
o Fix some multi-monitor problems.(Takuma Murakami)
|
|
||||||
|
|
||||||
o Fix repeated key strokes. (Ivan Pascal)
|
|
||||||
|
|
||||||
o Automatic keyboard layouts for the most frequently used keyboard lay-
|
|
||||||
outs. (Alexander Gottwald)
|
|
||||||
|
|
||||||
o Built in SHM support with detection of the SHM engine (cygserver).
|
|
||||||
(Ralf Habacker, Harold L Hunt II)
|
|
||||||
|
|
||||||
o Merged in work on the NativeGDI engine. (Alan Hourihane)
|
|
||||||
|
|
||||||
OpenGL with Cygwin/X
|
|
||||||
====================
|
|
||||||
|
|
||||||
Cygwin/X has supported GLX only with software rendering provided by the Mesa
|
|
||||||
library. Starting with X11R6.7 we add support for hardware accelerated OpenGL.
|
|
||||||
|
|
||||||
This support is still under development and still has some bigger problems.
|
|
||||||
To provide both versions (the stable software rendering and the new hardware
|
|
||||||
accelerated) we ship to binaries. XWin.exe contains the software rendering
|
|
||||||
and XWin_GL.exe uses the hardware acceleration provided by the windows drivers.
|
|
||||||
|
|
||||||
The known problems with hardware accelerated OpenGL are:
|
|
||||||
|
|
||||||
o Only multiwindow mode is useful. In the other modes the OpenGL output
|
|
||||||
does not align with the X11 windows.
|
|
||||||
|
|
||||||
o Using two programs which require different visuals will fail. For example
|
|
||||||
glxgears and glxinfo will not work without restarting XWin_GL.exe.
|
|
||||||
|
|
||||||
o OpenGL extensions and functions from OpenGL 1.2 and later should work
|
|
||||||
but are not completely tested.
|
|
||||||
|
|
||||||
o The standard Windows OpenGL driver will produce no output. Use the one
|
|
||||||
from your video adapter vendor.
|
|
||||||
|
|
||||||
If you notice problems with some programs please send a message with the
|
|
||||||
logfile /tmp/XWin.log and a short error description to <cygwin-xfree@cygwin.com>
|
|
||||||
|
|
||||||
The hardware accelerated OpenGL was tested using:
|
|
||||||
|
|
||||||
o glxgears
|
|
||||||
o glxinfo
|
|
||||||
o blender
|
|
||||||
o tuxkart
|
|
||||||
o GLUT demos (some did fail)
|
|
||||||
o tuxracer (currently not working)
|
|
||||||
|
|
||||||
|
|
||||||
Release X11R6.8
|
|
||||||
===============
|
|
||||||
|
|
||||||
Having reached a quite mature state in release X11R6.7 the development
|
|
||||||
has slowed down a little bit. Some of the former active developers have
|
|
||||||
retired or cut their work for the Cygwin/X project due to conflicts with
|
|
||||||
job, study and family.
|
|
||||||
|
|
||||||
The X11R6.8 release now includes major improvements from the xserver project.
|
|
||||||
This includes the XFixes, Damage, Composite and XEVIE extension which is a
|
|
||||||
major step towards allowing Cygwin/X to have real transparency.
|
|
||||||
|
|
||||||
But at the current state Composite is not working with Cygwin/X. Not all code
|
|
||||||
in the Cygwin/X Server has been updated to support the Composite feature and
|
|
||||||
using it will even crash the xserver. But as a second problem nearly all
|
|
||||||
functions required for compositing are lacking acceleration in Cygwin/X so
|
|
||||||
the feature would not be very useful if it would work. So it is disabled by
|
|
||||||
default.
|
|
||||||
|
|
||||||
OpenGL with Cygwin/X
|
|
||||||
====================
|
|
||||||
|
|
||||||
The OpenGL support has lost some of it's limitations from the last release
|
|
||||||
and should be much more stable. But due to missing wide spread testing in
|
|
||||||
the community it is still available in a separate program. XWin still uses
|
|
||||||
the old software OpenGL which is known to be stable.
|
|
||||||
|
|
||||||
The known problems with hardware accelerated OpenGL are:
|
|
||||||
|
|
||||||
o Only multiwindow mode is useful. In the other modes the OpenGL output
|
|
||||||
does not align with the X11 windows.
|
|
||||||
|
|
||||||
o OpenGL extensions and functions from OpenGL 1.2 and later should work
|
|
||||||
but are not completely tested.
|
|
||||||
|
|
||||||
o The standard Windows OpenGL driver will produce no output. Use the one
|
|
||||||
from your video adapter vendor.
|
|
||||||
|
|
||||||
If you notice problems with some programs please send a message with the
|
|
||||||
logfile /tmp/XWin.log and a short error description to <cygwin-xfree@cygwin.com>
|
|
||||||
|
|
||||||
The hardware accelerated OpenGL was tested using:
|
|
||||||
|
|
||||||
o glxgears
|
|
||||||
o glxinfo
|
|
||||||
o blender
|
|
||||||
o tuxkart
|
|
||||||
o GLUT demos (some did fail)
|
|
||||||
|
|
|
@ -313,18 +313,22 @@ exit silently and don't display any error message.
|
||||||
.B "\-xkbvariant \fIvariant\fp"
|
.B "\-xkbvariant \fIvariant\fp"
|
||||||
These options configure the xkeyboard extension to load
|
These options configure the xkeyboard extension to load
|
||||||
a particular keyboard map as the X server starts. The behavior is similar
|
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
|
to the \fIsetxkbmap\fP(1) program.
|
||||||
__datadir__/X11/xkb/\fP. Additional information is found in the
|
|
||||||
README files therein and in the man page of \fIsetxkbmap\fP. For example
|
See the \fIxkeyboard-config\fP(__miscmansuffix__) manual page for a list of
|
||||||
in order to load a German layout for a pc105 keyboard one uses
|
keyboard configurations.
|
||||||
the options:
|
|
||||||
|
The keyboard layout data is located at \fI__datadir__/X11/xkb/\fP. Additional information
|
||||||
|
can be found in the README files there and in the \fIsetxkbmap\fP(1) manual page.
|
||||||
|
|
||||||
|
For example, in order to load a German layout for a pc105 keyboard, use the options:
|
||||||
.br
|
.br
|
||||||
.I " \-xkblayout de \-xkbmodel pc105"
|
.I " \-xkblayout de \-xkbmodel pc105"
|
||||||
|
|
||||||
Alternatively one may use the \fIsetxkbmap\fP program after \fIXWin\fP is
|
Alternatively, you can use the \fIsetxkbmap\fP(1) program after \fIXWin\fP is
|
||||||
running.
|
running.
|
||||||
|
|
||||||
The default is to select a configuration matching your current layout as
|
The default is to select a keyboard configuration matching your current layout as
|
||||||
reported by \fIWindows\fP, if known, or the default X server configuration
|
reported by \fIWindows\fP, if known, or the default X server configuration
|
||||||
if no matching keyboard configuration was found.
|
if no matching keyboard configuration was found.
|
||||||
|
|
||||||
|
@ -370,7 +374,7 @@ window, in both the generic case and for particular programs.
|
||||||
* To change the style that is associated to the \fIWindows\fP window that
|
* To change the style that is associated to the \fIWindows\fP window that
|
||||||
\fXWin I-multiwindow\fP produces for each top-level X window.
|
\fXWin I-multiwindow\fP produces for each top-level X window.
|
||||||
.PP
|
.PP
|
||||||
The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
|
The format of the \fI.XWinrc\fP file is given in the XWinrc(5) manual page.
|
||||||
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
Need some examples
|
Need some examples
|
||||||
|
@ -378,15 +382,15 @@ Need some examples
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__),
|
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__),
|
||||||
setxkbmap(1), xkeyboard-config (__miscmansuffix__).
|
setxkbmap(1), xkeyboard-config(__miscmansuffix__).
|
||||||
|
|
||||||
|
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
.I XWin
|
.I XWin
|
||||||
and this man page still have many limitations.
|
and this manual page still have many limitations.
|
||||||
|
|
||||||
The \fIXWin\fP software is continuously developing; it is therefore possible that
|
The \fIXWin\fP software is continuously developing; it is therefore possible that
|
||||||
this man page is not up to date. It is always prudent to
|
this manual page is not up to date. It is always prudent to
|
||||||
look also at the output of \fIXWin -help\fP in order to
|
look also at the output of \fIXWin -help\fP in order to
|
||||||
check the options that are operative.
|
check the options that are operative.
|
||||||
|
|
||||||
|
|
|
@ -388,6 +388,7 @@ typedef struct {
|
||||||
DWORD dwScreen;
|
DWORD dwScreen;
|
||||||
|
|
||||||
int iMonitor;
|
int iMonitor;
|
||||||
|
HMONITOR hMonitor;
|
||||||
DWORD dwUserWidth;
|
DWORD dwUserWidth;
|
||||||
DWORD dwUserHeight;
|
DWORD dwUserHeight;
|
||||||
DWORD dwWidth;
|
DWORD dwWidth;
|
||||||
|
@ -578,7 +579,6 @@ typedef struct _winPrivScreenRec {
|
||||||
UnrealizeWindowProcPtr UnrealizeWindow;
|
UnrealizeWindowProcPtr UnrealizeWindow;
|
||||||
ValidateTreeProcPtr ValidateTree;
|
ValidateTreeProcPtr ValidateTree;
|
||||||
PostValidateTreeProcPtr PostValidateTree;
|
PostValidateTreeProcPtr PostValidateTree;
|
||||||
WindowExposuresProcPtr WindowExposures;
|
|
||||||
CopyWindowProcPtr CopyWindow;
|
CopyWindowProcPtr CopyWindow;
|
||||||
ClearToBackgroundProcPtr ClearToBackground;
|
ClearToBackgroundProcPtr ClearToBackground;
|
||||||
ClipNotifyProcPtr ClipNotify;
|
ClipNotifyProcPtr ClipNotify;
|
||||||
|
|
|
@ -58,7 +58,7 @@ winBlockHandler(ScreenPtr pScreen,
|
||||||
if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
|
if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
|
||||||
int iReturn;
|
int iReturn;
|
||||||
|
|
||||||
winDebug("winBlockHandler - Releasing pmServerStarted\n");
|
ErrorF("winBlockHandler - pthread_mutex_unlock()\n");
|
||||||
|
|
||||||
/* Flag that modules are to be started */
|
/* Flag that modules are to be started */
|
||||||
pScreenPriv->fServerStarted = TRUE;
|
pScreenPriv->fServerStarted = TRUE;
|
||||||
|
|
|
@ -111,13 +111,6 @@ void *winClipboardProc(void *);
|
||||||
void
|
void
|
||||||
winDeinitClipboard(void);
|
winDeinitClipboard(void);
|
||||||
|
|
||||||
/*
|
|
||||||
* winclipboardunicode.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winClipboardDetectUnicodeSupport(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* winclipboardwndproc.c
|
* winclipboardwndproc.c
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern HWND g_hwndClipboard;
|
||||||
Bool
|
Bool
|
||||||
winInitClipboard(void)
|
winInitClipboard(void)
|
||||||
{
|
{
|
||||||
ErrorF("winInitClipboard ()\n");
|
winDebug("winInitClipboard ()\n");
|
||||||
|
|
||||||
/* Wrap some internal server functions */
|
/* Wrap some internal server functions */
|
||||||
if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner) {
|
if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner) {
|
||||||
|
|
|
@ -64,7 +64,6 @@ static int clipboardRestarts = 0;
|
||||||
static XIOErrorHandler g_winClipboardOldIOErrorHandler;
|
static XIOErrorHandler g_winClipboardOldIOErrorHandler;
|
||||||
static pthread_t g_winClipboardProcThread;
|
static pthread_t g_winClipboardProcThread;
|
||||||
|
|
||||||
Bool g_fUnicodeSupport = FALSE;
|
|
||||||
Bool g_fUseUnicode = FALSE;
|
Bool g_fUseUnicode = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -103,14 +102,11 @@ winClipboardProc(void *pvNotUsed)
|
||||||
char szDisplay[512];
|
char szDisplay[512];
|
||||||
int iSelectError;
|
int iSelectError;
|
||||||
|
|
||||||
ErrorF("winClipboardProc - Hello\n");
|
winDebug("winClipboardProc - Hello\n");
|
||||||
++clipboardRestarts;
|
++clipboardRestarts;
|
||||||
|
|
||||||
/* Do we have Unicode support? */
|
|
||||||
g_fUnicodeSupport = winClipboardDetectUnicodeSupport();
|
|
||||||
|
|
||||||
/* Do we use Unicode clipboard? */
|
/* Do we use Unicode clipboard? */
|
||||||
fUseUnicode = g_fUnicodeClipboard && g_fUnicodeSupport;
|
fUseUnicode = g_fUnicodeClipboard;
|
||||||
|
|
||||||
/* Save the Unicode support flag in a global */
|
/* Save the Unicode support flag in a global */
|
||||||
g_fUseUnicode = fUseUnicode;
|
g_fUseUnicode = fUseUnicode;
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
|
|
||||||
*
|
|
||||||
*Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
*"Software"), to deal in the Software without restriction, including
|
|
||||||
*without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
*permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
*the following conditions:
|
|
||||||
*
|
|
||||||
*The above copyright notice and this permission notice shall be
|
|
||||||
*included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
|
|
||||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*Except as contained in this notice, the name of Harold L Hunt II
|
|
||||||
*shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
*or other dealings in this Software without prior written authorization
|
|
||||||
*from Harold L Hunt II.
|
|
||||||
*
|
|
||||||
* Authors: Harold L Hunt II
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
|
||||||
#include <xwin-config.h>
|
|
||||||
#endif
|
|
||||||
#include "winclipboard.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Determine whether we suport Unicode or not.
|
|
||||||
* NOTE: Currently, just check if we are on an NT-based platform or not.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
winClipboardDetectUnicodeSupport(void)
|
|
||||||
{
|
|
||||||
Bool fReturn = FALSE;
|
|
||||||
OSVERSIONINFO osvi = { 0 };
|
|
||||||
|
|
||||||
/* Get operating system version information */
|
|
||||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
|
||||||
GetVersionEx(&osvi);
|
|
||||||
|
|
||||||
/* Branch on platform ID */
|
|
||||||
switch (osvi.dwPlatformId) {
|
|
||||||
case VER_PLATFORM_WIN32_NT:
|
|
||||||
/* Unicode supported on NT only */
|
|
||||||
fReturn = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32_WINDOWS:
|
|
||||||
/* Unicode is not supported on non-NT */
|
|
||||||
fReturn = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fReturn;
|
|
||||||
}
|
|
|
@ -49,7 +49,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern Bool g_fUseUnicode;
|
extern Bool g_fUseUnicode;
|
||||||
extern Bool g_fUnicodeSupport;
|
|
||||||
extern void *g_pClipboardDisplay;
|
extern void *g_pClipboardDisplay;
|
||||||
extern Window g_iClipboardWindow;
|
extern Window g_iClipboardWindow;
|
||||||
extern Atom g_atomLastOwnedSelection;
|
extern Atom g_atomLastOwnedSelection;
|
||||||
|
@ -60,6 +59,7 @@ extern Atom g_atomLastOwnedSelection;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
||||||
|
|
||||||
winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
|
winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
|
||||||
Bool fUseUnicode, int iTimeoutSec);
|
Bool fUseUnicode, int iTimeoutSec);
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if (message == WM_RENDERALLFORMATS)
|
if (message == WM_RENDERALLFORMATS)
|
||||||
fConvertToUnicode = FALSE;
|
fConvertToUnicode = FALSE;
|
||||||
else
|
else
|
||||||
fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
|
fConvertToUnicode = (CF_UNICODETEXT == wParam);
|
||||||
|
|
||||||
/* Request the selection contents */
|
/* Request the selection contents */
|
||||||
iReturn = XConvertSelection(pDisplay,
|
iReturn = XConvertSelection(pDisplay,
|
||||||
|
@ -470,7 +470,6 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
*/
|
*/
|
||||||
if (WIN_XEVENTS_NOTIFY != iReturn) {
|
if (WIN_XEVENTS_NOTIFY != iReturn) {
|
||||||
/* Paste no data, to satisfy required call to SetClipboardData */
|
/* Paste no data, to satisfy required call to SetClipboardData */
|
||||||
if (g_fUnicodeSupport)
|
|
||||||
SetClipboardData(CF_UNICODETEXT, NULL);
|
SetClipboardData(CF_UNICODETEXT, NULL);
|
||||||
SetClipboardData(CF_TEXT, NULL);
|
SetClipboardData(CF_TEXT, NULL);
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ DISPATCH_PROC(winProcSetSelectionOwner);
|
||||||
* References to external symbols
|
* References to external symbols
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern Bool g_fUnicodeSupport;
|
|
||||||
extern int g_iNumScreens;
|
extern int g_iNumScreens;
|
||||||
extern unsigned int g_uiAuthDataLen;
|
extern unsigned int g_uiAuthDataLen;
|
||||||
extern char *g_pAuthData;
|
extern char *g_pAuthData;
|
||||||
|
@ -90,7 +89,7 @@ winProcEstablishConnection(ClientPtr client)
|
||||||
static unsigned long s_ulServerGeneration = 0;
|
static unsigned long s_ulServerGeneration = 0;
|
||||||
|
|
||||||
if (s_iCallCount == 0)
|
if (s_iCallCount == 0)
|
||||||
ErrorF("winProcEstablishConnection - Hello\n");
|
winDebug("winProcEstablishConnection - Hello\n");
|
||||||
|
|
||||||
/* Do nothing if clipboard is not enabled */
|
/* Do nothing if clipboard is not enabled */
|
||||||
if (!g_fClipboard) {
|
if (!g_fClipboard) {
|
||||||
|
@ -362,11 +361,8 @@ winProcSetSelectionOwner(ClientPtr client)
|
||||||
goto winProcSetSelectionOwner_Done;
|
goto winProcSetSelectionOwner_Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Advertise Unicode if we support it */
|
/* Advertise regular text and unicode */
|
||||||
if (g_fUnicodeSupport)
|
|
||||||
SetClipboardData(CF_UNICODETEXT, NULL);
|
SetClipboardData(CF_UNICODETEXT, NULL);
|
||||||
|
|
||||||
/* Always advertise regular text */
|
|
||||||
SetClipboardData(CF_TEXT, NULL);
|
SetClipboardData(CF_TEXT, NULL);
|
||||||
|
|
||||||
/* Save handle to last owned selection */
|
/* Save handle to last owned selection */
|
||||||
|
|
|
@ -36,12 +36,6 @@
|
||||||
#include "winclipboard.h"
|
#include "winclipboard.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* References to external symbols
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern Bool g_fUnicodeSupport;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process any pending X events
|
* Process any pending X events
|
||||||
*/
|
*/
|
||||||
|
@ -228,10 +222,6 @@ winClipboardFlushXEvents(HWND hwnd,
|
||||||
else
|
else
|
||||||
xiccesStyle = XStringStyle;
|
xiccesStyle = XStringStyle;
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: Can't pass CF_UNICODETEXT on Windows 95/98/Me
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Get a pointer to the clipboard text, in desired format */
|
/* Get a pointer to the clipboard text, in desired format */
|
||||||
if (fUseUnicode) {
|
if (fUseUnicode) {
|
||||||
/* Retrieve clipboard data */
|
/* Retrieve clipboard data */
|
||||||
|
@ -687,10 +677,10 @@ winClipboardFlushXEvents(HWND hwnd,
|
||||||
free(pwszUnicodeStr);
|
free(pwszUnicodeStr);
|
||||||
if (hGlobal && pszGlobalData)
|
if (hGlobal && pszGlobalData)
|
||||||
GlobalUnlock(hGlobal);
|
GlobalUnlock(hGlobal);
|
||||||
if (fSetClipboardData && g_fUnicodeSupport)
|
if (fSetClipboardData) {
|
||||||
SetClipboardData(CF_UNICODETEXT, NULL);
|
SetClipboardData(CF_UNICODETEXT, NULL);
|
||||||
if (fSetClipboardData)
|
|
||||||
SetClipboardData(CF_TEXT, NULL);
|
SetClipboardData(CF_TEXT, NULL);
|
||||||
|
}
|
||||||
return WIN_XEVENTS_NOTIFY;
|
return WIN_XEVENTS_NOTIFY;
|
||||||
|
|
||||||
case SelectionClear:
|
case SelectionClear:
|
||||||
|
|
|
@ -34,10 +34,6 @@
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "shellapi.h"
|
#include "shellapi.h"
|
||||||
|
|
||||||
#ifndef ABS_AUTOHIDE
|
|
||||||
#define ABS_AUTOHIDE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local function prototypes
|
* Local function prototypes
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +42,7 @@ static Bool
|
||||||
winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
|
winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
winAdjustForAutoHide(RECT * prcWorkArea);
|
winAdjustForAutoHide(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a full screen window
|
* Create a full screen window
|
||||||
|
@ -218,7 +214,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
|
||||||
winGetWorkArea(&rcWorkArea, pScreenInfo);
|
winGetWorkArea(&rcWorkArea, pScreenInfo);
|
||||||
|
|
||||||
/* Adjust for auto-hide taskbars */
|
/* Adjust for auto-hide taskbars */
|
||||||
winAdjustForAutoHide(&rcWorkArea);
|
winAdjustForAutoHide(&rcWorkArea, pScreenInfo);
|
||||||
|
|
||||||
/* Did the user specify a position? */
|
/* Did the user specify a position? */
|
||||||
if (pScreenInfo->fUserGavePosition) {
|
if (pScreenInfo->fUserGavePosition) {
|
||||||
|
@ -501,14 +497,32 @@ winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
|
||||||
int iLeft, iTop;
|
int iLeft, iTop;
|
||||||
int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
|
int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
|
||||||
|
|
||||||
|
/* Use GetMonitorInfo to get work area for monitor */
|
||||||
|
if (!pScreenInfo->fMultipleMonitors) {
|
||||||
|
MONITORINFO mi;
|
||||||
|
|
||||||
|
mi.cbSize = sizeof(MONITORINFO);
|
||||||
|
if (GetMonitorInfo(pScreenInfo->hMonitor, &mi)) {
|
||||||
|
*prcWorkArea = mi.rcWork;
|
||||||
|
|
||||||
|
winDebug("winGetWorkArea - Monitor %d WorkArea: %d %d %d %d\n",
|
||||||
|
pScreenInfo->iMonitor,
|
||||||
|
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||||
|
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ErrorF("winGetWorkArea - GetMonitorInfo() failed for monitor %d\n",
|
||||||
|
pScreenInfo->iMonitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bail out here if we aren't using multiple monitors */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* SPI_GETWORKAREA only gets the work area of the primary screen. */
|
/* SPI_GETWORKAREA only gets the work area of the primary screen. */
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0);
|
SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0);
|
||||||
|
|
||||||
/* Bail out here if we aren't using multiple monitors */
|
winDebug("winGetWorkArea - Primary Monitor WorkArea: %d %d %d %d\n",
|
||||||
if (!pScreenInfo->fMultipleMonitors)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
winDebug("winGetWorkArea - Original WorkArea: %d %d %d %d\n",
|
|
||||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||||
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||||
|
|
||||||
|
@ -556,16 +570,39 @@ winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo * pScreenInfo)
|
||||||
|
{
|
||||||
|
APPBARDATA abd;
|
||||||
|
HWND hwndAutoHide;
|
||||||
|
|
||||||
|
ZeroMemory(&abd, sizeof(abd));
|
||||||
|
abd.cbSize = sizeof(abd);
|
||||||
|
abd.uEdge = uEdge;
|
||||||
|
|
||||||
|
hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
||||||
|
if (hwndAutoHide != NULL) {
|
||||||
|
/*
|
||||||
|
Found an autohide taskbar on that edge, but is it on the
|
||||||
|
same monitor as the screen window?
|
||||||
|
*/
|
||||||
|
if (pScreenInfo->fMultipleMonitors ||
|
||||||
|
(MonitorFromWindow(hwndAutoHide, MONITOR_DEFAULTTONULL) ==
|
||||||
|
pScreenInfo->hMonitor))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust the client area so that any auto-hide toolbars
|
* Adjust the client area so that any auto-hide toolbars
|
||||||
* will work correctly.
|
* will work correctly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
winAdjustForAutoHide(RECT * prcWorkArea)
|
winAdjustForAutoHide(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
|
||||||
{
|
{
|
||||||
APPBARDATA abd;
|
APPBARDATA abd;
|
||||||
HWND hwndAutoHide;
|
|
||||||
|
|
||||||
winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
|
winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
|
||||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||||
|
@ -577,34 +614,31 @@ winAdjustForAutoHide(RECT * prcWorkArea)
|
||||||
if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
|
if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
|
||||||
winDebug("winAdjustForAutoHide - Taskbar is auto hide\n");
|
winDebug("winAdjustForAutoHide - Taskbar is auto hide\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
Despite the forgoing, we are checking for any AppBar
|
||||||
|
hiding along a monitor edge, not just the Windows TaskBar.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Look for a TOP auto-hide taskbar */
|
/* Look for a TOP auto-hide taskbar */
|
||||||
abd.uEdge = ABE_TOP;
|
if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo)) {
|
||||||
hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
|
||||||
if (hwndAutoHide != NULL) {
|
|
||||||
winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
|
winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
|
||||||
prcWorkArea->top += 1;
|
prcWorkArea->top += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for a LEFT auto-hide taskbar */
|
/* Look for a LEFT auto-hide taskbar */
|
||||||
abd.uEdge = ABE_LEFT;
|
if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo)) {
|
||||||
hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
|
||||||
if (hwndAutoHide != NULL) {
|
|
||||||
winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
|
winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
|
||||||
prcWorkArea->left += 1;
|
prcWorkArea->left += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for a BOTTOM auto-hide taskbar */
|
/* Look for a BOTTOM auto-hide taskbar */
|
||||||
abd.uEdge = ABE_BOTTOM;
|
if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo)) {
|
||||||
hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
|
||||||
if (hwndAutoHide != NULL) {
|
|
||||||
winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
|
winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
|
||||||
prcWorkArea->bottom -= 1;
|
prcWorkArea->bottom -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for a RIGHT auto-hide taskbar */
|
/* Look for a RIGHT auto-hide taskbar */
|
||||||
abd.uEdge = ABE_RIGHT;
|
if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo)) {
|
||||||
hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
|
||||||
if (hwndAutoHide != NULL) {
|
|
||||||
winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
|
winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
|
||||||
prcWorkArea->right -= 1;
|
prcWorkArea->right -= 1;
|
||||||
}
|
}
|
||||||
|
@ -613,14 +647,5 @@ winAdjustForAutoHide(RECT * prcWorkArea)
|
||||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||||
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Obtain the task bar window dimensions */
|
|
||||||
abd.hWnd = hwndAutoHide;
|
|
||||||
hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
|
|
||||||
winDebug("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n",
|
|
||||||
hwndAutoHide, abd.hWnd,
|
|
||||||
abd.rc.top, abd.rc.left, abd.rc.bottom, abd.rc.right);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,7 +492,7 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
ErrorF("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
|
winDebug("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* User dismissed the dialog, hide it until the
|
* User dismissed the dialog, hide it until the
|
||||||
|
@ -504,7 +504,7 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
ErrorF("winChangeDepthDlgProc - WM_CLOSE\n");
|
winDebug("winChangeDepthDlgProc - WM_CLOSE\n");
|
||||||
|
|
||||||
DestroyWindow(g_hDlgAbout);
|
DestroyWindow(g_hDlgAbout);
|
||||||
g_hDlgAbout = NULL;
|
g_hDlgAbout = NULL;
|
||||||
|
@ -609,7 +609,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
ErrorF("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
|
winDebug("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
|
||||||
|
|
||||||
DestroyWindow(g_hDlgAbout);
|
DestroyWindow(g_hDlgAbout);
|
||||||
g_hDlgAbout = NULL;
|
g_hDlgAbout = NULL;
|
||||||
|
@ -699,7 +699,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
ErrorF("winAboutDlgProc - WM_CLOSE\n");
|
winDebug("winAboutDlgProc - WM_CLOSE\n");
|
||||||
|
|
||||||
DestroyWindow(g_hDlgAbout);
|
DestroyWindow(g_hDlgAbout);
|
||||||
g_hDlgAbout = NULL;
|
g_hDlgAbout = NULL;
|
||||||
|
|
|
@ -111,7 +111,7 @@ winMessageBoxF(const char *pszError, UINT uType, ...)
|
||||||
#define MESSAGEBOXF \
|
#define MESSAGEBOXF \
|
||||||
"%s\n" \
|
"%s\n" \
|
||||||
"Vendor: %s\n" \
|
"Vendor: %s\n" \
|
||||||
"Release: %d.%d.%d.%d (%d)\n" \
|
"Release: %d.%d.%d.%d\n" \
|
||||||
"Contact: %s\n" \
|
"Contact: %s\n" \
|
||||||
"%s\n\n" \
|
"%s\n\n" \
|
||||||
"XWin was started with the following command-line:\n\n" \
|
"XWin was started with the following command-line:\n\n" \
|
||||||
|
@ -120,7 +120,7 @@ winMessageBoxF(const char *pszError, UINT uType, ...)
|
||||||
size = asprintf(&pszMsgBox, MESSAGEBOXF,
|
size = asprintf(&pszMsgBox, MESSAGEBOXF,
|
||||||
pszErrorF, XVENDORNAME,
|
pszErrorF, XVENDORNAME,
|
||||||
XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
|
XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
|
||||||
XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
|
XORG_VERSION_SNAP,
|
||||||
BUILDERADDR, BUILDERSTRING, g_pszCommandLine);
|
BUILDERADDR, BUILDERSTRING, g_pszCommandLine);
|
||||||
|
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
|
|
|
@ -133,24 +133,6 @@ winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
|
||||||
Bool
|
Bool
|
||||||
winInstallKeyboardHookLL(void)
|
winInstallKeyboardHookLL(void)
|
||||||
{
|
{
|
||||||
OSVERSIONINFO osvi = { 0 };
|
|
||||||
|
|
||||||
/* Get operating system version information */
|
|
||||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
|
||||||
GetVersionEx(&osvi);
|
|
||||||
|
|
||||||
/* Branch on platform ID */
|
|
||||||
switch (osvi.dwPlatformId) {
|
|
||||||
case VER_PLATFORM_WIN32_NT:
|
|
||||||
/* Low-level is supported on NT 4.0 SP3+ only */
|
|
||||||
/* TODO: Return FALSE on NT 4.0 with no SP, SP1, or SP2 */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32_WINDOWS:
|
|
||||||
/* Low-level hook is not supported on non-NT */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Install the hook only once */
|
/* Install the hook only once */
|
||||||
if (!g_hhookKeyboardLL)
|
if (!g_hhookKeyboardLL)
|
||||||
g_hhookKeyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL,
|
g_hhookKeyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL,
|
||||||
|
|
|
@ -48,6 +48,7 @@ getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
|
||||||
data->monitorOffsetY = rect->top;
|
data->monitorOffsetY = rect->top;
|
||||||
data->monitorHeight = rect->bottom - rect->top;
|
data->monitorHeight = rect->bottom - rect->top;
|
||||||
data->monitorWidth = rect->right - rect->left;
|
data->monitorWidth = rect->right - rect->left;
|
||||||
|
data->monitorHandle = hMonitor;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -63,5 +64,7 @@ QueryMonitor(int index, struct GetMonitorInfoData *data)
|
||||||
data->requestedMonitor = index;
|
data->requestedMonitor = index;
|
||||||
|
|
||||||
/* query information */
|
/* query information */
|
||||||
return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
|
EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,31 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright 1993, 1998 The Open Group
|
||||||
|
Copyright (C) Colin Harrison 2005-2008
|
||||||
|
|
||||||
|
Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
the above copyright notice appear in all copies and that both that
|
||||||
|
copyright notice and this permission notice appear in supporting
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the name of The Open Group shall
|
||||||
|
not be used in advertising or otherwise to promote the sale, use or
|
||||||
|
other dealings in this Software without prior written authorization
|
||||||
|
from The Open Group.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
/* data returned for monitor information */
|
/* data returned for monitor information */
|
||||||
struct GetMonitorInfoData {
|
struct GetMonitorInfoData {
|
||||||
|
@ -9,6 +37,7 @@ struct GetMonitorInfoData {
|
||||||
int monitorOffsetY;
|
int monitorOffsetY;
|
||||||
int monitorHeight;
|
int monitorHeight;
|
||||||
int monitorWidth;
|
int monitorWidth;
|
||||||
|
HMONITOR monitorHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
Bool QueryMonitor(int index, struct GetMonitorInfoData *data);
|
Bool QueryMonitor(int index, struct GetMonitorInfoData *data);
|
||||||
|
|
|
@ -380,21 +380,21 @@ InitQueue(WMMsgQueuePtr pQueue)
|
||||||
pQueue->nQueueSize = 0;
|
pQueue->nQueueSize = 0;
|
||||||
|
|
||||||
#if CYGMULTIWINDOW_DEBUG
|
#if CYGMULTIWINDOW_DEBUG
|
||||||
ErrorF("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
|
winDebug("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
|
||||||
QueueSize(pQueue));
|
QueueSize(pQueue));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ErrorF("InitQueue - Calling pthread_mutex_init\n");
|
winDebug("InitQueue - Calling pthread_mutex_init\n");
|
||||||
|
|
||||||
/* Create synchronization objects */
|
/* Create synchronization objects */
|
||||||
pthread_mutex_init(&pQueue->pmMutex, NULL);
|
pthread_mutex_init(&pQueue->pmMutex, NULL);
|
||||||
|
|
||||||
ErrorF("InitQueue - pthread_mutex_init returned\n");
|
winDebug("InitQueue - pthread_mutex_init returned\n");
|
||||||
ErrorF("InitQueue - Calling pthread_cond_init\n");
|
winDebug("InitQueue - Calling pthread_cond_init\n");
|
||||||
|
|
||||||
pthread_cond_init(&pQueue->pcNotEmpty, NULL);
|
pthread_cond_init(&pQueue->pcNotEmpty, NULL);
|
||||||
|
|
||||||
ErrorF("InitQueue - pthread_cond_init returned\n");
|
winDebug("InitQueue - pthread_cond_init returned\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -477,23 +477,23 @@ SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Updates the name of a HWND according to its X WM_NAME property
|
* See if we can get the stored HWND for this window...
|
||||||
*/
|
*/
|
||||||
|
static HWND
|
||||||
static void
|
getHwnd(WMInfoPtr pWMInfo, Window iWindow)
|
||||||
UpdateName(WMInfoPtr pWMInfo, Window iWindow)
|
|
||||||
{
|
{
|
||||||
wchar_t *pszName;
|
|
||||||
Atom atmType;
|
Atom atmType;
|
||||||
int fmtRet;
|
int fmtRet;
|
||||||
unsigned long items, remain;
|
unsigned long items, remain;
|
||||||
HWND *retHwnd, hWnd;
|
HWND *retHwnd, hWnd = NULL;
|
||||||
XWindowAttributes attr;
|
|
||||||
|
|
||||||
hWnd = 0;
|
if (XGetWindowProperty(pWMInfo->pDisplay,
|
||||||
|
iWindow,
|
||||||
/* See if we can get the cached HWND for this window... */
|
pWMInfo->atmPrivMap,
|
||||||
if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap,
|
0,
|
||||||
|
1,
|
||||||
|
False,
|
||||||
|
XA_INTEGER,
|
||||||
&atmType,
|
&atmType,
|
||||||
&fmtRet,
|
&fmtRet,
|
||||||
&items,
|
&items,
|
||||||
|
@ -506,8 +506,26 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow)
|
||||||
|
|
||||||
/* Some sanity checks */
|
/* Some sanity checks */
|
||||||
if (!hWnd)
|
if (!hWnd)
|
||||||
return;
|
return NULL;
|
||||||
if (!IsWindow(hWnd))
|
if (!IsWindow(hWnd))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return hWnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Updates the name of a HWND according to its X WM_NAME property
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
UpdateName(WMInfoPtr pWMInfo, Window iWindow)
|
||||||
|
{
|
||||||
|
wchar_t *pszName;
|
||||||
|
HWND hWnd;
|
||||||
|
XWindowAttributes attr;
|
||||||
|
|
||||||
|
hWnd = getHwnd(pWMInfo, iWindow);
|
||||||
|
if (!hWnd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Set the Windows window name */
|
/* Set the Windows window name */
|
||||||
|
@ -532,27 +550,12 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow)
|
||||||
static void
|
static void
|
||||||
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
|
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
|
||||||
{
|
{
|
||||||
Atom atmType;
|
HWND hWnd;
|
||||||
int fmtRet;
|
|
||||||
unsigned long items, remain;
|
|
||||||
HWND hWnd, *retHwnd;
|
|
||||||
DWORD myWinProcID, winProcID;
|
DWORD myWinProcID, winProcID;
|
||||||
Window xWindow;
|
Window xWindow;
|
||||||
WINDOWPLACEMENT wndPlace;
|
WINDOWPLACEMENT wndPlace;
|
||||||
|
|
||||||
hWnd = NULL;
|
hWnd = getHwnd(pWMInfo, iWindow);
|
||||||
/* See if we can get the cached HWND for this window... */
|
|
||||||
if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap,
|
|
||||||
&atmType,
|
|
||||||
&fmtRet,
|
|
||||||
&items,
|
|
||||||
&remain, (unsigned char **) &retHwnd) == Success) {
|
|
||||||
if (retHwnd) {
|
|
||||||
hWnd = *retHwnd;
|
|
||||||
XFree(retHwnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hWnd)
|
if (!hWnd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -802,7 +805,7 @@ winMultiWindowXMsgProc(void *pArg)
|
||||||
int iReturn;
|
int iReturn;
|
||||||
XIconSize *xis;
|
XIconSize *xis;
|
||||||
|
|
||||||
ErrorF("winMultiWindowXMsgProc - Hello\n");
|
winDebug("winMultiWindowXMsgProc - Hello\n");
|
||||||
|
|
||||||
/* Check that argument pointer is not invalid */
|
/* Check that argument pointer is not invalid */
|
||||||
if (pProcArg == NULL) {
|
if (pProcArg == NULL) {
|
||||||
|
@ -1172,7 +1175,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
|
||||||
char pszDisplay[512];
|
char pszDisplay[512];
|
||||||
int iReturn;
|
int iReturn;
|
||||||
|
|
||||||
ErrorF("winInitMultiWindowWM - Hello\n");
|
winDebug("winInitMultiWindowWM - Hello\n");
|
||||||
|
|
||||||
/* Check that argument pointer is not invalid */
|
/* Check that argument pointer is not invalid */
|
||||||
if (pProcArg == NULL) {
|
if (pProcArg == NULL) {
|
||||||
|
|
|
@ -101,20 +101,22 @@ winInitializeScreenDefaults(void)
|
||||||
int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
|
int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||||
|
|
||||||
winErrorFVerb(2,
|
winErrorFVerb(2,
|
||||||
"winInitializeDefaultScreens - native DPI x %d y %d\n",
|
"winInitializeScreenDefaults - native DPI x %d y %d\n",
|
||||||
dpiX, dpiY);
|
dpiX, dpiY);
|
||||||
|
|
||||||
monitorResolution = dpiY;
|
monitorResolution = dpiY;
|
||||||
ReleaseDC(NULL, hdc);
|
ReleaseDC(NULL, hdc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
winErrorFVerb(1,
|
winErrorFVerb(1,
|
||||||
"winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n",
|
"winInitializeScreenDefaults - Failed to retrieve native DPI, falling back to default of %d DPI\n",
|
||||||
WIN_DEFAULT_DPI);
|
WIN_DEFAULT_DPI);
|
||||||
monitorResolution = WIN_DEFAULT_DPI;
|
monitorResolution = WIN_DEFAULT_DPI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultScreenInfo.iMonitor = 1;
|
defaultScreenInfo.iMonitor = 1;
|
||||||
|
defaultScreenInfo.hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
|
||||||
defaultScreenInfo.dwWidth = dwWidth;
|
defaultScreenInfo.dwWidth = dwWidth;
|
||||||
defaultScreenInfo.dwHeight = dwHeight;
|
defaultScreenInfo.dwHeight = dwHeight;
|
||||||
defaultScreenInfo.dwUserWidth = dwWidth;
|
defaultScreenInfo.dwUserWidth = dwWidth;
|
||||||
|
@ -159,7 +161,7 @@ winInitializeScreenDefaults(void)
|
||||||
static void
|
static void
|
||||||
winInitializeScreen(int i)
|
winInitializeScreen(int i)
|
||||||
{
|
{
|
||||||
winErrorFVerb(2, "winInitializeScreen - %d\n", i);
|
winErrorFVerb(3, "winInitializeScreen - %d\n", i);
|
||||||
|
|
||||||
/* Initialize default screen values, if needed */
|
/* Initialize default screen values, if needed */
|
||||||
winInitializeScreenDefaults();
|
winInitializeScreenDefaults();
|
||||||
|
@ -176,7 +178,7 @@ winInitializeScreens(int maxscreens)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
winErrorFVerb(2, "winInitializeScreens - %i\n", maxscreens);
|
winErrorFVerb(3, "winInitializeScreens - %i\n", maxscreens);
|
||||||
|
|
||||||
if (maxscreens > g_iNumScreens) {
|
if (maxscreens > g_iNumScreens) {
|
||||||
/* Reallocate the memory for DDX-specific screen info */
|
/* Reallocate the memory for DDX-specific screen info */
|
||||||
|
@ -333,6 +335,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
|
g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
|
||||||
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
|
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
|
||||||
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
|
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
|
||||||
|
g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
|
||||||
g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
|
g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
|
||||||
g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
|
g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
|
||||||
g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
|
g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
|
||||||
|
@ -383,6 +386,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
}
|
}
|
||||||
else if (data.bMonitorSpecifiedExists == TRUE) {
|
else if (data.bMonitorSpecifiedExists == TRUE) {
|
||||||
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
|
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
|
||||||
|
g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
|
||||||
g_ScreenInfo[nScreenNum].dwInitialX +=
|
g_ScreenInfo[nScreenNum].dwInitialX +=
|
||||||
data.monitorOffsetX;
|
data.monitorOffsetX;
|
||||||
g_ScreenInfo[nScreenNum].dwInitialY +=
|
g_ScreenInfo[nScreenNum].dwInitialY +=
|
||||||
|
@ -415,6 +419,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
iMonitor);
|
iMonitor);
|
||||||
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
|
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
|
||||||
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
|
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
|
||||||
|
g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
|
||||||
g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
|
g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
|
||||||
g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
|
g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
|
||||||
}
|
}
|
||||||
|
@ -1158,9 +1163,8 @@ winLogVersionInfo(void)
|
||||||
|
|
||||||
ErrorF("Welcome to the XWin X Server\n");
|
ErrorF("Welcome to the XWin X Server\n");
|
||||||
ErrorF("Vendor: %s\n", XVENDORNAME);
|
ErrorF("Vendor: %s\n", XVENDORNAME);
|
||||||
ErrorF("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR,
|
ErrorF("Release: %d.%d.%d.%d\n", XORG_VERSION_MAJOR,
|
||||||
XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP,
|
XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
|
||||||
XORG_VERSION_CURRENT);
|
|
||||||
ErrorF("%s\n\n", BUILDERSTRING);
|
ErrorF("%s\n\n", BUILDERSTRING);
|
||||||
ErrorF("Contact: %s\n", BUILDERADDR);
|
ErrorF("Contact: %s\n", BUILDERADDR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,7 +432,7 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
if (pScreen->a) { \
|
if (pScreen->a) { \
|
||||||
pScreenPriv->a = pScreen->a; \
|
pScreenPriv->a = pScreen->a; \
|
||||||
} else { \
|
} else { \
|
||||||
ErrorF("null screen fn " #a "\n"); \
|
winDebug("winScreenInit - null screen fn " #a "\n"); \
|
||||||
pScreenPriv->a = NULL; \
|
pScreenPriv->a = NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
if (pScreen->a) { \
|
if (pScreen->a) { \
|
||||||
pScreenPriv->a = pScreen->a; \
|
pScreenPriv->a = pScreen->a; \
|
||||||
} else { \
|
} else { \
|
||||||
ErrorF("null screen fn " #a "\n"); \
|
winDebug("null screen fn " #a "\n"); \
|
||||||
pScreenPriv->a = NULL; \
|
pScreenPriv->a = NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,6 +428,13 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case WM_SYSCOMMAND:
|
||||||
|
if (s_pScreenInfo->iResizeMode == resizeWithRandr &&
|
||||||
|
((wParam & 0xfff0) == SC_MAXIMIZE ||
|
||||||
|
(wParam & 0xfff0) == SC_RESTORE))
|
||||||
|
PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_ENTERSIZEMOVE:
|
case WM_ENTERSIZEMOVE:
|
||||||
ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n");
|
ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n");
|
||||||
break;
|
break;
|
||||||
|
|
10
include/os.h
10
include/os.h
|
@ -359,9 +359,13 @@ Fopen(const char *, const char *);
|
||||||
extern _X_EXPORT int
|
extern _X_EXPORT int
|
||||||
Fclose(pointer);
|
Fclose(pointer);
|
||||||
#else
|
#else
|
||||||
#define System(a) system(a)
|
|
||||||
#define Popen(a,b) popen(a,b)
|
extern const char *
|
||||||
#define Pclose(a) pclose(a)
|
Win32TempDir(void);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
System(const char *cmdline);
|
||||||
|
|
||||||
#define Fopen(a,b) fopen(a,b)
|
#define Fopen(a,b) fopen(a,b)
|
||||||
#define Fclose(a) fclose(a)
|
#define Fclose(a) fclose(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
73
os/utils.c
73
os/utils.c
|
@ -1561,6 +1561,79 @@ Fclose(pointer iop)
|
||||||
|
|
||||||
#endif /* !WIN32 */
|
#endif /* !WIN32 */
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
#include <X11/Xwindows.h>
|
||||||
|
|
||||||
|
const char *
|
||||||
|
Win32TempDir()
|
||||||
|
{
|
||||||
|
static char buffer[PATH_MAX];
|
||||||
|
|
||||||
|
if (GetTempPath(sizeof(buffer), buffer)) {
|
||||||
|
int len;
|
||||||
|
|
||||||
|
buffer[sizeof(buffer) - 1] = 0;
|
||||||
|
len = strlen(buffer);
|
||||||
|
if (len > 0)
|
||||||
|
if (buffer[len - 1] == '\\')
|
||||||
|
buffer[len - 1] = 0;
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
if (getenv("TEMP") != NULL)
|
||||||
|
return getenv("TEMP");
|
||||||
|
else if (getenv("TMP") != NULL)
|
||||||
|
return getenv("TEMP");
|
||||||
|
else
|
||||||
|
return "/tmp";
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
System(const char *cmdline)
|
||||||
|
{
|
||||||
|
STARTUPINFO si;
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
DWORD dwExitCode;
|
||||||
|
char *cmd = strdup(cmdline);
|
||||||
|
|
||||||
|
ZeroMemory(&si, sizeof(si));
|
||||||
|
si.cb = sizeof(si);
|
||||||
|
ZeroMemory(&pi, sizeof(pi));
|
||||||
|
|
||||||
|
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
|
||||||
|
LPVOID buffer;
|
||||||
|
|
||||||
|
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
NULL,
|
||||||
|
GetLastError(),
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR) & buffer, 0, NULL)) {
|
||||||
|
ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *) buffer);
|
||||||
|
LocalFree(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(cmd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* Wait until child process exits. */
|
||||||
|
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||||
|
|
||||||
|
GetExitCodeProcess(pi.hProcess, &dwExitCode);
|
||||||
|
|
||||||
|
/* Close process and thread handles. */
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
|
free(cmd);
|
||||||
|
|
||||||
|
return dwExitCode;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CheckUserParameters: check for long command line arguments and long
|
* CheckUserParameters: check for long command line arguments and long
|
||||||
* environment variables. By default, these checks are only done when
|
* environment variables. By default, these checks are only done when
|
||||||
|
|
|
@ -44,12 +44,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* from ddxLoad.c */
|
/* from ddxLoad.c */
|
||||||
extern const char *Win32TempDir(void);
|
|
||||||
extern int Win32System(const char *cmdline);
|
|
||||||
|
|
||||||
#undef System
|
|
||||||
#define System Win32System
|
|
||||||
|
|
||||||
#define W32_tmparg " '%s'"
|
#define W32_tmparg " '%s'"
|
||||||
#define W32_tmpfile ,tmpname
|
#define W32_tmpfile ,tmpname
|
||||||
#define W32_tmplen strlen(tmpname)+3
|
#define W32_tmplen strlen(tmpname)+3
|
||||||
|
|
|
@ -68,81 +68,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define PATHSEPARATOR "/"
|
#define PATHSEPARATOR "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
#include <X11/Xwindows.h>
|
|
||||||
const char *
|
|
||||||
Win32TempDir()
|
|
||||||
{
|
|
||||||
static char buffer[PATH_MAX];
|
|
||||||
|
|
||||||
if (GetTempPath(sizeof(buffer), buffer)) {
|
|
||||||
int len;
|
|
||||||
|
|
||||||
buffer[sizeof(buffer) - 1] = 0;
|
|
||||||
len = strlen(buffer);
|
|
||||||
if (len > 0)
|
|
||||||
if (buffer[len - 1] == '\\')
|
|
||||||
buffer[len - 1] = 0;
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
if (getenv("TEMP") != NULL)
|
|
||||||
return getenv("TEMP");
|
|
||||||
else if (getenv("TMP") != NULL)
|
|
||||||
return getenv("TEMP");
|
|
||||||
else
|
|
||||||
return "/tmp";
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
Win32System(const char *cmdline)
|
|
||||||
{
|
|
||||||
STARTUPINFO si;
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
DWORD dwExitCode;
|
|
||||||
char *cmd = strdup(cmdline);
|
|
||||||
|
|
||||||
ZeroMemory(&si, sizeof(si));
|
|
||||||
si.cb = sizeof(si);
|
|
||||||
ZeroMemory(&pi, sizeof(pi));
|
|
||||||
|
|
||||||
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
|
|
||||||
LPVOID buffer;
|
|
||||||
|
|
||||||
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
||||||
NULL,
|
|
||||||
GetLastError(),
|
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
(LPTSTR) & buffer, 0, NULL)) {
|
|
||||||
ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *) buffer);
|
|
||||||
LocalFree(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(cmd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/* Wait until child process exits. */
|
|
||||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
|
||||||
|
|
||||||
GetExitCodeProcess(pi.hProcess, &dwExitCode);
|
|
||||||
|
|
||||||
/* Close process and thread handles. */
|
|
||||||
CloseHandle(pi.hProcess);
|
|
||||||
CloseHandle(pi.hThread);
|
|
||||||
free(cmd);
|
|
||||||
|
|
||||||
return dwExitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef System
|
|
||||||
#define System(x) Win32System(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
OutputDirectory(char *outdir, size_t size)
|
OutputDirectory(char *outdir, size_t size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue