mirror of
https://github.com/gnustep/libs-back.git
synced 2025-06-04 11:10:44 +00:00
General cleanup of win32 code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@26066 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f801684505
commit
4d00d5253c
9 changed files with 570 additions and 889 deletions
|
@ -74,7 +74,6 @@ DWORD windowStyleForGSStyle(unsigned int style);
|
||||||
typedef struct w32serverFlags {
|
typedef struct w32serverFlags {
|
||||||
|
|
||||||
int _last_WM_ACTIVATE;
|
int _last_WM_ACTIVATE;
|
||||||
int eventQueCount;
|
|
||||||
int menuRef; // reference to menu window
|
int menuRef; // reference to menu window
|
||||||
unsigned int currentGS_Style; // what style is current event window
|
unsigned int currentGS_Style; // what style is current event window
|
||||||
BOOL HOLD_MENU_FOR_MOVE; // override GS move event on hide
|
BOOL HOLD_MENU_FOR_MOVE; // override GS move event on hide
|
||||||
|
@ -125,13 +124,27 @@ typedef struct w32serverFlags {
|
||||||
|
|
||||||
- (void) setFlagsforEventLoop: (HWND)hwnd;
|
- (void) setFlagsforEventLoop: (HWND)hwnd;
|
||||||
|
|
||||||
// declared but should be implimented in a subclass window server (subclass resposibility)
|
- (DWORD) windowStyleForGSStyle: (unsigned int) style;
|
||||||
|
|
||||||
|
- (void) resizeBackingStoreFor: (HWND)hwnd;
|
||||||
|
|
||||||
|
- (void) resetForGSWindowStyle: (HWND)hwnd w32Style:(DWORD)aStyle;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WIN32Server (w32_activate)
|
||||||
|
|
||||||
- (LRESULT) decodeWM_ACTIVEParams: (WPARAM)wParam : (LPARAM)lParam
|
- (LRESULT) decodeWM_ACTIVEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||||
: (HWND)hwnd;
|
: (HWND)hwnd;
|
||||||
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam
|
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam
|
||||||
: (LPARAM)lParam;
|
: (LPARAM)lParam;
|
||||||
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam
|
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||||
: (HWND)hwnd;
|
: (HWND)hwnd;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WIN32Server (w32_movesize)
|
||||||
|
|
||||||
- (LRESULT) decodeWM_SIZEParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
- (LRESULT) decodeWM_SIZEParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
||||||
- (LRESULT) decodeWM_MOVEParams: (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_NCCALCSIZEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
|
@ -142,24 +155,39 @@ typedef struct w32serverFlags {
|
||||||
- (LRESULT) decodeWM_MOVINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
- (LRESULT) decodeWM_MOVINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
||||||
- (void) decodeWM_SIZINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
- (void) decodeWM_SIZINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WIN32Server (w32_create)
|
||||||
|
|
||||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
|
|
||||||
- (DWORD) windowStyleForGSStyle: (unsigned int) style;
|
@end
|
||||||
|
|
||||||
|
@interface WIN32Server (w32_windowdisplay)
|
||||||
|
|
||||||
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (void) decodeWM_NCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (void) decodeWM_NCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (LRESULT) decodeWM_ERASEBKGNDParams: (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_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (void) decodeWM_SYNCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (void) decodeWM_SYNCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (void) decodeWM_CAPTURECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (void) decodeWM_CAPTURECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
//- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (void) resizeBackingStoreFor: (HWND)hwnd;
|
- (HICON) decodeWM_SETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WIN32Server (w32_text_focus)
|
||||||
|
|
||||||
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (LRESULT) decodeWM_SETFOCUSParams: (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_KILLFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
- (void) decodeWM_GETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
- (void) decodeWM_GETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WIN32Server (w32_General)
|
||||||
|
|
||||||
- (void) decodeWM_CLOSEParams: (WPARAM)wParam :(LPARAM)lParam :(HWND)hwnd;
|
- (void) decodeWM_CLOSEParams: (WPARAM)wParam :(LPARAM)lParam :(HWND)hwnd;
|
||||||
- (void) decodeWM_DESTROYParams: (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_NCDESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||||
|
|
|
@ -60,13 +60,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static NSEvent *process_key_event(WIN32Server *svr,
|
static NSEvent *process_key_event(WIN32Server *svr,
|
||||||
HWND hwnd, WPARAM wParam, LPARAM lParam, NSEventType eventType);
|
HWND hwnd, WPARAM wParam,
|
||||||
|
LPARAM lParam, NSEventType eventType);
|
||||||
static NSEvent *process_mouse_event(WIN32Server *svr,
|
static NSEvent *process_mouse_event(WIN32Server *svr,
|
||||||
HWND hwnd, WPARAM wParam, LPARAM lParam, NSEventType eventType);
|
HWND hwnd, WPARAM wParam,
|
||||||
|
LPARAM lParam, NSEventType eventType);
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
validateWindow(WIN32Server *svr, HWND hwnd, RECT rect);
|
|
||||||
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) callback: (id)sender
|
- (void) callback: (id)sender
|
||||||
|
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
WINBOOL bRet;
|
WINBOOL bRet;
|
||||||
|
@ -188,7 +186,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
WNDCLASSEX wc;
|
WNDCLASSEX wc;
|
||||||
hinstance = (HINSTANCE)GetModuleHandle(NULL);
|
hinstance = (HINSTANCE)GetModuleHandle(NULL);
|
||||||
|
|
||||||
|
|
||||||
// Register the main window class.
|
// Register the main window class.
|
||||||
wc.cbSize = sizeof(wc);
|
wc.cbSize = sizeof(wc);
|
||||||
//wc.style = CS_OWNDC; // | CS_HREDRAW | CS_VREDRAW;
|
//wc.style = CS_OWNDC; // | CS_HREDRAW | CS_VREDRAW;
|
||||||
|
@ -261,8 +258,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||||
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||||
|
|
||||||
flags.eventQueCount =0;
|
|
||||||
|
|
||||||
[self setHandlesWindowDecorations: NO];
|
[self setHandlesWindowDecorations: NO];
|
||||||
[self setUsesNativeTaskbar: YES];
|
[self setUsesNativeTaskbar: YES];
|
||||||
|
|
||||||
|
@ -422,219 +417,17 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
Beep(400, 500);
|
Beep(400, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stubs for window server events note other stubs should be
|
|
||||||
declared for mouse and keyboards
|
|
||||||
these should be implmented in a subclass or a catagory
|
|
||||||
*/
|
|
||||||
- (LRESULT) decodeWM_ACTIVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_SIZEParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) decodeWM_SIZINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_MOVINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_MOVEParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) decodeWM_NCCALCSIZEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_WINDOWPOSCHANGINGParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_WINDOWPOSCHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (DWORD) windowStyleForGSStyle: (unsigned int) style
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_NCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_ERASEBKGNDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_SYNCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_CAPTURECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
//{
|
|
||||||
//[self subclassResponsibility: _cmd];
|
|
||||||
//return nil;
|
|
||||||
//}
|
|
||||||
|
|
||||||
- (void) resizeBackingStoreFor: (HWND)hwnd
|
- (void) resizeBackingStoreFor: (HWND)hwnd
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
//{
|
|
||||||
//[self subclassResponsibility: _cmd];
|
|
||||||
|
|
||||||
//return 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_SETFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_KILLFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_GETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_CLOSEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_DESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_NCDESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_QUERYOPENParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) decodeWM_SYSCOMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) displayEvent: (unsigned int)uMsg; // diagnotic filter
|
- (BOOL) displayEvent: (unsigned int)uMsg; // diagnotic filter
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LRESULT) decodeWM_EXITSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
|
||||||
{
|
|
||||||
[self subclassResponsibility: _cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// main event loop
|
// main event loop
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -728,7 +521,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
[self decodeWM_ACTIVEParams: wParam : lParam : hwnd];
|
[self decodeWM_ACTIVEParams: wParam : lParam : hwnd];
|
||||||
break;
|
break;
|
||||||
case WM_ACTIVATEAPP:
|
case WM_ACTIVATEAPP:
|
||||||
//if (_is_cache == NO)
|
|
||||||
return [self decodeWM_ACTIVEAPPParams: hwnd : wParam : lParam];
|
return [self decodeWM_ACTIVEAPPParams: hwnd : wParam : lParam];
|
||||||
break;
|
break;
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
|
@ -753,6 +545,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
break;
|
break;
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
[self decodeWM_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd];
|
[self decodeWM_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd];
|
||||||
|
break;
|
||||||
case WM_SYNCPAINT:
|
case WM_SYNCPAINT:
|
||||||
if ([self handlesWindowDecorations])
|
if ([self handlesWindowDecorations])
|
||||||
[self decodeWM_SYNCPAINTParams: wParam : lParam : hwnd];
|
[self decodeWM_SYNCPAINTParams: wParam : lParam : hwnd];
|
||||||
|
@ -797,7 +590,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
//case WM_SETICON:
|
//case WM_SETICON:
|
||||||
//return [self decodeWM_SETICONParams: wParam : lParam : hwnd];
|
//return [self decodeWM_SETICONParams: wParam : lParam : hwnd];
|
||||||
//break;
|
//break;
|
||||||
case WM_CANCELMODE: // new added by Tom MacSween
|
case WM_CANCELMODE:
|
||||||
break;
|
break;
|
||||||
case WM_ENABLE:
|
case WM_ENABLE:
|
||||||
case WM_CHILDACTIVATE:
|
case WM_CHILDACTIVATE:
|
||||||
|
@ -805,7 +598,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
case WM_NULL:
|
case WM_NULL:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* resued from WIN32EventServer.m (now removed from this project) */
|
|
||||||
case WM_NCHITTEST: //MOUSE
|
case WM_NCHITTEST: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCHITTEST", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCHITTEST", hwnd);
|
||||||
break;
|
break;
|
||||||
|
@ -849,16 +641,12 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONDBLCLK", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONDBLCLK", hwnd);
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONDOWN: //MOUSE
|
case WM_RBUTTONDOWN: //MOUSE
|
||||||
{
|
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONDOWN", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONDOWN", hwnd);
|
||||||
ev = process_mouse_event(self, hwnd, wParam, lParam, NSRightMouseDown);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSRightMouseDown);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONUP: //MOUSE
|
case WM_RBUTTONUP: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONUP", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONUP", hwnd);
|
||||||
{
|
|
||||||
ev = process_mouse_event(self, hwnd, wParam, lParam, NSRightMouseUp);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSRightMouseUp);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONDBLCLK: //MOUSE
|
case WM_RBUTTONDBLCLK: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONDBLCLK", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONDBLCLK", hwnd);
|
||||||
|
@ -904,11 +692,11 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
if (ev != nil)
|
if (ev != nil)
|
||||||
{
|
{
|
||||||
[GSCurrentServer() postEvent: ev atStart: NO];
|
[GSCurrentServer() postEvent: ev atStart: NO];
|
||||||
flags.eventQueCount++;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We did not care about the event return it back to the windows
|
* We did not care about the event, return it back to the windows
|
||||||
* event handler
|
* event handler
|
||||||
*/
|
*/
|
||||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
|
@ -932,13 +720,101 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation WIN32Server (WindowOps)
|
@implementation WIN32Server (WindowOps)
|
||||||
|
|
||||||
|
/*
|
||||||
|
styles are mapped between the two systems
|
||||||
|
|
||||||
|
NSUtilityWindowMask 16
|
||||||
|
NSDocModalWindowMask 32
|
||||||
|
NSBorderlessWindowMask 0
|
||||||
|
NSTitledWindowMask 1
|
||||||
|
NSClosableWindowMask 2
|
||||||
|
NSMiniaturizableWindowMask 4
|
||||||
|
NSResizableWindowMask 8
|
||||||
|
NSIconWindowMask 64
|
||||||
|
NSMiniWindowMask 128
|
||||||
|
|
||||||
|
NSMenu(style) = NSTitledWindowMask | NSClosableWindowMask =3;
|
||||||
|
*/
|
||||||
|
- (DWORD) windowStyleForGSStyle: (unsigned int) style
|
||||||
|
{
|
||||||
|
DWORD wstyle = 0;
|
||||||
|
|
||||||
|
if ([self handlesWindowDecorations] == NO)
|
||||||
|
return WS_POPUP;
|
||||||
|
|
||||||
|
switch (style)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
wstyle = WS_POPUP;
|
||||||
|
break;
|
||||||
|
case NSTitledWindowMask: // 1
|
||||||
|
wstyle = WS_CAPTION;
|
||||||
|
break;
|
||||||
|
case NSClosableWindowMask: // 2
|
||||||
|
wstyle = WS_CAPTION+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
case NSMiniaturizableWindowMask: //4
|
||||||
|
wstyle = WS_MINIMIZEBOX+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
case NSResizableWindowMask: // 8
|
||||||
|
wstyle = WS_SIZEBOX;
|
||||||
|
case NSMiniWindowMask: //128
|
||||||
|
case NSIconWindowMask: // 64
|
||||||
|
wstyle = WS_ICONIC;
|
||||||
|
break;
|
||||||
|
//case NSUtilityWindowMask: //16
|
||||||
|
//case NSDocModalWindowMask: //32
|
||||||
|
break;
|
||||||
|
// combinations
|
||||||
|
case NSTitledWindowMask+NSClosableWindowMask: //3
|
||||||
|
wstyle = WS_CAPTION+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
case NSTitledWindowMask+NSClosableWindowMask+NSMiniaturizableWindowMask: //7
|
||||||
|
wstyle = WS_CAPTION+WS_MINIMIZEBOX+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
case NSTitledWindowMask+NSResizableWindowMask: // 9
|
||||||
|
wstyle = WS_CAPTION+WS_SIZEBOX;
|
||||||
|
break;
|
||||||
|
case NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask: // 11
|
||||||
|
wstyle = WS_CAPTION+WS_SIZEBOX+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
case NSTitledWindowMask+NSResizableWindowMask+NSMiniaturizableWindowMask: //13
|
||||||
|
wstyle = WS_SIZEBOX+WS_MINIMIZEBOX+WS_SYSMENU+WS_CAPTION;
|
||||||
|
break;
|
||||||
|
case NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask+
|
||||||
|
NSMiniaturizableWindowMask: //15
|
||||||
|
wstyle = WS_CAPTION+WS_SIZEBOX+WS_MINIMIZEBOX+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wstyle = WS_POPUP; //WS_CAPTION+WS_SYSMENU;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//NSLog(@"Window wstyle %d for style %d", wstyle, style);
|
||||||
|
return wstyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) resetForGSWindowStyle:(HWND)hwnd w32Style:(DWORD)aStyle
|
||||||
|
{
|
||||||
|
// to be completed for styles
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
|
SetLastError(0);
|
||||||
|
result = SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||||
|
result = SetWindowLong(hwnd, GWL_STYLE, (LONG)aStyle);
|
||||||
|
// should check error here...
|
||||||
|
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
styleMask specifies the receiver's style. It can either be
|
styleMask specifies the receiver's style. It can either be
|
||||||
NSBorderlessWindowMask, or it can contain any of the following
|
NSBorderlessWindowMask, or it can contain any of the following
|
||||||
|
@ -1098,6 +974,38 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) resizeBackingStoreFor: (HWND)hwnd
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
||||||
|
|
||||||
|
// FIXME: We should check if the size really did change.
|
||||||
|
if (win->useHDC)
|
||||||
|
{
|
||||||
|
HDC hdc, hdc2;
|
||||||
|
HBITMAP hbitmap;
|
||||||
|
HGDIOBJ old;
|
||||||
|
|
||||||
|
old = SelectObject(win->hdc, win->old);
|
||||||
|
DeleteObject(old);
|
||||||
|
DeleteDC(win->hdc);
|
||||||
|
win->hdc = NULL;
|
||||||
|
win->old = NULL;
|
||||||
|
|
||||||
|
GetClientRect((HWND)hwnd, &r);
|
||||||
|
hdc = GetDC((HWND)hwnd);
|
||||||
|
hdc2 = CreateCompatibleDC(hdc);
|
||||||
|
hbitmap = CreateCompatibleBitmap(hdc, r.right - r.left, r.bottom - r.top);
|
||||||
|
win->old = SelectObject(hdc2, hbitmap);
|
||||||
|
win->hdc = hdc2;
|
||||||
|
|
||||||
|
ReleaseDC((HWND)hwnd, hdc);
|
||||||
|
|
||||||
|
// After resizing the backing store, we need to redraw the window
|
||||||
|
win->backingStoreEmpty = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) titlewindow: (NSString*)window_title : (int) winNum
|
- (void) titlewindow: (NSString*)window_title : (int) winNum
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"WTrace", @"titlewindow: %@ : %d", window_title, winNum);
|
NSDebugLLog(@"WTrace", @"titlewindow: %@ : %d", window_title, winNum);
|
||||||
|
@ -1342,8 +1250,26 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
/** Causes buffered graphics to be flushed to the screen */
|
/** Causes buffered graphics to be flushed to the screen */
|
||||||
- (void) flushwindowrect: (NSRect)rect : (int)winNum
|
- (void) flushwindowrect: (NSRect)rect : (int)winNum
|
||||||
{
|
{
|
||||||
RECT r = GSWindowRectToMS(self, (HWND)winNum, rect);
|
HWND hwnd = (HWND)winNum;
|
||||||
validateWindow(self, (HWND)winNum, r);
|
RECT r = GSWindowRectToMS(self, hwnd, rect);
|
||||||
|
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
|
||||||
|
|
||||||
|
if (win->useHDC)
|
||||||
|
{
|
||||||
|
HDC hdc = GetDC(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)
|
||||||
|
{
|
||||||
|
NSLog(@"Flush window %d %@", hwnd,
|
||||||
|
NSStringFromRect(MSWindowRectToGS(self, hwnd, rect)));
|
||||||
|
NSLog(@"Flush window failed with %d", GetLastError());
|
||||||
|
}
|
||||||
|
ReleaseDC(hwnd, hdc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||||
|
@ -1515,7 +1441,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
// static keyboard/mouse methods >into a subclass some day
|
|
||||||
|
|
||||||
static unichar
|
static unichar
|
||||||
process_char(WPARAM wParam, unsigned *eventModifierFlags)
|
process_char(WPARAM wParam, unsigned *eventModifierFlags)
|
||||||
|
@ -1802,29 +1727,3 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
|
|
||||||
return [ctxt windowEventProc: hwnd : uMsg : wParam : lParam];
|
return [ctxt windowEventProc: hwnd : uMsg : wParam : lParam];
|
||||||
}
|
}
|
||||||
// end static Keyboard mouse
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
validateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|
||||||
{
|
|
||||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
NSLog(@"validated window %d %@", hwnd,
|
|
||||||
NSStringFromRect(MSWindowRectToGS(svr, (HWND)hwnd, rect)));
|
|
||||||
NSLog(@"validateWindow failed %d", GetLastError());
|
|
||||||
}
|
|
||||||
ReleaseDC((HWND)hwnd, hdc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
/* WIN32Server - Implements window handling for MSWindows
|
|
||||||
|
|
||||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Written by: Tom MacSween <macsweent@sympatico.ca>
|
|
||||||
Date August 2005
|
|
||||||
This file is part of the GNU Objective C User Interface Library.
|
|
||||||
|
|
||||||
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 3 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; 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _W32_EVENTS_h_INCLUDE
|
|
||||||
#define _W32_EVENTS_h_INCLUDE
|
|
||||||
|
|
||||||
#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/NSMenuView.h>
|
|
||||||
#include <AppKit/NSWindow.h>
|
|
||||||
#include <AppKit/NSView.h>
|
|
||||||
#include <AppKit/NSEvent.h>
|
|
||||||
#include <AppKit/NSCursor.h>
|
|
||||||
#include <AppKit/NSText.h>
|
|
||||||
#include <AppKit/DPSOperators.h>
|
|
||||||
|
|
||||||
#include "win32/WIN32Server.h"
|
|
||||||
#include "win32/WIN32Geometry.h"
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_notifications)
|
|
||||||
|
|
||||||
- (void) ApplicationDidFinishLaunching: (NSNotification*)aNotification;
|
|
||||||
- (void) ApplicationWillFinishLaunching: (NSNotification*)aNotification;
|
|
||||||
- (void) ApplicationWillHideNotification: (NSNotification*)aNotification;
|
|
||||||
- (void) WindowWillMiniaturizeNotification:(NSNotification*)aNotification;
|
|
||||||
- (void) MenuWillTearOff: (NSNotification*)aNotification;
|
|
||||||
- (void) MenuwillPopUP: (NSNotification*)aNotification;
|
|
||||||
- (void) WindowDidCreateWindow: (NSNotification*)aNotification;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_activate)
|
|
||||||
- (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;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_movesize)
|
|
||||||
|
|
||||||
- (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;
|
|
||||||
- (LRESULT) decodeWM_EXITSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
- (void) decodeWM_SIZINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
|
||||||
- (LRESULT) decodeWM_MOVINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_create)
|
|
||||||
|
|
||||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_windowdisplay)
|
|
||||||
- (DWORD) windowStyleForGSStyle: (unsigned int) style;
|
|
||||||
- (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;
|
|
||||||
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
- (HICON) decodeWM_SETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
- (void) resizeBackingStoreFor: (HWND)hwnd;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_text_focus)
|
|
||||||
|
|
||||||
//- (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;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
//small but useful events
|
|
||||||
|
|
||||||
@interface WIN32Server (w32_General)
|
|
||||||
|
|
||||||
- (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;
|
|
||||||
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
- (void) resetForGSWindowStyle: (HWND)hwnd w32Style:(DWORD)aStyle;
|
|
||||||
//- (LRESULT) decodeWM_LBUTTONDOWNParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
#endif //_W32_EVENTS_h_INCLUDE
|
|
|
@ -24,17 +24,16 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AppKit/NSImage.h>
|
#include <AppKit/NSEvent.h>
|
||||||
#include <AppKit/NSBitmapImageRep.h>
|
#include <AppKit/NSWindow.h>
|
||||||
#include <Foundation/NSData.h>
|
#include "win32/WIN32Server.h"
|
||||||
#include "w32_Events.h"
|
#include "win32/WIN32Geometry.h"
|
||||||
|
|
||||||
@implementation WIN32Server (w32_activate)
|
@implementation WIN32Server (w32_activate)
|
||||||
|
|
||||||
- (LRESULT) decodeWM_ACTIVEParams:(WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
- (LRESULT) decodeWM_ACTIVEParams:(WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||||
{
|
{
|
||||||
// decode our params
|
// decode our params
|
||||||
|
|
||||||
flags._last_WM_ACTIVATE = LOWORD(wParam);
|
flags._last_WM_ACTIVATE = LOWORD(wParam);
|
||||||
//int minimized = HIWORD(wParam);
|
//int minimized = HIWORD(wParam);
|
||||||
|
|
||||||
|
@ -64,7 +63,8 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam
|
||||||
|
: (LPARAM)lParam
|
||||||
{
|
{
|
||||||
BOOL active = [NSApp isActive];
|
BOOL active = [NSApp isActive];
|
||||||
|
|
||||||
|
@ -118,7 +118,8 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||||
|
: (HWND)hwnd
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,20 +26,22 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "w32_Events.h"
|
#include <AppKit/NSEvent.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include "win32/WIN32Server.h"
|
||||||
|
#include "win32/WIN32Geometry.h"
|
||||||
|
|
||||||
@implementation WIN32Server (w32_create)
|
@implementation WIN32Server (w32_create)
|
||||||
|
|
||||||
|
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
: (HWND)hwnd
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
- (LRESULT) decodeWM_CREATEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||||
|
: (HWND)hwnd
|
||||||
{
|
{
|
||||||
//Created by original author
|
|
||||||
WIN_INTERN *win;
|
WIN_INTERN *win;
|
||||||
NSBackingStoreType type = (NSBackingStoreType)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
NSBackingStoreType type = (NSBackingStoreType)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,10 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "w32_Events.h"
|
#include <AppKit/NSEvent.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include "win32/WIN32Server.h"
|
||||||
|
#include "win32/WIN32Geometry.h"
|
||||||
|
|
||||||
@implementation WIN32Server (w32_General)
|
@implementation WIN32Server (w32_General)
|
||||||
|
|
||||||
|
@ -131,17 +134,4 @@
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) resetForGSWindowStyle:(HWND)hwnd w32Style:(DWORD)aStyle
|
|
||||||
{
|
|
||||||
// to be completed for styles
|
|
||||||
LONG result;
|
|
||||||
|
|
||||||
ShowWindow(hwnd, SW_HIDE);
|
|
||||||
SetLastError(0);
|
|
||||||
result=SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
|
||||||
result=SetWindowLong(hwnd, GWL_STYLE, (LONG)aStyle);
|
|
||||||
// should check error here...
|
|
||||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "w32_Events.h"
|
#include <AppKit/NSEvent.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include "win32/WIN32Server.h"
|
||||||
|
#include "win32/WIN32Geometry.h"
|
||||||
|
|
||||||
@implementation WIN32Server (w32_movesize)
|
@implementation WIN32Server (w32_movesize)
|
||||||
|
|
||||||
|
@ -34,10 +37,9 @@
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
RECT r;
|
RECT r;
|
||||||
NSEvent *ev = nil;
|
NSEvent *ev = nil;
|
||||||
|
|
||||||
GetWindowRect(hwnd, &r);
|
GetWindowRect(hwnd, &r);
|
||||||
|
|
||||||
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
||||||
|
|
||||||
eventLocation = rect.origin;
|
eventLocation = rect.origin;
|
||||||
|
|
||||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||||
|
@ -58,7 +60,6 @@
|
||||||
{
|
{
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -66,7 +67,6 @@
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||||
}
|
}
|
||||||
|
|
||||||
ev=nil;
|
|
||||||
flags.HOLD_MENU_FOR_MOVE=FALSE;
|
flags.HOLD_MENU_FOR_MOVE=FALSE;
|
||||||
flags.HOLD_MINI_FOR_MOVE=FALSE;
|
flags.HOLD_MINI_FOR_MOVE=FALSE;
|
||||||
flags.HOLD_TRANSIENT_FOR_MOVE=FALSE;
|
flags.HOLD_TRANSIENT_FOR_MOVE=FALSE;
|
||||||
|
@ -82,10 +82,9 @@
|
||||||
NSEvent *ev =nil;
|
NSEvent *ev =nil;
|
||||||
|
|
||||||
GetWindowRect(hwnd, &r);
|
GetWindowRect(hwnd, &r);
|
||||||
|
|
||||||
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
||||||
|
|
||||||
eventLocation = rect.origin;
|
eventLocation = rect.origin;
|
||||||
|
|
||||||
switch ((int)wParam)
|
switch ((int)wParam)
|
||||||
{
|
{
|
||||||
case SIZE_MAXHIDE:
|
case SIZE_MAXHIDE:
|
||||||
|
@ -313,8 +312,8 @@
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,13 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "w32_Events.h"
|
#include <AppKit/NSEvent.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include "win32/WIN32Server.h"
|
||||||
|
#include "win32/WIN32Geometry.h"
|
||||||
|
|
||||||
@implementation WIN32Server (w32_text_focus)
|
@implementation WIN32Server (w32_text_focus)
|
||||||
|
|
||||||
|
|
||||||
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||||
//{
|
//{
|
||||||
//printf("WM_SETTEXT\n");
|
//printf("WM_SETTEXT\n");
|
||||||
|
@ -48,7 +50,6 @@
|
||||||
|
|
||||||
- (LRESULT) decodeWM_SETFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
- (LRESULT) decodeWM_SETFOCUSParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||||
{
|
{
|
||||||
// reused from original author (added debug output)
|
|
||||||
/* This message comes when the window already got focus, so we send a focus
|
/* This message comes when the window already got focus, so we send a focus
|
||||||
in event to the front end, but also mark the window as having current focus
|
in event to the front end, but also mark the window as having current focus
|
||||||
so that the front end doesn't try to focus the window again. */
|
so that the front end doesn't try to focus the window again. */
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AppKit/NSEvent.h>
|
||||||
#include "w32_Events.h"
|
#include <AppKit/NSView.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
static void invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect);
|
#include "win32/WIN32Server.h"
|
||||||
|
#include "win32/WIN32Geometry.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||||
|
@ -72,86 +73,6 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||||
|
|
||||||
@implementation WIN32Server (w32_windowdisplay)
|
@implementation WIN32Server (w32_windowdisplay)
|
||||||
|
|
||||||
/* styles are mapped between the two systems
|
|
||||||
* I have not changed current inplimentation of mouse or keyboard
|
|
||||||
* events. */
|
|
||||||
- (DWORD) windowStyleForGSStyle: (unsigned int) style
|
|
||||||
{
|
|
||||||
|
|
||||||
/*
|
|
||||||
NSUtilityWindowMask 16
|
|
||||||
NSDocModalWindowMask 32
|
|
||||||
NSBorderlessWindowMask 0
|
|
||||||
NSTitledWindowMask 1
|
|
||||||
NSClosableWindowMask 2
|
|
||||||
NSMiniaturizableWindowMask 4
|
|
||||||
NSResizableWindowMask 8
|
|
||||||
NSIconWindowMask 64
|
|
||||||
NSMiniWindowMask 128
|
|
||||||
|
|
||||||
NSMenu(style) = NSTitledWindowMask | NSClosableWindowMask =3;
|
|
||||||
*/
|
|
||||||
|
|
||||||
DWORD wstyle = 0;
|
|
||||||
|
|
||||||
if ([self handlesWindowDecorations] == NO)
|
|
||||||
return WS_POPUP;
|
|
||||||
|
|
||||||
switch (style)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
wstyle=WS_POPUP;
|
|
||||||
break;
|
|
||||||
case NSTitledWindowMask: // 1
|
|
||||||
wstyle = WS_CAPTION;
|
|
||||||
break;
|
|
||||||
case NSClosableWindowMask: // 2
|
|
||||||
wstyle =WS_CAPTION+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
case NSMiniaturizableWindowMask: //4
|
|
||||||
wstyle =WS_MINIMIZEBOX+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
case NSResizableWindowMask: // 8
|
|
||||||
wstyle=WS_SIZEBOX;
|
|
||||||
case NSMiniWindowMask: //128
|
|
||||||
case NSIconWindowMask: // 64
|
|
||||||
wstyle = WS_ICONIC;
|
|
||||||
break;
|
|
||||||
//case NSUtilityWindowMask: //16
|
|
||||||
//case NSDocModalWindowMask: //32
|
|
||||||
break;
|
|
||||||
// combinations
|
|
||||||
case NSTitledWindowMask+NSClosableWindowMask: //3
|
|
||||||
wstyle =WS_CAPTION+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
case NSTitledWindowMask+NSClosableWindowMask+NSMiniaturizableWindowMask: //7
|
|
||||||
wstyle =WS_CAPTION+WS_MINIMIZEBOX+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
case NSTitledWindowMask+NSResizableWindowMask: // 9
|
|
||||||
wstyle = WS_CAPTION+WS_SIZEBOX;
|
|
||||||
break;
|
|
||||||
case NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask: // 11
|
|
||||||
wstyle =WS_CAPTION+WS_SIZEBOX+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
case NSTitledWindowMask+NSResizableWindowMask+NSMiniaturizableWindowMask: //13
|
|
||||||
wstyle = WS_SIZEBOX+WS_MINIMIZEBOX+WS_SYSMENU+WS_CAPTION;
|
|
||||||
break;
|
|
||||||
case NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask+
|
|
||||||
NSMiniaturizableWindowMask: //15
|
|
||||||
wstyle =WS_CAPTION+WS_SIZEBOX+WS_MINIMIZEBOX+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
wstyle =WS_POPUP; //WS_CAPTION+WS_SYSMENU;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//NSLog(@"Window wstyle %d for style %d", wstyle, style);
|
|
||||||
return wstyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*deprecated remove from code */
|
|
||||||
|
|
||||||
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
- (void) decodeWM_SHOWWINDOWParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||||
{
|
{
|
||||||
//SW_OTHERUNZOOM //window is being uncovered
|
//SW_OTHERUNZOOM //window is being uncovered
|
||||||
|
@ -255,36 +176,4 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||||
return currentAppIcon;
|
return currentAppIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) resizeBackingStoreFor: (HWND)hwnd
|
|
||||||
{
|
|
||||||
RECT r;
|
|
||||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
|
||||||
|
|
||||||
// FIXME: We should check if the size really did change.
|
|
||||||
if (win->useHDC)
|
|
||||||
{
|
|
||||||
HDC hdc, hdc2;
|
|
||||||
HBITMAP hbitmap;
|
|
||||||
HGDIOBJ old;
|
|
||||||
|
|
||||||
old = SelectObject(win->hdc, win->old);
|
|
||||||
DeleteObject(old);
|
|
||||||
DeleteDC(win->hdc);
|
|
||||||
win->hdc = NULL;
|
|
||||||
win->old = NULL;
|
|
||||||
|
|
||||||
GetClientRect((HWND)hwnd, &r);
|
|
||||||
hdc = GetDC((HWND)hwnd);
|
|
||||||
hdc2 = CreateCompatibleDC(hdc);
|
|
||||||
hbitmap = CreateCompatibleBitmap(hdc, r.right - r.left, r.bottom - r.top);
|
|
||||||
win->old = SelectObject(hdc2, hbitmap);
|
|
||||||
win->hdc = hdc2;
|
|
||||||
|
|
||||||
ReleaseDC((HWND)hwnd, hdc);
|
|
||||||
|
|
||||||
// After resizing the backing store, we need to redraw the window
|
|
||||||
win->backingStoreEmpty = YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue