2002-04-21 22:51:21 +00:00
|
|
|
/* WIN32Server - Implements window handling for MSWindows
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
Copyright (C) 2002,2005 Free Software Foundation, Inc.
|
2002-04-21 22:51:21 +00:00
|
|
|
|
|
|
|
Written by: Fred Kiefer <FredKiefer@gmx.de>
|
|
|
|
Date: March 2002
|
2005-09-14 15:48:11 +00:00
|
|
|
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
|
|
|
|
2002-04-21 22:51:21 +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
|
2002-04-21 22:51:21 +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
|
|
|
|
2002-04-21 22:51:21 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
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.
|
2002-04-21 22:51:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WIN32Server_h_INCLUDE
|
|
|
|
#define _WIN32Server_h_INCLUDE
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
#include <Foundation/NSNotification.h>
|
|
|
|
#include <Foundation/NSDebug.h>
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSValue.h>
|
|
|
|
#include <Foundation/NSConnection.h>
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
#include <Foundation/NSTimer.h>
|
|
|
|
#include <AppKit/AppKitExceptions.h>
|
|
|
|
#include <AppKit/NSApplication.h>
|
|
|
|
#include <AppKit/NSGraphics.h>
|
|
|
|
#include <AppKit/NSMenu.h>
|
|
|
|
#include <AppKit/NSWindow.h>
|
|
|
|
#include <AppKit/NSView.h>
|
|
|
|
#include <AppKit/NSEvent.h>
|
|
|
|
#include <AppKit/NSCursor.h>
|
|
|
|
#include <AppKit/NSText.h>
|
2005-10-21 03:07:19 +00:00
|
|
|
#include <AppKit/NSPopUpButton.h>
|
|
|
|
#include <AppKit/NSPanel.h>
|
2005-09-14 15:48:11 +00:00
|
|
|
#include <AppKit/DPSOperators.h>
|
2005-10-21 03:07:19 +00:00
|
|
|
#include <AppKit/NSImage.h>
|
|
|
|
|
2003-07-31 23:57:11 +00:00
|
|
|
#include <GNUstepGUI/GSDisplayServer.h>
|
2012-08-29 21:34:21 +00:00
|
|
|
#include <config.h>
|
2002-04-21 22:51:21 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
2016-10-06 14:00:51 +00:00
|
|
|
/* MINGW64 hack to build */
|
|
|
|
#ifdef __MINGW64__
|
|
|
|
#undef GWL_USERDATA
|
|
|
|
#define GWL_USERDATA GWLP_USERDATA
|
|
|
|
#endif
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
/*
|
|
|
|
This standard windows macros are missing in MinGW. The definition
|
|
|
|
here is almost correct, but will fail for multi monitor systems
|
|
|
|
*/
|
|
|
|
#ifndef GET_X_LPARAM
|
|
|
|
#define GET_X_LPARAM(p) ((int)(short)LOWORD(p))
|
|
|
|
#endif
|
|
|
|
#ifndef GET_Y_LPARAM
|
|
|
|
#define GET_Y_LPARAM(p) ((int)(short)HIWORD(p))
|
|
|
|
#endif
|
|
|
|
|
2010-03-13 21:38:23 +00:00
|
|
|
// The horizontal mousehweel message is missing in MinGW
|
|
|
|
#ifndef WM_MOUSEHWHEEL
|
|
|
|
#define WM_MOUSEHWHEEL 0x020E
|
|
|
|
#endif
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
#define EVENT_WINDOW(lp) (GSWindowWithNumber((int)lp))
|
2003-12-03 20:39:45 +00:00
|
|
|
|
2005-10-21 03:07:19 +00:00
|
|
|
DWORD windowStyleForGSStyle(unsigned int style);
|
2005-09-14 15:48:11 +00:00
|
|
|
|
2013-08-09 14:21:15 +00:00
|
|
|
typedef struct w32serverFlags
|
|
|
|
{
|
|
|
|
BOOL HOLD_MINI_FOR_SIZE; // override GS size event on miniturize
|
|
|
|
BOOL _eventHandled; // did we handle the event?
|
|
|
|
} serverFlags;
|
2005-10-21 03:07:19 +00:00
|
|
|
|
|
|
|
@interface WIN32Server : GSDisplayServer
|
|
|
|
{
|
2007-03-07 18:11:17 +00:00
|
|
|
BOOL handlesWindowDecorations;
|
|
|
|
BOOL usesNativeTaskbar;
|
|
|
|
|
2005-10-21 03:07:19 +00:00
|
|
|
serverFlags flags;
|
|
|
|
HINSTANCE hinstance;
|
|
|
|
|
|
|
|
HWND currentFocus;
|
|
|
|
HWND desiredFocus;
|
|
|
|
HWND currentActive;
|
|
|
|
HICON currentAppIcon;
|
2012-06-27 17:59:11 +00:00
|
|
|
NSMutableArray *monitorInfo;
|
2013-01-17 23:09:35 +00:00
|
|
|
NSMutableDictionary *systemCursors;
|
2016-03-08 16:27:48 +00:00
|
|
|
NSMutableArray *listOfCursorsFailed;
|
2002-04-21 22:51:21 +00:00
|
|
|
}
|
2005-09-14 15:48:11 +00:00
|
|
|
|
2007-03-07 18:11:17 +00:00
|
|
|
- (BOOL) handlesWindowDecorations;
|
|
|
|
- (void) setHandlesWindowDecorations: (BOOL) b;
|
|
|
|
|
|
|
|
- (BOOL) usesNativeTaskbar;
|
|
|
|
- (void) setUsesNativeTaskbar: (BOOL) b;
|
|
|
|
|
|
|
|
+ (void) initializeBackend;
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
- (LRESULT) windowEventProc: (HWND)hwnd : (UINT)uMsg
|
|
|
|
: (WPARAM)wParam : (LPARAM)lParam;
|
|
|
|
|
|
|
|
- (void) setFlagsforEventLoop: (HWND)hwnd;
|
|
|
|
|
2008-02-14 22:26:00 +00:00
|
|
|
- (DWORD) windowStyleForGSStyle: (unsigned int) style;
|
|
|
|
|
|
|
|
- (void) resizeBackingStoreFor: (HWND)hwnd;
|
|
|
|
|
2013-01-17 23:09:35 +00:00
|
|
|
- (HDC) createHdcForScreen: (int)screen;
|
|
|
|
- (void) deleteScreenHdc: (HDC)hdc;
|
|
|
|
|
2008-02-14 22:26:00 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface WIN32Server (w32_activate)
|
|
|
|
|
2010-01-14 10:40:29 +00:00
|
|
|
- (LRESULT) decodeWM_MOUSEACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam
|
|
|
|
: (HWND)hwnd;
|
2005-09-14 15:48:11 +00:00
|
|
|
- (LRESULT) decodeWM_ACTIVEParams: (WPARAM)wParam : (LPARAM)lParam
|
|
|
|
: (HWND)hwnd;
|
|
|
|
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam
|
|
|
|
: (LPARAM)lParam;
|
|
|
|
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam
|
|
|
|
: (HWND)hwnd;
|
2008-02-14 22:26:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface WIN32Server (w32_movesize)
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
- (LRESULT) decodeWM_SIZEParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
|
|
|
- (LRESULT) decodeWM_MOVEParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
|
|
|
- (void) decodeWM_NCCALCSIZEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_WINDOWPOSCHANGINGParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_WINDOWPOSCHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2012-10-17 20:08:34 +00:00
|
|
|
- (LRESULT) decodeWM_ENTERSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2005-09-14 15:48:11 +00:00
|
|
|
- (LRESULT) decodeWM_EXITSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2005-10-21 03:07:19 +00:00
|
|
|
- (LRESULT) decodeWM_MOVINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
2010-03-20 06:42:17 +00:00
|
|
|
- (LRESULT) decodeWM_SIZINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
2005-09-14 15:48:11 +00:00
|
|
|
|
2008-02-14 22:26:00 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface WIN32Server (w32_create)
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
|
2008-02-14 22:26:00 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface WIN32Server (w32_windowdisplay)
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_NCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (LRESULT) decodeWM_ERASEBKGNDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_SYNCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_CAPTURECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2008-02-14 22:26:00 +00:00
|
|
|
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (HICON) decodeWM_SETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface WIN32Server (w32_text_focus)
|
2005-09-14 15:48:11 +00:00
|
|
|
|
|
|
|
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (LRESULT) decodeWM_SETFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_KILLFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_GETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
|
2008-02-14 22:26:00 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface WIN32Server (w32_General)
|
|
|
|
|
2005-09-14 15:48:11 +00:00
|
|
|
- (void) decodeWM_CLOSEParams: (WPARAM)wParam :(LPARAM)lParam :(HWND)hwnd;
|
|
|
|
- (void) decodeWM_DESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_NCDESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_QUERYOPENParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
|
|
- (void) decodeWM_SYSCOMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2005-10-21 03:07:19 +00:00
|
|
|
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2010-05-16 21:32:56 +00:00
|
|
|
- (void) decodeWM_THEMECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2013-10-03 20:28:20 +00:00
|
|
|
- (void) decodeWM_SETCURSORParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2013-10-21 18:00:44 +00:00
|
|
|
- (void) decodeWM_NCMOUSELEAVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
2005-09-14 15:48:11 +00:00
|
|
|
|
2002-04-21 22:51:21 +00:00
|
|
|
@end
|
|
|
|
|
2010-08-25 04:20:45 +00:00
|
|
|
// FIXME: Keep all of the extra window data in one place
|
|
|
|
|
|
|
|
// Extra window data accessed via GetWindowLong
|
|
|
|
|
2012-11-14 19:06:57 +00:00
|
|
|
enum _WIN_EXTRA_BYTES
|
|
|
|
{
|
|
|
|
OFF_LEVEL = 0,
|
2016-12-07 21:45:00 +00:00
|
|
|
OFF_ORDERED = OFF_LEVEL + sizeof(DWORD), // Value
|
|
|
|
IME_INFO = OFF_ORDERED + sizeof(void*), // Pointer
|
|
|
|
WIN_EXTRABYTES = IME_INFO + sizeof(void*) // Pointer
|
2012-11-14 19:06:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Pointer to this struct set in IME_INFO extra bytes space for
|
|
|
|
// handling IME composition processing between various windows...
|
|
|
|
typedef struct IME_INFO_S
|
|
|
|
{
|
|
|
|
DWORD isOpened;
|
|
|
|
BOOL isComposing;
|
2013-01-15 17:02:18 +00:00
|
|
|
UINT inProgress;
|
|
|
|
BOOL useCompositionWindow;
|
2012-11-14 19:06:57 +00:00
|
|
|
|
|
|
|
LPVOID readString;
|
|
|
|
DWORD readStringLength;
|
|
|
|
LPVOID compString;
|
|
|
|
DWORD compStringLength;
|
|
|
|
|
|
|
|
DWORD compositionMode;
|
|
|
|
DWORD sentenceMode;
|
|
|
|
} IME_INFO_T;
|
|
|
|
|
2010-08-25 04:20:45 +00:00
|
|
|
|
|
|
|
// Extra window data allocated using objc_malloc in WM_CREATE and accessed via
|
|
|
|
// the GWL_USERDATA pointer
|
|
|
|
|
|
|
|
typedef struct _win_intern {
|
2002-04-21 22:51:21 +00:00
|
|
|
BOOL useHDC;
|
2008-03-05 08:07:51 +00:00
|
|
|
BOOL backingStoreEmpty;
|
2002-04-21 22:51:21 +00:00
|
|
|
HDC hdc;
|
2002-04-27 10:12:58 +00:00
|
|
|
HGDIOBJ old;
|
2002-04-21 22:51:21 +00:00
|
|
|
MINMAXINFO minmax;
|
2012-08-29 21:34:21 +00:00
|
|
|
NSBackingStoreType type;
|
|
|
|
#if (BUILD_GRAPHICS==GRAPHICS_cairo)
|
|
|
|
void *surface;
|
|
|
|
#endif
|
2002-04-21 22:51:21 +00:00
|
|
|
} WIN_INTERN;
|
|
|
|
|
|
|
|
#endif /* _WIN32Server_h_INCLUDE */
|