mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +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 {
|
||||
|
||||
int _last_WM_ACTIVATE;
|
||||
int eventQueCount;
|
||||
int menuRef; // reference to menu window
|
||||
unsigned int currentGS_Style; // what style is current event window
|
||||
BOOL HOLD_MENU_FOR_MOVE; // override GS move event on hide
|
||||
|
@ -125,13 +124,27 @@ typedef struct w32serverFlags {
|
|||
|
||||
- (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
|
||||
: (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;
|
||||
|
@ -142,24 +155,39 @@ typedef struct w32serverFlags {
|
|||
- (LRESULT) decodeWM_MOVINGParams: (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_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_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;
|
||||
- (void) resizeBackingStoreFor: (HWND)hwnd;
|
||||
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (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_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
|
||||
|
||||
@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;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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,101 +24,102 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSBitmapImageRep.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include "w32_Events.h"
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include "win32/WIN32Server.h"
|
||||
#include "win32/WIN32Geometry.h"
|
||||
|
||||
@implementation WIN32Server (w32_activate)
|
||||
|
||||
- (LRESULT) decodeWM_ACTIVEParams:(WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// decode our params
|
||||
|
||||
flags._last_WM_ACTIVATE = LOWORD(wParam);
|
||||
//int minimized = HIWORD(wParam);
|
||||
|
||||
switch (flags._last_WM_ACTIVATE)
|
||||
{
|
||||
case WA_ACTIVE: //deactivate
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
break;
|
||||
case WA_CLICKACTIVE: //order back the window
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
break;
|
||||
case WA_INACTIVE: // set currentactive and display
|
||||
{
|
||||
currentActive=hwnd;
|
||||
[EVENT_WINDOW(lParam) display];
|
||||
}
|
||||
break;
|
||||
case WA_ACTIVE: //deactivate
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
break;
|
||||
case WA_CLICKACTIVE: //order back the window
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
break;
|
||||
case WA_INACTIVE: // set currentactive and display
|
||||
{
|
||||
currentActive = hwnd;
|
||||
[EVENT_WINDOW(lParam) display];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
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];
|
||||
|
||||
switch ((int)wParam)
|
||||
{
|
||||
case TRUE:
|
||||
{
|
||||
if (active==YES)
|
||||
{
|
||||
if (flags._is_menu==YES) // have menu and app active
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
else // Not a menu and app is active
|
||||
{
|
||||
// window is Visable
|
||||
if ([EVENT_WINDOW(hwnd) isVisible]==YES)
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
else
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
}
|
||||
}
|
||||
else // app is not active
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
flags._eventHandled=YES;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FALSE:
|
||||
{
|
||||
if (flags._is_menu==YES)
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
else
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TRUE:
|
||||
{
|
||||
if (active==YES)
|
||||
{
|
||||
if (flags._is_menu==YES) // have menu and app active
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
else // Not a menu and app is active
|
||||
{
|
||||
// window is Visable
|
||||
if ([EVENT_WINDOW(hwnd) isVisible]==YES)
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
else
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
}
|
||||
}
|
||||
else // app is not active
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
flags._eventHandled=YES;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FALSE:
|
||||
{
|
||||
if (flags._is_menu==YES)
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
else
|
||||
{
|
||||
// future implimentation if needed
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "w32_Events.h"
|
||||
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include "win32/WIN32Server.h"
|
||||
#include "win32/WIN32Geometry.h"
|
||||
|
||||
@implementation WIN32Server (w32_create)
|
||||
|
||||
|
||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||
: (HWND)hwnd
|
||||
{
|
||||
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;
|
||||
NSBackingStoreType type = (NSBackingStoreType)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||
|
||||
|
@ -61,7 +63,7 @@
|
|||
hdc = GetDC(hwnd);
|
||||
hdc2 = CreateCompatibleDC(hdc);
|
||||
hbitmap = CreateCompatibleBitmap(hdc, r.right - r.left,
|
||||
r.bottom - r.top);
|
||||
r.bottom - r.top);
|
||||
win->old = SelectObject(hdc2, hbitmap);
|
||||
|
||||
win->hdc = hdc2;
|
||||
|
|
|
@ -27,7 +27,10 @@
|
|||
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)
|
||||
|
||||
|
@ -130,18 +133,5 @@
|
|||
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
}
|
||||
|
||||
- (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
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
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)
|
||||
|
||||
|
@ -34,10 +37,9 @@
|
|||
NSRect rect;
|
||||
RECT r;
|
||||
NSEvent *ev = nil;
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
|
||||
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
||||
|
||||
eventLocation = rect.origin;
|
||||
|
||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
|
@ -55,18 +57,16 @@
|
|||
{
|
||||
//need native code here?
|
||||
if (flags.HOLD_MENU_FOR_MOVE==FALSE)
|
||||
{
|
||||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
}
|
||||
|
||||
{
|
||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flags.HOLD_TRANSIENT_FOR_MOVE==FALSE)
|
||||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||
}
|
||||
|
||||
ev=nil;
|
||||
flags.HOLD_MENU_FOR_MOVE=FALSE;
|
||||
flags.HOLD_MINI_FOR_MOVE=FALSE;
|
||||
flags.HOLD_TRANSIENT_FOR_MOVE=FALSE;
|
||||
|
@ -82,10 +82,9 @@
|
|||
NSEvent *ev =nil;
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
|
||||
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
||||
|
||||
eventLocation = rect.origin;
|
||||
|
||||
switch ((int)wParam)
|
||||
{
|
||||
case SIZE_MAXHIDE:
|
||||
|
@ -313,8 +312,8 @@
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
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)
|
||||
|
||||
|
||||
//- (LRESULT) decodeWM_SETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
//{
|
||||
//printf("WM_SETTEXT\n");
|
||||
|
@ -48,7 +50,6 @@
|
|||
|
||||
- (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
|
||||
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. */
|
||||
|
@ -69,16 +70,16 @@
|
|||
else
|
||||
{
|
||||
/* We need to do this directly and not send an event to the frontend -
|
||||
that's too slow and allows the window state to get out of sync,
|
||||
causing bad recursion problems */
|
||||
that's too slow and allows the window state to get out of sync,
|
||||
causing bad recursion problems */
|
||||
NSWindow *window = GSWindowWithNumber((int)hwnd);
|
||||
if ([window canBecomeKeyWindow] == YES)
|
||||
{
|
||||
NSDebugLLog(@"Focus", @"Making %d key", win_num);
|
||||
[window makeKeyWindow];
|
||||
[window makeMainWindow];
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
{
|
||||
NSDebugLLog(@"Focus", @"Making %d key", win_num);
|
||||
[window makeKeyWindow];
|
||||
[window makeMainWindow];
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "w32_Events.h"
|
||||
|
||||
static void invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect);
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include "win32/WIN32Server.h"
|
||||
#include "win32/WIN32Geometry.h"
|
||||
|
||||
static void
|
||||
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||
|
@ -72,86 +73,6 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
|
||||
@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
|
||||
{
|
||||
//SW_OTHERUNZOOM //window is being uncovered
|
||||
|
@ -247,44 +168,12 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
return currentAppIcon;
|
||||
return currentAppIcon;
|
||||
}
|
||||
|
||||
- (HICON) decodeWM_SETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
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;
|
||||
}
|
||||
return currentAppIcon;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue