2005-09-14 15:48:11 +00:00
|
|
|
/* WIN32Server - Implements window handling for MSWindows
|
|
|
|
|
|
|
|
Copyright (C) 2005 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Fred Kiefer <FredKiefer@gmx.de>
|
|
|
|
Date: March 2002
|
|
|
|
Part of this code have been re-written by:
|
|
|
|
Tom MacSween <macsweent@sympatico.ca>
|
|
|
|
Date August 2005
|
2007-10-29 23:25:10 +00:00
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
This file is part of the GNU Objective C User Interface Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 23:25:10 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2005-09-14 15:48:11 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:12:46 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 23:25:10 +00:00
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
2005-09-14 15:48:11 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 23:25:10 +00:00
|
|
|
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; see the file COPYING.LIB.
|
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
2005-09-14 15:48:11 +00:00
|
|
|
|
2008-02-14 22:26:00 +00:00
|
|
|
#include <AppKit/NSEvent.h>
|
|
|
|
#include <AppKit/NSView.h>
|
|
|
|
#include <AppKit/NSWindow.h>
|
|
|
|
#include "win32/WIN32Server.h"
|
|
|
|
#include "win32/WIN32Geometry.h"
|
2005-09-14 15:48:11 +00:00
|
|
|
|
|
|
|
static void
|
2006-09-12 19:53:46 +00:00
|
|
|
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
2005-09-14 15:48:11 +00:00
|
|
|
{
|
|
|
|
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
|
|
|
|
2008-02-14 21:13:17 +00:00
|
|
|
if (!win->useHDC || win->backingStoreEmpty)
|
|
|
|
{
|
|
|
|
NSWindow *window = GSWindowWithNumber((int)hwnd);
|
|
|
|
NSRect r = MSWindowRectToGS(svr, hwnd, rect);
|
|
|
|
|
|
|
|
/*
|
|
|
|
NSLog(@"Invalidated window %d %@ (%d, %d, %d, %d)", hwnd,
|
|
|
|
NSStringFromRect(r), rect.left, rect.top, rect.right, rect.bottom);
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Repaint the windows's client area */
|
|
|
|
[[[window contentView] superview] setNeedsDisplayInRect: r];
|
|
|
|
// FIXME: We should never do a direct draw call here!
|
|
|
|
[[[window contentView] superview] displayIfNeeded];
|
|
|
|
win->backingStoreEmpty = NO;
|
|
|
|
}
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
if (win->useHDC)
|
|
|
|
{
|
|
|
|
HDC hdc = GetDC((HWND)hwnd);
|
|
|
|
WINBOOL result;
|
|
|
|
|
|
|
|
result = BitBlt(hdc, rect.left, rect.top,
|
|
|
|
(rect.right - rect.left), (rect.bottom - rect.top),
|
|
|
|
win->hdc, rect.left, rect.top, SRCCOPY);
|
|
|
|
if (!result)
|
|
|
|
{
|
2008-02-14 21:13:17 +00:00
|
|
|
NSLog(@"validateWindow failed %d", GetLastError());
|
|
|
|
}
|
2005-09-14 15:48:11 +00:00
|
|
|
ReleaseDC((HWND)hwnd, hdc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@implementation WIN32Server (w32_windowdisplay)
|
|
|
|
|
|
|
|
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
|
|
|
//SW_OTHERUNZOOM //window is being uncovered
|
|
|
|
//SW_OTHERZOOM //window is being covered by window that has maximized.
|
|
|
|
//SW_PARENTCLOSING // window's owner window is being minimized.
|
|
|
|
//SW_PARENTOPENING //The window's owner window is being restored.
|
|
|
|
//zero - 0 //call to the ShowWindow function
|
|
|
|
|
|
|
|
switch ((int)wParam)
|
|
|
|
{
|
|
|
|
case TRUE:
|
|
|
|
{
|
|
|
|
switch ((int)lParam)
|
|
|
|
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2007-01-31 14:04:20 +00:00
|
|
|
ShowWindow(hwnd, SW_SHOW);
|
2005-09-14 15:48:11 +00:00
|
|
|
flags._eventHandled=YES;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SW_PARENTCLOSING:
|
|
|
|
{
|
2007-01-31 14:04:20 +00:00
|
|
|
ShowWindow(hwnd, SW_SHOW);
|
2005-09-14 15:48:11 +00:00
|
|
|
flags._eventHandled=YES;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FALSE:
|
|
|
|
{
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) decodeWM_NCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (LRESULT) decodeWM_ERASEBKGNDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
|
|
|
// GS handles this for now...
|
|
|
|
return (LRESULT)1;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) decodeWM_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
|
|
|
RECT rect;
|
2008-02-14 21:13:17 +00:00
|
|
|
if (GetUpdateRect(hwnd, &rect, TRUE))
|
|
|
|
{
|
2009-03-04 09:58:41 +00:00
|
|
|
NSRect r = MSWindowRectToGS(self, hwnd, rect);
|
|
|
|
NSWindow *window = GSWindowWithNumber((int)hwnd);
|
|
|
|
[[[window contentView] superview] setNeedsDisplayInRect: r];
|
2005-09-14 15:48:11 +00:00
|
|
|
}
|
|
|
|
|
2009-03-04 09:58:41 +00:00
|
|
|
//flags._eventHandled = YES; -->DefWindowProc validates the event
|
2005-09-14 15:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) decodeWM_SYNCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
|
|
|
// stub for future dev
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) decodeWM_CAPTURECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
|
|
|
// stub for future dev
|
|
|
|
}
|
|
|
|
|
2005-10-21 03:07:19 +00:00
|
|
|
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
2005-09-14 15:48:11 +00:00
|
|
|
{
|
|
|
|
// stub for future dev
|
2008-02-14 22:26:00 +00:00
|
|
|
return currentAppIcon;
|
2005-09-14 15:48:11 +00:00
|
|
|
}
|
|
|
|
|
2005-10-21 03:07:19 +00:00
|
|
|
- (HICON) decodeWM_SETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
|
|
{
|
2008-02-14 22:26:00 +00:00
|
|
|
return currentAppIcon;
|
2005-09-14 15:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|