This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
[PATCH] -nodecoration parameter
- From: Jehan <jehan_something at hotmail dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Fri, 07 Jun 2002 18:21:50 -0700
- Subject: [PATCH] -nodecoration parameter
Hi,
Here is a little patch that adds a "-nodecoration" parameter to XWin.
With this parameter on (and no -fullscreen), the XWin window won't have
titlebar nor border. It cumulates the advantage of both fullscreen
(doesn't waste estate, especially if your taskbar in set to auto-hide)
and non-fullscreen mode (Windows window on top of XWin, taskbar and
other desktop toolbar still visible, always-on-top (winamp) window are
still accessible).
Jehan
--- xc/programs/Xserver/hw/xwin/InitOutput.c 2002-06-07 18:06:12.000000000 -0700
+++ xc/programs/Xserver/hw/xwin/InitOutput.c 2002-06-07 15:47:04.000000000 -0700
@@ -89,6 +89,7 @@
g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH;
g_ScreenInfo[i].pfb = NULL;
g_ScreenInfo[i].fFullScreen = FALSE;
+ g_ScreenInfo[i].fDecoration = TRUE;
g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF;
g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI)
* 25.4;
@@ -436,6 +437,32 @@
}
/*
+ * Look for the '-nodecoration' argument
+ */
+ if (strcmp(argv[i], "-nodecoration") == 0)
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fDecoration = FALSE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fDecoration = FALSE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
* Look for the '-ignoreinput' argument
*/
if (strcmp(argv[i], "-ignoreinput") == 0)
--- xc/programs/Xserver/hw/xwin/win.h 2002-06-07 18:06:14.000000000 -0700
+++ xc/programs/Xserver/hw/xwin/win.h 2002-06-07 17:12:58.000000000 -0700
@@ -315,6 +315,7 @@
DWORD dwEnginePreferred;
DWORD dwEnginesSupported;
Bool fFullScreen;
+ Bool fDecoration;
int iE3BTimeout;
/* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
Bool fUseWinKillKey;
--- xc/programs/Xserver/hw/xwin/wincreatewnd.c 2002-06-07 18:06:14.000000000 -0700
+++ xc/programs/Xserver/hw/xwin/wincreatewnd.c 2002-06-07 17:53:04.000000000 -0700
@@ -124,6 +124,7 @@
HWND *phwnd = &pScreenPriv->hwndScreen;
WNDCLASS wc;
RECT rcClient, rcWorkArea;
+ int windowStyle;
/* Setup our window class */
wc.style = CS_HREDRAW | CS_VREDRAW;
@@ -153,17 +154,12 @@
if (iWidth > (rcWorkArea.right - rcWorkArea.left))
{
iWidth = rcWorkArea.right - rcWorkArea.left;
- pScreenInfo->dwWidth = iWidth -
- 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
}
/* Trim window height to fit work area */
if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
{
iHeight = rcWorkArea.bottom - rcWorkArea.top;
- pScreenInfo->dwHeight = iHeight
- - 2 * GetSystemMetrics (SM_CYFIXEDFRAME)
- - GetSystemMetrics (SM_CYCAPTION);
}
#if CYGDEBUG
@@ -172,14 +168,24 @@
pScreenInfo->dwWidth, pScreenInfo->dwHeight);
#endif
+ windowStyle = WS_OVERLAPPED
+ | WS_SYSMENU
+ | WS_MINIMIZEBOX;
+
+ if (pScreenInfo->fDecoration == TRUE)
+ {
+ windowStyle |= WS_CAPTION;
+ }
+ else
+ {
+ windowStyle |= WS_POPUP;
+ }
+
/* Create the window */
*phwnd = CreateWindowExA (0, /* Extended styles */
WINDOW_CLASS, /* Class name */
WINDOW_TITLE, /* Window name */
- WS_OVERLAPPED
- | WS_CAPTION
- | WS_SYSMENU
- | WS_MINIMIZEBOX, /* Almost OverlappedWindow */
+ windowStyle,
rcWorkArea.left, /* Horizontal position */
rcWorkArea.top, /* Vertical position */
iWidth, /* Right edge */
@@ -188,6 +194,7 @@
(HMENU) NULL, /* No menu */
GetModuleHandle (NULL),/* Instance handle */
pScreenPriv); /* ScreenPrivates */
+
if (*phwnd == NULL)
{
ErrorF ("winCreateBoundingWindowWindowed () CreateWindowEx () failed\n");
@@ -206,11 +213,14 @@
return FALSE;
}
ErrorF ("winCreateBoundingWindowWindowed () - WindowClient "\
- "w %d h %d r %d l %d b %d t %d\n",
+ "w %ld h %ld r %ld l %ld b %ld t %ld\n",
rcClient.right - rcClient.left,
rcClient.bottom - rcClient.top,
rcClient.right, rcClient.left,
rcClient.bottom, rcClient.top);
+
+ pScreenInfo->dwWidth = rcClient.right - rcClient.left;
+ pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
/*
* Transform the client relative coords to screen relative coords.
--- xc/programs/Xserver/hw/xwin/winshadddnl.c 2002-06-07 18:06:14.000000000 -0700
+++ xc/programs/Xserver/hw/xwin/winshadddnl.c 2002-06-07 17:04:22.000000000 -0700
@@ -309,7 +309,7 @@
ddpfPrimary.u2.dwRBitMask,
ddpfPrimary.u3.dwGBitMask,
ddpfPrimary.u4.dwBBitMask,
- ddpfPrimary.u.dwRGBBitCount);
+ ddpfPrimary.u1.dwRGBBitCount);
#endif
/* Attach our clipper to our primary surface handle */