Bug 777: Merge from CYGWIN branch
This commit is contained in:
parent
dfdbb60bf5
commit
d6e8b1affe
64
hw/xwin/ChangeLog
Normal file
64
hw/xwin/ChangeLog
Normal file
|
@ -0,0 +1,64 @@
|
|||
2004-05-27 Alexander Gottwald <ago@freedesktop.org>
|
||||
|
||||
* winpriv.c: Create win32 window if not already created
|
||||
* winmultiwindowwindow.c: Export winCreateWindowWindow
|
||||
|
||||
2004-05-27 Alexander Gottwald <ago@freedesktop.org>
|
||||
|
||||
* win.h: Allow CYGDEBUG to defined in the Makefile
|
||||
* winwindow.h: Allow CYGWINDOWING_DEBUG to defined in the Makefile
|
||||
|
||||
2004-05-19 Alexander Gottwald <ago@freedesktop.org>
|
||||
|
||||
* winmultiwindowicons.c (winInitGlobalIcons): Load the small default
|
||||
icon too
|
||||
* winprefs.h, winprefs.c (winOverrideDefaultIcon): Takes the iconsize
|
||||
as parameter
|
||||
|
||||
2004-05-19 Alexander Gottwald <ago@freedesktop.org>
|
||||
|
||||
* win.h, winmultiwindowicons.c (winXIconToHICON): Takes iconsize
|
||||
as parameter
|
||||
* winglobals.c, winmultiwindowicons.c: Rename g_hiconX to g_hIconX.
|
||||
Added new variable g_hSmallIconX for 16x16 icon.
|
||||
* winwindow.h, winmultiwindowicons.c (winInitGlobalIcons): Inits the
|
||||
global g_hIconX handles.
|
||||
* winwindow.h, winmultiwindowicons.c (winDestroyIcon): Free the icon
|
||||
without messing with the global icon handle.
|
||||
* winmultiwindowicons.c (winSelectIcons): Generate a custom icon from
|
||||
window settigns or set them to globals.
|
||||
* winmultiwindowshape.c, winmultiwindowwindow.c, winwin32rootless.c,
|
||||
winwin32rootlesswindow.c, winwin32rootlesswndproc.c: Remove
|
||||
declaration of g_hiconX;
|
||||
* winmultiwindowwindow.c (winCreateWindowsWindow),
|
||||
winwin32rootless.c (winMWExtWMCreateFrame): Use winSelectIcons
|
||||
to get the window icons. Set the small icon too.
|
||||
* winmultiwindowwindow.c (winDestroyWindowsWindow),
|
||||
winmultiwindowicons.c (winUpdateIcon),
|
||||
winprefs.c (ReloadEnumWindowsProc),
|
||||
winwin32rootlesswindow.c (winMWExtWMUpdateIcon),
|
||||
winwin32rootless.c (winMWExtWMDestroyFrame): Use winDestroyIcon
|
||||
to free the icon without destroying the global icon.
|
||||
|
||||
2004-05-17 Alexander Gottwald <ago@freedesktop.org>
|
||||
|
||||
* windialogs.c (winExitDlgProc, winAboutDlgProc),
|
||||
winmultiwindowwndproc.c (winTopLevelWindowProc),
|
||||
winwndproc.c (winWindowProc): Check if g_fSoftwareCursor is set
|
||||
before calling ShowCursor.
|
||||
|
||||
2004-05-09 Dan Wilks <Dan_Wilks@intuit.com>
|
||||
|
||||
* winclipboard.h: Add extern prototypes for winDebug, winErrorFVerb
|
||||
copied from winmsg.h.
|
||||
* winclipboardinit.c (winFixClipboardChain): Post rather than send the
|
||||
reinit message to the clipboard window. Sending the message caused,
|
||||
or possibly just exacerbated an existing, race condition that would
|
||||
cause the X server to hang when coming back from a remote desktop
|
||||
session.
|
||||
* winclipboardwndproc.c (winProcessXEventsTimeout): switch to new
|
||||
logging api's.
|
||||
* winclipboardwindproc.c (winClipboardWindowProc): switch to new
|
||||
logging api's. Add some additional debug logging. Make best effort
|
||||
to prevent our window appearing twice in the clipboard chain. Also
|
||||
detect loops when they occur and try to behave in a reasonable way.
|
|
@ -29,9 +29,40 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.11 2002/07/05 09:19:25 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "../../Xext/xf86miscproc.h"
|
||||
#ifdef XWIN_CLIPBOARD
|
||||
# include "../../Xext/xf86miscproc.h"
|
||||
#endif
|
||||
#include "dixstruct.h"
|
||||
|
||||
CARD32 g_c32LastInputEventTime = 0;
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
#ifdef XWIN_CLIPBOARD
|
||||
DISPATCH_PROC(winProcEstablishConnection);
|
||||
DISPATCH_PROC(winProcQueryTree);
|
||||
DISPATCH_PROC(winProcSetSelectionOwner);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local global declarations
|
||||
*/
|
||||
|
||||
CARD32 g_c32LastInputEventTime = 0;
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern int g_fdMessageQueue;
|
||||
extern Bool g_fXdmcpEnabled;
|
||||
#ifdef XWIN_CLIPBOARD
|
||||
extern winDispatchProcPtr winProcEstablishConnectionOrig;
|
||||
extern winDispatchProcPtr winProcQueryTreeOrig;
|
||||
#endif
|
||||
|
||||
|
||||
/* Called from dix/devices.c */
|
||||
|
@ -87,7 +118,24 @@ InitInput (int argc, char *argv[])
|
|||
DeviceIntPtr pMouse, pKeyboard;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("InitInput\n");
|
||||
winDebug ("InitInput\n");
|
||||
#endif
|
||||
|
||||
#ifdef XWIN_CLIPBOARD
|
||||
/*
|
||||
* Wrap some functions at every generation of the server.
|
||||
*/
|
||||
if (InitialVector[2] != winProcEstablishConnection)
|
||||
{
|
||||
winProcEstablishConnectionOrig = InitialVector[2];
|
||||
InitialVector[2] = winProcEstablishConnection;
|
||||
}
|
||||
if (g_fXdmcpEnabled
|
||||
&& ProcVector[X_QueryTree] != winProcQueryTree)
|
||||
{
|
||||
winProcQueryTreeOrig = ProcVector[X_QueryTree];
|
||||
ProcVector[X_QueryTree] = winProcQueryTree;
|
||||
}
|
||||
#endif
|
||||
|
||||
pMouse = AddInputDevice (winMouseProc, TRUE);
|
||||
|
@ -118,36 +166,8 @@ InitInput (int argc, char *argv[])
|
|||
AddEnabledDevice (g_fdMessageQueue);
|
||||
}
|
||||
|
||||
#if 0
|
||||
{
|
||||
MiscExtReturn ret;
|
||||
pointer kbd;
|
||||
|
||||
#if 0
|
||||
if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0)
|
||||
return BadAlloc;
|
||||
#else
|
||||
kbd = MiscExtCreateStruct (MISC_KEYBOARD);
|
||||
#endif
|
||||
|
||||
MiscExtSetKbdValue(kbd, MISC_KBD_TYPE, 0);
|
||||
MiscExtSetKbdValue(kbd, MISC_KBD_RATE, 0);
|
||||
MiscExtSetKbdValue(kbd, MISC_KBD_DELAY, 0);
|
||||
MiscExtSetKbdValue(kbd, MISC_KBD_SERVNUMLOCK, 0);
|
||||
|
||||
switch ((ret = MiscExtApply (kbd, MISC_KEYBOARD)))
|
||||
{
|
||||
case MISC_RET_SUCCESS: break;
|
||||
case MISC_RET_BADVAL:
|
||||
case MISC_RET_BADKBDTYPE:
|
||||
default:
|
||||
ErrorF ("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("InitInput - returning\n");
|
||||
winDebug ("InitInput - returning\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
1401
hw/xwin/InitOutput.c
1401
hw/xwin/InitOutput.c
File diff suppressed because it is too large
Load Diff
BIN
hw/xwin/X-boxed.ico
Executable file
BIN
hw/xwin/X-boxed.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
hw/xwin/X.ico
BIN
hw/xwin/X.ico
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 20 KiB |
337
hw/xwin/XWin.man
337
hw/xwin/XWin.man
|
@ -1,64 +1,89 @@
|
|||
.\" $XFree86: xc/programs/Xserver/hw/xwin/XWin.man,v 1.5 2002/07/05 09:19:25 alanh Exp $
|
||||
.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
|
||||
.I XWin is an X Server for the X Window System on the Cygwin environment
|
||||
running on Microsoft Windows.
|
||||
.SH OPTIONS
|
||||
|
||||
|
||||
.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/tmp/XWin.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/usr/X11R6/lib/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:
|
||||
manual page, \fIXWin\fP accepts the following command line switches,
|
||||
\fIall\fP of which are optional:
|
||||
.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 "\-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.
|
||||
.TP 8
|
||||
.B "\-engine \fIengine_type_id\fP"
|
||||
Override 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
|
||||
Run the server in fullscreen mode, as opposed to the default windowed
|
||||
mode.
|
||||
.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 "\-screen \fIscreen_number\fP \fIwidth\fP \fIheight\fP"
|
||||
Sets the display resolution for the X server to use on screen
|
||||
.I screen_number.
|
||||
.TP 8
|
||||
.B \-nodecoration
|
||||
Draw the Cygwin/X window without a border or title bar.
|
||||
.TP 8
|
||||
.B \-rootless
|
||||
EXPERIMENTAL: Run Cygwin/X in pseduo-rootless mode.
|
||||
.TP 8
|
||||
.B \-lesspointer
|
||||
Hide the Windows mouse pointer when over an inactive X window
|
||||
.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.
|
||||
.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
|
||||
|
@ -69,61 +94,191 @@ 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 usefullness of this feature through testing.
|
||||
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. The PseudoColor visual
|
||||
does not have correct colors, and it may crash, but it at least allows
|
||||
you to run your PseudoColor application in TrueColor modes.
|
||||
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/tmp/XWin.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
|
||||
Ctrl+Alt+Backspace exits the X Server
|
||||
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
|
||||
Alt+F4 exits the X Server
|
||||
.SH "SEE ALSO"
|
||||
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 "\-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/usr/X11R6/lib/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
|
||||
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(5)
|
||||
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(1), setxkbmap(1)
|
||||
|
||||
|
||||
.SH BUGS
|
||||
.I XWin
|
||||
and this man page still have many limitations. Some of the more obvious
|
||||
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.
|
||||
.PP
|
||||
.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
|
||||
X was originally ported to Cygwin by Dakshinamurthy Karra,
|
||||
Dr. Peter Busch, John Fortin, and Suhaib Siddiqi.
|
||||
.I XWin
|
||||
is maintained by the Cygwin/X project, with hosting services
|
||||
provided by freedesktop.org.
|
||||
.PP
|
||||
The following members, in alphabetical order by last name, of the
|
||||
Cygwin/X Team contributed to the X.Org Foundation 6.7 release:
|
||||
.PP
|
||||
Robert Collins - Cygwin developer, miscellaneous
|
||||
.br
|
||||
Christopher Faylor - Management of hosting services, general
|
||||
programming guru
|
||||
.br
|
||||
Alexander Gottwald - AltGr handling for non-U.S. keyboards
|
||||
.br
|
||||
Alan Hourihane - X developer, patch reviewer, general programming guru
|
||||
.br
|
||||
Pierre A Humblet - Debugging of socket-related crashes, developer
|
||||
.br
|
||||
Harold L Hunt II - Project leader, lead developer, documentation,
|
||||
and website updates
|
||||
.br
|
||||
Suhaib Siddiqi - Originator of the project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2002-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
|
||||
|
@ -15,28 +15,48 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/XWin.rc,v 1.1 2002/10/17 08:18:21 alanh Exp $ */
|
||||
|
||||
#include "resource.h"
|
||||
#include "winresource.h"
|
||||
|
||||
|
||||
/*
|
||||
* Dialogs
|
||||
*/
|
||||
|
||||
/* Depth_Change */
|
||||
/* About */
|
||||
ABOUT_BOX DIALOG DISCARDABLE 32, 32, 240, 105
|
||||
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTER
|
||||
CAPTION "About Cygwin/X"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Cygwin/X Website", ID_ABOUT_WEBSITE, "Button",
|
||||
BS_OWNERDRAW | WS_TABSTOP, 30, 45, 75, 15
|
||||
CONTROL "Change Log", ID_ABOUT_CHANGELOG, "Button",
|
||||
BS_OWNERDRAW | WS_TABSTOP, 135, 45, 75, 15
|
||||
CONTROL "User's Guide", ID_ABOUT_UG, "Button",
|
||||
BS_OWNERDRAW | WS_TABSTOP, 30, 65, 75, 15
|
||||
CONTROL "FAQ", ID_ABOUT_FAQ, "Button",
|
||||
BS_OWNERDRAW | WS_TABSTOP, 135, 65, 75, 15
|
||||
|
||||
DEFPUSHBUTTON "Dismiss", IDOK, 95, 85, 50, 15
|
||||
|
||||
CTEXT "Welcome to the preliminary About box for the Cygwin/X 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 Cygwin/X project.", IDC_STATIC, 5, 5, 230, 35
|
||||
END
|
||||
|
||||
|
||||
/* Depth change */
|
||||
|
||||
DEPTH_CHANGE_BOX DIALOG DISCARDABLE 32, 32, 180, 100
|
||||
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTER
|
||||
|
@ -52,15 +72,16 @@ END
|
|||
|
||||
/* Exit */
|
||||
|
||||
EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 70
|
||||
EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78
|
||||
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTER
|
||||
FONT 8, "MS Sans Serif"
|
||||
CAPTION "Cygwin/X - Exit?"
|
||||
BEGIN
|
||||
PUSHBUTTON "E&xit", IDOK, 55, 48, 30, 14
|
||||
DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 48, 30, 14
|
||||
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 "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 24, 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
|
||||
|
||||
|
||||
|
@ -73,7 +94,7 @@ BEGIN
|
|||
POPUP "TRAYICON_MENU"
|
||||
BEGIN
|
||||
MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT
|
||||
MENUITEM "&Show Root Window", ID_APP_SHOW_ROOT
|
||||
MENUITEM "&About...", ID_APP_ABOUT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_APP_EXIT
|
||||
END
|
||||
|
@ -85,3 +106,4 @@ END
|
|||
*/
|
||||
|
||||
IDI_XWIN ICON DISCARDABLE "X.ico"
|
||||
IDI_XWIN_BOXED ICON DISCARDABLE "X-boxed.ico"
|
||||
|
|
180
hw/xwin/XWinrc.man
Executable file
180
hw/xwin/XWinrc.man
Executable file
|
@ -0,0 +1,180 @@
|
|||
.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/usr/X11R6/lib/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.
|
||||
|
||||
|
||||
.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.
|
||||
.PP
|
||||
There are three kinds of instructions: miscellaneous, menu, and icon.
|
||||
|
||||
|
||||
.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 specific WM_CLASS or WM_NAME.
|
||||
|
||||
|
||||
.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",nn"\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 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
|
||||
|
||||
|
||||
.SH "SEE ALSO"
|
||||
XWin(1)
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
The XWinrc feature of XWin was written primarily by Earle F. Philhower
|
||||
III.
|
|
@ -40,8 +40,24 @@
|
|||
# ...
|
||||
# }
|
||||
|
||||
# When specifying an ICONFILE in the following commands several different
|
||||
# formats are allowed:
|
||||
# 1. Name of a regular Windows .ico format file
|
||||
# (ex: "cygwin.ico", "apple.ico")
|
||||
# 2. Name and index into a Windows .DLL
|
||||
# (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon
|
||||
# "c:\windows\system32\shell32.dll,5" gives the floppy drive icon)
|
||||
# 3. Index into XWin.EXE internal ICON resource
|
||||
# (ex: ",101" is the 1st icon inside XWin.exe)
|
||||
|
||||
# To define where ICO files live (** Windows path**)
|
||||
# ICONDIRECTORY <windows-path i.e. c:\cygwin\usr\icons>
|
||||
# NOTE: If you specify a fully qualified path to an ICON below
|
||||
# (i.e. "c:\xxx" or "d:\xxxx")
|
||||
# this ICONDIRECTORY will not be prepended
|
||||
|
||||
# To change the taskbar icon use...
|
||||
# TRAYICON <name-of-windows-ico-file-in-icondirectory>
|
||||
|
||||
# To define a replacement for the standard X icon for apps w/o specified icons
|
||||
# DEFAULTICON <name-of-windows-ico-file-in-icondirectory>
|
||||
|
@ -54,6 +70,8 @@
|
|||
# In the case where multiple matches occur, the first listed in the ICONS
|
||||
# section will be chosen.
|
||||
|
||||
# To disable exit confirmation dialog add the line containing SilentExit
|
||||
|
||||
# DEBUG <string> prints out the string to the XWin.log file
|
||||
|
||||
// Below are just some silly menus to demonstrate writing your
|
||||
|
@ -101,5 +119,7 @@ SysMenu {
|
|||
# "xterm" "uninstall.ico"
|
||||
# }
|
||||
|
||||
# SilentExit
|
||||
|
||||
DEBUG "Done parsing the configuration file..."
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* $Id$ */
|
||||
|
||||
#ifndef __WINE_DDRAW_H
|
||||
#define __WINE_DDRAW_H
|
||||
|
|
789
hw/xwin/win.h
789
hw/xwin/win.h
File diff suppressed because it is too large
Load Diff
|
@ -33,7 +33,6 @@
|
|||
#include "win.h"
|
||||
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 58 */
|
||||
/*
|
||||
* Allocate indexes for the privates that we use.
|
||||
|
@ -48,7 +47,7 @@ winAllocatePrivates (ScreenPtr pScreen)
|
|||
winPrivScreenPtr pScreenPriv;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateScreenPrivates - g_ulServerGeneration: %d "
|
||||
winDebug ("winAllocateScreenPrivates - g_ulServerGeneration: %d "
|
||||
"serverGeneration: %d\n",
|
||||
g_ulServerGeneration, serverGeneration);
|
||||
#endif
|
||||
|
@ -120,7 +119,7 @@ Bool
|
|||
winInitCmapPrivates (ColormapPtr pcmap)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInitCmapPrivates\n");
|
||||
winDebug ("winInitCmapPrivates\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -146,7 +145,7 @@ winAllocateCmapPrivates (ColormapPtr pCmap)
|
|||
static unsigned long s_ulPrivateGeneration = 0;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateCmapPrivates\n");
|
||||
winDebug ("winAllocateCmapPrivates\n");
|
||||
#endif
|
||||
|
||||
/* Get a new privates index when the server generation changes */
|
||||
|
@ -174,7 +173,7 @@ winAllocateCmapPrivates (ColormapPtr pCmap)
|
|||
winSetCmapPriv (pCmap, pCmapPriv);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateCmapPrivates - Returning\n");
|
||||
winDebug ("winAllocateCmapPrivates - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
|
129
hw/xwin/winauth.c
Normal file
129
hw/xwin/winauth.c
Normal file
|
@ -0,0 +1,129 @@
|
|||
#if defined(XCSECURITY)
|
||||
/*
|
||||
*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
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
|
||||
/* Includes for authorization */
|
||||
#include "X11/Xauth.h"
|
||||
#define _SECURITY_SERVER
|
||||
#include "X11/extensions/security.h"
|
||||
#include "X11/extensions/securstr.h"
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
|
||||
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
|
||||
XID g_authId = 0;
|
||||
unsigned int g_uiAuthDataLen = 0;
|
||||
char *g_pAuthData = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Generate authorization cookie for internal server clients
|
||||
*/
|
||||
|
||||
Bool
|
||||
winGenerateAuthorization ()
|
||||
{
|
||||
Bool fFreeAuth = FALSE;
|
||||
SecurityAuthorizationPtr pAuth = NULL;
|
||||
|
||||
/* Call OS layer to generate authorization key */
|
||||
g_authId = GenerateAuthorization (strlen (AUTH_NAME),
|
||||
AUTH_NAME,
|
||||
0,
|
||||
NULL,
|
||||
&g_uiAuthDataLen,
|
||||
&g_pAuthData);
|
||||
if ((XID) ~0L == g_authId)
|
||||
{
|
||||
ErrorF ("winGenerateAuthorization - GenerateAuthorization failed\n");
|
||||
goto auth_bailout;
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
ErrorF ("winGenerateAuthorization - GenerateAuthorization success!\n"
|
||||
"AuthDataLen: %d AuthData: %s\n",
|
||||
g_uiAuthDataLen, g_pAuthData);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate structure for additional auth information */
|
||||
pAuth = (SecurityAuthorizationPtr)
|
||||
xalloc (sizeof (SecurityAuthorizationRec));
|
||||
if (!(pAuth))
|
||||
{
|
||||
ErrorF ("winGenerateAuthorization - Failed allocating "
|
||||
"SecurityAuthorizationPtr.\n");
|
||||
goto auth_bailout;
|
||||
}
|
||||
|
||||
/* Fill in the auth fields */
|
||||
pAuth->id = g_authId;
|
||||
pAuth->timeout = 0; /* live for x seconds after refcnt == 0 */
|
||||
pAuth->group = None;
|
||||
pAuth->trustLevel = XSecurityClientTrusted;
|
||||
pAuth->refcnt = 1; /* this auth must stick around */
|
||||
pAuth->secondsRemaining = 0;
|
||||
pAuth->timer = NULL;
|
||||
pAuth->eventClients = NULL;
|
||||
|
||||
/* Add the authorization to the server's auth list */
|
||||
if (!AddResource (g_authId,
|
||||
SecurityAuthorizationResType,
|
||||
pAuth))
|
||||
{
|
||||
ErrorF ("winGenerateAuthorization - AddResource failed for auth.\n");
|
||||
fFreeAuth = TRUE;
|
||||
goto auth_bailout;
|
||||
}
|
||||
|
||||
/* Don't free the auth data, since it is still used internally */
|
||||
pAuth = NULL;
|
||||
|
||||
return TRUE;
|
||||
|
||||
auth_bailout:
|
||||
if (fFreeAuth)
|
||||
xfree (pAuth);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,21 +15,31 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.5 2002/10/17 08:18:22 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "winmsg.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern HWND g_hDlgDepthChange;
|
||||
extern HWND g_hDlgExit;
|
||||
extern HWND g_hDlgAbout;
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 6 */
|
||||
void
|
||||
|
@ -41,12 +51,13 @@ winBlockHandler (int nScreen,
|
|||
winScreenPriv((ScreenPtr)pBlockData);
|
||||
MSG msg;
|
||||
|
||||
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
|
||||
/* Signal threaded modules to begin */
|
||||
if (pScreenPriv != NULL && !pScreenPriv->fServerStarted)
|
||||
{
|
||||
int iReturn;
|
||||
|
||||
ErrorF ("winBlockHandler - Releasing pmServerStarted\n");
|
||||
winDebug ("winBlockHandler - Releasing pmServerStarted\n");
|
||||
|
||||
/* Flag that modules are to be started */
|
||||
pScreenPriv->fServerStarted = TRUE;
|
||||
|
@ -60,10 +71,11 @@ winBlockHandler (int nScreen,
|
|||
goto winBlockHandler_ProcessMessages;
|
||||
}
|
||||
|
||||
ErrorF ("winBlockHandler - pthread_mutex_unlock () returned\n");
|
||||
winDebug ("winBlockHandler - pthread_mutex_unlock () returned\n");
|
||||
}
|
||||
|
||||
winBlockHandler_ProcessMessages:
|
||||
#endif
|
||||
|
||||
/* Process all messages on our queue */
|
||||
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
|
||||
|
@ -71,10 +83,11 @@ winBlockHandler_ProcessMessages:
|
|||
if ((g_hDlgDepthChange == 0
|
||||
|| !IsDialogMessage (g_hDlgDepthChange, &msg))
|
||||
&& (g_hDlgExit == 0
|
||||
|| !IsDialogMessage (g_hDlgExit, &msg)))
|
||||
|| !IsDialogMessage (g_hDlgExit, &msg))
|
||||
&& (g_hDlgAbout == 0
|
||||
|| !IsDialogMessage (g_hDlgAbout, &msg)))
|
||||
{
|
||||
DispatchMessage (&msg);
|
||||
}
|
||||
}
|
||||
winReorderWindowsMultiWindow ((ScreenPtr)pBlockData);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,19 +15,18 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef _WINCLIPBOARD_H_
|
||||
#define _WINCLIPBOARD_H_
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,23 +17,18 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold Hunt
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.5 2002/11/07 10:31:32 alanh Exp $ */
|
||||
|
||||
|
||||
#ifndef _WINCLIPBOARD_H_
|
||||
#define _WINCLIPBOARD_H_
|
||||
|
||||
/* Standard library headers */
|
||||
#include <assert.h>
|
||||
|
@ -44,41 +41,42 @@
|
|||
#include <pthread.h>
|
||||
|
||||
/* X headers */
|
||||
#include "X.h"
|
||||
#include "Xatom.h"
|
||||
#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 "Xproto.h"
|
||||
#include "Xutil.h"
|
||||
#include "Xlocale.h"
|
||||
#include "X11/Xproto.h"
|
||||
#include "X11/Xutil.h"
|
||||
#include "X11/Xlocale.h"
|
||||
|
||||
/* Fixups to prevent collisions between Windows and X headers */
|
||||
#define ATOM DWORD
|
||||
|
||||
/* Windows headers */
|
||||
#ifndef XFree86Server
|
||||
#define XFree86Server
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef XFree86Server
|
||||
|
||||
|
||||
/* Clipboard module constants */
|
||||
#define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip"
|
||||
#define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip"
|
||||
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
|
||||
#define WIN_CONNECT_RETRIES 3
|
||||
#define WIN_CONNECT_RETRIES 40
|
||||
#define WIN_CONNECT_DELAY 4
|
||||
#define WIN_JMP_OKAY 0
|
||||
#define WIN_JMP_ERROR_IO 2
|
||||
#define WIN_LOCAL_PROPERTY "CYGX_CUT_BUFFER"
|
||||
#define WIN_XEVENTS_SUCCESS 0
|
||||
#define WIN_XEVENTS_SHUTDOWN 1
|
||||
#define WIN_XEVENTS_CONVERT 2
|
||||
#define WIN_XEVENTS_NOTIFY 3
|
||||
|
||||
/*
|
||||
* Argument structure for Clipboard module main thread
|
||||
*/
|
||||
|
||||
typedef struct _ClipboardProcArgRec {
|
||||
DWORD dwScreen;
|
||||
pthread_mutex_t *ppmServerStarted;
|
||||
} ClipboardProcArgRec, *ClipboardProcArgPtr;
|
||||
|
||||
#define WM_WM_REINIT (WM_USER + 1)
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
|
@ -86,6 +84,8 @@ typedef struct _ClipboardProcArgRec {
|
|||
|
||||
extern char *display;
|
||||
extern void ErrorF (const char* /*f*/, ...);
|
||||
extern void winDebug (const char *format, ...);
|
||||
extern void winErrorFVerb (int verb, const char *format, ...);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -93,12 +93,10 @@ extern void ErrorF (const char* /*f*/, ...);
|
|||
*/
|
||||
|
||||
Bool
|
||||
winInitClipboard (pthread_t *ptClipboardProc,
|
||||
pthread_mutex_t *ppmServerStarted,
|
||||
DWORD dwScreen);
|
||||
winInitClipboard (void);
|
||||
|
||||
HWND
|
||||
winClipboardCreateMessagingWindow ();
|
||||
winClipboardCreateMessagingWindow (void);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -117,17 +115,18 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
|
|||
*/
|
||||
|
||||
void *
|
||||
winClipboardProc (void *pArg);
|
||||
winClipboardProc (void *);
|
||||
|
||||
void
|
||||
winDeinitClipboard ();
|
||||
winDeinitClipboard (void);
|
||||
|
||||
|
||||
/*
|
||||
* winclipboardunicode.c
|
||||
*/
|
||||
|
||||
Bool
|
||||
winClipboardDetectUnicodeSupport ();
|
||||
winClipboardDetectUnicodeSupport (void);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -146,14 +145,8 @@ winClipboardWindowProc (HWND hwnd, UINT message,
|
|||
* winclipboardxevents.c
|
||||
*/
|
||||
|
||||
Bool
|
||||
int
|
||||
winClipboardFlushXEvents (HWND hwnd,
|
||||
Atom atomClipboard,
|
||||
Atom atomLocalProperty,
|
||||
Atom atomUTF8String,
|
||||
Atom atomCompoundText,
|
||||
Atom atomTargets,
|
||||
Atom atomDeleteWindow,
|
||||
int iWindow,
|
||||
Display *pDisplay,
|
||||
Bool fUnicodeSupport);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,50 +15,63 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */
|
||||
|
||||
#include "dixstruct.h"
|
||||
#include "winclipboard.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local typedefs
|
||||
*/
|
||||
|
||||
typedef int (*winDispatchProcPtr) (ClientPtr);
|
||||
|
||||
DISPATCH_PROC(winProcSetSelectionOwner);
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern pthread_t g_ptClipboardProc;
|
||||
extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
|
||||
extern Bool g_fClipboard;
|
||||
extern HWND g_hwndClipboard;
|
||||
|
||||
|
||||
/*
|
||||
* Intialize the Clipboard module
|
||||
*/
|
||||
|
||||
Bool
|
||||
winInitClipboard (pthread_t *ptClipboardProc,
|
||||
pthread_mutex_t *ppmServerStarted,
|
||||
DWORD dwScreen)
|
||||
winInitClipboard ()
|
||||
{
|
||||
ClipboardProcArgPtr pArg;
|
||||
|
||||
ErrorF ("winInitClipboard ()\n");
|
||||
|
||||
/* Allocate the parameter structure */
|
||||
pArg = (ClipboardProcArgPtr) malloc (sizeof (ClipboardProcArgRec));
|
||||
if (pArg == NULL)
|
||||
/* Wrap some internal server functions */
|
||||
if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner)
|
||||
{
|
||||
ErrorF ("winInitClipboard - malloc for ClipboardProcArgRec failed.\n");
|
||||
return FALSE;
|
||||
winProcSetSelectionOwnerOrig = ProcVector[X_SetSelectionOwner];
|
||||
ProcVector[X_SetSelectionOwner] = winProcSetSelectionOwner;
|
||||
}
|
||||
|
||||
/* Setup the argument structure for the thread function */
|
||||
pArg->dwScreen = dwScreen;
|
||||
pArg->ppmServerStarted = ppmServerStarted;
|
||||
|
||||
/* Spawn a thread for the Clipboard module */
|
||||
if (pthread_create (ptClipboardProc, NULL, winClipboardProc, pArg))
|
||||
if (pthread_create (&g_ptClipboardProc,
|
||||
NULL,
|
||||
winClipboardProc,
|
||||
NULL))
|
||||
{
|
||||
/* Bail if thread creation failed */
|
||||
ErrorF ("winInitClipboard - pthread_create failed.\n");
|
||||
|
@ -76,8 +89,8 @@ winInitClipboard (pthread_t *ptClipboardProc,
|
|||
HWND
|
||||
winClipboardCreateMessagingWindow ()
|
||||
{
|
||||
WNDCLASS wc;
|
||||
HWND hwnd;
|
||||
WNDCLASS wc;
|
||||
HWND hwnd;
|
||||
|
||||
/* Setup our window class */
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
|
@ -104,7 +117,7 @@ winClipboardCreateMessagingWindow ()
|
|||
(HWND) NULL, /* No parent or owner window */
|
||||
(HMENU) NULL, /* No menu */
|
||||
GetModuleHandle (NULL),/* Instance handle */
|
||||
NULL); /* ScreenPrivates */
|
||||
NULL); /* Creation data */
|
||||
assert (hwnd != NULL);
|
||||
|
||||
/* I'm not sure, but we may need to call this to start message processing */
|
||||
|
@ -115,3 +128,13 @@ winClipboardCreateMessagingWindow ()
|
|||
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
void
|
||||
winFixClipboardChain (void)
|
||||
{
|
||||
if (g_fClipboard
|
||||
&& g_hwndClipboard)
|
||||
{
|
||||
PostMessage (g_hwndClipboard, WM_WM_REINIT, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,30 +15,33 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
winClipboardDOStoUNIX (char *pszSrc, int iLength);
|
||||
void
|
||||
winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
|
||||
|
||||
/*
|
||||
* Convert \r\n to \n
|
||||
*
|
||||
* NOTE: This was heavily inspired by, if not down right stolen from,
|
||||
* Cygwin's winsup/cygwin/fhandler.cc/fhandler_base::read ()
|
||||
* NOTE: This was heavily inspired by, Cygwin's
|
||||
* winsup/cygwin/fhandler.cc/fhandler_base::read ()
|
||||
*/
|
||||
|
||||
void
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,27 +15,44 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */
|
||||
|
||||
#include "winclipboard.h"
|
||||
#include "X11/Xauth.h"
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern Bool g_fCalledSetLocale;
|
||||
extern Bool g_fUnicodeClipboard;
|
||||
extern unsigned long serverGeneration;
|
||||
#if defined(XCSECURITY)
|
||||
extern unsigned int g_uiAuthDataLen;
|
||||
extern char *g_pAuthData;
|
||||
#endif
|
||||
extern Bool g_fClipboardStarted;
|
||||
extern HWND g_hwndClipboard;
|
||||
extern void *g_pClipboardDisplay;
|
||||
extern Window g_iClipboardWindow;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -43,7 +60,7 @@ extern Bool g_fCalledSetLocale;
|
|||
*/
|
||||
|
||||
static jmp_buf g_jmpEntry;
|
||||
static Bool g_shutdown = FALSE;
|
||||
Bool g_fUnicodeSupport = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -62,72 +79,28 @@ winClipboardIOErrorHandler (Display *pDisplay);
|
|||
*/
|
||||
|
||||
void *
|
||||
winClipboardProc (void *pArg)
|
||||
winClipboardProc (void *pvNotUsed)
|
||||
{
|
||||
Atom atomClipboard, atomClipboardManager;
|
||||
Atom atomLocalProperty, atomCompoundText;
|
||||
Atom atomUTF8String, atomTargets;
|
||||
int iReturn;
|
||||
HWND hwnd = NULL;
|
||||
int iConnectionNumber;
|
||||
int fdMessageQueue;
|
||||
int iConnectionNumber = 0;
|
||||
int fdMessageQueue = 0;
|
||||
fd_set fdsRead;
|
||||
int iMaxDescriptor;
|
||||
Display *pDisplay;
|
||||
Window iWindow;
|
||||
Atom atomDeleteWindow;
|
||||
Bool fReturn;
|
||||
Display *pDisplay = NULL;
|
||||
Window iWindow = None;
|
||||
int iRetries;
|
||||
Bool fUnicodeSupport;
|
||||
char szDisplay[512];
|
||||
ClipboardProcArgPtr pProcArg = (ClipboardProcArgPtr) pArg;
|
||||
|
||||
ErrorF ("winClipboardProc - Hello\n");
|
||||
|
||||
/* Check that argument pointer is not invalid */
|
||||
if (pArg == NULL)
|
||||
{
|
||||
ErrorF ("winClipboardProc - pArg is NULL, bailing.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winClipboardProc - Calling pthread_mutex_lock ()\n");
|
||||
|
||||
/* Grab the server started mutex - pause until we get it */
|
||||
iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
ErrorF ("winClipboardProc - pthread_mutex_lock () failed: %d\n",
|
||||
iReturn);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winClipboardProc - pthread_mutex_lock () returned.\n");
|
||||
|
||||
/* Do we have Unicode support? */
|
||||
fUnicodeSupport = winClipboardDetectUnicodeSupport ();
|
||||
fUnicodeSupport = g_fUnicodeClipboard && winClipboardDetectUnicodeSupport ();
|
||||
|
||||
/* Set the current locale? What does this do? */
|
||||
if (fUnicodeSupport && !g_fCalledSetLocale)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Calling setlocale ()\n");
|
||||
if (!setlocale (LC_ALL, ""))
|
||||
{
|
||||
ErrorF ("winClipboardProc - setlocale () error\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
ErrorF ("winClipboardProc - setlocale () returned\n");
|
||||
|
||||
/* See if X supports the current locale */
|
||||
if (XSupportsLocale () == False)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Locale not supported by X\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Flag that we have called setlocale */
|
||||
g_fCalledSetLocale = TRUE;
|
||||
/* Save the Unicode support flag in a global */
|
||||
g_fUnicodeSupport = fUnicodeSupport;
|
||||
|
||||
/* Allow multiple threads to access Xlib */
|
||||
if (XInitThreads () == 0)
|
||||
|
@ -136,12 +109,12 @@ winClipboardProc (void *pArg)
|
|||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winClipboardProc - XInitThreads () returned.\n");
|
||||
|
||||
/* Release the server started mutex */
|
||||
pthread_mutex_unlock (pProcArg->ppmServerStarted);
|
||||
|
||||
ErrorF ("winClipboardProc - pthread_mutex_unlock () returned.\n");
|
||||
/* See if X supports the current locale */
|
||||
if (XSupportsLocale () == False)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Locale not supported by X. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Set jump point for Error exits */
|
||||
iReturn = setjmp (g_jmpEntry);
|
||||
|
@ -155,26 +128,40 @@ winClipboardProc (void *pArg)
|
|||
iReturn);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
else if (g_shutdown)
|
||||
{
|
||||
/* Shutting down, the X server severed out connection! */
|
||||
ErrorF ("winClipboardProc - Detected shutdown in progress\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
else if (iReturn == WIN_JMP_ERROR_IO)
|
||||
{
|
||||
ErrorF ("winClipboardProc - setjmp returned and hwnd: %08x\n", hwnd);
|
||||
/* TODO: Cleanup the Win32 window and free any allocated memory */
|
||||
ErrorF ("winClipboardProc - setjmp returned for IO Error Handler.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
#if defined(XCSECURITY)
|
||||
/* Use our generated cookie for authentication */
|
||||
XSetAuthorization (AUTH_NAME,
|
||||
strlen (AUTH_NAME),
|
||||
g_pAuthData,
|
||||
g_uiAuthDataLen);
|
||||
#endif
|
||||
|
||||
/* Set error handler */
|
||||
XSetErrorHandler (winClipboardErrorHandler);
|
||||
XSetIOErrorHandler (winClipboardIOErrorHandler);
|
||||
|
||||
/* Initialize retry count */
|
||||
iRetries = 0;
|
||||
|
||||
/* Setup the display connection string x */
|
||||
/*
|
||||
* NOTE: Always connect to screen 0 since we require that screen
|
||||
* numbers start at 0 and increase without gaps. We only need
|
||||
* to connect to one screen on the display to get events
|
||||
* for all screens on the display. That is why there is only
|
||||
* one clipboard client thread.
|
||||
*/
|
||||
snprintf (szDisplay,
|
||||
512,
|
||||
"127.0.0.1:%s.%d",
|
||||
display,
|
||||
(int) pProcArg->dwScreen);
|
||||
"127.0.0.1:%s.0",
|
||||
display);
|
||||
|
||||
/* Print the display connection string */
|
||||
ErrorF ("winClipboardProc - DISPLAY=%s\n", szDisplay);
|
||||
|
@ -204,12 +191,12 @@ winClipboardProc (void *pArg)
|
|||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Save the display in the screen privates */
|
||||
g_pClipboardDisplay = pDisplay;
|
||||
|
||||
ErrorF ("winClipboardProc - XOpenDisplay () returned and "
|
||||
"successfully opened the display.\n");
|
||||
|
||||
/* Create Windows messaging window */
|
||||
hwnd = winClipboardCreateMessagingWindow ();
|
||||
|
||||
/* Get our connection number */
|
||||
iConnectionNumber = ConnectionNumber (pDisplay);
|
||||
|
||||
|
@ -233,6 +220,13 @@ winClipboardProc (void *pArg)
|
|||
ErrorF ("winClipboardProc - XSelectInput generated BadWindow "
|
||||
"on RootWindow\n\n");
|
||||
|
||||
/* Create atoms */
|
||||
atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
|
||||
atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
|
||||
|
||||
/* FIXME: Save some values as globals for the window proc */
|
||||
g_fUnicodeSupport = fUnicodeSupport;
|
||||
|
||||
/* Create a messaging window */
|
||||
iWindow = XCreateSimpleWindow (pDisplay,
|
||||
DefaultRootWindow (pDisplay),
|
||||
|
@ -243,27 +237,24 @@ winClipboardProc (void *pArg)
|
|||
BlackPixel (pDisplay, 0));
|
||||
if (iWindow == 0)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create a window\n");
|
||||
ErrorF ("winClipboardProc - Could not create an X window.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* This looks like our only hope for getting a message before shutdown */
|
||||
/* Register for WM_DELETE_WINDOW message from window manager */
|
||||
atomDeleteWindow = XInternAtom (pDisplay, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols (pDisplay, iWindow, &atomDeleteWindow, 1);
|
||||
#if 0
|
||||
ErrorF ("winClipboardProc - iWindow: %d\n", iWindow);
|
||||
#endif
|
||||
|
||||
/* Set error handler */
|
||||
XSetErrorHandler (winClipboardErrorHandler);
|
||||
XSetIOErrorHandler (winClipboardIOErrorHandler);
|
||||
/* Save the window in the screen privates */
|
||||
g_iClipboardWindow = iWindow;
|
||||
|
||||
/* Create an atom for CLIPBOARD_MANAGER */
|
||||
atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
|
||||
if (atomClipboardManager == None)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create CLIPBOARD_MANAGER atom\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
/* Create Windows messaging window */
|
||||
hwnd = winClipboardCreateMessagingWindow ();
|
||||
|
||||
/* Save copy of HWND in screen privates */
|
||||
g_hwndClipboard = hwnd;
|
||||
|
||||
#if 0
|
||||
/* Assert ownership of CLIPBOARD_MANAGER */
|
||||
iReturn = XSetSelectionOwner (pDisplay, atomClipboardManager,
|
||||
iWindow, CurrentTime);
|
||||
|
@ -272,63 +263,28 @@ winClipboardProc (void *pArg)
|
|||
ErrorF ("winClipboardProc - Could not set CLIPBOARD_MANAGER owner\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Create an atom for CLIPBOARD */
|
||||
atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
|
||||
if (atomClipboard == None)
|
||||
/* Assert ownership of selections if Win32 clipboard is owned */
|
||||
if (NULL != GetClipboardOwner ())
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create CLIPBOARD atom\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
/* PRIMARY */
|
||||
iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
|
||||
iWindow, CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Assert ownership of CLIPBOARD */
|
||||
iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
|
||||
iWindow, CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Assert ownership of PRIMARY */
|
||||
iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
|
||||
iWindow, CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Local property to hold pasted data */
|
||||
atomLocalProperty = XInternAtom (pDisplay, "CYGX_CUT_BUFFER", False);
|
||||
if (atomLocalProperty == None)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create CYGX_CUT_BUFFER atom\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Create an atom for UTF8_STRING */
|
||||
atomUTF8String = XInternAtom (pDisplay, "UTF8_STRING", False);
|
||||
if (atomUTF8String == None)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create UTF8_STRING atom\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Create an atom for COMPOUND_TEXT */
|
||||
atomCompoundText = XInternAtom (pDisplay, "COMPOUND_TEXT", False);
|
||||
if (atomCompoundText == None)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create COMPOUND_TEXT atom\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Create an atom for TARGETS */
|
||||
atomTargets = XInternAtom (pDisplay, "TARGETS", False);
|
||||
if (atomTargets == None)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not create TARGETS atom\n");
|
||||
pthread_exit (NULL);
|
||||
/* CLIPBOARD */
|
||||
iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
|
||||
iWindow, CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Pre-flush X events */
|
||||
|
@ -338,12 +294,6 @@ winClipboardProc (void *pArg)
|
|||
* already.
|
||||
*/
|
||||
winClipboardFlushXEvents (hwnd,
|
||||
atomClipboard,
|
||||
atomLocalProperty,
|
||||
atomUTF8String,
|
||||
atomCompoundText,
|
||||
atomTargets,
|
||||
atomDeleteWindow,
|
||||
iWindow,
|
||||
pDisplay,
|
||||
fUnicodeSupport);
|
||||
|
@ -352,6 +302,9 @@ winClipboardProc (void *pArg)
|
|||
if (!winClipboardFlushWindowsMessageQueue (hwnd))
|
||||
return 0;
|
||||
|
||||
/* Signal that the clipboard client has started */
|
||||
g_fClipboardStarted = TRUE;
|
||||
|
||||
/* Loop for X events */
|
||||
while (1)
|
||||
{
|
||||
|
@ -377,7 +330,7 @@ winClipboardProc (void *pArg)
|
|||
"Bailing.\n", iReturn);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Branch on which descriptor became active */
|
||||
if (FD_ISSET (iConnectionNumber, &fdsRead))
|
||||
{
|
||||
|
@ -388,20 +341,14 @@ winClipboardProc (void *pArg)
|
|||
|
||||
/* Process X events */
|
||||
/* Exit when we see that server is shutting down */
|
||||
fReturn = winClipboardFlushXEvents (hwnd,
|
||||
atomClipboard,
|
||||
atomLocalProperty,
|
||||
atomUTF8String,
|
||||
atomCompoundText,
|
||||
atomTargets,
|
||||
atomDeleteWindow,
|
||||
iReturn = winClipboardFlushXEvents (hwnd,
|
||||
iWindow,
|
||||
pDisplay,
|
||||
fUnicodeSupport);
|
||||
if (!fReturn)
|
||||
if (WIN_XEVENTS_SHUTDOWN == iReturn)
|
||||
{
|
||||
ErrorF ("winClipboardProc - Caught WM_DELETE_WINDOW - "
|
||||
"shutting down\n");
|
||||
ErrorF ("winClipboardProc - winClipboardFlushXEvents "
|
||||
"trapped shutdown event, exiting main loop.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -413,14 +360,58 @@ winClipboardProc (void *pArg)
|
|||
#if 0
|
||||
ErrorF ("winClipboardProc - Windows event ready\n");
|
||||
#endif
|
||||
|
||||
|
||||
/* Process Windows messages */
|
||||
if (!winClipboardFlushWindowsMessageQueue (hwnd))
|
||||
break;
|
||||
{
|
||||
ErrorF ("winClipboardProc - "
|
||||
"winClipboardFlushWindowsMessageQueue trapped "
|
||||
"WM_QUIT message, exiting main loop.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Close our X window */
|
||||
if (pDisplay && iWindow)
|
||||
{
|
||||
iReturn = XDestroyWindow (pDisplay, iWindow);
|
||||
if (iReturn == BadWindow)
|
||||
ErrorF ("winClipboardProc - XDestroyWindow returned BadWindow.\n");
|
||||
else
|
||||
ErrorF ("winClipboardProc - XDestroyWindow succeeded.\n");
|
||||
}
|
||||
|
||||
/* Close our Win32 message handle */
|
||||
if (fdMessageQueue)
|
||||
close (fdMessageQueue);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* FIXME: XCloseDisplay hangs if we call it, as of 2004/03/26. The
|
||||
* XSync and XSelectInput calls did not help.
|
||||
*/
|
||||
|
||||
/* Discard any remaining events */
|
||||
XSync (pDisplay, TRUE);
|
||||
|
||||
/* Select event types to watch */
|
||||
XSelectInput (pDisplay,
|
||||
DefaultRootWindow (pDisplay),
|
||||
None);
|
||||
|
||||
/* Close our X display */
|
||||
if (pDisplay)
|
||||
{
|
||||
XCloseDisplay (pDisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_iClipboardWindow = None;
|
||||
g_pClipboardDisplay = NULL;
|
||||
g_hwndClipboard = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,19 +430,6 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
|||
sizeof (pszErrorMsg));
|
||||
ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n", pszErrorMsg);
|
||||
|
||||
if (pErr->error_code == BadWindow
|
||||
|| pErr->error_code == BadMatch
|
||||
|| pErr->error_code == BadDrawable)
|
||||
{
|
||||
#if 0
|
||||
pthread_exit (NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
pthread_exit (NULL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -463,22 +441,10 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
|||
static int
|
||||
winClipboardIOErrorHandler (Display *pDisplay)
|
||||
{
|
||||
printf ("\nwinClipboardIOErrorHandler!\n\n");
|
||||
ErrorF ("\nwinClipboardIOErrorHandler!\n\n");
|
||||
|
||||
/* Restart at the main entry point */
|
||||
longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Notify the clipboard thread we're exiting and not to reconnect
|
||||
*/
|
||||
|
||||
void
|
||||
winDeinitClipboard ()
|
||||
{
|
||||
ErrorF ("winDeinitClipboard - Noting shutdown in progress\n");
|
||||
g_shutdown = TRUE;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,21 +15,20 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "winclipboard.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -38,13 +37,12 @@
|
|||
*/
|
||||
|
||||
Bool
|
||||
winClipboardDetectUnicodeSupport ()
|
||||
winClipboardDetectUnicodeSupport (void)
|
||||
{
|
||||
Bool fReturn = FALSE;
|
||||
OSVERSIONINFO osvi;
|
||||
OSVERSIONINFO osvi = {0};
|
||||
|
||||
/* Get operating system version information */
|
||||
ZeroMemory (&osvi, sizeof (osvi));
|
||||
osvi.dwOSVersionInfoSize = sizeof (osvi);
|
||||
GetVersionEx (&osvi);
|
||||
|
||||
|
@ -52,13 +50,13 @@ winClipboardDetectUnicodeSupport ()
|
|||
switch (osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
/* Engine 4 is supported on NT only */
|
||||
/* Unicode supported on NT only */
|
||||
ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n");
|
||||
fReturn = TRUE;
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
/* Engine 4 is supported on NT only */
|
||||
/* Unicode is not supported on non-NT */
|
||||
ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n");
|
||||
fReturn = FALSE;
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,23 +15,120 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */
|
||||
|
||||
#include "winclipboard.h"
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#define WIN_CLIPBOARD_PROP "cyg_clipboard_prop"
|
||||
#define WIN_POLL_TIMEOUT 1
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern Bool g_fUnicodeSupport;
|
||||
extern void *g_pClipboardDisplay;
|
||||
extern Window g_iClipboardWindow;
|
||||
extern Atom g_atomLastOwnedSelection;
|
||||
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
|
||||
Bool fUnicodeSupport, int iTimeoutSec);
|
||||
|
||||
|
||||
/*
|
||||
* Process X events up to specified timeout
|
||||
*/
|
||||
|
||||
static int
|
||||
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
|
||||
Bool fUnicodeSupport, int iTimeoutSec)
|
||||
{
|
||||
int iConnNumber;
|
||||
struct timeval tv;
|
||||
int iReturn;
|
||||
DWORD dwStopTime = (GetTickCount () / 1000) + iTimeoutSec;
|
||||
|
||||
/* We need to ensure that all pending events are processed */
|
||||
XSync (pDisplay, FALSE);
|
||||
|
||||
/* Get our connection number */
|
||||
iConnNumber = ConnectionNumber (pDisplay);
|
||||
|
||||
/* Loop for X events */
|
||||
while (1)
|
||||
{
|
||||
fd_set fdsRead;
|
||||
|
||||
/* Setup the file descriptor set */
|
||||
FD_ZERO (&fdsRead);
|
||||
FD_SET (iConnNumber, &fdsRead);
|
||||
|
||||
/* Adjust timeout */
|
||||
tv.tv_sec = dwStopTime - (GetTickCount () / 1000);
|
||||
tv.tv_usec = 0;
|
||||
|
||||
/* Break out if no time left */
|
||||
if (tv.tv_sec < 0)
|
||||
return WIN_XEVENTS_SUCCESS;
|
||||
|
||||
/* Wait for a Windows event or an X event */
|
||||
iReturn = select (iConnNumber + 1,/* Highest fds number */
|
||||
&fdsRead, /* Read mask */
|
||||
NULL, /* No write mask */
|
||||
NULL, /* No exception mask */
|
||||
&tv); /* No timeout */
|
||||
if (iReturn <= 0)
|
||||
{
|
||||
ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d. "
|
||||
"Bailing.\n", iReturn);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Branch on which descriptor became active */
|
||||
if (FD_ISSET (iConnNumber, &fdsRead))
|
||||
{
|
||||
/* Process X events */
|
||||
/* Exit when we see that server is shutting down */
|
||||
iReturn = winClipboardFlushXEvents (hwnd,
|
||||
iWindow,
|
||||
pDisplay,
|
||||
fUnicodeSupport);
|
||||
if (WIN_XEVENTS_NOTIFY == iReturn
|
||||
|| WIN_XEVENTS_CONVERT == iReturn)
|
||||
{
|
||||
/* Bail out if convert or notify processed */
|
||||
return iReturn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return WIN_XEVENTS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process a given Windows message
|
||||
*/
|
||||
|
@ -40,18 +137,413 @@ LRESULT CALLBACK
|
|||
winClipboardWindowProc (HWND hwnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HWND s_hwndNextViewer;
|
||||
static Bool s_fCBCInitialized;
|
||||
|
||||
/* Branch on message type */
|
||||
switch (message)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
{
|
||||
winDebug ("winClipboardWindowProc - WM_DESTROY\n");
|
||||
|
||||
/* Remove ourselves from the clipboard chain */
|
||||
ChangeClipboardChain (hwnd, s_hwndNextViewer);
|
||||
|
||||
s_hwndNextViewer = NULL;
|
||||
|
||||
PostQuitMessage (0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
case WM_CREATE:
|
||||
#if 0
|
||||
ErrorF ("WindowProc - WM_CREATE\n");
|
||||
#endif
|
||||
{
|
||||
winDebug ("winClipboardWindowProc - WM_CREATE\n");
|
||||
|
||||
/* Add ourselves to the clipboard viewer chain */
|
||||
s_hwndNextViewer = SetClipboardViewer (hwnd);
|
||||
if (s_hwndNextViewer == hwnd)
|
||||
{
|
||||
s_hwndNextViewer = NULL;
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_CREATE: "
|
||||
"attempted to set next window to ourselves.");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
case WM_CHANGECBCHAIN:
|
||||
{
|
||||
static Bool s_fProcessingChangeCBChain = FALSE;
|
||||
winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
|
||||
"lParam(%x) s_hwndNextViewer(%x)\n",
|
||||
wParam, lParam, s_hwndNextViewer);
|
||||
|
||||
|
||||
/*
|
||||
* We've occasionally seen a loop in the clipboard chain. Break
|
||||
* it on the first hint of recursion.
|
||||
*/
|
||||
if (! s_fProcessingChangeCBChain)
|
||||
{
|
||||
s_fProcessingChangeCBChain = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_CHANGECBCHAIN - "
|
||||
"Nested calls detected. Bailing.\n");
|
||||
winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((HWND) wParam == s_hwndNextViewer)
|
||||
{
|
||||
s_hwndNextViewer = (HWND) lParam;
|
||||
if (s_hwndNextViewer == hwnd)
|
||||
{
|
||||
s_hwndNextViewer = NULL;
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_CHANGECBCHAIN: "
|
||||
"attempted to set next window to ourselves.");
|
||||
}
|
||||
}
|
||||
else if (s_hwndNextViewer)
|
||||
SendMessage (s_hwndNextViewer, message,
|
||||
wParam, lParam);
|
||||
|
||||
s_fProcessingChangeCBChain = FALSE;
|
||||
}
|
||||
winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
|
||||
return 0;
|
||||
|
||||
case WM_WM_REINIT:
|
||||
{
|
||||
/* Ensure that we're in the clipboard chain. Some apps,
|
||||
* WinXP's remote desktop for one, don't play nice with the
|
||||
* chain. This message is called whenever we receive a
|
||||
* WM_ACTIVATEAPP message to ensure that we continue to
|
||||
* receive clipboard messages.
|
||||
*
|
||||
* It might be possible to detect if we're still in the chain
|
||||
* by calling SendMessage (GetClipboardViewer(),
|
||||
* WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the
|
||||
* WM_DRAWCLIPBOARD message. That, however, might be more
|
||||
* expensive than just putting ourselves back into the chain.
|
||||
*/
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
|
||||
if (hwnd != GetClipboardViewer ())
|
||||
{
|
||||
winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head "
|
||||
"of chain\n", hwnd, s_hwndNextViewer);
|
||||
s_fCBCInitialized = FALSE;
|
||||
ChangeClipboardChain (hwnd, s_hwndNextViewer);
|
||||
s_hwndNextViewer = NULL;
|
||||
s_fCBCInitialized = FALSE;
|
||||
winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n");
|
||||
s_hwndNextViewer = SetClipboardViewer (hwnd);
|
||||
if (s_hwndNextViewer == hwnd)
|
||||
{
|
||||
s_hwndNextViewer = NULL;
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_WM_REINIT: "
|
||||
"attempted to set next window to ourselves.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
winDebug (" WM_WM_REINIT: already at head of viewer chain.\n");
|
||||
}
|
||||
}
|
||||
winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
|
||||
return 0;
|
||||
|
||||
|
||||
case WM_DRAWCLIPBOARD:
|
||||
{
|
||||
static Bool s_fProcessingDrawClipboard = FALSE;
|
||||
Display *pDisplay = g_pClipboardDisplay;
|
||||
Window iWindow = g_iClipboardWindow;
|
||||
int iReturn;
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
|
||||
|
||||
/*
|
||||
* We've occasionally seen a loop in the clipboard chain. Break
|
||||
* it on the first hint of recursion.
|
||||
*/
|
||||
if (! s_fProcessingDrawClipboard)
|
||||
{
|
||||
s_fProcessingDrawClipboard = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Nested calls detected. Bailing.\n");
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Pass the message on the next window in the clipboard viewer chain */
|
||||
if (s_hwndNextViewer)
|
||||
SendMessage (s_hwndNextViewer, message, 0, 0);
|
||||
|
||||
/* Bail on first message */
|
||||
if (!s_fCBCInitialized)
|
||||
{
|
||||
s_fCBCInitialized = TRUE;
|
||||
s_fProcessingDrawClipboard = FALSE;
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: We cannot bail out when NULL == GetClipboardOwner ()
|
||||
* because some applications deal with the clipboard in a manner
|
||||
* that causes the clipboard owner to be NULL when they are in
|
||||
* fact taking ownership. One example of this is the Win32
|
||||
* native compile of emacs.
|
||||
*/
|
||||
|
||||
/* Bail when we still own the clipboard */
|
||||
if (hwnd == GetClipboardOwner ())
|
||||
{
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"We own the clipboard, returning.\n");
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
|
||||
s_fProcessingDrawClipboard = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not take ownership of the X11 selections when something
|
||||
* other than CF_TEXT or CF_UNICODETEXT has been copied
|
||||
* into the Win32 clipboard.
|
||||
*/
|
||||
if (!IsClipboardFormatAvailable (CF_TEXT)
|
||||
&& !IsClipboardFormatAvailable (CF_UNICODETEXT))
|
||||
{
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Clipboard does not contain CF_TEXT nor "
|
||||
"CF_UNICODETEXT.\n");
|
||||
|
||||
/*
|
||||
* We need to make sure that the X Server has processed
|
||||
* previous XSetSelectionOwner messages.
|
||||
*/
|
||||
XSync (pDisplay, FALSE);
|
||||
|
||||
/* Release PRIMARY selection if owned */
|
||||
iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
|
||||
if (iReturn == g_iClipboardWindow)
|
||||
{
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"PRIMARY selection is owned by us.\n");
|
||||
XSetSelectionOwner (pDisplay,
|
||||
XA_PRIMARY,
|
||||
None,
|
||||
CurrentTime);
|
||||
}
|
||||
else if (BadWindow == iReturn || BadAtom == iReturn)
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"XGetSelection failed for PRIMARY: %d\n", iReturn);
|
||||
|
||||
/* Release CLIPBOARD selection if owned */
|
||||
iReturn = XGetSelectionOwner (pDisplay,
|
||||
XInternAtom (pDisplay,
|
||||
"CLIPBOARD",
|
||||
False));
|
||||
if (iReturn == g_iClipboardWindow)
|
||||
{
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"CLIPBOARD selection is owned by us.\n");
|
||||
XSetSelectionOwner (pDisplay,
|
||||
XInternAtom (pDisplay,
|
||||
"CLIPBOARD",
|
||||
False),
|
||||
None,
|
||||
CurrentTime);
|
||||
}
|
||||
else if (BadWindow == iReturn || BadAtom == iReturn)
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"XGetSelection failed for CLIPBOARD: %d\n", iReturn);
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
|
||||
s_fProcessingDrawClipboard = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reassert ownership of PRIMARY */
|
||||
iReturn = XSetSelectionOwner (pDisplay,
|
||||
XA_PRIMARY,
|
||||
iWindow,
|
||||
CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Could not reassert ownership of PRIMARY\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Reasserted ownership of PRIMARY\n");
|
||||
}
|
||||
|
||||
/* Reassert ownership of the CLIPBOARD */
|
||||
iReturn = XSetSelectionOwner (pDisplay,
|
||||
XInternAtom (pDisplay,
|
||||
"CLIPBOARD",
|
||||
False),
|
||||
iWindow,
|
||||
CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Could not reassert ownership of CLIPBOARD\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Reasserted ownership of CLIPBOARD\n");
|
||||
}
|
||||
|
||||
/* Flush the pending SetSelectionOwner event now */
|
||||
XFlush (pDisplay);
|
||||
|
||||
s_fProcessingDrawClipboard = FALSE;
|
||||
}
|
||||
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
|
||||
return 0;
|
||||
|
||||
|
||||
case WM_DESTROYCLIPBOARD:
|
||||
/*
|
||||
* NOTE: Intentionally do nothing.
|
||||
* Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
|
||||
* above. We only process this message to conform to the specs
|
||||
* for delayed clipboard rendering in Win32. You might think
|
||||
* that we need to release ownership of the X11 selections, but
|
||||
* we do not, because a WM_DRAWCLIPBOARD message will closely
|
||||
* follow this message and reassert ownership of the X11
|
||||
* selections, handling the issue for us.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
|
||||
case WM_RENDERFORMAT:
|
||||
case WM_RENDERALLFORMATS:
|
||||
{
|
||||
int iReturn;
|
||||
Display *pDisplay = g_pClipboardDisplay;
|
||||
Window iWindow = g_iClipboardWindow;
|
||||
Bool fConvertToUnicode;
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Hello.\n");
|
||||
|
||||
/* Flag whether to convert to Unicode or not */
|
||||
if (message == WM_RENDERALLFORMATS)
|
||||
fConvertToUnicode = FALSE;
|
||||
else
|
||||
fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
|
||||
|
||||
/* Request the selection contents */
|
||||
iReturn = XConvertSelection (pDisplay,
|
||||
g_atomLastOwnedSelection,
|
||||
XInternAtom (pDisplay,
|
||||
"COMPOUND_TEXT", False),
|
||||
XInternAtom (pDisplay,
|
||||
"CYGX_CUT_BUFFER", False),
|
||||
iWindow,
|
||||
CurrentTime);
|
||||
if (iReturn == BadAtom || iReturn == BadWindow)
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMAT - "
|
||||
"XConvertSelection () failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Special handling for WM_RENDERALLFORMATS */
|
||||
if (message == WM_RENDERALLFORMATS)
|
||||
{
|
||||
/* We must open and empty the clipboard */
|
||||
|
||||
/* Close clipboard if we have it open already */
|
||||
if (GetOpenClipboardWindow () == hwnd)
|
||||
{
|
||||
CloseClipboard ();
|
||||
}
|
||||
|
||||
if (!OpenClipboard (hwnd))
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
|
||||
"OpenClipboard () failed: %08x\n",
|
||||
GetLastError ());
|
||||
break;
|
||||
}
|
||||
|
||||
if (!EmptyClipboard ())
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
|
||||
"EmptyClipboard () failed: %08x\n",
|
||||
GetLastError ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Process the SelectionNotify event */
|
||||
iReturn = winProcessXEventsTimeout (hwnd,
|
||||
iWindow,
|
||||
pDisplay,
|
||||
fConvertToUnicode,
|
||||
WIN_POLL_TIMEOUT);
|
||||
if (WIN_XEVENTS_CONVERT == iReturn)
|
||||
{
|
||||
/*
|
||||
* The selection was offered for conversion first, so we have
|
||||
* to process a second SelectionNotify event to get the actual
|
||||
* data in the selection.
|
||||
*/
|
||||
iReturn = winProcessXEventsTimeout (hwnd,
|
||||
iWindow,
|
||||
pDisplay,
|
||||
fConvertToUnicode,
|
||||
WIN_POLL_TIMEOUT);
|
||||
}
|
||||
|
||||
/*
|
||||
* The last of the up-to two calls to winProcessXEventsTimeout
|
||||
* from above had better have seen a notify event, or else we
|
||||
* are dealing with a buggy or old X11 app. In these cases we
|
||||
* have to paste some fake data to the Win32 clipboard to
|
||||
* satisfy the requirement that we write something to it.
|
||||
*/
|
||||
if (WIN_XEVENTS_NOTIFY != iReturn)
|
||||
{
|
||||
/* Paste no data, to satisfy required call to SetClipboardData */
|
||||
if (fConvertToUnicode)
|
||||
SetClipboardData (CF_UNICODETEXT, NULL);
|
||||
else
|
||||
SetClipboardData (CF_TEXT, NULL);
|
||||
}
|
||||
|
||||
/* Special handling for WM_RENDERALLFORMATS */
|
||||
if (message == WM_RENDERALLFORMATS)
|
||||
{
|
||||
/* We must close the clipboard */
|
||||
|
||||
if (!CloseClipboard ())
|
||||
{
|
||||
winErrorFVerb (1, "winClipboardWindowProc - WM_RENDERALLFORMATS - "
|
||||
"CloseClipboard () failed: %08x\n",
|
||||
GetLastError ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Let Windows perform default processing for unhandled messages */
|
||||
|
|
541
hw/xwin/winclipboardwrappers.c
Executable file
541
hw/xwin/winclipboardwrappers.c
Executable file
|
@ -0,0 +1,541 @@
|
|||
/*
|
||||
*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
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
#include "dixstruct.h"
|
||||
#include "X11/Xatom.h"
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#define CLIP_NUM_SELECTIONS 2
|
||||
#define CLIP_OWN_PRIMARY 0
|
||||
#define CLIP_OWN_CLIPBOARD 1
|
||||
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
DISPATCH_PROC(winProcEstablishConnection);
|
||||
DISPATCH_PROC(winProcQueryTree);
|
||||
DISPATCH_PROC(winProcSetSelectionOwner);
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern Bool g_fUnicodeSupport;
|
||||
extern int g_iNumScreens;
|
||||
extern unsigned int g_uiAuthDataLen;
|
||||
extern char *g_pAuthData;
|
||||
extern Bool g_fXdmcpEnabled;
|
||||
extern Bool g_fClipboardLaunched;
|
||||
extern Bool g_fClipboardStarted;
|
||||
extern Bool g_fClipboard;
|
||||
extern Window g_iClipboardWindow;
|
||||
extern Atom g_atomLastOwnedSelection;
|
||||
extern HWND g_hwndClipboard;
|
||||
|
||||
extern winDispatchProcPtr winProcEstablishConnectionOrig;
|
||||
extern winDispatchProcPtr winProcQueryTreeOrig;
|
||||
extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
|
||||
|
||||
|
||||
/*
|
||||
* Wrapper for internal QueryTree function.
|
||||
* Hides the clipboard client when it is the only client remaining.
|
||||
*/
|
||||
|
||||
int
|
||||
winProcQueryTree (ClientPtr client)
|
||||
{
|
||||
int iReturn;
|
||||
|
||||
/*
|
||||
* This procedure is only used for initialization.
|
||||
* We can unwrap the original procedure at this point
|
||||
* so that this function is no longer called until the
|
||||
* server resets and the function is wrapped again.
|
||||
*/
|
||||
ProcVector[X_QueryTree] = winProcQueryTreeOrig;
|
||||
|
||||
/*
|
||||
* Call original function and bail if it fails.
|
||||
* NOTE: We must do this first, since we need XdmcpOpenDisplay
|
||||
* to be called before we initialize our clipboard client.
|
||||
*/
|
||||
iReturn = (*winProcQueryTreeOrig) (client);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
ErrorF ("winProcQueryTree - ProcQueryTree failed, bailing.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/* Make errors more obvious */
|
||||
winProcQueryTreeOrig = NULL;
|
||||
|
||||
/* Do nothing if clipboard is not enabled */
|
||||
if (!g_fClipboard)
|
||||
{
|
||||
ErrorF ("winProcQueryTree - Clipboard is not enabled, "
|
||||
"returning.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/* If the clipboard client has already been started, abort */
|
||||
if (g_fClipboardLaunched)
|
||||
{
|
||||
ErrorF ("winProcQueryTree - Clipboard client already "
|
||||
"launched, returning.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/* Startup the clipboard client if clipboard mode is being used */
|
||||
if (g_fXdmcpEnabled && g_fClipboard)
|
||||
{
|
||||
/*
|
||||
* NOTE: The clipboard client is started here for a reason:
|
||||
* 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
|
||||
* 2) If the clipboard client attaches during X Server startup,
|
||||
* then it becomes the "magic client" that causes the X Server
|
||||
* to reset if it exits.
|
||||
* 3) XDMCP calls KillAllClients when it starts up.
|
||||
* 4) The clipboard client is a client, so it is killed.
|
||||
* 5) The clipboard client is the "magic client", so the X Server
|
||||
* resets itself.
|
||||
* 6) This repeats ad infinitum.
|
||||
* 7) We avoid this by waiting until at least one client (could
|
||||
* be XDM, could be another client) connects, which makes it
|
||||
* almost certain that the clipboard client will not connect
|
||||
* until after XDM when using XDMCP.
|
||||
* 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 first call
|
||||
* to ProcQueryTree before we startup the clipboard client.
|
||||
* This should prevent XDM from finding the clipboard client,
|
||||
* since it has not yet created a window.
|
||||
* 11)Startup when not using XDMCP is handled in
|
||||
* winProcEstablishConnection.
|
||||
*/
|
||||
|
||||
/* Create the clipboard client thread */
|
||||
if (!winInitClipboard ())
|
||||
{
|
||||
ErrorF ("winProcQueryTree - winClipboardInit "
|
||||
"failed.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
ErrorF ("winProcQueryTree - winInitClipboard returned.\n");
|
||||
}
|
||||
|
||||
/* Flag that clipboard client has been launched */
|
||||
g_fClipboardLaunched = TRUE;
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wrapper for internal EstablishConnection function.
|
||||
* Initializes internal clients that must not be started until
|
||||
* an external client has connected.
|
||||
*/
|
||||
|
||||
int
|
||||
winProcEstablishConnection (ClientPtr client)
|
||||
{
|
||||
int iReturn;
|
||||
static int s_iCallCount = 0;
|
||||
static unsigned long s_ulServerGeneration = 0;
|
||||
|
||||
ErrorF ("winProcEstablishConnection - Hello\n");
|
||||
|
||||
/* Do nothing if clipboard is not enabled */
|
||||
if (!g_fClipboard)
|
||||
{
|
||||
ErrorF ("winProcEstablishConnection - Clipboard is not enabled, "
|
||||
"returning.\n");
|
||||
|
||||
/* Unwrap the original function, call it, and return */
|
||||
InitialVector[2] = winProcEstablishConnectionOrig;
|
||||
iReturn = (*winProcEstablishConnectionOrig) (client);
|
||||
winProcEstablishConnectionOrig = NULL;
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/* Watch for server reset */
|
||||
if (s_ulServerGeneration != serverGeneration)
|
||||
{
|
||||
/* Save new generation number */
|
||||
s_ulServerGeneration = serverGeneration;
|
||||
|
||||
/* Reset call count */
|
||||
s_iCallCount = 0;
|
||||
}
|
||||
|
||||
/* Increment call count */
|
||||
++s_iCallCount;
|
||||
|
||||
/* Wait for second call when Xdmcp is enabled */
|
||||
if (g_fXdmcpEnabled
|
||||
&& !g_fClipboardLaunched
|
||||
&& s_iCallCount < 4)
|
||||
{
|
||||
ErrorF ("winProcEstablishConnection - Xdmcp enabled, waiting to "
|
||||
"start clipboard client until fourth call.\n");
|
||||
return (*winProcEstablishConnectionOrig) (client);
|
||||
}
|
||||
|
||||
/*
|
||||
* This procedure is only used for initialization.
|
||||
* We can unwrap the original procedure at this point
|
||||
* so that this function is no longer called until the
|
||||
* server resets and the function is wrapped again.
|
||||
*/
|
||||
InitialVector[2] = winProcEstablishConnectionOrig;
|
||||
|
||||
/*
|
||||
* Call original function and bail if it fails.
|
||||
* NOTE: We must do this first, since we need XdmcpOpenDisplay
|
||||
* to be called before we initialize our clipboard client.
|
||||
*/
|
||||
iReturn = (*winProcEstablishConnectionOrig) (client);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
ErrorF ("winProcEstablishConnection - ProcEstablishConnection "
|
||||
"failed, bailing.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/* Clear original function pointer */
|
||||
winProcEstablishConnectionOrig = NULL;
|
||||
|
||||
/* If the clipboard client has already been started, abort */
|
||||
if (g_fClipboardLaunched)
|
||||
{
|
||||
ErrorF ("winProcEstablishConnection - Clipboard client already "
|
||||
"launched, returning.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/* Startup the clipboard client if clipboard mode is being used */
|
||||
if (g_fClipboard)
|
||||
{
|
||||
/*
|
||||
* NOTE: The clipboard client is started here for a reason:
|
||||
* 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
|
||||
* 2) If the clipboard client attaches during X Server startup,
|
||||
* then it becomes the "magic client" that causes the X Server
|
||||
* to reset if it exits.
|
||||
* 3) XDMCP calls KillAllClients when it starts up.
|
||||
* 4) The clipboard client is a client, so it is killed.
|
||||
* 5) The clipboard client is the "magic client", so the X Server
|
||||
* resets itself.
|
||||
* 6) This repeats ad infinitum.
|
||||
* 7) We avoid this by waiting until at least one client (could
|
||||
* be XDM, could be another client) connects, which makes it
|
||||
* almost certain that the clipboard client will not connect
|
||||
* until after XDM when using XDMCP.
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Create the clipboard client thread */
|
||||
if (!winInitClipboard ())
|
||||
{
|
||||
ErrorF ("winProcEstablishConnection - winClipboardInit "
|
||||
"failed.\n");
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
ErrorF ("winProcEstablishConnection - winInitClipboard returned.\n");
|
||||
}
|
||||
|
||||
/* Flag that clipboard client has been launched */
|
||||
g_fClipboardLaunched = TRUE;
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wrapper for internal SetSelectionOwner function.
|
||||
* Grabs ownership of Windows clipboard when X11 clipboard owner changes.
|
||||
*/
|
||||
|
||||
int
|
||||
winProcSetSelectionOwner (ClientPtr client)
|
||||
{
|
||||
int i;
|
||||
DrawablePtr pDrawable;
|
||||
WindowPtr pWindow = None;
|
||||
Bool fOwnedToNotOwned = FALSE;
|
||||
static Window s_iOwners[CLIP_NUM_SELECTIONS] = {None};
|
||||
static unsigned long s_ulServerGeneration = 0;
|
||||
REQUEST(xSetSelectionOwnerReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
|
||||
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - Hello.\n");
|
||||
#endif
|
||||
|
||||
/* Watch for server reset */
|
||||
if (s_ulServerGeneration != serverGeneration)
|
||||
{
|
||||
/* Save new generation number */
|
||||
s_ulServerGeneration = serverGeneration;
|
||||
|
||||
/* Initialize static variables */
|
||||
for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
|
||||
s_iOwners[i] = None;
|
||||
}
|
||||
|
||||
/* Abort if clipboard not completely initialized yet */
|
||||
if (!g_fClipboardStarted)
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, "
|
||||
"aborting.\n");
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Grab window if we have one */
|
||||
if (None != stuff->window)
|
||||
{
|
||||
/* Grab the Window from the request */
|
||||
pWindow = (WindowPtr) SecurityLookupWindow (stuff->window, client,
|
||||
SecurityReadAccess);
|
||||
if (!pWindow)
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we either have a valid window or None */
|
||||
|
||||
/* Save selection owners for monitored selections, ignore other selections */
|
||||
if (XA_PRIMARY == stuff->selection)
|
||||
{
|
||||
/* Look for owned -> not owned transition */
|
||||
if (None == stuff->window
|
||||
&& None != s_iOwners[CLIP_OWN_PRIMARY])
|
||||
{
|
||||
fOwnedToNotOwned = TRUE;
|
||||
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - PRIMARY - Going from "
|
||||
"owned to not owned.\n");
|
||||
#endif
|
||||
|
||||
/* Adjust last owned selection */
|
||||
if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
|
||||
g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
|
||||
else
|
||||
g_atomLastOwnedSelection = None;
|
||||
}
|
||||
|
||||
/* Save new selection owner or None */
|
||||
s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
|
||||
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
|
||||
stuff->window);
|
||||
#endif
|
||||
}
|
||||
else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
|
||||
{
|
||||
/* Look for owned -> not owned transition */
|
||||
if (None == stuff->window
|
||||
&& None != s_iOwners[CLIP_OWN_CLIPBOARD])
|
||||
{
|
||||
fOwnedToNotOwned = TRUE;
|
||||
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Going from "
|
||||
"owned to not owned.\n");
|
||||
#endif
|
||||
|
||||
/* Adjust last owned selection */
|
||||
if (None != s_iOwners[CLIP_OWN_PRIMARY])
|
||||
g_atomLastOwnedSelection = XA_PRIMARY;
|
||||
else
|
||||
g_atomLastOwnedSelection = None;
|
||||
}
|
||||
|
||||
/* Save new selection owner or None */
|
||||
s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
|
||||
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
|
||||
stuff->window);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
|
||||
/*
|
||||
* At this point, if one of the selections is still owned by the
|
||||
* clipboard manager then it should be marked as unowned since
|
||||
* we will be taking ownership of the Win32 clipboard.
|
||||
*/
|
||||
if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
|
||||
s_iOwners[CLIP_OWN_PRIMARY] = None;
|
||||
if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
|
||||
s_iOwners[CLIP_OWN_CLIPBOARD] = None;
|
||||
|
||||
/*
|
||||
* Handle case when selection is being disowned,
|
||||
* WM_DRAWCLIPBOARD did not do the disowning,
|
||||
* both monitored selections are no longer owned,
|
||||
* an owned to not owned transition was detected,
|
||||
* and we currently own the Win32 clipboard.
|
||||
*/
|
||||
if (None == stuff->window
|
||||
&& g_iClipboardWindow != client->lastDrawableID
|
||||
&& (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])
|
||||
&& fOwnedToNotOwned
|
||||
&& g_hwndClipboard != NULL
|
||||
&& g_hwndClipboard == GetClipboardOwner ())
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - We currently own the "
|
||||
"clipboard and neither the PRIMARY nor the CLIPBOARD "
|
||||
"selections are owned, releasing ownership of Win32 "
|
||||
"clipboard.\n");
|
||||
#endif
|
||||
|
||||
/* Release ownership of the Windows clipboard */
|
||||
OpenClipboard (NULL);
|
||||
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;
|
||||
}
|
||||
|
||||
/* Abort if no window at this point */
|
||||
if (None == stuff->window)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - No window, returning.\n");
|
||||
#endif
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Abort if invalid selection */
|
||||
if (!ValidAtom (stuff->selection))
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Cast Window to Drawable */
|
||||
pDrawable = (DrawablePtr) pWindow;
|
||||
|
||||
/* Abort if clipboard manager is owning the selection */
|
||||
if (pDrawable->id == g_iClipboardWindow)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - We changed ownership, "
|
||||
"aborting.\n");
|
||||
#endif
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Abort if root window is taking ownership */
|
||||
if (pDrawable->id == 0)
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - Root window taking ownership, "
|
||||
"aborting\n");
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Close clipboard if we have it open already */
|
||||
if (GetOpenClipboardWindow () == g_hwndClipboard)
|
||||
{
|
||||
CloseClipboard ();
|
||||
}
|
||||
|
||||
/* Access the Windows clipboard */
|
||||
if (!OpenClipboard (g_hwndClipboard))
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x\n",
|
||||
(int) GetLastError ());
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Take ownership of the Windows clipboard */
|
||||
if (!EmptyClipboard ())
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
|
||||
(int) GetLastError ());
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
/* Advertise Unicode if we support it */
|
||||
if (g_fUnicodeSupport)
|
||||
SetClipboardData (CF_UNICODETEXT, NULL);
|
||||
|
||||
/* Always advertise regular text */
|
||||
SetClipboardData (CF_TEXT, NULL);
|
||||
|
||||
/* Save handle to last owned selection */
|
||||
g_atomLastOwnedSelection = stuff->selection;
|
||||
|
||||
/* Release the clipboard */
|
||||
if (!CloseClipboard ())
|
||||
{
|
||||
ErrorF ("winProcSetSelectionOwner - CloseClipboard () failed: "
|
||||
"%08x\n",
|
||||
(int) GetLastError ());
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
winProcSetSelectionOwner_Done:
|
||||
return (*winProcSetSelectionOwnerOrig) (client);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -35,13 +35,65 @@
|
|||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
static int
|
||||
winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps);
|
||||
|
||||
static void
|
||||
winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
|
||||
|
||||
static void
|
||||
winInstallColormap (ColormapPtr pmap);
|
||||
|
||||
static void
|
||||
winUninstallColormap (ColormapPtr pmap);
|
||||
|
||||
static void
|
||||
winResolveColor (unsigned short *pred,
|
||||
unsigned short *pgreen,
|
||||
unsigned short *pblue,
|
||||
VisualPtr pVisual);
|
||||
|
||||
static Bool
|
||||
winCreateColormap (ColormapPtr pmap);
|
||||
|
||||
static void
|
||||
winDestroyColormap (ColormapPtr pmap);
|
||||
|
||||
static Bool
|
||||
winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap);
|
||||
|
||||
static Bool
|
||||
winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap);
|
||||
|
||||
|
||||
/*
|
||||
* Set screen functions for colormaps
|
||||
*/
|
||||
|
||||
void
|
||||
winSetColormapFunctions (ScreenPtr pScreen)
|
||||
{
|
||||
pScreen->CreateColormap = winCreateColormap;
|
||||
pScreen->DestroyColormap = winDestroyColormap;
|
||||
pScreen->InstallColormap = winInstallColormap;
|
||||
pScreen->UninstallColormap = winUninstallColormap;
|
||||
pScreen->ListInstalledColormaps = winListInstalledColormaps;
|
||||
pScreen->StoreColors = winStoreColors;
|
||||
pScreen->ResolveColor = winResolveColor;
|
||||
}
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 30 */
|
||||
/*
|
||||
* Walk the list of installed colormaps, filling the pmaps list
|
||||
* with the resource ids of the installed maps, and return
|
||||
* a count of the total number of installed maps.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -58,7 +110,7 @@ winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps)
|
|||
|
||||
/* See Porting Layer Definition - p. 30 */
|
||||
/* See Programming Windows - p. 663 */
|
||||
void
|
||||
static void
|
||||
winInstallColormap (ColormapPtr pColormap)
|
||||
{
|
||||
ScreenPtr pScreen = pColormap->pScreen;
|
||||
|
@ -66,14 +118,14 @@ winInstallColormap (ColormapPtr pColormap)
|
|||
ColormapPtr oldpmap = pScreenPriv->pcmapInstalled;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInstallColormap\n");
|
||||
winDebug ("winInstallColormap\n");
|
||||
#endif
|
||||
|
||||
/* Did the colormap actually change? */
|
||||
if (pColormap != oldpmap)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInstallColormap - Colormap has changed, attempt "
|
||||
winDebug ("winInstallColormap - Colormap has changed, attempt "
|
||||
"to install.\n");
|
||||
#endif
|
||||
|
||||
|
@ -91,7 +143,7 @@ winInstallColormap (ColormapPtr pColormap)
|
|||
/* Call the engine specific colormap install procedure */
|
||||
if (!((*pScreenPriv->pwinInstallColormap) (pColormap)))
|
||||
{
|
||||
ErrorF ("winInstallColormap - Screen specific colormap install "
|
||||
winErrorFVerb (2, "winInstallColormap - Screen specific colormap install "
|
||||
"procedure failed. Continuing, but colors may be "
|
||||
"messed up from now on.\n");
|
||||
}
|
||||
|
@ -103,14 +155,14 @@ winInstallColormap (ColormapPtr pColormap)
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 30 */
|
||||
void
|
||||
static void
|
||||
winUninstallColormap (ColormapPtr pmap)
|
||||
{
|
||||
winScreenPriv(pmap->pScreen);
|
||||
ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winUninstallColormap\n");
|
||||
winDebug ("winUninstallColormap\n");
|
||||
#endif
|
||||
|
||||
/* Is the colormap currently installed? */
|
||||
|
@ -139,7 +191,7 @@ winUninstallColormap (ColormapPtr pmap)
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 30 */
|
||||
void
|
||||
static void
|
||||
winStoreColors (ColormapPtr pmap,
|
||||
int ndef,
|
||||
xColorItem *pdefs)
|
||||
|
@ -152,7 +204,7 @@ winStoreColors (ColormapPtr pmap,
|
|||
|
||||
#if CYGDEBUG
|
||||
if (ndef != 1)
|
||||
ErrorF ("winStoreColors - ndef: %d\n",
|
||||
winDebug ("winStoreColors - ndef: %d\n",
|
||||
ndef);
|
||||
#endif
|
||||
|
||||
|
@ -175,7 +227,7 @@ winStoreColors (ColormapPtr pmap,
|
|||
pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winStoreColors - nRed %d nGreen %d nBlue %d\n",
|
||||
winDebug ("winStoreColors - nRed %d nGreen %d nBlue %d\n",
|
||||
nRed, nGreen, nBlue);
|
||||
#endif
|
||||
}
|
||||
|
@ -183,7 +235,7 @@ winStoreColors (ColormapPtr pmap,
|
|||
/* Call the engine specific store colors procedure */
|
||||
if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs)))
|
||||
{
|
||||
ErrorF ("winStoreColors - Engine cpecific color storage procedure "
|
||||
winErrorFVerb (2, "winStoreColors - Engine cpecific color storage procedure "
|
||||
"failed. Continuing, but colors may be messed up from now "
|
||||
"on.\n");
|
||||
}
|
||||
|
@ -191,14 +243,14 @@ winStoreColors (ColormapPtr pmap,
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 30 */
|
||||
void
|
||||
static void
|
||||
winResolveColor (unsigned short *pred,
|
||||
unsigned short *pgreen,
|
||||
unsigned short *pblue,
|
||||
VisualPtr pVisual)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winResolveColor ()\n");
|
||||
winDebug ("winResolveColor ()\n");
|
||||
#endif
|
||||
|
||||
miResolveColor (pred, pgreen, pblue, pVisual);
|
||||
|
@ -206,7 +258,7 @@ winResolveColor (unsigned short *pred,
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 29 */
|
||||
Bool
|
||||
static Bool
|
||||
winCreateColormap (ColormapPtr pmap)
|
||||
{
|
||||
winPrivCmapPtr pCmapPriv = NULL;
|
||||
|
@ -214,7 +266,7 @@ winCreateColormap (ColormapPtr pmap)
|
|||
winScreenPriv(pScreen);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateColormap\n");
|
||||
winDebug ("winCreateColormap\n");
|
||||
#endif
|
||||
|
||||
/* Allocate colormap privates */
|
||||
|
@ -256,7 +308,7 @@ winCreateColormap (ColormapPtr pmap)
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 29, 30 */
|
||||
void
|
||||
static void
|
||||
winDestroyColormap (ColormapPtr pColormap)
|
||||
{
|
||||
winScreenPriv(pColormap->pScreen);
|
||||
|
@ -265,7 +317,7 @@ winDestroyColormap (ColormapPtr pColormap)
|
|||
/* Call the engine specific colormap destruction procedure */
|
||||
if (!((*pScreenPriv->pwinDestroyColormap) (pColormap)))
|
||||
{
|
||||
ErrorF ("winDestroyColormap - Engine specific colormap destruction "
|
||||
winErrorFVerb (2, "winDestroyColormap - Engine specific colormap destruction "
|
||||
"procedure failed. Continuing, but it is possible that memory "
|
||||
"was leaked, or that colors will be messed up from now on.\n");
|
||||
}
|
||||
|
@ -275,26 +327,16 @@ winDestroyColormap (ColormapPtr pColormap)
|
|||
winSetCmapPriv (pColormap, NULL);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyColormap - Returning\n");
|
||||
winDebug ("winDestroyColormap - Returning\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
winExpandDirectColors (ColormapPtr pmap, int ndef,
|
||||
xColorItem *indefs, xColorItem *outdefs)
|
||||
{
|
||||
ErrorF ("\nwinExpandDirectColors\n");
|
||||
return miExpandDirectColors (pmap, ndef, indefs, outdefs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Internal function to load the palette used by the Shadow DIB
|
||||
*/
|
||||
|
||||
static
|
||||
Bool
|
||||
static Bool
|
||||
winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -316,7 +358,7 @@ winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winGetPaletteDIB - Retrieved %d colors from DIB\n",
|
||||
winDebug ("winGetPaletteDIB - Retrieved %d colors from DIB\n",
|
||||
uiColorsRetrieved);
|
||||
#endif
|
||||
|
||||
|
@ -341,7 +383,7 @@ winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
|
|||
nBlue = rgbColors[i].rgbBlue << 8;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winGetPaletteDIB - Allocating a color: %d; "
|
||||
winDebug ("winGetPaletteDIB - Allocating a color: %d; "
|
||||
"%d %d %d\n",
|
||||
pixel, nRed, nGreen, nBlue);
|
||||
#endif
|
||||
|
@ -364,9 +406,9 @@ winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
|
|||
|| nGreen != rgbColors[i].rgbGreen
|
||||
|| nBlue != rgbColors[i].rgbBlue)
|
||||
{
|
||||
ErrorF ("winGetPaletteDIB - Got: %d; "
|
||||
winDebug ("winGetPaletteDIB - Got: %d; "
|
||||
"%d %d %d\n",
|
||||
pixel, nRed, nGreen, nBlue);
|
||||
(int) pixel, nRed, nGreen, nBlue);
|
||||
}
|
||||
|
||||
/* FIXME: Not sure that this bit is needed at all */
|
||||
|
@ -385,11 +427,10 @@ winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
|
|||
|
||||
|
||||
/*
|
||||
* Internal function to load the standard system palette being used by GDI
|
||||
* Internal function to load the standard system palette being used by DD
|
||||
*/
|
||||
|
||||
static
|
||||
Bool
|
||||
static Bool
|
||||
winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
|
||||
{
|
||||
int i;
|
||||
|
@ -418,7 +459,7 @@ winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winGetPaletteDD - uiSystemPaletteEntries %d\n",
|
||||
winDebug ("winGetPaletteDD - uiSystemPaletteEntries %d\n",
|
||||
uiSystemPaletteEntries);
|
||||
#endif
|
||||
|
||||
|
@ -444,7 +485,7 @@ winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
|
|||
nGreen = ppeColors[i].peGreen << 8;
|
||||
nBlue = ppeColors[i].peBlue << 8;
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winGetPaletteDD - Allocating a color: %d; "
|
||||
winDebug ("winGetPaletteDD - Allocating a color: %d; "
|
||||
"%d %d %d\n",
|
||||
pixel, nRed, nGreen, nBlue);
|
||||
#endif
|
||||
|
@ -506,13 +547,13 @@ winCreateDefColormap (ScreenPtr pScreen)
|
|||
Pixel wp, bp;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateDefColormap\n");
|
||||
winDebug ("winCreateDefColormap\n");
|
||||
#endif
|
||||
|
||||
/* Use standard fb colormaps for non palettized color modes */
|
||||
if (pScreenInfo->dwBPP > 8)
|
||||
{
|
||||
ErrorF ("winCreateDefColormap - Deferring to " \
|
||||
winDebug ("winCreateDefColormap - Deferring to " \
|
||||
"fbCreateDefColormap ()\n");
|
||||
return fbCreateDefColormap (pScreen);
|
||||
}
|
||||
|
@ -528,7 +569,7 @@ winCreateDefColormap (ScreenPtr pScreen)
|
|||
*/
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateDefColormap - defColormap: %d\n",
|
||||
winDebug ("winCreateDefColormap - defColormap: %d\n",
|
||||
pScreen->defColormap);
|
||||
#endif
|
||||
|
||||
|
@ -550,7 +591,7 @@ winCreateDefColormap (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateDefColormap - Created a colormap\n");
|
||||
winDebug ("winCreateDefColormap - Created a colormap\n");
|
||||
#endif
|
||||
|
||||
/* Branch on the visual class */
|
||||
|
@ -624,7 +665,7 @@ winCreateDefColormap (ScreenPtr pScreen)
|
|||
(*pScreen->InstallColormap)(pcmap);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateDefColormap - Returning\n");
|
||||
winDebug ("winCreateDefColormap - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "XKBsrv.h"
|
||||
#endif
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
#ifndef CONFIGPATH
|
||||
#define CONFIGPATH "%A," "%R," \
|
||||
"/etc/X11/%R," "%P/etc/X11/%R," \
|
||||
|
@ -53,14 +54,25 @@
|
|||
#endif
|
||||
|
||||
XF86ConfigPtr g_xf86configptr = NULL;
|
||||
#endif
|
||||
|
||||
WinCmdlineRec g_cmdline = {
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
NULL, /* configFile */
|
||||
#endif
|
||||
NULL, /* fontPath */
|
||||
NULL, /* rgbPath */
|
||||
#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 */
|
||||
|
@ -98,6 +110,9 @@ winInfoRec g_winInfo = {
|
|||
50}
|
||||
};
|
||||
|
||||
#define NULL_IF_EMPTY(x) (winNameCompare(x,"")?x:NULL)
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
serverLayoutRec g_winConfigLayout;
|
||||
|
||||
static Bool ParseOptionValue (int scrnIndex, pointer options,
|
||||
|
@ -106,8 +121,6 @@ static Bool configLayout (serverLayoutPtr, XF86ConfLayoutPtr, char *);
|
|||
static Bool configImpliedLayout (serverLayoutPtr, XF86ConfScreenPtr);
|
||||
static Bool GetBoolValue (OptionInfoPtr p, const char *s);
|
||||
|
||||
#define NULL_IF_EMPTY(x) (winNameCompare(x,"")?x:NULL)
|
||||
|
||||
|
||||
Bool
|
||||
winReadConfigfile ()
|
||||
|
@ -194,7 +207,7 @@ winReadConfigfile ()
|
|||
g_xf86configptr->conf_layout_lst,
|
||||
NULL))
|
||||
{
|
||||
winMsg (X_ERROR, "Unable to determin the screen layout\n");
|
||||
winMsg (X_ERROR, "Unable to determine the screen layout\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +217,7 @@ winReadConfigfile ()
|
|||
winConfigFiles ();
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the keyboard configuration */
|
||||
|
@ -232,9 +246,10 @@ WinKBLayoutRec winKBLayouts[] = {
|
|||
{ 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
|
||||
{ 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
|
||||
{ 0x410, -1, "pc105", "it", NULL, NULL, "Italian"},
|
||||
{ 0x411, -1, "jp", "jp", NULL, NULL, "Japanese"},
|
||||
{ 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"},
|
||||
{ 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"},
|
||||
{ 0x414, -1, "pc105", "no", NULL, NULL, "Norwegian"},
|
||||
{ 0x416, -1, "pc105", "pt", NULL, NULL, "Portuguese (Brazil, ABNT)"},
|
||||
{ 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)"},
|
||||
{ 0x41d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
|
||||
|
@ -245,13 +260,18 @@ WinKBLayoutRec winKBLayouts[] = {
|
|||
Bool
|
||||
winConfigKeyboard (DeviceIntPtr pDevice)
|
||||
{
|
||||
#ifdef XKB
|
||||
char layoutName[KL_NAMELENGTH];
|
||||
unsigned int layoutNum;
|
||||
int keyboardType;
|
||||
static unsigned int layoutNum = 0;
|
||||
int keyboardType;
|
||||
#endif
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
XF86ConfInputPtr kbd = NULL;
|
||||
XF86ConfInputPtr input_list = NULL;
|
||||
MessageType from = X_DEFAULT;
|
||||
MessageType kbdfrom = X_CONFIG;
|
||||
#endif
|
||||
MessageType from = X_DEFAULT;
|
||||
char *s = NULL;
|
||||
|
||||
/* Setup defaults */
|
||||
#ifdef XKB
|
||||
|
@ -270,22 +290,58 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
g_winInfo.xkb.options = NULL;
|
||||
# endif /* PC98 */
|
||||
|
||||
/*
|
||||
* 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;
|
||||
DWORD kbd_speed;
|
||||
if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &kbd_delay, 0) &&
|
||||
SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &kbd_speed, 0))
|
||||
{
|
||||
switch (kbd_delay)
|
||||
{
|
||||
case 0: g_winInfo.keyboard.delay = 250; break;
|
||||
case 1: g_winInfo.keyboard.delay = 500; break;
|
||||
case 2: g_winInfo.keyboard.delay = 750; break;
|
||||
default:
|
||||
case 3: g_winInfo.keyboard.delay = 1000; break;
|
||||
}
|
||||
g_winInfo.keyboard.rate = max(1,kbd_speed);
|
||||
winMsgVerb(X_PROBED, 1, "Setting autorepeat to delay=%d, rate=%d\n",
|
||||
g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
keyboardType = GetKeyboardType (0);
|
||||
if (keyboardType > 0 && GetKeyboardLayoutName (layoutName))
|
||||
{
|
||||
WinKBLayoutPtr pLayout;
|
||||
|
||||
layoutNum = strtoul (layoutName, (char **)NULL, 16);
|
||||
Bool bfound = FALSE;
|
||||
|
||||
if (! layoutNum)
|
||||
layoutNum = strtoul (layoutName, (char **)NULL, 16);
|
||||
if ((layoutNum & 0xffff) == 0x411) {
|
||||
/* The japanese layouts know a lot of different IMEs which all have
|
||||
different layout numbers set. Map them to a single entry.
|
||||
Same might apply for chinese, korean and other symbol languages
|
||||
too */
|
||||
different layout numbers set. Map them to a single entry.
|
||||
Same might apply for chinese, korean and other symbol languages
|
||||
too */
|
||||
layoutNum = (layoutNum & 0xffff);
|
||||
if (keyboardType == 7)
|
||||
{
|
||||
/* Japanese layouts have problems with key event messages
|
||||
such as the lack of WM_KEYUP for Caps Lock key.
|
||||
Loading US layout fixes this problem. */
|
||||
if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
|
||||
winMsg (X_INFO, "Loading US keyboard layout.\n");
|
||||
else
|
||||
winMsg (X_ERROR, "LoadKeyboardLaout failed.\n");
|
||||
}
|
||||
}
|
||||
winMsg (X_DEFAULT, "winConfigKeyboard - Layout: \"%s\" (%08x) \n",
|
||||
winMsg (X_PROBED, "winConfigKeyboard - Layout: \"%s\" (%08x) \n",
|
||||
layoutName, layoutNum);
|
||||
|
||||
for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
|
||||
|
@ -295,9 +351,10 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
|
||||
continue;
|
||||
|
||||
winMsg (X_DEFAULT,
|
||||
"Using preset keyboard for \"%s\" (%s), type \"%d\"\n",
|
||||
pLayout->layoutname, layoutName, keyboardType);
|
||||
bfound = TRUE;
|
||||
winMsg (X_PROBED,
|
||||
"Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
|
||||
pLayout->layoutname, pLayout->winlayout, keyboardType);
|
||||
|
||||
g_winInfo.xkb.model = pLayout->xkbmodel;
|
||||
g_winInfo.xkb.layout = pLayout->xkblayout;
|
||||
|
@ -305,6 +362,31 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
g_winInfo.xkb.options = pLayout->xkboptions;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bfound)
|
||||
{
|
||||
HKEY regkey = NULL;
|
||||
const char regtempl[] =
|
||||
"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
|
||||
char *regpath;
|
||||
char lname[256];
|
||||
DWORD namesize = sizeof(lname);
|
||||
|
||||
regpath = alloca(sizeof(regtempl) + KL_NAMELENGTH + 1);
|
||||
strcpy(regpath, regtempl);
|
||||
strcat(regpath, layoutName);
|
||||
|
||||
if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, ®key) &&
|
||||
!RegQueryValueEx(regkey, "Layout Text", 0, NULL, lname, &namesize))
|
||||
{
|
||||
winMsg (X_ERROR,
|
||||
"Keyboardlayout \"%s\" (%s) is unknown\n", lname, layoutName);
|
||||
}
|
||||
|
||||
/* Close registry key */
|
||||
if (regkey)
|
||||
RegCloseKey (regkey);
|
||||
}
|
||||
}
|
||||
|
||||
g_winInfo.xkb.initialMap = NULL;
|
||||
|
@ -317,7 +399,7 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
#endif /* XKB */
|
||||
|
||||
/* parse the configuration */
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
if (g_cmdline.keyboard)
|
||||
kbdfrom = X_CMDLINE;
|
||||
|
||||
|
@ -344,10 +426,29 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
|
||||
if (kbd != NULL)
|
||||
{
|
||||
|
||||
if (kbd->inp_identifier)
|
||||
winMsg (kbdfrom, "Using keyboard \"%s\" as primary keyboard\n",
|
||||
kbd->inp_identifier);
|
||||
|
||||
if ((s = winSetStrOption(kbd->inp_option_lst, "AutoRepeat", NULL)))
|
||||
{
|
||||
if ((sscanf(s, "%ld %ld", &g_winInfo.keyboard.delay,
|
||||
&g_winInfo.keyboard.rate) != 2) ||
|
||||
(g_winInfo.keyboard.delay < 1) ||
|
||||
(g_winInfo.keyboard.rate == 0) ||
|
||||
(1000 / g_winInfo.keyboard.rate) < 1)
|
||||
{
|
||||
winErrorFVerb (2, "\"%s\" is not a valid AutoRepeat value", s);
|
||||
xfree(s);
|
||||
return FALSE;
|
||||
}
|
||||
xfree(s);
|
||||
winMsg (X_CONFIG, "AutoRepeat: %ld %ld\n",
|
||||
g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XKB
|
||||
from = X_DEFAULT;
|
||||
if (g_cmdline.noXkbExtension)
|
||||
|
@ -355,6 +456,7 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
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);
|
||||
|
@ -364,44 +466,109 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
g_winInfo.xkb.disable = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (g_winInfo.xkb.disable)
|
||||
{
|
||||
winMsg (from, "XkbExtension disabled\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *s;
|
||||
|
||||
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL)))
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (s)
|
||||
{
|
||||
g_winInfo.xkb.rules = NULL_IF_EMPTY (s);
|
||||
winMsg (X_CONFIG, "XKB: rules: \"%s\"\n", s);
|
||||
winMsg (from, "XKB: rules: \"%s\"\n", s);
|
||||
}
|
||||
|
||||
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL)))
|
||||
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (s)
|
||||
{
|
||||
g_winInfo.xkb.model = NULL_IF_EMPTY (s);
|
||||
winMsg (X_CONFIG, "XKB: model: \"%s\"\n", s);
|
||||
winMsg (from, "XKB: model: \"%s\"\n", s);
|
||||
}
|
||||
|
||||
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL)))
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (s)
|
||||
{
|
||||
g_winInfo.xkb.layout = NULL_IF_EMPTY (s);
|
||||
winMsg (X_CONFIG, "XKB: layout: \"%s\"\n", s);
|
||||
winMsg (from, "XKB: layout: \"%s\"\n", s);
|
||||
}
|
||||
|
||||
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL)))
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (s)
|
||||
{
|
||||
g_winInfo.xkb.variant = NULL_IF_EMPTY (s);
|
||||
winMsg (X_CONFIG, "XKB: variant: \"%s\"\n", s);
|
||||
winMsg (from, "XKB: variant: \"%s\"\n", s);
|
||||
}
|
||||
|
||||
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL)))
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (s)
|
||||
{
|
||||
g_winInfo.xkb.options = NULL_IF_EMPTY (s);
|
||||
winMsg (X_CONFIG, "XKB: options: \"%s\"\n", s);
|
||||
winMsg (from, "XKB: options: \"%s\"\n", s);
|
||||
}
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
from = X_CMDLINE;
|
||||
if (!XkbInitialMap)
|
||||
{
|
||||
|
@ -433,16 +600,14 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
winMsg (X_CONFIG, "XKB: types: \"%s\"\n", s);
|
||||
}
|
||||
|
||||
if (
|
||||
(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 =
|
||||
if ((s =
|
||||
winSetStrOption (kbd->inp_option_lst, "XkbGeometry", NULL)))
|
||||
{
|
||||
g_winInfo.xkb.geometry = NULL_IF_EMPTY (s);
|
||||
|
@ -454,23 +619,23 @@ winConfigKeyboard (DeviceIntPtr pDevice)
|
|||
g_winInfo.xkb.symbols = NULL_IF_EMPTY (s);
|
||||
winMsg (X_CONFIG, "XKB: symbols: \"%s\"\n", s);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
}
|
||||
else
|
||||
{
|
||||
winMsg (X_ERROR, "No primary keyboard configured\n");
|
||||
winMsg (X_DEFAULT, "Using compiletime defaults for keyboard\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
Bool
|
||||
winConfigMouse (DeviceIntPtr pDevice)
|
||||
{
|
||||
MessageType mousefrom = X_CONFIG;
|
||||
|
||||
XF86ConfInputPtr mouse = NULL;
|
||||
XF86ConfInputPtr input_list = NULL;
|
||||
|
||||
|
@ -563,6 +728,7 @@ winConfigFiles ()
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Bool
|
||||
|
@ -579,6 +745,7 @@ winConfigScreens ()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
char *
|
||||
winSetStrOption (pointer optlist, const char *name, char *deflt)
|
||||
{
|
||||
|
@ -632,6 +799,7 @@ winSetRealOption (pointer optlist, const char *name, double deflt)
|
|||
deflt = o.value.realnum;
|
||||
return deflt;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -680,6 +848,7 @@ winNameCompare (const char *s1, const char *s2)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
/*
|
||||
* Find the named option in the list.
|
||||
* @return the pointer to the option record, or NULL if not found.
|
||||
|
@ -987,6 +1156,7 @@ GetBoolValue (OptionInfoPtr p, const char *s)
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
char *
|
||||
|
@ -1017,3 +1187,4 @@ winNormalizeName (const char *s)
|
|||
*q = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef __WIN_CONFIG_H__
|
||||
#define __WIN_CONFIG_H__
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
@ -27,11 +29,12 @@
|
|||
*
|
||||
* Authors: Alexander Gottwald
|
||||
*/
|
||||
#ifndef __WIN_CONFIG_H__
|
||||
#define __WIN_CONFIG_H__
|
||||
/* $Id$ */
|
||||
|
||||
#include "win.h"
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
#include "../xfree86/parser/xf86Parser.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* These are taken from hw/xfree86/common/xf86str.h */
|
||||
|
@ -184,14 +187,23 @@ serverLayoutRec, *serverLayoutPtr;
|
|||
typedef struct
|
||||
{
|
||||
/* Files */
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
char *configFile;
|
||||
#endif
|
||||
char *fontPath;
|
||||
char *rgbPath;
|
||||
/* input devices - keyboard */
|
||||
#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;
|
||||
|
@ -204,8 +216,9 @@ WinCmdlineRec, *WinCmdlinePtr;
|
|||
|
||||
|
||||
extern WinCmdlineRec g_cmdline;
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
extern XF86ConfigPtr g_xf86configptr;
|
||||
#endif
|
||||
extern serverLayoutRec g_winConfigLayout;
|
||||
|
||||
|
||||
|
@ -281,9 +294,10 @@ char *winSetStrOption (pointer optlist, const char *name, char *deflt);
|
|||
int winSetBoolOption (pointer optlist, const char *name, int deflt);
|
||||
int winSetIntOption (pointer optlist, const char *name, int deflt);
|
||||
double winSetRealOption (pointer optlist, const char *name, double deflt);
|
||||
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
XF86OptionPtr winFindOption (XF86OptionPtr list, const char *name);
|
||||
char *winFindOptionValue (XF86OptionPtr list, const char *name);
|
||||
#endif
|
||||
int winNameCompare (const char *s1, const char *s2);
|
||||
char *winNormalizeName (const char *s);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,23 +15,25 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/wincreatewnd.c,v 1.4 2002/10/17 08:18:22 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "shellapi.h"
|
||||
|
||||
#ifndef ABS_AUTOHIDE
|
||||
#define ABS_AUTOHIDE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
|
@ -60,7 +62,7 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
|
|||
char szTitle[256];
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowFullScreen\n");
|
||||
winDebug ("winCreateBoundingWindowFullScreen\n");
|
||||
#endif
|
||||
|
||||
/* Setup our window class */
|
||||
|
@ -90,7 +92,7 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
|
|||
(int) pScreenInfo->dwScreen);
|
||||
|
||||
/* Create the window */
|
||||
*phwnd = CreateWindowExA (WS_EX_TOPMOST, /* Extended styles */
|
||||
*phwnd = CreateWindowExA (0, /* Extended styles */
|
||||
WINDOW_CLASS, /* Class name */
|
||||
szTitle, /* Window name */
|
||||
WS_POPUP,
|
||||
|
@ -106,10 +108,12 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
|
|||
/* Branch on the server engine */
|
||||
switch (pScreenInfo->dwEngine)
|
||||
{
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
case WIN_SERVER_SHADOW_GDI:
|
||||
/* Show the window */
|
||||
ShowWindow (*phwnd, SW_SHOWMAXIMIZED);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* Hide the window */
|
||||
|
@ -144,18 +148,24 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
DWORD dwWindowStyle;
|
||||
char szTitle[256];
|
||||
|
||||
ErrorF ("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
|
||||
pScreenInfo->dwUserWidth, pScreenInfo->dwUserHeight);
|
||||
ErrorF ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
|
||||
pScreenInfo->dwWidth, pScreenInfo->dwHeight);
|
||||
|
||||
winDebug ("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
|
||||
(int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
|
||||
winDebug ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
|
||||
(int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
|
||||
|
||||
/* Set the common window style flags */
|
||||
dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
|
||||
|
||||
/* Decorated or undecorated window */
|
||||
if (pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
&& !pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
&& !pScreenInfo->fRootless
|
||||
&& !pScreenInfo->fMultiWindow)
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
&& !pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
)
|
||||
{
|
||||
dwWindowStyle |= WS_CAPTION;
|
||||
if (pScreenInfo->fScrollbars)
|
||||
|
@ -188,23 +198,29 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
{
|
||||
/* User gave a desired height and width, try to accomodate */
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - User gave height "
|
||||
winDebug ("winCreateBoundingWindowWindowed - User gave height "
|
||||
"and width\n");
|
||||
#endif
|
||||
|
||||
/* Adjust the window width and height for borders and title bar */
|
||||
if (pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
&& !pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
&& !pScreenInfo->fRootless
|
||||
&& !pScreenInfo->fMultiWindow)
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
&& !pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - Window has decoration\n");
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
|
||||
#endif
|
||||
/* Are we using scrollbars? */
|
||||
if (pScreenInfo->fScrollbars)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - Window has "
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window has "
|
||||
"scrollbars\n");
|
||||
#endif
|
||||
|
||||
|
@ -215,7 +231,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
else
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - Window does not have "
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window does not have "
|
||||
"scrollbars\n");
|
||||
#endif
|
||||
|
||||
|
@ -247,7 +263,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
{
|
||||
/* By default, we are creating a window that is as large as possible */
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - User did not give "
|
||||
winDebug ("winCreateBoundingWindowWindowed - User did not give "
|
||||
"height and width\n");
|
||||
#endif
|
||||
/* Defaults are wrong if we have multiple monitors */
|
||||
|
@ -260,8 +276,14 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
|
||||
/* Clean up the scrollbars flag, if necessary */
|
||||
if ((!pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
|| pScreenInfo->fRootless
|
||||
|| pScreenInfo->fMultiWindow)
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
)
|
||||
&& pScreenInfo->fScrollbars)
|
||||
{
|
||||
/* We cannot have scrollbars if we do not have a window border */
|
||||
|
@ -277,7 +299,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
iHeight = rcWorkArea.bottom - rcWorkArea.top;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - Adjusted width: %d "\
|
||||
winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\
|
||||
"height: %d\n",
|
||||
iWidth, iHeight);
|
||||
#endif
|
||||
|
@ -315,7 +337,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
|
||||
winDebug ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
|
||||
#endif
|
||||
|
||||
/* Get the client area coordinates */
|
||||
|
@ -326,7 +348,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ErrorF ("winCreateBoundingWindowWindowed - WindowClient "
|
||||
winDebug ("winCreateBoundingWindowWindowed - WindowClient "
|
||||
"w %ld h %ld r %ld l %ld b %ld t %ld\n",
|
||||
rcClient.right - rcClient.left,
|
||||
rcClient.bottom - rcClient.top,
|
||||
|
@ -382,21 +404,28 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
/* Setup the width range and page size */
|
||||
si.nMax = pScreenInfo->dwWidth - 1;
|
||||
si.nPage = rcClient.right - rcClient.left;
|
||||
ErrorF ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
|
||||
winDebug ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
|
||||
si.nMax, si.nPage);
|
||||
SetScrollInfo (*phwnd, SB_HORZ, &si, TRUE);
|
||||
|
||||
/* Setup the height range and page size */
|
||||
si.nMax = pScreenInfo->dwHeight - 1;
|
||||
si.nPage = rcClient.bottom - rcClient.top;
|
||||
ErrorF ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
|
||||
winDebug ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
|
||||
si.nMax, si.nPage);
|
||||
SetScrollInfo (*phwnd, SB_VERT, &si, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Show the window */
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
if (FALSE
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pScreenPriv->fRootWindowShown = FALSE;
|
||||
ShowWindow (*phwnd, SW_HIDE);
|
||||
|
@ -410,18 +439,31 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
/* Attempt to bring our window to the top of the display */
|
||||
if (!BringWindowToTop (*phwnd))
|
||||
if (TRUE
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
&& !pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
&& !pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
&& !pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () "
|
||||
"failed\n");
|
||||
return FALSE;
|
||||
if (!BringWindowToTop (*phwnd))
|
||||
{
|
||||
ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () "
|
||||
"failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
/* Paint window background blue */
|
||||
if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
|
||||
winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF));
|
||||
#endif
|
||||
|
||||
ErrorF ("winCreateBoundingWindowWindowed - Returning\n");
|
||||
winDebug ("winCreateBoundingWindowWindowed - Returning\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -446,27 +488,27 @@ winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
|
|||
if (!pScreenInfo->fMultipleMonitors)
|
||||
return TRUE;
|
||||
|
||||
ErrorF ("winGetWorkArea - Original WorkArea: %d %d %d %d\n",
|
||||
prcWorkArea->top, prcWorkArea->left,
|
||||
prcWorkArea->bottom, prcWorkArea->right);
|
||||
winDebug ("winGetWorkArea - Original WorkArea: %d %d %d %d\n",
|
||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||
|
||||
/* Get size of full virtual screen */
|
||||
iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
|
||||
iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
||||
|
||||
ErrorF ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
|
||||
winDebug ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
|
||||
|
||||
/* Get origin of full virtual screen */
|
||||
iLeft = GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
iTop = GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
|
||||
ErrorF ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
|
||||
winDebug ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
|
||||
|
||||
/* Get size of primary screen */
|
||||
iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN);
|
||||
iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN);
|
||||
|
||||
ErrorF ("winGetWorkArea - Primary screen is %d x %d\n",
|
||||
winDebug ("winGetWorkArea - Primary screen is %d x %d\n",
|
||||
iPrimaryWidth, iPrimaryHeight);
|
||||
|
||||
/* Work out how much of the primary screen we aren't using */
|
||||
|
@ -489,10 +531,10 @@ winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
|
|||
prcWorkArea->bottom = prcWorkArea->top + iHeight -
|
||||
iPrimaryNonWorkAreaHeight;
|
||||
|
||||
ErrorF ("winGetWorkArea - Adjusted WorkArea for multiple "
|
||||
winDebug ("winGetWorkArea - Adjusted WorkArea for multiple "
|
||||
"monitors: %d %d %d %d\n",
|
||||
prcWorkArea->top, prcWorkArea->left,
|
||||
prcWorkArea->bottom, prcWorkArea->right);
|
||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -509,22 +551,22 @@ winAdjustForAutoHide (RECT *prcWorkArea)
|
|||
APPBARDATA abd;
|
||||
HWND hwndAutoHide;
|
||||
|
||||
ErrorF ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
|
||||
prcWorkArea->top, prcWorkArea->left,
|
||||
prcWorkArea->bottom, prcWorkArea->right);
|
||||
winDebug ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
|
||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||
|
||||
/* Find out if the Windows taskbar is set to auto-hide */
|
||||
ZeroMemory (&abd, sizeof (abd));
|
||||
abd.cbSize = sizeof (abd);
|
||||
if (SHAppBarMessage (ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
|
||||
ErrorF ("winAdjustForAutoHide - Taskbar is auto hide\n");
|
||||
winDebug ("winAdjustForAutoHide - Taskbar is auto hide\n");
|
||||
|
||||
/* Look for a TOP auto-hide taskbar */
|
||||
abd.uEdge = ABE_TOP;
|
||||
hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
|
||||
if (hwndAutoHide != NULL)
|
||||
{
|
||||
ErrorF ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
|
||||
winDebug ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
|
||||
prcWorkArea->top += 1;
|
||||
}
|
||||
|
||||
|
@ -533,7 +575,7 @@ winAdjustForAutoHide (RECT *prcWorkArea)
|
|||
hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
|
||||
if (hwndAutoHide != NULL)
|
||||
{
|
||||
ErrorF ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
|
||||
winDebug ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
|
||||
prcWorkArea->left += 1;
|
||||
}
|
||||
|
||||
|
@ -542,7 +584,7 @@ winAdjustForAutoHide (RECT *prcWorkArea)
|
|||
hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
|
||||
if (hwndAutoHide != NULL)
|
||||
{
|
||||
ErrorF ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
|
||||
winDebug ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
|
||||
prcWorkArea->bottom -= 1;
|
||||
}
|
||||
|
||||
|
@ -551,19 +593,19 @@ winAdjustForAutoHide (RECT *prcWorkArea)
|
|||
hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
|
||||
if (hwndAutoHide != NULL)
|
||||
{
|
||||
ErrorF ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
|
||||
winDebug ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
|
||||
prcWorkArea->right -= 1;
|
||||
}
|
||||
|
||||
ErrorF ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
|
||||
prcWorkArea->top, prcWorkArea->left,
|
||||
prcWorkArea->bottom, prcWorkArea->right);
|
||||
winDebug ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
|
||||
(int) prcWorkArea->top, (int) prcWorkArea->left,
|
||||
(int) prcWorkArea->bottom, (int) prcWorkArea->right);
|
||||
|
||||
#if 0
|
||||
/* Obtain the task bar window dimensions */
|
||||
abd.hWnd = hwndAutoHide;
|
||||
hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETTASKBARPOS, &abd);
|
||||
ErrorF ("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n",
|
||||
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
|
||||
|
|
|
@ -33,6 +33,38 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xwin/wincursor.c,v 1.5 2002/07/05 09:19:26 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "winmsg.h"
|
||||
#include <cursorstr.h>
|
||||
#include <mipointrst.h>
|
||||
#include <servermd.h>
|
||||
|
||||
|
||||
#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
|
||||
# define WIN_DEBUG_MSG winDebug
|
||||
#else
|
||||
# define WIN_DEBUG_MSG(...)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
static void
|
||||
winPointerWarpCursor (ScreenPtr pScreen, int x, int y);
|
||||
|
||||
static Bool
|
||||
winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y);
|
||||
|
||||
static void
|
||||
winCrossScreen (ScreenPtr pScreen, Bool fEntering);
|
||||
|
||||
miPointerScreenFuncRec g_winPointerCursorFuncs =
|
||||
{
|
||||
|
@ -42,7 +74,7 @@ miPointerScreenFuncRec g_winPointerCursorFuncs =
|
|||
};
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
winPointerWarpCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -57,7 +89,7 @@ winPointerWarpCursor (ScreenPtr pScreen, int x, int y)
|
|||
/* Don't ignore subsequent warps */
|
||||
s_fInitialWarp = FALSE;
|
||||
|
||||
ErrorF ("winPointerWarpCursor - Discarding first warp: %d %d\n",
|
||||
winErrorFVerb (2, "winPointerWarpCursor - Discarding first warp: %d %d\n",
|
||||
x, y);
|
||||
|
||||
return;
|
||||
|
@ -86,14 +118,495 @@ winPointerWarpCursor (ScreenPtr pScreen, int x, int y)
|
|||
miPointerWarpCursor (pScreen, x, y);
|
||||
}
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
winCrossScreen (ScreenPtr pScreen, Bool fEntering)
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
reverse(unsigned char c)
|
||||
{
|
||||
int i;
|
||||
unsigned char ret = 0;
|
||||
for (i = 0; i < 8; ++i)
|
||||
{
|
||||
ret |= ((c >> i)&1) << (7 - i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert X cursor to Windows cursor
|
||||
* FIXME: Perhaps there are more smart code
|
||||
*/
|
||||
static HCURSOR
|
||||
winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
HCURSOR hCursor = NULL;
|
||||
unsigned char *pAnd;
|
||||
unsigned char *pXor;
|
||||
int nCX, nCY;
|
||||
int nBytes;
|
||||
double dForeY, dBackY;
|
||||
BOOL fReverse;
|
||||
HBITMAP hAnd, hXor;
|
||||
ICONINFO ii;
|
||||
unsigned char *pCur;
|
||||
int x, y;
|
||||
unsigned char bit;
|
||||
HDC hDC;
|
||||
BITMAPV4HEADER bi;
|
||||
BITMAPINFO *pbmi;
|
||||
unsigned long *lpBits;
|
||||
|
||||
WIN_DEBUG_MSG("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n",
|
||||
pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
|
||||
pCursor->bits->width, pCursor->bits->height,
|
||||
pCursor->bits->xhot, pCursor->bits->yhot
|
||||
);
|
||||
|
||||
/* We can use only White and Black, so calc brightness of color
|
||||
* Also check if the cursor is inverted */
|
||||
dForeY = BRIGHTNESS(pCursor->fore);
|
||||
dBackY = BRIGHTNESS(pCursor->back);
|
||||
fReverse = dForeY < dBackY;
|
||||
|
||||
/* Check wether the X11 cursor is bigger than the win32 cursor */
|
||||
if (pScreenPriv->cursor.sm_cx < pCursor->bits->width ||
|
||||
pScreenPriv->cursor.sm_cy < pCursor->bits->height)
|
||||
{
|
||||
winErrorFVerb (2, "winLoadCursor - Windows requires %dx%d cursor\n"
|
||||
"\tbut X requires %dx%d\n",
|
||||
pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
|
||||
pCursor->bits->width, pCursor->bits->height);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Get the effective width and 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);
|
||||
memset (pAnd, 0xFF, nBytes);
|
||||
pXor = malloc (nBytes);
|
||||
memset (pXor, 0x00, nBytes);
|
||||
|
||||
/* Convert the X11 bitmap to a win32 bitmap
|
||||
* The first is for an empty mask */
|
||||
if (pCursor->bits->emptyMask)
|
||||
{
|
||||
int x, y, xmax = BYTE_COUNT(nCX);
|
||||
for (y = 0; y < nCY; ++y)
|
||||
for (x = 0; x < xmax; ++x)
|
||||
{
|
||||
int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x;
|
||||
int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
|
||||
|
||||
pAnd[nWinPix] = 0;
|
||||
if (fReverse)
|
||||
pXor[nWinPix] = reverse (~pCursor->bits->source[nXPix]);
|
||||
else
|
||||
pXor[nWinPix] = reverse (pCursor->bits->source[nXPix]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x, y, xmax = BYTE_COUNT(nCX);
|
||||
for (y = 0; y < nCY; ++y)
|
||||
for (x = 0; x < xmax; ++x)
|
||||
{
|
||||
int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x;
|
||||
int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
|
||||
|
||||
unsigned char mask = pCursor->bits->mask[nXPix];
|
||||
pAnd[nWinPix] = reverse (~mask);
|
||||
if (fReverse)
|
||||
pXor[nWinPix] = reverse (~pCursor->bits->source[nXPix] & mask);
|
||||
else
|
||||
pXor[nWinPix] = reverse (pCursor->bits->source[nXPix] & mask);
|
||||
}
|
||||
}
|
||||
|
||||
/* prepare the pointers */
|
||||
hCursor = NULL;
|
||||
lpBits = NULL;
|
||||
|
||||
/* We have a truecolor alpha-blended cursor and can use it! */
|
||||
if (pCursor->bits->argb)
|
||||
{
|
||||
WIN_DEBUG_MSG("winLoadCursor: Trying truecolor alphablended cursor\n");
|
||||
memset (&bi, 0, sizeof (BITMAPV4HEADER));
|
||||
bi.bV4Size = sizeof(BITMAPV4HEADER);
|
||||
bi.bV4Width = pScreenPriv->cursor.sm_cx;
|
||||
bi.bV4Height = -(pScreenPriv->cursor.sm_cy); /* right-side up */
|
||||
bi.bV4Planes = 1;
|
||||
bi.bV4BitCount = 32;
|
||||
bi.bV4V4Compression = BI_BITFIELDS;
|
||||
bi.bV4RedMask = 0x00FF0000;
|
||||
bi.bV4GreenMask = 0x0000FF00;
|
||||
bi.bV4BlueMask = 0x000000FF;
|
||||
bi.bV4AlphaMask = 0xFF000000;
|
||||
|
||||
lpBits = (unsigned long *) calloc (pScreenPriv->cursor.sm_cx*pScreenPriv->cursor.sm_cy,
|
||||
sizeof (unsigned long));
|
||||
|
||||
if (lpBits)
|
||||
{
|
||||
for (y=0; y<nCY; y++)
|
||||
{
|
||||
unsigned long *src, *dst;
|
||||
src = &(pCursor->bits->argb[y * pCursor->bits->width]);
|
||||
dst = &(lpBits[y * pScreenPriv->cursor.sm_cx]);
|
||||
memcpy (dst, src, 4*nCX);
|
||||
}
|
||||
}
|
||||
} /* End if-truecolor-icon */
|
||||
|
||||
if (!lpBits)
|
||||
{
|
||||
/* Bicolor, use a palettized DIB */
|
||||
WIN_DEBUG_MSG("winLoadCursor: Trying two color cursor\n");
|
||||
pbmi = (BITMAPINFO*)&bi;
|
||||
memset (pbmi, 0, sizeof (BITMAPINFOHEADER));
|
||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx;
|
||||
pbmi->bmiHeader.biHeight = -abs(pScreenPriv->cursor.sm_cy); /* right-side up */
|
||||
pbmi->bmiHeader.biPlanes = 1;
|
||||
pbmi->bmiHeader.biBitCount = 8;
|
||||
pbmi->bmiHeader.biCompression = BI_RGB;
|
||||
pbmi->bmiHeader.biSizeImage = 0;
|
||||
pbmi->bmiHeader.biClrUsed = 3;
|
||||
pbmi->bmiHeader.biClrImportant = 3;
|
||||
pbmi->bmiColors[0].rgbRed = 0; /* Empty */
|
||||
pbmi->bmiColors[0].rgbGreen = 0;
|
||||
pbmi->bmiColors[0].rgbBlue = 0;
|
||||
pbmi->bmiColors[0].rgbReserved = 0;
|
||||
pbmi->bmiColors[1].rgbRed = pCursor->backRed>>8; /* Background */
|
||||
pbmi->bmiColors[1].rgbGreen = pCursor->backGreen>>8;
|
||||
pbmi->bmiColors[1].rgbBlue = pCursor->backBlue>>8;
|
||||
pbmi->bmiColors[1].rgbReserved = 0;
|
||||
pbmi->bmiColors[2].rgbRed = pCursor->foreRed>>8; /* Foreground */
|
||||
pbmi->bmiColors[2].rgbGreen = pCursor->foreGreen>>8;
|
||||
pbmi->bmiColors[2].rgbBlue = pCursor->foreBlue>>8;
|
||||
pbmi->bmiColors[2].rgbReserved = 0;
|
||||
|
||||
lpBits = (unsigned long *) calloc (pScreenPriv->cursor.sm_cx*pScreenPriv->cursor.sm_cy,
|
||||
sizeof (char));
|
||||
|
||||
pCur = (unsigned char *)lpBits;
|
||||
if (lpBits)
|
||||
{
|
||||
for (y=0; y<pScreenPriv->cursor.sm_cy; y++)
|
||||
{
|
||||
for (x=0; x<pScreenPriv->cursor.sm_cx; x++)
|
||||
{
|
||||
if (x>=nCX || y>=nCY) /* Outside of X11 icon bounds */
|
||||
(*pCur++) = 0;
|
||||
else /* Within X11 icon bounds */
|
||||
{
|
||||
int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + (x/8);
|
||||
|
||||
bit = pAnd[nWinPix];
|
||||
bit = bit & (1<<(7-(x&7)));
|
||||
if (!bit) /* Within the cursor mask? */
|
||||
{
|
||||
int nXPix = BitmapBytePad(pCursor->bits->width) * y + (x/8);
|
||||
bit = ~reverse(~pCursor->bits->source[nXPix] & pCursor->bits->mask[nXPix]);
|
||||
bit = bit & (1<<(7-(x&7)));
|
||||
if (bit) /* Draw foreground */
|
||||
(*pCur++) = 2;
|
||||
else /* Draw background */
|
||||
(*pCur++) = 1;
|
||||
}
|
||||
else /* Outside the cursor mask */
|
||||
(*pCur++) = 0;
|
||||
}
|
||||
} /* end for (x) */
|
||||
} /* end for (y) */
|
||||
} /* end if (lpbits) */
|
||||
}
|
||||
|
||||
/* If one of the previous two methods gave us the bitmap we need, make a cursor */
|
||||
if (lpBits)
|
||||
{
|
||||
WIN_DEBUG_MSG("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n",
|
||||
pCursor->bits->xhot, pCursor->bits->yhot);
|
||||
|
||||
hAnd = NULL;
|
||||
hXor = NULL;
|
||||
|
||||
hAnd = CreateBitmap (pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, 1, 1, pAnd);
|
||||
|
||||
hDC = GetDC (NULL);
|
||||
if (hDC)
|
||||
{
|
||||
hXor = CreateCompatibleBitmap (hDC, pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy);
|
||||
SetDIBits (hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits, (BITMAPINFO*)&bi, DIB_RGB_COLORS);
|
||||
ReleaseDC (NULL, hDC);
|
||||
}
|
||||
free (lpBits);
|
||||
|
||||
|
||||
if (hAnd && hXor)
|
||||
{
|
||||
ii.fIcon = FALSE;
|
||||
ii.xHotspot = pCursor->bits->xhot;
|
||||
ii.yHotspot = pCursor->bits->yhot;
|
||||
ii.hbmMask = hAnd;
|
||||
ii.hbmColor = hXor;
|
||||
hCursor = (HCURSOR) CreateIconIndirect( &ii );
|
||||
|
||||
if (hCursor == NULL)
|
||||
winW32Error(2, "winLoadCursor - CreateIconIndirect failed:");
|
||||
else
|
||||
{
|
||||
if (GetIconInfo(hCursor, &ii))
|
||||
{
|
||||
if (ii.fIcon)
|
||||
{
|
||||
WIN_DEBUG_MSG("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n");
|
||||
|
||||
DestroyCursor(hCursor);
|
||||
|
||||
ii.fIcon = FALSE;
|
||||
ii.xHotspot = pCursor->bits->xhot;
|
||||
ii.yHotspot = pCursor->bits->yhot;
|
||||
hCursor = (HCURSOR) CreateIconIndirect( &ii );
|
||||
|
||||
if (hCursor == NULL)
|
||||
winW32Error(2, "winLoadCursor - CreateIconIndirect failed:");
|
||||
}
|
||||
/* GetIconInfo creates new bitmaps. Destroy them again */
|
||||
if (ii.hbmMask)
|
||||
DeleteObject(ii.hbmMask);
|
||||
if (ii.hbmColor)
|
||||
DeleteObject(ii.hbmColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hAnd)
|
||||
DeleteObject (hAnd);
|
||||
if (hXor)
|
||||
DeleteObject (hXor);
|
||||
}
|
||||
|
||||
if (!hCursor)
|
||||
{
|
||||
/* We couldn't make a color cursor for this screen, use
|
||||
black and white instead */
|
||||
hCursor = CreateCursor (g_hInstance,
|
||||
pCursor->bits->xhot, pCursor->bits->yhot,
|
||||
pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
|
||||
pAnd, pXor);
|
||||
if (hCursor == NULL)
|
||||
winW32Error(2, "winLoadCursor - CreateCursor failed:");
|
||||
}
|
||||
free (pAnd);
|
||||
free (pXor);
|
||||
|
||||
return hCursor;
|
||||
}
|
||||
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Pointer sprite functions
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* winRealizeCursor
|
||||
* Convert the X cursor representation to native format if possible.
|
||||
*/
|
||||
static Bool
|
||||
winRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
WIN_DEBUG_MSG("winRealizeCursor: cursor=%p\n", pCursor);
|
||||
|
||||
if(pCursor == NULL || pCursor->bits == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* FIXME: cache ARGB8888 representation? */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winUnrealizeCursor
|
||||
* Free the storage space associated with a realized cursor.
|
||||
*/
|
||||
static Bool
|
||||
winUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
WIN_DEBUG_MSG("winUnrealizeCursor: cursor=%p\n", pCursor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winSetCursor
|
||||
* Set the cursor sprite and position.
|
||||
*/
|
||||
static void
|
||||
winSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||
{
|
||||
POINT ptCurPos, ptTemp;
|
||||
HWND hwnd;
|
||||
RECT rcClient;
|
||||
BOOL bInhibit;
|
||||
winScreenPriv(pScreen);
|
||||
WIN_DEBUG_MSG("winSetCursor: cursor=%p\n", pCursor);
|
||||
|
||||
/* Inhibit changing the cursor if the mouse is not in a client area */
|
||||
bInhibit = FALSE;
|
||||
if (GetCursorPos (&ptCurPos))
|
||||
{
|
||||
hwnd = WindowFromPoint (ptCurPos);
|
||||
if (hwnd)
|
||||
{
|
||||
if (GetClientRect (hwnd, &rcClient))
|
||||
{
|
||||
ptTemp.x = rcClient.left;
|
||||
ptTemp.y = rcClient.top;
|
||||
if (ClientToScreen (hwnd, &ptTemp))
|
||||
{
|
||||
rcClient.left = ptTemp.x;
|
||||
rcClient.top = ptTemp.y;
|
||||
ptTemp.x = rcClient.right;
|
||||
ptTemp.y = rcClient.bottom;
|
||||
if (ClientToScreen (hwnd, &ptTemp))
|
||||
{
|
||||
rcClient.right = ptTemp.x;
|
||||
rcClient.bottom = ptTemp.y;
|
||||
if (!PtInRect (&rcClient, ptCurPos))
|
||||
bInhibit = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pCursor == NULL)
|
||||
{
|
||||
if (pScreenPriv->cursor.visible)
|
||||
{
|
||||
if (!bInhibit)
|
||||
ShowCursor (FALSE);
|
||||
pScreenPriv->cursor.visible = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pScreenPriv->cursor.handle)
|
||||
{
|
||||
if (!bInhibit)
|
||||
SetCursor (NULL);
|
||||
DestroyCursor (pScreenPriv->cursor.handle);
|
||||
pScreenPriv->cursor.handle = NULL;
|
||||
}
|
||||
pScreenPriv->cursor.handle =
|
||||
winLoadCursor (pScreen, pCursor, pScreen->myNum);
|
||||
WIN_DEBUG_MSG("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle);
|
||||
|
||||
if (!bInhibit)
|
||||
SetCursor (pScreenPriv->cursor.handle);
|
||||
|
||||
if (!pScreenPriv->cursor.visible)
|
||||
{
|
||||
if (!bInhibit)
|
||||
ShowCursor (TRUE);
|
||||
pScreenPriv->cursor.visible = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzMoveCursor
|
||||
* Move the cursor. This is a noop for us.
|
||||
*/
|
||||
static void
|
||||
winMoveCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static miPointerSpriteFuncRec winSpriteFuncsRec = {
|
||||
winRealizeCursor,
|
||||
winUnrealizeCursor,
|
||||
winSetCursor,
|
||||
winMoveCursor
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Other screen functions
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* winCursorQueryBestSize
|
||||
* Handle queries for best cursor size
|
||||
*/
|
||||
static void
|
||||
winCursorQueryBestSize (int class, unsigned short *width,
|
||||
unsigned short *height, ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
||||
if (class == CursorShape)
|
||||
{
|
||||
*width = pScreenPriv->cursor.sm_cx;
|
||||
*height = pScreenPriv->cursor.sm_cy;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pScreenPriv->cursor.QueryBestSize)
|
||||
(*pScreenPriv->cursor.QueryBestSize)(class, width, height, pScreen);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* winInitCursor
|
||||
* Initialize cursor support
|
||||
*/
|
||||
Bool
|
||||
winInitCursor (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
miPointerScreenPtr pPointPriv;
|
||||
/* override some screen procedures */
|
||||
pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize;
|
||||
pScreen->QueryBestSize = winCursorQueryBestSize;
|
||||
|
||||
pPointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr;
|
||||
|
||||
pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
|
||||
pPointPriv->spriteFuncs = &winSpriteFuncsRec;
|
||||
|
||||
pScreenPriv->cursor.handle = NULL;
|
||||
pScreenPriv->cursor.visible = FALSE;
|
||||
|
||||
pScreenPriv->cursor.sm_cx = GetSystemMetrics (SM_CXCURSOR);
|
||||
pScreenPriv->cursor.sm_cy = GetSystemMetrics (SM_CYCURSOR);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,32 +15,193 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
* Earle F. Philhower III
|
||||
*/
|
||||
/* $XFree86: $ */
|
||||
|
||||
#include "win.h"
|
||||
#include <sys/cygwin.h>
|
||||
#include <shellapi.h>
|
||||
#include "winprefs.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external globals
|
||||
*/
|
||||
|
||||
extern Bool g_fCursor;
|
||||
extern HWND g_hDlgDepthChange;
|
||||
extern HWND g_hDlgExit;
|
||||
extern HWND g_hDlgAbout;
|
||||
extern WINPREFS pref;
|
||||
extern Bool g_fClipboardStarted;
|
||||
extern Bool g_fSoftwareCursor;
|
||||
|
||||
BOOL CALLBACK
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
static BOOL CALLBACK
|
||||
winExitDlgProc (HWND hDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
|
||||
BOOL CALLBACK
|
||||
static BOOL CALLBACK
|
||||
winChangeDepthDlgProc (HWND hDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static BOOL CALLBACK
|
||||
winAboutDlgProc (HWND hDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
||||
static void
|
||||
winDrawURLWindow (LPARAM lParam);
|
||||
|
||||
static LRESULT CALLBACK
|
||||
winURLWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static void
|
||||
winOverrideURLButton (HWND hdlg, int id);
|
||||
|
||||
static void
|
||||
winUnoverrideURLButton (HWND hdlg, int id);
|
||||
|
||||
|
||||
/*
|
||||
* Owner-draw a button as a URL
|
||||
*/
|
||||
|
||||
static void
|
||||
winDrawURLWindow (LPARAM lParam)
|
||||
{
|
||||
DRAWITEMSTRUCT *draw;
|
||||
char str[256];
|
||||
RECT rect;
|
||||
HFONT font;
|
||||
COLORREF crText;
|
||||
|
||||
draw = (DRAWITEMSTRUCT *) lParam;
|
||||
GetWindowText (draw->hwndItem, str, sizeof(str));
|
||||
str[255] = 0;
|
||||
GetClientRect (draw->hwndItem, &rect);
|
||||
|
||||
/* Color the button depending upon its state */
|
||||
if (draw->itemState & ODS_SELECTED)
|
||||
crText = RGB(128+64,0,0);
|
||||
else if (draw->itemState & ODS_FOCUS)
|
||||
crText = RGB(0,128+64,0);
|
||||
else
|
||||
crText = RGB(0,0,128+64);
|
||||
SetTextColor (draw->hDC, crText);
|
||||
|
||||
/* Create underlined font 14 high, standard dialog font */
|
||||
font = CreateFont (-14, 0, 0, 0, FW_NORMAL, FALSE, TRUE, FALSE,
|
||||
0, 0, 0, 0, 0, "MS Sans Serif");
|
||||
if (!font)
|
||||
{
|
||||
ErrorF ("winDrawURLWindow: Unable to create URL font, bailing.\n");
|
||||
return;
|
||||
}
|
||||
/* Draw it */
|
||||
SetBkMode (draw->hDC, OPAQUE);
|
||||
SelectObject (draw->hDC, font);
|
||||
DrawText (draw->hDC, str, strlen (str),&rect,DT_CENTER | DT_VCENTER);
|
||||
/* Delete the created font, replace it with stock font */
|
||||
DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* WndProc for overridden buttons
|
||||
*/
|
||||
|
||||
static LRESULT CALLBACK
|
||||
winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC origCB = NULL;
|
||||
HCURSOR cursor;
|
||||
|
||||
/* If it's a SetCursor message, tell it to the hand */
|
||||
if (msg==WM_SETCURSOR) {
|
||||
cursor = LoadCursor (NULL, IDC_HAND);
|
||||
if (cursor)
|
||||
SetCursor (cursor);
|
||||
return TRUE;
|
||||
}
|
||||
origCB = (WNDPROC)GetWindowLong (hwnd, GWL_USERDATA);
|
||||
/* Otherwise fall through to original WndProc */
|
||||
if (origCB)
|
||||
return CallWindowProc (origCB, hwnd, msg, wParam, lParam);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Register and unregister the custom WndProc
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
winUnoverrideURLButton (HWND hwnd, int id)
|
||||
{
|
||||
WNDPROC origCB;
|
||||
origCB = (WNDPROC)SetWindowLong (GetDlgItem (hwnd, id),
|
||||
GWL_USERDATA, 0);
|
||||
if (origCB)
|
||||
SetWindowLong (GetDlgItem (hwnd, id), GWL_WNDPROC, (LONG)origCB);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Center a dialog window in the desktop window
|
||||
*/
|
||||
|
||||
static void
|
||||
winCenterDialog (HWND hwndDlg)
|
||||
{
|
||||
HWND hwndDesk;
|
||||
RECT rc, rcDlg, rcDesk;
|
||||
|
||||
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),
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOZORDER);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display the Exit dialog box
|
||||
|
@ -49,6 +210,37 @@ winChangeDepthDlgProc (HWND hDialog, UINT message,
|
|||
void
|
||||
winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
|
||||
{
|
||||
int i;
|
||||
int liveClients = 0;
|
||||
|
||||
/* Count up running clinets (clients[0] is serverClient) */
|
||||
for (i = 1; i < currentMaxClients; i++)
|
||||
if (clients[i] != NullClient)
|
||||
liveClients++;
|
||||
/* Count down server internal clients */
|
||||
if (pScreenPriv->pScreenInfo->fMultiWindow)
|
||||
liveClients -= 2; /* multiwindow window manager & XMsgProc */
|
||||
if (g_fClipboardStarted)
|
||||
liveClients--; /* clipboard manager */
|
||||
|
||||
/* A user reported that this sometimes drops below zero. just eye-candy. */
|
||||
if (liveClients < 0)
|
||||
liveClients = 0;
|
||||
|
||||
/* Don't show the exit confirmation dialog if SilentExit is enabled */
|
||||
if (pref.fSilentExit && liveClients <= 0)
|
||||
{
|
||||
if (g_hDlgExit != NULL)
|
||||
{
|
||||
DestroyWindow (g_hDlgExit);
|
||||
g_hDlgExit = NULL;
|
||||
}
|
||||
PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
pScreenPriv->iConnectedClients = liveClients;
|
||||
|
||||
/* Check if dialog already exists */
|
||||
if (g_hDlgExit != NULL)
|
||||
{
|
||||
|
@ -74,8 +266,8 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
|
|||
& ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
|
||||
SetWindowLong (g_hDlgExit, GWL_EXSTYLE,
|
||||
GetWindowLong (g_hDlgExit, GWL_EXSTYLE) & ~WS_EX_APPWINDOW );
|
||||
SetWindowPos (g_hDlgExit, 0, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE);
|
||||
SetWindowPos (g_hDlgExit, HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
|
||||
/* Show the dialog box */
|
||||
ShowWindow (g_hDlgExit, SW_SHOW);
|
||||
|
@ -83,38 +275,60 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
|
|||
/* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
|
||||
SetForegroundWindow (g_hDlgExit);
|
||||
|
||||
/* Set focus to the Cancel buton */
|
||||
/* Set focus to the Cancel button */
|
||||
PostMessage (g_hDlgExit, WM_NEXTDLGCTL,
|
||||
(int) GetDlgItem (g_hDlgExit, IDCANCEL), TRUE);
|
||||
}
|
||||
|
||||
#define CONNECTED_CLIENTS_FORMAT "There are currently %d clients connected."
|
||||
|
||||
|
||||
/*
|
||||
* Exit dialog window procedure
|
||||
*/
|
||||
|
||||
BOOL CALLBACK
|
||||
static BOOL CALLBACK
|
||||
winExitDlgProc (HWND hDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static winPrivScreenPtr s_pScreenPriv = NULL;
|
||||
static winScreenInfo *s_pScreenInfo = NULL;
|
||||
static ScreenPtr s_pScreen = NULL;
|
||||
|
||||
/* Branch on message type */
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
/* Store pointers to private structures for future use */
|
||||
s_pScreenPriv = (winPrivScreenPtr) lParam;
|
||||
s_pScreenInfo = s_pScreenPriv->pScreenInfo;
|
||||
s_pScreen = s_pScreenInfo->pScreen;
|
||||
{
|
||||
char *pszConnectedClients;
|
||||
int iReturn;
|
||||
|
||||
/* Set icon to standard app icon */
|
||||
PostMessage (hDialog,
|
||||
WM_SETICON,
|
||||
ICON_SMALL,
|
||||
(LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)));
|
||||
/* 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)));
|
||||
|
||||
/* Format the connected clients string */
|
||||
iReturn = sprintf (NULL, CONNECTED_CLIENTS_FORMAT,
|
||||
s_pScreenPriv->iConnectedClients);
|
||||
if (iReturn <= 0)
|
||||
return TRUE;
|
||||
pszConnectedClients = malloc (iReturn + 1);
|
||||
if (!pszConnectedClients)
|
||||
return TRUE;
|
||||
snprintf (pszConnectedClients, iReturn + 1, CONNECTED_CLIENTS_FORMAT,
|
||||
s_pScreenPriv->iConnectedClients);
|
||||
|
||||
/* Set the number of connected clients */
|
||||
SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED),
|
||||
pszConnectedClients);
|
||||
free (pszConnectedClients);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -143,7 +357,7 @@ winExitDlgProc (HWND hDialog, UINT message,
|
|||
case WM_MOUSEMOVE:
|
||||
case WM_NCMOUSEMOVE:
|
||||
/* Show the cursor if it is hidden */
|
||||
if (!g_fCursor)
|
||||
if (g_fSoftwareCursor && !g_fCursor)
|
||||
{
|
||||
g_fCursor = TRUE;
|
||||
ShowCursor (TRUE);
|
||||
|
@ -207,8 +421,9 @@ winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
|
|||
ShowWindow (g_hDlgDepthChange, SW_SHOW);
|
||||
|
||||
ErrorF ("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
|
||||
g_hDlgDepthChange);
|
||||
ErrorF ("winDisplayDepthChangeDialog - GetLastError: %d\n", GetLastError ());
|
||||
(int) g_hDlgDepthChange);
|
||||
ErrorF ("winDisplayDepthChangeDialog - GetLastError: %d\n",
|
||||
(int) GetLastError ());
|
||||
|
||||
/* Minimize the display window */
|
||||
ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
|
||||
|
@ -220,7 +435,7 @@ winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
|
|||
* disruptive screen depth changes.
|
||||
*/
|
||||
|
||||
BOOL CALLBACK
|
||||
static BOOL CALLBACK
|
||||
winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -229,7 +444,7 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
|||
static ScreenPtr s_pScreen = NULL;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winChangeDepthDlgProc\n");
|
||||
winDebug ("winChangeDepthDlgProc\n");
|
||||
#endif
|
||||
|
||||
/* Branch on message type */
|
||||
|
@ -237,7 +452,7 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winChangeDepthDlgProc - WM_INITDIALOG\n");
|
||||
winDebug ("winChangeDepthDlgProc - WM_INITDIALOG\n");
|
||||
#endif
|
||||
|
||||
/* Store pointers to private structures for future use */
|
||||
|
@ -246,17 +461,19 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
|||
s_pScreen = s_pScreenInfo->pScreen;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winChangeDepthDlgProc - WM_INITDIALG - s_pScreenPriv: %08x, "
|
||||
winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
|
||||
"s_pScreenInfo: %08x, s_pScreen: %08x\n",
|
||||
s_pScreenPriv, s_pScreenInfo, s_pScreen);
|
||||
#endif
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
|
||||
winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
|
||||
"last bpp: %d\n",
|
||||
s_pScreenInfo->dwBPP,
|
||||
s_pScreenPriv->dwLastWindowsBitsPixel);
|
||||
#endif
|
||||
|
||||
winCenterDialog( hwndDialog );
|
||||
|
||||
/* Set icon to standard app icon */
|
||||
PostMessage (hwndDialog,
|
||||
|
@ -268,7 +485,7 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
|||
|
||||
case WM_DISPLAYCHANGE:
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
|
||||
winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
|
||||
"last bpp: %d, new bpp: %d\n",
|
||||
s_pScreenInfo->dwBPP,
|
||||
s_pScreenPriv->dwLastWindowsBitsPixel,
|
||||
|
@ -308,11 +525,250 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
|||
case WM_CLOSE:
|
||||
ErrorF ("winChangeDepthDlgProc - WM_CLOSE\n");
|
||||
|
||||
/*
|
||||
* User dismissed the dialog, hide it until the
|
||||
* display mode is restored.
|
||||
*/
|
||||
ShowWindow (g_hDlgDepthChange, SW_HIDE);
|
||||
DestroyWindow (g_hDlgAbout);
|
||||
g_hDlgAbout = NULL;
|
||||
|
||||
/* Fix to make sure keyboard focus isn't trapped */
|
||||
PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display the About dialog box
|
||||
*/
|
||||
|
||||
void
|
||||
winDisplayAboutDialog (winPrivScreenPtr pScreenPriv)
|
||||
{
|
||||
/* Check if dialog already exists */
|
||||
if (g_hDlgAbout != NULL)
|
||||
{
|
||||
/* Dialog box already exists, display it */
|
||||
ShowWindow (g_hDlgAbout, SW_SHOWDEFAULT);
|
||||
|
||||
/* User has lost the dialog. Show them where it is. */
|
||||
SetForegroundWindow (g_hDlgAbout);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the about box
|
||||
*/
|
||||
g_hDlgAbout = CreateDialogParam (g_hInstance,
|
||||
"ABOUT_BOX",
|
||||
pScreenPriv->hwndScreen,
|
||||
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);
|
||||
|
||||
/* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
|
||||
SetForegroundWindow (g_hDlgAbout);
|
||||
|
||||
/* Set focus to the OK button */
|
||||
PostMessage (g_hDlgAbout, WM_NEXTDLGCTL,
|
||||
(int) GetDlgItem (g_hDlgAbout, IDOK), TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process messages for the about dialog.
|
||||
*/
|
||||
|
||||
static BOOL CALLBACK
|
||||
winAboutDlgProc (HWND hwndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static winPrivScreenPtr s_pScreenPriv = NULL;
|
||||
static winScreenInfo *s_pScreenInfo = NULL;
|
||||
static ScreenPtr s_pScreen = NULL;
|
||||
|
||||
#if CYGDEBUG
|
||||
winDebug ("winAboutDlgProc\n");
|
||||
#endif
|
||||
|
||||
/* Branch on message type */
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
#if CYGDEBUG
|
||||
winDebug ("winAboutDlgProc - WM_INITDIALOG\n");
|
||||
#endif
|
||||
|
||||
/* Store pointers to private structures for future use */
|
||||
s_pScreenPriv = (winPrivScreenPtr) lParam;
|
||||
s_pScreenInfo = s_pScreenPriv->pScreenInfo;
|
||||
s_pScreen = s_pScreenInfo->pScreen;
|
||||
|
||||
winCenterDialog (hwndDialog);
|
||||
|
||||
/* Set icon to standard app icon */
|
||||
PostMessage (hwndDialog,
|
||||
WM_SETICON,
|
||||
ICON_SMALL,
|
||||
(LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)));
|
||||
|
||||
/* Override the URL buttons */
|
||||
winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
|
||||
winOverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
|
||||
winOverrideURLButton (hwndDialog, ID_ABOUT_UG);
|
||||
winOverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
/* Draw the URL buttons as needed */
|
||||
winDrawURLWindow (lParam);
|
||||
return TRUE;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
case WM_NCMOUSEMOVE:
|
||||
/* Show the cursor if it is hidden */
|
||||
if (g_fSoftwareCursor && !g_fCursor)
|
||||
{
|
||||
g_fCursor = TRUE;
|
||||
ShowCursor (TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD (wParam))
|
||||
{
|
||||
case IDOK:
|
||||
case IDCANCEL:
|
||||
ErrorF ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
|
||||
|
||||
DestroyWindow (g_hDlgAbout);
|
||||
g_hDlgAbout = NULL;
|
||||
|
||||
/* Fix to make sure keyboard focus isn't trapped */
|
||||
PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
|
||||
|
||||
/* Restore window procedures for URL buttons */
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case ID_ABOUT_CHANGELOG:
|
||||
{
|
||||
const char * pszCygPath = "/usr/X11R6/share/doc/"
|
||||
"xorg-x11-xwin/changelog.html";
|
||||
char pszWinPath[MAX_PATH + 1];
|
||||
int iReturn;
|
||||
|
||||
/* Convert the POSIX path to a Win32 path */
|
||||
cygwin_conv_to_win32_path (pszCygPath, pszWinPath);
|
||||
|
||||
iReturn = (int) ShellExecute (NULL,
|
||||
"open",
|
||||
pszWinPath,
|
||||
NULL,
|
||||
NULL,
|
||||
SW_MAXIMIZE);
|
||||
if (iReturn < 32)
|
||||
{
|
||||
ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
|
||||
"ShellExecute failed: %d\n",
|
||||
iReturn);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case ID_ABOUT_WEBSITE:
|
||||
{
|
||||
const char * pszPath = "http://x.cygwin.com/";
|
||||
int iReturn;
|
||||
|
||||
iReturn = (int) ShellExecute (NULL,
|
||||
"open",
|
||||
pszPath,
|
||||
NULL,
|
||||
NULL,
|
||||
SW_MAXIMIZE);
|
||||
if (iReturn < 32)
|
||||
{
|
||||
ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
|
||||
"ShellExecute failed: %d\n",
|
||||
iReturn);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case ID_ABOUT_UG:
|
||||
{
|
||||
const char * pszPath = "http://x.cygwin.com/docs/ug/";
|
||||
int iReturn;
|
||||
|
||||
iReturn = (int) ShellExecute (NULL,
|
||||
"open",
|
||||
pszPath,
|
||||
NULL,
|
||||
NULL,
|
||||
SW_MAXIMIZE);
|
||||
if (iReturn < 32)
|
||||
{
|
||||
ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
|
||||
"ShellExecute failed: %d\n",
|
||||
iReturn);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case ID_ABOUT_FAQ:
|
||||
{
|
||||
const char * pszPath = "http://x.cygwin.com/docs/faq/";
|
||||
int iReturn;
|
||||
|
||||
iReturn = (int) ShellExecute (NULL,
|
||||
"open",
|
||||
pszPath,
|
||||
NULL,
|
||||
NULL,
|
||||
SW_MAXIMIZE);
|
||||
if (iReturn < 32)
|
||||
{
|
||||
ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
|
||||
"ShellExecute failed: %d\n",
|
||||
iReturn);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
ErrorF ("winAboutDlgProc - WM_CLOSE\n");
|
||||
|
||||
DestroyWindow (g_hDlgAbout);
|
||||
g_hDlgAbout = NULL;
|
||||
|
||||
/* Fix to make sure keyboard focus isn't trapped */
|
||||
PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
|
||||
|
||||
/* Restore window procedures for URL buttons */
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
|
||||
winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,21 +15,21 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winengine.c,v 1.3 2002/07/05 09:19:26 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "winmsg.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -52,7 +52,7 @@ winDetectSupportedEngines ()
|
|||
/* Initialize the engine support flags */
|
||||
g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
|
||||
|
||||
#if WIN_NATIVE_GDI_SUPPORT
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
|
||||
#endif
|
||||
|
||||
|
@ -66,12 +66,12 @@ winDetectSupportedEngines ()
|
|||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
/* Engine 4 is supported on NT only */
|
||||
ErrorF ("winDetectSupportedEngines - Windows NT/2000/XP\n");
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - Windows NT/2000/XP\n");
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
/* Engine 4 is supported on NT only */
|
||||
ErrorF ("winDetectSupportedEngines - Windows 95/98/Me\n");
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - Windows 95/98/Me\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -97,21 +97,23 @@ winDetectSupportedEngines ()
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
/* No DirectDraw support */
|
||||
ErrorF ("winDetectSupportedEngines - DirectDraw not installed\n");
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw not installed\n");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have DirectDraw */
|
||||
ErrorF ("winDetectSupportedEngines - DirectDraw installed\n");
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw installed\n");
|
||||
g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
|
||||
|
||||
#ifdef XWIN_PRIMARYFB
|
||||
/* Allow PrimaryDD engine if NT */
|
||||
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
{
|
||||
g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
|
||||
ErrorF ("winDetectSupportedEngines - Allowing PrimaryDD\n");
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - Allowing PrimaryDD\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Try to query for DirectDraw4 interface */
|
||||
|
@ -121,7 +123,7 @@ winDetectSupportedEngines ()
|
|||
if (SUCCEEDED (ddrval))
|
||||
{
|
||||
/* We have DirectDraw4 */
|
||||
ErrorF ("winDetectSupportedEngines - DirectDraw4 installed\n");
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw4 installed\n");
|
||||
g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
|
||||
}
|
||||
|
||||
|
@ -132,8 +134,8 @@ winDetectSupportedEngines ()
|
|||
IDirectDraw_Release (lpdd);
|
||||
}
|
||||
|
||||
ErrorF ("winDetectSupportedEngines - Returning, supported engines %08x\n",
|
||||
g_dwEnginesSupported);
|
||||
winErrorFVerb (2, "winDetectSupportedEngines - Returning, supported engines %08x\n",
|
||||
(unsigned int) g_dwEnginesSupported);
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,7 +175,7 @@ winSetEngine (ScreenPtr pScreen)
|
|||
/* ShadowGDI is the only engine that supports windowed PseudoColor */
|
||||
if (dwBPP == 8 && !pScreenInfo->fFullScreen)
|
||||
{
|
||||
ErrorF ("winSetEngine - Windowed && PseudoColor => ShadowGDI\n");
|
||||
winErrorFVerb (2, "winSetEngine - Windowed && PseudoColor => ShadowGDI\n");
|
||||
pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
|
||||
|
||||
/* Set engine function pointers */
|
||||
|
@ -182,9 +184,20 @@ winSetEngine (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
/* ShadowGDI is the only engine that supports Multi Window Mode */
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
if (
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
pScreenInfo->fMWExtWM
|
||||
#else
|
||||
FALSE
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| pScreenInfo->fMultiWindow
|
||||
#else
|
||||
|| FALSE
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ErrorF ("winSetEngine - Multi Window => ShadowGDI\n");
|
||||
winErrorFVerb (2, "winSetEngine - Multi Window or Rootless => ShadowGDI\n");
|
||||
pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
|
||||
|
||||
/* Set engine function pointers */
|
||||
|
@ -195,8 +208,8 @@ winSetEngine (ScreenPtr pScreen)
|
|||
/* If the user's choice is supported, we'll use that */
|
||||
if (g_dwEnginesSupported & pScreenInfo->dwEnginePreferred)
|
||||
{
|
||||
ErrorF ("winSetEngine - Using user's preference: %d\n",
|
||||
pScreenInfo->dwEnginePreferred);
|
||||
winErrorFVerb (2, "winSetEngine - Using user's preference: %d\n",
|
||||
(int) pScreenInfo->dwEnginePreferred);
|
||||
pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred;
|
||||
|
||||
/* Setup engine function pointers */
|
||||
|
@ -211,12 +224,16 @@ winSetEngine (ScreenPtr pScreen)
|
|||
case WIN_SERVER_SHADOW_DDNL:
|
||||
winSetEngineFunctionsShadowDDNL (pScreen);
|
||||
break;
|
||||
#ifdef XWIN_PRIMARYFB
|
||||
case WIN_SERVER_PRIMARY_DD:
|
||||
winSetEngineFunctionsPrimaryDD (pScreen);
|
||||
break;
|
||||
#endif
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
case WIN_SERVER_NATIVE_GDI:
|
||||
winSetEngineFunctionsNativeGDI (pScreen);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
FatalError ("winSetEngine - Invalid engine type\n");
|
||||
}
|
||||
|
@ -226,7 +243,7 @@ winSetEngine (ScreenPtr pScreen)
|
|||
/* ShadowDDNL has good performance, so why not */
|
||||
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL)
|
||||
{
|
||||
ErrorF ("winSetEngine - Using Shadow DirectDraw NonLocking\n");
|
||||
winErrorFVerb (2, "winSetEngine - Using Shadow DirectDraw NonLocking\n");
|
||||
pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL;
|
||||
|
||||
/* Set engine function pointers */
|
||||
|
@ -237,7 +254,7 @@ winSetEngine (ScreenPtr pScreen)
|
|||
/* ShadowDD is next in line */
|
||||
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD)
|
||||
{
|
||||
ErrorF ("winSetEngine - Using Shadow DirectDraw\n");
|
||||
winErrorFVerb (2, "winSetEngine - Using Shadow DirectDraw\n");
|
||||
pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
|
||||
|
||||
/* Set engine function pointers */
|
||||
|
@ -248,7 +265,7 @@ winSetEngine (ScreenPtr pScreen)
|
|||
/* ShadowGDI is next in line */
|
||||
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI)
|
||||
{
|
||||
ErrorF ("winSetEngine - Using Shadow GDI DIB\n");
|
||||
winErrorFVerb (2, "winSetEngine - Using Shadow GDI DIB\n");
|
||||
pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
|
||||
|
||||
/* Set engine function pointers */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,23 +15,31 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winerror.c,v 1.3 2001/10/23 22:22:47 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
/* References to external symbols */
|
||||
extern char * g_pszCommandLine;
|
||||
extern Bool g_fUseMsg;
|
||||
|
||||
|
||||
#ifdef DDXOSVERRORF
|
||||
/* Prototype */
|
||||
void
|
||||
OsVendorVErrorF (const char *pszFormat, va_list va_args);
|
||||
|
||||
void
|
||||
OsVendorVErrorF (const char *pszFormat, va_list va_args)
|
||||
{
|
||||
|
@ -41,7 +49,7 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
|
|||
pthread_mutex_lock (&s_pmPrinting);
|
||||
|
||||
/* Print the error message to a log file, could be stderr */
|
||||
LogVWrite(0, pszFormat, va_args);
|
||||
LogVWrite (0, pszFormat, va_args);
|
||||
|
||||
/* Unlock the printing mutex */
|
||||
pthread_mutex_unlock (&s_pmPrinting);
|
||||
|
@ -60,6 +68,80 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
|
|||
void
|
||||
OsVendorFatalError (void)
|
||||
{
|
||||
|
||||
/* Don't give duplicate warning if UseMsg was called */
|
||||
if (g_fUseMsg)
|
||||
return;
|
||||
|
||||
winMessageBoxF ("A fatal error has occurred and Cygwin/X will now exit.\n" \
|
||||
"Please open /tmp/XWin.log for more information.\n",
|
||||
MB_ICONERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* winMessageBoxF - Print a formatted error message in a useful
|
||||
* message box.
|
||||
*/
|
||||
|
||||
void
|
||||
winMessageBoxF (const char *pszError, UINT uType, ...)
|
||||
{
|
||||
int i;
|
||||
char * pszErrorF = NULL;
|
||||
char * pszMsgBox = NULL;
|
||||
va_list args;
|
||||
|
||||
/* Get length of formatted error string */
|
||||
va_start (args, uType);
|
||||
i = sprintf (NULL, pszError, args);
|
||||
va_end (args);
|
||||
|
||||
/* Allocate memory for formatted error string */
|
||||
pszErrorF = malloc (i);
|
||||
if (!pszErrorF)
|
||||
goto winMessageBoxF_Cleanup;
|
||||
|
||||
/* Create the formatted error string */
|
||||
va_start (args, uType);
|
||||
sprintf (pszErrorF, pszError, args);
|
||||
va_end (args);
|
||||
|
||||
#define MESSAGEBOXF \
|
||||
"%s\n" \
|
||||
"Vendor: %s\n" \
|
||||
"Release: %s\n" \
|
||||
"Contact: %s\n" \
|
||||
"XWin was started with the following command-line:\n\n" \
|
||||
"%s\n"
|
||||
|
||||
/* Get length of message box string */
|
||||
i = sprintf (NULL, MESSAGEBOXF,
|
||||
pszErrorF,
|
||||
VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT,
|
||||
g_pszCommandLine);
|
||||
|
||||
/* Allocate memory for message box string */
|
||||
pszMsgBox = malloc (i);
|
||||
if (!pszMsgBox)
|
||||
goto winMessageBoxF_Cleanup;
|
||||
|
||||
/* Format the message box string */
|
||||
sprintf (pszMsgBox, MESSAGEBOXF,
|
||||
pszErrorF,
|
||||
VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT,
|
||||
g_pszCommandLine);
|
||||
|
||||
/* Display the message box string */
|
||||
MessageBox (NULL,
|
||||
pszMsgBox,
|
||||
"Cygwin/X",
|
||||
MB_OK | uType);
|
||||
|
||||
winMessageBoxF_Cleanup:
|
||||
if (pszErrorF)
|
||||
free (pszErrorF);
|
||||
if (pszMsgBox)
|
||||
free (pszMsgBox);
|
||||
#undef MESSAGEBOXF
|
||||
}
|
||||
|
|
|
@ -32,6 +32,16 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern int g_iPixmapPrivateIndex;
|
||||
extern int g_iGCPrivateIndex;
|
||||
extern int g_copyROP[];
|
||||
|
||||
|
||||
extern void ROP16(HDC hdc, int rop);
|
||||
|
||||
#define TRANSLATE_COLOR(color) \
|
||||
|
@ -118,7 +128,7 @@ winFillSpansNativeGDI (DrawablePtr pDrawable,
|
|||
if (hbmpOrig == NULL)
|
||||
FatalError ("winFillSpans - DRAWABLE_PIXMAP - "
|
||||
"SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
|
||||
"%08x\n", pPixmapPriv->hBitmap);
|
||||
"%08x\n", (unsigned int) pPixmapPriv->hBitmap);
|
||||
|
||||
/* Branch on the fill type */
|
||||
switch (pGC->fillStyle)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,19 +15,18 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winfont.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
@ -37,7 +36,7 @@ Bool
|
|||
winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winRealizeFont()\n");
|
||||
winDebug ("winRealizeFont()\n");
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -48,7 +47,7 @@ Bool
|
|||
winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winUnrealizeFont()\n");
|
||||
winDebug ("winUnrealizeFont()\n");
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,23 +15,57 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.10 2001/10/30 15:39:09 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
void
|
||||
winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
|
||||
winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static void
|
||||
winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges);
|
||||
#endif
|
||||
|
||||
static void
|
||||
winValidateGCNativeGDI (GCPtr pGC,
|
||||
unsigned long changes,
|
||||
DrawablePtr pDrawable);
|
||||
|
||||
#if 0
|
||||
static void
|
||||
winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst);
|
||||
#endif
|
||||
|
||||
static void
|
||||
winDestroyGCNativeGDI (GCPtr pGC);
|
||||
|
||||
#if 0
|
||||
static void
|
||||
winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects);
|
||||
|
||||
static void
|
||||
winDestroyClipNativeGDI (GCPtr pGC);
|
||||
|
||||
static void
|
||||
winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* GC Handling Routines */
|
||||
|
@ -133,17 +167,19 @@ winCreateGCNativeGDI (GCPtr pGC)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* See Porting Layer Definition - p. 45 */
|
||||
void
|
||||
static void
|
||||
winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winChangeGCNativeGDI () - Doing nothing\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
winValidateGCNativeGDI (GCPtr pGC,
|
||||
unsigned long ulChanges,
|
||||
DrawablePtr pDrawable)
|
||||
|
@ -156,16 +192,18 @@ winValidateGCNativeGDI (GCPtr pGC,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* See Porting Layer Definition - p. 46 */
|
||||
void
|
||||
static void
|
||||
winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 46 */
|
||||
void
|
||||
static void
|
||||
winDestroyGCNativeGDI (GCPtr pGC)
|
||||
{
|
||||
winGCPriv(pGC);
|
||||
|
@ -193,8 +231,9 @@ winDestroyGCNativeGDI (GCPtr pGC)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* See Porting Layer Definition - p. 46 */
|
||||
void
|
||||
static void
|
||||
winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects)
|
||||
{
|
||||
|
||||
|
@ -202,7 +241,7 @@ winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects)
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 47 */
|
||||
void
|
||||
static void
|
||||
winDestroyClipNativeGDI (GCPtr pGC)
|
||||
{
|
||||
|
||||
|
@ -210,8 +249,9 @@ winDestroyClipNativeGDI (GCPtr pGC)
|
|||
|
||||
|
||||
/* See Porting Layer Definition - p. 47 */
|
||||
void
|
||||
static void
|
||||
winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
128
hw/xwin/winglobals.c
Normal file
128
hw/xwin/winglobals.c
Normal file
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
*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
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* General global variables
|
||||
*/
|
||||
|
||||
int g_iNumScreens = 0;
|
||||
winScreenInfo g_ScreenInfo[MAXSCREENS];
|
||||
int g_iLastScreen = -1;
|
||||
int g_fdMessageQueue = WIN_FD_INVALID;
|
||||
int g_iScreenPrivateIndex = -1;
|
||||
int g_iCmapPrivateIndex = -1;
|
||||
int g_iGCPrivateIndex = -1;
|
||||
int g_iPixmapPrivateIndex = -1;
|
||||
int g_iWindowPrivateIndex = -1;
|
||||
unsigned long g_ulServerGeneration = 0;
|
||||
Bool g_fInitializedDefaultScreens = FALSE;
|
||||
DWORD g_dwEnginesSupported = 0;
|
||||
HINSTANCE g_hInstance = 0;
|
||||
HWND g_hDlgDepthChange = NULL;
|
||||
HWND g_hDlgExit = NULL;
|
||||
HWND g_hDlgAbout = NULL;
|
||||
const char * g_pszQueryHost = NULL;
|
||||
Bool g_fXdmcpEnabled = FALSE;
|
||||
HICON g_hIconX = NULL;
|
||||
HICON g_hSmallIconX = NULL;
|
||||
char * g_pszLogFile = "/tmp/XWin.log";
|
||||
int g_iLogVerbose = 2;
|
||||
Bool g_fLogInited = FALSE;
|
||||
char * g_pszCommandLine = NULL;
|
||||
Bool g_fUseMsg = FALSE;
|
||||
DWORD g_dwCurrentThreadID = 0;
|
||||
Bool g_fKeyboardHookLL = FALSE;
|
||||
HHOOK g_hhookKeyboardLL = NULL;
|
||||
HWND g_hwndKeyboardFocus = NULL;
|
||||
Bool g_fNoHelpMessageBox = FALSE;
|
||||
Bool g_fSoftwareCursor = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
* Global variables for dynamically loaded libraries and
|
||||
* their function pointers
|
||||
*/
|
||||
|
||||
HMODULE g_hmodDirectDraw = NULL;
|
||||
FARPROC g_fpDirectDrawCreate = NULL;
|
||||
FARPROC g_fpDirectDrawCreateClipper = NULL;
|
||||
|
||||
HMODULE g_hmodCommonControls = NULL;
|
||||
FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
|
||||
|
||||
|
||||
#ifdef XWIN_CLIPBOARD
|
||||
/*
|
||||
* Wrapped DIX functions
|
||||
*/
|
||||
winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
|
||||
winDispatchProcPtr winProcQueryTreeOrig = NULL;
|
||||
winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Clipboard variables
|
||||
*/
|
||||
|
||||
Bool g_fUnicodeClipboard = TRUE;
|
||||
Bool g_fClipboard = FALSE;
|
||||
Bool g_fClipboardLaunched = FALSE;
|
||||
Bool g_fClipboardStarted = FALSE;
|
||||
pthread_t g_ptClipboardProc = 0;
|
||||
HWND g_hwndClipboard = NULL;
|
||||
void *g_pClipboardDisplay = NULL;
|
||||
Window g_iClipboardWindow = None;
|
||||
Atom g_atomLastOwnedSelection = None;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Re-initialize global variables that are invalidated
|
||||
* by a server reset.
|
||||
*/
|
||||
|
||||
void
|
||||
winInitializeGlobals (void)
|
||||
{
|
||||
g_dwCurrentThreadID = GetCurrentThreadId ();
|
||||
g_hwndKeyboardFocus = NULL;
|
||||
#ifdef XWIN_CLIPBOARD
|
||||
g_fClipboardLaunched = FALSE;
|
||||
g_fClipboardStarted = FALSE;
|
||||
g_iClipboardWindow = None;
|
||||
g_pClipboardDisplay = NULL;
|
||||
g_atomLastOwnedSelection = None;
|
||||
g_hwndClipboard = NULL;
|
||||
g_ptClipboardProc = 0;
|
||||
#endif
|
||||
}
|
|
@ -36,7 +36,8 @@
|
|||
#include "win.h"
|
||||
#include "winkeybd.h"
|
||||
#include "winconfig.h"
|
||||
|
||||
#include "winmsg.h"
|
||||
|
||||
#ifdef XKB
|
||||
#define XKB_IN_SERVER
|
||||
#include "XKBsrv.h"
|
||||
|
@ -44,172 +45,23 @@
|
|||
|
||||
static Bool g_winKeyState[NUM_KEYCODES];
|
||||
|
||||
|
||||
#if WIN_NEW_KEYBOARD_SUPPORT
|
||||
|
||||
const unsigned int MaxKeysPerKey = 4;
|
||||
|
||||
void
|
||||
winProcessKeyEvent (DWORD dwVirtualKey, DWORD dwKeyData)
|
||||
{
|
||||
Bool fDown = ((dwKeyData & 0x80000000) == 0);
|
||||
winKeyEventsRec kerEvent;
|
||||
int i;
|
||||
|
||||
/* Get the key events */
|
||||
kerEvent = winTranslateKey (dwVirtualKey, dwKeyData);
|
||||
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_LCONTROL)
|
||||
winSendKeyEvent (XK_Control_L, FALSE);
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_RCONTROL)
|
||||
winSendKeyEvent (XK_Control_R, FALSE);
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_LALT)
|
||||
winSendKeyEvent (XK_Alt_L, FALSE);
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_RALT)
|
||||
winSendKeyEvent (XK_Alt_R, FALSE);
|
||||
|
||||
for (i = 0; kerEvent.dwXKeycodes[i] != XK_VoidSymbol; ++i)
|
||||
winSendKeyEvent (kerEvent.dwXKeycodes[i], fDown);
|
||||
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_LCONTROL)
|
||||
winSendKeyEvent (XK_Control_L, FALSE);
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_RCONTROL)
|
||||
winSendKeyEvent (XK_Control_R, TRUE);
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_LALT)
|
||||
winSendKeyEvent (XK_Alt_L, FALSE);
|
||||
if (kerEvent.dwReleaseModifiers & WIN_MOD_RALT)
|
||||
winSendKeyEvent (XK_Alt_R, TRUE);
|
||||
|
||||
}
|
||||
/* Stored to get internal mode key states. Must be read-only. */
|
||||
static unsigned short const *g_winInternalModeKeyStatesPtr = NULL;
|
||||
|
||||
|
||||
winKeyEventsRec
|
||||
winTranslateKey (DWORD dwVirtualKey, DWORD dwKeyData)
|
||||
{
|
||||
winKeyEventsRec kerEvents;
|
||||
Bool fExtended = ((HIWORD (dwKeyData) & KF_EXTENDED) != 0);
|
||||
int i;
|
||||
DWORD dwNumEvents = 0;
|
||||
BYTE bKeyboardState[256];
|
||||
int iReturn;
|
||||
unsigned char cAscii[4];
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
/* Remap extended modifiers to the right version of that key. */
|
||||
if (fExtended)
|
||||
{
|
||||
switch (dwVirtualKey)
|
||||
{
|
||||
case VK_MENU:
|
||||
dwVirtualKey = VK_RMENU;
|
||||
break;
|
||||
static void
|
||||
winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap);
|
||||
|
||||
case VK_CONTROL:
|
||||
dwVirtualKey = VK_RCONTROL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
static void
|
||||
winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
|
||||
pointer pCtrl, int iClass);
|
||||
|
||||
/* Initialize the modifiers to release flag */
|
||||
kerEvents.dwReleaseModifiers = 0;
|
||||
|
||||
/* Look up the current virtual key code in the translation table */
|
||||
for (i = 0; i < g_winKeymapEntries; ++i)
|
||||
{
|
||||
/* Did we find a mapping? */
|
||||
if (winKeymap[i].dwVirtualKey == dwVirtualKey)
|
||||
{
|
||||
/* Mapping found, we have at least one event now */
|
||||
kerEvents.dwXKeycodes[dwNumEvents] = winKeymap[i].dwXKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Break out early, if we found the key in the translation table */
|
||||
if (dwNumEvents != 0)
|
||||
{
|
||||
/* Terminate the last of the key events with a void symbol */
|
||||
kerEvents.dwXKeycodes[dwNumEvents] = XK_VoidSymbol;
|
||||
return kerEvents;
|
||||
}
|
||||
|
||||
/* Get the state of all keyboard keys */
|
||||
GetKeyboardState (bKeyboardState);
|
||||
|
||||
/* Try to convert the key to ASCII */
|
||||
iReturn = ToAscii (dwVirtualKey, 0, bKeyboardState, (WORD *) cAscii, 0);
|
||||
|
||||
/*
|
||||
* Left Control and Alt pressed, combined with a valid result
|
||||
* from ToAscii means that we have found the Windows version of AltGr.
|
||||
*/
|
||||
if ((bKeyboardState[VK_MENU] & 0x80) && (bKeyboardState[VK_CONTROL] & 0x80)
|
||||
&& (iReturn >= 1)
|
||||
&& (((cAscii[0] >= 32) && (cAscii[0] <= 126))
|
||||
|| (cAscii[0] >= 160)))
|
||||
{
|
||||
/* These three calls will return 0 on Windows 95/98/Me */
|
||||
if ((GetKeyState (VK_LCONTROL) & KF_UP))
|
||||
kerEvents.dwReleaseModifiers |= WIN_MOD_LCONTROL;
|
||||
if ((GetKeyState (VK_LMENU) & KF_UP))
|
||||
kerEvents.dwReleaseModifiers |= WIN_MOD_LALT;
|
||||
if ((GetKeyState (VK_RMENU) & KF_UP))
|
||||
kerEvents.dwReleaseModifiers |= WIN_MOD_RALT;
|
||||
|
||||
/* Windows 95/98/Me handling - pop all of them */
|
||||
if (kerEvents.dwReleaseModifiers == 0)
|
||||
kerEvents.dwReleaseModifiers
|
||||
= WIN_MOD_LCONTROL | WIN_MOD_LALT | WIN_MOD_RALT;
|
||||
|
||||
/* Copy the string of character events */
|
||||
for (i = 0; i < iReturn; ++i)
|
||||
kerEvents.dwXKeycodes[dwNumEvents++] = cAscii[i];
|
||||
}
|
||||
|
||||
/* Handle non Ctrl+Alt cases*/
|
||||
if (dwNumEvents == 0)
|
||||
{
|
||||
bKeyboardState[VK_CONTROL] = 0;
|
||||
bKeyboardState[VK_LCONTROL] = 0;
|
||||
bKeyboardState[VK_RCONTROL] = 0;
|
||||
|
||||
iReturn = ToAscii (dwVirtualKey, 0, bKeyboardState, (WORD *)cAscii, 0);
|
||||
if (iReturn < 0)
|
||||
{
|
||||
switch (cAscii[0])
|
||||
{
|
||||
case '`':
|
||||
kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_grave;
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_acute;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_tilde;
|
||||
break;
|
||||
|
||||
case '^':
|
||||
kerEvents.dwXKeycodes[dwNumEvents++] = XK_dead_circumflex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send what we've got if its a printable character */
|
||||
if (iReturn >= 1)
|
||||
for (i = 0; i < iReturn; ++i)
|
||||
kerEvents.dwXKeycodes[dwNumEvents++] = cAscii[i];
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the last of the key events with a void symbol */
|
||||
kerEvents.dwXKeycodes[dwNumEvents] = XK_VoidSymbol;
|
||||
return kerEvents;
|
||||
}
|
||||
|
||||
|
||||
#else /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
static void
|
||||
winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -236,15 +88,13 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
|
|||
*piScanCode = LOBYTE (HIWORD (lParam));
|
||||
}
|
||||
|
||||
#endif /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
|
||||
|
||||
/*
|
||||
* We call this function from winKeybdProc when we are
|
||||
* initializing the keyboard.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap)
|
||||
{
|
||||
int i;
|
||||
|
@ -287,7 +137,6 @@ winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap)
|
|||
pModMap[i] = AltMask;
|
||||
break;
|
||||
|
||||
#if !WIN_NEW_KEYBOARD_SUPPORT
|
||||
case XK_Num_Lock:
|
||||
pModMap[i] = NumLockMask;
|
||||
break;
|
||||
|
@ -296,6 +145,12 @@ winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap)
|
|||
pModMap[i] = ScrollLockMask;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case XK_Super_L:
|
||||
case XK_Super_R:
|
||||
pModMap[i] = Mod4Mask;
|
||||
break;
|
||||
#else
|
||||
/* Hirigana/Katakana toggle */
|
||||
case XK_Kana_Lock:
|
||||
case XK_Kana_Shift:
|
||||
|
@ -318,7 +173,7 @@ winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap)
|
|||
|
||||
|
||||
/* Ring the keyboard bell (system speaker on PCs) */
|
||||
void
|
||||
static void
|
||||
winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
|
||||
pointer pCtrl, int iClass)
|
||||
{
|
||||
|
@ -333,10 +188,10 @@ winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
|
|||
|
||||
|
||||
/* Change some keyboard configuration parameters */
|
||||
void
|
||||
static void
|
||||
winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
|
||||
{
|
||||
|
||||
g_winInternalModeKeyStatesPtr = &(pDevice->key->state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,6 +208,8 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
|
|||
DevicePtr pDevice = (DevicePtr) pDeviceInt;
|
||||
#ifdef XKB
|
||||
XkbComponentNamesRec names;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
XkbControlsPtr ctrl;
|
||||
#endif
|
||||
|
||||
switch (iState)
|
||||
|
@ -402,7 +259,7 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
|
|||
names.geometry = g_winInfo.xkb.geometry;
|
||||
}
|
||||
|
||||
ErrorF("Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
|
||||
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,
|
||||
|
@ -415,14 +272,36 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
|
|||
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");
|
||||
}
|
||||
}
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@ -440,7 +319,6 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
|
|||
void
|
||||
winInitializeModeKeyStates (void)
|
||||
{
|
||||
#if !WIN_NEW_KEYBOARD_SUPPORT
|
||||
/* Restore NumLock */
|
||||
if (GetKeyState (VK_NUMLOCK) & 0x0001)
|
||||
{
|
||||
|
@ -468,36 +346,6 @@ winInitializeModeKeyStates (void)
|
|||
winSendKeyEvent (KEY_HKTG, TRUE);
|
||||
winSendKeyEvent (KEY_HKTG, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We have to store the last state of each mode
|
||||
* key before we lose the keyboard focus.
|
||||
*/
|
||||
|
||||
void
|
||||
winStoreModeKeyStates (ScreenPtr pScreen)
|
||||
{
|
||||
#if !WIN_NEW_KEYBOARD_SUPPORT
|
||||
winScreenPriv(pScreen);
|
||||
|
||||
/* Initialize all mode key states to off */
|
||||
pScreenPriv->dwModeKeyStates = 0x0L;
|
||||
|
||||
pScreenPriv->dwModeKeyStates |=
|
||||
(GetKeyState (VK_NUMLOCK) & 0x0001) << NumLockMapIndex;
|
||||
|
||||
pScreenPriv->dwModeKeyStates |=
|
||||
(GetKeyState (VK_SCROLL) & 0x0001) << ScrollLockMapIndex;
|
||||
|
||||
pScreenPriv->dwModeKeyStates |=
|
||||
(GetKeyState (VK_CAPITAL) & 0x0001) << LockMapIndex;
|
||||
|
||||
pScreenPriv->dwModeKeyStates |=
|
||||
(GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -508,11 +356,27 @@ winStoreModeKeyStates (ScreenPtr pScreen)
|
|||
*/
|
||||
|
||||
void
|
||||
winRestoreModeKeyStates (ScreenPtr pScreen)
|
||||
winRestoreModeKeyStates ()
|
||||
{
|
||||
#if !WIN_NEW_KEYBOARD_SUPPORT
|
||||
winScreenPriv(pScreen);
|
||||
DWORD dwKeyState;
|
||||
BOOL processEvents = TRUE;
|
||||
unsigned short internalKeyStates;
|
||||
|
||||
/* X server is being initialized */
|
||||
if (!g_winInternalModeKeyStatesPtr)
|
||||
return;
|
||||
|
||||
/* Only process events if the rootwindow is mapped. The keyboard events
|
||||
* will cause segfaults otherwise */
|
||||
if (WindowTable && WindowTable[0] && WindowTable[0]->mapped == FALSE)
|
||||
processEvents = FALSE;
|
||||
|
||||
/* Force to process all pending events in the mi event queue */
|
||||
if (processEvents)
|
||||
mieqProcessInputEvents ();
|
||||
|
||||
/* Read the mode key states of our X server */
|
||||
internalKeyStates = *g_winInternalModeKeyStatesPtr;
|
||||
|
||||
/*
|
||||
* NOTE: The C XOR operator, ^, will not work here because it is
|
||||
|
@ -522,7 +386,7 @@ winRestoreModeKeyStates (ScreenPtr pScreen)
|
|||
|
||||
/* Has the key state changed? */
|
||||
dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
|
||||
if (WIN_XOR (pScreenPriv->dwModeKeyStates & NumLockMask, dwKeyState))
|
||||
if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
|
||||
{
|
||||
winSendKeyEvent (KEY_NumLock, TRUE);
|
||||
winSendKeyEvent (KEY_NumLock, FALSE);
|
||||
|
@ -530,7 +394,7 @@ winRestoreModeKeyStates (ScreenPtr pScreen)
|
|||
|
||||
/* Has the key state changed? */
|
||||
dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
|
||||
if (WIN_XOR (pScreenPriv->dwModeKeyStates & LockMask, dwKeyState))
|
||||
if (WIN_XOR (internalKeyStates & LockMask, dwKeyState))
|
||||
{
|
||||
winSendKeyEvent (KEY_CapsLock, TRUE);
|
||||
winSendKeyEvent (KEY_CapsLock, FALSE);
|
||||
|
@ -538,7 +402,7 @@ winRestoreModeKeyStates (ScreenPtr pScreen)
|
|||
|
||||
/* Has the key state changed? */
|
||||
dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
|
||||
if (WIN_XOR (pScreenPriv->dwModeKeyStates & ScrollLockMask, dwKeyState))
|
||||
if (WIN_XOR (internalKeyStates & ScrollLockMask, dwKeyState))
|
||||
{
|
||||
winSendKeyEvent (KEY_ScrollLock, TRUE);
|
||||
winSendKeyEvent (KEY_ScrollLock, FALSE);
|
||||
|
@ -546,16 +410,14 @@ winRestoreModeKeyStates (ScreenPtr pScreen)
|
|||
|
||||
/* Has the key state changed? */
|
||||
dwKeyState = GetKeyState (VK_KANA) & 0x0001;
|
||||
if (WIN_XOR (pScreenPriv->dwModeKeyStates & KanaMask, dwKeyState))
|
||||
if (WIN_XOR (internalKeyStates & KanaMask, dwKeyState))
|
||||
{
|
||||
winSendKeyEvent (KEY_HKTG, TRUE);
|
||||
winSendKeyEvent (KEY_HKTG, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if !WIN_NEW_KEYBOARD_SUPPORT
|
||||
/*
|
||||
* Look for the lovely fake Control_L press/release generated by Windows
|
||||
* when AltGr is pressed/released on a non-U.S. keyboard.
|
||||
|
@ -580,12 +442,27 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
/* Get time of current message */
|
||||
lTime = GetMessageTime ();
|
||||
|
||||
|
||||
/* Look for fake Ctrl_L preceeding an Alt_R press. */
|
||||
fReturn = PeekMessage (&msgNext, NULL,
|
||||
WM_KEYDOWN, WM_KEYDOWN,
|
||||
PM_NOREMOVE);
|
||||
|
||||
/*
|
||||
* Try again if the first call fails.
|
||||
* NOTE: This usually happens when TweakUI is enabled.
|
||||
*/
|
||||
if (!fReturn)
|
||||
{
|
||||
/* Voodoo to make sure that the Alt_R message has posted */
|
||||
Sleep (0);
|
||||
|
||||
/* Look for fake Ctrl_L preceeding an Alt_R press. */
|
||||
fReturn = PeekMessage (&msgNext, NULL,
|
||||
WM_KEYDOWN, WM_KEYDOWN,
|
||||
PM_NOREMOVE);
|
||||
}
|
||||
|
||||
/* Is next press an Alt_R with the same timestamp? */
|
||||
if (fReturn && msgNext.wParam == VK_MENU
|
||||
&& msgNext.time == lTime
|
||||
|
@ -618,6 +495,21 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
|
|||
WM_KEYUP, WM_SYSKEYUP,
|
||||
PM_NOREMOVE);
|
||||
|
||||
/*
|
||||
* Try again if the first call fails.
|
||||
* NOTE: This usually happens when TweakUI is enabled.
|
||||
*/
|
||||
if (!fReturn)
|
||||
{
|
||||
/* Voodoo to make sure that the Alt_R message has posted */
|
||||
Sleep (0);
|
||||
|
||||
/* Look for fake Ctrl_L release preceeding an Alt_R release. */
|
||||
fReturn = PeekMessage (&msgNext, NULL,
|
||||
WM_KEYUP, WM_SYSKEYUP,
|
||||
PM_NOREMOVE);
|
||||
}
|
||||
|
||||
/* Is next press an Alt_R with the same timestamp? */
|
||||
if (fReturn
|
||||
&& (msgNext.message == WM_KEYUP
|
||||
|
@ -638,7 +530,6 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
|
|||
/* Not a fake control left press/release */
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
|
||||
|
||||
/*
|
||||
|
@ -648,7 +539,6 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
|
|||
void
|
||||
winKeybdReleaseKeys ()
|
||||
{
|
||||
#if !WIN_NEW_KEYBOARD_SUPPORT
|
||||
int i;
|
||||
|
||||
/* Verify that the mi input system has been initialized */
|
||||
|
@ -665,7 +555,6 @@ winKeybdReleaseKeys ()
|
|||
/* Reset pressed flag for keys */
|
||||
g_winKeyState[i] = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#if !defined(WINKEYBD_H)
|
||||
#define WINKEYBD_H
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
@ -32,7 +34,7 @@
|
|||
/*
|
||||
* We need symbols for the scan codes of keys.
|
||||
*/
|
||||
#include "../xfree86/common/atKeynames.h"
|
||||
#include "winkeynames.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -40,98 +42,7 @@
|
|||
*
|
||||
* This header declares a static KeySym array called 'map'.
|
||||
*/
|
||||
#include "../xfree86/common/xf86Keymap.h"
|
||||
|
||||
|
||||
#if WIN_NEW_KEYBOARD_SUPPORT
|
||||
|
||||
/* Define the keymap structure */
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwVirtualKey;
|
||||
DWORD dwXKey;
|
||||
} winKeymappingRec, *winKeymappingPtr;
|
||||
|
||||
static const winKeymappingRec
|
||||
winKeymap[] = {
|
||||
{VK_BACK, XK_BackSpace},
|
||||
{VK_TAB, XK_Tab},
|
||||
{VK_CLEAR, XK_Clear},
|
||||
{VK_RETURN, XK_Return},
|
||||
{VK_LSHIFT, XK_Shift_L},
|
||||
{VK_RSHIFT, XK_Shift_R},
|
||||
{VK_SHIFT, XK_Shift_L},
|
||||
{VK_LCONTROL, XK_Control_L},
|
||||
{VK_RCONTROL, XK_Control_R},
|
||||
{VK_CONTROL, XK_Control_L},
|
||||
{VK_LMENU, XK_Alt_L},
|
||||
{VK_RMENU, XK_Alt_R},
|
||||
{VK_MENU, XK_Alt_L},
|
||||
{VK_PAUSE, XK_Pause},
|
||||
{VK_CAPITAL, XK_Caps_Lock},
|
||||
{VK_ESCAPE, XK_Escape},
|
||||
{VK_SPACE, XK_space},
|
||||
{VK_PRIOR, XK_Page_Up},
|
||||
{VK_NEXT, XK_Page_Down},
|
||||
{VK_END, XK_End},
|
||||
{VK_HOME, XK_Home},
|
||||
{VK_LEFT, XK_Left},
|
||||
{VK_UP, XK_Up},
|
||||
{VK_RIGHT, XK_Right},
|
||||
{VK_DOWN, XK_Down},
|
||||
{VK_SELECT, XK_Select},
|
||||
{VK_EXECUTE, XK_Execute},
|
||||
{VK_SNAPSHOT, XK_Print},
|
||||
{VK_INSERT, XK_Insert},
|
||||
{VK_DELETE, XK_Delete},
|
||||
{VK_HELP, XK_Help},
|
||||
{VK_NUMPAD0, XK_KP_0},
|
||||
{VK_NUMPAD1, XK_KP_1},
|
||||
{VK_NUMPAD2, XK_KP_2},
|
||||
{VK_NUMPAD3, XK_KP_3},
|
||||
{VK_NUMPAD4, XK_KP_4},
|
||||
{VK_NUMPAD5, XK_KP_5},
|
||||
{VK_NUMPAD6, XK_KP_6},
|
||||
{VK_NUMPAD7, XK_KP_7},
|
||||
{VK_NUMPAD8, XK_KP_8},
|
||||
{VK_NUMPAD9, XK_KP_9},
|
||||
{VK_MULTIPLY, XK_KP_Multiply},
|
||||
{VK_ADD, XK_KP_Add},
|
||||
{VK_SEPARATOR, XK_KP_Separator}, // often comma
|
||||
{VK_SUBTRACT, XK_KP_Subtract},
|
||||
{VK_DECIMAL, XK_KP_Decimal},
|
||||
{VK_DIVIDE, XK_KP_Divide},
|
||||
{VK_F1, XK_F1},
|
||||
{VK_F2, XK_F2},
|
||||
{VK_F3, XK_F3},
|
||||
{VK_F4, XK_F4},
|
||||
{VK_F5, XK_F5},
|
||||
{VK_F6, XK_F6},
|
||||
{VK_F7, XK_F7},
|
||||
{VK_F8, XK_F8},
|
||||
{VK_F9, XK_F9},
|
||||
{VK_F10, XK_F10},
|
||||
{VK_F11, XK_F11},
|
||||
{VK_F12, XK_F12},
|
||||
{VK_F13, XK_F13},
|
||||
{VK_F14, XK_F14},
|
||||
{VK_F15, XK_F15},
|
||||
{VK_F16, XK_F16},
|
||||
{VK_F17, XK_F17},
|
||||
{VK_F18, XK_F18},
|
||||
{VK_F19, XK_F19},
|
||||
{VK_F20, XK_F20},
|
||||
{VK_F21, XK_F21},
|
||||
{VK_F22, XK_F22},
|
||||
{VK_F23, XK_F23},
|
||||
{VK_F24, XK_F24},
|
||||
{VK_NUMLOCK, XK_Num_Lock},
|
||||
{VK_SCROLL, XK_Scroll_Lock}
|
||||
};
|
||||
|
||||
static int g_winKeymapEntries = sizeof (winKeymap) / sizeof (winKeymappingRec);
|
||||
|
||||
#else /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
#include "winkeymap.h"
|
||||
|
||||
#define WIN_KEYMAP_COLS 3
|
||||
|
||||
|
@ -395,4 +306,5 @@ g_iKeyMap [] = {
|
|||
/* 254 */ 0, 0, 0,
|
||||
/* 255 */ 0, 0, 0
|
||||
};
|
||||
#endif /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
|
||||
#endif /* WINKEYBD_H */
|
||||
|
|
170
hw/xwin/winkeyhook.c
Executable file
170
hw/xwin/winkeyhook.c
Executable file
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
*Copyright (C) 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
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern HHOOK g_hhookKeyboardLL;
|
||||
extern DWORD g_dwCurrentThreadID;
|
||||
extern HWND g_hwndKeyboardFocus;
|
||||
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
||||
static LRESULT CALLBACK
|
||||
winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
||||
#ifndef LLKHF_EXTENDED
|
||||
# define LLKHF_EXTENDED 0x00000001
|
||||
#endif
|
||||
#ifndef LLKHF_UP
|
||||
# define LLKHF_UP 0x00000080
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* KeyboardMessageHook
|
||||
*/
|
||||
|
||||
static LRESULT CALLBACK
|
||||
winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL fPassKeystroke = FALSE;
|
||||
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
|
||||
|
||||
/* Pass keystrokes on to our main message loop */
|
||||
if (iCode == HC_ACTION)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("vkCode: %08x\tscanCode: %08x\n", p->vkCode, p->scanCode);
|
||||
#endif
|
||||
|
||||
switch (wParam)
|
||||
{
|
||||
case WM_KEYDOWN: case WM_SYSKEYDOWN:
|
||||
case WM_KEYUP: case WM_SYSKEYUP:
|
||||
fPassKeystroke =
|
||||
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
|
||||
#if 0
|
||||
|| (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)
|
||||
#endif
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass message on to our main message loop.
|
||||
* We process this immediately with SendMessage so that the keystroke
|
||||
* appears in, hopefully, the correct order.
|
||||
*/
|
||||
if (fPassKeystroke)
|
||||
{
|
||||
LPARAM lParamKey = 0x0;
|
||||
|
||||
/* Construct the lParam from KBDLLHOOKSTRUCT */
|
||||
lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */
|
||||
lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16));
|
||||
lParamKey = lParamKey
|
||||
| (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23));
|
||||
lParamKey = lParamKey
|
||||
| (0x20000000
|
||||
& ((p->flags & LLKHF_ALTDOWN) << 24));
|
||||
lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
|
||||
|
||||
/* Send message to our main window that has the keyboard focus */
|
||||
PostMessage (g_hwndKeyboardFocus,
|
||||
(UINT) wParam,
|
||||
(WPARAM) p->vkCode,
|
||||
lParamKey);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Call next hook */
|
||||
return CallNextHookEx (NULL, iCode, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Attempt to install the keyboard hook, return FALSE if it was not installed
|
||||
*/
|
||||
|
||||
Bool
|
||||
winInstallKeyboardHookLL ()
|
||||
{
|
||||
OSVERSIONINFO osvi = {0};
|
||||
|
||||
/* Get operating system version information */
|
||||
osvi.dwOSVersionInfoSize = sizeof (osvi);
|
||||
GetVersionEx (&osvi);
|
||||
|
||||
/* Branch on platform ID */
|
||||
switch (osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
/* Low-level is supported on NT 4.0 SP3+ only */
|
||||
/* TODO: Return FALSE on NT 4.0 with no SP, SP1, or SP2 */
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
/* Low-level hook is not supported on non-NT */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Install the hook only once */
|
||||
if (!g_hhookKeyboardLL)
|
||||
g_hhookKeyboardLL = SetWindowsHookEx (WH_KEYBOARD_LL,
|
||||
winKeyboardMessageHookLL,
|
||||
g_hInstance,
|
||||
0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Remove the keyboard hook if it is installed
|
||||
*/
|
||||
|
||||
void
|
||||
winRemoveKeyboardHookLL ()
|
||||
{
|
||||
if (g_hhookKeyboardLL)
|
||||
UnhookWindowsHookEx (g_hhookKeyboardLL);
|
||||
g_hhookKeyboardLL = NULL;
|
||||
}
|
138
hw/xwin/winkeymap.h
Executable file
138
hw/xwin/winkeymap.h
Executable file
|
@ -0,0 +1,138 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.19 2002/05/31 18:45:58 dawes Exp $ */
|
||||
/*
|
||||
*
|
||||
* For Scancodes see notes in winkeynames.h !!!!
|
||||
*
|
||||
*/
|
||||
/* $XConsortium: xf86Keymap.h /main/14 1996/02/21 17:38:47 kaleb $ */
|
||||
|
||||
static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
|
||||
/* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
|
||||
/* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
|
||||
/* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
|
||||
/* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
|
||||
/* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
|
||||
/* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
|
||||
/* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
|
||||
/* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
|
||||
/* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
|
||||
/* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
|
||||
/* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
|
||||
/* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
|
||||
/* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol,
|
||||
/* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
|
||||
/* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
|
||||
/* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
|
||||
/* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
|
||||
/* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
|
||||
/* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
|
||||
/* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
|
||||
/* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
|
||||
/* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
|
||||
/* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
|
||||
/* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
|
||||
/* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
|
||||
/* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
|
||||
/* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
|
||||
/* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
|
||||
/* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
|
||||
/* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
|
||||
/* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
|
||||
/* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
|
||||
/* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
|
||||
/* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
|
||||
/* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
|
||||
/* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x5c */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x5e */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x5f */ XK_End, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x60 */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x61 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x62 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x63 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
|
||||
/* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x6e */ XK_F13, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x6f */ XK_F14, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x70 */ XK_F15, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x71 */ XK_F16, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x72 */ XK_F17, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x73 */ XK_backslash, XK_underscore, NoSymbol, NoSymbol,
|
||||
/* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x79 */ XK_Henkan, XK_Mode_switch, NoSymbol, NoSymbol,
|
||||
/* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x7b */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
|
||||
/* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
/* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
||||
};
|
204
hw/xwin/winkeynames.h
Executable file
204
hw/xwin/winkeynames.h
Executable file
|
@ -0,0 +1,204 @@
|
|||
#ifndef _WINKEYNAMES_H
|
||||
#define _WINKEYNAMES_H
|
||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.18 2001/09/29 20:40:30 herrb Exp $ */
|
||||
/*
|
||||
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Thomas Roell not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Thomas Roell makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
/* $XConsortium: atKeynames.h /main/11 1996/03/09 11:17:41 kaleb $ */
|
||||
|
||||
#define XK_TECHNICAL
|
||||
#define XK_KATAKANA
|
||||
#include "keysym.h"
|
||||
|
||||
#define GLYPHS_PER_KEY 4
|
||||
#define NUM_KEYCODES 248
|
||||
#define MIN_KEYCODE 8
|
||||
#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
|
||||
|
||||
#define AltMask Mod1Mask
|
||||
#define NumLockMask Mod2Mask
|
||||
#define AltLangMask Mod3Mask
|
||||
#define KanaMask Mod4Mask
|
||||
#define ScrollLockMask Mod5Mask
|
||||
|
||||
#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
|
||||
#define ModifierDown(k) ((keyc->state & (k)) == (k))
|
||||
|
||||
/*
|
||||
* NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
|
||||
* sets of scancodes. Set3 can only be generated by a MF keyboard.
|
||||
* Set2 sends a makecode for keypress, and the same code prefixed by a
|
||||
* F0 for keyrelease. This is a little bit ugly to handle. Thus we use
|
||||
* here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
|
||||
* Bit 7 ist set if the key is released. The code E0 switches to a
|
||||
* different meaning to add the new MF cursorkeys, while not breaking old
|
||||
* applications. E1 is another special prefix. Since I assume that there
|
||||
* will be further versions of PC/XT scancode compatible keyboards, we
|
||||
* may be in trouble one day.
|
||||
*
|
||||
* IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
|
||||
* 2) Use the keyboards native set and translate it to common keysyms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* definition of the AT84/MF101/MF102 Keyboard:
|
||||
* ============================================================
|
||||
* Defined Key Cap Glyphs Pressed value
|
||||
* Key Name Main Also (hex) (dec)
|
||||
* ---------------- ---------- ------- ------ ------
|
||||
*/
|
||||
|
||||
#define KEY_Escape /* Escape 0x01 */ 1
|
||||
#define KEY_1 /* 1 ! 0x02 */ 2
|
||||
#define KEY_2 /* 2 @ 0x03 */ 3
|
||||
#define KEY_3 /* 3 # 0x04 */ 4
|
||||
#define KEY_4 /* 4 $ 0x05 */ 5
|
||||
#define KEY_5 /* 5 % 0x06 */ 6
|
||||
#define KEY_6 /* 6 ^ 0x07 */ 7
|
||||
#define KEY_7 /* 7 & 0x08 */ 8
|
||||
#define KEY_8 /* 8 * 0x09 */ 9
|
||||
#define KEY_9 /* 9 ( 0x0a */ 10
|
||||
#define KEY_0 /* 0 ) 0x0b */ 11
|
||||
#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
|
||||
#define KEY_Equal /* = (Equal) + 0x0d */ 13
|
||||
#define KEY_BackSpace /* Back Space 0x0e */ 14
|
||||
#define KEY_Tab /* Tab 0x0f */ 15
|
||||
#define KEY_Q /* Q 0x10 */ 16
|
||||
#define KEY_W /* W 0x11 */ 17
|
||||
#define KEY_E /* E 0x12 */ 18
|
||||
#define KEY_R /* R 0x13 */ 19
|
||||
#define KEY_T /* T 0x14 */ 20
|
||||
#define KEY_Y /* Y 0x15 */ 21
|
||||
#define KEY_U /* U 0x16 */ 22
|
||||
#define KEY_I /* I 0x17 */ 23
|
||||
#define KEY_O /* O 0x18 */ 24
|
||||
#define KEY_P /* P 0x19 */ 25
|
||||
#define KEY_LBrace /* [ { 0x1a */ 26
|
||||
#define KEY_RBrace /* ] } 0x1b */ 27
|
||||
#define KEY_Enter /* Enter 0x1c */ 28
|
||||
#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
|
||||
#define KEY_A /* A 0x1e */ 30
|
||||
#define KEY_S /* S 0x1f */ 31
|
||||
#define KEY_D /* D 0x20 */ 32
|
||||
#define KEY_F /* F 0x21 */ 33
|
||||
#define KEY_G /* G 0x22 */ 34
|
||||
#define KEY_H /* H 0x23 */ 35
|
||||
#define KEY_J /* J 0x24 */ 36
|
||||
#define KEY_K /* K 0x25 */ 37
|
||||
#define KEY_L /* L 0x26 */ 38
|
||||
#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
|
||||
#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
|
||||
#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
|
||||
#define KEY_ShiftL /* Shift(left) 0x2a */ 42
|
||||
#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
|
||||
#define KEY_Z /* Z 0x2c */ 44
|
||||
#define KEY_X /* X 0x2d */ 45
|
||||
#define KEY_C /* C 0x2e */ 46
|
||||
#define KEY_V /* V 0x2f */ 47
|
||||
#define KEY_B /* B 0x30 */ 48
|
||||
#define KEY_N /* N 0x31 */ 49
|
||||
#define KEY_M /* M 0x32 */ 50
|
||||
#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
|
||||
#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
|
||||
#define KEY_Slash /* / (Slash) ? 0x35 */ 53
|
||||
#define KEY_ShiftR /* Shift(right) 0x36 */ 54
|
||||
#define KEY_KP_Multiply /* * 0x37 */ 55
|
||||
#define KEY_Alt /* Alt(left) 0x38 */ 56
|
||||
#define KEY_Space /* (SpaceBar) 0x39 */ 57
|
||||
#define KEY_CapsLock /* CapsLock 0x3a */ 58
|
||||
#define KEY_F1 /* F1 0x3b */ 59
|
||||
#define KEY_F2 /* F2 0x3c */ 60
|
||||
#define KEY_F3 /* F3 0x3d */ 61
|
||||
#define KEY_F4 /* F4 0x3e */ 62
|
||||
#define KEY_F5 /* F5 0x3f */ 63
|
||||
#define KEY_F6 /* F6 0x40 */ 64
|
||||
#define KEY_F7 /* F7 0x41 */ 65
|
||||
#define KEY_F8 /* F8 0x42 */ 66
|
||||
#define KEY_F9 /* F9 0x43 */ 67
|
||||
#define KEY_F10 /* F10 0x44 */ 68
|
||||
#define KEY_NumLock /* NumLock 0x45 */ 69
|
||||
#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
|
||||
#define KEY_KP_7 /* 7 Home 0x47 */ 71
|
||||
#define KEY_KP_8 /* 8 Up 0x48 */ 72
|
||||
#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
|
||||
#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
|
||||
#define KEY_KP_4 /* 4 Left 0x4b */ 75
|
||||
#define KEY_KP_5 /* 5 0x4c */ 76
|
||||
#define KEY_KP_6 /* 6 Right 0x4d */ 77
|
||||
#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
|
||||
#define KEY_KP_1 /* 1 End 0x4f */ 79
|
||||
#define KEY_KP_2 /* 2 Down 0x50 */ 80
|
||||
#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
|
||||
#define KEY_KP_0 /* 0 Insert 0x52 */ 82
|
||||
#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
|
||||
#define KEY_SysReqest /* SysReqest 0x54 */ 84
|
||||
/* NOTUSED 0x55 */
|
||||
#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
|
||||
#define KEY_F11 /* F11 0x57 */ 87
|
||||
#define KEY_F12 /* F12 0x58 */ 88
|
||||
|
||||
#define KEY_Prefix0 /* special 0x60 */ 96
|
||||
#define KEY_Prefix1 /* specail 0x61 */ 97
|
||||
|
||||
/*
|
||||
* The 'scancodes' below are generated by the server, because the MF101/102
|
||||
* keyboard sends them as sequence of other scancodes
|
||||
*/
|
||||
#define KEY_Home /* Home 0x59 */ 89
|
||||
#define KEY_Up /* Up 0x5a */ 90
|
||||
#define KEY_PgUp /* PgUp 0x5b */ 91
|
||||
#define KEY_Left /* Left 0x5c */ 92
|
||||
#define KEY_Begin /* Begin 0x5d */ 93
|
||||
#define KEY_Right /* Right 0x5e */ 94
|
||||
#define KEY_End /* End 0x5f */ 95
|
||||
#define KEY_Down /* Down 0x60 */ 96
|
||||
#define KEY_PgDown /* PgDown 0x61 */ 97
|
||||
#define KEY_Insert /* Insert 0x62 */ 98
|
||||
#define KEY_Delete /* Delete 0x63 */ 99
|
||||
#define KEY_KP_Enter /* Enter 0x64 */ 100
|
||||
#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
|
||||
#define KEY_Pause /* Pause 0x66 */ 102
|
||||
#define KEY_Print /* Print 0x67 */ 103
|
||||
#define KEY_KP_Divide /* Divide 0x68 */ 104
|
||||
#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
|
||||
#define KEY_Break /* Break 0x6a */ 106
|
||||
#define KEY_LMeta /* Left Meta 0x6b */ 107
|
||||
#define KEY_RMeta /* Right Meta 0x6c */ 108
|
||||
#define KEY_Menu /* Menu 0x6d */ 109
|
||||
#define KEY_F13 /* F13 0x6e */ 110
|
||||
#define KEY_F14 /* F14 0x6f */ 111
|
||||
#define KEY_F15 /* F15 0x70 */ 112
|
||||
#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112
|
||||
#define KEY_F16 /* F16 0x71 */ 113
|
||||
#define KEY_F17 /* F17 0x72 */ 114
|
||||
#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
|
||||
#define KEY_BSlash2 /* \ _ 0x73 */ 115
|
||||
#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
|
||||
#define KEY_XFER /* Kanji Transfer 0x79 */ 121
|
||||
#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
|
||||
#define KEY_Yen /* Yen 0x7d */ 125
|
||||
|
||||
/* These are for "notused" and "unknown" entries in translation maps. */
|
||||
#define KEY_NOTUSED 0
|
||||
#define KEY_UNKNOWN 255
|
||||
|
||||
#endif /* _WINKEYNAMES_H */
|
1027
hw/xwin/winmessages.h
Executable file
1027
hw/xwin/winmessages.h
Executable file
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,23 +15,22 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.5 2001/11/11 22:45:57 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
/* See Porting Layer Definition - p. 33 */
|
||||
/*
|
||||
* Called by clients, returns the best size for a cursor, tile, or
|
||||
|
@ -44,6 +43,7 @@ winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
|
|||
{
|
||||
ErrorF ("winQueryBestSizeNativeGDI\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -96,6 +96,7 @@ winUpdateFBPointer (ScreenPtr pScreen, void *pbits)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
/*
|
||||
* Paint the window background with the specified color
|
||||
*/
|
||||
|
@ -145,3 +146,4 @@ winPaintBackground (HWND hwnd, COLORREF colorref)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,23 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
void
|
||||
#if defined(XFree86Server) && defined(XINPUT)
|
||||
#include "inputstr.h"
|
||||
|
||||
/* Peek the internal button mapping */
|
||||
static CARD8 const *g_winMouseButtonMap = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
static void
|
||||
winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl);
|
||||
|
||||
|
||||
static void
|
||||
winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl)
|
||||
{
|
||||
}
|
||||
|
@ -65,6 +81,10 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
|
|||
miPointerGetMotionEvents,
|
||||
winMouseCtrl,
|
||||
miPointerGetMotionBufferSize ());
|
||||
|
||||
#if defined(XFree86Server) && defined(XINPUT)
|
||||
g_winMouseButtonMap = pDeviceInt->button->map;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DEVICE_ON:
|
||||
|
@ -72,6 +92,9 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
|
|||
break;
|
||||
|
||||
case DEVICE_CLOSE:
|
||||
#if defined(XFree86Server) && defined(XINPUT)
|
||||
g_winMouseButtonMap = NULL;
|
||||
#endif
|
||||
case DEVICE_OFF:
|
||||
pDevice->on = FALSE;
|
||||
break;
|
||||
|
@ -85,7 +108,7 @@ int
|
|||
winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
xEvent xCurrentEvent;
|
||||
int button; /* Button4 or Button5 */
|
||||
|
||||
/* Button4 = WheelUp */
|
||||
/* Button5 = WheelDown */
|
||||
|
@ -136,11 +159,11 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
|
|||
/* Set the button to indicate up or down wheel delta */
|
||||
if (iDeltaZ > 0)
|
||||
{
|
||||
xCurrentEvent.u.u.detail = Button4;
|
||||
button = Button4;
|
||||
}
|
||||
else
|
||||
{
|
||||
xCurrentEvent.u.u.detail = Button5;
|
||||
button = Button5;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -157,16 +180,10 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
|
|||
while (iDeltaZ--)
|
||||
{
|
||||
/* Push the wheel button */
|
||||
xCurrentEvent.u.u.type = ButtonPress;
|
||||
xCurrentEvent.u.keyButtonPointer.time
|
||||
= g_c32LastInputEventTime = GetTickCount ();
|
||||
mieqEnqueue (&xCurrentEvent);
|
||||
winMouseButtonsSendEvent (ButtonPress, button);
|
||||
|
||||
/* Release the wheel button */
|
||||
xCurrentEvent.u.u.type = ButtonRelease;
|
||||
xCurrentEvent.u.keyButtonPointer.time
|
||||
= g_c32LastInputEventTime = GetTickCount ();
|
||||
mieqEnqueue (&xCurrentEvent);
|
||||
winMouseButtonsSendEvent (ButtonRelease, button);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -184,6 +201,11 @@ winMouseButtonsSendEvent (int iEventType, int iButton)
|
|||
|
||||
/* Load an xEvent and enqueue the event */
|
||||
xCurrentEvent.u.u.type = iEventType;
|
||||
#if defined(XFree86Server) && defined(XINPUT)
|
||||
if (g_winMouseButtonMap)
|
||||
xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
|
||||
else
|
||||
#endif
|
||||
xCurrentEvent.u.u.detail = iButton;
|
||||
xCurrentEvent.u.keyButtonPointer.time
|
||||
= g_c32LastInputEventTime = GetTickCount ();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef _WINMS_H_
|
||||
#define _WINMS_H_
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,22 +17,18 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winms.h,v 1.1 2001/04/05 20:13:50 dawes Exp $ */
|
||||
|
||||
#ifndef _WINMS_H_
|
||||
#define _WINMS_H_
|
||||
|
||||
#undef MINSHORT
|
||||
#undef MAXSHORT
|
||||
|
@ -44,6 +42,9 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#ifndef XFree86Server
|
||||
#define XFree86Server
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
|
|
|
@ -33,14 +33,8 @@
|
|||
#include "winmsg.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef VERBOSE_LEVEL
|
||||
#define VERBOSE_LEVEL 4
|
||||
#endif
|
||||
|
||||
|
||||
void winVMsg (int, MessageType, int verb, const char *, va_list);
|
||||
|
||||
|
||||
void
|
||||
winVMsg (int scrnIndex, MessageType type, int verb, const char *format,
|
||||
va_list ap)
|
||||
|
@ -64,7 +58,7 @@ winMsg (MessageType type, const char *format, ...)
|
|||
{
|
||||
va_list ap;
|
||||
va_start (ap, format);
|
||||
LogVMessageVerb(type, 0, format, ap);
|
||||
LogVMessageVerb(type, 1, format, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -98,3 +92,42 @@ winErrorFVerb (int verb, const char *format, ...)
|
|||
LogVMessageVerb(X_NONE, verb, format, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
void
|
||||
winDebug (const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, format);
|
||||
LogVMessageVerb(X_NONE, 3, format, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
void
|
||||
winW32Error(int verb, const char *msg)
|
||||
{
|
||||
winW32ErrorEx(verb, msg, GetLastError());
|
||||
}
|
||||
|
||||
void
|
||||
winW32ErrorEx(int verb, const char *msg, DWORD errorcode)
|
||||
{
|
||||
LPVOID buffer;
|
||||
if (!FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
errorcode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) &buffer,
|
||||
0,
|
||||
NULL ))
|
||||
{
|
||||
winErrorFVerb(verb, "Unknown error in FormatMessage!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
winErrorFVerb(verb, "%s %s", msg, (char *)buffer);
|
||||
LocalFree(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef __WIN_MSG_H__
|
||||
#define __WIN_MSG_H__
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
@ -29,8 +31,6 @@
|
|||
*/
|
||||
/* $XFree86$ */
|
||||
|
||||
#ifndef __WIN_MSG_H__
|
||||
#define __WIN_MSG_H__
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
|
@ -41,7 +41,10 @@ void winDrvMsgVerb (int scrnIndex,
|
|||
void winDrvMsg (int scrnIndex, MessageType type, const char *format, ...);
|
||||
void winMsgVerb (MessageType type, int verb, const char *format, ...);
|
||||
void winMsg (MessageType type, const char *format, ...);
|
||||
void winDebug (const char *format, ...);
|
||||
|
||||
void winErrorFVerb (int verb, const char *format, ...);
|
||||
void winW32Error(int verb, const char *message);
|
||||
void winW32ErrorEx(int verb, const char *message, DWORD errorcode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,10 +29,18 @@
|
|||
*/
|
||||
/* $XFree86$ */
|
||||
|
||||
#include <Xatom.h>
|
||||
#include "X11/Xatom.h"
|
||||
#include "propertyst.h"
|
||||
#include "windowstr.h"
|
||||
#include "winmultiwindowclass.h"
|
||||
#include "win.h"
|
||||
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
|
||||
DEFINE_ATOM_HELPER(AtmWmWindowRole, "WM_WINDOW_ROLE")
|
||||
|
||||
|
||||
int
|
||||
winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class)
|
||||
|
@ -148,15 +156,10 @@ winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
|
|||
struct _Window *pwin;
|
||||
struct _Property *prop;
|
||||
int len_role;
|
||||
static Atom atmWmWindowRole = 0;
|
||||
|
||||
if (!pWin || !res_role)
|
||||
return 0;
|
||||
|
||||
/* Initialize the window role atom, not in XAtom.h */
|
||||
if (!atmWmWindowRole)
|
||||
atmWmWindowRole = MakeAtom ("WM_WINDOW_ROLE", 14, 1);
|
||||
|
||||
pwin = (struct _Window*) pWin;
|
||||
|
||||
if (pwin->optional)
|
||||
|
@ -167,7 +170,7 @@ winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
|
|||
*res_role = NULL;
|
||||
while (prop)
|
||||
{
|
||||
if (prop->propertyName == atmWmWindowRole
|
||||
if (prop->propertyName == AtmWmWindowRole ()
|
||||
&& prop->type == XA_STRING
|
||||
&& prop->format == 8
|
||||
&& prop->data)
|
||||
|
@ -226,10 +229,46 @@ winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints)
|
|||
else
|
||||
prop = prop->next;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy)
|
||||
{
|
||||
struct _Window *pwin;
|
||||
struct _Property *prop;
|
||||
|
||||
if (!pWin)
|
||||
{
|
||||
ErrorF ("winMultiWindowGetTransientFor - pWin was NULL\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pwin = (struct _Window*) pWin;
|
||||
|
||||
if (pwin->optional)
|
||||
prop = (struct _Property *) pwin->optional->userProps;
|
||||
else
|
||||
prop = NULL;
|
||||
|
||||
if (ppDaddy)
|
||||
*ppDaddy = NULL;
|
||||
|
||||
while (prop)
|
||||
{
|
||||
if (prop->propertyName == XA_WM_TRANSIENT_FOR)
|
||||
{
|
||||
if (ppDaddy)
|
||||
memcpy (*ppDaddy, prop->data, sizeof (WindowPtr *));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
prop = prop->next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
|
||||
|
@ -281,4 +320,3 @@ winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#if !defined(WINMULTIWINDOWCLASS_H)
|
||||
#define WINMULTIWINDOWCLASS_H
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
@ -108,3 +110,7 @@ winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints);
|
|||
int
|
||||
winMultiWindowGetWMName (WindowPtr pWin, char **wmName);
|
||||
|
||||
int
|
||||
winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
* External global variables
|
||||
*/
|
||||
|
||||
extern HICON g_hiconX;
|
||||
extern HICON g_hIconX;
|
||||
extern HICON g_hSmallIconX;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -71,26 +72,39 @@ winScaleXBitmapToWindows (int iconSize,
|
|||
unsigned int zero;
|
||||
unsigned int color;
|
||||
|
||||
effXBPP = BitsPerPixel(pixmap->drawable.depth);
|
||||
effXDepth = pixmap->drawable.depth;
|
||||
|
||||
if (pixmap->drawable.bitsPerPixel == 15)
|
||||
effXBPP = 16;
|
||||
else
|
||||
effXBPP = pixmap->drawable.bitsPerPixel;
|
||||
|
||||
if (pixmap->drawable.depth == 15)
|
||||
effXDepth = 16;
|
||||
else
|
||||
effXDepth = pixmap->drawable.depth;
|
||||
|
||||
/* Need 32-bit aligned rows */
|
||||
stride = ((iconSize * effBPP + 31) & (~31)) / 8;
|
||||
xStride = ((pixmap->drawable.width * effXBPP + 31) & (~31)) / 8;
|
||||
|
||||
xStride = PixmapBytePad (pixmap->drawable.width, pixmap->drawable.depth);
|
||||
if (stride == 0 || xStride == 0)
|
||||
{
|
||||
ErrorF ("winScaleXBitmapToWindows - stride or xStride is zero. "
|
||||
"Bailing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Allocate memory for icon data */
|
||||
iconData = malloc (xStride * pixmap->drawable.height);
|
||||
if (!iconData)
|
||||
{
|
||||
ErrorF ("winScaleXBitmapToWindows - malloc failed for iconData. "
|
||||
"Bailing.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get icon data */
|
||||
miGetImage ((DrawablePtr) &(pixmap->drawable), 0, 0,
|
||||
pixmap->drawable.width, pixmap->drawable.height,
|
||||
ZPixmap, 0xffffffff, iconData);
|
||||
|
||||
|
||||
/* Keep aspect ratio */
|
||||
factX = ((float)pixmap->drawable.width) / ((float)iconSize);
|
||||
factY = ((float)pixmap->drawable.height) / ((float)iconSize);
|
||||
|
@ -250,13 +264,13 @@ winScaleXBitmapToWindows (int iconSize,
|
|||
*/
|
||||
|
||||
HICON
|
||||
winXIconToHICON (WindowPtr pWin)
|
||||
winXIconToHICON (WindowPtr pWin, int iconSize)
|
||||
{
|
||||
unsigned char *mask, *image, *imageMask;
|
||||
unsigned char *dst, *src;
|
||||
PixmapPtr iconPtr;
|
||||
PixmapPtr maskPtr;
|
||||
int iconSize, planes, bpp, effBPP, stride, maskStride, i;
|
||||
int planes, bpp, effBPP, stride, maskStride, i;
|
||||
HDC hDC;
|
||||
ICONINFO ii;
|
||||
WinXWMHints hints;
|
||||
|
@ -269,8 +283,6 @@ winXIconToHICON (WindowPtr pWin)
|
|||
|
||||
if (!iconPtr) return NULL;
|
||||
|
||||
iconSize = 32;
|
||||
|
||||
hDC = GetDC (GetDesktopWindow ());
|
||||
planes = GetDeviceCaps (hDC, PLANES);
|
||||
bpp = GetDeviceCaps (hDC, BITSPIXEL);
|
||||
|
@ -357,7 +369,7 @@ winUpdateIcon (Window id)
|
|||
hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
|
||||
|
||||
if (!hIcon)
|
||||
hIcon = winXIconToHICON (pWin);
|
||||
hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
|
||||
|
||||
if (hIcon)
|
||||
{
|
||||
|
@ -370,9 +382,92 @@ winUpdateIcon (Window id)
|
|||
(int) hIcon);
|
||||
|
||||
/* Delete the icon if its not the default */
|
||||
if (hiconOld != g_hiconX &&
|
||||
!winIconIsOverride((unsigned long)hiconOld))
|
||||
DeleteObject (hiconOld);
|
||||
winDestroyIcon(hiconOld);
|
||||
}
|
||||
}
|
||||
|
||||
hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
|
||||
if (hIcon)
|
||||
{
|
||||
winWindowPriv(pWin);
|
||||
|
||||
if (pWinPriv->hWnd)
|
||||
{
|
||||
hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
|
||||
GCL_HICONSM,
|
||||
(int) hIcon);
|
||||
winDestroyIcon (hiconOld);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void winInitGlobalIcons (void)
|
||||
{
|
||||
int sm_cx = GetSystemMetrics(SM_CXICON);
|
||||
int sm_cxsm = GetSystemMetrics(SM_CXSMICON);
|
||||
/* 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);
|
||||
}
|
||||
|
||||
if (!g_hIconX)
|
||||
{
|
||||
g_hIconX = (HICON)LoadImage (g_hInstance,
|
||||
MAKEINTRESOURCE(IDI_XWIN),
|
||||
IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXICON),
|
||||
GetSystemMetrics(SM_CYICON),
|
||||
0);
|
||||
g_hSmallIconX = (HICON)LoadImage (g_hInstance,
|
||||
MAKEINTRESOURCE(IDI_XWIN),
|
||||
IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CYSMICON),
|
||||
LR_DEFAULTSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
|
||||
{
|
||||
HICON hIcon, hSmallIcon;
|
||||
|
||||
winInitGlobalIcons();
|
||||
|
||||
/* Try and get the icon from WM_HINTS */
|
||||
hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
|
||||
hSmallIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
|
||||
|
||||
/* If we got the small, but not the large one swap them */
|
||||
if (!hIcon && hSmallIcon)
|
||||
{
|
||||
hIcon = hSmallIcon;
|
||||
hSmallIcon = NULL;
|
||||
}
|
||||
|
||||
/* Use default X icon if no icon loaded from WM_HINTS */
|
||||
if (!hIcon) {
|
||||
hIcon = g_hIconX;
|
||||
hSmallIcon = g_hSmallIconX;
|
||||
}
|
||||
|
||||
if (pIcon)
|
||||
*pIcon = hIcon;
|
||||
else
|
||||
winDestroyIcon(hIcon);
|
||||
if (pSmallIcon)
|
||||
*pSmallIcon = hSmallIcon;
|
||||
else
|
||||
winDestroyIcon(hSmallIcon);
|
||||
}
|
||||
|
||||
void winDestroyIcon(HICON hIcon)
|
||||
{
|
||||
/* Delete the icon if its not the default */
|
||||
if (hIcon &&
|
||||
hIcon != g_hIconX &&
|
||||
hIcon != g_hSmallIconX &&
|
||||
!winIconIsOverride((unsigned long)hIcon))
|
||||
DestroyIcon (hIcon);
|
||||
}
|
||||
|
|
|
@ -35,13 +35,6 @@
|
|||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* External global variables
|
||||
*/
|
||||
|
||||
extern HICON g_hiconX;
|
||||
|
||||
|
||||
/*
|
||||
* winSetShapeMultiWindow - See Porting Layer Definition - p. 42
|
||||
*/
|
||||
|
@ -91,7 +84,7 @@ winReshapeMultiWindow (WindowPtr pWin)
|
|||
winWindowPriv(pWin);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winReshape ()\n");
|
||||
winDebug ("winReshape ()\n");
|
||||
#endif
|
||||
|
||||
/* Bail if the window is the root window */
|
||||
|
|
|
@ -36,19 +36,19 @@
|
|||
#include "winmultiwindowclass.h"
|
||||
#include "winprefs.h"
|
||||
|
||||
|
||||
/*
|
||||
* External global variables
|
||||
*/
|
||||
|
||||
extern HICON g_hiconX;
|
||||
extern HWND g_hDlgDepthChange;
|
||||
|
||||
extern void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
|
||||
|
||||
/*
|
||||
* Prototypes for local functions
|
||||
*/
|
||||
|
||||
static void
|
||||
void
|
||||
winCreateWindowsWindow (WindowPtr pWin);
|
||||
|
||||
static void
|
||||
|
@ -60,12 +60,6 @@ winUpdateWindowsWindow (WindowPtr pWin);
|
|||
static void
|
||||
winFindWindow (pointer value, XID id, pointer cdata);
|
||||
|
||||
#if 0
|
||||
static void
|
||||
winRestackXWindow (WindowPtr pWin, int smode);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Constant defines
|
||||
*/
|
||||
|
@ -109,8 +103,7 @@ winCreateWindowMultiWindow (WindowPtr pWin)
|
|||
pWinPriv->hWnd = NULL;
|
||||
pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
|
||||
pWinPriv->fXKilled = FALSE;
|
||||
pWinPriv->fNeedRestore = FALSE;
|
||||
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
||||
|
@ -145,13 +138,17 @@ winDestroyWindowMultiWindow (WindowPtr pWin)
|
|||
|
||||
/*
|
||||
* PositionWindow - See Porting Layer Definition - p. 37
|
||||
*
|
||||
* This function adjusts the position and size of Windows window
|
||||
* with respect to the underlying X window. This is the inverse
|
||||
* of winAdjustXWindow, which adjusts X window to Windows window.
|
||||
*/
|
||||
|
||||
Bool
|
||||
winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
Bool fResult = TRUE;
|
||||
int iX, iY, iWidth, iHeight, iBorder;
|
||||
int iX, iY, iWidth, iHeight;
|
||||
winWindowPriv(pWin);
|
||||
HWND hWnd = pWinPriv->hWnd;
|
||||
RECT rcNew;
|
||||
|
@ -171,17 +168,24 @@ winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
|
|||
if (winGetScreenPriv(pWin->drawable.pScreen)->PositionWindow)
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->PositionWindow (pWin, x, y);
|
||||
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n",
|
||||
x, y);
|
||||
#endif
|
||||
|
||||
/* Bail out if the Windows window handle is bad */
|
||||
if (!hWnd)
|
||||
return fResult;
|
||||
{
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("\timmediately return since hWnd is NULL\n");
|
||||
#endif
|
||||
return fResult;
|
||||
}
|
||||
|
||||
/* Get the Windows window style and extended style */
|
||||
dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE);
|
||||
dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE);
|
||||
|
||||
/* Get the width of the X window border */
|
||||
iBorder = wBorderWidth (pWin);
|
||||
|
||||
/* Get the X and Y location of the X window */
|
||||
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
|
@ -232,6 +236,10 @@ winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
|
|||
ErrorF ("winPositionWindowMultiWindow - Need to move\n");
|
||||
#endif
|
||||
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("\tMoveWindow to (%ld, %ld) - %ldx%ld\n", rcNew.left, rcNew.top,
|
||||
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
|
||||
#endif
|
||||
/* Change the position and dimensions of the Windows window */
|
||||
MoveWindow (hWnd,
|
||||
rcNew.left, rcNew.top,
|
||||
|
@ -372,7 +380,7 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
|
|||
HWND hWnd = NULL;
|
||||
winWindowPriv(pWin);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
|
||||
ErrorF ("winRestackMultiWindow - %08x\n", pWin);
|
||||
#endif
|
||||
|
||||
|
@ -381,9 +389,13 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
|
|||
winGetScreenPriv(pWin->drawable.pScreen)->RestackWindow (pWin,
|
||||
pOldNextSib);
|
||||
|
||||
if (winGetScreenPriv(pWin->drawable.pScreen)->fRestacking)
|
||||
return;
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* Calling winReorderWindowsMultiWindow here means our window manager
|
||||
* (i.e. Windows Explorer) has initiative to determine Z order.
|
||||
*/
|
||||
winReorderWindowsMultiWindow ();
|
||||
#else
|
||||
/* Bail out if no window privates or window handle is invalid */
|
||||
if (!pWinPriv || !pWinPriv->hWnd)
|
||||
return;
|
||||
|
@ -436,6 +448,7 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
|
|||
0, 0,
|
||||
0, 0,
|
||||
uFlags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -443,50 +456,49 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
|
|||
* winCreateWindowsWindow - Create a Windows window associated with an X window
|
||||
*/
|
||||
|
||||
static void
|
||||
void
|
||||
winCreateWindowsWindow (WindowPtr pWin)
|
||||
{
|
||||
int iX, iY;
|
||||
int iWidth;
|
||||
int iHeight;
|
||||
int iBorder;
|
||||
HWND hWnd;
|
||||
WNDCLASS wc;
|
||||
WNDCLASSEX wc;
|
||||
winWindowPriv(pWin);
|
||||
HICON hIcon;
|
||||
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;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin);
|
||||
#endif
|
||||
|
||||
iBorder = wBorderWidth (pWin);
|
||||
|
||||
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
|
||||
|
||||
/* Default positions if none specified */
|
||||
if (!winMultiWindowGetWMNormalHints(pWin, &hints))
|
||||
hints.flags = 0;
|
||||
if ( !(hints.flags & (USPosition|PPosition)) &&
|
||||
!winMultiWindowGetTransientFor (pWin, NULL) &&
|
||||
!pWin->overrideRedirect )
|
||||
{
|
||||
iX = CW_USEDEFAULT;
|
||||
iY = CW_USEDEFAULT;
|
||||
}
|
||||
|
||||
iWidth = pWin->drawable.width;
|
||||
iHeight = pWin->drawable.height;
|
||||
|
||||
/* Load default X icon in case it's not ready yet */
|
||||
if (!g_hiconX)
|
||||
g_hiconX = (HICON)winOverrideDefaultIcon();
|
||||
|
||||
if (!g_hiconX)
|
||||
g_hiconX = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
|
||||
|
||||
/* Try and get the icon from WM_HINTS */
|
||||
hIcon = winXIconToHICON (pWin);
|
||||
|
||||
/* Use default X icon if no icon loaded from WM_HINTS */
|
||||
if (!hIcon)
|
||||
hIcon = g_hiconX;
|
||||
winSelectIcons(pWin, &hIcon, &hIconSmall);
|
||||
|
||||
/* Set standard class name prefix so we can identify window easily */
|
||||
strncpy (pszClass, WINDOW_CLASS_X, strlen (WINDOW_CLASS_X));
|
||||
strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass));
|
||||
|
||||
if (winMultiWindowGetClassHint (pWin, &res_name, &res_class))
|
||||
{
|
||||
|
@ -520,23 +532,27 @@ winCreateWindowsWindow (WindowPtr pWin)
|
|||
#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;
|
||||
RegisterClass (&wc);
|
||||
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_TITLE_X, /* Window name */
|
||||
WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
iX, /* Horizontal position */
|
||||
iY, /* Vertical position */
|
||||
iWidth, /* Right edge */
|
||||
|
@ -548,18 +564,28 @@ winCreateWindowsWindow (WindowPtr pWin)
|
|||
if (hWnd == NULL)
|
||||
{
|
||||
ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n",
|
||||
GetLastError ());
|
||||
(int) GetLastError ());
|
||||
}
|
||||
|
||||
|
||||
/* Change style back to popup, already placed... */
|
||||
SetWindowLong (hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
SetWindowPos (hWnd, 0, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
|
||||
/* Make sure it gets the proper system menu for a WS_POPUP, too */
|
||||
GetSystemMenu (hWnd, TRUE);
|
||||
|
||||
pWinPriv->hWnd = hWnd;
|
||||
|
||||
/* Cause the "Always On Top" to be added in main WNDPROC */
|
||||
/* 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));
|
||||
|
||||
/* Flag that this Windows window handles its own activation */
|
||||
SetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
|
||||
|
||||
/* Call engine-specific create window procedure */
|
||||
(*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
|
||||
}
|
||||
|
||||
|
||||
|
@ -567,13 +593,13 @@ winCreateWindowsWindow (WindowPtr pWin)
|
|||
* winDestroyWindowsWindow - Destroy a Windows window associated
|
||||
* with an X window
|
||||
*/
|
||||
|
||||
static void
|
||||
winDestroyWindowsWindow (WindowPtr pWin)
|
||||
{
|
||||
MSG msg;
|
||||
winWindowPriv(pWin);
|
||||
HICON hiconClass;
|
||||
HICON hiconSmClass;
|
||||
HMODULE hInstance;
|
||||
int iReturn;
|
||||
char pszClass[512];
|
||||
|
@ -586,11 +612,10 @@ winDestroyWindowsWindow (WindowPtr pWin)
|
|||
if (pWinPriv->hWnd == NULL)
|
||||
return;
|
||||
|
||||
SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, 0);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Destroy the Windows window */
|
||||
|
@ -620,15 +645,8 @@ winDestroyWindowsWindow (WindowPtr pWin)
|
|||
ErrorF ("winDestroyWindowsWindow - %d Deleting Icon: ", iReturn);
|
||||
#endif
|
||||
|
||||
/* Only delete if it's not the default */
|
||||
if (hiconClass != g_hiconX &&
|
||||
!winIconIsOverride((unsigned long)hiconClass))
|
||||
{
|
||||
iReturn = DestroyIcon (hiconClass);
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winDestroyWindowsWindow - %d\n", iReturn);
|
||||
#endif
|
||||
}
|
||||
winDestroyIcon(hiconClass);
|
||||
winDestroyIcon(hiconSmClass);
|
||||
}
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
|
@ -704,38 +722,6 @@ winGetWindowID (WindowPtr pWin)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* winMoveXWindow -
|
||||
*/
|
||||
|
||||
void
|
||||
winMoveXWindow (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winResizeXWindow -
|
||||
*/
|
||||
|
||||
void
|
||||
winResizeXWindow (WindowPtr pWin, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = w;
|
||||
(CARD32*)vlist[1] = h;
|
||||
ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winFindWindow -
|
||||
*/
|
||||
|
@ -752,95 +738,69 @@ winFindWindow (pointer value, XID id, pointer cdata)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* winRestackXWindow -
|
||||
*/
|
||||
|
||||
static void
|
||||
winRestackXWindow (WindowPtr pWin, int smode)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(unsigned long));
|
||||
|
||||
if (vlist == NULL)
|
||||
{
|
||||
ErrorF ("winRestackXWindow - malloc () failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pWin == NULL)
|
||||
{
|
||||
ErrorF ("winRestackXWindow - NULL window\n");
|
||||
free(vlist);
|
||||
return;
|
||||
}
|
||||
|
||||
*((unsigned long*)vlist) = smode;
|
||||
ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
|
||||
|
||||
free(vlist);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* winReorderWindowsMultiWindow -
|
||||
*/
|
||||
|
||||
void
|
||||
winReorderWindowsMultiWindow (ScreenPtr pScreen)
|
||||
winReorderWindowsMultiWindow (void)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
HWND hwnd = NULL;
|
||||
WindowPtr pWin = NULL;
|
||||
WindowPtr pWinSib = NULL;
|
||||
XID vlist[2];
|
||||
static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
|
||||
DWORD dwCurrentProcessID = GetCurrentProcessId ();
|
||||
DWORD dwWindowProcessID = 0;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winOrderWindowsMultiWindow\n");
|
||||
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
|
||||
ErrorF ("winReorderWindowsMultiWindow\n");
|
||||
#endif
|
||||
|
||||
pScreenPriv->fRestacking = TRUE;
|
||||
|
||||
if (pScreenPriv->fWindowOrderChanged)
|
||||
if (fRestacking)
|
||||
{
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winOrderWindowsMultiWindow - Need to restack\n");
|
||||
/* It is a recusive call so immediately exit */
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winReorderWindowsMultiWindow - "
|
||||
"exit because fRestacking == TRUE\n");
|
||||
#endif
|
||||
hwnd = GetTopWindow (NULL);
|
||||
return;
|
||||
}
|
||||
fRestacking = TRUE;
|
||||
|
||||
while (hwnd)
|
||||
/* Loop through top level Window windows, descending in Z order */
|
||||
for ( hwnd = GetTopWindow (NULL);
|
||||
hwnd;
|
||||
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT) )
|
||||
{
|
||||
/* Don't take care of other Cygwin/X process's windows */
|
||||
GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
|
||||
|
||||
if ( GetProp (hwnd, WIN_WINDOW_PROP)
|
||||
&& (dwWindowProcessID == dwCurrentProcessID)
|
||||
&& !IsIconic (hwnd) ) /* ignore minimized windows */
|
||||
{
|
||||
if (GetProp (hwnd, WIN_WINDOW_PROP))
|
||||
{
|
||||
pWinSib = pWin;
|
||||
pWin = GetProp (hwnd, WIN_WINDOW_PROP);
|
||||
pWinSib = pWin;
|
||||
pWin = GetProp (hwnd, WIN_WINDOW_PROP);
|
||||
|
||||
if (pWinSib)
|
||||
{
|
||||
XID *vlist = malloc (sizeof(long) * 2);
|
||||
if (!pWinSib)
|
||||
{ /* 1st window - raise to the top */
|
||||
vlist[0] = Above;
|
||||
|
||||
if (vlist == NULL)
|
||||
{
|
||||
ErrorF ("winOrderWindowsMultiWindow - malloc () "
|
||||
"failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
((long*)vlist)[0] = winGetWindowID (pWinSib);
|
||||
((long*)vlist)[1] = Below;
|
||||
|
||||
ConfigureWindow (pWin, CWSibling | CWStackMode,
|
||||
vlist, wClient(pWin));
|
||||
|
||||
free (vlist);
|
||||
}
|
||||
ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
|
||||
}
|
||||
else
|
||||
{ /* 2nd or deeper windows - just below the previous one */
|
||||
vlist[0] = winGetWindowID (pWinSib);
|
||||
vlist[1] = Below;
|
||||
|
||||
ConfigureWindow (pWin, CWSibling | CWStackMode,
|
||||
vlist, wClient(pWin));
|
||||
}
|
||||
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
|
||||
}
|
||||
}
|
||||
|
||||
pScreenPriv->fRestacking = FALSE;
|
||||
pScreenPriv->fWindowOrderChanged = FALSE;
|
||||
fRestacking = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -853,6 +813,10 @@ winMinimizeWindow (Window id)
|
|||
{
|
||||
WindowPtr pWin;
|
||||
winPrivWinPtr pWinPriv;
|
||||
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winMinimizeWindow\n");
|
||||
#endif
|
||||
|
||||
pWin = LookupIDByType (id, RT_WINDOW);
|
||||
|
||||
|
@ -860,3 +824,147 @@ winMinimizeWindow (Window id)
|
|||
|
||||
ShowWindow (pWinPriv->hWnd, SW_MINIMIZE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CopyWindow - See Porting Layer Definition - p. 39
|
||||
*/
|
||||
void
|
||||
winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
|
||||
RegionPtr oldRegion)
|
||||
{
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("CopyWindowMultiWindow\n");
|
||||
#endif
|
||||
/* Call any wrapped CopyWindow function */
|
||||
if (winGetScreenPriv(pWin->drawable.pScreen)->CopyWindow)
|
||||
winGetScreenPriv(pWin->drawable.pScreen)->CopyWindow (pWin,
|
||||
oldpt,
|
||||
oldRegion);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MoveWindow - See Porting Layer Definition - p. 42
|
||||
*/
|
||||
void
|
||||
winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
|
||||
WindowPtr pSib, VTKind kind)
|
||||
{
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("MoveWindowMultiWindow to (%d, %d)\n", x, y);
|
||||
#endif
|
||||
/* Call any wrapped MoveWindow function */
|
||||
if (winGetScreenPriv(pWin->drawable.pScreen)->MoveWindow)
|
||||
winGetScreenPriv(pWin->drawable.pScreen)->MoveWindow (pWin, x, y,
|
||||
pSib, kind);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ResizeWindow - See Porting Layer Definition - p. 42
|
||||
*/
|
||||
void
|
||||
winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
|
||||
unsigned int h, WindowPtr pSib)
|
||||
{
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
|
||||
#endif
|
||||
/* Call any wrapped MoveWindow function */
|
||||
if (winGetScreenPriv(pWin->drawable.pScreen)->ResizeWindow)
|
||||
winGetScreenPriv(pWin->drawable.pScreen)->ResizeWindow (pWin, x, y,
|
||||
w, h, pSib);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winAdjustXWindow
|
||||
*
|
||||
* Move and resize X window with respect to corresponding Windows window.
|
||||
* This is called from WM_MOVE/WM_SIZE handlers when the user performs
|
||||
* any windowing operation (move, resize, minimize, maximize, restore).
|
||||
*
|
||||
* The functionality is the inverse of winPositionWindowMultiWindow, which
|
||||
* adjusts Windows window with respect to X window.
|
||||
*/
|
||||
int
|
||||
winAdjustXWindow (WindowPtr pWin, HWND hwnd)
|
||||
{
|
||||
RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
|
||||
RECT rcWin; /* The source: WindowRect from hwnd */
|
||||
DrawablePtr pDraw;
|
||||
XID vlist[4];
|
||||
LONG dX, dY, dW, dH, x, y;
|
||||
DWORD dwStyle, dwExStyle;
|
||||
|
||||
#define WIDTH(rc) (rc.right - rc.left)
|
||||
#define HEIGHT(rc) (rc.bottom - rc.top)
|
||||
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winAdjustXWindow\n");
|
||||
#endif
|
||||
|
||||
if (IsIconic (hwnd))
|
||||
{
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("\timmediately return because the window is iconized\n");
|
||||
#endif
|
||||
/*
|
||||
* If the Windows window is minimized, its WindowRect has
|
||||
* meaningless values so we don't adjust X window to it.
|
||||
* Instead we put the X window to the bottom in Z order to
|
||||
* be obscured by other windows.
|
||||
*/
|
||||
vlist[0] = Below;
|
||||
return ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
|
||||
}
|
||||
|
||||
pDraw = &pWin->drawable;
|
||||
|
||||
/* Calculate the window rect from the drawable */
|
||||
x = pDraw->x + GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
y = pDraw->y + GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
SetRect (&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
|
||||
dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
|
||||
dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
|
||||
AdjustWindowRectEx (&rcDraw, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
/* The source of adjust */
|
||||
GetWindowRect (hwnd, &rcWin);
|
||||
|
||||
if (EqualRect (&rcDraw, &rcWin)) {
|
||||
/* Bail if no adjust is needed */
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("\treturn because already adjusted\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Calculate delta values */
|
||||
dX = rcWin.left - rcDraw.left;
|
||||
dY = rcWin.top - rcDraw.top;
|
||||
dW = WIDTH(rcWin) - WIDTH(rcDraw);
|
||||
dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
|
||||
|
||||
/*
|
||||
* Adjust.
|
||||
* We may only need to move (vlist[0] and [1]), or only resize
|
||||
* ([2] and [3]) but currently we set all the parameters and leave
|
||||
* the decision to ConfigureWindow. The reason is code simplicity.
|
||||
*/
|
||||
vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
|
||||
vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
|
||||
vlist[2] = pDraw->width + dW;
|
||||
vlist[3] = pDraw->height + dH;
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
|
||||
vlist[2], vlist[3]);
|
||||
#endif
|
||||
return ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight,
|
||||
vlist, wClient(pWin));
|
||||
|
||||
#undef WIDTH
|
||||
#undef HEIGHT
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,15 @@
|
|||
#include <windows.h>
|
||||
|
||||
/* Local headers */
|
||||
#include "obj_base.h"
|
||||
#include "ddraw.h"
|
||||
#include "winwindow.h"
|
||||
|
||||
extern void winDebug(const char *format, ...);
|
||||
|
||||
#ifndef CYGDEBUG
|
||||
#define CYGDEBUG NO
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constant defines
|
||||
|
@ -79,6 +86,7 @@ typedef struct _WMMsgQueueRec {
|
|||
struct _WMMsgNodeRec *pTail;
|
||||
pthread_mutex_t pmMutex;
|
||||
pthread_cond_t pcNotEmpty;
|
||||
int nQueueSize;
|
||||
} WMMsgQueueRec, *WMMsgQueuePtr;
|
||||
|
||||
typedef struct _WMInfo {
|
||||
|
@ -96,9 +104,9 @@ typedef struct _WMProcArgRec {
|
|||
} WMProcArgRec, *WMProcArgPtr;
|
||||
|
||||
typedef struct _XMsgProcArgRec {
|
||||
Display *pDisplay;
|
||||
DWORD dwScreen;
|
||||
WMInfoPtr pWMInfo;
|
||||
Display *pDisplay;
|
||||
DWORD dwScreen;
|
||||
WMInfoPtr pWMInfo;
|
||||
pthread_mutex_t *ppmServerStarted;
|
||||
} XMsgProcArgRec, *XMsgProcArgPtr;
|
||||
|
||||
|
@ -109,8 +117,6 @@ typedef struct _XMsgProcArgRec {
|
|||
|
||||
extern char *display;
|
||||
extern void ErrorF (const char* /*f*/, ...);
|
||||
extern Bool g_fCalledSetLocale;
|
||||
extern Bool g_fCalledXInitThreads;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -139,26 +145,40 @@ static void*
|
|||
winMultiWindowWMProc (void* pArg);
|
||||
|
||||
static int
|
||||
winMultiWindowWMErrorHandler (Display *pDisp, XErrorEvent *e);
|
||||
winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr);
|
||||
|
||||
static int
|
||||
winMultiWindowWMIOErrorHandler (Display *pDisplay);
|
||||
|
||||
static void *
|
||||
winMultiWindowXMsgProc (void *pArg);
|
||||
|
||||
static int
|
||||
winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr);
|
||||
|
||||
static int
|
||||
winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay);
|
||||
|
||||
static int
|
||||
winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr);
|
||||
|
||||
static void
|
||||
winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
|
||||
|
||||
static int
|
||||
winMutliWindowWMIOErrorHandler (Display *pDisplay);
|
||||
#if 0
|
||||
static void
|
||||
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local globals
|
||||
*/
|
||||
|
||||
static int g_nQueueSize;
|
||||
static jmp_buf g_jmpEntry;
|
||||
static jmp_buf g_jmpWMEntry;
|
||||
static jmp_buf g_jmpXMsgProcEntry;
|
||||
static Bool g_shutdown = FALSE;
|
||||
|
||||
static Bool redirectError = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -214,7 +234,7 @@ PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
|
|||
#endif
|
||||
|
||||
/* Increase the count of elements in the queue by one */
|
||||
++g_nQueueSize;
|
||||
++(pQueue->nQueueSize);
|
||||
|
||||
/* Release the queue mutex */
|
||||
pthread_mutex_unlock (&pQueue->pmMutex);
|
||||
|
@ -274,10 +294,10 @@ PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
|
|||
}
|
||||
|
||||
/* Drop the number of elements in the queue by one */
|
||||
--g_nQueueSize;
|
||||
--(pQueue->nQueueSize);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("Queue Size %d %d\n", g_nQueueSize, QueueSize(pQueue));
|
||||
ErrorF ("Queue Size %d %d\n", pQueue->nQueueSize, QueueSize(pQueue));
|
||||
#endif
|
||||
|
||||
/* Release the queue mutex */
|
||||
|
@ -328,10 +348,11 @@ InitQueue (WMMsgQueuePtr pQueue)
|
|||
pQueue->pTail = NULL;
|
||||
|
||||
/* There are no elements initially */
|
||||
g_nQueueSize = 0;
|
||||
pQueue->nQueueSize = 0;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("InitQueue - Queue Size %d %d\n", g_nQueueSize, QueueSize(pQueue));
|
||||
ErrorF ("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
|
||||
QueueSize(pQueue));
|
||||
#endif
|
||||
|
||||
ErrorF ("InitQueue - Calling pthread_mutex_init\n");
|
||||
|
@ -399,10 +420,10 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
|
|||
/* */
|
||||
if (nNum && ppList && *ppList)
|
||||
{
|
||||
XFree (xtpName.value);
|
||||
*ppName = strdup (*ppList);
|
||||
XFreeStringList (ppList);
|
||||
}
|
||||
XFree (xtpName.value);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("GetWindowName - %s %s\n",
|
||||
|
@ -410,7 +431,6 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("GetWindowName - Returning\n");
|
||||
#endif
|
||||
|
@ -499,6 +519,74 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Fix up any differences between the X11 and Win32 window stacks
|
||||
* starting at the window passed in
|
||||
*/
|
||||
static void
|
||||
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
|
||||
{
|
||||
Atom atmType;
|
||||
int fmtRet;
|
||||
unsigned long items, remain;
|
||||
HWND hWnd, *retHwnd;
|
||||
DWORD myWinProcID, winProcID;
|
||||
Window xWindow;
|
||||
WINDOWPLACEMENT wndPlace;
|
||||
|
||||
hWnd = NULL;
|
||||
/* See if we can get the cached HWND for this window... */
|
||||
if (XGetWindowProperty (pWMInfo->pDisplay,
|
||||
iWindow,
|
||||
pWMInfo->atmPrivMap,
|
||||
0,
|
||||
1,
|
||||
False,
|
||||
pWMInfo->atmPrivMap,
|
||||
&atmType,
|
||||
&fmtRet,
|
||||
&items,
|
||||
&remain,
|
||||
(unsigned char **) &retHwnd) == Success)
|
||||
{
|
||||
if (retHwnd)
|
||||
{
|
||||
hWnd = *retHwnd;
|
||||
XFree (retHwnd);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hWnd) return;
|
||||
|
||||
GetWindowThreadProcessId (hWnd, &myWinProcID);
|
||||
hWnd = GetNextWindow (hWnd, direction);
|
||||
|
||||
while (hWnd) {
|
||||
GetWindowThreadProcessId (hWnd, &winProcID);
|
||||
if (winProcID == myWinProcID)
|
||||
{
|
||||
wndPlace.length = sizeof(WINDOWPLACEMENT);
|
||||
GetWindowPlacement (hWnd, &wndPlace);
|
||||
if ( !(wndPlace.showCmd==SW_HIDE ||
|
||||
wndPlace.showCmd==SW_MINIMIZE) )
|
||||
{
|
||||
xWindow = (Window)GetProp (hWnd, WIN_WID_PROP);
|
||||
if (xWindow)
|
||||
{
|
||||
if (direction==GW_HWNDPREV)
|
||||
XRaiseWindow (pWMInfo->pDisplay, xWindow);
|
||||
else
|
||||
XLowerWindow (pWMInfo->pDisplay, xWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
hWnd = GetNextWindow(hWnd, direction);
|
||||
}
|
||||
}
|
||||
#endif /* PreserveWin32Stack */
|
||||
|
||||
|
||||
/*
|
||||
* winMultiWindowWMProc
|
||||
*/
|
||||
|
@ -527,7 +615,7 @@ winMultiWindowWMProc (void *pArg)
|
|||
{
|
||||
/* Bail if PopMessage returns without a message */
|
||||
/* NOTE: Remember that PopMessage is a blocking function. */
|
||||
ErrorF ("winMultiWindowWMProc - Queue is Empty?\n");
|
||||
ErrorF ("winMultiWindowWMProc - Queue is Empty? Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
|
@ -553,9 +641,11 @@ winMultiWindowWMProc (void *pArg)
|
|||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("\tWM_WM_RAISE\n");
|
||||
#endif
|
||||
|
||||
/* Raise the window */
|
||||
XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
|
||||
#if 0
|
||||
PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_WM_LOWER:
|
||||
|
@ -582,6 +672,10 @@ 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);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_WM_UNMAP:
|
||||
|
@ -652,7 +746,7 @@ winMultiWindowWMProc (void *pArg)
|
|||
break;
|
||||
|
||||
default:
|
||||
ErrorF ("winMultiWindowWMProc - Unknown Message.\n");
|
||||
ErrorF ("winMultiWindowWMProc - Unknown Message. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
break;
|
||||
}
|
||||
|
@ -680,48 +774,7 @@ winMultiWindowWMProc (void *pArg)
|
|||
|
||||
|
||||
/*
|
||||
* winMultiWindowWMErrorHandler - Our application specific error handler
|
||||
*/
|
||||
|
||||
static int
|
||||
winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
||||
{
|
||||
char pszErrorMsg[100];
|
||||
|
||||
if (pErr->request_code == X_ChangeWindowAttributes
|
||||
&& pErr->error_code == BadAccess)
|
||||
{
|
||||
ErrorF ("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
|
||||
"BadAccess.\n");
|
||||
#if 0
|
||||
pthread_exit (NULL);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
XGetErrorText (pDisplay,
|
||||
pErr->error_code,
|
||||
pszErrorMsg,
|
||||
sizeof (pszErrorMsg));
|
||||
ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n", pszErrorMsg);
|
||||
|
||||
if (pErr->error_code == BadWindow
|
||||
|| pErr->error_code == BadMatch
|
||||
|| pErr->error_code == BadDrawable)
|
||||
{
|
||||
#if 0
|
||||
pthread_exit (NULL);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
pthread_exit (NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* X message procedure
|
||||
*/
|
||||
|
||||
static void *
|
||||
|
@ -743,7 +796,7 @@ winMultiWindowXMsgProc (void *pArg)
|
|||
/* Check that argument pointer is not invalid */
|
||||
if (pProcArg == NULL)
|
||||
{
|
||||
ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL, bailing.\n");
|
||||
ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
|
@ -753,27 +806,27 @@ winMultiWindowXMsgProc (void *pArg)
|
|||
iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d\n",
|
||||
ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. "
|
||||
"Exiting.\n",
|
||||
iReturn);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
|
||||
|
||||
/* Only call XInitThreads once for the whole process */
|
||||
if (!g_fCalledXInitThreads)
|
||||
/* Allow multiple threads to access Xlib */
|
||||
if (XInitThreads () == 0)
|
||||
{
|
||||
/* Allow multiple threads to access Xlib */
|
||||
if (XInitThreads () == 0)
|
||||
{
|
||||
ErrorF ("winMultiWindowXMsgProc - XInitThreads () failed.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Flag that XInitThreads has been called */
|
||||
g_fCalledXInitThreads = TRUE;
|
||||
ErrorF ("winMultiWindowXMsgProc - XInitThreads () failed. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winMultiWindowXMsgProc - XInitThreads () returned.\n");
|
||||
/* See if X supports the current locale */
|
||||
if (XSupportsLocale () == False)
|
||||
{
|
||||
ErrorF ("winMultiWindowXMsgProc - Locale not supported by X. "
|
||||
"Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Release the server started mutex */
|
||||
|
@ -781,6 +834,28 @@ winMultiWindowXMsgProc (void *pArg)
|
|||
|
||||
ErrorF ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
|
||||
|
||||
/* Set jump point for IO Error exits */
|
||||
iReturn = setjmp (g_jmpXMsgProcEntry);
|
||||
|
||||
/* Check if we should continue operations */
|
||||
if (iReturn != WIN_JMP_ERROR_IO
|
||||
&& iReturn != WIN_JMP_OKAY)
|
||||
{
|
||||
/* setjmp returned an unknown value, exit */
|
||||
ErrorF ("winInitMultiWindowXMsgProc - setjmp returned: %d. Exiting.\n",
|
||||
iReturn);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
else if (iReturn == WIN_JMP_ERROR_IO)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowXMsgProc - Caught IO Error. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Install our error handler */
|
||||
XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
|
||||
XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler);
|
||||
|
||||
/* Setup the display connection string x */
|
||||
snprintf (pszDisplay,
|
||||
512, "127.0.0.1:%s.%d", display, (int)pProcArg->dwScreen);
|
||||
|
@ -788,6 +863,7 @@ winMultiWindowXMsgProc (void *pArg)
|
|||
/* Print the display connection string */
|
||||
ErrorF ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
|
||||
|
||||
/* Initialize retry count */
|
||||
iRetries = 0;
|
||||
|
||||
/* Open the X display */
|
||||
|
@ -812,21 +888,28 @@ winMultiWindowXMsgProc (void *pArg)
|
|||
/* Make sure that the display opened */
|
||||
if (pProcArg->pDisplay == NULL)
|
||||
{
|
||||
ErrorF ("winMultiWindowXMsgProcwinInitMultiWindowWM - "
|
||||
"Failed opening the display, giving up.\n\f");
|
||||
ErrorF ("winMultiWindowXMsgProc - Failed opening the display. "
|
||||
"Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winMultiWindowXMsgProc - XOpenDisplay () returned and "
|
||||
"successfully opened the display.\n");
|
||||
|
||||
/* Install our error handler */
|
||||
XSetErrorHandler (winMultiWindowWMErrorHandler);
|
||||
XSetIOErrorHandler (winMutliWindowWMIOErrorHandler);
|
||||
|
||||
XSelectInput (pProcArg->pDisplay,
|
||||
RootWindow(pProcArg->pDisplay, pProcArg->dwScreen),
|
||||
SubstructureNotifyMask);
|
||||
/* Check if another window manager is already running */
|
||||
redirectError = FALSE;
|
||||
XSetErrorHandler (winRedirectErrorHandler);
|
||||
XSelectInput(pProcArg->pDisplay,
|
||||
RootWindow (pProcArg->pDisplay, pProcArg->dwScreen),
|
||||
SubstructureNotifyMask | ButtonPressMask);
|
||||
XSync (pProcArg->pDisplay, 0);
|
||||
XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
|
||||
if (redirectError)
|
||||
{
|
||||
ErrorF ("winMultiWindowXMsgProc - "
|
||||
"another window manager is running. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Set up the supported icon sizes */
|
||||
xis = XAllocIconSize ();
|
||||
|
@ -924,10 +1007,15 @@ winInitWM (void **ppWMInfo,
|
|||
/* Bail if the input parameters are bad */
|
||||
if (pArg == NULL || pWMInfo == NULL)
|
||||
{
|
||||
ErrorF ("winInitWM - malloc fail.\n");
|
||||
ErrorF ("winInitWM - malloc failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Zero the allocated memory */
|
||||
ZeroMemory (pArg, sizeof (WMProcArgRec));
|
||||
ZeroMemory (pWMInfo, sizeof (WMInfoRec));
|
||||
ZeroMemory (pXMsgArg, sizeof (XMsgProcArgRec));
|
||||
|
||||
/* Set a return pointer to the Window Manager info structure */
|
||||
*ppWMInfo = pWMInfo;
|
||||
|
||||
|
@ -963,7 +1051,7 @@ winInitWM (void **ppWMInfo,
|
|||
}
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
ErrorF ("winInitWM - Returning.\n");
|
||||
winDebug ("winInitWM - Returning.\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -971,26 +1059,22 @@ winInitWM (void **ppWMInfo,
|
|||
|
||||
|
||||
/*
|
||||
* winInitMultiWindowWM -
|
||||
* Window manager thread - setup
|
||||
*/
|
||||
|
||||
Bool
|
||||
winClipboardDetectUnicodeSupport ();
|
||||
|
||||
static void
|
||||
winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
|
||||
{
|
||||
int iRetries = 0;
|
||||
char pszDisplay[512];
|
||||
int iReturn;
|
||||
Bool fUnicodeSupport;
|
||||
|
||||
ErrorF ("winInitMultiWindowWM - Hello\n");
|
||||
|
||||
/* Check that argument pointer is not invalid */
|
||||
if (pProcArg == NULL)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - pProcArg is NULL, bailing.\n");
|
||||
ErrorF ("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
|
@ -1000,52 +1084,26 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
|
|||
iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d\n",
|
||||
ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. "
|
||||
"Exiting.\n",
|
||||
iReturn);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
|
||||
|
||||
/* Do we have Unicode support? */
|
||||
fUnicodeSupport = winClipboardDetectUnicodeSupport ();
|
||||
|
||||
/* Set the current locale? What does this do? */
|
||||
if (fUnicodeSupport && !g_fCalledSetLocale)
|
||||
/* Allow multiple threads to access Xlib */
|
||||
if (XInitThreads () == 0)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - Calling setlocale ()\n");
|
||||
if (!setlocale (LC_ALL, ""))
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - setlocale () error\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
ErrorF ("winInitMultiWindowWM - setlocale () returned\n");
|
||||
|
||||
/* See if X supports the current locale */
|
||||
if (XSupportsLocale () == False)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - Locale not supported by X\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
ErrorF ("winInitMultiWindowWM - XInitThreads () failed. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Flag that we have called setlocale */
|
||||
g_fCalledSetLocale = TRUE;
|
||||
|
||||
/* Only call XInitThreads once for the whole process */
|
||||
if (!g_fCalledXInitThreads)
|
||||
/* See if X supports the current locale */
|
||||
if (XSupportsLocale () == False)
|
||||
{
|
||||
/* Allow multiple threads to access Xlib */
|
||||
if (XInitThreads () == 0)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - XInitThreads () failed.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Flag that XInitThreads has been called */
|
||||
g_fCalledXInitThreads = TRUE;
|
||||
|
||||
ErrorF ("winInitMultiWindowWM - XInitThreads () returned.\n");
|
||||
ErrorF ("winInitMultiWindowWM - Locale not supported by X. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Release the server started mutex */
|
||||
|
@ -1054,28 +1112,27 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
|
|||
ErrorF ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
|
||||
|
||||
/* Set jump point for IO Error exits */
|
||||
iReturn = setjmp (g_jmpEntry);
|
||||
iReturn = setjmp (g_jmpWMEntry);
|
||||
|
||||
/* Check if we should continue operations */
|
||||
if (iReturn != WIN_JMP_ERROR_IO
|
||||
&& iReturn != WIN_JMP_OKAY)
|
||||
{
|
||||
/* setjmp returned an unknown value, exit */
|
||||
ErrorF ("winInitMultiWindowWM - setjmp returned: %d exiting\n",
|
||||
ErrorF ("winInitMultiWindowWM - setjmp returned: %d. Exiting.\n",
|
||||
iReturn);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
else if (g_shutdown)
|
||||
{
|
||||
/* Shutting down, the X server severed out connection! */
|
||||
ErrorF ("winInitMultiWindowWM - Detected shutdown in progress\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
else if (iReturn == WIN_JMP_ERROR_IO)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - setjmp returned WIN_JMP_ERROR_IO\n");
|
||||
ErrorF ("winInitMultiWindowWM - Caught IO Error. Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
/* Install our error handler */
|
||||
XSetErrorHandler (winMultiWindowWMErrorHandler);
|
||||
XSetIOErrorHandler (winMultiWindowWMIOErrorHandler);
|
||||
|
||||
/* Setup the display connection string x */
|
||||
snprintf (pszDisplay,
|
||||
512,
|
||||
|
@ -1108,17 +1165,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
|
|||
/* Make sure that the display opened */
|
||||
if (pWMInfo->pDisplay == NULL)
|
||||
{
|
||||
ErrorF ("winInitMultiWindowWM - Failed opening the display, "
|
||||
"giving up.\n\f");
|
||||
ErrorF ("winInitMultiWindowWM - Failed opening the display. "
|
||||
"Exiting.\n");
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
ErrorF ("winInitMultiWindowWM - XOpenDisplay () returned and "
|
||||
"successfully opened the display.\n");
|
||||
|
||||
/* Install our error handler */
|
||||
XSetErrorHandler (winMultiWindowWMErrorHandler);
|
||||
XSetIOErrorHandler (winMutliWindowWMIOErrorHandler);
|
||||
|
||||
/* Create some atoms */
|
||||
pWMInfo->atmWmProtos = XInternAtom (pWMInfo->pDisplay,
|
||||
|
@ -1156,21 +1210,95 @@ winSendMessageToWM (void *pWMInfo, winWMMessagePtr pMsg)
|
|||
|
||||
|
||||
/*
|
||||
* winMutliWindowWMIOErrorHandler - Our application specific IO error handler
|
||||
* Window manager error handler
|
||||
*/
|
||||
|
||||
static int
|
||||
winMutliWindowWMIOErrorHandler (Display *pDisplay)
|
||||
winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
||||
{
|
||||
printf ("\nwinMutliWindowWMIOErrorHandler!\n\n");
|
||||
char pszErrorMsg[100];
|
||||
|
||||
if (pErr->request_code == X_ChangeWindowAttributes
|
||||
&& pErr->error_code == BadAccess)
|
||||
{
|
||||
ErrorF ("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
|
||||
"BadAccess.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
XGetErrorText (pDisplay,
|
||||
pErr->error_code,
|
||||
pszErrorMsg,
|
||||
sizeof (pszErrorMsg));
|
||||
ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n", pszErrorMsg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Window manager IO error handler
|
||||
*/
|
||||
|
||||
static int
|
||||
winMultiWindowWMIOErrorHandler (Display *pDisplay)
|
||||
{
|
||||
ErrorF ("\nwinMultiWindowWMIOErrorHandler!\n\n");
|
||||
|
||||
/* Restart at the main entry point */
|
||||
longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
|
||||
longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* X message procedure error handler
|
||||
*/
|
||||
|
||||
static int
|
||||
winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
||||
{
|
||||
char pszErrorMsg[100];
|
||||
|
||||
XGetErrorText (pDisplay,
|
||||
pErr->error_code,
|
||||
pszErrorMsg,
|
||||
sizeof (pszErrorMsg));
|
||||
ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* X message procedure IO error handler
|
||||
*/
|
||||
|
||||
static int
|
||||
winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay)
|
||||
{
|
||||
ErrorF ("\nwinMultiWindowXMsgProcIOErrorHandler!\n\n");
|
||||
|
||||
/* Restart at the main entry point */
|
||||
longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Catch RedirectError to detect other window manager running
|
||||
*/
|
||||
|
||||
static int
|
||||
winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
||||
{
|
||||
redirectError = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Notify the MWM thread we're exiting and not to reconnect
|
||||
*/
|
||||
|
|
|
@ -35,19 +35,17 @@
|
|||
#include "dixevents.h"
|
||||
#include "winmultiwindowclass.h"
|
||||
#include "winprefs.h"
|
||||
#if CYGDEBUG
|
||||
#include "winmessages.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* External global variables
|
||||
*/
|
||||
|
||||
extern Bool g_fCursor;
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
HICON g_hiconX = NULL;
|
||||
extern Bool g_fCursor;
|
||||
extern Bool g_fKeyboardHookLL;
|
||||
extern Bool g_fSoftwareCursor;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -65,7 +63,6 @@ static UINT_PTR g_uipMousePollingTimerID = 0;
|
|||
#define WIN_MULTIWINDOW_SHAPE YES
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ConstrainSize - Taken from TWM sources - Respects hints for sizing
|
||||
*/
|
||||
|
@ -206,8 +203,7 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
|
|||
{
|
||||
WinXSizeHints sizeHints;
|
||||
RECT *rect;
|
||||
int iWidth, iHeight, iTopBorder;
|
||||
POINT pt;
|
||||
int iWidth, iHeight;
|
||||
|
||||
/* Invalid input checking */
|
||||
if (pWin==NULL || lParam==0)
|
||||
|
@ -229,21 +225,19 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
|
|||
iWidth = rect->right - rect->left;
|
||||
iHeight = rect->bottom - rect->top;
|
||||
|
||||
/* Get title bar height, there must be an easier way?! */
|
||||
pt.x = pt.y = 0;
|
||||
ClientToScreen(hwnd, &pt);
|
||||
iTopBorder = pt.y - rect->top;
|
||||
|
||||
/* Now remove size of any borders */
|
||||
iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
iHeight -= GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
|
||||
iHeight -= (GetSystemMetrics(SM_CYCAPTION)
|
||||
+ 2 * GetSystemMetrics(SM_CYSIZEFRAME));
|
||||
|
||||
|
||||
/* Constrain the size to legal values */
|
||||
ConstrainSize (sizeHints, &iWidth, &iHeight);
|
||||
|
||||
/* Add back the borders */
|
||||
iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
iHeight += GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
|
||||
iHeight += (GetSystemMetrics(SM_CYCAPTION)
|
||||
+ 2 * GetSystemMetrics(SM_CYSIZEFRAME));
|
||||
|
||||
/* Adjust size according to where we're dragging from */
|
||||
switch(wParam) {
|
||||
|
@ -296,6 +290,19 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
winWMMessageRec wmMsg;
|
||||
Bool fWMMsgInitialized = FALSE;
|
||||
static Bool s_fTracking = FALSE;
|
||||
|
||||
#if CYGDEBUG
|
||||
if (message >= WM_USER)
|
||||
{
|
||||
winDebug("winTopLevelWindowProc - Message WM_USER + %d", message - WM_USER);
|
||||
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
|
||||
}
|
||||
else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
|
||||
{
|
||||
winDebug("winTopLevelWindowProc - Message %s", MESSAGE_NAMES[message]);
|
||||
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check if the Windows window property for our X window pointer is valid */
|
||||
if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
|
||||
|
@ -321,10 +328,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
wmMsg.hwndWindow = hwnd;
|
||||
wmMsg.iWindow = (Window)GetProp (hwnd, WIN_WID_PROP);
|
||||
|
||||
wmMsg.iX = pWinPriv->iX;
|
||||
wmMsg.iY = pWinPriv->iY;
|
||||
wmMsg.iWidth = pWinPriv->iWidth;
|
||||
wmMsg.iHeight = pWinPriv->iHeight;
|
||||
wmMsg.iX = pDraw->x;
|
||||
wmMsg.iY = pDraw->y;
|
||||
wmMsg.iWidth = pDraw->width;
|
||||
wmMsg.iHeight = pDraw->height;
|
||||
|
||||
fWMMsgInitialized = TRUE;
|
||||
|
||||
|
@ -373,9 +380,14 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
WIN_WID_PROP,
|
||||
(HANDLE)winGetWindowID (((LPCREATESTRUCT) lParam)->lpCreateParams));
|
||||
|
||||
/*
|
||||
* Make X windows' Z orders sync with Windows windows because
|
||||
* there can be AlwaysOnTop windows overlapped on the window
|
||||
* currently being created.
|
||||
*/
|
||||
winReorderWindowsMultiWindow ();
|
||||
return 0;
|
||||
|
||||
|
||||
case WM_INIT_SYS_MENU:
|
||||
/*
|
||||
* Add whatever the setup file wants to for this window
|
||||
|
@ -387,7 +399,33 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
/*
|
||||
* Any window menu items go through here
|
||||
*/
|
||||
HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam));
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
switch (wParam & 0xFFF0) /* See MSDN for the magic number 0xFFF0 */
|
||||
{
|
||||
case SC_MINIMIZE:
|
||||
ErrorF ("winTopLevelWindowProc - WM_SYSCOMMAND (SC_MINIMIZE)\n");
|
||||
break;
|
||||
|
||||
case SC_RESTORE:
|
||||
ErrorF ("winTopLevelWindowProc - WM_SYSCOMMAND (SC_RESTORE)\n");
|
||||
break;
|
||||
|
||||
case SC_MAXIMIZE:
|
||||
ErrorF ("winTopLevelWindowProc - WM_SYSCOMMAND (SC_MAXIMIZE)\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
ErrorF ("winTopLevelWindowProc - WM_SYSCOMMAND (UNKNOWN)\n");
|
||||
#endif
|
||||
if (HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam)))
|
||||
{
|
||||
/* Don't pass customized menus to DefWindowProc */
|
||||
return 0;
|
||||
}
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_INITMENU:
|
||||
|
@ -481,7 +519,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
}
|
||||
|
||||
/* Hide or show the Windows mouse cursor */
|
||||
if (g_fCursor)
|
||||
if (g_fSoftwareCursor && g_fCursor)
|
||||
{
|
||||
/* Hide Windows cursor */
|
||||
g_fCursor = FALSE;
|
||||
|
@ -516,7 +554,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
break;
|
||||
|
||||
/* Non-client mouse movement, show Windows cursor */
|
||||
if (!g_fCursor)
|
||||
if (g_fSoftwareCursor && !g_fCursor)
|
||||
{
|
||||
g_fCursor = TRUE;
|
||||
ShowCursor (TRUE);
|
||||
|
@ -540,7 +578,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
s_fTracking = FALSE;
|
||||
|
||||
/* Show the mouse cursor, if necessary */
|
||||
if (!g_fCursor)
|
||||
if (g_fSoftwareCursor && !g_fCursor)
|
||||
{
|
||||
g_fCursor = TRUE;
|
||||
ShowCursor (TRUE);
|
||||
|
@ -599,9 +637,23 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
SendMessage (hwndScreen, message, wParam, lParam);
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
|
||||
winRestoreModeKeyStates ();
|
||||
|
||||
/* Add the keyboard hook if possible */
|
||||
if (g_fKeyboardHookLL)
|
||||
g_fKeyboardHookLL = winInstallKeyboardHookLL ();
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
/* Pop any pressed keys since we are losing keyboard focus */
|
||||
winKeybdReleaseKeys ();
|
||||
|
||||
/* Remove our keyboard hook if it is installed */
|
||||
winRemoveKeyboardHookLL ();
|
||||
return 0;
|
||||
|
||||
case WM_SYSDEADCHAR:
|
||||
|
@ -635,6 +687,42 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
if (wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000))
|
||||
break;
|
||||
|
||||
#if CYGWINDOWING_DEBUG
|
||||
if (wParam == VK_ESCAPE)
|
||||
{
|
||||
/* Place for debug: put any tests and dumps here */
|
||||
WINDOWPLACEMENT windPlace;
|
||||
RECT rc;
|
||||
LPRECT pRect;
|
||||
|
||||
windPlace.length = sizeof (WINDOWPLACEMENT);
|
||||
GetWindowPlacement (hwnd, &windPlace);
|
||||
pRect = &windPlace.rcNormalPosition;
|
||||
ErrorF ("\nCYGWINDOWING Dump:\n"
|
||||
"\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x,
|
||||
pDraw->y, pDraw->width, pDraw->height);
|
||||
ErrorF ("\twindPlace: (%ld, %ld) - %ldx%ld\n", pRect->left,
|
||||
pRect->top, pRect->right - pRect->left,
|
||||
pRect->bottom - pRect->top);
|
||||
if (GetClientRect (hwnd, &rc))
|
||||
{
|
||||
pRect = &rc;
|
||||
ErrorF ("\tClientRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
|
||||
pRect->top, pRect->right - pRect->left,
|
||||
pRect->bottom - pRect->top);
|
||||
}
|
||||
if (GetWindowRect (hwnd, &rc))
|
||||
{
|
||||
pRect = &rc;
|
||||
ErrorF ("\tWindowRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
|
||||
pRect->top, pRect->right - pRect->left,
|
||||
pRect->bottom - pRect->top);
|
||||
}
|
||||
ErrorF ("\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Pass the message to the root window */
|
||||
SendMessage (hwndScreen, message, wParam, lParam);
|
||||
return 0;
|
||||
|
@ -667,15 +755,18 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
/* Pass the message to the root window */
|
||||
SendMessage (hwndScreen, message, wParam, lParam);
|
||||
|
||||
if (s_pScreenPriv != NULL)
|
||||
s_pScreenPriv->fWindowOrderChanged = TRUE;
|
||||
|
||||
if (LOWORD(wParam) != WA_INACTIVE)
|
||||
{
|
||||
/* Raise the window to the top in Z order */
|
||||
wmMsg.msg = WM_WM_RAISE;
|
||||
if (fWMMsgInitialized)
|
||||
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
|
||||
|
||||
/* Tell our Window Manager thread to activate the window */
|
||||
wmMsg.msg = WM_WM_ACTIVATE;
|
||||
if (fWMMsgInitialized)
|
||||
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
|
||||
if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
|
||||
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@ -683,10 +774,11 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - WM_ACTIVATEAPP\n");
|
||||
#endif
|
||||
|
||||
/* Pass the message to the root window */
|
||||
SendMessage (hwndScreen, message, wParam, lParam);
|
||||
return 0;
|
||||
/*
|
||||
* This message is also sent to the root window
|
||||
* so we do nothing for individual multiwindow windows
|
||||
*/
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
|
@ -723,48 +815,23 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
|
||||
}
|
||||
|
||||
RemoveProp (hwnd, WIN_WINDOW_PROP);
|
||||
RemoveProp (hwnd, WIN_WID_PROP);
|
||||
RemoveProp (hwnd, WIN_NEEDMANAGE_PROP);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - WM_DESTROY\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - WM_MOVE - %d ms\n", GetTickCount ());
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - WM_MOVE to (%d, %d) - %d ms\n",
|
||||
(int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam),
|
||||
(int)(GetTickCount ()));
|
||||
#endif
|
||||
|
||||
/* Bail if Windows window is not actually moving */
|
||||
if (pWinPriv->iX == (short) LOWORD(lParam)
|
||||
&& pWinPriv->iY == (short) HIWORD(lParam))
|
||||
break;
|
||||
|
||||
/* Also bail if we're maximizing, we'll do the whole thing in WM_SIZE */
|
||||
{
|
||||
WINDOWPLACEMENT windPlace;
|
||||
windPlace.length = sizeof (WINDOWPLACEMENT);
|
||||
|
||||
/* Get current window placement */
|
||||
GetWindowPlacement (hwnd, &windPlace);
|
||||
|
||||
/* Bail if maximizing */
|
||||
if (windPlace.showCmd == SW_MAXIMIZE
|
||||
|| windPlace.showCmd == SW_SHOWMAXIMIZED)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get new position */
|
||||
pWinPriv->iX = (short) LOWORD(lParam);
|
||||
pWinPriv->iY = (short) HIWORD(lParam);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("\t(%d, %d)\n", pWinPriv->iX, pWinPriv->iY);
|
||||
#endif
|
||||
|
||||
winMoveXWindow (pWin,
|
||||
(LOWORD(lParam) - wBorderWidth (pWin)
|
||||
- GetSystemMetrics (SM_XVIRTUALSCREEN)),
|
||||
(HIWORD(lParam) - wBorderWidth (pWin)
|
||||
- GetSystemMetrics (SM_YVIRTUALSCREEN)));
|
||||
/* Adjust the X Window to the moved Windows window */
|
||||
winAdjustXWindow (pWin, hwnd);
|
||||
return 0;
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
|
@ -772,6 +839,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
if (!wParam)
|
||||
return 0;
|
||||
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - WM_SHOWWINDOW\n");
|
||||
#endif
|
||||
|
||||
/* Tell X to map the window */
|
||||
MapWindow (pWin, wClient(pWin));
|
||||
|
||||
|
@ -795,10 +866,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
{
|
||||
/* Setup a rectangle with the X window position and size */
|
||||
SetRect (&rcNew,
|
||||
pWinPriv->iX,
|
||||
pWinPriv->iY,
|
||||
pWinPriv->iX + pWinPriv->iWidth,
|
||||
pWinPriv->iY + pWinPriv->iHeight);
|
||||
pDraw->x,
|
||||
pDraw->y,
|
||||
pDraw->x + pDraw->width,
|
||||
pDraw->y + pDraw->height);
|
||||
|
||||
#if 0
|
||||
ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n",
|
||||
|
@ -813,8 +884,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
WS_EX_APPWINDOW);
|
||||
|
||||
/* Calculate position deltas */
|
||||
iDx = pWinPriv->iX - rcNew.left;
|
||||
iDy = pWinPriv->iY - rcNew.top;
|
||||
iDx = pDraw->x - rcNew.left;
|
||||
iDy = pDraw->y - rcNew.top;
|
||||
|
||||
/* Calculate new rectangle */
|
||||
rcNew.left += iDx;
|
||||
|
@ -846,18 +917,24 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
SetForegroundWindow (hwnd);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/* Setup the Window Manager message */
|
||||
wmMsg.msg = WM_WM_MAP;
|
||||
wmMsg.iWidth = pWinPriv->iWidth;
|
||||
wmMsg.iHeight = pWinPriv->iHeight;
|
||||
wmMsg.iWidth = pDraw->width;
|
||||
wmMsg.iHeight = pDraw->height;
|
||||
|
||||
/* Tell our Window Manager thread to map the window */
|
||||
if (fWMMsgInitialized)
|
||||
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
|
||||
|
||||
if (s_pScreenPriv != NULL)
|
||||
s_pScreenPriv->fWindowOrderChanged = TRUE;
|
||||
return 0;
|
||||
|
||||
case WM_SIZING:
|
||||
|
@ -865,119 +942,78 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
/* for applications like xterm */
|
||||
return ValidateSizing (hwnd, pWin, wParam, lParam);
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
LPWINDOWPOS pwindPos = (LPWINDOWPOS) lParam;
|
||||
|
||||
/* Bail if window z order was not changed */
|
||||
if (pwindPos->flags & SWP_NOZORDER)
|
||||
break;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - hwndInsertAfter: %p\n",
|
||||
pwindPos->hwndInsertAfter);
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
if (lParam != 0)
|
||||
{
|
||||
WINDOWPOS *windowpos = (WINDOWPOS *)lParam;
|
||||
HWND hwndprev = GetNextWindow(hwnd, GW_HWNDPREV);
|
||||
HWND hwndafter = windowpos->hwndInsertAfter;
|
||||
#if CYGDEBUG
|
||||
char buffer[1024];
|
||||
char buffer2[1024];
|
||||
GetWindowText(hwndafter, buffer, sizeof(buffer));
|
||||
GetWindowText(hwndprev, buffer2, sizeof(buffer2));
|
||||
winDebug("%s - hwndInsertAfter = %x (%s), hwndPrev = %x (%s)\n",
|
||||
__FUNCTION__, hwndafter,
|
||||
(hwndafter==HWND_TOP?"HWND_TOP":
|
||||
(hwndafter==HWND_BOTTOM?"HWND_BOTTOM":
|
||||
(hwndafter==HWND_NOTOPMOST?"HWND_NOTOPMOST":
|
||||
(hwndafter==HWND_TOPMOST?"HWND_TOPMOST":
|
||||
buffer)))),
|
||||
hwndprev,
|
||||
(hwndprev==HWND_TOP?"HWND_TOP":
|
||||
(hwndprev==HWND_BOTTOM?"HWND_BOTTOM":
|
||||
(hwndprev==HWND_NOTOPMOST?"HWND_NOTOPMOST":
|
||||
(hwndprev==HWND_TOPMOST?"HWND_TOPMOST":
|
||||
buffer2)))));
|
||||
winDebug("%s - flags: %s\n", __FUNCTION__,
|
||||
(windowpos->flags & SWP_NOZORDER?"NOZORDER":""));
|
||||
|
||||
#endif
|
||||
|
||||
/* Pass the message to the root window */
|
||||
SendMessage (hwndScreen, message, wParam, lParam);
|
||||
|
||||
if (s_pScreenPriv != NULL)
|
||||
s_pScreenPriv->fWindowOrderChanged = TRUE;
|
||||
}
|
||||
return 0;
|
||||
if (windowpos->flags & SWP_NOZORDER)
|
||||
break;
|
||||
if (TRUE || hwndafter == HWND_TOP || hwndafter != hwndprev)
|
||||
{
|
||||
wmMsg.msg = WM_WM_RAISE;
|
||||
//if (fWMMsgInitialized)
|
||||
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
/*
|
||||
* Pass the message to DefWindowProc to let the function
|
||||
* break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE.
|
||||
*/
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
/* see dix/window.c */
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winTopLevelWindowProc - WM_SIZE - %d ms\n", GetTickCount ());
|
||||
#endif
|
||||
|
||||
/* Branch on type of resizing occurring */
|
||||
switch (wParam)
|
||||
{
|
||||
case SIZE_MINIMIZED:
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("\tSIZE_MINIMIZED\n");
|
||||
#endif
|
||||
if (s_pScreenPriv != NULL)
|
||||
s_pScreenPriv->fWindowOrderChanged = TRUE;
|
||||
break;
|
||||
|
||||
case SIZE_RESTORED:
|
||||
case SIZE_MAXIMIZED:
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("SIZE_RESTORED || SIZE_MAXIMIZED\n");
|
||||
#endif
|
||||
/* Break out if nothing to do */
|
||||
if (pWinPriv->iWidth == (short) LOWORD(lParam)
|
||||
&& pWinPriv->iHeight == (short) HIWORD(lParam))
|
||||
#if CYGWINDOWING_DEBUG
|
||||
{
|
||||
char buf[64];
|
||||
switch (wParam)
|
||||
{
|
||||
case SIZE_MINIMIZED:
|
||||
strcpy(buf, "SIZE_MINIMIZED");
|
||||
break;
|
||||
|
||||
/* Get the dimensions of the resized Windows window */
|
||||
pWinPriv->iWidth = (short) LOWORD(lParam);
|
||||
pWinPriv->iHeight = (short) HIWORD(lParam);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("\t(%d, %d)\n", pWinPriv->iWidth, pWinPriv->iHeight);
|
||||
case SIZE_MAXIMIZED:
|
||||
strcpy(buf, "SIZE_MAXIMIZED");
|
||||
break;
|
||||
case SIZE_RESTORED:
|
||||
strcpy(buf, "SIZE_RESTORED");
|
||||
break;
|
||||
default:
|
||||
strcpy(buf, "UNKNOWN_FLAG");
|
||||
}
|
||||
ErrorF ("winTopLevelWindowProc - WM_SIZE to %dx%d (%s) - %d ms\n",
|
||||
(int)LOWORD(lParam), (int)HIWORD(lParam), buf,
|
||||
(int)(GetTickCount ()));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we're maximizing the window has been moved to upper left
|
||||
* of current screen. Now it is safe for X to know about this.
|
||||
*/
|
||||
if (wParam == SIZE_MAXIMIZED)
|
||||
{
|
||||
POINT ptHome;
|
||||
|
||||
/* Flag that we are being maximized and store info for restore */
|
||||
pWinPriv->fNeedRestore = TRUE;
|
||||
pWinPriv->ptRestore.x = pWinPriv->iX;
|
||||
pWinPriv->ptRestore.y = pWinPriv->iY;
|
||||
|
||||
/* Get screen location of window root */
|
||||
ptHome.x = 0;
|
||||
ptHome.y = 0;
|
||||
ClientToScreen (hwnd, &ptHome);
|
||||
|
||||
/* Map from screen (-X,-Y) to (0,0) root coords */
|
||||
winMoveXWindow (pWin,
|
||||
ptHome.x - wBorderWidth (pWin)
|
||||
- GetSystemMetrics (SM_XVIRTUALSCREEN),
|
||||
ptHome.y - wBorderWidth (pWin)
|
||||
- GetSystemMetrics (SM_YVIRTUALSCREEN));
|
||||
}
|
||||
else if (wParam == SIZE_RESTORED && pWinPriv->fNeedRestore)
|
||||
{
|
||||
/* If need restore and !maximized then move to cached position */
|
||||
WINDOWPLACEMENT windPlace;
|
||||
|
||||
windPlace.length = sizeof (WINDOWPLACEMENT);
|
||||
|
||||
GetWindowPlacement (hwnd, &windPlace);
|
||||
|
||||
if (windPlace.showCmd != SW_MAXIMIZE
|
||||
&& windPlace.showCmd != SW_SHOWMAXIMIZED)
|
||||
{
|
||||
pWinPriv->fNeedRestore = FALSE;
|
||||
winMoveXWindow (pWin,
|
||||
pWinPriv->ptRestore.x - wBorderWidth (pWin)
|
||||
- GetSystemMetrics (SM_XVIRTUALSCREEN),
|
||||
pWinPriv->ptRestore.y - wBorderWidth (pWin)
|
||||
- GetSystemMetrics (SM_YVIRTUALSCREEN));
|
||||
}
|
||||
}
|
||||
|
||||
/* Perform the resize and notify the X client */
|
||||
winResizeXWindow (pWin,
|
||||
(short) LOWORD(lParam),
|
||||
(short) HIWORD(lParam));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
/* Adjust the X Window to the moved Windows window */
|
||||
winAdjustXWindow (pWin, hwnd);
|
||||
return 0; /* end of WM_SIZE handler */
|
||||
|
||||
case WM_MOUSEACTIVATE:
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
|
@ -997,6 +1033,14 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT)
|
||||
{
|
||||
if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,65 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
Bool
|
||||
|
||||
/*
|
||||
* External symbols
|
||||
*/
|
||||
|
||||
extern HWND g_hDlgExit;
|
||||
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winAllocateFBNativeGDI (ScreenPtr pScreen);
|
||||
|
||||
static void
|
||||
winShadowUpdateNativeGDI (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf);
|
||||
|
||||
static Bool
|
||||
winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInitVisualsNativeGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winAdjustVideoModeNativeGDI (ScreenPtr pScreen);
|
||||
|
||||
#if 0
|
||||
static Bool
|
||||
winBltExposedRegionsNativeGDI (ScreenPtr pScreen);
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
winActivateAppNativeGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRedrawScreenNativeGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInstallColormapNativeGDI (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winStoreColorsNativeGDI (ColormapPtr pmap,
|
||||
int ndef,
|
||||
xColorItem *pdefs);
|
||||
|
||||
static Bool
|
||||
winCreateColormapNativeGDI (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winDestroyColormapNativeGDI (ColormapPtr pColormap);
|
||||
|
||||
|
||||
|
||||
static Bool
|
||||
winAllocateFBNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
FatalError ("winAllocateFBNativeGDI\n");
|
||||
|
@ -39,11 +97,13 @@ winAllocateFBNativeGDI (ScreenPtr pScreen)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We wrap whatever CloseScreen procedure was specified by fb;
|
||||
* a pointer to said procedure is stored in our privates.
|
||||
*/
|
||||
Bool
|
||||
|
||||
static Bool
|
||||
winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -95,7 +155,7 @@ winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
winShadowUpdateNativeGDI (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf)
|
||||
{
|
||||
|
@ -104,7 +164,7 @@ winShadowUpdateNativeGDI (ScreenPtr pScreen,
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInitVisualsNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -149,7 +209,7 @@ winInitVisualsNativeGDI (ScreenPtr pScreen)
|
|||
|
||||
/* Tell the user how many bits per RGB we are using */
|
||||
ErrorF ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n",
|
||||
pScreenPriv->dwBitsPerRGB);
|
||||
(int) pScreenPriv->dwBitsPerRGB);
|
||||
|
||||
/* Create a single visual according to the Windows screen depth */
|
||||
switch (pScreenInfo->dwDepth)
|
||||
|
@ -199,7 +259,7 @@ winInitVisualsNativeGDI (ScreenPtr pScreen)
|
|||
|
||||
|
||||
/* Adjust the video mode */
|
||||
Bool
|
||||
static Bool
|
||||
winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -239,7 +299,8 @@ winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
|
|||
{
|
||||
/* No -depth parameter passed, let the user know the depth being used */
|
||||
ErrorF ("winAdjustVideoModeNativeGDI - Using Windows display "
|
||||
"depth of %d bits per pixel, %d depth\n", dwBPP, pScreenInfo->dwDepth);
|
||||
"depth of %d bits per pixel, %d depth\n",
|
||||
(int) dwBPP, (int) pScreenInfo->dwDepth);
|
||||
|
||||
/* Use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -248,7 +309,8 @@ winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
|
|||
{
|
||||
/* Warn user if GDI depth is different than -depth parameter */
|
||||
ErrorF ("winAdjustVideoModeNativeGDI - Command line bpp: %d, "\
|
||||
"using bpp: %d\n", pScreenInfo->dwBPP, dwBPP);
|
||||
"using bpp: %d\n",
|
||||
(int) pScreenInfo->dwBPP, (int) dwBPP);
|
||||
|
||||
/* We'll use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -261,7 +323,7 @@ winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winActivateAppNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -380,15 +442,17 @@ winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
#if 0
|
||||
static Bool
|
||||
winBltExposedRegionsNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRedrawScreenNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
FatalError ("winRedrawScreenNativeGDI\n");
|
||||
|
@ -396,7 +460,7 @@ winRedrawScreenNativeGDI (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen)
|
||||
{
|
||||
FatalError ("winRealizeInstalledPaletteNativeGDI\n");
|
||||
|
@ -404,7 +468,7 @@ winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInstallColormapNativeGDI (ColormapPtr pColormap)
|
||||
{
|
||||
FatalError ("winInstallColormapNativeGDI\n");
|
||||
|
@ -412,7 +476,7 @@ winInstallColormapNativeGDI (ColormapPtr pColormap)
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winStoreColorsNativeGDI (ColormapPtr pmap,
|
||||
int ndef,
|
||||
xColorItem *pdefs)
|
||||
|
@ -422,7 +486,7 @@ winStoreColorsNativeGDI (ColormapPtr pmap,
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCreateColormapNativeGDI (ColormapPtr pColormap)
|
||||
{
|
||||
FatalError ("winCreateColormapNativeGDI\n");
|
||||
|
@ -430,7 +494,7 @@ winCreateColormapNativeGDI (ColormapPtr pColormap)
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winDestroyColormapNativeGDI (ColormapPtr pColormap)
|
||||
{
|
||||
FatalError ("winDestroyColormapNativeGDI\n");
|
||||
|
@ -474,7 +538,7 @@ winSetEngineFunctionsNativeGDI (ScreenPtr pScreen)
|
|||
pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
|
||||
pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
|
||||
pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -36,17 +36,41 @@
|
|||
|
||||
|
||||
/*
|
||||
* External global variables
|
||||
* External symbols
|
||||
*/
|
||||
|
||||
extern const GUID _IID_IDirectDraw2;
|
||||
extern const GUID _IID_IDirectDraw2;
|
||||
extern HWND g_hDlgExit;
|
||||
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winAllocateFBPrimaryDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInitVisualsPrimaryDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winAdjustVideoModePrimaryDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winActivateAppPrimaryDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winHotKeyAltTabPrimaryDD (ScreenPtr pScreen);
|
||||
|
||||
|
||||
/*
|
||||
* Create a DirectDraw primary surface
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAllocateFBPrimaryDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -77,7 +101,7 @@ winAllocateFBPrimaryDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -131,7 +155,7 @@ winAllocateFBPrimaryDD (ScreenPtr pScreen)
|
|||
NULL);
|
||||
if (FAILED (ddrval))
|
||||
FatalError ("winAllocateFBPrimaryDD - Could not create primary "
|
||||
"surface %08x\n", ddrval);
|
||||
"surface %08x\n", (unsigned int) ddrval);
|
||||
|
||||
ErrorF ("winAllocateFBPrimaryDD - Created primary\n");
|
||||
|
||||
|
@ -222,7 +246,7 @@ winAllocateFBPrimaryDD (ScreenPtr pScreen)
|
|||
* Free our resources and private structures.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -305,7 +329,7 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
|
|||
* to verify that last sentence.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInitVisualsPrimaryDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -326,10 +350,10 @@ winInitVisualsPrimaryDD (ScreenPtr pScreen)
|
|||
pScreenPriv->dwBitsPerRGB = dwBlueBits;
|
||||
|
||||
ErrorF ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
|
||||
pScreenPriv->dwRedMask,
|
||||
pScreenPriv->dwGreenMask,
|
||||
pScreenPriv->dwBlueMask,
|
||||
pScreenPriv->dwBitsPerRGB);
|
||||
(unsigned int) pScreenPriv->dwRedMask,
|
||||
(unsigned int) pScreenPriv->dwGreenMask,
|
||||
(unsigned int) pScreenPriv->dwBlueMask,
|
||||
(int) pScreenPriv->dwBitsPerRGB);
|
||||
|
||||
/* Create a single visual according to the Windows screen depth */
|
||||
switch (pScreenInfo->dwDepth)
|
||||
|
@ -353,7 +377,7 @@ winInitVisualsPrimaryDD (ScreenPtr pScreen)
|
|||
|
||||
case 8:
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
|
||||
winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
|
||||
#endif /* CYGDEBUG */
|
||||
if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
|
||||
PseudoColorMask,
|
||||
|
@ -368,7 +392,7 @@ winInitVisualsPrimaryDD (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInitVisualsPrimaryDD - Returned from "
|
||||
winDebug ("winInitVisualsPrimaryDD - Returned from "
|
||||
"miSetVisualTypesAndMasks\n");
|
||||
#endif /* CYGDEBUG */
|
||||
break;
|
||||
|
@ -384,7 +408,7 @@ winInitVisualsPrimaryDD (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -408,7 +432,7 @@ winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
|
|||
{
|
||||
/* No -depth parameter passed, let the user know the depth being used */
|
||||
ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display "
|
||||
"depth of %d bits per pixel\n", dwBPP);
|
||||
"depth of %d bits per pixel\n", (int) dwBPP);
|
||||
|
||||
/* Use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -418,14 +442,14 @@ winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
|
|||
{
|
||||
/* FullScreen, and GDI depth differs from -depth parameter */
|
||||
ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command "
|
||||
"line depth: %d\n", pScreenInfo->dwBPP);
|
||||
"line depth: %d\n", (int) pScreenInfo->dwBPP);
|
||||
}
|
||||
else if (dwBPP != pScreenInfo->dwBPP)
|
||||
{
|
||||
/* Windowed, and GDI depth differs from -depth parameter */
|
||||
ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line "
|
||||
"depth: %d, using depth: %d\n",
|
||||
pScreenInfo->dwBPP, dwBPP);
|
||||
(int) pScreenInfo->dwBPP, (int) dwBPP);
|
||||
|
||||
/* We'll use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -444,7 +468,7 @@ winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
|
|||
* the fb code back to the primary surface memory.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winActivateAppPrimaryDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -498,7 +522,7 @@ winActivateAppPrimaryDD (ScreenPtr pScreen)
|
|||
NULL);
|
||||
if (ddrval != DD_OK)
|
||||
FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen "
|
||||
"surface to primary surface %08x\n", ddrval);
|
||||
"surface to primary surface %08x\n", (unsigned int) ddrval);
|
||||
|
||||
/* Lock the primary surface */
|
||||
ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
|
||||
|
@ -533,7 +557,7 @@ winActivateAppPrimaryDD (ScreenPtr pScreen)
|
|||
* fb for the duration of the deactivation.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winHotKeyAltTabPrimaryDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -596,12 +620,12 @@ winHotKeyAltTabPrimaryDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary "
|
||||
"surface to offscreen surface: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from "
|
||||
"Blt: %08dx\n", ddrval);
|
||||
"Blt: %08dx\n", (unsigned int) ddrval);
|
||||
}
|
||||
|
||||
/* Lock the offscreen surface */
|
||||
|
@ -636,7 +660,7 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
|
|||
/* Set our pointers */
|
||||
pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
|
||||
pScreenPriv->pwinShadowUpdate
|
||||
= (winShadowUpdateProcPtr) (void (*)())NoopDDA;
|
||||
= (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
|
||||
pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
|
||||
pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
|
||||
pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
|
||||
|
@ -646,9 +670,13 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
|
|||
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
|
||||
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
|
||||
pScreenPriv->pwinBltExposedRegions
|
||||
= (winBltExposedRegionsProcPtr) (void (*)())NoopDDA;
|
||||
= (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
|
||||
pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
|
||||
pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
pScreenPriv->pwinFinishCreateWindowsWindow =
|
||||
(winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,31 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern int g_iPixmapPrivateIndex;
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static void
|
||||
winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw);
|
||||
|
||||
static void
|
||||
winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh);
|
||||
|
||||
static void
|
||||
winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
|
||||
int xrot, int yrot);
|
||||
#endif
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 34 */
|
||||
/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
|
||||
PixmapPtr
|
||||
|
@ -51,7 +76,7 @@ winCreatePixmapNativeGDI (ScreenPtr pScreen,
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreatePixmap () - w %d h %d d %d bw %d\n",
|
||||
winDebug ("winCreatePixmap () - w %d h %d d %d bw %d\n",
|
||||
iWidth, iHeight, iDepth,
|
||||
PixmapBytePad (iWidth, iDepth));
|
||||
#endif
|
||||
|
@ -94,7 +119,7 @@ winCreatePixmapNativeGDI (ScreenPtr pScreen,
|
|||
(BITMAPINFO **) &pPixmapPriv->pbmih);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
|
||||
winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
|
||||
"screen: %08x\n",
|
||||
pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
|
||||
#endif
|
||||
|
@ -115,7 +140,7 @@ winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
|
|||
winPrivPixmapPtr pPixmapPriv = NULL;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyPixmapNativeGDI ()\n");
|
||||
winDebug ("winDestroyPixmapNativeGDI ()\n");
|
||||
#endif
|
||||
|
||||
/* Bail early if there is not a pixmap to destroy */
|
||||
|
@ -129,7 +154,7 @@ winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
|
|||
pPixmapPriv = winGetPixmapPriv (pPixmap);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
|
||||
winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
|
||||
pPixmapPriv->hBitmap);
|
||||
#endif
|
||||
|
||||
|
@ -173,12 +198,13 @@ winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not used yet.
|
||||
* See cfb/cfbpixmap.c
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw)
|
||||
{
|
||||
ErrorF ("winXRotatePixmap()\n");
|
||||
|
@ -190,7 +216,7 @@ winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw)
|
|||
* Not used yet.
|
||||
* See cfb/cfbpixmap.c
|
||||
*/
|
||||
void
|
||||
static void
|
||||
winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh)
|
||||
{
|
||||
ErrorF ("winYRotatePixmap()\n");
|
||||
|
@ -203,10 +229,11 @@ winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh)
|
|||
* See cfb/cfbpixmap.c
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
|
||||
int xrot, int yrot)
|
||||
{
|
||||
ErrorF ("winCopyRotatePixmap()\n");
|
||||
/* fill in this function, look at CFB */
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,19 +15,18 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winpntwin.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,19 +15,18 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winpolyline.c,v 1.3 2001/09/13 08:25:45 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
/* Fixups to prevent collisions between Windows and X headers */
|
||||
#define ATOM DWORD
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "winprefs.h"
|
||||
#include "winmultiwindowclass.h"
|
||||
|
@ -44,14 +45,20 @@
|
|||
/* Where will the custom menu commands start counting from? */
|
||||
#define STARTMENUID WM_USER
|
||||
|
||||
/* External global variables */
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
extern DWORD g_dwCurrentThreadID;
|
||||
#endif
|
||||
|
||||
/* From winmultiwindowflex.l, the real parser */
|
||||
extern void parse_file (FILE *fp);
|
||||
|
||||
/* From winmultiwindowyacc.y, the pref structure loaded by the parser */
|
||||
extern WINMULTIWINDOWPREFS pref;
|
||||
/* From winprefyacc.y, the pref structure loaded by the parser */
|
||||
extern WINPREFS pref;
|
||||
|
||||
/* The global X default icon */
|
||||
extern HICON g_hiconX;
|
||||
extern HICON g_hIconX;
|
||||
extern HICON g_hSmallIconX;
|
||||
|
||||
/* Currently in use command ID, incremented each new menu item created */
|
||||
static int g_cmdid = STARTMENUID;
|
||||
|
@ -60,6 +67,11 @@ static int g_cmdid = STARTMENUID;
|
|||
/* Defined in DIX */
|
||||
extern char *display;
|
||||
|
||||
/* Local function to handle comma-ified icon names */
|
||||
static HICON
|
||||
LoadImageComma (char *fname, int sx, int sy, int flags);
|
||||
|
||||
|
||||
/*
|
||||
* Creates or appends a menu from a MENUPARSED structure
|
||||
*/
|
||||
|
@ -71,7 +83,7 @@ MakeMenu (char *name,
|
|||
int i;
|
||||
int item;
|
||||
MENUPARSED *m;
|
||||
HMENU hmenu;
|
||||
HMENU hmenu, hsub;
|
||||
|
||||
for (i=0; i<pref.menuItems; i++)
|
||||
{
|
||||
|
@ -96,6 +108,11 @@ MakeMenu (char *name,
|
|||
else
|
||||
{
|
||||
hmenu = CreatePopupMenu();
|
||||
if (!hmenu)
|
||||
{
|
||||
ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name);
|
||||
return NULL;
|
||||
}
|
||||
item = 0;
|
||||
}
|
||||
|
||||
|
@ -128,11 +145,13 @@ MakeMenu (char *name,
|
|||
|
||||
case CMD_MENU:
|
||||
/* Recursive! */
|
||||
InsertMenu (hmenu,
|
||||
item,
|
||||
MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING,
|
||||
(UINT_PTR)MakeMenu (m->menuItem[i].param, 0, 0),
|
||||
m->menuItem[i].text);
|
||||
hsub = MakeMenu (m->menuItem[i].param, 0, 0);
|
||||
if (hsub)
|
||||
InsertMenu (hmenu,
|
||||
item,
|
||||
MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING,
|
||||
(UINT_PTR)hsub,
|
||||
m->menuItem[i].text);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -145,6 +164,7 @@ MakeMenu (char *name,
|
|||
}
|
||||
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/*
|
||||
* Callback routine that is executed once per window class.
|
||||
* Removes or creates custom window settings depending on LPARAM
|
||||
|
@ -152,16 +172,14 @@ MakeMenu (char *name,
|
|||
static BOOL CALLBACK
|
||||
ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
char szClassName[1024];
|
||||
HICON hicon;
|
||||
Window wid;
|
||||
|
||||
if (!GetClassName (hwnd, szClassName, 1024))
|
||||
return TRUE;
|
||||
if (!hwnd) {
|
||||
ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strncmp (szClassName, WINDOW_CLASS_X, strlen (WINDOW_CLASS_X)))
|
||||
/* Not one of our windows... */
|
||||
return TRUE;
|
||||
|
||||
/* It's our baby, either clean or dirty it */
|
||||
if (lParam==FALSE)
|
||||
{
|
||||
|
@ -171,8 +189,15 @@ ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
|
|||
SetClassLong (hwnd, GCL_HICON, (LONG)LoadIcon (NULL, IDI_APPLICATION));
|
||||
|
||||
/* If it's generated on-the-fly, get rid of it, will regen */
|
||||
if (!winIconIsOverride((unsigned long)hicon) && hicon!=g_hiconX)
|
||||
DestroyIcon (hicon);
|
||||
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 */
|
||||
winDestroyIcon (hicon);
|
||||
|
||||
/* Remove any menu additions, use bRevert flag */
|
||||
GetSystemMenu (hwnd, TRUE);
|
||||
|
@ -181,9 +206,12 @@ ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Make the icon default, dynamic, of from xwinrc */
|
||||
SetClassLong (hwnd, GCL_HICON, (LONG)g_hiconX);
|
||||
winUpdateIcon ((Window)GetProp (hwnd, WIN_WID_PROP));
|
||||
/* Make the icon default, dynamic, or from xwinrc */
|
||||
SetClassLong (hwnd, GCL_HICON, (LONG)g_hIconX);
|
||||
SetClassLong (hwnd, GCL_HICONSM, (LONG)g_hSmallIconX);
|
||||
wid = (Window)GetProp (hwnd, WIN_WID_PROP);
|
||||
if (wid)
|
||||
winUpdateIcon (wid);
|
||||
/* Update the system menu for this window */
|
||||
SetupSysMenu ((unsigned long)hwnd);
|
||||
|
||||
|
@ -192,6 +220,7 @@ ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -201,13 +230,15 @@ ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
|
|||
* Set custom icons and menus again.
|
||||
*/
|
||||
static void
|
||||
ReloadPrefs ()
|
||||
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 */
|
||||
EnumWindows (ReloadEnumWindowsProc, FALSE);
|
||||
EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
|
||||
#endif
|
||||
|
||||
/* Now, free/clear all info from our prefs structure */
|
||||
for (i=0; i<pref.menuItems; i++)
|
||||
|
@ -226,6 +257,7 @@ ReloadPrefs ()
|
|||
|
||||
pref.iconDirectory[0] = 0;
|
||||
pref.defaultIconName[0] = 0;
|
||||
pref.trayIconName[0] = 0;
|
||||
|
||||
for (i=0; i<pref.iconItems; i++)
|
||||
if (pref.icon[i].hicon)
|
||||
|
@ -235,7 +267,10 @@ ReloadPrefs ()
|
|||
pref.iconItems = 0;
|
||||
|
||||
/* Free global default X icon */
|
||||
DestroyIcon (g_hiconX);
|
||||
if (g_hIconX)
|
||||
DestroyIcon (g_hIconX);
|
||||
if (g_hSmallIconX)
|
||||
DestroyIcon (g_hSmallIconX);
|
||||
|
||||
/* Reset the custom command IDs */
|
||||
g_cmdid = STARTMENUID;
|
||||
|
@ -243,13 +278,15 @@ ReloadPrefs ()
|
|||
/* Load the updated resource file */
|
||||
LoadPreferences();
|
||||
|
||||
/* Define global icon, load it */
|
||||
g_hiconX = (HICON)winOverrideDefaultIcon();
|
||||
if (!g_hiconX)
|
||||
g_hiconX = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
|
||||
g_hIconX = NULL;
|
||||
g_hSmallIconX = NULL;
|
||||
|
||||
winInitGlobalIcons();
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Rebuild the icons and menus */
|
||||
EnumWindows (ReloadEnumWindowsProc, TRUE);
|
||||
EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
|
||||
#endif
|
||||
|
||||
/* Whew, done */
|
||||
}
|
||||
|
@ -284,9 +321,10 @@ HandleCustomWM_INITMENU(unsigned long hwndIn,
|
|||
}
|
||||
|
||||
/*
|
||||
* Searches for the custom WM_COMMAND command ID and performs action
|
||||
* Searches for the custom WM_COMMAND command ID and performs action.
|
||||
* Return TRUE if command is proccessed, FALSE otherwise.
|
||||
*/
|
||||
int
|
||||
Bool
|
||||
HandleCustomWM_COMMAND (unsigned long hwndIn,
|
||||
int command)
|
||||
{
|
||||
|
@ -298,7 +336,7 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
|
|||
hwnd = (HWND)hwndIn;
|
||||
|
||||
if (!command)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
for (i=0; i<pref.menuItems; i++)
|
||||
{
|
||||
|
@ -332,12 +370,12 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
|
|||
exit (0);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CMD_ALWAYSONTOP:
|
||||
if (!hwnd)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
/* Get extended window style */
|
||||
dwExStyle = GetWindowLong (hwnd, GWL_EXSTYLE);
|
||||
|
@ -355,23 +393,28 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
|
|||
0, 0,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE);
|
||||
return 0;
|
||||
#if XWIN_MULTIWINDOW
|
||||
/* Reflect the changed Z order */
|
||||
winReorderWindowsMultiWindow ();
|
||||
#endif
|
||||
return TRUE;
|
||||
|
||||
case CMD_RELOAD:
|
||||
ReloadPrefs();
|
||||
return 0;
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
} /* match */
|
||||
} /* for j */
|
||||
} /* for i */
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/*
|
||||
* Add the default or a custom menu depending on the class match
|
||||
*/
|
||||
|
@ -428,6 +471,7 @@ SetupSysMenu (unsigned long hwndIn)
|
|||
MakeMenu (pref.defaultSysMenuName, sys, -1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -453,28 +497,16 @@ SetupRootMenu (unsigned long hmenuRoot)
|
|||
* Check for and return an overridden default ICON specified in the prefs
|
||||
*/
|
||||
unsigned long
|
||||
winOverrideDefaultIcon()
|
||||
winOverrideDefaultIcon(int size)
|
||||
{
|
||||
HICON hicon;
|
||||
char fname[PATH_MAX+NAME_MAX+2];
|
||||
|
||||
if (pref.defaultIconName[0])
|
||||
{
|
||||
/* Make sure we have a dir with trailing backslash */
|
||||
/* Note we are using _Windows_ paths here, not cygwin */
|
||||
strcpy (fname, pref.iconDirectory);
|
||||
if (pref.iconDirectory[0])
|
||||
if (fname[strlen(fname)-1]!='\\')
|
||||
strcat (fname, "\\");
|
||||
strcat (fname, pref.defaultIconName);
|
||||
|
||||
hicon = (HICON)LoadImage(NULL,
|
||||
fname,
|
||||
IMAGE_ICON,
|
||||
0, 0,
|
||||
LR_DEFAULTSIZE|LR_LOADFROMFILE);
|
||||
hicon = LoadImageComma (pref.defaultIconName, size, size, 0);
|
||||
if (hicon==NULL)
|
||||
ErrorF ("winOverrideDefaultIcon: LoadIcon(%s) failed\n", fname);
|
||||
ErrorF ("winOverrideDefaultIcon: LoadImageComma(%s) failed\n",
|
||||
pref.defaultIconName);
|
||||
|
||||
return (unsigned long)hicon;
|
||||
}
|
||||
|
@ -483,6 +515,104 @@ winOverrideDefaultIcon()
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return the HICON to use in the taskbar notification area
|
||||
*/
|
||||
unsigned long
|
||||
winTaskbarIcon(void)
|
||||
{
|
||||
HICON hicon;
|
||||
|
||||
hicon = 0;
|
||||
/* First try and load an overridden, if success then return it */
|
||||
if (pref.trayIconName[0])
|
||||
{
|
||||
hicon = LoadImageComma (pref.trayIconName,
|
||||
GetSystemMetrics (SM_CXSMICON),
|
||||
GetSystemMetrics (SM_CYSMICON),
|
||||
0 );
|
||||
}
|
||||
|
||||
/* Otherwise return the default */
|
||||
if (!hicon)
|
||||
hicon = (HICON) LoadImage (g_hInstance,
|
||||
MAKEINTRESOURCE(IDI_XWIN),
|
||||
IMAGE_ICON,
|
||||
GetSystemMetrics (SM_CXSMICON),
|
||||
GetSystemMetrics (SM_CYSMICON),
|
||||
0);
|
||||
|
||||
return (unsigned long)hicon;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse a filename to extract an icon:
|
||||
* If fname is exactly ",nnn" then extract icon from our resource
|
||||
* else if it is "file,nnn" then extract icon nnn from that file
|
||||
* else try to load it as an .ico file and if that fails return NULL
|
||||
*/
|
||||
static HICON
|
||||
LoadImageComma (char *fname, int sx, int sy, int flags)
|
||||
{
|
||||
HICON hicon;
|
||||
int index;
|
||||
char file[PATH_MAX+NAME_MAX+2];
|
||||
|
||||
/* Some input error checking */
|
||||
if (!fname || !fname[0])
|
||||
return NULL;
|
||||
|
||||
index = 0;
|
||||
hicon = NULL;
|
||||
|
||||
if (fname[0]==',')
|
||||
{
|
||||
/* It's the XWIN.EXE resource they want */
|
||||
index = atoi (fname+1);
|
||||
hicon = LoadImage (g_hInstance,
|
||||
MAKEINTRESOURCE(index),
|
||||
IMAGE_ICON,
|
||||
sx,
|
||||
sy,
|
||||
flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
file[0] = 0;
|
||||
/* Prepend path if not given a "X:\" filename */
|
||||
if ( !(fname[0] && fname[1]==':' && fname[2]=='\\') )
|
||||
{
|
||||
strcpy (file, pref.iconDirectory);
|
||||
if (pref.iconDirectory[0])
|
||||
if (fname[strlen(fname)-1]!='\\')
|
||||
strcat (file, "\\");
|
||||
}
|
||||
strcat (file, fname);
|
||||
|
||||
if (strrchr (file, ','))
|
||||
{
|
||||
/* Specified as <fname>,<index> */
|
||||
|
||||
*(strrchr (file, ',')) = 0; /* End string at comma */
|
||||
index = atoi (strrchr (fname, ',') + 1);
|
||||
hicon = ExtractIcon (g_hInstance, file, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just an .ico file... */
|
||||
|
||||
hicon = (HICON)LoadImage (NULL,
|
||||
file,
|
||||
IMAGE_ICON,
|
||||
sx,
|
||||
sy,
|
||||
LR_LOADFROMFILE|flags);
|
||||
}
|
||||
}
|
||||
return hicon;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -494,7 +624,6 @@ winOverrideIcon (unsigned long longWin)
|
|||
char *res_name, *res_class;
|
||||
int i;
|
||||
HICON hicon;
|
||||
char fname[PATH_MAX+NAME_MAX+2];
|
||||
char *wmName;
|
||||
|
||||
if (pWin==NULL)
|
||||
|
@ -519,21 +648,10 @@ winOverrideIcon (unsigned long longWin)
|
|||
if (pref.icon[i].hicon)
|
||||
return pref.icon[i].hicon;
|
||||
|
||||
/* Make sure we have a dir with trailing backslash */
|
||||
/* Note we are using _Windows_ paths here, not cygwin */
|
||||
strcpy (fname, pref.iconDirectory);
|
||||
if (pref.iconDirectory[0])
|
||||
if (fname[strlen(fname)-1]!='\\')
|
||||
strcat (fname, "\\");
|
||||
strcat (fname, pref.icon[i].iconFile);
|
||||
|
||||
hicon = (HICON)LoadImage(NULL,
|
||||
fname,
|
||||
IMAGE_ICON,
|
||||
0, 0,
|
||||
LR_DEFAULTSIZE|LR_LOADFROMFILE);
|
||||
if (hicon==NULL)
|
||||
ErrorF ("winOverrideIcon: LoadIcon(%s) failed\n", fname);
|
||||
hicon = LoadImageComma (pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE);
|
||||
if (hicon==NULL)
|
||||
ErrorF ("winOverrideIcon: LoadImageComma(%s) failed\n",
|
||||
pref.icon[i].iconFile);
|
||||
|
||||
pref.icon[i].hicon = (unsigned long)hicon;
|
||||
return (unsigned long)hicon;
|
||||
|
@ -604,11 +722,18 @@ LoadPreferences ()
|
|||
strcat (fname, ".XWinrc");
|
||||
|
||||
prefFile = fopen (fname, "r");
|
||||
if (prefFile)
|
||||
ErrorF ("winPrefsLoadPreferences: %s\n", fname);
|
||||
}
|
||||
|
||||
/* No home file found, check system default */
|
||||
if (!prefFile)
|
||||
prefFile = fopen (PROJECTROOT"/lib/X11/system.XWinrc", "r");
|
||||
{
|
||||
prefFile = fopen (PROJECTROOT"/lib/X11/system.XWinrc", "r");
|
||||
if (prefFile)
|
||||
ErrorF ("winPrefsLoadPreferences: %s\n",
|
||||
PROJECTROOT"/lib/X11/system.XWinrc");
|
||||
}
|
||||
|
||||
/* If we could open it, then read the settings and close it */
|
||||
if (prefFile)
|
||||
|
@ -658,4 +783,3 @@ LoadPreferences ()
|
|||
} /* for all menus */
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#if !defined(WINPREFS_H)
|
||||
#define WINPREFS_H
|
||||
/*
|
||||
* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
@ -29,6 +31,11 @@
|
|||
*/
|
||||
/* $XFree86: $ */
|
||||
|
||||
/* Need Bool */
|
||||
#include "Xdefs.h"
|
||||
/* Need TURE */
|
||||
#include "misc.h"
|
||||
|
||||
/* Need to know how long paths can be... */
|
||||
#include <limits.h>
|
||||
|
||||
|
@ -36,7 +43,7 @@
|
|||
#define NAME_MAX PATH_MAX
|
||||
#endif
|
||||
#define MENU_MAX 128 /* Maximum string length of a menu name or item */
|
||||
#define PARAM_MAX (4*PATH_MAX) /* Maximim length of a parameter to a MENU */
|
||||
#define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */
|
||||
|
||||
|
||||
/* Supported commands in a MENU {} statement */
|
||||
|
@ -89,7 +96,7 @@ typedef struct ICONITEM
|
|||
unsigned long hicon; /* LoadImage() result */
|
||||
} ICONITEM;
|
||||
|
||||
typedef struct WINMULTIWINDOWPREFS
|
||||
typedef struct WINPREFS
|
||||
{
|
||||
/* Menu information */
|
||||
MENUPARSED *menu; /* Array of created menus */
|
||||
|
@ -109,18 +116,22 @@ typedef struct WINMULTIWINDOWPREFS
|
|||
/* Icon information */
|
||||
char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */
|
||||
char defaultIconName[NAME_MAX+1]; /* Replacement for x.ico */
|
||||
char trayIconName[NAME_MAX+1]; /* Replacement for tray icon */
|
||||
|
||||
ICONITEM *icon;
|
||||
int iconItems;
|
||||
|
||||
} WINMULTIWINDOWPREFS;
|
||||
/* Silent exit flag */
|
||||
Bool fSilentExit;
|
||||
|
||||
} WINPREFS;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Functions */
|
||||
void
|
||||
LoadPreferences();
|
||||
LoadPreferences(void);
|
||||
|
||||
void
|
||||
SetupRootMenu (unsigned long hmenuRoot);
|
||||
|
@ -132,7 +143,7 @@ void
|
|||
HandleCustomWM_INITMENU(unsigned long hwndIn,
|
||||
unsigned long hmenuIn);
|
||||
|
||||
int
|
||||
Bool
|
||||
HandleCustomWM_COMMAND (unsigned long hwndIn,
|
||||
int command);
|
||||
|
||||
|
@ -143,5 +154,8 @@ unsigned long
|
|||
winOverrideIcon (unsigned long longpWin);
|
||||
|
||||
unsigned long
|
||||
winOverrideDefaultIcon();
|
||||
winTaskbarIcon(void);
|
||||
|
||||
unsigned long
|
||||
winOverrideDefaultIcon(int size);
|
||||
#endif
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
extern YYSTYPE yylval;
|
||||
extern char *yytext;
|
||||
extern int yyparse();
|
||||
extern int yyparse(void);
|
||||
|
||||
extern void ErrorF (const char* /*f*/, ...);
|
||||
|
||||
|
@ -62,31 +62,33 @@ static char *makestr(char *str)
|
|||
%option yylineno
|
||||
|
||||
%%
|
||||
\#.*[\r\n] { /* comment */ return NEWLINE; }
|
||||
\/\/.*[\r\n] { /* comment */ return NEWLINE; }
|
||||
[\r\n] { return NEWLINE; }
|
||||
[ \t]+ { /* ignore whitespace */ }
|
||||
[mM][eE][nN][uU] { return MENU; }
|
||||
[iI][cC][oO][nN][dD][iI][rR][eE][cC][tT][oO][rR][yY] { return ICONDIRECTORY; }
|
||||
[dD][eE][fF][aA][uU][lL][tT][iI][cC][oO][nN] { return DEFAULTICON; }
|
||||
[iI][cC][oO][nN][sS] { return ICONS; }
|
||||
[rR][oO][oO][tT][mM][eE][nN][uU] { return ROOTMENU; }
|
||||
[dD][eE][fF][aA][uU][lL][tT][sS][yY][sS][mM][eE][nN][uU] { return DEFAULTSYSMENU; }
|
||||
[sS][yY][sS][mM][eE][nN][uU] { return SYSMENU; }
|
||||
[sS][eE][pP][aA][rR][aA][tT][oO][rR] { return SEPARATOR; }
|
||||
[aA][tT][sS][tT][aA][rR][tT] { return ATSTART; }
|
||||
[aA][tT][eE][nN][dD] { return ATEND; }
|
||||
[eE][xX][eE][cC] { return EXEC; }
|
||||
[aA][lL][wW][aA][yY][sS][oO][nN][tT][oO][pP] { return ALWAYSONTOP; }
|
||||
[dD][eE][bB][uU][gG] { return DEBUG; }
|
||||
[rR][eE][lL][oO][aA][dD] { return RELOAD; }
|
||||
"{" { return LB; }
|
||||
"}" { return RB; }
|
||||
"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
|
||||
yylval.sVal[strlen(yylval.sVal)-1] = 0; \
|
||||
return STRING; }
|
||||
[^ \t\r\n]+ { yylval.sVal = makestr(yytext); \
|
||||
return STRING; }
|
||||
\#.*[\r\n] { /* comment */ return NEWLINE; }
|
||||
\/\/.*[\r\n] { /* comment */ return NEWLINE; }
|
||||
[\r\n] { return NEWLINE; }
|
||||
[ \t]+ { /* ignore whitespace */ }
|
||||
MENU { return MENU; }
|
||||
ICONDIRECTORY { return ICONDIRECTORY; }
|
||||
DEFAULTICON { return DEFAULTICON; }
|
||||
ICONS { return ICONS; }
|
||||
ROOTMENU { return ROOTMENU; }
|
||||
DEFAULTSYSMENU { return DEFAULTSYSMENU; }
|
||||
SYSMENU { return SYSMENU; }
|
||||
SEPARATOR { return SEPARATOR; }
|
||||
ATSTART { return ATSTART; }
|
||||
ATEND { return ATEND; }
|
||||
EXEC { return EXEC; }
|
||||
ALWAYSONTOP { return ALWAYSONTOP; }
|
||||
DEBUG { return DEBUG; }
|
||||
RELOAD { return RELOAD; }
|
||||
TRAYICON { return TRAYICON; }
|
||||
SILENTEXIT { return SILENTEXIT; }
|
||||
"{" { return LB; }
|
||||
"}" { return RB; }
|
||||
"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
|
||||
yylval.sVal[strlen(yylval.sVal)-1] = 0; \
|
||||
return STRING; }
|
||||
[^ \t\r\n]+ { yylval.sVal = makestr(yytext); \
|
||||
return STRING; }
|
||||
%%
|
||||
|
||||
/*
|
||||
|
@ -111,3 +113,4 @@ parse_file (FILE *file)
|
|||
yyin = file;
|
||||
yyparse ();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define YYERROR_VERBOSE 1
|
||||
|
||||
/* The global pref settings */
|
||||
WINMULTIWINDOWPREFS pref;
|
||||
WINPREFS pref;
|
||||
|
||||
/* The working menu */
|
||||
static MENUPARSED menu;
|
||||
|
@ -51,24 +51,25 @@ static void SetIconDirectory (char *path);
|
|||
static void SetDefaultIcon (char *fname);
|
||||
static void SetRootMenu (char *menu);
|
||||
static void SetDefaultSysMenu (char *menu, int pos);
|
||||
static void SetTrayIcon (char *fname);
|
||||
|
||||
static void OpenMenu(char *menuname);
|
||||
static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
|
||||
static void CloseMenu();
|
||||
static void CloseMenu(void);
|
||||
|
||||
static void OpenIcons();
|
||||
static void OpenIcons(void);
|
||||
static void AddIconLine(char *matchstr, char *iconfile);
|
||||
static void CloseIcons();
|
||||
static void CloseIcons(void);
|
||||
|
||||
static void OpenSysMenu();
|
||||
static void OpenSysMenu(void);
|
||||
static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
|
||||
static void CloseSysMenu();
|
||||
static void CloseSysMenu(void);
|
||||
|
||||
static int yyerror (char *s);
|
||||
|
||||
extern void ErrorF (const char* /*f*/, ...);
|
||||
extern char *yytext;
|
||||
extern int yylex();
|
||||
extern int yylex(void);
|
||||
|
||||
%}
|
||||
|
||||
|
@ -79,7 +80,7 @@ extern int yylex();
|
|||
|
||||
%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU
|
||||
%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
|
||||
%token RELOAD
|
||||
%token RELOAD TRAYICON SILENTEXIT
|
||||
|
||||
%token <sVal> STRING
|
||||
%type <iVal> atspot
|
||||
|
@ -107,6 +108,11 @@ command: defaulticon
|
|||
| rootmenu
|
||||
| defaultsysmenu
|
||||
| debug
|
||||
| trayicon
|
||||
| silentexit
|
||||
;
|
||||
|
||||
trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
|
||||
;
|
||||
|
||||
rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
|
||||
|
@ -160,6 +166,9 @@ sysmenulist: sysmenuline
|
|||
sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
|
||||
;
|
||||
|
||||
silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
|
||||
;
|
||||
|
||||
debug: DEBUG STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
|
||||
;
|
||||
|
||||
|
@ -192,6 +201,13 @@ SetDefaultIcon (char *fname)
|
|||
pref.defaultIconName[NAME_MAX] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SetTrayIcon (char *fname)
|
||||
{
|
||||
strncpy (pref.trayIconName, fname, NAME_MAX);
|
||||
pref.trayIconName[NAME_MAX] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SetRootMenu (char *menu)
|
||||
{
|
||||
|
@ -240,7 +256,7 @@ AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
|
|||
}
|
||||
|
||||
static void
|
||||
CloseMenu ()
|
||||
CloseMenu (void)
|
||||
{
|
||||
if (menu.menuItem==NULL || menu.menuItems==0)
|
||||
{
|
||||
|
@ -261,7 +277,7 @@ CloseMenu ()
|
|||
}
|
||||
|
||||
static void
|
||||
OpenIcons ()
|
||||
OpenIcons (void)
|
||||
{
|
||||
if (pref.icon != NULL) {
|
||||
ErrorF("LoadPreferences: Redefining icon mappings\n");
|
||||
|
@ -292,12 +308,12 @@ AddIconLine (char *matchstr, char *iconfile)
|
|||
}
|
||||
|
||||
static void
|
||||
CloseIcons ()
|
||||
CloseIcons (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
OpenSysMenu ()
|
||||
OpenSysMenu (void)
|
||||
{
|
||||
if (pref.sysMenu != NULL) {
|
||||
ErrorF("LoadPreferences: Redefining system menu\n");
|
||||
|
@ -328,7 +344,7 @@ AddSysMenuLine (char *matchstr, char *menuname, int pos)
|
|||
}
|
||||
|
||||
static void
|
||||
CloseSysMenu ()
|
||||
CloseSysMenu (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
131
hw/xwin/winpriv.c
Normal file
131
hw/xwin/winpriv.c
Normal file
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Export window information for the Windows-OpenGL GLX implementation.
|
||||
*
|
||||
* Authors: Alexander Gottwald
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
#include "winpriv.h"
|
||||
#include "winwindow.h"
|
||||
|
||||
void
|
||||
winCreateWindowsWindow (WindowPtr pWin);
|
||||
/**
|
||||
* Return size and handles of a window.
|
||||
* If pWin is NULL, then the information for the root window is requested.
|
||||
*/
|
||||
extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
|
||||
{
|
||||
/* Sanity check */
|
||||
if (pWinInfo == NULL)
|
||||
return;
|
||||
|
||||
winDebug("%s:%d pWin=%p\n", __FUNCTION__, __LINE__, pWin);
|
||||
|
||||
/* a real window was requested */
|
||||
if (pWin != NULL)
|
||||
{
|
||||
/* Initialize the size information */
|
||||
RECT rect = {
|
||||
pWin->drawable.x,
|
||||
pWin->drawable.y,
|
||||
pWin->drawable.x + pWin->drawable.width,
|
||||
pWin->drawable.y + pWin->drawable.height
|
||||
}, rect_extends;
|
||||
/* Get the window and screen privates */
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
||||
winScreenInfoPtr pScreenInfo = NULL;
|
||||
|
||||
rect_extends = rect;
|
||||
OffsetRect(&rect_extends, -pWin->drawable.x, -pWin->drawable.y);
|
||||
|
||||
if (pWinScreen == NULL)
|
||||
{
|
||||
ErrorF("winGetWindowInfo: screen has no privates\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pWinInfo->hwnd = pWinScreen->hwndScreen;
|
||||
pWinInfo->hrgn = NULL;
|
||||
pWinInfo->rect = rect;
|
||||
|
||||
|
||||
pScreenInfo = pWinScreen->pScreenInfo;
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* check for multiwindow mode */
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
{
|
||||
winWindowPriv(pWin);
|
||||
|
||||
if (pWinPriv == NULL)
|
||||
{
|
||||
ErrorF("winGetWindowInfo: window has no privates\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pWinPriv->hWnd == NULL)
|
||||
{
|
||||
winCreateWindowsWindow(pWin);
|
||||
}
|
||||
if (pWinPriv->hWnd != NULL) {
|
||||
|
||||
/* copy size and window handle */
|
||||
pWinInfo->rect = rect_extends;
|
||||
pWinInfo->hwnd = pWinPriv->hWnd;
|
||||
|
||||
/* Copy window region */
|
||||
if (pWinInfo->hrgn)
|
||||
DeleteObject(pWinInfo->hrgn);
|
||||
pWinInfo->hrgn = CreateRectRgn(0,0,0,0);
|
||||
CombineRgn(pWinInfo->hrgn, pWinPriv->hRgn, pWinPriv->hRgn,
|
||||
RGN_COPY);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
/* check for multiwindow external wm mode */
|
||||
if (pScreenInfo->fMWExtWM)
|
||||
{
|
||||
win32RootlessWindowPtr pRLWinPriv
|
||||
= (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
|
||||
|
||||
if (pRLWinPriv == NULL) {
|
||||
ErrorF("winGetWindowInfo: window has no privates\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pRLWinPriv->hWnd != NULL)
|
||||
{
|
||||
/* copy size and window handle */
|
||||
pWinInfo->rect = rect_extends;
|
||||
pWinInfo->hwnd = pRLWinPriv->hWnd;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT rect = {0, 0, 0, 0};
|
||||
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
|
||||
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
||||
|
||||
pWinInfo->hwnd = NULL;
|
||||
pWinInfo->hrgn = NULL;
|
||||
pWinInfo->rect = rect;
|
||||
|
||||
if (pWinScreen == NULL)
|
||||
{
|
||||
ErrorF("winGetWindowInfo: screen has no privates\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ErrorF("winGetWindowInfo: returning root window\n");
|
||||
|
||||
pWinInfo->hwnd = pWinScreen->hwndScreen;
|
||||
}
|
||||
return;
|
||||
}
|
15
hw/xwin/winpriv.h
Normal file
15
hw/xwin/winpriv.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Export window information for the Windows-OpenGL GLX implementation.
|
||||
*
|
||||
* Authors: Alexander Gottwald
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HWND hwnd;
|
||||
HRGN hrgn;
|
||||
RECT rect;
|
||||
} winWindowInfoRec, *winWindowInfoPtr;
|
||||
|
||||
extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo);
|
1250
hw/xwin/winprocarg.c
Executable file
1250
hw/xwin/winprocarg.c
Executable file
File diff suppressed because it is too large
Load Diff
|
@ -75,11 +75,8 @@ bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
|
|||
* in the server, we need to rename one of them
|
||||
*/
|
||||
void
|
||||
winPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
|
||||
GCPtr pGC;
|
||||
PixmapPtr pBitMap;
|
||||
DrawablePtr pDrawable;
|
||||
int dx, dy, xOrg, yOrg;
|
||||
winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
|
||||
int dx, int dy, int xOrg, int yOrg)
|
||||
{
|
||||
int h, dxDivPPW, ibEnd;
|
||||
MiBits *pwLineStart;
|
||||
|
|
138
hw/xwin/winrandr.c
Executable file
138
hw/xwin/winrandr.c
Executable file
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
*Copyright (C) 2001-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
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations);
|
||||
|
||||
static Bool
|
||||
winRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation rotateKind,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize);
|
||||
|
||||
Bool
|
||||
winRandRInit (ScreenPtr pScreen);
|
||||
|
||||
|
||||
/*
|
||||
* Answer queries about the RandR features supported.
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
||||
int n;
|
||||
Rotation rotateKind;
|
||||
RRScreenSizePtr pSize;
|
||||
|
||||
winDebug ("winRandRGetInfo ()\n");
|
||||
|
||||
/* Don't support rotations, yet */
|
||||
*pRotations = RR_Rotate_0;
|
||||
|
||||
/* Bail if no depth has a visual associated with it */
|
||||
for (n = 0; n < pScreen->numDepths; n++)
|
||||
if (pScreen->allowedDepths[n].numVids)
|
||||
break;
|
||||
if (n == pScreen->numDepths)
|
||||
return FALSE;
|
||||
|
||||
/* Only one allowed rotation for now */
|
||||
rotateKind = RR_Rotate_0;
|
||||
|
||||
/*
|
||||
* Register supported sizes. This can be called many times, but
|
||||
* we only support one size for now.
|
||||
*/
|
||||
pSize = RRRegisterSize (pScreen,
|
||||
pScreenInfo->dwWidth,
|
||||
pScreenInfo->dwHeight,
|
||||
pScreenInfo->dwWidth_mm,
|
||||
pScreenInfo->dwHeight_mm);
|
||||
|
||||
/* Tell RandR what the current config is */
|
||||
RRSetCurrentConfig (pScreen,
|
||||
rotateKind,
|
||||
0, /* refresh rate, not needed */
|
||||
pSize);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Respond to resize/rotate request from either X Server or X client app
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation rotateKind,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize)
|
||||
{
|
||||
winDebug ("winRandRSetConfig ()\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the RandR layer.
|
||||
*/
|
||||
|
||||
Bool
|
||||
winRandRInit (ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr pRRScrPriv;
|
||||
|
||||
winDebug ("winRandRInit ()\n");
|
||||
|
||||
if (!RRScreenInit (pScreen))
|
||||
{
|
||||
ErrorF ("winRandRInit () - RRScreenInit () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set some RandR function pointers */
|
||||
pRRScrPriv = rrGetScrPriv (pScreen);
|
||||
pRRScrPriv->rrGetInfo = winRandRGetInfo;
|
||||
pRRScrPriv->rrSetConfig = winRandRSetConfig;
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2002-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
|
||||
|
@ -15,22 +15,24 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.5 2001/11/11 22:45:57 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
/* Prototypes */
|
||||
DWORD
|
||||
winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey);
|
||||
|
||||
DWORD
|
||||
winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey)
|
||||
|
|
57
hw/xwin/winresource.h
Normal file
57
hw/xwin/winresource.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
#if !defined(WINRESOURCE_H)
|
||||
#define WINRESOURCE_H
|
||||
/*
|
||||
*Copyright (C) 2002-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
|
||||
*/
|
||||
|
||||
#include "winms.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local defines
|
||||
*/
|
||||
|
||||
#define IDC_STATIC -1
|
||||
#define IDI_XWIN 101
|
||||
#define IDI_XWIN_BOXED 102
|
||||
#define IDM_TRAYICON_MENU 103
|
||||
#define IDC_CLIENTS_CONNECTED 104
|
||||
|
||||
|
||||
#define ID_APP_EXIT 200
|
||||
#define ID_APP_HIDE_ROOT 201
|
||||
#define ID_APP_ALWAYS_ON_TOP 202
|
||||
#define ID_APP_ABOUT 203
|
||||
|
||||
#define ID_ABOUT_UG 300
|
||||
#define ID_ABOUT_FAQ 301
|
||||
#define ID_ABOUT_CHANGELOG 302
|
||||
#define ID_ABOUT_WEBSITE 303
|
||||
|
||||
#endif
|
|
@ -34,6 +34,9 @@
|
|||
*/
|
||||
#include "win.h"
|
||||
|
||||
void
|
||||
ROP16 (HDC hdc, int rop);
|
||||
|
||||
int g_copyROP[16] = { 0xFF0062, /* GXclear - 0 */
|
||||
0x8800C6, /* GXand - S & D */
|
||||
0x440328, /* GXandReverse - S & !D */
|
||||
|
|
|
@ -34,6 +34,62 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.27 2003/07/29 21:25:18 dawes Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "winmsg.h"
|
||||
#include "safeAlpha.h"
|
||||
|
||||
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
static RootlessFrameProcsRec
|
||||
winMWExtWMProcs = {
|
||||
winMWExtWMCreateFrame,
|
||||
winMWExtWMDestroyFrame,
|
||||
|
||||
winMWExtWMMoveFrame,
|
||||
winMWExtWMResizeFrame,
|
||||
winMWExtWMRestackFrame,
|
||||
winMWExtWMReshapeFrame,
|
||||
winMWExtWMUnmapFrame,
|
||||
|
||||
winMWExtWMStartDrawing,
|
||||
winMWExtWMStopDrawing,
|
||||
winMWExtWMUpdateRegion,
|
||||
#ifndef ROOTLESS_TRACK_DAMAGE
|
||||
winMWExtWMDamageRects,
|
||||
#endif
|
||||
winMWExtWMRootlessSwitchWindow,
|
||||
|
||||
NULL,//winMWExtWMCopyBytes,
|
||||
NULL,//winMWExtWMFillBytes,
|
||||
NULL,//winMWExtWMCompositePixels,
|
||||
winMWExtWMCopyWindow
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern winScreenInfo g_ScreenInfo[];
|
||||
extern miPointerScreenFuncRec g_winPointerCursorFuncs;
|
||||
extern int g_iScreenPrivateIndex;
|
||||
extern Bool g_fSoftwareCursor;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
||||
Bool
|
||||
winRandRInit (ScreenPtr pScreen);
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winSaveScreen (ScreenPtr pScreen, int on);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -51,8 +107,8 @@ winScreenInit (int index,
|
|||
winPrivScreenPtr pScreenPriv;
|
||||
HDC hdc;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winScreenInit - dwWidth: %d dwHeight: %d\n",
|
||||
#if CYGDEBUG || YES
|
||||
winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
|
||||
pScreenInfo->dwWidth, pScreenInfo->dwHeight);
|
||||
#endif
|
||||
|
||||
|
@ -98,7 +154,7 @@ winScreenInit (int index,
|
|||
ErrorF ("winScreenInit - Unsupported display depth: %d\n" \
|
||||
"Change your Windows display depth to 15, 16, 24, or 32 bits "
|
||||
"per pixel.\n",
|
||||
pScreenInfo->dwBPP);
|
||||
(int) pScreenInfo->dwBPP);
|
||||
ErrorF ("winScreenInit - Supported depths: %08x\n",
|
||||
WIN_SUPPORTED_BPPS);
|
||||
#if WIN_CHECK_DEPTH
|
||||
|
@ -177,8 +233,13 @@ winScreenInit (int index,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!g_fSoftwareCursor)
|
||||
winInitCursor(pScreen);
|
||||
else
|
||||
winErrorFVerb(2, "winScreenInit - Using software cursor\n");
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
ErrorF ("winScreenInit - returning\n");
|
||||
winDebug ("winScreenInit - returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -197,10 +258,6 @@ winFinishScreenInitFB (int index,
|
|||
char *pbits = NULL;
|
||||
int iReturn;
|
||||
|
||||
#if WIN_LAYER_SUPPORT
|
||||
pScreenPriv->dwLayerKind = LAYER_SHADOW;
|
||||
#endif
|
||||
|
||||
/* Create framebuffer */
|
||||
if (!(*pScreenPriv->pwinAllocateFB) (pScreen))
|
||||
{
|
||||
|
@ -218,9 +275,10 @@ winFinishScreenInitFB (int index,
|
|||
+ winCountBits (pScreenPriv->dwGreenMask)
|
||||
+ winCountBits (pScreenPriv->dwBlueMask);
|
||||
|
||||
ErrorF ("winFinishScreenInitFB - Masks: %08x %08x %08x\n",
|
||||
pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask,
|
||||
pScreenPriv->dwBlueMask);
|
||||
winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n",
|
||||
(unsigned int) pScreenPriv->dwRedMask,
|
||||
(unsigned int) pScreenPriv->dwGreenMask,
|
||||
(unsigned int) pScreenPriv->dwBlueMask);
|
||||
|
||||
/* Init visuals */
|
||||
if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
|
||||
|
@ -255,13 +313,7 @@ winFinishScreenInitFB (int index,
|
|||
|| (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||
&& pScreenInfo->fFullScreen)))
|
||||
{
|
||||
pScreen->CreateColormap = winCreateColormap;
|
||||
pScreen->DestroyColormap = winDestroyColormap;
|
||||
pScreen->InstallColormap = winInstallColormap;
|
||||
pScreen->UninstallColormap = winUninstallColormap;
|
||||
pScreen->ListInstalledColormaps = winListInstalledColormaps;
|
||||
pScreen->StoreColors = winStoreColors;
|
||||
pScreen->ResolveColor = winResolveColor;
|
||||
winSetColormapFunctions (pScreen);
|
||||
|
||||
/*
|
||||
* NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
|
||||
|
@ -322,44 +374,13 @@ winFinishScreenInitFB (int index,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if WIN_LAYER_SUPPORT
|
||||
/* KDrive does LayerStartInit right after fbPictureInit */
|
||||
if (!LayerStartInit (pScreen))
|
||||
{
|
||||
ErrorF ("winFinishScreenInitFB - LayerStartInit () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Not sure what we're adding to shadow, but add it anyway */
|
||||
if (!shadowAdd (pScreen, 0, pScreenPriv->pwinShadowUpdate, NULL, 0, 0))
|
||||
{
|
||||
ErrorF ("winFinishScreenInitFB - shadowAdd () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* KDrive does LayerFinishInit right after LayerStartInit */
|
||||
if (!LayerFinishInit (pScreen))
|
||||
{
|
||||
ErrorF ("winFinishScreenInitFB - LayerFinishInit () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* KDrive does LayerCreate right after LayerFinishInit */
|
||||
pScreenPriv->pLayer = winLayerCreate (pScreen);
|
||||
if (!pScreenPriv->pLayer)
|
||||
{
|
||||
ErrorF ("winFinishScreenInitFB - winLayerCreate () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* KDrive does RandRInit right after LayerCreate */
|
||||
#ifdef RANDR
|
||||
if (pScreenInfo->dwDepth != 8 && !winRandRInit (pScreen))
|
||||
/* Initialize resize and rotate support */
|
||||
if (!winRandRInit (pScreen))
|
||||
{
|
||||
ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -371,14 +392,14 @@ winFinishScreenInitFB (int index,
|
|||
/* KDrive does miDCInitialize right after miInitializeBackingStore */
|
||||
/* Setup the cursor routines */
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
|
||||
winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
|
||||
#endif
|
||||
miDCInitialize (pScreen, &g_winPointerCursorFuncs);
|
||||
|
||||
/* KDrive does winCreateDefColormap right after miDCInitialize */
|
||||
/* Create a default colormap */
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
|
||||
winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
|
||||
#endif
|
||||
if (!winCreateDefColormap (pScreen))
|
||||
{
|
||||
|
@ -386,14 +407,17 @@ winFinishScreenInitFB (int index,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if !WIN_LAYER_SUPPORT
|
||||
/* Initialize the shadow framebuffer layer */
|
||||
if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
|
||||
|| pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||
|| pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
|
||||
if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
|
||||
|| pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||
|| pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
&& !pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winFinishScreenInitFB - Calling shadowInit ()\n");
|
||||
winDebug ("winFinishScreenInitFB - Calling shadowInit ()\n");
|
||||
#endif
|
||||
if (!shadowInit (pScreen,
|
||||
pScreenPriv->pwinShadowUpdate,
|
||||
|
@ -403,10 +427,28 @@ winFinishScreenInitFB (int index,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
/* Handle multi-window external window manager mode */
|
||||
if (pScreenInfo->fMWExtWM)
|
||||
{
|
||||
winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
|
||||
|
||||
RootlessInit(pScreen, &winMWExtWMProcs);
|
||||
|
||||
winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
|
||||
|
||||
rootless_CopyBytes_threshold = 0;
|
||||
rootless_FillBytes_threshold = 0;
|
||||
rootless_CompositePixels_threshold = 0;
|
||||
/* FIXME: How many? Profiling needed? */
|
||||
rootless_CopyWindow_threshold = 1;
|
||||
|
||||
winWindowsWMExtensionInit ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Handle pseudo-rootless mode */
|
||||
/* Handle rootless mode */
|
||||
if (pScreenInfo->fRootless)
|
||||
{
|
||||
/* Define the WRAP macro temporarily for local use */
|
||||
|
@ -429,20 +471,23 @@ winFinishScreenInitFB (int index,
|
|||
WRAP(SetShape);
|
||||
#endif
|
||||
|
||||
/* Assign pseudo-rootless window procedures to be top level procedures */
|
||||
pScreen->CreateWindow = winCreateWindowPRootless;
|
||||
pScreen->DestroyWindow = winDestroyWindowPRootless;
|
||||
pScreen->PositionWindow = winPositionWindowPRootless;
|
||||
pScreen->ChangeWindowAttributes = winChangeWindowAttributesPRootless;
|
||||
pScreen->RealizeWindow = winMapWindowPRootless;
|
||||
pScreen->UnrealizeWindow = winUnmapWindowPRootless;
|
||||
/* Assign rootless window procedures to be top level procedures */
|
||||
pScreen->CreateWindow = winCreateWindowRootless;
|
||||
pScreen->DestroyWindow = winDestroyWindowRootless;
|
||||
pScreen->PositionWindow = winPositionWindowRootless;
|
||||
pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;
|
||||
pScreen->RealizeWindow = winMapWindowRootless;
|
||||
pScreen->UnrealizeWindow = winUnmapWindowRootless;
|
||||
#ifdef SHAPE
|
||||
pScreen->SetShape = winSetShapePRootless;
|
||||
pScreen->SetShape = winSetShapeRootless;
|
||||
#endif
|
||||
|
||||
/* Undefine the WRAP macro, as it is not needed elsewhere */
|
||||
#undef WRAP
|
||||
}
|
||||
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Handle multi window mode */
|
||||
else if (pScreenInfo->fMultiWindow)
|
||||
{
|
||||
|
@ -464,6 +509,9 @@ winFinishScreenInitFB (int index,
|
|||
WRAP(ChangeWindowAttributes);
|
||||
WRAP(ReparentWindow);
|
||||
WRAP(RestackWindow);
|
||||
WRAP(ResizeWindow);
|
||||
WRAP(MoveWindow);
|
||||
WRAP(CopyWindow);
|
||||
#ifdef SHAPE
|
||||
WRAP(SetShape);
|
||||
#endif
|
||||
|
@ -477,6 +525,9 @@ winFinishScreenInitFB (int index,
|
|||
pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
|
||||
pScreen->ReparentWindow = winReparentWindowMultiWindow;
|
||||
pScreen->RestackWindow = winRestackWindowMultiWindow;
|
||||
pScreen->ResizeWindow = winResizeWindowMultiWindow;
|
||||
pScreen->MoveWindow = winMoveWindowMultiWindow;
|
||||
pScreen->CopyWindow = winCopyWindowMultiWindow;
|
||||
#ifdef SHAPE
|
||||
pScreen->SetShape = winSetShapeMultiWindow;
|
||||
#endif
|
||||
|
@ -484,12 +535,14 @@ winFinishScreenInitFB (int index,
|
|||
/* Undefine the WRAP macro, as it is not needed elsewhere */
|
||||
#undef WRAP
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
|
||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
|
||||
|
||||
/* Create a mutex for modules in seperate threads to wait for */
|
||||
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
|
||||
/* Create a mutex for modules in separate threads to wait for */
|
||||
iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
|
@ -498,7 +551,7 @@ winFinishScreenInitFB (int index,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Own the mutex for modules in seperate threads */
|
||||
/* Own the mutex for modules in separate threads */
|
||||
iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted);
|
||||
if (iReturn != 0)
|
||||
{
|
||||
|
@ -509,15 +562,16 @@ winFinishScreenInitFB (int index,
|
|||
|
||||
/* Set the ServerStarted flag to false */
|
||||
pScreenPriv->fServerStarted = FALSE;
|
||||
#endif
|
||||
|
||||
/* Set the WindowOrderChanged flag to false */
|
||||
pScreenPriv->fWindowOrderChanged = FALSE;
|
||||
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
pScreenPriv->fRestacking = FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
#if CYGDEBUG || YES
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
ErrorF ("winFinishScreenInitFB - Calling winInitWM.\n");
|
||||
winDebug ("winFinishScreenInitFB - Calling winInitWM.\n");
|
||||
#endif
|
||||
|
||||
/* Initialize multi window mode */
|
||||
|
@ -531,22 +585,8 @@ winFinishScreenInitFB (int index,
|
|||
ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
if (pScreenInfo->fClipboard)
|
||||
ErrorF ("winFinishScreenInitFB - Calling winInitClipboard.\n");
|
||||
#endif
|
||||
|
||||
/* Initialize the clipboard manager */
|
||||
if (pScreenInfo->fClipboard
|
||||
&& !winInitClipboard (&pScreenPriv->ptClipboardProc,
|
||||
&pScreenPriv->pmServerStarted,
|
||||
pScreenInfo->dwScreen))
|
||||
{
|
||||
ErrorF ("winFinishScreenInitFB - winClipboardInit () failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Tell the server that we are enabled */
|
||||
pScreenPriv->fEnabled = TRUE;
|
||||
|
||||
|
@ -554,27 +594,13 @@ winFinishScreenInitFB (int index,
|
|||
pScreenPriv->fBadDepth = FALSE;
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
ErrorF ("winFinishScreenInitFB - returning\n");
|
||||
winDebug ("winFinishScreenInitFB - returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* TEST CODE BELOW - NOT USED IN NORMAL COMPILATION
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
/* See Porting Layer Definition - p. 20 */
|
||||
|
||||
Bool
|
||||
|
@ -677,11 +703,11 @@ winFinishScreenInitNativeGDI (int index,
|
|||
|
||||
/* Colormap Routines */
|
||||
pScreen->CreateColormap = miInitializeColormap;
|
||||
pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)()) NoopDDA;
|
||||
pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
|
||||
pScreen->InstallColormap = miInstallColormap;
|
||||
pScreen->UninstallColormap = miUninstallColormap;
|
||||
pScreen->ListInstalledColormaps = miListInstalledColormaps;
|
||||
pScreen->StoreColors = (StoreColorsProcPtr) (void (*)()) NoopDDA;
|
||||
pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
|
||||
pScreen->ResolveColor = miResolveColor;
|
||||
|
||||
/* Bitmap */
|
||||
|
@ -718,30 +744,16 @@ winFinishScreenInitNativeGDI (int index,
|
|||
|
||||
ErrorF ("winFinishScreenInitNativeGDI - Successful addition of "
|
||||
"screen %08x\n",
|
||||
pScreen);
|
||||
(unsigned int) pScreen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 33 */
|
||||
Bool
|
||||
static Bool
|
||||
winSaveScreen (ScreenPtr pScreen, int on)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
PixmapPtr
|
||||
winGetWindowPixmap (WindowPtr pwin)
|
||||
{
|
||||
ErrorF ("winGetWindowPixmap ()\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
winSetWindowPixmap (WindowPtr pwin, PixmapPtr pPix)
|
||||
{
|
||||
ErrorF ("winSetWindowPixmap ()\n");
|
||||
}
|
||||
|
|
|
@ -32,6 +32,16 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern int g_iPixmapPrivateIndex;
|
||||
extern int g_iGCPrivateIndex;
|
||||
extern int g_copyROP[];
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 55 */
|
||||
void
|
||||
winSetSpansNativeGDI (DrawablePtr pDrawable,
|
||||
|
|
|
@ -34,6 +34,14 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* External symbols
|
||||
*/
|
||||
|
||||
extern HWND g_hDlgExit;
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
|
||||
* so we have to redefine it here.
|
||||
|
@ -53,13 +61,66 @@ DEFINE_GUID( IID_IDirectDraw2,0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,
|
|||
#endif /* IID_IDirectDraw2 */
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winAllocateFBShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static void
|
||||
winShadowUpdateDD (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf);
|
||||
|
||||
static Bool
|
||||
winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInitVisualsShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winAdjustVideoModeShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winBltExposedRegionsShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winActivateAppShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRedrawScreenShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInstallColormapShadowDD (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winStoreColorsShadowDD (ColormapPtr pmap,
|
||||
int ndef,
|
||||
xColorItem *pdefs);
|
||||
|
||||
static Bool
|
||||
winCreateColormapShadowDD (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winDestroyColormapShadowDD (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen);
|
||||
|
||||
|
||||
/*
|
||||
* Create the primary surface and attach the clipper.
|
||||
* Used for both the initial surface creation and during
|
||||
* WM_DISPLAYCHANGE messages.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -80,12 +141,12 @@ winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDD - Could not create primary "
|
||||
"surface: %08x\n", ddrval);
|
||||
"surface: %08x\n", (unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDD - Created primary surface\n");
|
||||
winDebug ("winCreatePrimarySurfaceShadowDD - Created primary surface\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -98,12 +159,12 @@ winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDD - Primary attach clipper "
|
||||
"failed: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDD - Attached clipper to "
|
||||
winDebug ("winCreatePrimarySurfaceShadowDD - Attached clipper to "
|
||||
"primary surface\n");
|
||||
#endif
|
||||
|
||||
|
@ -117,7 +178,7 @@ winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen)
|
|||
* Called from WM_DISPLAYCHANGE.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -155,7 +216,7 @@ winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen)
|
|||
* that clips our blits to the unobscured client area of our display window.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAllocateFBShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -165,7 +226,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
DDSURFACEDESC *pddsdShadow = NULL;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD\n");
|
||||
winDebug ("winAllocateFBShadowDD\n");
|
||||
#endif
|
||||
|
||||
/* Create a clipper */
|
||||
|
@ -175,12 +236,12 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not create clipper: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD - Created a clipper\n");
|
||||
winDebug ("winAllocateFBShadowDD - Created a clipper\n");
|
||||
#endif
|
||||
|
||||
/* Get a device context for the screen */
|
||||
|
@ -194,12 +255,12 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Clipper not attached to "
|
||||
"window: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD - Attached clipper to window\n");
|
||||
winDebug ("winAllocateFBShadowDD - Attached clipper to window\n");
|
||||
#endif
|
||||
|
||||
/* Create a DirectDraw object, store the address at lpdd */
|
||||
|
@ -207,12 +268,12 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD () - Created and initialized DD\n");
|
||||
winDebug ("winAllocateFBShadowDD () - Created and initialized DD\n");
|
||||
#endif
|
||||
|
||||
/* Get a DirectDraw2 interface pointer */
|
||||
|
@ -222,7 +283,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -242,7 +303,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not set "
|
||||
"cooperative level: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -262,7 +323,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not get current "
|
||||
"refresh rate: %08x. Continuing.\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
dwRefreshRateCurrent = 0;
|
||||
}
|
||||
else
|
||||
|
@ -309,7 +370,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not set "\
|
||||
"full screen display mode: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +393,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not set "\
|
||||
"cooperative level: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -368,12 +429,12 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not create shadow "\
|
||||
"surface: %08x\n", ddrval);
|
||||
"surface: %08x\n", (unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD - Created shadow\n");
|
||||
winDebug ("winAllocateFBShadowDD - Created shadow\n");
|
||||
#endif
|
||||
|
||||
/* Allocate a DD surface description for our screen privates */
|
||||
|
@ -388,7 +449,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
pddsdShadow->dwSize = sizeof (*pddsdShadow);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD - Locking shadow\n");
|
||||
winDebug ("winAllocateFBShadowDD - Locking shadow\n");
|
||||
#endif
|
||||
|
||||
/* Lock the shadow surface */
|
||||
|
@ -400,12 +461,12 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL)
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDD - Could not lock shadow "\
|
||||
"surface: %08x\n", ddrval);
|
||||
"surface: %08x\n", (unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD - Locked shadow\n");
|
||||
winDebug ("winAllocateFBShadowDD - Locked shadow\n");
|
||||
#endif
|
||||
|
||||
/* We don't know how to deal with anything other than RGB */
|
||||
|
@ -428,7 +489,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDD - Returning\n");
|
||||
winDebug ("winAllocateFBShadowDD - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -439,7 +500,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
|
|||
* Transfer the damaged regions of the shadow framebuffer to the display.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
winShadowUpdateDD (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf)
|
||||
{
|
||||
|
@ -604,7 +665,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
|
|||
* Free our resources and private structures.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -612,7 +673,7 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
|
|||
Bool fReturn;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCloseScreenShadowDD - Freeing screen resources\n");
|
||||
winDebug ("winCloseScreenShadowDD - Freeing screen resources\n");
|
||||
#endif
|
||||
|
||||
/* Flag that the screen is closed */
|
||||
|
@ -689,8 +750,10 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
|
|||
pScreenPriv->hwndScreen = NULL;
|
||||
}
|
||||
|
||||
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
|
||||
/* Destroy the thread startup mutex */
|
||||
pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
|
||||
#endif
|
||||
|
||||
/* Kill our screeninfo's pointer to the screen */
|
||||
pScreenInfo->pScreen = NULL;
|
||||
|
@ -713,7 +776,7 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
|
|||
* to verify that last sentence.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInitVisualsShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -737,12 +800,12 @@ winInitVisualsShadowDD (ScreenPtr pScreen)
|
|||
|
||||
ErrorF ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d "
|
||||
"bpp %d\n",
|
||||
pScreenPriv->dwRedMask,
|
||||
pScreenPriv->dwGreenMask,
|
||||
pScreenPriv->dwBlueMask,
|
||||
pScreenPriv->dwBitsPerRGB,
|
||||
pScreenInfo->dwDepth,
|
||||
pScreenInfo->dwBPP);
|
||||
(unsigned int) pScreenPriv->dwRedMask,
|
||||
(unsigned int) pScreenPriv->dwGreenMask,
|
||||
(unsigned int) pScreenPriv->dwBlueMask,
|
||||
(int) pScreenPriv->dwBitsPerRGB,
|
||||
(int) pScreenInfo->dwDepth,
|
||||
(int) pScreenInfo->dwBPP);
|
||||
|
||||
/* Create a single visual according to the Windows screen depth */
|
||||
switch (pScreenInfo->dwDepth)
|
||||
|
@ -765,7 +828,7 @@ winInitVisualsShadowDD (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if WIN_EMULATE_PSEUDO_SUPPORT
|
||||
#ifdef XWIN_EMULATEPSEUDO
|
||||
if (!pScreenInfo->fEmulatePseudo)
|
||||
break;
|
||||
|
||||
|
@ -797,7 +860,7 @@ winInitVisualsShadowDD (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if WIN_EMULATE_PSEUDO_SUPPORT
|
||||
#ifdef XWIN_EMULATEPSEUDO
|
||||
if (!pScreenInfo->fEmulatePseudo)
|
||||
break;
|
||||
|
||||
|
@ -855,7 +918,7 @@ winInitVisualsShadowDD (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInitVisualsShadowDD - Returning\n");
|
||||
winDebug ("winInitVisualsShadowDD - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -866,7 +929,7 @@ winInitVisualsShadowDD (ScreenPtr pScreen)
|
|||
* Adjust the user proposed video mode
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAdjustVideoModeShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -890,7 +953,7 @@ winAdjustVideoModeShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
/* No -depth parameter passed, let the user know the depth being used */
|
||||
ErrorF ("winAdjustVideoModeShadowDD - Using Windows display "
|
||||
"depth of %d bits per pixel\n", dwBPP);
|
||||
"depth of %d bits per pixel\n", (int) dwBPP);
|
||||
|
||||
/* Use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -900,13 +963,13 @@ winAdjustVideoModeShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
/* FullScreen, and GDI depth differs from -depth parameter */
|
||||
ErrorF ("winAdjustVideoModeShadowDD - FullScreen, using command line "
|
||||
"bpp: %d\n", pScreenInfo->dwBPP);
|
||||
"bpp: %d\n", (int) pScreenInfo->dwBPP);
|
||||
}
|
||||
else if (dwBPP != pScreenInfo->dwBPP)
|
||||
{
|
||||
/* Windowed, and GDI depth differs from -depth parameter */
|
||||
ErrorF ("winAdjustVideoModeShadowDD - Windowed, command line bpp: "
|
||||
"%d, using bpp: %d\n", pScreenInfo->dwBPP, dwBPP);
|
||||
"%d, using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP);
|
||||
|
||||
/* We'll use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -934,7 +997,7 @@ winAdjustVideoModeShadowDD (ScreenPtr pScreen)
|
|||
* Blt exposed regions to the screen
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winBltExposedRegionsShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -1007,10 +1070,10 @@ winBltExposedRegionsShadowDD (ScreenPtr pScreen)
|
|||
|
||||
/* Try to restore the surface, once */
|
||||
ddrval = IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
|
||||
ErrorF ("winBltExposedRegionsShadowDDNL - "
|
||||
ErrorF ("winBltExposedRegionsShadowDD - "
|
||||
"IDirectDrawSurface2_Restore returned: ");
|
||||
if (ddrval == DD_OK)
|
||||
continue;
|
||||
ErrorF ("DD_OK\n");
|
||||
else if (ddrval == DDERR_WRONGMODE)
|
||||
ErrorF ("DDERR_WRONGMODE\n");
|
||||
else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
|
||||
|
@ -1022,7 +1085,7 @@ winBltExposedRegionsShadowDD (ScreenPtr pScreen)
|
|||
else if (ddrval == DDERR_INVALIDOBJECT)
|
||||
ErrorF ("DDERR_INVALIDOBJECT\n");
|
||||
else
|
||||
ErrorF ("unknown error: %08x\n", ddrval);
|
||||
ErrorF ("unknown error: %08x\n", (unsigned int) ddrval);
|
||||
|
||||
/* Loop around to try the blit one more time */
|
||||
continue;
|
||||
|
@ -1031,7 +1094,8 @@ winBltExposedRegionsShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
fReturn = FALSE;
|
||||
ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
|
||||
"failed, but surface not lost: %08x %d\n", ddrval, ddrval);
|
||||
"failed, but surface not lost: %08x %d\n",
|
||||
(unsigned int) ddrval, (int) ddrval);
|
||||
goto winBltExposedRegionsShadowDD_Exit;
|
||||
}
|
||||
else
|
||||
|
@ -1097,7 +1161,7 @@ winBltExposedRegionsShadowDD (ScreenPtr pScreen)
|
|||
* Do any engine-specific appliation-activation processing
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winActivateAppShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -1123,7 +1187,7 @@ winActivateAppShadowDD (ScreenPtr pScreen)
|
|||
* Reblit the shadow framebuffer to the screen.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRedrawScreenShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -1160,7 +1224,7 @@ winRedrawScreenShadowDD (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () "
|
||||
"failed: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1171,7 +1235,7 @@ winRedrawScreenShadowDD (ScreenPtr pScreen)
|
|||
* Realize the currently installed colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen)
|
||||
{
|
||||
return TRUE;
|
||||
|
@ -1182,7 +1246,7 @@ winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen)
|
|||
* Install the specified colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInstallColormapShadowDD (ColormapPtr pColormap)
|
||||
{
|
||||
ScreenPtr pScreen = pColormap->pScreen;
|
||||
|
@ -1211,7 +1275,7 @@ winInstallColormapShadowDD (ColormapPtr pColormap)
|
|||
* Store the specified colors in the specified colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winStoreColorsShadowDD (ColormapPtr pColormap,
|
||||
int ndef,
|
||||
xColorItem *pdefs)
|
||||
|
@ -1231,7 +1295,7 @@ winStoreColorsShadowDD (ColormapPtr pColormap,
|
|||
+ pdefs[0].pixel);
|
||||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed\n");
|
||||
ErrorF ("winStoreColorsShadowDD - SetEntries () failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1243,7 +1307,7 @@ winStoreColorsShadowDD (ColormapPtr pColormap,
|
|||
|
||||
if (!winInstallColormapShadowDD (pColormap))
|
||||
{
|
||||
ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n");
|
||||
ErrorF ("winStoreColorsShadowDD - Failed installing colormap\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1255,7 +1319,7 @@ winStoreColorsShadowDD (ColormapPtr pColormap,
|
|||
* Colormap initialization procedure
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCreateColormapShadowDD (ColormapPtr pColormap)
|
||||
{
|
||||
HRESULT ddrval = DD_OK;
|
||||
|
@ -1271,7 +1335,7 @@ winCreateColormapShadowDD (ColormapPtr pColormap)
|
|||
NULL);
|
||||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n");
|
||||
ErrorF ("winCreateColormapShadowDD - CreatePalette failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1283,7 +1347,7 @@ winCreateColormapShadowDD (ColormapPtr pColormap)
|
|||
* Colormap destruction procedure
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winDestroyColormapShadowDD (ColormapPtr pColormap)
|
||||
{
|
||||
winScreenPriv(pColormap->pScreen);
|
||||
|
@ -1301,7 +1365,7 @@ winDestroyColormapShadowDD (ColormapPtr pColormap)
|
|||
if (pColormap->flags & IsDefault)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyColormapShadowDDNL - Destroying default "
|
||||
winDebug ("winDestroyColormapShadowDD - Destroying default "
|
||||
"colormap\n");
|
||||
#endif
|
||||
|
||||
|
@ -1315,7 +1379,7 @@ winDestroyColormapShadowDD (ColormapPtr pColormap)
|
|||
NULL);
|
||||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the "
|
||||
ErrorF ("winDestroyColormapShadowDD - Failed freeing the "
|
||||
"default colormap DirectDraw palette.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1364,10 +1428,13 @@ winSetEngineFunctionsShadowDD (ScreenPtr pScreen)
|
|||
pScreenPriv->pwinStoreColors = winStoreColorsShadowDD;
|
||||
pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD;
|
||||
pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
|
||||
pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD;
|
||||
pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD;
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
pScreenPriv->pwinFinishCreateWindowsWindow =
|
||||
(winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,14 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* External symbols
|
||||
*/
|
||||
|
||||
extern HWND g_hDlgExit;
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
|
||||
* so we have to redefine it here.
|
||||
|
@ -54,20 +62,73 @@ DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f
|
|||
#define FAIL_MSG_MAX_BLT 10
|
||||
|
||||
|
||||
/*
|
||||
* Local prototypes
|
||||
*/
|
||||
|
||||
static Bool
|
||||
winAllocateFBShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static void
|
||||
winShadowUpdateDDNL (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf);
|
||||
|
||||
static Bool
|
||||
winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInitVisualsShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winAdjustVideoModeShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winBltExposedRegionsShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winActivateAppShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRedrawScreenShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInstallColormapShadowDDNL (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winStoreColorsShadowDDNL (ColormapPtr pmap,
|
||||
int ndef,
|
||||
xColorItem *pdefs);
|
||||
|
||||
static Bool
|
||||
winCreateColormapShadowDDNL (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winDestroyColormapShadowDDNL (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
|
||||
|
||||
|
||||
/*
|
||||
* Create the primary surface and attach the clipper.
|
||||
* Used for both the initial surface creation and during
|
||||
* WM_DISPLAYCHANGE messages.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
HRESULT ddrval = DD_OK;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
|
||||
winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
|
||||
|
||||
/* Describe the primary surface */
|
||||
ZeroMemory (&ddsd, sizeof (ddsd));
|
||||
|
@ -84,12 +145,12 @@ winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create primary "
|
||||
"surface: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if 1
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
|
||||
winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
|
||||
#endif
|
||||
|
||||
/* Attach our clipper to our primary surface handle */
|
||||
|
@ -99,12 +160,12 @@ winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper "
|
||||
"failed: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if 1
|
||||
ErrorF ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
|
||||
winDebug ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
|
||||
"surface\n");
|
||||
#endif
|
||||
|
||||
|
@ -118,12 +179,12 @@ winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
|
|||
* Called from WM_DISPLAYCHANGE.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
||||
ErrorF ("winReleasePrimarySurfaceShadowDDNL - Hello\n");
|
||||
winDebug ("winReleasePrimarySurfaceShadowDDNL - Hello\n");
|
||||
|
||||
/* Release the primary surface and clipper, if they exist */
|
||||
if (pScreenPriv->pddsPrimary4)
|
||||
|
@ -135,14 +196,14 @@ winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
|
|||
IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
|
||||
NULL);
|
||||
|
||||
ErrorF ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
|
||||
winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
|
||||
|
||||
/* Release the primary surface */
|
||||
IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
|
||||
pScreenPriv->pddsPrimary4 = NULL;
|
||||
}
|
||||
|
||||
ErrorF ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
|
||||
winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -167,7 +228,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
DDPIXELFORMAT ddpfPrimary;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDDNL - w %d h %d d %d\n",
|
||||
winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n",
|
||||
pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
|
||||
#endif
|
||||
|
||||
|
@ -192,12 +253,12 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDDNL - Created a clipper\n");
|
||||
winDebug ("winAllocateFBShadowDDNL - Created a clipper\n");
|
||||
#endif
|
||||
|
||||
/* Get a device context for the screen */
|
||||
|
@ -211,12 +272,12 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Clipper not attached "
|
||||
"to window: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDDNL - Attached clipper to window\n");
|
||||
winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n");
|
||||
#endif
|
||||
|
||||
/* Create a DirectDraw object, store the address at lpdd */
|
||||
|
@ -227,12 +288,12 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not start "
|
||||
"DirectDraw: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDDNL - Created and initialized DD\n");
|
||||
winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n");
|
||||
#endif
|
||||
|
||||
/* Get a DirectDraw4 interface pointer */
|
||||
|
@ -242,7 +303,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -262,7 +323,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not set "
|
||||
"cooperative level: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -282,7 +343,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not get current "
|
||||
"refresh rate: %08x. Continuing.\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
dwRefreshRateCurrent = 0;
|
||||
}
|
||||
else
|
||||
|
@ -316,7 +377,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
|| pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL)
|
||||
|| pScreenInfo->dwRefreshRate != 0))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Changing video mode\n");
|
||||
winDebug ("winAllocateFBShadowDDNL - Changing video mode\n");
|
||||
|
||||
/* Change the video mode to the mode requested */
|
||||
ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
|
||||
|
@ -329,13 +390,13 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not set "
|
||||
"full screen display mode: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Not changing video mode\n");
|
||||
winDebug ("winAllocateFBShadowDDNL - Not changing video mode\n");
|
||||
}
|
||||
|
||||
/* Release our DC */
|
||||
|
@ -352,7 +413,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not set "
|
||||
"cooperative level: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -374,12 +435,12 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not get primary "
|
||||
"pixformat: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
|
||||
winDebug ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
|
||||
"dwRGBBitCount: %d\n",
|
||||
ddpfPrimary.u2.dwRBitMask,
|
||||
ddpfPrimary.u3.dwGBitMask,
|
||||
|
@ -407,8 +468,8 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
ddsdShadow.lpSurface = lpSurface;
|
||||
ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary;
|
||||
|
||||
ErrorF ("winAllocateFBShadowDDNL - lPitch: %d\n",
|
||||
pScreenInfo->dwPaddedWidth);
|
||||
winDebug ("winAllocateFBShadowDDNL - lPitch: %d\n",
|
||||
(int) pScreenInfo->dwPaddedWidth);
|
||||
|
||||
/* Create the shadow surface */
|
||||
ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
|
||||
|
@ -418,13 +479,13 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowDDNL - Could not create shadow "
|
||||
"surface: %08x\n", ddrval);
|
||||
"surface: %08x\n", (unsigned int) ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
ErrorF ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
|
||||
ddsdShadow.u1.lPitch);
|
||||
winDebug ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
|
||||
(int) ddsdShadow.u1.lPitch);
|
||||
#endif
|
||||
|
||||
/* Grab the pitch from the surface desc */
|
||||
|
@ -432,8 +493,8 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
/ pScreenInfo->dwBPP;
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
ErrorF ("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
|
||||
pScreenInfo->dwStride);
|
||||
winDebug ("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
|
||||
(int) pScreenInfo->dwStride);
|
||||
#endif
|
||||
|
||||
/* Save the pointer to our surface memory */
|
||||
|
@ -445,18 +506,65 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
|
|||
pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowDDNL - Returning\n");
|
||||
winDebug ("winAllocateFBShadowDDNL - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a DirectDraw surface for the new multi-window window
|
||||
*/
|
||||
|
||||
static
|
||||
Bool
|
||||
winFinishCreateWindowsWindowDDNL (WindowPtr pWin)
|
||||
{
|
||||
winWindowPriv(pWin);
|
||||
winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
|
||||
HRESULT ddrval = DD_OK;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
int iWidth, iHeight;
|
||||
int iX, iY;
|
||||
|
||||
winDebug ("\nwinFinishCreateWindowsWindowDDNL!\n\n");
|
||||
|
||||
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
|
||||
iWidth = pWin->drawable.width;
|
||||
iHeight = pWin->drawable.height;
|
||||
|
||||
/* Describe the primary surface */
|
||||
ZeroMemory (&ddsd, sizeof (ddsd));
|
||||
ddsd.dwSize = sizeof (ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
ddsd.dwHeight = iHeight;
|
||||
ddsd.dwWidth = iWidth;
|
||||
|
||||
/* Create the primary surface */
|
||||
ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
|
||||
&ddsd,
|
||||
&pWinPriv->pddsPrimary4,
|
||||
NULL);
|
||||
if (FAILED (ddrval))
|
||||
{
|
||||
ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary "
|
||||
"surface: %08x\n",
|
||||
(unsigned int)ddrval);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transfer the damaged regions of the shadow framebuffer to the display.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
winShadowUpdateDDNL (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf)
|
||||
{
|
||||
|
@ -522,7 +630,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
|
|||
{
|
||||
ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () "
|
||||
"failed: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
|
||||
++s_iFailCount;
|
||||
|
||||
|
@ -530,7 +638,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
|
|||
{
|
||||
ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt "
|
||||
"failure message maximum (%d) reached. No "
|
||||
"more failure messages will be printed.",
|
||||
"more failure messages will be printed.\n",
|
||||
FAIL_MSG_MAX_BLT);
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +670,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
|
|||
hrgnCombined = NULL;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
|
||||
winDebug ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
|
||||
pBoxExtents->x1, pBoxExtents->y1,
|
||||
pBoxExtents->x2, pBoxExtents->y2);
|
||||
#endif
|
||||
|
@ -599,7 +707,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
|
|||
* Free our resources and private structures.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -607,7 +715,7 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
|
|||
Bool fReturn;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCloseScreenShadowDDNL - Freeing screen resources\n");
|
||||
winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n");
|
||||
#endif
|
||||
|
||||
/* Flag that the screen is closed */
|
||||
|
@ -685,8 +793,10 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
|
|||
pScreenPriv->hwndScreen = NULL;
|
||||
}
|
||||
|
||||
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
|
||||
/* Destroy the thread startup mutex */
|
||||
pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
|
||||
#endif
|
||||
|
||||
/* Kill our screeninfo's pointer to the screen */
|
||||
pScreenInfo->pScreen = NULL;
|
||||
|
@ -709,7 +819,7 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
|
|||
* to verify that last sentence.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInitVisualsShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -731,14 +841,14 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen)
|
|||
else
|
||||
pScreenPriv->dwBitsPerRGB = dwBlueBits;
|
||||
|
||||
ErrorF ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
|
||||
winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
|
||||
"bpp %d\n",
|
||||
pScreenPriv->dwRedMask,
|
||||
pScreenPriv->dwGreenMask,
|
||||
pScreenPriv->dwBlueMask,
|
||||
pScreenPriv->dwBitsPerRGB,
|
||||
pScreenInfo->dwDepth,
|
||||
pScreenInfo->dwBPP);
|
||||
(unsigned int) pScreenPriv->dwRedMask,
|
||||
(unsigned int) pScreenPriv->dwGreenMask,
|
||||
(unsigned int) pScreenPriv->dwBlueMask,
|
||||
(int) pScreenPriv->dwBitsPerRGB,
|
||||
(int) pScreenInfo->dwDepth,
|
||||
(int) pScreenInfo->dwBPP);
|
||||
|
||||
/* Create a single visual according to the Windows screen depth */
|
||||
switch (pScreenInfo->dwDepth)
|
||||
|
@ -761,7 +871,7 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if WIN_EMULATE_PSEUDO_SUPPORT
|
||||
#ifdef XWIN_EMULATEPSEUDO
|
||||
if (!pScreenInfo->fEmulatePseudo)
|
||||
break;
|
||||
|
||||
|
@ -793,7 +903,7 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if WIN_EMULATE_PSEUDO_SUPPORT
|
||||
#ifdef XWIN_EMULATEPSEUDO
|
||||
if (!pScreenInfo->fEmulatePseudo)
|
||||
break;
|
||||
|
||||
|
@ -851,7 +961,7 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInitVisualsShadowDDNL - Returning\n");
|
||||
winDebug ("winInitVisualsShadowDDNL - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -862,7 +972,7 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen)
|
|||
* Adjust the user proposed video mode
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -885,8 +995,8 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
|
|||
if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
|
||||
{
|
||||
/* No -depth parameter passed, let the user know the depth being used */
|
||||
ErrorF ("winAdjustVideoModeShadowDDNL - Using Windows display "
|
||||
"depth of %d bits per pixel\n", dwBPP);
|
||||
winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Using Windows display "
|
||||
"depth of %d bits per pixel\n", (int) dwBPP);
|
||||
|
||||
/* Use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -895,15 +1005,15 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
|
|||
&& pScreenInfo->dwBPP != dwBPP)
|
||||
{
|
||||
/* FullScreen, and GDI depth differs from -depth parameter */
|
||||
ErrorF ("winAdjustVideoModeShadowDDNL - FullScreen, using command "
|
||||
"line bpp: %d\n", pScreenInfo->dwBPP);
|
||||
winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - FullScreen, using command "
|
||||
"line bpp: %d\n", (int) pScreenInfo->dwBPP);
|
||||
}
|
||||
else if (dwBPP != pScreenInfo->dwBPP)
|
||||
{
|
||||
/* Windowed, and GDI depth differs from -depth parameter */
|
||||
ErrorF ("winAdjustVideoModeShadowDDNL - Windowed, command line "
|
||||
winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Windowed, command line "
|
||||
"bpp: %d, using bpp: %d\n",
|
||||
pScreenInfo->dwBPP, dwBPP);
|
||||
(int) pScreenInfo->dwBPP, (int) dwBPP);
|
||||
|
||||
/* We'll use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -913,7 +1023,7 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
|
|||
if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
|
||||
>= WIN_DIB_MAXIMUM_SIZE)
|
||||
{
|
||||
ErrorF ("winAdjustVideoModeShadowDDNL - Requested DirectDraw surface "
|
||||
winErrorFVerb (1, "winAdjustVideoModeShadowDDNL - Requested DirectDraw surface "
|
||||
"will be larger than %d MB. The surface may fail to be "
|
||||
"allocated on Windows 95, 98, or Me, due to a %d MB limit in "
|
||||
"DIB size. This limit does not apply to Windows NT/2000, and "
|
||||
|
@ -932,7 +1042,7 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
|
|||
* Blt exposed regions to the screen
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -986,29 +1096,29 @@ winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
|
|||
if (ddrval == DDERR_SURFACELOST)
|
||||
{
|
||||
/* Surface was lost */
|
||||
ErrorF ("winBltExposedRegionsShadowDDNL - IDirectDrawSurface4_Blt "
|
||||
"reported that the primary surface was lost, "
|
||||
"trying to restore, retry: %d\n", i + 1);
|
||||
winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
|
||||
"IDirectDrawSurface4_Blt reported that the primary "
|
||||
"surface was lost, trying to restore, retry: %d\n", i + 1);
|
||||
|
||||
/* Try to restore the surface, once */
|
||||
|
||||
ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
|
||||
ErrorF ("winBltExposedRegionsShadowDDNL - "
|
||||
winDebug ("winBltExposedRegionsShadowDDNL - "
|
||||
"IDirectDrawSurface4_Restore returned: ");
|
||||
if (ddrval == DD_OK)
|
||||
continue;
|
||||
winDebug ("DD_OK\n");
|
||||
else if (ddrval == DDERR_WRONGMODE)
|
||||
ErrorF ("DDERR_WRONGMODE\n");
|
||||
winDebug ("DDERR_WRONGMODE\n");
|
||||
else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
|
||||
ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n");
|
||||
winDebug ("DDERR_INCOMPATIBLEPRIMARY\n");
|
||||
else if (ddrval == DDERR_UNSUPPORTED)
|
||||
ErrorF ("DDERR_UNSUPPORTED\n");
|
||||
winDebug ("DDERR_UNSUPPORTED\n");
|
||||
else if (ddrval == DDERR_INVALIDPARAMS)
|
||||
ErrorF ("DDERR_INVALIDPARAMS\n");
|
||||
winDebug ("DDERR_INVALIDPARAMS\n");
|
||||
else if (ddrval == DDERR_INVALIDOBJECT)
|
||||
ErrorF ("DDERR_INVALIDOBJECT\n");
|
||||
winDebug ("DDERR_INVALIDOBJECT\n");
|
||||
else
|
||||
ErrorF ("unknown error: %08x\n", ddrval);
|
||||
winDebug ("unknown error: %08x\n", (unsigned int) ddrval);
|
||||
|
||||
/* Loop around to try the blit one more time */
|
||||
continue;
|
||||
|
@ -1016,8 +1126,10 @@ winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
|
|||
else if (FAILED (ddrval))
|
||||
{
|
||||
fReturn = FALSE;
|
||||
ErrorF ("winBltExposedRegionsShadowDDNL - IDirectDrawSurface4_Blt "
|
||||
"failed, but surface not lost: %08x %d\n", ddrval, ddrval);
|
||||
winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
|
||||
"IDirectDrawSurface4_Blt failed, but surface not "
|
||||
"lost: %08x %d\n",
|
||||
(unsigned int) ddrval, (int) ddrval);
|
||||
goto winBltExposedRegionsShadowDDNL_Exit;
|
||||
}
|
||||
else
|
||||
|
@ -1036,10 +1148,10 @@ winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
|
|||
|
||||
|
||||
/*
|
||||
* Do any engine-specific appliation-activation processing
|
||||
* Do any engine-specific application-activation processing
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winActivateAppShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -1065,7 +1177,7 @@ winActivateAppShadowDDNL (ScreenPtr pScreen)
|
|||
* Reblit the shadow framebuffer to the screen.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRedrawScreenShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -1102,7 +1214,7 @@ winRedrawScreenShadowDDNL (ScreenPtr pScreen)
|
|||
{
|
||||
ErrorF ("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () "
|
||||
"failed: %08x\n",
|
||||
ddrval);
|
||||
(unsigned int) ddrval);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1113,7 +1225,7 @@ winRedrawScreenShadowDDNL (ScreenPtr pScreen)
|
|||
* Realize the currently installed colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen)
|
||||
{
|
||||
return TRUE;
|
||||
|
@ -1124,7 +1236,7 @@ winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen)
|
|||
* Install the specified colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInstallColormapShadowDDNL (ColormapPtr pColormap)
|
||||
{
|
||||
ScreenPtr pScreen = pColormap->pScreen;
|
||||
|
@ -1153,7 +1265,7 @@ winInstallColormapShadowDDNL (ColormapPtr pColormap)
|
|||
* Store the specified colors in the specified colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winStoreColorsShadowDDNL (ColormapPtr pColormap,
|
||||
int ndef,
|
||||
xColorItem *pdefs)
|
||||
|
@ -1197,7 +1309,7 @@ winStoreColorsShadowDDNL (ColormapPtr pColormap,
|
|||
* Colormap initialization procedure
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCreateColormapShadowDDNL (ColormapPtr pColormap)
|
||||
{
|
||||
HRESULT ddrval = DD_OK;
|
||||
|
@ -1225,7 +1337,7 @@ winCreateColormapShadowDDNL (ColormapPtr pColormap)
|
|||
* Colormap destruction procedure
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winDestroyColormapShadowDDNL (ColormapPtr pColormap)
|
||||
{
|
||||
winScreenPriv(pColormap->pScreen);
|
||||
|
@ -1243,8 +1355,7 @@ winDestroyColormapShadowDDNL (ColormapPtr pColormap)
|
|||
if (pColormap->flags & IsDefault)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyColormapShadowDDNL - Destroying default "
|
||||
"colormap\n");
|
||||
winDebug ("winDestroyColormapShadowDDNL - Destroying default colormap\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1306,11 +1417,13 @@ winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen)
|
|||
pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
|
||||
pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
|
||||
pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
|
||||
pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
|
||||
pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
pScreenPriv->pwinFinishCreateWindowsWindow
|
||||
= winFinishCreateWindowsWindowDDNL;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*Copyright (C) 2001-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
|
||||
|
@ -15,29 +15,86 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.21 2002/10/17 08:18:25 alanh Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* External symbols
|
||||
*/
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
extern DWORD g_dwCurrentThreadID;
|
||||
#endif
|
||||
extern HWND g_hDlgExit;
|
||||
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
BOOL CALLBACK
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
static BOOL CALLBACK
|
||||
winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam);
|
||||
|
||||
static BOOL CALLBACK
|
||||
winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam);
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
winAllocateFBShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static void
|
||||
winShadowUpdateGDI (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf);
|
||||
|
||||
static Bool
|
||||
winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInitVisualsShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winAdjustVideoModeShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winBltExposedRegionsShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winActivateAppShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRedrawScreenShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen);
|
||||
|
||||
static Bool
|
||||
winInstallColormapShadowGDI (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winStoreColorsShadowGDI (ColormapPtr pmap,
|
||||
int ndef,
|
||||
xColorItem *pdefs);
|
||||
|
||||
static Bool
|
||||
winCreateColormapShadowGDI (ColormapPtr pColormap);
|
||||
|
||||
static Bool
|
||||
winDestroyColormapShadowGDI (ColormapPtr pColormap);
|
||||
|
||||
|
||||
/*
|
||||
* Internal function to get the DIB format that is compatible with the screen
|
||||
|
@ -82,7 +139,7 @@ winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih)
|
|||
/* Get a pointer to bitfields */
|
||||
pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
|
||||
|
||||
ErrorF ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
|
||||
winDebug ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
|
||||
pdw[0], pdw[1], pdw[2]);
|
||||
#endif
|
||||
|
||||
|
@ -169,27 +226,53 @@ winQueryRGBBitsAndMasks (ScreenPtr pScreen)
|
|||
pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winQueryRGBBitsAndMasks - Masks: %08x %08x %08x\n",
|
||||
winDebug ("%s - Masks: %08x %08x %08x\n", __FUNCTION__,
|
||||
pdw[0], pdw[1], pdw[2]);
|
||||
winDebug ("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__,
|
||||
pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes);
|
||||
winDebug ("%s - Compression: %d %s\n", __FUNCTION__,
|
||||
pbmih->biCompression,
|
||||
(pbmih->biCompression == BI_RGB?"(BI_RGB)":
|
||||
(pbmih->biCompression == BI_RLE8?"(BI_RLE8)":
|
||||
(pbmih->biCompression == BI_RLE4?"(BI_RLE4)":
|
||||
(pbmih->biCompression == BI_BITFIELDS?"(BI_BITFIELDS)":""
|
||||
)))));
|
||||
#endif
|
||||
|
||||
/* Count the number of bits in each mask */
|
||||
dwRedBits = winCountBits (pdw[0]);
|
||||
dwGreenBits = winCountBits (pdw[1]);
|
||||
dwBlueBits = winCountBits (pdw[2]);
|
||||
/* Handle BI_RGB case, which is returned by Wine */
|
||||
if (pbmih->biCompression == BI_RGB)
|
||||
{
|
||||
dwRedBits = 5;
|
||||
dwGreenBits = 5;
|
||||
dwBlueBits = 5;
|
||||
|
||||
pScreenPriv->dwBitsPerRGB = 5;
|
||||
|
||||
/* Set screen privates masks */
|
||||
pScreenPriv->dwRedMask = 0x7c00;
|
||||
pScreenPriv->dwGreenMask = 0x03e0;
|
||||
pScreenPriv->dwBlueMask = 0x001f;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Count the number of bits in each mask */
|
||||
dwRedBits = winCountBits (pdw[0]);
|
||||
dwGreenBits = winCountBits (pdw[1]);
|
||||
dwBlueBits = winCountBits (pdw[2]);
|
||||
|
||||
/* Find maximum bits per red, green, blue */
|
||||
if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
|
||||
pScreenPriv->dwBitsPerRGB = dwRedBits;
|
||||
else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
|
||||
pScreenPriv->dwBitsPerRGB = dwGreenBits;
|
||||
else
|
||||
pScreenPriv->dwBitsPerRGB = dwBlueBits;
|
||||
/* Find maximum bits per red, green, blue */
|
||||
if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
|
||||
pScreenPriv->dwBitsPerRGB = dwRedBits;
|
||||
else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
|
||||
pScreenPriv->dwBitsPerRGB = dwGreenBits;
|
||||
else
|
||||
pScreenPriv->dwBitsPerRGB = dwBlueBits;
|
||||
|
||||
/* Set screen privates masks */
|
||||
pScreenPriv->dwRedMask = pdw[0];
|
||||
pScreenPriv->dwGreenMask = pdw[1];
|
||||
pScreenPriv->dwBlueMask = pdw[2];
|
||||
/* Set screen privates masks */
|
||||
pScreenPriv->dwRedMask = pdw[0];
|
||||
pScreenPriv->dwGreenMask = pdw[1];
|
||||
pScreenPriv->dwBlueMask = pdw[2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -205,32 +288,59 @@ winQueryRGBBitsAndMasks (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/*
|
||||
* Redraw all ---?
|
||||
*/
|
||||
|
||||
BOOL CALLBACK
|
||||
static BOOL CALLBACK
|
||||
winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
char strClassName[100];
|
||||
if (hwnd == (HWND)lParam)
|
||||
return TRUE;
|
||||
InvalidateRect (hwnd, NULL, FALSE);
|
||||
UpdateWindow (hwnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (GetClassName (hwnd, strClassName, 100))
|
||||
static BOOL CALLBACK
|
||||
winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
BoxPtr pDamage = (BoxPtr)lParam;
|
||||
RECT rcClient, rcDamage, rcRedraw;
|
||||
POINT topLeft, bottomRight;
|
||||
|
||||
if (IsIconic (hwnd))
|
||||
return TRUE; /* Don't care minimized windows */
|
||||
|
||||
/* Convert the damaged area from Screen coords to Client coords */
|
||||
topLeft.x = pDamage->x1; topLeft.y = pDamage->y1;
|
||||
bottomRight.x = pDamage->x2; bottomRight.y = pDamage->y2;
|
||||
topLeft.x += GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
bottomRight.x += GetSystemMetrics (SM_XVIRTUALSCREEN);
|
||||
topLeft.y += GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
bottomRight.y += GetSystemMetrics (SM_YVIRTUALSCREEN);
|
||||
ScreenToClient (hwnd, &topLeft);
|
||||
ScreenToClient (hwnd, &bottomRight);
|
||||
SetRect (&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
|
||||
|
||||
GetClientRect (hwnd, &rcClient);
|
||||
|
||||
if (IntersectRect (&rcRedraw, &rcClient, &rcDamage))
|
||||
{
|
||||
if (strncmp (WINDOW_CLASS_X, strClassName, strlen (WINDOW_CLASS_X)) == 0)
|
||||
{
|
||||
InvalidateRect (hwnd, NULL, FALSE);
|
||||
UpdateWindow (hwnd);
|
||||
}
|
||||
InvalidateRect (hwnd, &rcRedraw, FALSE);
|
||||
UpdateWindow (hwnd);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Allocate a DIB for the shadow framebuffer GDI server
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAllocateFBShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -261,7 +371,7 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
|
||||
ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d "
|
||||
"depth: %d\n",
|
||||
pbmih->biWidth, -pbmih->biHeight, pbmih->biBitCount);
|
||||
(int) pbmih->biWidth, (int) -pbmih->biHeight, pbmih->biBitCount);
|
||||
|
||||
/* Create a DI shadow bitmap with a bit pointer */
|
||||
pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen,
|
||||
|
@ -272,13 +382,13 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
0);
|
||||
if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL)
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowGDI - CreateDIBSection failed\n");
|
||||
winW32Error (2, "winAllocateFBShadowGDI - CreateDIBSection failed:");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowGDI - Shadow buffer allocated\n");
|
||||
winDebug ("winAllocateFBShadowGDI - Shadow buffer allocated\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -289,11 +399,11 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
|
||||
#if CYGDEBUG || YES
|
||||
/* Print information about bitmap allocated */
|
||||
ErrorF ("winAllocateFBShadowGDI - Dibsection width: %d height: %d "
|
||||
winDebug ("winAllocateFBShadowGDI - Dibsection width: %d height: %d "
|
||||
"depth: %d size image: %d\n",
|
||||
dibsection.dsBmih.biWidth, dibsection.dsBmih.biHeight,
|
||||
(int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight,
|
||||
dibsection.dsBmih.biBitCount,
|
||||
dibsection.dsBmih.biSizeImage);
|
||||
(int) dibsection.dsBmih.biSizeImage);
|
||||
#endif
|
||||
|
||||
/* Select the shadow bitmap into the shadow DC */
|
||||
|
@ -301,7 +411,7 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
pScreenPriv->hbmpShadow);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowGDI - Attempting a shadow blit\n");
|
||||
winDebug ("winAllocateFBShadowGDI - Attempting a shadow blit\n");
|
||||
#endif
|
||||
|
||||
/* Do a test blit from the shadow to the screen, I think */
|
||||
|
@ -314,23 +424,25 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
if (fReturn)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAllocateFBShadowGDI - Shadow blit success\n");
|
||||
winDebug ("winAllocateFBShadowGDI - Shadow blit success\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorF ("winAllocateFBShadowGDI - Shadow blit failure\n");
|
||||
winW32Error (2, "winAllocateFBShadowGDI - Shadow blit failure\n");
|
||||
#if 0
|
||||
return FALSE;
|
||||
#else
|
||||
/* ago: ignore this error. The blit fails with wine, but does not
|
||||
* cause any problems later. */
|
||||
|
||||
fReturn = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Look for height weirdness */
|
||||
if (dibsection.dsBmih.biHeight < 0)
|
||||
{
|
||||
/* FIXME: Figure out why biHeight is sometimes negative */
|
||||
ErrorF ("winAllocateFBShadowGDI - WEIRDNESS - biHeight "
|
||||
"still negative: %d\n"
|
||||
"winAllocateFBShadowGDI - WEIRDNESS - Flipping biHeight sign\n",
|
||||
dibsection.dsBmih.biHeight);
|
||||
dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
|
||||
}
|
||||
|
||||
|
@ -340,8 +452,8 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
* 8) / pScreenInfo->dwBPP;
|
||||
|
||||
#if CYGDEBUG || YES
|
||||
ErrorF ("winAllocateFBShadowGDI - Created shadow stride: %d\n",
|
||||
pScreenInfo->dwStride);
|
||||
winDebug ("winAllocateFBShadowGDI - Created shadow stride: %d\n",
|
||||
(int) pScreenInfo->dwStride);
|
||||
#endif
|
||||
|
||||
/* See if the shadow bitmap will be larger than the DIB size limit */
|
||||
|
@ -363,8 +475,11 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Redraw all windows */
|
||||
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
|
||||
#endif
|
||||
|
||||
return fReturn;
|
||||
}
|
||||
|
@ -374,7 +489,7 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
|
|||
* Blit the damaged regions of the shadow fb to the screen
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
winShadowUpdateGDI (ScreenPtr pScreen,
|
||||
shadowBufPtr pBuf)
|
||||
{
|
||||
|
@ -385,11 +500,12 @@ winShadowUpdateGDI (ScreenPtr pScreen,
|
|||
BoxPtr pBox = REGION_RECTS (damage);
|
||||
int x, y, w, h;
|
||||
HRGN hrgnTemp = NULL, hrgnCombined = NULL;
|
||||
#if WIN_UPDATE_STATS
|
||||
#ifdef XWIN_UPDATESTATS
|
||||
static DWORD s_dwNonUnitRegions = 0;
|
||||
static DWORD s_dwTotalUpdates = 0;
|
||||
static DWORD s_dwTotalBoxes = 0;
|
||||
#endif
|
||||
BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage);
|
||||
|
||||
/*
|
||||
* Return immediately if the app is not active
|
||||
|
@ -398,7 +514,7 @@ winShadowUpdateGDI (ScreenPtr pScreen,
|
|||
if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
|
||||
|| pScreenPriv->fBadDepth) return;
|
||||
|
||||
#if WIN_UPDATE_STATS
|
||||
#ifdef XWIN_UPDATESTATS
|
||||
++s_dwTotalUpdates;
|
||||
s_dwTotalBoxes += dwBox;
|
||||
|
||||
|
@ -414,7 +530,7 @@ winShadowUpdateGDI (ScreenPtr pScreen,
|
|||
(s_dwNonUnitRegions * 100) / s_dwTotalUpdates,
|
||||
s_dwTotalBoxes / s_dwTotalUpdates,
|
||||
s_dwNonUnitRegions, s_dwTotalUpdates);
|
||||
#endif /* WIN_UPDATE_STATS */
|
||||
#endif /* XWIN_UPDATESTATS */
|
||||
|
||||
/*
|
||||
* Handle small regions with multiple blits,
|
||||
|
@ -449,8 +565,6 @@ winShadowUpdateGDI (ScreenPtr pScreen,
|
|||
}
|
||||
else
|
||||
{
|
||||
BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage);
|
||||
|
||||
/* Compute a GDI region from the damaged region */
|
||||
hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
|
||||
dwBox--;
|
||||
|
@ -484,8 +598,13 @@ winShadowUpdateGDI (ScreenPtr pScreen,
|
|||
SelectClipRgn (pScreenPriv->hdcScreen, NULL);
|
||||
}
|
||||
|
||||
/* Redraw all windows */
|
||||
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Redraw all multiwindow windows */
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
EnumThreadWindows (g_dwCurrentThreadID,
|
||||
winRedrawDamagedWindowShadowGDI,
|
||||
(LPARAM)pBoxExtents);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -495,7 +614,7 @@ winShadowUpdateGDI (ScreenPtr pScreen,
|
|||
* a pointer to said procedure is stored in our privates.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -503,7 +622,7 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
|
|||
Bool fReturn;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCloseScreenShadowGDI - Freeing screen resources\n");
|
||||
winDebug ("winCloseScreenShadowGDI - Freeing screen resources\n");
|
||||
#endif
|
||||
|
||||
/* Flag that the screen is closed */
|
||||
|
@ -544,8 +663,10 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
|
|||
pScreenPriv->hwndScreen = NULL;
|
||||
}
|
||||
|
||||
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
|
||||
/* Destroy the thread startup mutex */
|
||||
pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
|
||||
#endif
|
||||
|
||||
/* Invalidate our screeninfo's pointer to the screen */
|
||||
pScreenInfo->pScreen = NULL;
|
||||
|
@ -568,7 +689,7 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
|
|||
* to verify that last sentence.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInitVisualsShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -577,12 +698,12 @@ winInitVisualsShadowGDI (ScreenPtr pScreen)
|
|||
/* Display debugging information */
|
||||
ErrorF ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d "
|
||||
"bpp %d\n",
|
||||
pScreenPriv->dwRedMask,
|
||||
pScreenPriv->dwGreenMask,
|
||||
pScreenPriv->dwBlueMask,
|
||||
pScreenPriv->dwBitsPerRGB,
|
||||
pScreenInfo->dwDepth,
|
||||
pScreenInfo->dwBPP);
|
||||
(unsigned int) pScreenPriv->dwRedMask,
|
||||
(unsigned int) pScreenPriv->dwGreenMask,
|
||||
(unsigned int) pScreenPriv->dwBlueMask,
|
||||
(int) pScreenPriv->dwBitsPerRGB,
|
||||
(int) pScreenInfo->dwDepth,
|
||||
(int) pScreenInfo->dwBPP);
|
||||
|
||||
/* Create a single visual according to the Windows screen depth */
|
||||
switch (pScreenInfo->dwDepth)
|
||||
|
@ -605,7 +726,7 @@ winInitVisualsShadowGDI (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if WIN_EMULATE_PSEUDO_SUPPORT
|
||||
#ifdef XWIN_EMULATEPSEUDO
|
||||
if (!pScreenInfo->fEmulatePseudo)
|
||||
break;
|
||||
|
||||
|
@ -637,7 +758,7 @@ winInitVisualsShadowGDI (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if WIN_EMULATE_PSEUDO_SUPPORT
|
||||
#ifdef XWIN_EMULATEPSEUDO
|
||||
if (!pScreenInfo->fEmulatePseudo)
|
||||
break;
|
||||
|
||||
|
@ -692,7 +813,7 @@ winInitVisualsShadowGDI (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winInitVisualsShadowGDI - Returning\n");
|
||||
winDebug ("winInitVisualsShadowGDI - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -703,7 +824,7 @@ winInitVisualsShadowGDI (ScreenPtr pScreen)
|
|||
* Adjust the proposed video mode
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -728,7 +849,7 @@ winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
|
|||
{
|
||||
/* No -depth parameter passed, let the user know the depth being used */
|
||||
ErrorF ("winAdjustVideoModeShadowGDI - Using Windows display "
|
||||
"depth of %d bits per pixel\n", dwBPP);
|
||||
"depth of %d bits per pixel\n", (int) dwBPP);
|
||||
|
||||
/* Use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -737,7 +858,7 @@ winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
|
|||
{
|
||||
/* Warn user if GDI depth is different than -depth parameter */
|
||||
ErrorF ("winAdjustVideoModeShadowGDI - Command line bpp: %d, "\
|
||||
"using bpp: %d\n", pScreenInfo->dwBPP, dwBPP);
|
||||
"using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP);
|
||||
|
||||
/* We'll use GDI's depth */
|
||||
pScreenInfo->dwBPP = dwBPP;
|
||||
|
@ -755,7 +876,7 @@ winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
|
|||
* Blt exposed regions to the screen
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winBltExposedRegionsShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -787,8 +908,12 @@ winBltExposedRegionsShadowGDI (ScreenPtr pScreen)
|
|||
/* EndPaint frees the DC */
|
||||
EndPaint (pScreenPriv->hwndScreen, &ps);
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Redraw all windows */
|
||||
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI,
|
||||
(LPARAM)pScreenPriv->hwndScreen);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -798,15 +923,22 @@ winBltExposedRegionsShadowGDI (ScreenPtr pScreen)
|
|||
* Do any engine-specific appliation-activation processing
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winActivateAppShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winActivateAppShadowGDI\n");
|
||||
#endif
|
||||
/*
|
||||
* 2004/04/12 - Harold - We perform the restoring or minimizing
|
||||
* manually for ShadowGDI in fullscreen modes so that this engine
|
||||
* will perform just like ShadowDD and ShadowDDNL in fullscreen mode;
|
||||
* if we do not do this then our fullscreen window will appear in the
|
||||
* z-order when it is deactivated and it can be uncovered by resizing
|
||||
* or minimizing another window that is on top of it, which is not how
|
||||
* the DirectDraw engines work. Therefore we keep this code here to
|
||||
* make sure that all engines work the same in fullscreen mode.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Are we active?
|
||||
|
@ -831,10 +963,6 @@ winActivateAppShadowGDI (ScreenPtr pScreen)
|
|||
ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
|
||||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winActivateAppShadowGDI - Returning\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -843,7 +971,7 @@ winActivateAppShadowGDI (ScreenPtr pScreen)
|
|||
* Reblit the shadow framebuffer to the screen.
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRedrawScreenShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
@ -857,31 +985,36 @@ winRedrawScreenShadowGDI (ScreenPtr pScreen)
|
|||
0, 0,
|
||||
SRCCOPY);
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Redraw all windows */
|
||||
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Realize the currently installed colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
winPrivCmapPtr pCmapPriv = NULL;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winRealizeInstalledPaletteShadowGDI\n");
|
||||
winDebug ("winRealizeInstalledPaletteShadowGDI\n");
|
||||
#endif
|
||||
|
||||
/* Don't do anything if there is not a colormap */
|
||||
if (pScreenPriv->pcmapInstalled == NULL)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winRealizeInstalledPaletteShadowGDI - No colormap "
|
||||
winDebug ("winRealizeInstalledPaletteShadowGDI - No colormap "
|
||||
"installed\n");
|
||||
#endif
|
||||
return TRUE;
|
||||
|
@ -916,7 +1049,7 @@ winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen)
|
|||
* Install the specified colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winInstallColormapShadowGDI (ColormapPtr pColormap)
|
||||
{
|
||||
ScreenPtr pScreen = pColormap->pScreen;
|
||||
|
@ -963,8 +1096,11 @@ winInstallColormapShadowGDI (ColormapPtr pColormap)
|
|||
/* Save a pointer to the newly installed colormap */
|
||||
pScreenPriv->pcmapInstalled = pColormap;
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Redraw all windows */
|
||||
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -974,7 +1110,7 @@ winInstallColormapShadowGDI (ColormapPtr pColormap)
|
|||
* Store the specified colors in the specified colormap
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winStoreColorsShadowGDI (ColormapPtr pColormap,
|
||||
int ndef,
|
||||
xColorItem *pdefs)
|
||||
|
@ -1034,7 +1170,7 @@ winStoreColorsShadowGDI (ColormapPtr pColormap,
|
|||
* Colormap initialization procedure
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winCreateColormapShadowGDI (ColormapPtr pColormap)
|
||||
{
|
||||
LPLOGPALETTE lpPaletteNew = NULL;
|
||||
|
@ -1056,7 +1192,7 @@ winCreateColormapShadowGDI (ColormapPtr pColormap)
|
|||
{
|
||||
ErrorF ("winCreateColormapShadowGDI - Couldn't allocate palette "
|
||||
"with %d entries\n",
|
||||
dwEntriesMax);
|
||||
(int) dwEntriesMax);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1227,7 @@ winCreateColormapShadowGDI (ColormapPtr pColormap)
|
|||
* Colormap destruction procedure
|
||||
*/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
winDestroyColormapShadowGDI (ColormapPtr pColormap)
|
||||
{
|
||||
winScreenPriv(pColormap->pScreen);
|
||||
|
@ -1108,7 +1244,7 @@ winDestroyColormapShadowGDI (ColormapPtr pColormap)
|
|||
if (pColormap->flags & IsDefault)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyColormapShadowGDI - Destroying default "
|
||||
winDebug ("winDestroyColormapShadowGDI - Destroying default "
|
||||
"colormap\n");
|
||||
#endif
|
||||
|
||||
|
@ -1170,11 +1306,15 @@ winSetEngineFunctionsShadowGDI (ScreenPtr pScreen)
|
|||
pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI;
|
||||
pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI;
|
||||
pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
|
||||
pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
|
||||
pScreenPriv->pwinCreatePrimarySurface
|
||||
= (winCreatePrimarySurfaceProcPtr) (void (*)())NoopDDA;
|
||||
= (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
|
||||
pScreenPriv->pwinReleasePrimarySurface
|
||||
= (winReleasePrimarySurfaceProcPtr) (void (*)())NoopDDA;
|
||||
= (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
pScreenPriv->pwinFinishCreateWindowsWindow =
|
||||
(winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -49,12 +49,7 @@ winInitNotifyIcon (winPrivScreenPtr pScreenPriv)
|
|||
nid.uID = pScreenInfo->dwScreen;
|
||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||
nid.uCallbackMessage = WM_TRAYICON;
|
||||
nid.hIcon = LoadImage (g_hInstance,
|
||||
MAKEINTRESOURCE(IDI_XWIN),
|
||||
IMAGE_ICON,
|
||||
GetSystemMetrics (SM_CXSMICON),
|
||||
GetSystemMetrics (SM_CYSMICON),
|
||||
0);
|
||||
nid.hIcon = (HICON)winTaskbarIcon ();
|
||||
|
||||
/* Save handle to the icon so it can be freed later */
|
||||
pScreenPriv->hiconNotifyIcon = nid.hIcon;
|
||||
|
@ -143,41 +138,33 @@ winHandleIconMessage (HWND hwnd, UINT message,
|
|||
/* Get actual tray icon menu */
|
||||
hmenuTray = GetSubMenu (hmenuPopup, 0);
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
/* Check for MultiWindow mode */
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
{
|
||||
/* Check if root window is shown or hidden */
|
||||
MENUITEMINFO mii = {0};
|
||||
|
||||
/* Root is shown, remove the check box */
|
||||
|
||||
/* Setup menu item info structure */
|
||||
mii.cbSize = sizeof (MENUITEMINFO);
|
||||
mii.fMask = MIIM_STATE;
|
||||
mii.fState = MFS_CHECKED;
|
||||
|
||||
/* Unheck box if root is shown */
|
||||
if (pScreenPriv->fRootWindowShown)
|
||||
{
|
||||
/* Remove Show Root Window button */
|
||||
RemoveMenu (hmenuTray,
|
||||
ID_APP_SHOW_ROOT,
|
||||
MF_BYCOMMAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove Hide Root Window button */
|
||||
RemoveMenu (hmenuTray,
|
||||
ID_APP_HIDE_ROOT,
|
||||
MF_BYCOMMAND);
|
||||
}
|
||||
mii.fState = MFS_UNCHECKED;
|
||||
|
||||
/* Set menu state */
|
||||
SetMenuItemInfo (hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Remove Show Root Window button */
|
||||
RemoveMenu (hmenuTray,
|
||||
ID_APP_SHOW_ROOT,
|
||||
MF_BYCOMMAND);
|
||||
|
||||
/* Remove Hide Root Window button */
|
||||
RemoveMenu (hmenuTray,
|
||||
ID_APP_HIDE_ROOT,
|
||||
MF_BYCOMMAND);
|
||||
|
||||
/* Remove separator */
|
||||
RemoveMenu (hmenuTray,
|
||||
0,
|
||||
MF_BYPOSITION);
|
||||
}
|
||||
|
||||
SetupRootMenu ((unsigned long)hmenuTray);
|
||||
|
|
185
hw/xwin/winvalargs.c
Executable file
185
hw/xwin/winvalargs.c
Executable file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
*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
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
#include "winmsg.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern int g_iNumScreens;
|
||||
extern winScreenInfo g_ScreenInfo[];
|
||||
extern Bool g_fXdmcpEnabled;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
||||
Bool
|
||||
winValidateArgs (void);
|
||||
|
||||
|
||||
/*
|
||||
* winValidateArgs - Look for invalid argument combinations
|
||||
*/
|
||||
|
||||
Bool
|
||||
winValidateArgs (void)
|
||||
{
|
||||
int i;
|
||||
int iMaxConsecutiveScreen = 0;
|
||||
BOOL fHasNormalScreen0 = FALSE;
|
||||
|
||||
/*
|
||||
* Check for a malformed set of -screen parameters.
|
||||
* Examples of malformed parameters:
|
||||
* XWin -screen 1
|
||||
* XWin -screen 0 -screen 2
|
||||
* XWin -screen 1 -screen 2
|
||||
*/
|
||||
for (i = 0; i < MAXSCREENS; i++)
|
||||
{
|
||||
if (g_ScreenInfo[i].fExplicitScreen)
|
||||
iMaxConsecutiveScreen = i + 1;
|
||||
}
|
||||
winErrorFVerb (2, "winValidateArgs - g_iNumScreens: %d "
|
||||
"iMaxConsecutiveScreen: %d\n",
|
||||
g_iNumScreens, iMaxConsecutiveScreen);
|
||||
if (g_iNumScreens < iMaxConsecutiveScreen)
|
||||
{
|
||||
ErrorF ("winValidateArgs - Malformed set of screen parameter(s). "
|
||||
"Screens must be specified consecutively starting with "
|
||||
"screen 0. That is, you cannot have only a screen 1, nor "
|
||||
"could you have screen 0 and screen 2. You instead must "
|
||||
"have screen 0, or screen 0 and screen 1, respectively. Of "
|
||||
"you can specify as many screens as you want from 0 up to "
|
||||
"%d.\n", MAXSCREENS - 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Loop through all screens */
|
||||
for (i = 0; i < g_iNumScreens; ++i)
|
||||
{
|
||||
/*
|
||||
* Check for any combination of
|
||||
* -multiwindow, -mwextwm, and -rootless.
|
||||
*/
|
||||
{
|
||||
int iCount = 0;
|
||||
|
||||
/* Count conflicting options */
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
if (g_ScreenInfo[i].fMultiWindow)
|
||||
++iCount;
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
if (g_ScreenInfo[i].fMWExtWM)
|
||||
++iCount;
|
||||
#endif
|
||||
if (g_ScreenInfo[i].fRootless)
|
||||
++iCount;
|
||||
|
||||
/* Check if the first screen is without rootless and multiwindow */
|
||||
if (iCount == 0 && i == 0)
|
||||
fHasNormalScreen0 = TRUE;
|
||||
|
||||
/* Fail if two or more conflicting options */
|
||||
if (iCount > 1)
|
||||
{
|
||||
ErrorF ("winValidateArgs - Only one of -multiwindow, -mwextwm, "
|
||||
"and -rootless can be specific at a time.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for -multiwindow or -mwextwm and Xdmcp */
|
||||
/* allow xdmcp if screen 0 is normal. */
|
||||
if (g_fXdmcpEnabled && !fHasNormalScreen0
|
||||
&& (FALSE
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| g_ScreenInfo[i].fMultiWindow
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| g_ScreenInfo[i].fMWExtWM
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
ErrorF ("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
|
||||
"is invalid with -multiwindow or -mwextwm.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
|
||||
if (g_ScreenInfo[i].fFullScreen
|
||||
&& (FALSE
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| g_ScreenInfo[i].fMultiWindow
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| g_ScreenInfo[i].fMWExtWM
|
||||
#endif
|
||||
|| g_ScreenInfo[i].fRootless)
|
||||
)
|
||||
{
|
||||
ErrorF ("winValidateArgs - -fullscreen is invalid with "
|
||||
"-multiwindow, -mwextwm, or -rootless.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check for !fullscreen and any fullscreen-only parameters */
|
||||
if (!g_ScreenInfo[i].fFullScreen
|
||||
&& (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_BPP
|
||||
|| g_ScreenInfo[i].dwBPP != WIN_DEFAULT_REFRESH))
|
||||
{
|
||||
ErrorF ("winValidateArgs - -refresh and -depth are only valid "
|
||||
"with -fullscreen.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check for fullscreen and any non-fullscreen parameters */
|
||||
if (g_ScreenInfo[i].fFullScreen
|
||||
&& (g_ScreenInfo[i].fScrollbars
|
||||
|| !g_ScreenInfo[i].fDecoration
|
||||
|| g_ScreenInfo[i].fLessPointer))
|
||||
{
|
||||
ErrorF ("winValidateArgs - -fullscreen is invalid with "
|
||||
"-scrollbars, -nodecoration, or -lesspointer.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
winDebug ("winValidateArgs - Returning.\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*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
|
||||
|
@ -15,24 +15,25 @@
|
|||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*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 the XFree86 Project
|
||||
*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 the XFree86 Project.
|
||||
*from Harold L Hunt II.
|
||||
*
|
||||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winvideo.c,v 1.1tsi Exp $ */
|
||||
|
||||
#include "win.h"
|
||||
#include "Xv.h"
|
||||
#include "Xvproto.h"
|
||||
|
||||
void
|
||||
winInitVideo (ScreenPtr pScreen);
|
||||
|
||||
/*
|
||||
* winInitVideo - Initialize support for the X Video (Xv) Extension.
|
||||
|
|
|
@ -34,6 +34,16 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern HWND g_hDlgDepthChange;
|
||||
extern HWND g_hDlgExit;
|
||||
extern HWND g_hDlgAbout;
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 7 */
|
||||
void
|
||||
winWakeupHandler (int nScreen,
|
||||
|
@ -41,9 +51,7 @@ winWakeupHandler (int nScreen,
|
|||
unsigned long ulResult,
|
||||
pointer pReadmask)
|
||||
{
|
||||
#if 0
|
||||
winScreenPriv((ScreenPtr)pWakeupData);
|
||||
#endif
|
||||
MSG msg;
|
||||
|
||||
/* Process all messages on our queue */
|
||||
|
@ -52,12 +60,11 @@ winWakeupHandler (int nScreen,
|
|||
if ((g_hDlgDepthChange == 0
|
||||
|| !IsDialogMessage (g_hDlgDepthChange, &msg))
|
||||
&& (g_hDlgExit == 0
|
||||
|| !IsDialogMessage (g_hDlgExit, &msg)))
|
||||
|| !IsDialogMessage (g_hDlgExit, &msg))
|
||||
&& (g_hDlgAbout == 0
|
||||
|| !IsDialogMessage (g_hDlgAbout, &msg)))
|
||||
{
|
||||
DispatchMessage (&msg);
|
||||
}
|
||||
}
|
||||
winReorderWindowsMultiWindow ((ScreenPtr)pWakeupData);
|
||||
}
|
||||
|
||||
|
||||
|
|
1035
hw/xwin/winwin32rootless.c
Executable file
1035
hw/xwin/winwin32rootless.c
Executable file
File diff suppressed because it is too large
Load Diff
184
hw/xwin/winwin32rootlesswindow.c
Executable file
184
hw/xwin/winwin32rootlesswindow.c
Executable file
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
*Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
*"Software"), to deal in the Software without restriction, including
|
||||
*without limitation the rights to use, copy, modify, merge, publish,
|
||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
||||
*permit persons to whom the Software is furnished to do so, subject to
|
||||
*the following conditions:
|
||||
*
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*Except as contained in this notice, the name of the XFree86 Project
|
||||
*shall not be used in advertising or otherwise to promote the sale, use
|
||||
*or other dealings in this Software without prior written authorization
|
||||
*from the XFree86 Project.
|
||||
*
|
||||
* Authors: Kensuke Matsuzaki
|
||||
* Earle F. Philhower, III
|
||||
* Harold L Hunt II
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
#include "winprefs.h"
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* winMWExtWMReorderWindows
|
||||
*/
|
||||
|
||||
void
|
||||
winMWExtWMReorderWindows (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
HWND hwnd = NULL;
|
||||
win32RootlessWindowPtr pRLWin = NULL;
|
||||
win32RootlessWindowPtr pRLWinSib = NULL;
|
||||
DWORD dwCurrentProcessID = GetCurrentProcessId ();
|
||||
DWORD dwWindowProcessID = 0;
|
||||
XID vlist[2];
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG && FALSE
|
||||
ErrorF ("winMWExtWMReorderWindows\n");
|
||||
#endif
|
||||
|
||||
pScreenPriv->fRestacking = TRUE;
|
||||
|
||||
if (pScreenPriv->fWindowOrderChanged)
|
||||
{
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winMWExtWMReorderWindows - Need to restack\n");
|
||||
#endif
|
||||
hwnd = GetTopWindow (NULL);
|
||||
|
||||
while (hwnd)
|
||||
{
|
||||
GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
|
||||
|
||||
if ((dwWindowProcessID == dwCurrentProcessID)
|
||||
&& GetProp (hwnd, WIN_WINDOW_PROP))
|
||||
{
|
||||
pRLWinSib = pRLWin;
|
||||
pRLWin = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP);
|
||||
|
||||
if (pRLWinSib)
|
||||
{
|
||||
vlist[0] = pRLWinSib->pFrame->win->drawable.id;
|
||||
vlist[1] = Below;
|
||||
|
||||
ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode,
|
||||
vlist, wClient(pRLWin->pFrame->win));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 1st window - raise to the top */
|
||||
vlist[0] = Above;
|
||||
|
||||
ConfigureWindow (pRLWin->pFrame->win, CWStackMode,
|
||||
vlist, wClient(pRLWin->pFrame->win));
|
||||
}
|
||||
}
|
||||
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
|
||||
}
|
||||
}
|
||||
|
||||
pScreenPriv->fRestacking = FALSE;
|
||||
pScreenPriv->fWindowOrderChanged = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* winMWExtWMMoveXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winMWExtWMResizeXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = w;
|
||||
(CARD32*)vlist[1] = h;
|
||||
ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winMWExtWMMoveResizeXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*4);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
(CARD32*)vlist[2] = w;
|
||||
(CARD32*)vlist[3] = h;
|
||||
|
||||
ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winMWExtWMUpdateIcon
|
||||
* Change the Windows window icon
|
||||
*/
|
||||
|
||||
void
|
||||
winMWExtWMUpdateIcon (Window id)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
HICON hIcon, hiconOld;
|
||||
|
||||
pWin = LookupIDByType (id, RT_WINDOW);
|
||||
hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
|
||||
|
||||
if (!hIcon)
|
||||
hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
|
||||
|
||||
if (hIcon)
|
||||
{
|
||||
win32RootlessWindowPtr pRLWinPriv
|
||||
= (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
|
||||
|
||||
if (pRLWinPriv->hWnd)
|
||||
{
|
||||
hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd,
|
||||
GCL_HICON,
|
||||
(int) hIcon);
|
||||
|
||||
winDestroyIcon(hiconOld);
|
||||
}
|
||||
}
|
||||
}
|
1162
hw/xwin/winwin32rootlesswndproc.c
Executable file
1162
hw/xwin/winwin32rootlesswndproc.c
Executable file
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "win.h"
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for local functions
|
||||
*/
|
||||
|
@ -41,15 +42,16 @@ winAddRgn (WindowPtr pWindow, pointer data);
|
|||
|
||||
static
|
||||
void
|
||||
winUpdateRgnPRootless (WindowPtr pWindow);
|
||||
winUpdateRgnRootless (WindowPtr pWindow);
|
||||
|
||||
#ifdef SHAPE
|
||||
static
|
||||
void
|
||||
winReshapePRootless (WindowPtr pWin);
|
||||
winReshapeRootless (WindowPtr pWin);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XWIN_NATIVEGDI
|
||||
/* See Porting Layer Definition - p. 37 */
|
||||
/* See mfb/mfbwindow.c - mfbCreateWindow() */
|
||||
|
||||
|
@ -212,19 +214,20 @@ winMapWindowNativeGDI (WindowPtr pWindow)
|
|||
return TRUE;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* See Porting Layer Definition - p. 37 */
|
||||
/* See mfb/mfbwindow.c - mfbCreateWindow() */
|
||||
|
||||
Bool
|
||||
winCreateWindowPRootless (WindowPtr pWin)
|
||||
winCreateWindowRootless (WindowPtr pWin)
|
||||
{
|
||||
Bool fResult = FALSE;
|
||||
winWindowPriv(pWin);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winCreateWindowPRootless ()\n");
|
||||
winDebug ("winCreateWindowRootless ()\n");
|
||||
#endif
|
||||
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->CreateWindow(pWin);
|
||||
|
@ -239,13 +242,13 @@ winCreateWindowPRootless (WindowPtr pWin)
|
|||
/* See mfb/mfbwindow.c - mfbDestroyWindow() */
|
||||
|
||||
Bool
|
||||
winDestroyWindowPRootless (WindowPtr pWin)
|
||||
winDestroyWindowRootless (WindowPtr pWin)
|
||||
{
|
||||
Bool fResult = FALSE;
|
||||
winWindowPriv(pWin);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winDestroyWindowPRootless ()\n");
|
||||
winDebug ("winDestroyWindowRootless ()\n");
|
||||
#endif
|
||||
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->DestroyWindow(pWin);
|
||||
|
@ -256,7 +259,7 @@ winDestroyWindowPRootless (WindowPtr pWin)
|
|||
pWinPriv->hRgn = NULL;
|
||||
}
|
||||
|
||||
winUpdateRgnPRootless (pWin);
|
||||
winUpdateRgnRootless (pWin);
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
@ -266,17 +269,17 @@ winDestroyWindowPRootless (WindowPtr pWin)
|
|||
/* See mfb/mfbwindow.c - mfbPositionWindow() */
|
||||
|
||||
Bool
|
||||
winPositionWindowPRootless (WindowPtr pWin, int x, int y)
|
||||
winPositionWindowRootless (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
Bool fResult = FALSE;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winPositionWindowPRootless ()\n");
|
||||
winDebug ("winPositionWindowRootless ()\n");
|
||||
#endif
|
||||
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->PositionWindow(pWin, x, y);
|
||||
|
||||
winUpdateRgnPRootless (pWin);
|
||||
winUpdateRgnRootless (pWin);
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
@ -286,17 +289,17 @@ winPositionWindowPRootless (WindowPtr pWin, int x, int y)
|
|||
/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
|
||||
|
||||
Bool
|
||||
winChangeWindowAttributesPRootless (WindowPtr pWin, unsigned long mask)
|
||||
winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask)
|
||||
{
|
||||
Bool fResult = FALSE;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winChangeWindowAttributesPRootless ()\n");
|
||||
winDebug ("winChangeWindowAttributesRootless ()\n");
|
||||
#endif
|
||||
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->ChangeWindowAttributes(pWin, mask);
|
||||
|
||||
winUpdateRgnPRootless (pWin);
|
||||
winUpdateRgnRootless (pWin);
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
@ -307,13 +310,13 @@ winChangeWindowAttributesPRootless (WindowPtr pWin, unsigned long mask)
|
|||
*/
|
||||
|
||||
Bool
|
||||
winUnmapWindowPRootless (WindowPtr pWin)
|
||||
winUnmapWindowRootless (WindowPtr pWin)
|
||||
{
|
||||
Bool fResult = FALSE;
|
||||
winWindowPriv(pWin);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winUnmapWindowPRootless ()\n");
|
||||
winDebug ("winUnmapWindowRootless ()\n");
|
||||
#endif
|
||||
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->UnrealizeWindow(pWin);
|
||||
|
@ -324,7 +327,7 @@ winUnmapWindowPRootless (WindowPtr pWin)
|
|||
pWinPriv->hRgn = NULL;
|
||||
}
|
||||
|
||||
winUpdateRgnPRootless (pWin);
|
||||
winUpdateRgnRootless (pWin);
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
@ -335,19 +338,21 @@ winUnmapWindowPRootless (WindowPtr pWin)
|
|||
*/
|
||||
|
||||
Bool
|
||||
winMapWindowPRootless (WindowPtr pWin)
|
||||
winMapWindowRootless (WindowPtr pWin)
|
||||
{
|
||||
Bool fResult = FALSE;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winMapWindowPRootless ()\n");
|
||||
winDebug ("winMapWindowRootless ()\n");
|
||||
#endif
|
||||
|
||||
fResult = winGetScreenPriv(pWin->drawable.pScreen)->RealizeWindow(pWin);
|
||||
|
||||
#ifdef SHAPE
|
||||
winReshapeRootless (pWin);
|
||||
#endif
|
||||
|
||||
winReshapePRootless (pWin);
|
||||
|
||||
winUpdateRgnPRootless (pWin);
|
||||
winUpdateRgnRootless (pWin);
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
@ -355,16 +360,16 @@ winMapWindowPRootless (WindowPtr pWin)
|
|||
|
||||
#ifdef SHAPE
|
||||
void
|
||||
winSetShapePRootless (WindowPtr pWin)
|
||||
winSetShapeRootless (WindowPtr pWin)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winSetShapePRootless ()\n");
|
||||
winDebug ("winSetShapeRootless ()\n");
|
||||
#endif
|
||||
|
||||
winGetScreenPriv(pWin->drawable.pScreen)->SetShape(pWin);
|
||||
|
||||
winReshapePRootless (pWin);
|
||||
winUpdateRgnPRootless (pWin);
|
||||
winReshapeRootless (pWin);
|
||||
winUpdateRgnRootless (pWin);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -388,7 +393,7 @@ winAddRgn (WindowPtr pWin, pointer data)
|
|||
if (pWin->parent != NULL)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winAddRgn ()\n");
|
||||
winDebug ("winAddRgn ()\n");
|
||||
#endif
|
||||
if (pWin->mapped)
|
||||
{
|
||||
|
@ -442,7 +447,7 @@ winAddRgn (WindowPtr pWin, pointer data)
|
|||
|
||||
static
|
||||
void
|
||||
winUpdateRgnPRootless (WindowPtr pWin)
|
||||
winUpdateRgnRootless (WindowPtr pWin)
|
||||
{
|
||||
HRGN hRgn = CreateRectRgn (0, 0, 0, 0);
|
||||
|
||||
|
@ -454,7 +459,7 @@ winUpdateRgnPRootless (WindowPtr pWin)
|
|||
}
|
||||
else
|
||||
{
|
||||
ErrorF ("winUpdateRgnPRootless - CreateRectRgn failed.\n");
|
||||
ErrorF ("winUpdateRgnRootless - CreateRectRgn failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +467,7 @@ winUpdateRgnPRootless (WindowPtr pWin)
|
|||
#ifdef SHAPE
|
||||
static
|
||||
void
|
||||
winReshapePRootless (WindowPtr pWin)
|
||||
winReshapeRootless (WindowPtr pWin)
|
||||
{
|
||||
int nRects;
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
@ -472,7 +477,7 @@ winReshapePRootless (WindowPtr pWin)
|
|||
winWindowPriv(pWin);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winReshapePRootless ()\n");
|
||||
winDebug ("winReshapeRootless ()\n");
|
||||
#endif
|
||||
|
||||
/* Bail if the window is the root window */
|
||||
|
@ -515,13 +520,13 @@ winReshapePRootless (WindowPtr pWin)
|
|||
pRects->x2, pRects->y2);
|
||||
if (hRgnRect == NULL)
|
||||
{
|
||||
ErrorF("winReshapePRootless - CreateRectRgn() failed\n");
|
||||
ErrorF("winReshapeRootless - CreateRectRgn() failed\n");
|
||||
}
|
||||
|
||||
/* Merge the Windows region with the accumulated region */
|
||||
if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
|
||||
{
|
||||
ErrorF("winReshapePRootless - CombineRgn() failed\n");
|
||||
ErrorF("winReshapeRootless - CombineRgn() failed\n");
|
||||
}
|
||||
|
||||
/* Delete the temporary Windows region */
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#if !defined(_WINWINDOW_H_)
|
||||
#define _WINWINDOW_H_
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
@ -29,10 +31,6 @@
|
|||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.h,v 1.3 2003/10/02 13:30:11 eich Exp $ */
|
||||
|
||||
|
||||
#ifndef _WINWINDOW_H_
|
||||
#define _WINWINDOW_H_
|
||||
|
||||
#ifndef NO
|
||||
#define NO 0
|
||||
#endif
|
||||
|
@ -49,11 +47,15 @@
|
|||
#define WINDOW_TITLE_X "Cygwin/X X"
|
||||
#define WIN_WINDOW_PROP "cyg_window_prop_rl"
|
||||
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
|
||||
#define WIN_LOG_FNAME "/tmp/XWin.log"
|
||||
#define WIN_WID_PROP "cyg_wid_prop_rl"
|
||||
#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl"
|
||||
#define WIN_HWND_CACHE "cyg_privmap_rl"
|
||||
#define WIN_HWND_CACHE "cyg_privmap_rl"
|
||||
#ifndef CYGMULTIWINDOW_DEBUG
|
||||
#define CYGMULTIWINDOW_DEBUG NO
|
||||
#endif
|
||||
#ifndef CYGWINDOWING_DEBUG
|
||||
#define CYGWINDOWING_DEBUG NO
|
||||
#endif
|
||||
|
||||
typedef struct _winPrivScreenRec *winPrivScreenPtr;
|
||||
|
||||
|
@ -68,15 +70,19 @@ typedef struct
|
|||
HRGN hRgn;
|
||||
HWND hWnd;
|
||||
winPrivScreenPtr pScreenPriv;
|
||||
int iX;
|
||||
int iY;
|
||||
int iWidth;
|
||||
int iHeight;
|
||||
Bool fXKilled;
|
||||
Bool fNeedRestore;
|
||||
POINT ptRestore;
|
||||
|
||||
/* Privates used by primary fb DirectDraw server */
|
||||
LPDDSURFACEDESC pddsdPrimary;
|
||||
|
||||
/* Privates used by shadow fb DirectDraw Nonlocking server */
|
||||
LPDIRECTDRAWSURFACE4 pddsPrimary4;
|
||||
|
||||
/* Privates used by both shadow fb DirectDraw servers */
|
||||
LPDIRECTDRAWCLIPPER pddcPrimary;
|
||||
} winPrivWinRec, *winPrivWinPtr;
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
typedef struct _winWMMessageRec{
|
||||
DWORD dwID;
|
||||
DWORD msg;
|
||||
|
@ -88,7 +94,7 @@ typedef struct _winWMMessageRec{
|
|||
|
||||
|
||||
/*
|
||||
* winrootlesswm.c
|
||||
* winmultiwindowwm.c
|
||||
*/
|
||||
|
||||
#define WM_WM_MOVE (WM_USER + 1)
|
||||
|
@ -103,11 +109,6 @@ typedef struct _winWMMessageRec{
|
|||
#define WM_WM_HINTS_EVENT (WM_USER + 10)
|
||||
#define WM_WM_CHANGE_STATE (WM_USER + 11)
|
||||
|
||||
|
||||
/*
|
||||
* winmultiwindowwm.c
|
||||
*/
|
||||
|
||||
void
|
||||
winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg);
|
||||
|
||||
|
@ -119,7 +120,7 @@ winInitWM (void **ppWMInfo,
|
|||
int dwScreen);
|
||||
|
||||
void
|
||||
winDeinitMultiWindowWM ();
|
||||
winDeinitMultiWindowWM (void);
|
||||
|
||||
void
|
||||
winMinimizeWindow (Window id);
|
||||
|
@ -132,4 +133,11 @@ winMinimizeWindow (Window id);
|
|||
void
|
||||
winUpdateIcon (Window id);
|
||||
|
||||
void
|
||||
winInitGlobalIcons (void);
|
||||
|
||||
void
|
||||
winDestroyIcon(HICON hIcon);
|
||||
|
||||
#endif /* XWIN_MULTIWINDOW */
|
||||
#endif
|
||||
|
|
663
hw/xwin/winwindowswm.c
Executable file
663
hw/xwin/winwindowswm.c
Executable file
|
@ -0,0 +1,663 @@
|
|||
/* WindowsWM extension is based on AppleWM extension */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
|
||||
Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#include "win.h"
|
||||
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "misc.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "colormapst.h"
|
||||
#include "cursorstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
#include "swaprep.h"
|
||||
#define _WINDOWSWM_SERVER_
|
||||
#include "windowswmstr.h"
|
||||
|
||||
static int WMErrorBase;
|
||||
|
||||
static DISPATCH_PROC(ProcWindowsWMDispatch);
|
||||
static DISPATCH_PROC(SProcWindowsWMDispatch);
|
||||
|
||||
static void WindowsWMResetProc(ExtensionEntry* extEntry);
|
||||
|
||||
static unsigned char WMReqCode = 0;
|
||||
static int WMEventBase = 0;
|
||||
|
||||
static RESTYPE ClientType, EventType; /* resource types for event masks */
|
||||
static XID eventResource;
|
||||
|
||||
/* Currently selected events */
|
||||
static unsigned int eventMask = 0;
|
||||
|
||||
static int WMFreeClient (pointer data, XID id);
|
||||
static int WMFreeEvents (pointer data, XID id);
|
||||
static void SNotifyEvent(xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to);
|
||||
|
||||
typedef struct _WMEvent *WMEventPtr;
|
||||
typedef struct _WMEvent {
|
||||
WMEventPtr next;
|
||||
ClientPtr client;
|
||||
XID clientResource;
|
||||
unsigned int mask;
|
||||
} WMEventRec;
|
||||
|
||||
static inline BoxRec
|
||||
make_box (int x, int y, int w, int h)
|
||||
{
|
||||
BoxRec r;
|
||||
r.x1 = x;
|
||||
r.y1 = y;
|
||||
r.x2 = x + w;
|
||||
r.y2 = y + h;
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
winWindowsWMExtensionInit ()
|
||||
{
|
||||
ExtensionEntry* extEntry;
|
||||
|
||||
ClientType = CreateNewResourceType(WMFreeClient);
|
||||
EventType = CreateNewResourceType(WMFreeEvents);
|
||||
eventResource = FakeClientID(0);
|
||||
|
||||
if (ClientType && EventType &&
|
||||
(extEntry = AddExtension(WINDOWSWMNAME,
|
||||
WindowsWMNumberEvents,
|
||||
WindowsWMNumberErrors,
|
||||
ProcWindowsWMDispatch,
|
||||
SProcWindowsWMDispatch,
|
||||
WindowsWMResetProc,
|
||||
StandardMinorOpcode)))
|
||||
{
|
||||
WMReqCode = (unsigned char)extEntry->base;
|
||||
WMErrorBase = extEntry->errorBase;
|
||||
WMEventBase = extEntry->eventBase;
|
||||
EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
|
||||
}
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
WindowsWMResetProc (ExtensionEntry* extEntry)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcWindowsWMQueryVersion(register ClientPtr client)
|
||||
{
|
||||
xWindowsWMQueryVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = WINDOWS_WM_MAJOR_VERSION;
|
||||
rep.minorVersion = WINDOWS_WM_MINOR_VERSION;
|
||||
rep.patchVersion = WINDOWS_WM_PATCH_VERSION;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *)&rep);
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
||||
/* events */
|
||||
|
||||
static inline void
|
||||
updateEventMask (WMEventPtr *pHead)
|
||||
{
|
||||
WMEventPtr pCur;
|
||||
|
||||
eventMask = 0;
|
||||
for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
|
||||
eventMask |= pCur->mask;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
WMFreeClient (pointer data, XID id)
|
||||
{
|
||||
WMEventPtr pEvent;
|
||||
WMEventPtr *pHead, pCur, pPrev;
|
||||
|
||||
pEvent = (WMEventPtr) data;
|
||||
pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
|
||||
if (pHead)
|
||||
{
|
||||
pPrev = 0;
|
||||
for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
|
||||
pPrev = pCur;
|
||||
if (pCur)
|
||||
{
|
||||
if (pPrev)
|
||||
pPrev->next = pEvent->next;
|
||||
else
|
||||
*pHead = pEvent->next;
|
||||
}
|
||||
updateEventMask (pHead);
|
||||
}
|
||||
xfree ((pointer) pEvent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
WMFreeEvents (pointer data, XID id)
|
||||
{
|
||||
WMEventPtr *pHead, pCur, pNext;
|
||||
|
||||
pHead = (WMEventPtr *) data;
|
||||
for (pCur = *pHead; pCur; pCur = pNext)
|
||||
{
|
||||
pNext = pCur->next;
|
||||
FreeResource (pCur->clientResource, ClientType);
|
||||
xfree ((pointer) pCur);
|
||||
}
|
||||
xfree ((pointer) pHead);
|
||||
eventMask = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcWindowsWMSelectInput (register ClientPtr client)
|
||||
{
|
||||
REQUEST(xWindowsWMSelectInputReq);
|
||||
WMEventPtr pEvent, pNewEvent, *pHead;
|
||||
XID clientResource;
|
||||
|
||||
REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq);
|
||||
pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource,
|
||||
EventType, SecurityWriteAccess);
|
||||
if (stuff->mask != 0)
|
||||
{
|
||||
if (pHead)
|
||||
{
|
||||
/* check for existing entry. */
|
||||
for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
|
||||
{
|
||||
if (pEvent->client == client)
|
||||
{
|
||||
pEvent->mask = stuff->mask;
|
||||
updateEventMask (pHead);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* build the entry */
|
||||
pNewEvent = (WMEventPtr) xalloc (sizeof (WMEventRec));
|
||||
if (!pNewEvent)
|
||||
return BadAlloc;
|
||||
pNewEvent->next = 0;
|
||||
pNewEvent->client = client;
|
||||
pNewEvent->mask = stuff->mask;
|
||||
/*
|
||||
* add a resource that will be deleted when
|
||||
* the client goes away
|
||||
*/
|
||||
clientResource = FakeClientID (client->index);
|
||||
pNewEvent->clientResource = clientResource;
|
||||
if (!AddResource (clientResource, ClientType, (pointer)pNewEvent))
|
||||
return BadAlloc;
|
||||
/*
|
||||
* create a resource to contain a pointer to the list
|
||||
* of clients selecting input. This must be indirect as
|
||||
* the list may be arbitrarily rearranged which cannot be
|
||||
* done through the resource database.
|
||||
*/
|
||||
if (!pHead)
|
||||
{
|
||||
pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource (eventResource, EventType, (pointer)pHead))
|
||||
{
|
||||
FreeResource (clientResource, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
*pHead = 0;
|
||||
}
|
||||
pNewEvent->next = *pHead;
|
||||
*pHead = pNewEvent;
|
||||
updateEventMask (pHead);
|
||||
}
|
||||
else if (stuff->mask == 0)
|
||||
{
|
||||
/* delete the interest */
|
||||
if (pHead)
|
||||
{
|
||||
pNewEvent = 0;
|
||||
for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
|
||||
{
|
||||
if (pEvent->client == client)
|
||||
break;
|
||||
pNewEvent = pEvent;
|
||||
}
|
||||
if (pEvent)
|
||||
{
|
||||
FreeResource (pEvent->clientResource, ClientType);
|
||||
if (pNewEvent)
|
||||
pNewEvent->next = pEvent->next;
|
||||
else
|
||||
*pHead = pEvent->next;
|
||||
xfree (pEvent);
|
||||
updateEventMask (pHead);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
client->errorValue = stuff->mask;
|
||||
return BadValue;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
* deliver the event
|
||||
*/
|
||||
|
||||
void
|
||||
winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
|
||||
Window window, int x, int y, int w, int h)
|
||||
{
|
||||
WMEventPtr *pHead, pEvent;
|
||||
ClientPtr client;
|
||||
xWindowsWMNotifyEvent se;
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
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);
|
||||
if (!pHead)
|
||||
return;
|
||||
for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
|
||||
{
|
||||
client = pEvent->client;
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winWindowsWMSendEvent - x%08x\n", (int) client);
|
||||
#endif
|
||||
if ((pEvent->mask & mask) == 0
|
||||
|| client == serverClient || client->clientGone)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winWindowsWMSendEvent - send\n");
|
||||
#endif
|
||||
se.type = type + WMEventBase;
|
||||
se.kind = which;
|
||||
se.window = window;
|
||||
se.arg = arg;
|
||||
se.x = x;
|
||||
se.y = y;
|
||||
se.w = w;
|
||||
se.h = h;
|
||||
se.sequenceNumber = client->sequence;
|
||||
se.time = currentTime.milliseconds;
|
||||
WriteEventsToClient (client, 1, (xEvent *) &se);
|
||||
}
|
||||
}
|
||||
|
||||
/* Safe to call from any thread. */
|
||||
unsigned int
|
||||
WindowsWMSelectedEvents (void)
|
||||
{
|
||||
return eventMask;
|
||||
}
|
||||
|
||||
|
||||
/* general utility functions */
|
||||
|
||||
static int
|
||||
ProcWindowsWMDisableUpdate (register ClientPtr client)
|
||||
{
|
||||
REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq);
|
||||
|
||||
//winDisableUpdate();
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcWindowsWMReenableUpdate (register ClientPtr client)
|
||||
{
|
||||
REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq);
|
||||
|
||||
//winEnableUpdate();
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
||||
/* window functions */
|
||||
|
||||
static int
|
||||
ProcWindowsWMSetFrontProcess (register ClientPtr client)
|
||||
{
|
||||
REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq);
|
||||
|
||||
//QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0);
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
||||
/* frame functions */
|
||||
|
||||
static int
|
||||
ProcWindowsWMFrameGetRect (register ClientPtr client)
|
||||
{
|
||||
xWindowsWMFrameGetRectReply rep;
|
||||
BoxRec ir;
|
||||
RECT rcNew;
|
||||
REQUEST(xWindowsWMFrameGetRectReq);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameGetRect %d %d\n",
|
||||
(sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len);
|
||||
#endif
|
||||
|
||||
REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
|
||||
|
||||
if (stuff->frame_rect != 0)
|
||||
{
|
||||
ErrorF ("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* Store the origin, height, and width in a rectangle structure */
|
||||
SetRect (&rcNew, stuff->ix, stuff->iy,
|
||||
stuff->ix + stuff->iw, stuff->iy + stuff->ih);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
|
||||
stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Calculate the required size of the Windows window rectangle,
|
||||
* given the size of the Windows window client area.
|
||||
*/
|
||||
AdjustWindowRectEx (&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex);
|
||||
rep.x = rcNew.left;
|
||||
rep.y = rcNew.top;
|
||||
rep.w = rcNew.right - rcNew.left;
|
||||
rep.h = rcNew.bottom - rcNew.top;
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
|
||||
rep.x, rep.y, rep.w, rep.h);
|
||||
#endif
|
||||
|
||||
WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *)&rep);
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ProcWindowsWMFrameDraw (register ClientPtr client)
|
||||
{
|
||||
REQUEST(xWindowsWMFrameDrawReq);
|
||||
WindowPtr pWin;
|
||||
win32RootlessWindowPtr pRLWinPriv;
|
||||
RECT rcNew;
|
||||
int nCmdShow;
|
||||
RegionRec newShape;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
REQUEST_SIZE_MATCH (xWindowsWMFrameDrawReq);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameDraw\n");
|
||||
#endif
|
||||
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window,
|
||||
client, SecurityReadAccess)))
|
||||
{
|
||||
return BadValue;
|
||||
}
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameDraw - Window found\n");
|
||||
#endif
|
||||
|
||||
pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, TRUE);
|
||||
if (pRLWinPriv == 0) return BadWindow;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
|
||||
(int) pRLWinPriv->hWnd, (int) stuff->frame_style,
|
||||
(int) stuff->frame_style_ex);
|
||||
ErrorF ("ProcWindowsWMFrameDraw - %d %d %d %d\n",
|
||||
stuff->ix, stuff->iy, stuff->iw, stuff->ih);
|
||||
#endif
|
||||
|
||||
/* Store the origin, height, and width in a rectangle structure */
|
||||
SetRect (&rcNew, stuff->ix, stuff->iy,
|
||||
stuff->ix + stuff->iw, stuff->iy + stuff->ih);
|
||||
|
||||
/*
|
||||
* Calculate the required size of the Windows window rectangle,
|
||||
* given the size of the Windows window client area.
|
||||
*/
|
||||
AdjustWindowRectEx (&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex);
|
||||
|
||||
/* Set the window extended style flags */
|
||||
if (!SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, stuff->frame_style_ex))
|
||||
{
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* Set the window standard style flags */
|
||||
if (!SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE, stuff->frame_style))
|
||||
{
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* Flush the window style */
|
||||
if (!SetWindowPos (pRLWinPriv->hWnd, NULL,
|
||||
rcNew.left, rcNew.top,
|
||||
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
|
||||
SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE))
|
||||
{
|
||||
return BadValue;
|
||||
}
|
||||
if (!IsWindowVisible(pRLWinPriv->hWnd))
|
||||
nCmdShow = SW_HIDE;
|
||||
else
|
||||
nCmdShow = SW_SHOWNA;
|
||||
|
||||
ShowWindow (pRLWinPriv->hWnd, nCmdShow);
|
||||
|
||||
winMWExtWMUpdateIcon (pWin->drawable.id);
|
||||
|
||||
if (wBoundingShape(pWin) != NULL)
|
||||
{
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
/* wBoundingShape is relative to *inner* origin of window.
|
||||
Translate by borderWidth to get the outside-relative position. */
|
||||
|
||||
REGION_NULL(pScreen, &newShape);
|
||||
REGION_COPY(pScreen, &newShape, wBoundingShape(pWin));
|
||||
REGION_TRANSLATE(pScreen, &newShape, pWin->borderWidth, pWin->borderWidth);
|
||||
winMWExtWMReshapeFrame (pRLWinPriv, &newShape);
|
||||
REGION_UNINIT(pScreen, &newShape);
|
||||
}
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameDraw - done\n");
|
||||
#endif
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcWindowsWMFrameSetTitle(
|
||||
register ClientPtr client
|
||||
)
|
||||
{
|
||||
unsigned int title_length, title_max;
|
||||
unsigned char *title_bytes;
|
||||
REQUEST(xWindowsWMFrameSetTitleReq);
|
||||
WindowPtr pWin;
|
||||
win32RootlessWindowPtr pRLWinPriv;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameSetTitle\n");
|
||||
#endif
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
|
||||
|
||||
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window,
|
||||
client, SecurityReadAccess)))
|
||||
{
|
||||
return BadValue;
|
||||
}
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n");
|
||||
#endif
|
||||
|
||||
title_length = stuff->title_length;
|
||||
title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq);
|
||||
|
||||
if (title_max < title_length)
|
||||
return BadValue;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameSetTitle - length is valid\n");
|
||||
#endif
|
||||
|
||||
title_bytes = malloc (title_length+1);
|
||||
strncpy (title_bytes, (unsigned char *) &stuff[1], title_length);
|
||||
title_bytes[title_length] = '\0';
|
||||
|
||||
pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
|
||||
|
||||
if (pRLWinPriv == 0)
|
||||
{
|
||||
free (title_bytes);
|
||||
return BadWindow;
|
||||
}
|
||||
|
||||
/* Flush the window style */
|
||||
SetWindowText (pRLWinPriv->hWnd, title_bytes);
|
||||
|
||||
free (title_bytes);
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("ProcWindowsWMFrameSetTitle - done\n");
|
||||
#endif
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
||||
/* dispatch */
|
||||
|
||||
static int
|
||||
ProcWindowsWMDispatch (register ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_WindowsWMQueryVersion:
|
||||
return ProcWindowsWMQueryVersion(client);
|
||||
}
|
||||
|
||||
if (!LocalClient(client))
|
||||
return WMErrorBase + WindowsWMClientNotLocal;
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_WindowsWMSelectInput:
|
||||
return ProcWindowsWMSelectInput(client);
|
||||
case X_WindowsWMDisableUpdate:
|
||||
return ProcWindowsWMDisableUpdate(client);
|
||||
case X_WindowsWMReenableUpdate:
|
||||
return ProcWindowsWMReenableUpdate(client);
|
||||
case X_WindowsWMSetFrontProcess:
|
||||
return ProcWindowsWMSetFrontProcess(client);
|
||||
case X_WindowsWMFrameGetRect:
|
||||
return ProcWindowsWMFrameGetRect(client);
|
||||
case X_WindowsWMFrameDraw:
|
||||
return ProcWindowsWMFrameDraw(client);
|
||||
case X_WindowsWMFrameSetTitle:
|
||||
return ProcWindowsWMFrameSetTitle(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SNotifyEvent (xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to)
|
||||
{
|
||||
to->type = from->type;
|
||||
to->kind = from->kind;
|
||||
cpswaps (from->sequenceNumber, to->sequenceNumber);
|
||||
cpswapl (from->window, to->window);
|
||||
cpswapl (from->time, to->time);
|
||||
cpswapl (from->arg, to->arg);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcWindowsWMQueryVersion (register ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xWindowsWMQueryVersionReq);
|
||||
swaps(&stuff->length, n);
|
||||
return ProcWindowsWMQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcWindowsWMDispatch (register ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
/* It is bound to be non-local when there is byte swapping */
|
||||
if (!LocalClient(client))
|
||||
return WMErrorBase + WindowsWMClientNotLocal;
|
||||
|
||||
/* only local clients are allowed WM access */
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_WindowsWMQueryVersion:
|
||||
return SProcWindowsWMQueryVersion(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
|
@ -36,14 +36,27 @@
|
|||
#include "win.h"
|
||||
#include <commctrl.h>
|
||||
#include "winprefs.h"
|
||||
#include "winconfig.h"
|
||||
#if CYGDEBUG
|
||||
#include "winmessages.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
Bool g_fCursor = TRUE;
|
||||
Bool g_fCursor = TRUE;
|
||||
|
||||
|
||||
/*
|
||||
* References to external symbols
|
||||
*/
|
||||
|
||||
extern Bool g_fClipboard;
|
||||
extern HWND g_hDlgDepthChange;
|
||||
extern Bool g_fKeyboardHookLL;
|
||||
extern HWND g_hwndKeyboardFocus;
|
||||
extern Bool g_fSoftwareCursor;
|
||||
|
||||
/*
|
||||
* Called by winWakeupHandler
|
||||
|
@ -61,9 +74,23 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
static HINSTANCE s_hInstance;
|
||||
static Bool s_fTracking = FALSE;
|
||||
static unsigned long s_ulServerGeneration = 0;
|
||||
static UINT s_uTaskbarRestart = 0;
|
||||
int iScanCode;
|
||||
int i;
|
||||
|
||||
#if CYGDEBUG
|
||||
if (message >= WM_USER)
|
||||
{
|
||||
winDebug("winWindowProc - Message WM_USER + %d", message - WM_USER);
|
||||
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
|
||||
}
|
||||
else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
|
||||
{
|
||||
winDebug("winWindowProc - Message %s", MESSAGE_NAMES[message]);
|
||||
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Watch for server regeneration */
|
||||
if (g_ulServerGeneration != s_ulServerGeneration)
|
||||
{
|
||||
|
@ -76,7 +103,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
&& (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - Setting privates handle\n");
|
||||
winDebug ("winWindowProc - Setting privates handle\n");
|
||||
#endif
|
||||
s_pScreenInfo = s_pScreenPriv->pScreenInfo;
|
||||
s_pScreen = s_pScreenInfo->pScreen;
|
||||
|
@ -99,7 +126,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|
||||
case WM_CREATE:
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_CREATE\n");
|
||||
winDebug ("winWindowProc - WM_CREATE\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -116,11 +143,9 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
s_pScreenInfo = s_pScreenPriv->pScreenInfo;
|
||||
s_pScreen = s_pScreenInfo->pScreen;
|
||||
s_hwndLastPrivates = hwnd;
|
||||
s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||
SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv);
|
||||
|
||||
/* Store the mode key states so restore doesn't try to restore them */
|
||||
winStoreModeKeyStates (s_pScreen);
|
||||
|
||||
/* Setup tray icon */
|
||||
if (!s_pScreenInfo->fNoTrayIcon)
|
||||
{
|
||||
|
@ -154,7 +179,10 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
if (s_pScreenInfo->fFullScreen
|
||||
&& (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
|
||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD))
|
||||
#ifdef XWIN_PRIMARYFB
|
||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
|
||||
#endif
|
||||
))
|
||||
{
|
||||
/*
|
||||
* Store the new display dimensions and depth.
|
||||
|
@ -170,8 +198,8 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|
||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, "
|
||||
"new bpp: %d\n",
|
||||
s_pScreenInfo->dwBPP,
|
||||
s_pScreenPriv->dwLastWindowsBitsPixel,
|
||||
(int) s_pScreenInfo->dwBPP,
|
||||
(int) s_pScreenPriv->dwLastWindowsBitsPixel,
|
||||
wParam);
|
||||
|
||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
|
||||
|
@ -208,7 +236,10 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
if ((s_pScreenInfo->dwBPP != wParam)
|
||||
&& (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
|
||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD))
|
||||
#ifdef XWIN_PRIMARYFB
|
||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
|
||||
#endif
|
||||
))
|
||||
{
|
||||
/* Cannot display the visual until the depth is restored */
|
||||
ErrorF ("winWindowProc - Disruptive change in depth\n");
|
||||
|
@ -245,14 +276,14 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
*/
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
|
||||
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
|
||||
#endif
|
||||
|
||||
/* Release the old primary surface */
|
||||
(*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Released "
|
||||
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Released "
|
||||
"primary surface\n");
|
||||
#endif
|
||||
|
||||
|
@ -260,21 +291,41 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
(*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Recreated "
|
||||
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated "
|
||||
"primary surface\n");
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Multi-Window mode uses RandR for resizes */
|
||||
if (s_pScreenInfo->fMultiWindow)
|
||||
{
|
||||
RRSetScreenConfig ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not "
|
||||
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not "
|
||||
"change\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Store the new display dimensions and depth */
|
||||
s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
|
||||
s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
|
||||
if (s_pScreenInfo->fMultipleMonitors)
|
||||
{
|
||||
s_pScreenPriv->dwLastWindowsWidth
|
||||
= GetSystemMetrics (SM_CXVIRTUALSCREEN);
|
||||
s_pScreenPriv->dwLastWindowsHeight
|
||||
= GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_pScreenPriv->dwLastWindowsWidth
|
||||
= GetSystemMetrics (SM_CXSCREEN);
|
||||
s_pScreenPriv->dwLastWindowsHeight
|
||||
= GetSystemMetrics (SM_CYSCREEN);
|
||||
}
|
||||
s_pScreenPriv->dwLastWindowsBitsPixel
|
||||
= GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);
|
||||
break;
|
||||
|
@ -286,14 +337,19 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
int iWidth, iHeight;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_SIZE\n");
|
||||
winDebug ("winWindowProc - WM_SIZE\n");
|
||||
#endif
|
||||
|
||||
/* Break if we do not use scrollbars */
|
||||
if (!s_pScreenInfo->fScrollbars
|
||||
|| !s_pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
|| s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| s_pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
|| s_pScreenInfo->fFullScreen)
|
||||
break;
|
||||
|
||||
|
@ -383,7 +439,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
int iVertPos;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_VSCROLL\n");
|
||||
winDebug ("winWindowProc - WM_VSCROLL\n");
|
||||
#endif
|
||||
|
||||
/* Get vertical scroll bar info */
|
||||
|
@ -468,7 +524,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
int iHorzPos;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_HSCROLL\n");
|
||||
winDebug ("winWindowProc - WM_HSCROLL\n");
|
||||
#endif
|
||||
|
||||
/* Get horizontal scroll bar info */
|
||||
|
@ -554,7 +610,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
int iBorderHeight, iBorderWidth;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
|
||||
winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
|
||||
s_pScreenInfo);
|
||||
#endif
|
||||
|
||||
|
@ -563,8 +619,14 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|| !s_pScreenInfo->fScrollbars
|
||||
|| s_pScreenInfo->fFullScreen
|
||||
|| !s_pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
|| s_pScreenInfo->fRootless
|
||||
|| s_pScreenInfo->fMultiWindow)
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|| s_pScreenInfo->fMultiWindow
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
|
||||
/*
|
||||
|
@ -594,7 +656,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|
||||
case WM_ERASEBKGND:
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_ERASEBKGND\n");
|
||||
winDebug ("winWindowProc - WM_ERASEBKGND\n");
|
||||
#endif
|
||||
/*
|
||||
* Pretend that we did erase the background but we don't care,
|
||||
|
@ -605,7 +667,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|
||||
case WM_PAINT:
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_PAINT\n");
|
||||
winDebug ("winWindowProc - WM_PAINT\n");
|
||||
#endif
|
||||
/* Only paint if we have privates and the server is enabled */
|
||||
if (s_pScreenPriv == NULL
|
||||
|
@ -628,7 +690,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
case WM_PALETTECHANGED:
|
||||
{
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_PALETTECHANGED\n");
|
||||
winDebug ("winWindowProc - WM_PALETTECHANGED\n");
|
||||
#endif
|
||||
/*
|
||||
* Don't process if we don't have privates or a colormap,
|
||||
|
@ -686,13 +748,13 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
}
|
||||
|
||||
/* Hide or show the Windows mouse cursor */
|
||||
if (g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer))
|
||||
if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer))
|
||||
{
|
||||
/* Hide Windows cursor */
|
||||
g_fCursor = FALSE;
|
||||
ShowCursor (FALSE);
|
||||
}
|
||||
else if (!g_fCursor && !s_pScreenPriv->fActive
|
||||
else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
|
||||
&& !s_pScreenInfo->fLessPointer)
|
||||
{
|
||||
/* Show Windows cursor */
|
||||
|
@ -721,7 +783,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
break;
|
||||
|
||||
/* Non-client mouse movement, show Windows cursor */
|
||||
if (!g_fCursor)
|
||||
if (g_fSoftwareCursor && !g_fCursor)
|
||||
{
|
||||
g_fCursor = TRUE;
|
||||
ShowCursor (TRUE);
|
||||
|
@ -735,7 +797,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
s_fTracking = FALSE;
|
||||
|
||||
/* Show the mouse cursor, if necessary */
|
||||
if (!g_fCursor)
|
||||
if (g_fSoftwareCursor && !g_fCursor)
|
||||
{
|
||||
g_fCursor = TRUE;
|
||||
ShowCursor (TRUE);
|
||||
|
@ -746,39 +808,69 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
case WM_LBUTTONDOWN:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
if (s_pScreenInfo->fRootless) SetCapture (hwnd);
|
||||
if (s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
SetCapture (hwnd);
|
||||
return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
if (s_pScreenInfo->fRootless) ReleaseCapture ();
|
||||
if (s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
ReleaseCapture ();
|
||||
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
|
||||
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_MBUTTONDOWN:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
if (s_pScreenInfo->fRootless) SetCapture (hwnd);
|
||||
if (s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
SetCapture (hwnd);
|
||||
return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
|
||||
|
||||
case WM_MBUTTONUP:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
if (s_pScreenInfo->fRootless) ReleaseCapture ();
|
||||
if (s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
ReleaseCapture ();
|
||||
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
|
||||
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
if (s_pScreenInfo->fRootless) SetCapture (hwnd);
|
||||
if (s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
SetCapture (hwnd);
|
||||
return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
if (s_pScreenInfo->fRootless) ReleaseCapture ();
|
||||
if (s_pScreenInfo->fRootless
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
#endif
|
||||
)
|
||||
ReleaseCapture ();
|
||||
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
|
||||
|
||||
case WM_TIMER:
|
||||
|
@ -827,7 +919,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_MOUSEWHEEL\n");
|
||||
winDebug ("winWindowProc - WM_MOUSEWHEEL\n");
|
||||
#endif
|
||||
winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
|
||||
break;
|
||||
|
@ -836,41 +928,31 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
|
||||
/* Save handle of our main window that last received focus */
|
||||
g_hwndKeyboardFocus = hwnd;
|
||||
|
||||
/* Restore the state of all mode keys */
|
||||
winRestoreModeKeyStates (s_pScreen);
|
||||
winRestoreModeKeyStates ();
|
||||
|
||||
/* Add the keyboard hook if possible */
|
||||
if (g_fKeyboardHookLL)
|
||||
g_fKeyboardHookLL = winInstallKeyboardHookLL ();
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
|
||||
/* Store the state of all mode keys */
|
||||
winStoreModeKeyStates (s_pScreen);
|
||||
/* Clear handle of our main window that last received focus */
|
||||
g_hwndKeyboardFocus = NULL;
|
||||
|
||||
/* Release any pressed keys */
|
||||
winKeybdReleaseKeys ();
|
||||
|
||||
/* Remove our keyboard hook if it is installed */
|
||||
winRemoveKeyboardHookLL ();
|
||||
return 0;
|
||||
|
||||
#if WIN_NEW_KEYBOARD_SUPPORT
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYUP:
|
||||
case WM_KEYUP:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
break;
|
||||
|
||||
/* Don't process keys if we are not active */
|
||||
if (!s_pScreenPriv->fActive)
|
||||
return 0;
|
||||
|
||||
winProcessKeyEvent ((DWORD)wParam, (DWORD) lParam);
|
||||
return 0;
|
||||
|
||||
case WM_DEADCHAR:
|
||||
case WM_SYSDEADCHAR:
|
||||
return 0;
|
||||
|
||||
#else /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
|
||||
|
@ -911,12 +993,30 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
if (wParam == VK_LWIN || wParam == VK_RWIN)
|
||||
break;
|
||||
|
||||
#ifdef XKB
|
||||
/*
|
||||
* Discard presses generated from Windows auto-repeat
|
||||
* ago: Only discard them if XKB is not disabled
|
||||
*/
|
||||
if (!g_winInfo.xkb.disable)
|
||||
{
|
||||
if (lParam & (1<<30))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */
|
||||
if (winIsFakeCtrl_L (message, wParam, lParam))
|
||||
return 0;
|
||||
|
||||
/* Send the key event(s) */
|
||||
/* Translate Windows key code to X scan code */
|
||||
winTranslateKey (wParam, lParam, &iScanCode);
|
||||
|
||||
/* Ignore repeats for CapsLock */
|
||||
if (wParam == VK_CAPITAL)
|
||||
lParam = 1;
|
||||
|
||||
/* Send the key event(s) */
|
||||
for (i = 0; i < LOWORD(lParam); ++i)
|
||||
winSendKeyEvent (iScanCode, TRUE);
|
||||
return 0;
|
||||
|
@ -942,7 +1042,6 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
winTranslateKey (wParam, lParam, &iScanCode);
|
||||
winSendKeyEvent (iScanCode, FALSE);
|
||||
return 0;
|
||||
#endif /* WIN_NEW_KEYBOARD_SUPPORT */
|
||||
|
||||
case WM_HOTKEY:
|
||||
if (s_pScreenPriv == NULL)
|
||||
|
@ -983,7 +1082,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
}
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_ACTIVATE\n");
|
||||
winDebug ("winWindowProc - WM_ACTIVATE\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -996,7 +1095,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
s_pScreenPriv->iDeltaZ = 0;
|
||||
|
||||
/* Reshow the Windows mouse cursor if we are being deactivated */
|
||||
if (LOWORD(wParam) == WA_INACTIVE
|
||||
if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE
|
||||
&& !g_fCursor)
|
||||
{
|
||||
/* Show Windows cursor */
|
||||
|
@ -1011,14 +1110,14 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
break;
|
||||
|
||||
#if CYGDEBUG
|
||||
ErrorF ("winWindowProc - WM_ACTIVATEAPP\n");
|
||||
winDebug ("winWindowProc - WM_ACTIVATEAPP\n");
|
||||
#endif
|
||||
|
||||
/* Activate or deactivate */
|
||||
s_pScreenPriv->fActive = wParam;
|
||||
|
||||
/* Reshow the Windows mouse cursor if we are being deactivated */
|
||||
if (!s_pScreenPriv->fActive
|
||||
if (g_fSoftwareCursor && !s_pScreenPriv->fActive
|
||||
&& !g_fCursor)
|
||||
{
|
||||
/* Show Windows cursor */
|
||||
|
@ -1026,6 +1125,9 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
ShowCursor (TRUE);
|
||||
}
|
||||
|
||||
/* Make sure the clipboard chain is ok. */
|
||||
winFixClipboardChain ();
|
||||
|
||||
/* Call engine specific screen activation/deactivation function */
|
||||
(*s_pScreenPriv->pwinActivateApp) (s_pScreen);
|
||||
return 0;
|
||||
|
@ -1038,27 +1140,35 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
winDisplayExitDialog (s_pScreenPriv);
|
||||
return 0;
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
case ID_APP_HIDE_ROOT:
|
||||
ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE);
|
||||
s_pScreenPriv->fRootWindowShown = FALSE;
|
||||
if (s_pScreenPriv->fRootWindowShown)
|
||||
ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE);
|
||||
else
|
||||
ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW);
|
||||
s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown;
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
case ID_APP_SHOW_ROOT:
|
||||
ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW);
|
||||
s_pScreenPriv->fRootWindowShown = TRUE;
|
||||
case ID_APP_ABOUT:
|
||||
/* Display the About box */
|
||||
winDisplayAboutDialog (s_pScreenPriv);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
/* It's probably one of the custom menus... */
|
||||
return HandleCustomWM_COMMAND (0, LOWORD (wParam));
|
||||
|
||||
if (HandleCustomWM_COMMAND (0, LOWORD (wParam)))
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ENDSESSION:
|
||||
case WM_GIVEUP:
|
||||
/* Tell X that we are giving up */
|
||||
winDeinitClipboard ();
|
||||
winDeinitMultiWindowWM ();
|
||||
/* Tell X that we are giving up */
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
if (s_pScreenInfo->fMultiWindow)
|
||||
winDeinitMultiWindowWM ();
|
||||
#endif
|
||||
GiveUp (0);
|
||||
return 0;
|
||||
|
||||
|
@ -1066,6 +1176,21 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
/* Display Exit dialog */
|
||||
winDisplayExitDialog (s_pScreenPriv);
|
||||
return 0;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT)
|
||||
{
|
||||
if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if(message == s_uTaskbarRestart)
|
||||
{
|
||||
winInitNotifyIcon (s_pScreenPriv);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||
|
|
Loading…
Reference in New Issue
Block a user