Get rid of the no longer used tty driver.

This commit is contained in:
Alexandre Julliard 2005-10-31 16:10:03 +00:00
parent bc30574383
commit 21883d794a
15 changed files with 1 additions and 1929 deletions

View File

@ -137,7 +137,6 @@ DLLs (under dlls/):
stdole32.tlb/ - Standard OLE typelib stdole32.tlb/ - Standard OLE typelib
sti/ - Still Image service sti/ - Still Image service
tapi32/ - Telephone interface tapi32/ - Telephone interface
ttydrv/ - TTY display driver (Wine specific)
twain/ - TWAIN Imaging device communications twain/ - TWAIN Imaging device communications
unicows/ - Unicows replacement (Unicode layer for Win9x) unicows/ - Unicows replacement (Unicode layer for Win9x)
url/ - Internet shortcut shell extension url/ - Internet shortcut shell extension

3
configure vendored

File diff suppressed because one or more lines are too long

View File

@ -1666,7 +1666,6 @@ dlls/stdole32.tlb/Makefile
dlls/sti/Makefile dlls/sti/Makefile
dlls/strmiids/Makefile dlls/strmiids/Makefile
dlls/tapi32/Makefile dlls/tapi32/Makefile
dlls/ttydrv/Makefile
dlls/twain/Makefile dlls/twain/Makefile
dlls/unicows/Makefile dlls/unicows/Makefile
dlls/url/Makefile dlls/url/Makefile

View File

@ -135,7 +135,6 @@ BASEDIRS = \
stdole32.tlb \ stdole32.tlb \
sti \ sti \
tapi32 \ tapi32 \
ttydrv \
twain \ twain \
unicows \ unicows \
url \ url \
@ -413,7 +412,6 @@ SYMLINKS_SO = \
winenas.drv.so \ winenas.drv.so \
wineoss.drv.so \ wineoss.drv.so \
wineps.drv.so \ wineps.drv.so \
winetty.drv.so \
wininet.dll.so \ wininet.dll.so \
winmm.dll.so \ winmm.dll.so \
winnls32.dll.so \ winnls32.dll.so \
@ -979,9 +977,6 @@ wineps.drv.so: wineps/wineps.drv.so
wineps16.drv.so : wineps.drv.so wineps16.drv.so : wineps.drv.so
$(RM) $@ && $(LN_S) wineps.drv.so $@ $(RM) $@ && $(LN_S) wineps.drv.so $@
winetty.drv.so: ttydrv/winetty.drv.so
$(RM) $@ && $(LN_S) ttydrv/winetty.drv.so $@
winex11.drv.so: x11drv/winex11.drv.so winex11.drv.so: x11drv/winex11.drv.so
$(RM) $@ && $(LN_S) x11drv/winex11.drv.so $@ $(RM) $@ && $(LN_S) x11drv/winex11.drv.so $@
@ -1736,7 +1731,6 @@ msacm/winemp3/winemp3.acm.so: msacm/winemp3
winmm/winenas/winenas.drv.so: winmm/winenas winmm/winenas/winenas.drv.so: winmm/winenas
winmm/wineoss/wineoss.drv.so: winmm/wineoss winmm/wineoss/wineoss.drv.so: winmm/wineoss
wineps/wineps.drv.so: wineps wineps/wineps.drv.so: wineps
ttydrv/winetty.drv.so: ttydrv
x11drv/winex11.drv.so: x11drv x11drv/winex11.drv.so: x11drv
wininet/wininet.dll.so: wininet wininet/wininet.dll.so: wininet
winmm/winmm.dll.so: winmm winmm/winmm.dll.so: winmm

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,20 +0,0 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winetty.drv
IMPORTS = user32 gdi32 kernel32 ntdll
EXTRALIBS = @CURSESLIBS@
C_SRCS = \
bitmap.c \
dc.c \
graphics.c \
objects.c \
palette.c \
ttydrv_main.c \
wnd.c
@MAKE_DLL_RULES@
### Dependencies:

View File

@ -1,76 +0,0 @@
/*
* TTY bitmap driver
*
* Copyright 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <string.h>
#include "ttydrv.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/***********************************************************************
* GetBitmapBits (TTYDRV.@)
*/
LONG TTYDRV_GetBitmapBits(HBITMAP hbitmap, void *bits, LONG count)
{
FIXME("(%p, %p, %ld): stub\n", hbitmap, bits, count);
memset(bits, 0, count);
return count;
}
/***********************************************************************
* SetBitmapBits (TTYDRV.@)
*/
LONG TTYDRV_SetBitmapBits(HBITMAP hbitmap, const void *bits, LONG count)
{
FIXME("(%p, %p, %ld): stub\n", hbitmap, bits, count);
return count;
}
/***********************************************************************
* TTYDRV_BITMAP_CreateDIBSection
*/
HBITMAP TTYDRV_BITMAP_CreateDIBSection(
TTYDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage,
LPVOID *bits, HANDLE section, DWORD offset)
{
FIXME("(%p, %p, %u, %p, %p, %ld): stub\n",
physDev->hdc, bmi, usage, bits, section, offset);
return NULL;
}
/***********************************************************************
* TTYDRV_DC_SetDIBitsToDevice
*/
INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc,
UINT startscan, UINT lines, LPCVOID bits,
const BITMAPINFO *info, UINT coloruse)
{
FIXME("(%p, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n",
physDev->hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse);
return 0;
}

View File

@ -1,225 +0,0 @@
/*
* TTY DC driver
*
* Copyright 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "ttydrv.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/**********************************************************************
* TTYDRV_GDI_Initialize
*/
BOOL TTYDRV_GDI_Initialize(void)
{
return TTYDRV_PALETTE_Initialize();
}
/***********************************************************************
* TTYDRV_DC_CreateDC
*/
BOOL TTYDRV_DC_CreateDC(HDC hdc, TTYDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device,
LPCWSTR output, const DEVMODEW *initData)
{
TTYDRV_PDEVICE *physDev;
TRACE("(%p, %s, %s, %s, %p)\n",
hdc, debugstr_w(driver), debugstr_w(device), debugstr_w(output), initData);
physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TTYDRV_PDEVICE));
if(!physDev) {
ERR("Can't allocate physDev\n");
return FALSE;
}
*pdev = physDev;
physDev->hdc = hdc;
physDev->org.x = physDev->org.y = 0;
if(GetObjectType(hdc) == OBJ_MEMDC) {
physDev->window = NULL;
physDev->cellWidth = 1;
physDev->cellHeight = 1;
} else {
physDev->window = root_window;
physDev->cellWidth = cell_width;
physDev->cellHeight = cell_height;
}
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_DeleteDC
*/
BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
{
TRACE("(%p)\n", physDev->hdc);
HeapFree( GetProcessHeap(), 0, physDev );
return TRUE;
}
/***********************************************************************
* GetDeviceCaps (TTYDRV.@)
*/
INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
{
switch(cap)
{
case DRIVERVERSION:
return 0x300;
case TECHNOLOGY:
return DT_RASDISPLAY;
case HORZSIZE:
return 0; /* FIXME: Screen width in mm */
case VERTSIZE:
return 0; /* FIXME: Screen height in mm */
case HORZRES:
return cell_width * screen_cols;
case VERTRES:
return cell_height * screen_rows;
case BITSPIXEL:
return 1; /* FIXME */
case PLANES:
return 1;
case NUMBRUSHES:
return 16 + 6;
case NUMPENS:
return 16;
case NUMMARKERS:
return 0;
case NUMFONTS:
return 0;
case NUMCOLORS:
return 100;
case PDEVICESIZE:
return sizeof(TTYDRV_PDEVICE);
case CURVECAPS:
return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
case LINECAPS:
return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
case POLYGONALCAPS:
return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
case TEXTCAPS:
return 0;
case CLIPCAPS:
return CP_REGION;
case RASTERCAPS:
return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
case ASPECTX:
case ASPECTY:
return 36;
case ASPECTXY:
return 51;
case LOGPIXELSX:
case LOGPIXELSY:
return 72; /* FIXME */
case SIZEPALETTE:
return 256; /* FIXME */
case NUMRESERVED:
return 0;
case COLORRES:
return 0;
case PHYSICALWIDTH:
case PHYSICALHEIGHT:
case PHYSICALOFFSETX:
case PHYSICALOFFSETY:
case SCALINGFACTORX:
case SCALINGFACTORY:
case VREFRESH:
case DESKTOPVERTRES:
case DESKTOPHORZRES:
case BTLALIGNMENT:
return 0;
default:
FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap );
return 0;
}
}
/***********************************************************************
* GetDCOrgEx (TTYDRV.@)
*/
BOOL TTYDRV_GetDCOrgEx( TTYDRV_PDEVICE *physDev, LPPOINT pt )
{
*pt = physDev->org;
return TRUE;
}
/***********************************************************************
* SetDCOrg (TTYDRV.@)
*/
DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
{
DWORD ret = MAKELONG( physDev->org.x, physDev->org.y );
physDev->org.x = x;
physDev->org.y = y;
return ret;
}
/**********************************************************************
* ExtEscape (X11DRV.@)
*/
INT TTYDRV_ExtEscape( TTYDRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data )
{
switch(escape)
{
case QUERYESCSUPPORT:
if (in_data)
{
switch (*(const INT *)in_data)
{
case TTYDRV_ESCAPE:
return TRUE;
}
}
break;
case TTYDRV_ESCAPE:
if (in_data && in_count >= sizeof(enum ttydrv_escape_codes))
{
switch(*(const enum ttydrv_escape_codes *)in_data)
{
case TTYDRV_SET_DRAWABLE:
if (in_count >= sizeof(struct ttydrv_escape_set_drawable))
{
const struct ttydrv_escape_set_drawable *data = (const struct ttydrv_escape_set_drawable *)in_data;
physDev->org = data->org;
return TRUE;
}
break;
}
}
break;
}
return 0;
}

View File

@ -1,432 +0,0 @@
/*
* TTY DC graphics
*
* Copyright 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wine/debug.h"
#include "ttydrv.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/***********************************************************************
* TTYDRV_DC_Arc
*/
BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend)
{
FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_Chord
*/
BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend)
{
FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_Ellipse
*/
BOOL TTYDRV_DC_Ellipse(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
{
FIXME("(%p, %d, %d, %d, %d): stub\n", physDev->hdc, left, top, right, bottom);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_ExtFloodFill
*/
BOOL TTYDRV_DC_ExtFloodFill(TTYDRV_PDEVICE *physDev, INT x, INT y,
COLORREF color, UINT fillType)
{
FIXME("(%p, %d, %d, 0x%08lx, %u): stub\n", physDev->hdc, x, y, color, fillType);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_GetPixel
*/
COLORREF TTYDRV_DC_GetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y)
{
FIXME("(%p, %d, %d): stub\n", physDev->hdc, x, y);
return RGB(0,0,0); /* FIXME: Always returns black */
}
/***********************************************************************
* TTYDRV_DC_LineTo
*/
BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y)
{
#ifdef WINE_CURSES
INT row1, col1, row2, col2;
POINT pt[2];
TRACE("(%p, %d, %d)\n", physDev->hdc, x, y);
if(!physDev->window)
return FALSE;
GetCurrentPositionEx( physDev->hdc, &pt[0] );
pt[1].x = x;
pt[1].y = y;
LPtoDP( physDev->hdc, pt, 2 );
row1 = (physDev->org.y + pt[0].y) / physDev->cellHeight;
col1 = (physDev->org.x + pt[0].x) / physDev->cellWidth;
row2 = (physDev->org.y + pt[1].y) / physDev->cellHeight;
col2 = (physDev->org.x + pt[1].x) / physDev->cellWidth;
if(row1 > row2) {
INT tmp = row1;
row1 = row2;
row2 = tmp;
}
if(col1 > col2) {
INT tmp = col1;
col1 = col2;
col2 = tmp;
}
wmove(physDev->window, row1, col1);
if(col1 == col2) {
wvline(physDev->window, ACS_VLINE, row2-row1);
} else if(row1 == row2) {
whline(physDev->window, ACS_HLINE, col2-col1);
} else {
FIXME("Diagonal line drawing not yet supported\n");
}
wrefresh(physDev->window);
return TRUE;
#else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d): stub\n", physDev->hdc, x, y);
return TRUE;
#endif /* defined(WINE_CURSES) */
}
/***********************************************************************
* TTYDRV_DC_PaintRgn
*/
BOOL TTYDRV_DC_PaintRgn(TTYDRV_PDEVICE *physDev, HRGN hrgn)
{
FIXME("(%p, %p): stub\n", physDev->hdc, hrgn);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_Pie
*/
BOOL TTYDRV_DC_Pie(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend)
{
FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_Polygon
*/
BOOL TTYDRV_DC_Polygon(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count)
{
FIXME("(%p, %p, %d): stub\n", physDev->hdc, pt, count);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_Polyline
*/
BOOL TTYDRV_DC_Polyline(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count)
{
FIXME("(%p, %p, %d): stub\n", physDev->hdc, pt, count);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_PolyPolygon
*/
BOOL TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons)
{
FIXME("(%p, %p, %p, %u): stub\n", physDev->hdc, pt, counts, polygons);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_PolyPolyline
*/
BOOL TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines)
{
FIXME("(%p, %p, %p, %lu): stub\n", physDev->hdc, pt, counts, polylines);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_Rectangle
*/
BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
{
#ifdef WINE_CURSES
INT row1, col1, row2, col2;
RECT rect;
TRACE("(%p, %d, %d, %d, %d)\n", physDev->hdc, left, top, right, bottom);
if(!physDev->window)
return FALSE;
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
LPtoDP( physDev->hdc, (POINT *)&rect, 2 );
row1 = (physDev->org.y + rect.top) / physDev->cellHeight;
col1 = (physDev->org.x + rect.left) / physDev->cellWidth;
row2 = (physDev->org.y + rect.bottom) / physDev->cellHeight;
col2 = (physDev->org.x + rect.right) / physDev->cellWidth;
if(row1 > row2) {
INT tmp = row1;
row1 = row2;
row2 = tmp;
}
if(col1 > col2) {
INT tmp = col1;
col1 = col2;
col2 = tmp;
}
wmove(physDev->window, row1, col1);
whline(physDev->window, ACS_HLINE, col2-col1);
wmove(physDev->window, row1, col2);
wvline(physDev->window, ACS_VLINE, row2-row1);
wmove(physDev->window, row2, col1);
whline(physDev->window, ACS_HLINE, col2-col1);
wmove(physDev->window, row1, col1);
wvline(physDev->window, ACS_VLINE, row2-row1);
mvwaddch(physDev->window, row1, col1, ACS_ULCORNER);
mvwaddch(physDev->window, row1, col2, ACS_URCORNER);
mvwaddch(physDev->window, row2, col2, ACS_LRCORNER);
mvwaddch(physDev->window, row2, col1, ACS_LLCORNER);
wrefresh(physDev->window);
return TRUE;
#else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d, %d, %d): stub\n", physDev->hdc, left, top, right, bottom);
return TRUE;
#endif /* defined(WINE_CURSES) */
}
/***********************************************************************
* TTYDRV_DC_RoundRect
*/
BOOL TTYDRV_DC_RoundRect(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height)
{
FIXME("(%p, %d, %d, %d, %d, %d, %d): stub\n",
physDev->hdc, left, top, right, bottom, ell_width, ell_height);
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_SetPixel
*/
COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color)
{
#ifdef WINE_CURSES
INT row, col;
POINT pt;
TRACE("(%p, %d, %d, 0x%08lx)\n", physDev->hdc, x, y, color);
if(!physDev->window)
return FALSE;
pt.x = x;
pt.y = y;
LPtoDP( physDev->hdc, &pt, 1 );
row = (physDev->org.y + pt.y) / physDev->cellHeight;
col = (physDev->org.x + pt.x) / physDev->cellWidth;
mvwaddch(physDev->window, row, col, ACS_BULLET);
wrefresh(physDev->window);
return RGB(0,0,0); /* FIXME: Always returns black */
#else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d, 0x%08lx): stub\n", physDev->hdc, x, y, color);
return RGB(0,0,0); /* FIXME: Always returns black */
#endif /* defined(WINE_CURSES) */
}
/***********************************************************************
* TTYDRV_DC_BitBlt
*/
BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT width, INT height, TTYDRV_PDEVICE *physDevSrc,
INT xSrc, INT ySrc, DWORD rop)
{
FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %lu): stub\n",
physDevDst->hdc, xDst, yDst, width, height, physDevSrc->hdc, xSrc, ySrc, rop );
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_PatBlt
*/
BOOL TTYDRV_DC_PatBlt(TTYDRV_PDEVICE *physDev, INT left, INT top,
INT width, INT height, DWORD rop)
{
FIXME("(%p, %d, %d, %d, %d, %lu): stub\n", physDev->hdc, left, top, width, height, rop );
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_StretchBlt
*/
BOOL TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT widthDst, INT heightDst,
TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop)
{
FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %d, %d, %lu): stub\n",
physDevDst->hdc, xDst, yDst, widthDst, heightDst,
physDevSrc->hdc, xSrc, ySrc, widthSrc, heightSrc, rop );
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_ExtTextOut
*/
BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lpRect, LPCWSTR str, UINT count,
const INT *lpDx )
{
#ifdef WINE_CURSES
INT row, col;
LPSTR ascii;
DWORD len;
TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
physDev->hdc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
if(!physDev->window)
return FALSE;
row = (physDev->org.y + y) / physDev->cellHeight;
col = (physDev->org.x + x) / physDev->cellWidth;
len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL );
ascii = HeapAlloc( GetProcessHeap(), 0, len );
WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL );
mvwaddnstr(physDev->window, row, col, ascii, len);
HeapFree( GetProcessHeap(), 0, ascii );
wrefresh(physDev->window);
return TRUE;
#else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
physDev->hdc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
return TRUE;
#endif /* defined(WINE_CURSES) */
}
/***********************************************************************
* TTYDRV_DC_GetCharWidth
*/
BOOL TTYDRV_DC_GetCharWidth(TTYDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
LPINT buffer)
{
UINT c;
FIXME("(%p, %u, %u, %p): semistub\n", physDev->hdc, firstChar, lastChar, buffer);
for(c=firstChar; c<=lastChar; c++) {
buffer[c-firstChar] = physDev->cellWidth;
}
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_GetTextExtentPoint
*/
BOOL TTYDRV_DC_GetTextExtentPoint(TTYDRV_PDEVICE *physDev, LPCWSTR str, INT count,
LPSIZE size)
{
TRACE("(%p, %s, %d, %p)\n", physDev->hdc, debugstr_wn(str, count), count, size);
size->cx = count * physDev->cellWidth;
size->cy = physDev->cellHeight;
return TRUE;
}
/***********************************************************************
* TTYDRV_DC_GetTextMetrics
*/
BOOL TTYDRV_DC_GetTextMetrics(TTYDRV_PDEVICE *physDev, LPTEXTMETRICW lptm)
{
TRACE("(%p, %p)\n", physDev->hdc, lptm);
lptm->tmHeight = physDev->cellHeight;
lptm->tmAscent = 0;
lptm->tmDescent = 0;
lptm->tmInternalLeading = 0;
lptm->tmExternalLeading = 0;
lptm->tmAveCharWidth = physDev->cellWidth;
lptm->tmMaxCharWidth = physDev->cellWidth;
lptm->tmWeight = FW_MEDIUM;
lptm->tmOverhang = 0;
lptm->tmDigitizedAspectX = physDev->cellWidth;
lptm->tmDigitizedAspectY = physDev->cellHeight;
lptm->tmFirstChar = 32;
lptm->tmLastChar = 255;
lptm->tmDefaultChar = 0;
lptm->tmBreakChar = 32;
lptm->tmItalic = FALSE;
lptm->tmUnderlined = FALSE;
lptm->tmStruckOut = FALSE;
lptm->tmPitchAndFamily = TMPF_FIXED_PITCH|TMPF_DEVICE;
lptm->tmCharSet = ANSI_CHARSET;
return TRUE;
}

View File

@ -1,36 +0,0 @@
/*
* TTY DC objects
*
* Copyright 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "ttydrv.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/***********************************************************************
* SelectFont (TTYDRV.@)
*/
HFONT TTYDRV_SelectFont(TTYDRV_PDEVICE *physDev, HFONT hfont, HANDLE gdiFont)
{
TRACE("(%p, %p)\n", physDev->hdc, hfont);
return (HFONT)1; /* Use device font */
}

View File

@ -1,107 +0,0 @@
/*
* TTY palette driver
*
* Copyright 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include "gdi.h"
#include "winbase.h"
#include "ttydrv.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/**********************************************************************/
static PALETTEENTRY *COLOR_sysPal;
static unsigned int palette_size = 256; /* FIXME */
/***********************************************************************
* TTYDRV_PALETTE_Initialize
*/
BOOL TTYDRV_PALETTE_Initialize(void)
{
unsigned int i;
PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS];
TRACE("(void)\n");
COLOR_sysPal = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * palette_size);
if(COLOR_sysPal == NULL) {
WARN("No memory to create system palette!\n");
return FALSE;
}
GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, sys_pal_template );
for(i=0; i < palette_size; i++ ) {
const PALETTEENTRY *src;
PALETTEENTRY *dst = &COLOR_sysPal[i];
if(i < NB_RESERVED_COLORS/2) {
src = &sys_pal_template[i];
} else if(i >= palette_size - NB_RESERVED_COLORS/2) {
src = &sys_pal_template[NB_RESERVED_COLORS + i - palette_size];
} else {
PALETTEENTRY pe = { 0, 0, 0, 0 };
src = &pe;
}
if((src->peRed + src->peGreen + src->peBlue) <= 0xB0) {
dst->peRed = 0;
dst->peGreen = 0;
dst->peBlue = 0;
dst->peFlags = PC_SYS_USED;
} else {
dst->peRed = 255;
dst->peGreen= 255;
dst->peBlue = 255;
dst->peFlags = PC_SYS_USED;
}
}
return TRUE;
}
/***********************************************************************
* GetSystemPaletteEntries (TTYDRV.@)
*/
UINT TTYDRV_GetSystemPaletteEntries( TTYDRV_PDEVICE *dev, UINT start, UINT count,
LPPALETTEENTRY entries )
{
UINT i;
if (!entries) return palette_size;
if (start >= palette_size) return 0;
if (start + count >= palette_size) count = palette_size - start;
for (i = 0; i < count; i++)
{
entries[i].peRed = COLOR_sysPal[start + i].peRed;
entries[i].peGreen = COLOR_sysPal[start + i].peGreen;
entries[i].peBlue = COLOR_sysPal[start + i].peBlue;
entries[i].peFlags = 0;
TRACE("\tidx(%02x) -> RGB(%08lx)\n", start + i, *(COLORREF*)(entries + i) );
}
return count;
}

View File

@ -1,125 +0,0 @@
/*
* TTY driver definitions
*
* Copyright 1998 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_TTYDRV_H
#define __WINE_TTYDRV_H
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#undef ERR
#if defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES)
#ifdef HAVE_NCURSES_H
# include <ncurses.h>
#elif defined(HAVE_CURSES_H)
# include <curses.h>
#endif
#endif
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
struct tagBITMAPOBJ;
#if defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES)
#define WINE_CURSES
#endif
/**************************************************************************
* TTY GDI driver
*/
#ifndef WINE_CURSES
typedef struct { int dummy; } WINDOW;
#endif
typedef struct {
HDC hdc;
POINT org;
WINDOW *window;
int cellWidth;
int cellHeight;
} TTYDRV_PDEVICE;
extern BOOL TTYDRV_GDI_Initialize(void);
/* TTY GDI bitmap driver */
extern HBITMAP TTYDRV_BITMAP_CreateDIBSection(TTYDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset);
extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
extern BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags);
extern BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev);
extern BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT width, INT height, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, DWORD rop);
extern BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern BOOL TTYDRV_DC_Ellipse(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom);
extern BOOL TTYDRV_DC_ExtFloodFill(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color, UINT fillType);
extern BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags, const RECT *lpRect, LPCWSTR str, UINT count, const INT *lpDx);
extern BOOL TTYDRV_DC_GetCharWidth(TTYDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar, LPINT buffer);
extern COLORREF TTYDRV_DC_GetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y);
extern BOOL TTYDRV_DC_GetTextExtentPoint(TTYDRV_PDEVICE *physDev, LPCWSTR str, INT count, LPSIZE size);
extern BOOL TTYDRV_DC_GetTextMetrics(TTYDRV_PDEVICE *physDev, TEXTMETRICW *metrics);
extern BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y);
extern BOOL TTYDRV_DC_PaintRgn(TTYDRV_PDEVICE *physDev, HRGN hrgn);
extern BOOL TTYDRV_DC_PatBlt(TTYDRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop);
extern BOOL TTYDRV_DC_Pie(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern BOOL TTYDRV_DC_Polygon(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count);
extern BOOL TTYDRV_DC_Polyline(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count);
extern BOOL TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons);
extern BOOL TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines);
extern BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom);
extern BOOL TTYDRV_DC_RoundRect(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height);
extern COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color);
extern BOOL TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop);
INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse);
/* TTY GDI palette driver */
extern BOOL TTYDRV_PALETTE_Initialize(void);
#define TTYDRV_ESCAPE 6999
enum ttydrv_escape_codes
{
TTYDRV_SET_DRAWABLE /* set current drawable for a DC */
};
struct ttydrv_escape_set_drawable
{
enum ttydrv_escape_codes code; /* escape code (TTYDRV_SET_DRAWABLE) */
POINT org; /* origin of DC relative to drawable */
};
/**************************************************************************
* TTY USER driver
*/
extern int cell_width;
extern int cell_height;
extern int screen_rows;
extern int screen_cols;
extern WINDOW *root_window;
#endif /* !defined(__WINE_TTYDRV_H) */

View File

@ -1,87 +0,0 @@
/*
* TTYDRV initialization code
*
* Copyright 2000 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
#include "wine/debug.h"
#include "ttydrv.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
int cell_width = 8;
int cell_height = 8;
int screen_rows = 50; /* default value */
int screen_cols = 80; /* default value */
WINDOW *root_window;
/***********************************************************************
* TTYDRV process initialisation routine
*/
static void process_attach(void)
{
#ifdef WINE_CURSES
if ((root_window = initscr()))
{
werase(root_window);
wrefresh(root_window);
}
getmaxyx(root_window, screen_rows, screen_cols);
#endif /* WINE_CURSES */
TTYDRV_GDI_Initialize();
}
/***********************************************************************
* TTYDRV process termination routine
*/
static void process_detach(void)
{
#ifdef WINE_CURSES
if (root_window) endwin();
#endif /* WINE_CURSES */
}
/***********************************************************************
* TTYDRV initialisation routine
*/
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinst);
process_attach();
break;
case DLL_PROCESS_DETACH:
process_detach();
break;
}
return TRUE;
}

View File

@ -1,44 +0,0 @@
# GDI driver
@ cdecl Arc(ptr long long long long long long long long) TTYDRV_DC_Arc
@ cdecl BitBlt(ptr long long long long ptr long long long) TTYDRV_DC_BitBlt
@ cdecl Chord(ptr long long long long long long long long) TTYDRV_DC_Chord
@ cdecl CreateDC(long ptr wstr wstr wstr ptr) TTYDRV_DC_CreateDC
@ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC
@ cdecl Ellipse(ptr long long long long) TTYDRV_DC_Ellipse
@ cdecl ExtEscape(ptr long long ptr long ptr) TTYDRV_ExtEscape
@ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) TTYDRV_DC_ExtTextOut
@ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits
@ cdecl GetCharWidth(ptr long long ptr) TTYDRV_DC_GetCharWidth
@ cdecl GetDCOrgEx(ptr ptr) TTYDRV_GetDCOrgEx
@ cdecl GetDeviceCaps(ptr long) TTYDRV_GetDeviceCaps
@ cdecl GetPixel(ptr long long) TTYDRV_DC_GetPixel
@ cdecl GetSystemPaletteEntries(ptr long long ptr) TTYDRV_GetSystemPaletteEntries
@ cdecl GetTextExtentPoint(ptr ptr long ptr) TTYDRV_DC_GetTextExtentPoint
@ cdecl GetTextMetrics(ptr ptr) TTYDRV_DC_GetTextMetrics
@ cdecl LineTo(ptr long long) TTYDRV_DC_LineTo
@ cdecl PaintRgn(ptr long) TTYDRV_DC_PaintRgn
@ cdecl PatBlt(ptr long long long long long) TTYDRV_DC_PatBlt
@ cdecl Pie(ptr long long long long long long long long) TTYDRV_DC_Pie
@ cdecl PolyPolygon(ptr ptr ptr long) TTYDRV_DC_PolyPolygon
@ cdecl PolyPolyline(ptr ptr ptr long) TTYDRV_DC_PolyPolyline
@ cdecl Polygon(ptr ptr long) TTYDRV_DC_Polygon
@ cdecl Polyline(ptr ptr long) TTYDRV_DC_Polyline
@ cdecl Rectangle(ptr long long long long) TTYDRV_DC_Rectangle
@ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect
@ cdecl SelectFont(ptr long long) TTYDRV_SelectFont
@ cdecl SetBitmapBits(long ptr long) TTYDRV_SetBitmapBits
@ cdecl SetDCOrg(ptr long long) TTYDRV_SetDCOrg
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice
@ cdecl SetPixel(ptr long long long) TTYDRV_DC_SetPixel
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) TTYDRV_DC_StretchBlt
# USER driver
@ cdecl CreateDesktopWindow(long) TTYDRV_CreateDesktopWindow
@ cdecl CreateWindow(long ptr long) TTYDRV_CreateWindow
@ cdecl DestroyWindow(long) TTYDRV_DestroyWindow
@ cdecl GetDC(long long long long) TTYDRV_GetDC
@ cdecl SetWindowPos(ptr) TTYDRV_SetWindowPos
@ cdecl ShowWindow(long long) TTYDRV_ShowWindow

View File

@ -1,766 +0,0 @@
/*
* TTY window driver
*
* Copyright 1998,1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "ttydrv.h"
#include "ntstatus.h"
#include "win.h"
#include "winpos.h"
#include "wownt32.h"
#include "wine/wingdi16.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
#define SWP_AGG_NOGEOMETRYCHANGE \
(SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
#define SWP_AGG_NOPOSCHANGE \
(SWP_AGG_NOGEOMETRYCHANGE | SWP_NOZORDER)
#define SWP_AGG_STATUSFLAGS \
(SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
/***********************************************************************
* get_server_visible_region
*/
static HRGN get_server_visible_region( HWND hwnd, UINT flags )
{
RGNDATA *data;
NTSTATUS status;
HRGN ret = 0;
size_t size = 256;
do
{
if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) + size - 1 ))) return 0;
SERVER_START_REQ( get_visible_region )
{
req->window = hwnd;
req->flags = flags;
wine_server_set_reply( req, data->Buffer, size );
if (!(status = wine_server_call( req )))
{
size_t reply_size = wine_server_reply_size( reply );
data->rdh.dwSize = sizeof(data->rdh);
data->rdh.iType = RDH_RECTANGLES;
data->rdh.nCount = reply_size / sizeof(RECT);
data->rdh.nRgnSize = reply_size;
ret = ExtCreateRegion( NULL, size, data );
}
else size = reply->total_size;
}
SERVER_END_REQ;
HeapFree( GetProcessHeap(), 0, data );
} while (status == STATUS_BUFFER_OVERFLOW);
if (status) SetLastError( RtlNtStatusToDosError(status) );
return ret;
}
/***********************************************************************
* set_window_pos
*
* Set a window position and Z order.
*/
static BOOL set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
const RECT *rectClient, UINT swp_flags )
{
WND *win = WIN_GetPtr( hwnd );
BOOL ret;
if (!win) return FALSE;
if (win == WND_OTHER_PROCESS)
{
if (IsWindow( hwnd )) ERR( "cannot set rectangles of other process window %p\n", hwnd );
return FALSE;
}
SERVER_START_REQ( set_window_pos )
{
req->handle = hwnd;
req->previous = insert_after;
req->flags = swp_flags;
req->window.left = rectWindow->left;
req->window.top = rectWindow->top;
req->window.right = rectWindow->right;
req->window.bottom = rectWindow->bottom;
req->client.left = rectClient->left;
req->client.top = rectClient->top;
req->client.right = rectClient->right;
req->client.bottom = rectClient->bottom;
ret = !wine_server_call( req );
}
SERVER_END_REQ;
if (win == WND_DESKTOP) return ret;
if (ret)
{
win->rectWindow = *rectWindow;
win->rectClient = *rectClient;
TRACE( "win %p window (%ld,%ld)-(%ld,%ld) client (%ld,%ld)-(%ld,%ld)\n", hwnd,
rectWindow->left, rectWindow->top, rectWindow->right, rectWindow->bottom,
rectClient->left, rectClient->top, rectClient->right, rectClient->bottom );
}
WIN_ReleasePtr( win );
return ret;
}
/**********************************************************************
* CreateDesktopWindow (TTYDRV.@)
*/
BOOL TTYDRV_CreateDesktopWindow( HWND hwnd )
{
RECT rect;
SetRect( &rect, 0, 0, cell_width * screen_cols, cell_height * screen_rows );
set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER );
SetPropA( hwnd, "__wine_ttydrv_window", root_window );
return TRUE;
}
/**********************************************************************
* CreateWindow (TTYDRV.@)
*/
BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{
BOOL ret;
RECT rect;
HWND hwndLinkAfter;
CBT_CREATEWNDA cbtc;
TRACE("(%p)\n", hwnd);
/* initialize the dimensions before sending WM_GETMINMAXINFO */
SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER );
#ifdef WINE_CURSES
/* Only create top-level windows */
if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())
{
WINDOW *window;
const INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
window = subwin( root_window, cs->cy/cellHeight, cs->cx/cellWidth,
cs->y/cellHeight, cs->x/cellWidth);
werase(window);
wrefresh(window);
SetPropA( hwnd, "__wine_ttydrv_window", window );
}
#else /* defined(WINE_CURSES) */
FIXME("(%p): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */
/* Call the WH_CBT hook */
hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
cbtc.lpcs = cs;
cbtc.hwndInsertAfter = hwndLinkAfter;
if (HOOK_CallHooks( WH_CBT, HCBT_CREATEWND, (WPARAM)hwnd, (LPARAM)&cbtc, unicode ))
{
TRACE("CBT-hook returned !0\n");
return FALSE;
}
if (unicode)
{
ret = SendMessageW( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
if (ret) ret = (SendMessageW( hwnd, WM_CREATE, 0, (LPARAM)cs ) != -1);
}
else
{
ret = SendMessageA( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
if (ret) ret = (SendMessageA( hwnd, WM_CREATE, 0, (LPARAM)cs ) != -1);
}
if (ret) NotifyWinEvent(EVENT_OBJECT_CREATE, hwnd, OBJID_WINDOW, 0);
return ret;
}
/***********************************************************************
* DestroyWindow (TTYDRV.@)
*/
BOOL TTYDRV_DestroyWindow( HWND hwnd )
{
#ifdef WINE_CURSES
WINDOW *window = GetPropA( hwnd, "__wine_ttydrv_window" );
TRACE("(%p)\n", hwnd);
if (window && window != root_window) delwin(window);
#else /* defined(WINE_CURSES) */
FIXME("(%p): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */
return TRUE;
}
/***********************************************************************
* GetDC (TTYDRV.@)
*
* Set the drawable, origin and dimensions for the DC associated to
* a given window.
*/
BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
{
struct ttydrv_escape_set_drawable escape;
if(flags & DCX_WINDOW)
{
RECT rect;
GetWindowRect( hwnd, &rect );
escape.org.x = rect.left;
escape.org.y = rect.top;
}
else
{
escape.org.x = escape.org.y = 0;
MapWindowPoints( hwnd, 0, &escape.org, 1 );
}
escape.code = TTYDRV_SET_DRAWABLE;
ExtEscape( hdc, TTYDRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) ||
SetHookFlags16( HDC_16(hdc), DCHF_VALIDATEVISRGN )) /* DC was dirty */
{
/* need to recompute the visible region */
HRGN visRgn = get_server_visible_region( hwnd, flags );
if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))
CombineRgn( visRgn, visRgn, hrgn, (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF );
SelectVisRgn16( HDC_16(hdc), HRGN_16(visRgn) );
DeleteObject( visRgn );
}
return TRUE;
}
/* fix redundant flags and values in the WINDOWPOS structure */
static BOOL fixup_flags( WINDOWPOS *winpos )
{
HWND parent;
WND *wndPtr = WIN_GetPtr( winpos->hwnd );
BOOL ret = TRUE;
if (!wndPtr || wndPtr == WND_OTHER_PROCESS)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
}
winpos->hwnd = wndPtr->hwndSelf; /* make it a full handle */
/* Finally make sure that all coordinates are valid */
if (winpos->x < -32768) winpos->x = -32768;
else if (winpos->x > 32767) winpos->x = 32767;
if (winpos->y < -32768) winpos->y = -32768;
else if (winpos->y > 32767) winpos->y = 32767;
if (winpos->cx < 0) winpos->cx = 0;
else if (winpos->cx > 32767) winpos->cx = 32767;
if (winpos->cy < 0) winpos->cy = 0;
else if (winpos->cy > 32767) winpos->cy = 32767;
parent = GetAncestor( winpos->hwnd, GA_PARENT );
if (!IsWindowVisible( parent )) winpos->flags |= SWP_NOREDRAW;
if (wndPtr->dwStyle & WS_VISIBLE) winpos->flags &= ~SWP_SHOWWINDOW;
else
{
winpos->flags &= ~SWP_HIDEWINDOW;
if (!(winpos->flags & SWP_SHOWWINDOW)) winpos->flags |= SWP_NOREDRAW;
}
if ((wndPtr->rectWindow.right - wndPtr->rectWindow.left == winpos->cx) &&
(wndPtr->rectWindow.bottom - wndPtr->rectWindow.top == winpos->cy))
winpos->flags |= SWP_NOSIZE; /* Already the right size */
if ((wndPtr->rectWindow.left == winpos->x) && (wndPtr->rectWindow.top == winpos->y))
winpos->flags |= SWP_NOMOVE; /* Already the right position */
if ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)
{
if (!(winpos->flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW))) /* Bring to the top when activating */
{
winpos->flags &= ~SWP_NOZORDER;
winpos->hwndInsertAfter = HWND_TOP;
}
}
/* Check hwndInsertAfter */
if (winpos->flags & SWP_NOZORDER) goto done;
/* fix sign extension */
if (winpos->hwndInsertAfter == (HWND)0xffff) winpos->hwndInsertAfter = HWND_TOPMOST;
else if (winpos->hwndInsertAfter == (HWND)0xfffe) winpos->hwndInsertAfter = HWND_NOTOPMOST;
/* FIXME: TOPMOST not supported yet */
if ((winpos->hwndInsertAfter == HWND_TOPMOST) ||
(winpos->hwndInsertAfter == HWND_NOTOPMOST)) winpos->hwndInsertAfter = HWND_TOP;
/* hwndInsertAfter must be a sibling of the window */
if (winpos->hwndInsertAfter == HWND_TOP)
{
if (GetWindow(winpos->hwnd, GW_HWNDFIRST) == winpos->hwnd)
winpos->flags |= SWP_NOZORDER;
}
else if (winpos->hwndInsertAfter == HWND_BOTTOM)
{
if (GetWindow(winpos->hwnd, GW_HWNDLAST) == winpos->hwnd)
winpos->flags |= SWP_NOZORDER;
}
else
{
if (GetAncestor( winpos->hwndInsertAfter, GA_PARENT ) != parent) ret = FALSE;
else
{
/* don't need to change the Zorder of hwnd if it's already inserted
* after hwndInsertAfter or when inserting hwnd after itself.
*/
if ((winpos->hwnd == winpos->hwndInsertAfter) ||
(winpos->hwnd == GetWindow( winpos->hwndInsertAfter, GW_HWNDNEXT )))
winpos->flags |= SWP_NOZORDER;
}
}
done:
WIN_ReleasePtr( wndPtr );
return ret;
}
/***********************************************************************
* SWP_DoNCCalcSize
*/
static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RECT* pNewClientRect )
{
UINT wvrFlags = 0;
WND *wndPtr;
if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
/* Send WM_NCCALCSIZE message to get new client area */
if( (pWinpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
{
NCCALCSIZE_PARAMS params;
WINDOWPOS winposCopy;
params.rgrc[0] = *pNewWindowRect;
params.rgrc[1] = wndPtr->rectWindow;
params.rgrc[2] = wndPtr->rectClient;
params.lppos = &winposCopy;
winposCopy = *pWinpos;
WIN_ReleasePtr( wndPtr );
wvrFlags = SendMessageW( pWinpos->hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)&params );
*pNewClientRect = params.rgrc[0];
if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
TRACE( "hwnd %p old win %s old client %s new win %s new client %s\n", pWinpos->hwnd,
wine_dbgstr_rect(&wndPtr->rectWindow), wine_dbgstr_rect(&wndPtr->rectClient),
wine_dbgstr_rect(pNewWindowRect), wine_dbgstr_rect(pNewClientRect) );
if( pNewClientRect->left != wndPtr->rectClient.left ||
pNewClientRect->top != wndPtr->rectClient.top )
pWinpos->flags &= ~SWP_NOCLIENTMOVE;
if( (pNewClientRect->right - pNewClientRect->left !=
wndPtr->rectClient.right - wndPtr->rectClient.left))
pWinpos->flags &= ~SWP_NOCLIENTSIZE;
else
wvrFlags &= ~WVR_HREDRAW;
if (pNewClientRect->bottom - pNewClientRect->top !=
wndPtr->rectClient.bottom - wndPtr->rectClient.top)
pWinpos->flags &= ~SWP_NOCLIENTSIZE;
else
wvrFlags &= ~WVR_VREDRAW;
}
else
{
if (!(pWinpos->flags & SWP_NOMOVE) &&
(pNewClientRect->left != wndPtr->rectClient.left ||
pNewClientRect->top != wndPtr->rectClient.top))
pWinpos->flags &= ~SWP_NOCLIENTMOVE;
}
WIN_ReleasePtr( wndPtr );
return wvrFlags;
}
struct move_owned_info
{
HWND owner;
HWND insert_after;
};
static BOOL CALLBACK move_owned_popups( HWND hwnd, LPARAM lparam )
{
struct move_owned_info *info = (struct move_owned_info *)lparam;
if (hwnd == info->owner) return FALSE;
if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) &&
GetWindow( hwnd, GW_OWNER ) == info->owner)
{
SetWindowPos( hwnd, info->insert_after, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE |
SWP_NOSENDCHANGING | SWP_DEFERERASE );
info->insert_after = hwnd;
}
return TRUE;
}
/***********************************************************************
* SWP_DoOwnedPopups
*
* fix Z order taking into account owned popups -
* basically we need to maintain them above the window that owns them
*
* FIXME: hide/show owned popups when owner visibility changes.
*/
static HWND SWP_DoOwnedPopups(HWND hwnd, HWND hwndInsertAfter)
{
HWND owner = GetWindow( hwnd, GW_OWNER );
LONG style = GetWindowLongW( hwnd, GWL_STYLE );
struct move_owned_info info;
TRACE("(%p) hInsertAfter = %p\n", hwnd, hwndInsertAfter );
if ((style & WS_POPUP) && owner)
{
/* make sure this popup stays above the owner */
if( hwndInsertAfter != HWND_TOP )
{
HWND hwndLocalPrev = HWND_TOP;
HWND prev = GetWindow( owner, GW_HWNDPREV );
while (prev && prev != hwndInsertAfter)
{
if (hwndLocalPrev == HWND_TOP && GetWindowLongW( prev, GWL_STYLE ) & WS_VISIBLE)
hwndLocalPrev = prev;
prev = GetWindow( prev, GW_HWNDPREV );
}
if (!prev) hwndInsertAfter = hwndLocalPrev;
}
}
else if (style & WS_CHILD) return hwndInsertAfter;
info.owner = hwnd;
info.insert_after = hwndInsertAfter;
EnumWindows( move_owned_popups, (LPARAM)&info );
return info.insert_after;
}
/***********************************************************************
* SWP_DoWinPosChanging
*/
static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT* pNewClientRect )
{
WND *wndPtr;
/* Send WM_WINDOWPOSCHANGING message */
if (!(pWinpos->flags & SWP_NOSENDCHANGING))
SendMessageW( pWinpos->hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)pWinpos );
if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) || wndPtr == WND_OTHER_PROCESS) return FALSE;
/* Calculate new position and size */
*pNewWindowRect = wndPtr->rectWindow;
*pNewClientRect = (wndPtr->dwStyle & WS_MINIMIZE) ? wndPtr->rectWindow
: wndPtr->rectClient;
if (!(pWinpos->flags & SWP_NOSIZE))
{
pNewWindowRect->right = pNewWindowRect->left + pWinpos->cx;
pNewWindowRect->bottom = pNewWindowRect->top + pWinpos->cy;
}
if (!(pWinpos->flags & SWP_NOMOVE))
{
pNewWindowRect->left = pWinpos->x;
pNewWindowRect->top = pWinpos->y;
pNewWindowRect->right += pWinpos->x - wndPtr->rectWindow.left;
pNewWindowRect->bottom += pWinpos->y - wndPtr->rectWindow.top;
OffsetRect( pNewClientRect, pWinpos->x - wndPtr->rectWindow.left,
pWinpos->y - wndPtr->rectWindow.top );
}
pWinpos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
TRACE( "hwnd %p, after %p, swp %d,%d %dx%d flags %08x\n",
pWinpos->hwnd, pWinpos->hwndInsertAfter, pWinpos->x, pWinpos->y,
pWinpos->cx, pWinpos->cy, pWinpos->flags );
TRACE( "current %s style %08lx new %s\n",
wine_dbgstr_rect( &wndPtr->rectWindow ), wndPtr->dwStyle,
wine_dbgstr_rect( pNewWindowRect ));
WIN_ReleasePtr( wndPtr );
return TRUE;
}
/***********************************************************************
* SetWindowPos (TTYDRV.@)
*/
BOOL TTYDRV_SetWindowPos( WINDOWPOS *winpos )
{
RECT newWindowRect, newClientRect;
UINT orig_flags;
TRACE( "hwnd %p, after %p, swp %d,%d %dx%d flags %08x\n",
winpos->hwnd, winpos->hwndInsertAfter, winpos->x, winpos->y,
winpos->cx, winpos->cy, winpos->flags);
orig_flags = winpos->flags;
winpos->flags &= ~SWP_WINE_NOHOSTMOVE;
/* Check window handle */
if (winpos->hwnd == GetDesktopWindow()) return FALSE;
/* First make sure that coordinates are valid for WM_WINDOWPOSCHANGING */
if (!(winpos->flags & SWP_NOMOVE))
{
if (winpos->x < -32768) winpos->x = -32768;
else if (winpos->x > 32767) winpos->x = 32767;
if (winpos->y < -32768) winpos->y = -32768;
else if (winpos->y > 32767) winpos->y = 32767;
}
if (!(winpos->flags & SWP_NOSIZE))
{
if (winpos->cx < 0) winpos->cx = 0;
else if (winpos->cx > 32767) winpos->cx = 32767;
if (winpos->cy < 0) winpos->cy = 0;
else if (winpos->cy > 32767) winpos->cy = 32767;
}
if (!SWP_DoWinPosChanging( winpos, &newWindowRect, &newClientRect )) return FALSE;
/* Fix redundant flags */
if (!fixup_flags( winpos )) return FALSE;
if((winpos->flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) != SWP_NOZORDER)
{
if (GetAncestor( winpos->hwnd, GA_PARENT ) == GetDesktopWindow())
winpos->hwndInsertAfter = SWP_DoOwnedPopups( winpos->hwnd, winpos->hwndInsertAfter );
}
/* Common operations */
SWP_DoNCCalcSize( winpos, &newWindowRect, &newClientRect );
if (!set_window_pos( winpos->hwnd, winpos->hwndInsertAfter,
&newWindowRect, &newClientRect, orig_flags ))
return FALSE;
if( winpos->flags & SWP_HIDEWINDOW )
HideCaret(winpos->hwnd);
else if (winpos->flags & SWP_SHOWWINDOW)
ShowCaret(winpos->hwnd);
if (!(winpos->flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW)))
{
/* child windows get WM_CHILDACTIVATE message */
if ((GetWindowLongW( winpos->hwnd, GWL_STYLE ) & (WS_CHILD | WS_POPUP)) == WS_CHILD)
SendMessageA( winpos->hwnd, WM_CHILDACTIVATE, 0, 0 );
else
SetForegroundWindow( winpos->hwnd );
}
/* And last, send the WM_WINDOWPOSCHANGED message */
TRACE("\tstatus flags = %04x\n", winpos->flags & SWP_AGG_STATUSFLAGS);
if (((winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE))
{
/* WM_WINDOWPOSCHANGED is sent even if SWP_NOSENDCHANGING is set
and always contains final window position.
*/
winpos->x = newWindowRect.left;
winpos->y = newWindowRect.top;
winpos->cx = newWindowRect.right - newWindowRect.left;
winpos->cy = newWindowRect.bottom - newWindowRect.top;
SendMessageW( winpos->hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)winpos );
}
return TRUE;
}
/***********************************************************************
* WINPOS_MinMaximize (internal)
*
*Lifted from x11 driver
*/
static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
{
UINT swpFlags = 0;
WINDOWPLACEMENT wpl;
TRACE("%p %u\n", hwnd, cmd );
FIXME("(%p): stub\n", hwnd);
wpl.length = sizeof(wpl);
GetWindowPlacement( hwnd, &wpl );
/* If I glark this right, yields an immutable window*/
swpFlags = SWP_NOSIZE | SWP_NOMOVE;
/*cmd handling goes here. see dlls/x1drv/winpos.c*/
return swpFlags;
}
/***********************************************************************
* ShowWindow (TTYDRV.@)
*
*Lifted from x11 driver
*Sets the specified windows' show state.
*/
BOOL TTYDRV_ShowWindow( HWND hwnd, INT cmd )
{
WND *wndPtr;
LONG style = GetWindowLongW( hwnd, GWL_STYLE );
BOOL wasVisible = (style & WS_VISIBLE) != 0;
BOOL showFlag = TRUE;
RECT newPos = {0, 0, 0, 0};
UINT swp = 0;
TRACE("hwnd=%p, cmd=%d, wasVisible %d\n", hwnd, cmd, wasVisible);
switch(cmd)
{
case SW_HIDE:
if (!wasVisible) return FALSE;
showFlag = FALSE;
swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER;
break;
case SW_SHOWMINNOACTIVE:
swp |= SWP_NOACTIVATE | SWP_NOZORDER;
/* fall through */
case SW_SHOWMINIMIZED:
case SW_FORCEMINIMIZE: /* FIXME: Does not work if thread is hung. */
swp |= SWP_SHOWWINDOW;
/* fall through */
case SW_MINIMIZE:
swp |= SWP_FRAMECHANGED;
if( !(style & WS_MINIMIZE) )
swp |= WINPOS_MinMaximize( hwnd, SW_MINIMIZE, &newPos );
else swp |= SWP_NOSIZE | SWP_NOMOVE;
break;
case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
if( !(style & WS_MAXIMIZE) )
swp |= WINPOS_MinMaximize( hwnd, SW_MAXIMIZE, &newPos );
else swp |= SWP_NOSIZE | SWP_NOMOVE;
break;
case SW_SHOWNA:
swp |= SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if (style & WS_CHILD) swp |= SWP_NOZORDER;
break;
case SW_SHOW:
if (wasVisible) return TRUE;
swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
break;
case SW_RESTORE:
swp |= SWP_FRAMECHANGED;
/* fall through */
case SW_SHOWNOACTIVATE:
swp |= SWP_NOACTIVATE | SWP_NOZORDER;
/* fall through */
case SW_SHOWNORMAL: /* same as SW_NORMAL: */
case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
swp |= SWP_SHOWWINDOW;
if (style & (WS_MINIMIZE | WS_MAXIMIZE))
swp |= WINPOS_MinMaximize( hwnd, SW_RESTORE, &newPos );
else swp |= SWP_NOSIZE | SWP_NOMOVE;
break;
}
if (showFlag != wasVisible || cmd == SW_SHOWNA)
{
SendMessageW( hwnd, WM_SHOWWINDOW, showFlag, 0 );
if (!IsWindow( hwnd )) return wasVisible;
}
/* ShowWindow won't activate a not being maximized child window */
if ((style & WS_CHILD) && cmd != SW_MAXIMIZE)
swp |= SWP_NOACTIVATE | SWP_NOZORDER;
SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top,
newPos.right, newPos.bottom, LOWORD(swp) );
if (cmd == SW_HIDE)
{
HWND hFocus;
/* FIXME: This will cause the window to be activated irrespective
* of whether it is owned by the same thread. Has to be done
* asynchronously.
*/
if (hwnd == GetActiveWindow())
WINPOS_ActivateOtherWindow(hwnd);
/* Revert focus to parent */
hFocus = GetFocus();
if (hwnd == hFocus || IsChild(hwnd, hFocus))
{
HWND parent = GetAncestor(hwnd, GA_PARENT);
if (parent == GetDesktopWindow()) parent = 0;
SetFocus(parent);
}
}
if (IsIconic(hwnd)) WINPOS_ShowIconTitle( hwnd, TRUE );
if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return wasVisible;
if (wndPtr->flags & WIN_NEED_SIZE)
{
/* should happen only in CreateWindowEx() */
int wParam = SIZE_RESTORED;
RECT client = wndPtr->rectClient;
wndPtr->flags &= ~WIN_NEED_SIZE;
if (wndPtr->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED;
else if (wndPtr->dwStyle & WS_MINIMIZE) wParam = SIZE_MINIMIZED;
WIN_ReleasePtr( wndPtr );
SendMessageW( hwnd, WM_SIZE, wParam,
MAKELONG( client.right - client.left, client.bottom - client.top ));
SendMessageW( hwnd, WM_MOVE, 0, MAKELONG( client.left, client.top ));
}
else WIN_ReleasePtr( wndPtr );
return wasVisible;
}