mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
Many changes :
- Deletion of all non-GNUstep debug stuff (printf...) - Deletion of all Notification hooks (used for a debugging purpose) - Deletion of the Application preference Panel that popups (pops up?) the 1st time you run _any_ application - Deletion of the check of GSWINHandlesWindowDecorations and GSWIN32HandlesWindowDecorations options (none worked because of a typo and are now deprecated). - use of GSBackHandlesWindowDecorations option like X11 backend instead of GSUseWMStyles (marked as deprecated) - use of GSBackUsesNativeTaskbar option instead of GSUseWMTaskbar (marked as deprecated) - all these options are read in -initWithAttribute: (no more in +inializeBackend) and set an instance (not class) variable. - add methods -handlesWindowDecorations/-setHandlesWindowDecorations - add methods -usesNativeTaskbar/-setUsesNativeTaskbar git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24804 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bbd4ebe7d8
commit
41208bb38d
16 changed files with 91 additions and 2404 deletions
|
@ -54,8 +54,6 @@
|
|||
|
||||
#include <GNUstepGUI/GSDisplayServer.h>
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/*
|
||||
|
@ -69,18 +67,12 @@
|
|||
#define GET_Y_LPARAM(p) ((int)(short)HIWORD(p))
|
||||
#endif
|
||||
|
||||
//#define __debugServer__ // main server debug (from WIN32Server)
|
||||
//#define __W32_debug__ // event frame debugging/logging
|
||||
|
||||
#define EVENT_WINDOW(lp) (GSWindowWithNumber((int)lp))
|
||||
|
||||
DWORD windowStyleForGSStyle(unsigned int style);
|
||||
|
||||
typedef struct w32serverFlags {
|
||||
|
||||
BOOL useWMTaskBar;
|
||||
BOOL useWMStyles;
|
||||
BOOL HAVE_SERVER_PREFS;
|
||||
int _last_WM_ACTIVATE;
|
||||
int eventQueCount;
|
||||
int menuRef; // reference to menu window
|
||||
|
@ -103,6 +95,9 @@ typedef struct w32serverFlags {
|
|||
|
||||
@interface WIN32Server : GSDisplayServer
|
||||
{
|
||||
BOOL handlesWindowDecorations;
|
||||
BOOL usesNativeTaskbar;
|
||||
|
||||
serverFlags flags;
|
||||
HINSTANCE hinstance;
|
||||
|
||||
|
@ -117,17 +112,18 @@ typedef struct w32serverFlags {
|
|||
NSButton * saveButton;
|
||||
}
|
||||
|
||||
- (BOOL) handlesWindowDecorations;
|
||||
- (void) setHandlesWindowDecorations: (BOOL) b;
|
||||
|
||||
- (BOOL) usesNativeTaskbar;
|
||||
- (void) setUsesNativeTaskbar: (BOOL) b;
|
||||
|
||||
+ (void) initializeBackend;
|
||||
|
||||
- (LRESULT) windowEventProc: (HWND)hwnd : (UINT)uMsg
|
||||
: (WPARAM)wParam : (LPARAM)lParam;
|
||||
|
||||
- (void) initConfigWindow;
|
||||
- (void) setStyle:(id)sender;
|
||||
- (void) setTaskBar:(id)sender;
|
||||
- (void) setSave:(id)sender;
|
||||
|
||||
- (void) setFlagsforEventLoop: (HWND)hwnd;
|
||||
- (NSString *) getNativeClassName: (HWND)hwnd;
|
||||
- (NSString *) getWindowtext: (HWND)hwnd;
|
||||
|
||||
// declared but should be implimented in a subclass window server (subclass resposibility)
|
||||
- (LRESULT) decodeWM_ACTIVEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||
|
@ -136,17 +132,6 @@ typedef struct w32serverFlags {
|
|||
: (LPARAM)lParam;
|
||||
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam
|
||||
: (HWND)hwnd;
|
||||
/*
|
||||
hooks for the subclass to process notifications and syncronize the win32 env
|
||||
with the application
|
||||
*/
|
||||
- (void) ApplicationDidFinishLaunching: (NSNotification*)aNotification;
|
||||
- (void) ApplicationWillFinishLaunching: (NSNotification*)aNotification;
|
||||
- (void) WindowWillMiniaturizeNotification: (NSNotification*)aNotification;
|
||||
- (void) MenuWillTearOff: (NSNotification*)aNotification;
|
||||
- (void) MenuwillPopUP: (NSNotification*)aNotification;
|
||||
|
||||
|
||||
- (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;
|
||||
|
@ -182,10 +167,6 @@ typedef struct w32serverFlags {
|
|||
- (void) decodeWM_SYSCOMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
|
||||
// diagnotic and debugging
|
||||
- (BOOL) displayEvent:(unsigned int)uMsg;
|
||||
- (void) registerForWindowEvents;
|
||||
- (void) registerForViewEvents;
|
||||
@end
|
||||
|
||||
typedef struct _win_intern {
|
||||
|
|
|
@ -1,367 +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 Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
#
|
||||
|
||||
|
||||
#sed -f Event_format.sed result.sed >test_result.log
|
||||
s/CYCLE 0 /WM_NULL 0/ g
|
||||
s/CYCLE 1 /WM_CREATE 1/g
|
||||
s/CYCLE 2 /WM_DESTROY 2/g
|
||||
s/CYCLE 3 /WM_MOVE 3/g
|
||||
s/CYCLE 5 /WM_SIZE 5/g
|
||||
s/CYCLE 6 /WM_ACTIVATE 6/g
|
||||
s/CYCLE 7 /WM_SETFOCUS 7/g
|
||||
s/CYCLE 8 /WM_KILLFOCUS 8/g
|
||||
s/CYCLE 10 /WM_ENABLE 10/g
|
||||
s/CYCLE 11 /WM_SETREDRAW 11/g
|
||||
s/CYCLE 12 /WM_SETTEXT 12/g
|
||||
s/CYCLE 13 /WM_GETTEXT 13/g
|
||||
s/CYCLE 14 /WM_GETTEXTLENGTH 14/g
|
||||
s/CYCLE 15 /WM_PAINT 15/g
|
||||
s/CYCLE 16 /WM_CLOSE 16/g
|
||||
s/CYCLE 17 /WM_QUERYENDSESSION 17/g
|
||||
s/CYCLE 18 /WM_QUIT 18/g
|
||||
s/CYCLE 19 /WM_QUERYOPEN 19/g
|
||||
s/CYCLE 20 /WM_ERASEBKGND 20/g
|
||||
s/CYCLE 21 /WM_SYSCOLORCHANGE 21/g
|
||||
s/CYCLE 22 /WM_ENDSESSION 22/g
|
||||
s/CYCLE 24 /WM_SHOWWINDOW 24/g
|
||||
s/CYCLE 26 /WM_SETTINGCHANGE 26/g
|
||||
s/CYCLE 26 /WM_WININICHANGE 26/g
|
||||
s/CYCLE 27 /WM_DEVMODECHANGE 27/g
|
||||
s/CYCLE 28 /WM_ACTIVATEAPP 28/g
|
||||
s/CYCLE 29 /WM_FONTCHANGE 29/g
|
||||
s/CYCLE 30 /WM_TIMECHANGE 30/g
|
||||
s/CYCLE 31 /WM_CANCELMODE 31/g
|
||||
s/CYCLE 32 /WM_SETCURSOR 32/g
|
||||
s/CYCLE 33 /WM_MOUSEACTIVATE 33/g
|
||||
s/CYCLE 34 /WM_CHILDACTIVATE 34/g
|
||||
s/CYCLE 35 /WM_QUEUESYNC 35/g
|
||||
s/CYCLE 36 /WM_GETMINMAXINFO 36/g
|
||||
s/CYCLE 38 /WM_PAINTICON 38/g
|
||||
s/CYCLE 39 /WM_ICONERASEBKGND 39/g
|
||||
s/CYCLE 40 /WM_NEXTDLGCTL 40/g
|
||||
s/CYCLE 42 /WM_SPOOLERSTATUS 42/g
|
||||
s/CYCLE 43 /WM_DRAWITEM 43/g
|
||||
s/CYCLE 44 /WM_MEASUREITEM 44/g
|
||||
s/CYCLE 45 /WM_DELETEITEM 45/g
|
||||
s/CYCLE 46 /WM_VKEYTOITEM 46/g
|
||||
s/CYCLE 47 /WM_CHARTOITEM 47/g
|
||||
s/CYCLE 48 /WM_SETFONT 48/g
|
||||
s/CYCLE 49 /WM_GETFONT 49/g
|
||||
s/CYCLE 50 /WM_SETHOTKEY 50/g
|
||||
s/CYCLE 51 /WM_GETHOTKEY 51/g
|
||||
s/CYCLE 55 /WM_QUERYDRAGICON 55/g
|
||||
s/CYCLE 57 /WM_COMPAREITEM 57/g
|
||||
s/CYCLE 65 /WM_COMPACTING 65/g
|
||||
s/CYCLE 68 /WM_COMMNOTIFY 68/g
|
||||
s/CYCLE 70 /WM_WINDOWPOSCHANGING 70/g
|
||||
s/CYCLE 71 /WM_WINDOWPOSCHANGED 71/g
|
||||
s/CYCLE 72 /WM_POWER 72/g
|
||||
s/CYCLE 74 /WM_COPYDATA 74/g
|
||||
s/CYCLE 75 /WM_CANCELJOURNAL 75/g
|
||||
s/CYCLE 78 /WM_NOTIFY 78/g
|
||||
s/CYCLE 80 /WM_INPUTLANGCHANGEREQUEST 80/g
|
||||
s/CYCLE 81 /WM_INPUTLANGCHANGE 81/g
|
||||
s/CYCLE 82 /WM_TCARD 82/g
|
||||
s/CYCLE 83 /WM_HELP 83/g
|
||||
s/CYCLE 84 /WM_USERCHANGED 84/g
|
||||
s/CYCLE 85 /WM_NOTIFYFORMAT 85/g
|
||||
s/CYCLE 123 /WM_CONTEXTMENU 123/g
|
||||
s/CYCLE 124 /WM_STYLECHANGING 124/g
|
||||
s/CYCLE 125 /WM_STYLECHANGED 125/g
|
||||
s/CYCLE 126 /WM_DISPLAYCHANGE 126/g
|
||||
s/CYCLE 127 /WM_GETICON 127/g
|
||||
s/CYCLE 128 /WM_SETICON 128/g
|
||||
s/CYCLE 129 /WM_NCCREATE 129/g
|
||||
s/CYCLE 130 /WM_NCDESTROY 130/g
|
||||
s/CYCLE 131 /WM_NCCALCSIZE 131/g
|
||||
s/CYCLE 132 /WM_NCHITTEST 132/g
|
||||
s/CYCLE 133 /WM_NCPAINT 133/g
|
||||
s/CYCLE 134 /WM_NCACTIVATE 134/g
|
||||
s/CYCLE 135 /WM_GETDLGCODE 135/g
|
||||
s/CYCLE 136 /WM_SYNCPAINT 136/g
|
||||
s/CYCLE 160 /WM_NCMOUSEMOVE 160/g
|
||||
s/CYCLE 161 /WM_NCLBUTTONDOWN 161/g
|
||||
s/CYCLE 162 /WM_NCLBUTTONUP 162/g
|
||||
s/CYCLE 163 /WM_NCLBUTTONDBLCLK 163/g
|
||||
s/CYCLE 164 /WM_NCRBUTTONDOWN 164/g
|
||||
s/CYCLE 165 /WM_NCRBUTTONUP 165/g
|
||||
s/CYCLE 166 /WM_NCRBUTTONDBLCLK 166/g
|
||||
s/CYCLE 167 /WM_NCMBUTTONDOWN 167/g
|
||||
s/CYCLE 168 /WM_NCMBUTTONUP 168/g
|
||||
s/CYCLE 169 /WM_NCMBUTTONDBLCLK 169/g
|
||||
s/CYCLE 171 /WM_NCXBUTTONDOWN 171/g
|
||||
s/CYCLE 172 /WM_NCXBUTTONUP 172/g
|
||||
s/CYCLE 173 /WM_NCXBUTTONDBLCLK 173/g
|
||||
s/CYCLE 256 /WM_KEYDOWN 256/g
|
||||
s/CYCLE 256 /WM_KEYFIRST 256/g
|
||||
s/CYCLE 257 /WM_KEYUP 257/g
|
||||
s/CYCLE 258 /WM_CHAR 258/g
|
||||
s/CYCLE 259 /WM_DEADCHAR 259/g
|
||||
s/CYCLE 260 /WM_SYSKEYDOWN 260/g
|
||||
s/CYCLE 261 /WM_SYSKEYUP 261/g
|
||||
s/CYCLE 262 /WM_SYSCHAR 262/g
|
||||
s/CYCLE 263 /WM_SYSDEADCHAR 263/g
|
||||
s/CYCLE 264 /WM_KEYLAST 264/g
|
||||
s/CYCLE 272 /WM_INITDIALOG 271/g
|
||||
s/CYCLE 273 /WM_COMMAND 273/g
|
||||
s/CYCLE 274 /WM_SYSCOMMAND 274/g
|
||||
s/CYCLE 275 /WM_TIMER 275/g
|
||||
s/CYCLE 276 /WM_HSCROLL 276/g
|
||||
s/CYCLE 277 /WM_VSCROLL 277/g
|
||||
s/CYCLE 278 /WM_INITMENU 278/g
|
||||
s/CYCLE 279 /WM_INITMENUPOPUP 279/g
|
||||
s/CYCLE 287 /WM_MENUSELECT 287/g
|
||||
s/CYCLE 288 /WM_MENUCHAR 288/g
|
||||
s/CYCLE 289 /WM_ENTERIDLE 289/g
|
||||
s/CYCLE 290 /WM_MENURBUTTONUP 290/g
|
||||
s/CYCLE 306 /WM_CTLCOLORMSGBOX 306/g
|
||||
s/CYCLE 307 /WM_CTLCOLOREDIT 307/g
|
||||
s/CYCLE 308 /WM_CTLCOLORLISTBOX 308/g
|
||||
s/CYCLE 309 /WM_CTLCOLORBTN 309/g
|
||||
s/CYCLE 310 /WM_CTLCOLORDLG 310/g
|
||||
s/CYCLE 311 /WM_CTLCOLORSCROLLBAR 311/g
|
||||
s/CYCLE 312 /WM_CTLCOLORSTATIC 312/g
|
||||
s/CYCLE 512 /WM_MOUSEMOVE 512/g
|
||||
s/CYCLE 512 /WM_MOUSEFIRST 512/g
|
||||
s/CYCLE 513 /WM_LBUTTONDOWN 513/g
|
||||
s/CYCLE 514 /WM_LBUTTONUP 514/g
|
||||
s/CYCLE 515 /WM_LBUTTONDBLCLK 515/g
|
||||
s/CYCLE 516 /WM_RBUTTONDOWN 516/g
|
||||
s/CYCLE 517 /WM_RBUTTONUP 517/g
|
||||
s/CYCLE 518 /WM_RBUTTONDBLCLK 518/g
|
||||
s/CYCLE 519 /WM_MBUTTONDOWN 519/g
|
||||
s/CYCLE 520 /WM_MBUTTONUP 520/g
|
||||
s/CYCLE 521 /WM_MBUTTONDBLCLK 521/g
|
||||
s/CYCLE 522 /WM_MOUSEWHEEL 522/g
|
||||
s/CYCLE 522 /WM_MOUSELAST 522/g
|
||||
s/CYCLE 523 /WM_XBUTTONDOWN 523/g
|
||||
s/CYCLE 524 /WM_XBUTTONUP 524/g
|
||||
s/CYCLE 525 /WM_XBUTTONDBLCLK 525/g
|
||||
s/CYCLE 525 /WM_MOUSELAST 525/g
|
||||
s/CYCLE 528 /WM_PARENTNOTIFY 528/g
|
||||
s/CYCLE 529 /WM_ENTERMENULOOP 529/g
|
||||
s/CYCLE 530 /WM_EXITMENULOOP 530/g
|
||||
s/CYCLE 531 /WM_NEXTMENU 531/g
|
||||
s/CYCLE 531 /WM_NEXTMENU 531/g
|
||||
s/CYCLE 532 /WM_SIZING 532/g
|
||||
s/CYCLE 533 /WM_CAPTURECHANGED 533/g
|
||||
s/CYCLE 534 /WM_MOVING 534/g
|
||||
s/CYCLE 536 /WM_POWERBROADCAST 536/g
|
||||
s/CYCLE 537 /WM_DEVICECHANGE 537/g
|
||||
s/CYCLE 544 /WM_MDICREATE 544/g
|
||||
s/CYCLE 545 /WM_MDIDESTROY 545/g
|
||||
s/CYCLE 546 /WM_MDIACTIVATE 546/g
|
||||
s/CYCLE 547 /WM_MDIRESTORE 547/g
|
||||
s/CYCLE 548 /WM_MDINEXT 548/g
|
||||
s/CYCLE 549 /WM_MDIMAXIMIZE 549/g
|
||||
s/CYCLE 550 /WM_MDITILE 550/g
|
||||
s/CYCLE 551 /WM_MDICASCADE 551/g
|
||||
s/CYCLE 552 /WM_MDIICONARRANGE 552/g
|
||||
s/CYCLE 553 /WM_MDIGETACTIVE 553/g
|
||||
s/CYCLE 560 /WM_MDISETMENU 560/g
|
||||
s/CYCLE 561 /WM_ENTERSIZEMOVE 561/g
|
||||
s/CYCLE 562 /WM_EXITSIZEMOVE 562/g
|
||||
s/CYCLE 563 /WM_DROPFILES 563/g
|
||||
s/CYCLE 564 /WM_MDIREFRESHMENU 564/g
|
||||
s/CYCLE 768 /WM_CUT 768/g
|
||||
s/CYCLE 769 /WM_COPY 769/g
|
||||
s/CYCLE 770 /WM_PASTE 770/g
|
||||
s/CYCLE 771 /WM_CLEAR 771/g
|
||||
s/CYCLE 772 /WM_UNDO 772/g
|
||||
s/CYCLE 773 /WM_RENDERFORMAT 773/g
|
||||
s/CYCLE 774 /WM_RENDERALLFORMATS 774/g
|
||||
s/CYCLE 775 /WM_DESTROYCLIPBOARD 775/g
|
||||
s/CYCLE 776 /WM_DRAWCLIPBOARD 776/g
|
||||
s/CYCLE 777 /WM_PAINTCLIPBOARD 777/g
|
||||
s/CYCLE 778 /WM_VSCROLLCLIPBOARD 778/g
|
||||
s/CYCLE 779 /WM_SIZECLIPBOARD 779/g
|
||||
s/CYCLE 780 /WM_ASKCBFORMATNAME 780/g
|
||||
s/CYCLE 781 /WM_CHANGECBCHAIN 781/g
|
||||
s/CYCLE 782 /WM_HSCROLLCLIPBOARD 782/g
|
||||
s/CYCLE 783 /WM_QUERYNEWPALETTE 783/g
|
||||
s/CYCLE 784 /WM_PALETTEISCHANGING 784/g
|
||||
s/CYCLE 785 /WM_PALETTECHANGED 785/g
|
||||
s/CYCLE 786 /WM_HOTKEY 786/g
|
||||
s/CYCLE 791 /WM_PRINT 791/g
|
||||
s/CYCLE 792 /WM_PRINTCLIENT 792/g
|
||||
s/CYCLE 794 /WM_THEMECHANGED 794/g
|
||||
s/CYCLE 856 /WM_HANDHELDFIRST 856/g
|
||||
s/CYCLE 863 /WM_HANDHELDLAST 863/g
|
||||
s/CYCLE 864 /WM_AFXFIRST 864/g
|
||||
s/CYCLE 895 /WM_AFXLAST 895/g
|
||||
s/CYCLE 896 /WM_PENWINFIRST 896/g
|
||||
s/CYCLE 911 /WM_PENWINLAST 911/g
|
||||
s/CYCLE 1024 /WM_USER 1024/g
|
||||
s/CYCLE 32768 /WM_APP 32768/g
|
||||
s/CYCLE 0x0123 /WM_MENUDRAG 0x0123/g
|
||||
s/CYCLE 0x0124 /WM_MENUGETOBJECT 0x0124/g
|
||||
s/CYCLE 0x0125 /WM_UNINITMENUPOPUP 0x0125/g
|
||||
s/CYCLE 0x0126 /WM_MENUCOMMAND 0x0126/g
|
||||
s/CYCLE 0x02A0 /WM_NCMOUSEHOVER 0x02A0/g
|
||||
s/CYCLE 0x02A2 /WM_NCMOUSELEAVE 0x02A2/g
|
||||
s/CYCLE 0x2A1 /WM_MOUSEHOVER 0x2A1/g
|
||||
s/CYCLE 0x2A3 /WM_MOUSELEAVE 0x2A3/g
|
||||
s/NEW EVENT WM_LBUTTONUP 514/\n\n\n\n******************************* NEW EVENT COMBO ON WM_LBUTTONUP 514 ***********************************/g
|
||||
#state Formats
|
||||
s/STATE 1/WA_ACTIVE (1) - deactivate (lParam)/g
|
||||
s/STATE 2/WA_CLICKACTIVE (2) - deactivate (lParam) /g
|
||||
s/STATE 0/WA_INACTIVE (0) - activate (lParam)/g
|
||||
#window styles
|
||||
s/Extended Style 16/WS_EX_ACCEPTFILES 16/g
|
||||
s/Extended Style 262144/WS_EX_APPWINDOW 262144/g
|
||||
s/Extended Style 512/WS_EX_CLIENTEDGE 512/g
|
||||
s/Extended Style 33554432/WS_EX_COMPOSITED 33554432/g
|
||||
s/Extended Style 1024/WS_EX_CONTEXTHELP 1024/g
|
||||
s/Extended Style 65536/WS_EX_CONTROLPARENT 65536/g
|
||||
s/Extended Style 16384/WS_EX_LEFTSCROLLBAR 16384/g
|
||||
s/Extended Style 134217728/WS_EX_NOACTIVATE 134217728/g
|
||||
s/Extended Style 1048576/WS_EX_NOINHERITLAYOUT 1048576/g
|
||||
s/Extended Style 4/WS_EX_NOPARENTNOTIFY 4/g
|
||||
s/Extended Style 392/WS_EX_PALETTEWINDOW 392/g
|
||||
s/Extended Style 768/WS_EX_OVERLAPPEDWINDOW 768/g
|
||||
s/Extended Style 4096/WS_EX_RIGHT 4096/g
|
||||
s/Extended Style 0/WS_EX_RIGHTSCROLLBAR 0/g
|
||||
s/Extended Style 131072/WS_EX_STATICEDGE 131072/g
|
||||
s/Extended Style 32/WS_EX_TRANSPARENT 32/g
|
||||
s/Extended Style 256/WS_EX_WINDOWEDGE 256/g
|
||||
s/Extended Style 128/WS_EX_TOOLWINDOW 128/g
|
||||
# size flags
|
||||
s/SIZE_FLAG is 4/SIZE_MAXHIDE (4)/g
|
||||
s/SIZE_FLAG is 2/SIZE_MAXIMIZED (2)/g
|
||||
s/SIZE_FLAG is 3/SIZE_MAXSHOW (3)/g
|
||||
s/SIZE_FLAG is 1/SIZE_MINIMIZED (1)/g
|
||||
s/SIZE_FLAG is 0/SIZE_RESTORED (0)/g
|
||||
# Event Type
|
||||
s/EventType 0/NSLeftMouseDown/g
|
||||
s/EventType 1/NSLeftMouseUp/g
|
||||
s/EventType 2/NSOtherMouseDown/g
|
||||
s/EventType 3/NSOtherMouseUp/g
|
||||
s/EventType 4/NSRightMouseDown/g
|
||||
s/EventType 5/NSRightMouseUp/g
|
||||
s/EventType 6/NSMouseMoved/g
|
||||
s/EventType 7/NSLeftMouseDragged/g
|
||||
s/EventType 8/NSOtherMouseDragged/g
|
||||
s/EventType 9/NSRightMouseDragged/g
|
||||
s/EventType 10/NSMouseEntered/g
|
||||
s/EventType 11/NSMouseExited/g
|
||||
s/EventType 12/NSKeyDown/g
|
||||
s/EventType 13/NSKeyUp/g
|
||||
s/EventType 14/NSFlagsChanged/g
|
||||
s/EventType 15/NSAppKitDefined/g
|
||||
s/EventType 16/NSSystemDefined/g
|
||||
s/EventType 17/NSApplicationDefined/g
|
||||
s/EventType 18/NSPeriodic/g
|
||||
s/EventType 19/NSCursorUpdate/g
|
||||
s/EventType 20/NSScrollWheel/g
|
||||
#show window
|
||||
s/SW_FLAG 4/SW_OTHERUNZOOM 4/g
|
||||
s/SW_FLAG 2/SW_OTHERZOOM 2/g
|
||||
s/SW_FLAG 1/SW_PARENTCLOSING 1/g
|
||||
s/SW_FLAG 3/SW_PARENTOPENING 3/g
|
||||
s/SW_FLAG 0/ZERO 0/g
|
||||
#Gnustep state flags
|
||||
s/MENU item state is 0/NSOffState 0/g
|
||||
s/MENU item state is 1/NSOnState 1/g
|
||||
s/MENU item state is -1/NSMixedState -1/g
|
||||
#
|
||||
#GS eventTypes
|
||||
#
|
||||
s/GSMouse_EVENT 0/NSLeftMouseDown 0/g
|
||||
#s/GSMouse_EVENT 1/NSLeftMouseUp 1/g
|
||||
s/GSMouse_EVENT 2/NSOtherMouseDown 2/g
|
||||
s/GSMouse_EVENT 3/NSOtherMouseUp 3/g
|
||||
s/GSMouse_EVENT 4/NSRightMouseDown 4/g
|
||||
#s/GSMouse_EVENT 5/NSRightMouseUp 5/g
|
||||
s/GSMouse_EVENT 6/NSMouseMoved 6/g
|
||||
s/GSMouse_EVENT 7/NSLeftMouseDragged 7/g
|
||||
s/GSMouse_EVENT 8/NSOtherMouseDragged 8/g
|
||||
s/GSMouse_EVENT 9/NSRightMouseDragged 9/g
|
||||
s/GSMouse_EVENT 10/NSMouseEntered 10/g
|
||||
s/GSMouse_EVENT 11/NSMouseExited 11/g
|
||||
s/GSKeyboard_EVENT 12/NSKeyDown 12/g
|
||||
s/GSKeyboard_EVENT 13/NSKeyUp 13/g
|
||||
s/GS_EVENT 14/NSFlagsChanged 14/g
|
||||
s/GS_EVENT 15/NSAppKitDefined 15/g
|
||||
s/GS_EVENT 16/NSSystemDefined 16/g
|
||||
s/GS_EVENT 17/NSApplicationDefined 17/g
|
||||
s/GS_EVENT 18/NSPeriodic 18/g
|
||||
s/GS_EVENT 19/NSCursorUpdate 19/g
|
||||
s/GS_EVENT 20/NSScrollWheel 20/g
|
||||
#
|
||||
#GS_SUBTYPES
|
||||
#
|
||||
s/GS_SUBTYPE 1/GSAppKitWindowMoved 1/g
|
||||
s/GS_SUBTYPE 2/GSAppKitWindowResized 2/g
|
||||
s/GS_SUBTYPE 3/GSAppKitWindowClose 3/g
|
||||
s/GS_SUBTYPE 4/GSAppKitWindowMiniaturize 4/g
|
||||
s/GS_SUBTYPE 5/GSAppKitWindowFocusIn 5/g
|
||||
s/GS_SUBTYPE 6/GSAppKitWindowFocusOut 6/g
|
||||
s/GS_SUBTYPE 7/GSAppKitWindowLeave 7/g
|
||||
s/GS_SUBTYPE 8/GSAppKitWindowEnter 8/g
|
||||
s/GS_SUBTYPE 9/GSAppKitDraggingEnter 9/g
|
||||
s/GS_SUBTYPE 10/GSAppKitDraggingUpdate 10/g
|
||||
s/GS_SUBTYPE 11/GSAppKitDraggingStatus 11/g
|
||||
s/GS_SUBTYPE 12/GSAppKitDraggingExit 12/g
|
||||
s/GS_SUBTYPE 13/GSAppKitDraggingDrop 13/g
|
||||
s/GS_SUBTYPE 14/GSAppKitDraggingFinished 14/g
|
||||
#
|
||||
# syscommand params
|
||||
#
|
||||
s/SYSTEM MENU REQUESTED 0xF060/SC_CLOSE 0xF060/g
|
||||
s/SYSTEM MENU REQUESTED 0xF180/SC_CONTEXTHELP 0xF180/g
|
||||
s/SYSTEM MENU REQUESTED 0xF150/SC_HOTKEY 0xF150/g
|
||||
s/SYSTEM MENU REQUESTED 0xF080/SC_HSCROLL 0xF080/g
|
||||
s/SYSTEM MENU REQUESTED 0xF100/SC_KEYMENU 0xF100/g
|
||||
s/SYSTEM MENU REQUESTED 0xF030/SC_MAXIMIZE 0xF030/g
|
||||
s/SYSTEM MENU REQUESTED 0xF020/SC_MINIMIZE 0xF020/g
|
||||
s/SYSTEM MENU REQUESTED 0xF170/SC_MONITORPOWER 0xF170/g
|
||||
s/SYSTEM MENU REQUESTED 0xF090/SC_MOUSEMENU 0xF090/g
|
||||
s/SYSTEM MENU REQUESTED 0xF010/SC_MOVE 0xF010/g
|
||||
s/SYSTEM MENU REQUESTED 0xF040/SC_NEXTWINDOW 0xF040/g
|
||||
s/SYSTEM MENU REQUESTED 0xF050/SC_PREVWINDOW 0xF050/g
|
||||
s/SYSTEM MENU REQUESTED 0xF120/SC_RESTORE 0xF120/g
|
||||
s/SYSTEM MENU REQUESTED 0xF140/SC_SCREENSAVE 0xF140/g
|
||||
s/SYSTEM MENU REQUESTED 0xF000/SC_SIZE 0xF000/g
|
||||
s/SYSTEM MENU REQUESTED 0xF130/SC_TASKLIST 0xF130/g
|
||||
s/SYSTEM MENU REQUESTED 0xF070/SC_VSCROLL 0xF070/g
|
||||
|
||||
|
||||
|
||||
#finalize format
|
||||
s/+//g
|
||||
s/*//g
|
||||
s/#//g
|
||||
s/=//g
|
||||
s/ / /g
|
||||
s/NEW EVENT COMBO ON WM_LBUTTONUP 514/NEW CYCLE/g
|
||||
s/NEW EVENT/NEW EVENT\n/g
|
||||
s/<BLANK_LINE>/\n\n/g
|
||||
s/\n\n/\n/g
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -44,8 +44,6 @@ win32_C_FILES = \
|
|||
# The Objective-C source files to be compiled
|
||||
win32_OBJC_FILES = \
|
||||
WIN32Server.m \
|
||||
w32_debug.m \
|
||||
w32_notifications.m \
|
||||
w32_activate.m \
|
||||
w32_create.m \
|
||||
w32_general.m \
|
||||
|
@ -54,7 +52,6 @@ w32_text_focus.m \
|
|||
w32_windowdisplay.m \
|
||||
w32_GLformat.m \
|
||||
w32_GLcontext.m \
|
||||
GSDisplayServer_details.m \
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
|
|
|
@ -1,71 +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 Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <GNUstepGUI/GSDisplayServer.h>
|
||||
#include "w32_events.h"
|
||||
|
||||
@implementation GSDisplayServer (GSDisplayServer_details)
|
||||
|
||||
- (int) eventQueCount
|
||||
{
|
||||
return [event_queue count];
|
||||
}
|
||||
|
||||
- (NSMutableString *) dumpQue:(int)acount
|
||||
{
|
||||
NSMutableString * output;
|
||||
int i=0;
|
||||
int c=[event_queue count];
|
||||
|
||||
output = [NSMutableString stringWithCapacity: 1024];
|
||||
[output appendString: @"Dumping "];
|
||||
if (acount >=c || acount==0)
|
||||
acount=c;
|
||||
else
|
||||
c=acount;
|
||||
|
||||
if (c==0)
|
||||
{
|
||||
[output appendString:@"0 Events Que is empty\n"];
|
||||
return output;
|
||||
}
|
||||
|
||||
[output appendFormat:@"%d From the EventQue\n-> ", c];
|
||||
|
||||
for (i=0;i<c;i++)
|
||||
{
|
||||
[output appendFormat:@"%d EventType %d\n-> "
|
||||
, i, [(NSEvent *)[event_queue objectAtIndex:i] type]];
|
||||
}
|
||||
[output appendString:@"\n"];
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
- (void) clearEventQue
|
||||
{
|
||||
[event_queue removeAllObjects];
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,233 +0,0 @@
|
|||
CYGWIN 1.5.17(0.129/4/2) or higher
|
||||
CYGWIN CYGWIN_NT-5.1
|
||||
CYGWIN 2005-05-25 19:38
|
||||
|
||||
September 29, 2005
|
||||
Fixed in this release:
|
||||
|
||||
fixed a compile errors when the debug flags were activated
|
||||
|
||||
Removed Detailed Documentation that was mistakenly release in august
|
||||
|
||||
backend now reads and writes correctly to the defaults db
|
||||
|
||||
New Features:
|
||||
|
||||
Fully impliment window style mapping to allow for native win32 look.
|
||||
The Main menu still looks like the standard GNUstep menu sence it is unique to
|
||||
Gnustep. All other window look and act like win32 windows
|
||||
|
||||
GSUseWMTaskbar is now working correctly, and I have also added another defaults flag
|
||||
called GSUseWMStyles which tells cygwin what style of windows it should use.
|
||||
|
||||
There is now a small configure panel which can be accessed in the app menu
|
||||
under info -> server Preferneces. This will allow you to select win32 style windows,
|
||||
Gnustep style window, or a combination of each if you like.
|
||||
|
||||
All of the notification related code has been moved to w32_notifications.m
|
||||
inorder to keep it in one place for managability.
|
||||
|
||||
|
||||
Future release:
|
||||
|
||||
complete context menu handling
|
||||
|
||||
More robust window registration under win32.
|
||||
|
||||
Parent - child window mapping down to the win32 level. This should give access
|
||||
to more events and improve server to server communication, and hopfully
|
||||
get a step closer to native evwent handling.
|
||||
|
||||
display of custom app icons on the taskbar.
|
||||
|
||||
Rect tracing when resizing windows
|
||||
|
||||
log file manager; this is allready in progress but not ready for release
|
||||
|
||||
integration with GSWorkspace
|
||||
|
||||
re impliment keyboard events so that cut copy past and other key equivilents work
|
||||
|
||||
PLEASE try it out and send FEEDBACK
|
||||
|
||||
Tom MacSween
|
||||
macsweent@sympatico.ca
|
||||
|
||||
August 22, 2005
|
||||
|
||||
|
||||
Project OverView:
|
||||
I started this to simply fix the display of toolbars under cygwin...
|
||||
Well I wound up doing a whole lot more:
|
||||
|
||||
Fixed in this release
|
||||
view resizing issues related to toolbars and minimizing of windows
|
||||
|
||||
application hiding - main menu has a taskbar icon everything else hides
|
||||
|
||||
Menu positioning bug - on activate after a hide - menu now does what it should
|
||||
|
||||
App windows - now have a named taskbar icon
|
||||
|
||||
window styles mapping - completed but not implimented; A future release will
|
||||
support native win32 decorations.
|
||||
|
||||
tear off Menus - now have a close button and an icon on the taskbar
|
||||
|
||||
Context Menu - working much better not fully completed but very usable
|
||||
|
||||
notifications - backend now receives key notifications from the App that it is
|
||||
displaying. see details view for more info.
|
||||
|
||||
structure - backend is more managable with event type catagories.
|
||||
It will also support subclassing more easily.
|
||||
Positioned for a native backend implimentation (future)
|
||||
Other window evwnts not currently managed are stubbed and ready for
|
||||
a future release
|
||||
|
||||
debugging - with the right defines the backend will produce rich and readable
|
||||
log files. See detail in the details view
|
||||
|
||||
|
||||
|
||||
details view:
|
||||
|
||||
Styles are mapped between the two systems note that this release does not
|
||||
utilize them but I have left them here for a future release.
|
||||
|
||||
I have also removed the check for useWMTaskBar in this release. behavior is native
|
||||
win32 - at this point I do not have gworkspace running under cygwin so it is not
|
||||
relivant.
|
||||
|
||||
I do not use the handlesWindowDecorations in my code but it is still set for use
|
||||
by the original code. I have not changed current inplimentation of mouse or keyboard
|
||||
events.
|
||||
|
||||
The WM_SETTEXT is removed from the event loop. win32 will handle this nicely for us.
|
||||
It will give us nice taskbar icons with window titles!
|
||||
|
||||
Window events are not posted - window events are either handled directly by the server
|
||||
or are sent directly to the window that they were called on using:
|
||||
|
||||
[EVENT_WINDOW(hwnd) sendEvent:anEvent]
|
||||
|
||||
This fixes any issues with view related display problems... like toolbars for example.
|
||||
Mouse and Keyboard events are posted and qued as usual.
|
||||
|
||||
|
||||
New debug features: controls are found in w32_config.h
|
||||
|
||||
#define _logging
|
||||
use to log messages to NSDebuglog
|
||||
|
||||
define any of these at compile time or uncomment them in the w32_config.h
|
||||
and get a bucket to catch stdout!
|
||||
|
||||
note: do not divert the out put from these next defines to NSDebuglog
|
||||
there is so much data that it will clog the works.
|
||||
I also do not recommend these be used unless you are debugging
|
||||
the back end
|
||||
#define __W32_debug__
|
||||
activate the debug code in the main event server
|
||||
output is to standard out only
|
||||
|
||||
#define __W32_debug_Event_loop
|
||||
special flag for event loops and counts all posted events are
|
||||
displayed in the log file.
|
||||
__W32_debug__ must be defined for this to work
|
||||
output is to standard out only
|
||||
|
||||
#define __STATE (YES or NO)
|
||||
when set to yes, events that are not currently implimented but monitered
|
||||
in the event loop will be included in the log output
|
||||
__W32_debug__ must be defined for this to work
|
||||
output is to standard out only
|
||||
|
||||
Event_format.sed
|
||||
pipe the output through sed with this file and it will clean up the
|
||||
output and make it more reader friendly.
|
||||
|
||||
|
||||
Notifications:
|
||||
|
||||
The backend now has better communication between it and the application.
|
||||
A display server needs to know what the app is doing in order to manage the
|
||||
task of displaying windows for it. To that end the backend is registerd for
|
||||
the following notifications:
|
||||
|
||||
NSApplicationWillHideNotification
|
||||
Catch the hide event and set flags so that the backend will defer
|
||||
to the native server (winxp NT or 9x) and allow the App to hide.
|
||||
|
||||
NSApplicationWillFinishLaunching
|
||||
registered but not utilized at this point (planned future development)
|
||||
|
||||
NSApplicationDidFinishLaunching
|
||||
Catch the main menu and finalize its setup for use in the win32
|
||||
environment. I have used some native win32 code here to accomplish
|
||||
this task. In future other tasks could also be carried out here.
|
||||
|
||||
NSWindowWillMiniaturizeNotification
|
||||
Basically this is done for the same reason as catching the hide.
|
||||
Set flags so that the backend will defer to the native server
|
||||
(winxp NT or 9x) and allow the window to miniturize without disturbing
|
||||
the views that it contains.
|
||||
|
||||
The next two Notifications are custom and unique to the win32 server and
|
||||
are implimented to manage specific menu events. I have overriden two internal
|
||||
NSMenu methods so that the notifications get sent. See notes on overrides.
|
||||
|
||||
NSMenuWillTearOff
|
||||
Set the win32 style on the menu window so that it will display an icon on
|
||||
the taskbar with a title. A tear of menu will always have a title that
|
||||
looks like: 'MENU submenu title' this makes it easy to find a tear off menu
|
||||
that could be hidden under any number of other windows.
|
||||
|
||||
NSMenuwillPopUP
|
||||
This allows the backend to setup and manage the behavior of a context
|
||||
menu in the win32 environment. This is not fully implimented but the
|
||||
behavior of the context menu is greatly improved. More work will be done
|
||||
on this in s future release.
|
||||
|
||||
Note: when debug is active (#define __W32_debug__) the server will register for all
|
||||
NSWindow notifications and some NSView notifications. Helps to show where
|
||||
appevents and server events are happening relitive to each other.
|
||||
these are all dumpted to a formatter for display in the log output.
|
||||
|
||||
Overrides of key methods:
|
||||
|
||||
In order the get the behavior I wanted the following methods from NSMenu
|
||||
have been overriden:
|
||||
|
||||
- (void) _rightMouseDisplay: (NSEvent*)theEvent;
|
||||
Modified by override to send NSMenuwillPopUP notification to the server.
|
||||
|
||||
- (void) setTornOff: (BOOL)flag;
|
||||
Modified by override to send NSMenuWillTearOff notification to the server
|
||||
|
||||
code Organization:
|
||||
|
||||
The code has been restructured to allow for more flexibility, managability and
|
||||
future development. The main event code is organized as catagories of
|
||||
WIN32Server in the following files:
|
||||
|
||||
w32_config.h: manage all of the defines need to control the debug output
|
||||
w32_debug.m: all of the main debug log generation is done here
|
||||
GSDisplayServer_details.m: (special catagory for debug hooks)
|
||||
|
||||
WIN32Server.m: main entry point for event handling
|
||||
|
||||
w32_Events.h: declarations of catagories and methods implimented in
|
||||
the follow files (see the code for more details)
|
||||
|
||||
w32_activate.m
|
||||
w32_create.m
|
||||
w32_debug.m
|
||||
w32_general.m
|
||||
w32_movesize.m
|
||||
w32_text_focus.m
|
||||
w32_windowdisplay.m
|
||||
|
||||
|
||||
|
||||
|
|
@ -52,24 +52,16 @@
|
|||
#ifdef HAVE_WGL
|
||||
#include "win32/WIN32OpenGL.h"
|
||||
#endif
|
||||
#include "w32_config.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
static NSString * Version =@"(C) 2005 FSF gnustep-back 0.10.1";
|
||||
// custom event notifications
|
||||
static NSString *NSMenuWillTearOff = @"MenuWillTearOff";
|
||||
static NSString *NSMenuwillPopUP =@"MenuwillPopUP";
|
||||
static NSString *NSWindowDidCreateWindow =@"WindowDidCreateWindow";
|
||||
|
||||
static NSEvent *process_key_event(WIN32Server *svr,
|
||||
HWND hwnd, WPARAM wParam, LPARAM lParam, NSEventType eventType);
|
||||
static NSEvent *process_mouse_event(WIN32Server *svr,
|
||||
HWND hwnd, WPARAM wParam, LPARAM lParam, NSEventType eventType);
|
||||
|
||||
//static BOOL HAVE_MAIN_MENU = NO;
|
||||
static BOOL handlesWindowDecorations = NO;
|
||||
|
||||
static void
|
||||
validateWindow(WIN32Server *svr, HWND hwnd, RECT rect);
|
||||
|
@ -78,7 +70,25 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
|
||||
@implementation WIN32Server
|
||||
|
||||
// server opts
|
||||
- (BOOL) handlesWindowDecorations
|
||||
{
|
||||
return handlesWindowDecorations;
|
||||
}
|
||||
|
||||
- (void) setHandlesWindowDecorations: (BOOL) b
|
||||
{
|
||||
handlesWindowDecorations = b;
|
||||
}
|
||||
|
||||
- (BOOL) usesNativeTaskbar
|
||||
{
|
||||
return usesNativeTaskbar;
|
||||
}
|
||||
|
||||
- (void) setUsesNativeTaskbar: (BOOL) b
|
||||
{
|
||||
usesNativeTaskbar = b;
|
||||
}
|
||||
|
||||
- (void) callback: (id) sender
|
||||
|
||||
|
@ -142,21 +152,10 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
dequeue: (BOOL)flag
|
||||
{
|
||||
[self callback: nil];
|
||||
#ifdef __W32_debug_Event_loop
|
||||
NSEvent * theEvent = [super getEventMatchingMask: mask
|
||||
beforeDate: limit
|
||||
inMode: mode
|
||||
dequeue: flag];
|
||||
|
||||
printf("Got EventType %d\n", [theEvent type]);
|
||||
return theEvent;
|
||||
#else
|
||||
|
||||
return [super getEventMatchingMask: mask
|
||||
beforeDate: limit
|
||||
inMode: mode
|
||||
dequeue: flag];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) discardEventsMatchingMask: (unsigned)mask
|
||||
|
@ -173,42 +172,13 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
/* Initialize AppKit backend */
|
||||
+ (void) initializeBackend
|
||||
{
|
||||
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("############## + (void)initializeBackend ##########################\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
|
||||
NSUserDefaults *defs;
|
||||
|
||||
NSDebugLog(@"Initializing GNUstep win32 backend.\n");
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
if ([defs objectForKey: @"GSBackHandlesWindowDecorations"])
|
||||
{
|
||||
handlesWindowDecorations =
|
||||
[defs boolForKey: @"GSBackHandlesWindowDecorations"];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([defs objectForKey: @"GSWIN32HandlesWindowDecorations"])
|
||||
{
|
||||
handlesWindowDecorations =
|
||||
[defs boolForKey: @"GSWINHandlesWindowDecorations"];
|
||||
}
|
||||
}
|
||||
|
||||
[GSDisplayServer setDefaultServerClass: [WIN32Server class]];
|
||||
//Flag to handle main menu window type -- parent of other menu windows
|
||||
}
|
||||
|
||||
- (void) _initWin32Context
|
||||
{
|
||||
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("############## - (void) _initWin32Context ##########################\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
WNDCLASSEX wc;
|
||||
hinstance = (HINSTANCE)GetModuleHandle(NULL);
|
||||
|
||||
|
@ -243,12 +213,6 @@ printf("\n\n##############################################################\n");
|
|||
{
|
||||
NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop];
|
||||
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("##- (void) setupRunLoopInputSourcesForMode: (NSString*)mode #######\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
int fdMessageQueue;
|
||||
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
|
||||
|
@ -277,584 +241,71 @@ printf("\n\n##############################################################\n");
|
|||
*/
|
||||
- (id) initWithAttributes: (NSDictionary *)info
|
||||
{
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("##initWithAttributes: (NSDictionary *)info #######\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[self _initWin32Context];
|
||||
[super initWithAttributes: info];
|
||||
// NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||
self = [super initWithAttributes: info];
|
||||
|
||||
//flags.useWMTaskBar = YES;
|
||||
//flags.useWMStyles = YES;
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] stringForKey: @"GSUseWMTaskbar"]
|
||||
!= nil)
|
||||
{
|
||||
flags.useWMTaskBar = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSUseWMTaskbar"];
|
||||
flags.HAVE_SERVER_PREFS = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.HAVE_SERVER_PREFS = NO;
|
||||
}
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] stringForKey: @"GSUseWMStyles"]
|
||||
!= nil)
|
||||
{
|
||||
flags.useWMStyles = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSUseWMStyles"];
|
||||
flags.HAVE_SERVER_PREFS = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.HAVE_SERVER_PREFS = NO;
|
||||
}
|
||||
|
||||
if (flags.useWMStyles == YES)
|
||||
{
|
||||
handlesWindowDecorations = YES;
|
||||
}
|
||||
|
||||
/* the backend needs to be able to keep tabs on events that
|
||||
* are only produced by GNUstep so that it can make changes
|
||||
* or override behavior in favor of the real platform window server
|
||||
*/
|
||||
[nc addObserver: self
|
||||
selector: @selector(ApplicationDidFinishLaunching:)
|
||||
name: NSApplicationDidFinishLaunchingNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(ApplicationWillFinishLaunching:)
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(ApplicationWillHideNotification:)
|
||||
name: NSApplicationWillHideNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(WindowWillMiniaturizeNotification:)
|
||||
name: NSWindowWillMiniaturizeNotification
|
||||
object: nil];
|
||||
|
||||
// register for custom notifications
|
||||
[nc addObserver: self
|
||||
selector: @selector(MenuWillTearOff:)
|
||||
name: NSMenuWillTearOff
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(MenuwillPopUP:)
|
||||
name: NSMenuwillPopUP
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(WindowDidCreateWindow:)
|
||||
name: NSWindowDidCreateWindow
|
||||
object: nil];
|
||||
|
||||
#ifdef __APPNOTIFICATIONS__
|
||||
[self registerForWindowEvents];
|
||||
[self registerForViewEvents];
|
||||
#endif
|
||||
flags.eventQueCount =0;
|
||||
if(self)
|
||||
{
|
||||
[self _initWin32Context];
|
||||
[super initWithAttributes: info];
|
||||
|
||||
[self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||
|
||||
flags.eventQueCount =0;
|
||||
|
||||
[self setHandlesWindowDecorations: NO];
|
||||
[self setUsesNativeTaskbar: YES];
|
||||
|
||||
{ // Check user defaults
|
||||
NSUserDefaults *defs;
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([defs objectForKey: @"GSUseWMStyles"])
|
||||
{
|
||||
NSWarnLog(@"Usage of 'GSUseWMStyles' as user default option is deprecated. "
|
||||
@"This option will be ignored in future versions. "
|
||||
@"You should use 'GSBackHandlesWindowDecorations' option.");
|
||||
[self setHandlesWindowDecorations: ![defs boolForKey: @"GSUseWMStyles"]];
|
||||
}
|
||||
if ([defs objectForKey: @"GSUsesWMTaskbar"])
|
||||
{
|
||||
NSWarnLog(@"Usage of 'GSUseWMTaskbar' as user default option is deprecated. "
|
||||
@"This option will be ignored in future versions. "
|
||||
@"You should use 'GSBackUsesNativeTaskbar' option.");
|
||||
[self setUsesNativeTaskbar: [defs boolForKey: @"GSUseWMTaskbar"]];
|
||||
}
|
||||
|
||||
if ([defs objectForKey: @"GSBackHandlesWindowDecorations"])
|
||||
{
|
||||
[self setHandlesWindowDecorations: [defs boolForKey: @"GSBackHandlesWindowDecorations"]];
|
||||
}
|
||||
if ([defs objectForKey: @"GSBackUsesNativeTaskbar"])
|
||||
{
|
||||
[self setUsesNativeTaskbar: [defs boolForKey: @"GSUseNativeTaskbar"]];
|
||||
}
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// required Notification hooks back to the application
|
||||
|
||||
- (void) ApplicationDidFinishLaunching: (NSNotification*)aNotification
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) ApplicationWillFinishLaunching: (NSNotification*)aNotification
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) ApplicationWillHideNotification: (NSNotification*)aNotification
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
-(void) WindowWillMiniaturizeNotification: (NSNotification*)aNotification
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
-(void) MenuWillTearOff: (NSNotification*)aNotification
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
-(void) MenuwillPopUP: (NSNotification*)aNotification
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
// make a configure window for the backend
|
||||
/* win32 is unique in that it can support both the win32 look and feel or
|
||||
a openstep look and feel.
|
||||
|
||||
To make it easier to switch between the 2 I have added a small server inspector
|
||||
panel that will provide access to settings without recompile.
|
||||
|
||||
If main debug feature is on then I can also add access to some of the switches
|
||||
to control debug output... or log specific event to a log panel.
|
||||
*/
|
||||
- (void) initConfigWindow
|
||||
{
|
||||
unsigned int style = NSTitledWindowMask | NSClosableWindowMask;
|
||||
NSRect rect;
|
||||
NSView *content;
|
||||
NSTextField *theText;
|
||||
NSTextField *theText2;
|
||||
|
||||
rect = NSMakeRect (715, 800, 236, 182);
|
||||
configWindow = RETAIN([[NSWindow alloc] initWithContentRect: rect
|
||||
styleMask: style
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: YES]);
|
||||
[configWindow setTitle: @"server Preferences"];
|
||||
[configWindow setReleasedWhenClosed: NO];
|
||||
|
||||
content = [configWindow contentView];
|
||||
theText = [[NSTextField alloc] initWithFrame: NSMakeRect (27, 155, 190, 22)];
|
||||
[theText setStringValue: @"Win32 GNUStep Display Server"];
|
||||
[theText setEditable: NO];
|
||||
[theText setEnabled: NO];
|
||||
[theText setSelectable: NO];
|
||||
[[theText cell] setBackgroundColor: [NSColor lightGrayColor]];
|
||||
[[theText cell] setBordered: NO];
|
||||
[[theText cell] setBezeled: NO];
|
||||
[content addSubview: theText];
|
||||
|
||||
/*
|
||||
NSTextField *theText1;
|
||||
|
||||
theText1 = [[NSTextField alloc] initWithFrame: NSMakeRect (27, 135, 190, 22)];
|
||||
[theText1 setStringValue: @"Revitalized By Tom MacSween"];
|
||||
[theText1 setEditable: NO];
|
||||
[theText1 setEnabled: NO];
|
||||
[theText1 setSelectable: NO];
|
||||
[[theText1 cell] setBackgroundColor: [NSColor lightGrayColor]];
|
||||
[[theText1 cell] setBordered: NO];
|
||||
[[theText1 cell] setBezeled: NO];
|
||||
[content addSubview: theText1];*/
|
||||
|
||||
theText2 = [[NSTextField alloc] initWithFrame: NSMakeRect (17, 115, 200, 22)];
|
||||
[theText2 setStringValue: Version];
|
||||
[theText2 setEditable: NO];
|
||||
[theText2 setEnabled: NO];
|
||||
[theText2 setSelectable: NO];
|
||||
[[theText2 cell] setBackgroundColor: [NSColor lightGrayColor]];
|
||||
[[theText2 cell] setBordered: NO];
|
||||
[[theText2 cell] setBezeled: NO];
|
||||
[content addSubview: theText2];
|
||||
|
||||
// popup for style
|
||||
styleButton
|
||||
= [[NSPopUpButton alloc] initWithFrame: NSMakeRect (30, 80, 171, 22)];
|
||||
[styleButton setAutoenablesItems: YES];
|
||||
[styleButton setTarget: self];
|
||||
[styleButton setAction: @selector(setStyle:)];
|
||||
[styleButton setTitle: @"Select window Style"];
|
||||
[styleButton addItemWithTitle: @"GNUStep window Style"];
|
||||
[styleButton addItemWithTitle: @"MicroSoft window Style"];
|
||||
[content addSubview: styleButton];
|
||||
|
||||
// set the tags on the items
|
||||
[[styleButton itemAtIndex: 0] setTag: 0];
|
||||
[[styleButton itemAtIndex: 1] setTag: 1];
|
||||
[[styleButton itemAtIndex: 2] setTag: 2];
|
||||
|
||||
|
||||
// check box for using taskbar
|
||||
taskbarButton = [[NSButton alloc] initWithFrame: NSMakeRect (30, 55, 171, 22)];
|
||||
[taskbarButton setButtonType: NSSwitchButton];
|
||||
[taskbarButton setTitle: @"Use Win Taskbar"];
|
||||
[taskbarButton setTarget: self];
|
||||
[taskbarButton setAction: @selector(setTaskBar:)];
|
||||
[content addSubview: taskbarButton];
|
||||
// save to defaults
|
||||
saveButton = [[NSButton alloc] initWithFrame: NSMakeRect (30, 25, 171, 22)];
|
||||
[saveButton setButtonType: NSMomentaryPushInButton];
|
||||
[saveButton setTitle: @"Save to defaults"];
|
||||
[saveButton setTarget: self];
|
||||
[saveButton setAction: @selector(setSave:)];
|
||||
[content addSubview: saveButton];
|
||||
[saveButton setEnabled: NO];
|
||||
|
||||
|
||||
// set the buttons to match the current state
|
||||
if (flags.useWMStyles == YES)
|
||||
[styleButton selectItemAtIndex: 2];
|
||||
else
|
||||
[styleButton selectItemAtIndex: 1];
|
||||
|
||||
if (flags.useWMTaskBar == YES)
|
||||
[taskbarButton setState: NSOnState];
|
||||
else
|
||||
[taskbarButton setState: NSOffState];
|
||||
}
|
||||
|
||||
// config window actions
|
||||
|
||||
- (void) setStyle: (id)sender
|
||||
{
|
||||
//defaults key: GSUseWMStyles
|
||||
// code flag: flags.useWMStyles
|
||||
[saveButton setEnabled: YES];
|
||||
|
||||
if ([[sender selectedItem] tag] > 1)
|
||||
{
|
||||
flags.useWMStyles = YES;
|
||||
flags.useWMTaskBar = YES;
|
||||
[taskbarButton setState: NSOnState];
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.useWMStyles = NO;
|
||||
flags.useWMTaskBar = NO;
|
||||
[taskbarButton setState: NSOffState];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setTaskBar: (id)sender
|
||||
{
|
||||
//defaults key: GSUseWMTaskbar
|
||||
// code flag: flags.useWMTaskBar
|
||||
[saveButton setEnabled: YES];
|
||||
flags.useWMTaskBar = [sender state];
|
||||
}
|
||||
|
||||
- (void) setSave: (id)sender
|
||||
{
|
||||
NSString *theValue = @"NO";
|
||||
//NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
//printf("Save to defaults\n");
|
||||
if (flags.useWMTaskBar == YES)
|
||||
theValue = @"YES";
|
||||
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: theValue forKey: @"GSUseWMTaskbar"];
|
||||
|
||||
theValue = @"NO";
|
||||
if (flags.useWMStyles == YES)
|
||||
theValue = @"YES";
|
||||
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: theValue forKey: @"GSUseWMStyles"];
|
||||
|
||||
// user must restart application for changes
|
||||
|
||||
NSRunInformationalAlertPanel(@"Server Preferences Changed",
|
||||
@"Changes will take affect on the next restart",
|
||||
@"OK", nil, nil);
|
||||
flags.HAVE_SERVER_PREFS = YES;
|
||||
[configWindow close];
|
||||
[saveButton setEnabled: NO];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (void) showServerPrefs: (id)sender
|
||||
{
|
||||
[configWindow makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
when debug is active (#define __W32_debug__) the following
|
||||
additional notifications are registered for in the backend server.
|
||||
Helps to show where appevents and server
|
||||
events are happening relitive to each other
|
||||
|
||||
|
||||
NSWindowDidBecomeKeyNotification
|
||||
Posted whenever an NSWindow becomes the key window.
|
||||
The notification object is the NSWindow that has become key.
|
||||
This notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidBecomeMainNotification
|
||||
Posted whenever an NSWindow becomes the main window.
|
||||
The notification object is the NSWindow that has become main.
|
||||
This notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidChangeScreenNotification
|
||||
Posted whenever a portion of an NSWindow’s frame moves onto
|
||||
or off of a screen.
|
||||
The notification object is the NSWindow that has changed screens.
|
||||
This notification does not contain a userInfo dictionary.
|
||||
This notification is not sent in Mac OS X versions earlier than 10.4.
|
||||
|
||||
NSWindowDidChangeScreenProfileNotification
|
||||
Posted whenever the display profile for the screen containing the window
|
||||
changes.
|
||||
This notification is sent only if the window returns YES from
|
||||
displaysWhenScreenProfileChanges. This notification may be sent
|
||||
when a majority of the window is moved to a different screen
|
||||
(whose profile is also different from the previous screen) or when
|
||||
the ColorSync profile for the current screen changes. The
|
||||
notification object is the NSWindow whose profile changed. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
|
||||
NSWindowDidDeminiaturizeNotification
|
||||
Posted whenever an NSWindow is deminiaturized.
|
||||
The notification object is the NSWindow that has been deminiaturized. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidEndSheetNotification
|
||||
Posted whenever an NSWindow closes an attached sheet.
|
||||
The notification object is the NSWindow that contained the sheet. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidExposeNotification
|
||||
Posted whenever a portion of a nonretained NSWindow is exposed,
|
||||
whether by being ordered in front of other windows or by other
|
||||
windows being removed from in front of it. The notification
|
||||
object is the NSWindow that has been exposed. The userInfo
|
||||
dictionary contains the following information: Key
|
||||
@"NSExposedRect" Value The rectangle that has been exposed
|
||||
(NSValue containing an NSRect).
|
||||
|
||||
NSWindowDidMiniaturizeNotification
|
||||
Posted whenever an NSWindow is miniaturized.
|
||||
The notification object is the NSWindow that has been miniaturized. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidMoveNotification
|
||||
Posted whenever an NSWindow is moved.
|
||||
The notification object is the NSWindow that has moved. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidResignKeyNotification
|
||||
Posted whenever an NSWindow resigns its status as key window.
|
||||
The notification object is the NSWindow that has resigned its key window
|
||||
status. This notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidResignMainNotification
|
||||
Posted whenever an NSWindow resigns its status as main window.
|
||||
The notification object is the NSWindow that has resigned its main window
|
||||
status. This notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidResizeNotification
|
||||
Posted whenever an NSWindow’s size changes.
|
||||
The notification object is the NSWindow whose size has changed. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowDidUpdateNotification
|
||||
Posted whenever an NSWindow receives an update message.
|
||||
The notification object is the NSWindow that received the update
|
||||
message. This notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowWillBeginSheetNotification
|
||||
Posted whenever an NSWindow is about to open a sheet.
|
||||
The notification object is the NSWindow that is about to open the
|
||||
sheet. This notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowWillCloseNotification
|
||||
Posted whenever an NSWindow is about to close.
|
||||
The notification object is the NSWindow that is about to close. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
|
||||
NSWindowWillMiniaturizeNotification
|
||||
Posted whenever an NSWindow is about to be miniaturized.
|
||||
The notification object is the NSWindow that is about to be
|
||||
miniaturized. This notification does not contain a userInfo
|
||||
dictionary.
|
||||
|
||||
NSWindowWillMoveNotification
|
||||
Posted whenever an NSWindow is about to move.
|
||||
The notification object is the NSWindow that is about to move. This
|
||||
notification does not contain a userInfo dictionary.
|
||||
*/
|
||||
|
||||
- (void) registerForWindowEvents
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidDeminiaturizeNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidMiniaturizeNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidBecomeMainNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidChangeScreenNotification
|
||||
object: nil];
|
||||
|
||||
/*
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidChangeScreenProfileNotification
|
||||
object: nil];
|
||||
*/
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidExposeNotification
|
||||
object: nil];
|
||||
|
||||
/*
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidEndSheetNotification
|
||||
object: nil];
|
||||
*/
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidMoveNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidResignKeyNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidResignMainNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidResizeNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidUpdateNotification
|
||||
object: nil];
|
||||
|
||||
/*
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowWillBeginSheetNotification
|
||||
object: nil];
|
||||
*/
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowWillMoveNotification
|
||||
object: nil];
|
||||
}
|
||||
|
||||
/*
|
||||
NSViewBoundsDidChangeNotification
|
||||
Posted whenever the NSView’s bounds rectangle changes
|
||||
independently of the frame rectangle, if the NSView is configured
|
||||
using setPostsBoundsChangedNotifications: to post such
|
||||
notifications. The notification object is the NSView whose bounds
|
||||
rectangle has changed. This notification does not contain a
|
||||
userInfo dictionary. The following methods can result in
|
||||
notification posting:
|
||||
|
||||
setBounds:
|
||||
setBoundsOrigin:
|
||||
setBoundsRotation:
|
||||
setBoundsSize:
|
||||
translateOriginToPoint:
|
||||
scaleUnitSquareToSize:
|
||||
rotateByAngle:
|
||||
|
||||
Note that the bounds rectangle resizes automatically to track the
|
||||
frame rectangle. Because the primary change is that of the frame
|
||||
rectangle, however, setFrame: and setFrameSize: don’t result in
|
||||
a bounds-changed notification.
|
||||
|
||||
|
||||
NSViewFocusDidChangeNotification
|
||||
Deprecated notification that was posted for an NSView and each of
|
||||
its descendents (recursively) whenever the frame or bounds
|
||||
geometry of the view changed.
|
||||
*/
|
||||
- (void) registerForViewEvents
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: nil];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSViewFocusDidChangeNotification
|
||||
object: nil];
|
||||
}
|
||||
|
||||
|
||||
- (void) _destroyWin32Context
|
||||
{
|
||||
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("- (void) _destroyWin32Context\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
|
||||
UnregisterClass("GNUstepWindowClass", hinstance);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
- (void) dealloc
|
||||
{
|
||||
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("- (void) dealloc\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
[self _destroyWin32Context];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) restrictWindow: (int)win toImage: (NSImage*)image
|
||||
{
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("restrictWindow\n");
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
|
||||
//[self subclassResponsibility: _cmd];
|
||||
//TODO [self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (int) findWindowAt: (NSPoint)screenLocation
|
||||
|
@ -1180,36 +631,6 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
// main event loop
|
||||
|
||||
|
||||
- (NSString *) getNativeClassName: (HWND)hwnd
|
||||
{
|
||||
UINT wsize = 80;
|
||||
unichar windowType[wsize + 1];
|
||||
|
||||
if (RealGetWindowClassW(hwnd, windowType, wsize) > 0)
|
||||
{
|
||||
return [NSString stringWithCharacters: windowType
|
||||
length: wcslen(windowType)];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) getWindowtext: (HWND)hwnd
|
||||
{
|
||||
int wsize = 80;
|
||||
unichar windowText[wsize + 1];
|
||||
|
||||
if (GetWindowTextW(hwnd, windowText, wsize) > 0)
|
||||
{
|
||||
return [NSString stringWithCharacters: windowText
|
||||
length: wcslen(windowText)];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reset all of our flags before the next run through the event switch
|
||||
*
|
||||
|
@ -1239,20 +660,6 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
[self setFlagsforEventLoop: hwnd];
|
||||
|
||||
#ifdef __W32_debug__
|
||||
if ([self displayEvent: uMsg]== YES)
|
||||
{
|
||||
printf("\n\n\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
||||
printf("+++ NEW EVENT CYCLE %u +++\n", uMsg);
|
||||
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
||||
#ifdef __W32_debug_Event_loop
|
||||
printf("Events Posted = %d\n", flags.eventQueCount);
|
||||
printf("EVENT Que Count = %d\n", (int)[GSCurrentServer() eventQueCount]);
|
||||
printf("%s", [[GSCurrentServer() dumpQue: 10] cString]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_SIZING:
|
||||
|
@ -1267,7 +674,7 @@ printf("\n\n##############################################################\n");
|
|||
[self decodeWM_NCACTIVATEParams: wParam : lParam : hwnd];
|
||||
break;
|
||||
case WM_NCPAINT:
|
||||
if (flags.useWMStyles == NO)
|
||||
if ([self handlesWindowDecorations])
|
||||
[self decodeWM_NCPAINTParams: wParam : lParam : hwnd];
|
||||
break;
|
||||
//case WM_SHOWWINDOW:
|
||||
|
@ -1341,7 +748,7 @@ printf("\n\n##############################################################\n");
|
|||
case WM_PAINT:
|
||||
[self decodeWM_PAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd];
|
||||
case WM_SYNCPAINT:
|
||||
if (flags.useWMStyles == NO)
|
||||
if ([self handlesWindowDecorations])
|
||||
[self decodeWM_SYNCPAINTParams: wParam : lParam : hwnd];
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
|
@ -1476,9 +883,6 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
default:
|
||||
// Process all other messages.
|
||||
#ifdef __W32_debug__
|
||||
printf("Uhandled message: %d on window %s\n", uMsg, [[GSWindowWithNumber((int)hwnd) className] cString]);
|
||||
#endif
|
||||
NSDebugLLog(@"NSEvent", @"Got unhandled Message %d for %d", uMsg, hwnd);
|
||||
break;
|
||||
}
|
||||
|
@ -1495,14 +899,6 @@ printf("\n\n##############################################################\n");
|
|||
{
|
||||
[GSCurrentServer() postEvent: ev atStart: NO];
|
||||
flags.eventQueCount++;
|
||||
#ifdef __W32_debug__
|
||||
if ([ev type]== NSAppKitDefined)
|
||||
{
|
||||
printf("uMsg %d ", uMsg);
|
||||
printf("Post event %s ", [[ev eventNameWithSubtype: YES] cString]);
|
||||
printf("on window %s\n", [[[ev window] className] cString]);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
|
@ -1537,12 +933,6 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
@implementation WIN32Server (WindowOps)
|
||||
|
||||
-(BOOL) handlesWindowDecorations
|
||||
{
|
||||
return handlesWindowDecorations;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
styleMask specifies the receiver's style. It can either be
|
||||
NSBorderlessWindowMask, or it can contain any of the following
|
||||
|
@ -1601,7 +991,7 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
if ((style & NSMiniaturizableWindowMask) == NSMiniaturizableWindowMask)
|
||||
{
|
||||
if (flags.useWMTaskBar == YES)
|
||||
if ([self usesNativeTaskbar])
|
||||
estyle = WS_EX_APPWINDOW;
|
||||
else
|
||||
estyle = WS_EX_TOOLWINDOW;
|
||||
|
@ -1613,16 +1003,6 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
r = GSScreenRectToMS(frame, style, self);
|
||||
|
||||
#ifdef __debugServer__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("handlesWindowDecorations %s\n", handlesWindowDecorations ? "YES" : "NO");
|
||||
printf("checking for NSMiniaturizableWindowMask %u\n", (style & NSMiniaturizableWindowMask));
|
||||
printf("GS Window Style %u\n", style);
|
||||
printf("Extended Style %d [hex] %X\n", (int)estyle, (UINT)estyle);
|
||||
printf("Win32 Style picked %ld [hex] %X\n", wstyle, (unsigned int)wstyle);
|
||||
printf("\n##############################################################\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* from here down is reused and unmodified from WIN32EventServer.m
|
||||
* which has been removed form the subproject
|
||||
|
@ -1659,8 +1039,8 @@ printf("\n\n##############################################################\n");
|
|||
{
|
||||
DWORD wstyle = [self windowStyleForGSStyle: style];
|
||||
|
||||
NSAssert(handlesWindowDecorations,
|
||||
@"-stylewindow: : called when handlesWindowDecorations == NO");
|
||||
NSAssert([self handlesWindowDecorations],
|
||||
@"-stylewindow: : called when [self handlesWindowDecorations] == NO");
|
||||
|
||||
NSDebugLLog(@"WTrace", @"stylewindow: %d : %d", style, winNum);
|
||||
SetWindowLong((HWND)winNum, GWL_STYLE, wstyle);
|
||||
|
@ -1747,7 +1127,7 @@ printf("\n\n##############################################################\n");
|
|||
{
|
||||
NSDebugLLog(@"WTrace", @"orderwindow: %d : %d : %d", op, otherWin, winNum);
|
||||
|
||||
if (flags.useWMTaskBar)
|
||||
if ([self usesNativeTaskbar])
|
||||
{
|
||||
/* When using this policy, we make these changes:
|
||||
- don't show the application icon window
|
||||
|
@ -1959,7 +1339,7 @@ printf("\n\n##############################################################\n");
|
|||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style
|
||||
{
|
||||
if (handlesWindowDecorations)
|
||||
if ([self handlesWindowDecorations])
|
||||
{
|
||||
DWORD wstyle = [self windowStyleForGSStyle: style];
|
||||
RECT rect = {100, 100, 200, 200};
|
||||
|
@ -1989,7 +1369,7 @@ printf("\n\n##############################################################\n");
|
|||
|
||||
- (void) setinputstate: (int)state : (int)winNum
|
||||
{
|
||||
if (handlesWindowDecorations == NO)
|
||||
if ([self handlesWindowDecorations] == NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
|
||||
#include "win32/WIN32Server.h"
|
||||
#include "win32/WIN32Geometry.h"
|
||||
#include "w32_config.h"
|
||||
|
||||
@interface WIN32Server (w32_notifications)
|
||||
|
||||
|
@ -126,29 +125,4 @@
|
|||
@end
|
||||
|
||||
|
||||
@interface WIN32Server (w32_debug)
|
||||
|
||||
- (BOOL) displayEvent: (unsigned int)uMsg; // diagnotic filter
|
||||
- (void) test_Geomemetry: (HWND)hwnd;
|
||||
- (void) print_result: (RECT)msrect and: (NSRect)gsrect and: (RECT)control;
|
||||
- (NSMutableString *) w32_createDetails: (LPCREATESTRUCT)details;
|
||||
- (NSMutableString *) createWindowDetail: (NSArray *)anArray;
|
||||
- (NSMutableString *) WindowDetail: (NSWindow *) theWindow;
|
||||
- (NSMutableString *) MSRectDetails: (RECT)aRect;
|
||||
- (NSMutableString *) NSRectDetails: (NSRect)aRect;
|
||||
- (NSMutableString *) gswindowstate: (NSWindow *)theWindow;
|
||||
- (NSMutableString *) MINMAXDetails: (MINMAXINFO *) mm;
|
||||
- (NSMutableString *) subViewDetails: (NSWindow *)theWindow;
|
||||
- (void) handleNotification: (NSNotification*)aNotification;
|
||||
|
||||
@end
|
||||
|
||||
// debug hooks into the GSDisplayServer class
|
||||
@interface GSDisplayServer (GSDisplayServer_details)
|
||||
- (int) eventQueCount;
|
||||
- (NSMutableString *) dumpQue:(int)acount;
|
||||
- (void) clearEventQue;
|
||||
|
||||
@end
|
||||
|
||||
#endif //_W32_EVENTS_h_INCLUDE
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
flags._last_WM_ACTIVATE = LOWORD(wParam);
|
||||
//int minimized = HIWORD(wParam);
|
||||
|
||||
|
||||
|
||||
|
||||
switch (flags._last_WM_ACTIVATE)
|
||||
{
|
||||
case WA_ACTIVE: //deactivate
|
||||
|
@ -62,21 +59,6 @@
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#ifdef __WM_ACTIVE__
|
||||
BOOL target=NO;
|
||||
|
||||
if ((int)lParam == flags.menuRef)
|
||||
target=YES;
|
||||
|
||||
printf("RECEIVER [hwnd]%s\n", [[EVENT_WINDOW(hwnd) className] cString]);
|
||||
printf("ON [lParam]%s\n", [[EVENT_WINDOW(lParam) className] cString]);
|
||||
|
||||
printf("[lParam] %s", [[self gswindowstate:EVENT_WINDOW(lParam)] cString]);
|
||||
printf("ACTIVATE_FLAG STATE %d \n", flags._last_WM_ACTIVATE);
|
||||
|
||||
printf("[hwnd] %s", [[self gswindowstate:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -132,30 +114,12 @@
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef __WM_ACTIVATEAPP__
|
||||
|
||||
printf("NSApp is:[%s]\n", active ? "active" : "inactive");
|
||||
printf("lParam is [%s]\n thread = [%u]\n w32_Class[%s] \n",
|
||||
(int)wParam ? "TRUE": "FALSE",
|
||||
(unsigned int)lParam,
|
||||
[[self getNativeClassName:hwnd] cString]);
|
||||
// debug GS_state details
|
||||
printf("%s", [[self gswindowstate:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("%s", [[self gswindowstate:EVENT_WINDOW(wParam)] cString]);
|
||||
printf("eventHandled=[%s]\n", flags._eventHandled ? "YES" : "NO");
|
||||
|
||||
printf("REQUESTED STATE %d\n", flags._last_WM_ACTIVATE);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) decodeWM_NCACTIVATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_NCACTIVATE\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,101 +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 Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _W32_CONFIG_h_INCLUDE
|
||||
#define _W32_CONFIG_h_INCLUDE
|
||||
|
||||
#define EVENT_WINDOW(lp) (GSWindowWithNumber((int)lp))
|
||||
|
||||
//#define _logging //use to log messages from our debug code
|
||||
|
||||
//#define __W32_debug_Event_loop //special flag for event loops and counts
|
||||
|
||||
//#define __W32_debug__ // activate the debug code in the main event server
|
||||
#define __STATE NO
|
||||
|
||||
#ifdef __W32_debug__ // turn on tests for this
|
||||
#define __SETFOCUS__
|
||||
#define __KILLFOCUS__
|
||||
#define __SHOWWINDOW__
|
||||
#define __WM_ACTIVE__
|
||||
#define __WM_ACTIVATEAPP__
|
||||
#define __WM_NCACTIVATE__
|
||||
#define __WM_NCCREATE__
|
||||
#define __WM_CREATE__
|
||||
#define __WM_MOVE__
|
||||
#define __WM_SIZE__
|
||||
#define __PAINT__
|
||||
#define __BACKING__
|
||||
#define __CLOSE__
|
||||
#define __DESTROY__
|
||||
#define __ERASEBKGND__
|
||||
#define __GETMINMAXINFO__
|
||||
#define __EXITSIZEMOVE__
|
||||
//#define __APPNOTIFICATIONS__
|
||||
#define __SIZING__
|
||||
#define __SYSCOMMAND__
|
||||
#define __COMMAND__
|
||||
#define __MOVING__
|
||||
#define __ENTERSIZEMOVE__
|
||||
|
||||
#define __SETFOCUS_FLAG 1
|
||||
#define __ACTIVE_FLAG 1
|
||||
#define __CREATE_FLAG 1
|
||||
#define __MOVE_FLAG 1
|
||||
#define __SIZE_FLAG 1
|
||||
#define __SHOWWINDOW_FLAG 1
|
||||
#define __KILLFOCUS_FLAG 1
|
||||
#define __PAINT_FLAG 1
|
||||
#define __CLOSE_FLAG 1
|
||||
#define __DESTROY_FLAG 1
|
||||
#define __ERASEBKGND_FLAG 1
|
||||
#define __GETMINMAXINFO_FLAG 1
|
||||
#define __EXITSIZEMOVE_FLAG 1
|
||||
#define __SIZING_FLAG 1
|
||||
#define __SYSCOMMAND_FLAG 1
|
||||
#define __COMMAND_FLAG 1
|
||||
#define __MOVING_FLAG 1
|
||||
#define __ENTERSIZEMOVE_FLAG 1
|
||||
#else
|
||||
#define __ACTIVE_FLAG 0
|
||||
#define __CREATE_FLAG 0
|
||||
#define __MOVE_FLAG 0
|
||||
#define __SIZE_FLAG 0
|
||||
#define __SHOWWINDOW_FLAG 0
|
||||
#define __KILLFOCUS_FLAG 0
|
||||
#define __SETFOCUS_FLAG 0
|
||||
#define __PAINT_FLAG 0
|
||||
#define __CLOSE_FLAG 0
|
||||
#define __DESTROY_FLAG 0
|
||||
#define __ERASEBKGND_FLAG 0
|
||||
#define __GETMINMAXINFO_FLAG 0
|
||||
#define __EXITSIZEMOVE_FLAG 0
|
||||
#define __SIZING_FLAG 0
|
||||
#define __SYSCOMMAND_FLAG 0
|
||||
#define __COMMAND_FLAG 0
|
||||
#define __MOVING_FLAG 0
|
||||
#define __ENTERSIZEMOVE_FLAG 0
|
||||
#endif
|
||||
|
||||
#endif //_W32_CONFIG_h_INCLUDE
|
|
@ -34,16 +34,6 @@
|
|||
|
||||
- (LRESULT) decodeWM_NCCREATEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stubbed for future development
|
||||
#ifdef __WM_NCCREATE__
|
||||
printf("WM_NCCREATE\n");
|
||||
#ifdef __W32_debug__
|
||||
printf("%s", [[self w32_createDetails:(LPCREATESTRUCT)lParam] cString]);
|
||||
#endif
|
||||
printf("\nRequested GS Window Style is %u\n", flags.currentGS_Style);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -84,23 +74,6 @@
|
|||
win->useHDC = NO;
|
||||
}
|
||||
|
||||
#ifdef __WM_CREATE__
|
||||
printf("WM_CREATE: *********************\n");
|
||||
#ifdef __W32_debug__
|
||||
printf("%s", [[self w32_createDetails:(LPCREATESTRUCT)lParam] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
|
||||
printf("Parent isa %s\n", [[self getNativeClassName:GetParent(hwnd)] cString]);
|
||||
printf("[hwnd]Native WindowType %s\n", [[self getNativeClassName:(HWND)hwnd] cString]);
|
||||
printf("[hwnd]GS WindowType %s:\n", [[EVENT_WINDOW(hwnd) className] cString]);
|
||||
printf("HAVE_MAIN_MENU = %s\n", flags.HAVE_MAIN_MENU ? "YES": "NO");
|
||||
printf("Main Menu Window Num: %d Currrent window Num: %d\n",
|
||||
[[[NSApp mainMenu] window] windowNumber], (int)hwnd);
|
||||
printf("Window Task bar flag %s\n", flags.useWMTaskBar ? "YES" : "NO");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -1,356 +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 Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "w32_Events.h"
|
||||
|
||||
static NSString * spacer =@"<BLANK_LINE>\n";
|
||||
|
||||
@implementation WIN32Server (w32_debug)
|
||||
|
||||
- (void) test_Geomemetry:(HWND)hwnd
|
||||
{
|
||||
NSRect gsrect;
|
||||
RECT r;
|
||||
RECT msrect;
|
||||
|
||||
NSWindow *window = GSWindowWithNumber((int)hwnd);
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
|
||||
printf("*******************testing Conversion \n\n\n");
|
||||
printf("MSScreenRectToGS GSScreenRectToMS\n");
|
||||
gsrect = MSScreenRectToGS(r, [window styleMask], self);
|
||||
msrect= GSScreenRectToMS(gsrect, [window styleMask], self);
|
||||
printf("*************************test complete\n\n\n");
|
||||
|
||||
[self print_result: msrect and: gsrect and: r];
|
||||
//TestsDone=YES;
|
||||
}
|
||||
|
||||
- (void) print_result:(RECT) msrect and:(NSRect) gsrect and:(RECT) control
|
||||
{
|
||||
|
||||
printf("MS - Control\n");
|
||||
printf("MSrect = left %ld ", control.left);
|
||||
printf(" top %ld", control.top);
|
||||
printf(" right %ld", control.right);
|
||||
printf(" Bottom %ld\n", control.bottom);
|
||||
|
||||
printf("GS - Calculated\n");
|
||||
printf("NSRect = height %f width %f ", gsrect.size.height, gsrect.size.width);
|
||||
printf(" X %f Y %f\n", gsrect.origin.x, gsrect.origin.y);
|
||||
|
||||
printf("MS - Calculated\n");
|
||||
printf("MSrect = left %ld ", msrect.left);
|
||||
printf(" top %ld", msrect.top);
|
||||
printf(" right %ld", msrect.right);
|
||||
printf(" Bottom %ld\n", msrect.bottom);
|
||||
}
|
||||
|
||||
- (BOOL) displayEvent:(unsigned int)uMsg
|
||||
{
|
||||
|
||||
#ifdef __W32_debug__ //_logging
|
||||
//NSDebugLLog(@"NSEvent", @"Got Message %u for %d", uMsg, hwnd);
|
||||
#endif
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_KEYDOWN: return NO; break; //Keyboard events
|
||||
case WM_KEYUP: return NO; break;
|
||||
case WM_MOUSEMOVE: return NO; break;// mouse moved events
|
||||
case WM_NCHITTEST: return NO; break;
|
||||
case WM_SETCURSOR: return NO; break;
|
||||
case WM_MOUSEWHEEL: return NO; break;
|
||||
case WM_LBUTTONDOWN: return YES; break;
|
||||
case WM_MOUSEACTIVATE: return NO; break;
|
||||
case WM_CAPTURECHANGED: return NO; break; //related to window -- redraw if needed
|
||||
case WM_NCMOUSEMOVE: return NO; break;
|
||||
case WM_RBUTTONDOWN: return YES; break;
|
||||
case WM_RBUTTONUP: return YES; break;
|
||||
case WM_NCLBUTTONDOWN: return NO; break;
|
||||
case WM_NCLBUTTONDBLCLK: return NO; break;
|
||||
// window events Stubed or Functioning
|
||||
case WM_SETTEXT: return __STATE; break;
|
||||
case WM_NCCREATE: return __CREATE_FLAG; break;
|
||||
case WM_NCCALCSIZE: return __STATE; break;
|
||||
case WM_NCACTIVATE: return __ACTIVE_FLAG; break;
|
||||
case WM_NCPAINT: return __STATE; break;
|
||||
case WM_SHOWWINDOW: return __SHOWWINDOW_FLAG; break;
|
||||
case WM_NCDESTROY: return __STATE; break;
|
||||
case WM_GETTEXT: return __STATE; break;
|
||||
case WM_STYLECHANGING: return __STATE; break;
|
||||
case WM_STYLECHANGED: return __STATE; break;
|
||||
case WM_GETMINMAXINFO: return __GETMINMAXINFO_FLAG; break;
|
||||
case WM_CREATE: return __CREATE_FLAG; break;
|
||||
case WM_WINDOWPOSCHANGING: return __STATE; break;
|
||||
case WM_WINDOWPOSCHANGED: return __STATE; break;
|
||||
case WM_MOVE: return __MOVE_FLAG; break;
|
||||
case WM_MOVING: return __MOVING_FLAG; break;
|
||||
case WM_SIZE: return __SIZE_FLAG; break;
|
||||
case WM_SIZING: return __SIZING_FLAG; break;
|
||||
case WM_ENTERSIZEMOVE: return __ENTERSIZEMOVE_FLAG; break;
|
||||
case WM_EXITSIZEMOVE: return __EXITSIZEMOVE_FLAG; break;
|
||||
case WM_ACTIVATE: return __ACTIVE_FLAG; break;
|
||||
case WM_ACTIVATEAPP: return __ACTIVE_FLAG; break;
|
||||
case WM_SETFOCUS: return __SETFOCUS_FLAG; break;
|
||||
case WM_KILLFOCUS: return __KILLFOCUS_FLAG; break;
|
||||
//case WM_SETCURSOR: return __STATE; break;
|
||||
case WM_QUERYOPEN: return __STATE; break;
|
||||
//case WM_CAPTURECHANGED: return __STATE; break;
|
||||
case WM_ERASEBKGND: return __ERASEBKGND_FLAG; break;
|
||||
case WM_PAINT: return __PAINT_FLAG; break;
|
||||
case WM_SYNCPAINT: return __STATE; break;
|
||||
case WM_CLOSE: return __CLOSE_FLAG; break;
|
||||
case WM_DESTROY: return __DESTROY_FLAG; break;
|
||||
case WM_QUIT: return __STATE; break;
|
||||
case WM_USER: return __STATE; break;
|
||||
case WM_APP: return __STATE; break;
|
||||
case WM_ENTERMENULOOP: return __STATE; break;
|
||||
case WM_EXITMENULOOP: return __STATE; break;
|
||||
case WM_INITMENU: return __STATE; break;
|
||||
case WM_MENUSELECT: return __STATE; break;
|
||||
case WM_ENTERIDLE: return __STATE; break;
|
||||
case WM_COMMAND: return __COMMAND_FLAG; break;
|
||||
case WM_SYSKEYDOWN: return __STATE; break;
|
||||
case WM_SYSKEYUP: return __STATE; break;
|
||||
case WM_SYSCOMMAND: return __SYSCOMMAND_FLAG; break;
|
||||
case WM_HELP: return __STATE; break;
|
||||
case WM_GETICON: return __STATE; break;
|
||||
case WM_CANCELMODE: return __STATE; break;
|
||||
case WM_ENABLE: return __STATE; break;
|
||||
case WM_CHILDACTIVATE: return __ACTIVE_FLAG; break;
|
||||
case WM_NULL: return __STATE; break;
|
||||
case WM_LBUTTONUP: return YES; break;
|
||||
case WM_PARENTNOTIFY: return __STATE; break;
|
||||
|
||||
default:
|
||||
return YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct tagCREATESTRUCT {
|
||||
LPVOID lpCreateParams;
|
||||
HINSTANCE hInstance;
|
||||
HMENU hMenu;
|
||||
HWND hwndParent;
|
||||
int cy;
|
||||
int cx;
|
||||
int y;
|
||||
int x;
|
||||
LONG style;
|
||||
LPCTSTR lpszName;
|
||||
LPCTSTR lpszClass;
|
||||
DWORD dwExStyle;
|
||||
} CREATESTRUCT, *LPCREATESTRUCT;
|
||||
*/
|
||||
|
||||
- (NSMutableString *) w32_createDetails:(LPCREATESTRUCT)details
|
||||
{
|
||||
NSMutableString * output= [NSMutableString stringWithString: spacer];
|
||||
|
||||
[output appendString:@"\n\nLPCREATESTRUCT details\n"];
|
||||
|
||||
[output appendFormat:@"HINSTANCE %p ", details->hInstance];
|
||||
|
||||
[output appendFormat:@"HMENU %p\n", details->hMenu];
|
||||
|
||||
|
||||
[output appendFormat:@"Creating window: Parent is %s:\n",
|
||||
[self getNativeClassName: details->hwndParent]];
|
||||
|
||||
[output appendFormat:@"Co-ordanates: height[%d] width[%d] Pos[%d] Pox[%d]\n",
|
||||
details->cy, details->cx, details->y, details->x];
|
||||
|
||||
[output appendFormat:
|
||||
@"Style %lu Name: %s Win32Class: %s Extended Style %ld\n\n\n",
|
||||
details->style, details->lpszName,
|
||||
details->lpszClass, details->dwExStyle];
|
||||
[output appendString: spacer];
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
- (NSMutableString *) createWindowDetail:(NSArray *)anArray
|
||||
{
|
||||
int i =0;
|
||||
int c=[anArray count];
|
||||
|
||||
|
||||
NSMutableString * output= [NSMutableString stringWithString: spacer];
|
||||
|
||||
[output appendFormat:@"Application window count is: %d\n", c];
|
||||
|
||||
for (i=0;i<c;i++)
|
||||
{
|
||||
NSWindow * theWindow=[anArray objectAtIndex: i];
|
||||
|
||||
[output appendString:[self WindowDetail: theWindow]];
|
||||
}
|
||||
[output appendString: spacer];
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
- (NSMutableString *) WindowDetail:(NSWindow *) theWindow
|
||||
{
|
||||
return [self gswindowstate: theWindow];
|
||||
|
||||
}
|
||||
|
||||
- (NSMutableString *) MSRectDetails:(RECT)aRect
|
||||
{
|
||||
NSMutableString * output= [NSMutableString stringWithCString:"MSRect Details\n"];
|
||||
|
||||
[output appendFormat:@"left %ld ", aRect.left];
|
||||
[output appendFormat:@"top %ld ", aRect.top];
|
||||
[output appendFormat:@"right %ld ", aRect.right];
|
||||
[output appendFormat:@"Bottom %ld\n", aRect.bottom];
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
- (NSMutableString *) NSRectDetails:(NSRect)aRect
|
||||
{
|
||||
|
||||
NSMutableString * output= [NSMutableString stringWithString:@" "];
|
||||
|
||||
[output appendFormat:@"height %ld width %ld ", (int)aRect.size.height
|
||||
, (int)aRect.size.width];
|
||||
[output appendFormat:@" XPos %ld YPos %ld\n", (int)aRect.origin.x
|
||||
, (int)aRect.origin.y];
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
- (NSMutableString *) gswindowstate:(NSWindow *)theWindow
|
||||
{
|
||||
// NSRect cvRect=[[theWindow contentView] frame];
|
||||
NSMutableString * output= [NSMutableString stringWithString: spacer];
|
||||
[output appendFormat:@"MenuRef = %d\n", flags.menuRef];
|
||||
[output appendFormat:@"Main Menu %s\n", flags._is_menu ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW title %@\n", [theWindow title]];
|
||||
[output appendFormat:@"WINDOW className %@\n", [theWindow className]];
|
||||
[output appendFormat:@"WINDOW isVisible: %s\n", [theWindow isVisible] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isAutodisplay: %s\n", [theWindow isAutodisplay] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isMiniaturized: %s\n", [theWindow isMiniaturized] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW viewsNeedDisplay: %s\n", [theWindow viewsNeedDisplay] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isOpaque: %s\n", [theWindow isOpaque] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isReleasedWhenClosed: %s\n ", [theWindow isReleasedWhenClosed] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isOneShot: %s\n", [theWindow isOneShot] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isMainWindow: %s\n", [theWindow isMainWindow] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW isKeyWindow: %s\n", [theWindow isKeyWindow] ? "YES" : "NO"];
|
||||
[output appendFormat:@"WINDOW styleMask: %d\n", [theWindow styleMask]];
|
||||
[output appendFormat:@"WINDOW frame:%@", [self NSRectDetails:[theWindow frame]]];
|
||||
//[output appendString:[self subViewDetails: theWindow]];
|
||||
|
||||
[output appendFormat:@"Native Class Name %@\n",
|
||||
[self getNativeClassName:(HWND)[theWindow windowNumber]]];
|
||||
[output appendFormat:@"Win32 GWL_EXStyle %ld\n",
|
||||
GetWindowLong((HWND)[theWindow windowNumber], GWL_EXSTYLE)];
|
||||
|
||||
[output appendFormat:@"Win32 GWL_STYLE %X\n",
|
||||
GetWindowLong((HWND)[theWindow windowNumber], GWL_STYLE)];
|
||||
|
||||
[output appendFormat:@"Win32 GWL_WNDPROC %ld\n",
|
||||
GetWindowLong((HWND)[theWindow windowNumber], GWL_WNDPROC)];
|
||||
|
||||
[output appendFormat:@"Win32 GWL_HINSTANCE %ld\n",
|
||||
GetWindowLong((HWND)[theWindow windowNumber], GWL_HINSTANCE)];
|
||||
|
||||
[output appendFormat:@"Win32 GWL_HWNDPARENT %ld\n",
|
||||
GetWindowLong((HWND)[theWindow windowNumber], GWL_HWNDPARENT)];
|
||||
|
||||
[output appendFormat:@"Win32 GWL_ID %ld\n",
|
||||
GetWindowLong((HWND)[theWindow windowNumber], GWL_ID)];
|
||||
[output appendString: spacer];
|
||||
|
||||
[output appendFormat:@"Win32 windowtext %@\n",
|
||||
[self getWindowtext:(HWND)[theWindow windowNumber]]];
|
||||
return output;
|
||||
}
|
||||
|
||||
- (NSMutableString *) MINMAXDetails:(MINMAXINFO *) mm
|
||||
{
|
||||
NSMutableString * output =[NSMutableString stringWithString: spacer];
|
||||
[output appendString:@"MINMAXINFO"];
|
||||
|
||||
[output appendFormat:@"ptMaxSize width[%ld] X height[%ld]\n",
|
||||
mm->ptMaxSize.x, mm->ptMaxSize.y];
|
||||
|
||||
[output appendFormat:@"ptMaxPosition width[%ld] X height[%ld]\n",
|
||||
mm->ptMaxPosition.x, mm->ptMaxPosition.y];
|
||||
|
||||
[output appendFormat:@"ptMinTrackSize width[%ld] X height[%ld]\n",
|
||||
mm->ptMinTrackSize.x, mm->ptMinTrackSize.y];
|
||||
|
||||
[output appendFormat:@"ptMaxTrackSize width[%ld] X height[%ld]\n",
|
||||
mm->ptMaxTrackSize.x, mm->ptMaxTrackSize.y];
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
- (NSMutableString *) subViewDetails:(NSWindow *)theWindow
|
||||
{
|
||||
NSView * cView=[theWindow contentView];
|
||||
NSView * sView=[cView superview];
|
||||
NSArray * theViews=[cView subviews];
|
||||
unsigned int i=0;
|
||||
unsigned int c=[theViews count];
|
||||
NSView * temp=nil;
|
||||
NSRect cvRect = [cView frame];
|
||||
NSRect svRect = [sView frame];
|
||||
NSRect tRect;
|
||||
NSMutableString * output =[NSMutableString stringWithString: spacer];
|
||||
[output appendFormat:@"subView Details for %@\n", [theWindow title]];
|
||||
[output appendFormat:@"superRect %@", [self NSRectDetails: svRect]];
|
||||
[output appendFormat:@"contentRect %@", [self NSRectDetails: cvRect]];
|
||||
|
||||
for (i=0;i<c;i++)
|
||||
{
|
||||
temp=[theViews objectAtIndex: i];
|
||||
tRect =[temp frame];
|
||||
[output appendFormat:@"subView %u rect %@",
|
||||
i, [self NSRectDetails: tRect]];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
- (void) handleNotification:(NSNotification*)aNotification
|
||||
{
|
||||
#ifdef __APPNOTIFICATIONS__
|
||||
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
||||
printf("+++ NEW EVENT +++\n");
|
||||
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
||||
printf("WM_APPNOTIFICATION -1\n %s\nPosted by current application\n",
|
||||
[[aNotification name] cString]);
|
||||
NSWindow *theWindow=[aNotification object];
|
||||
|
||||
printf("%s", [[self gswindowstate: theWindow] cString]);
|
||||
#endif
|
||||
}
|
||||
@end
|
||||
|
|
@ -49,21 +49,10 @@
|
|||
|
||||
ev=nil;
|
||||
flags._eventHandled=YES;
|
||||
|
||||
#ifdef __CLOSE__
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "CLOSE", hwnd);
|
||||
printf("CLOSING\n");
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("sending event %s \n", [[ev eventNameWithSubtype:YES] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_NCDESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_NCDESTROY\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_DESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
|
@ -83,17 +72,10 @@ printf("WM_NCDESTROY\n");
|
|||
objc_free(win);
|
||||
flags._eventHandled=YES;
|
||||
|
||||
#ifdef __DESTROY__
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_QUERYOPENParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_QUERYOPEN\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_SYSCOMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
|
@ -142,15 +124,10 @@ printf("WM_NCDESTROY\n");
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#ifdef __SYSCOMMAND__
|
||||
printf("SYSTEM MENU REQUESTED 0x%X\n", wParam);
|
||||
//printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
printf("WM_COMMAND\n");
|
||||
}
|
||||
|
||||
- (void) resetForGSWindowStyle:(HWND)hwnd w32Style:(DWORD)aStyle
|
||||
|
|
|
@ -64,17 +64,6 @@
|
|||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
}
|
||||
|
||||
#ifdef __WM_MOVE__
|
||||
printf("sending GS_EVENT %d GS_SUBTYPE %d\n", [ev type], [ev subtype]);
|
||||
printf("HOLD_MENU_FOR_MOVE is %s\n", flags.HOLD_MENU_FOR_MOVE ? "TRUE" : "FALSE");
|
||||
printf("HOLD_MENU_FOR_SIZE is %s\n", flags.HOLD_MENU_FOR_SIZE ? "TRUE" : "FALSE");
|
||||
|
||||
printf("%s\n", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("EVENTLOCATION %s", [[self NSRectDetails:rect] cString]);
|
||||
printf("[hwnd rect] is %s", [[self NSRectDetails:[EVENT_WINDOW(hwnd) frame]] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
ev=nil;
|
||||
flags.HOLD_MENU_FOR_MOVE=FALSE;
|
||||
flags.HOLD_MINI_FOR_MOVE=FALSE;
|
||||
|
@ -100,25 +89,16 @@
|
|||
case SIZE_MAXHIDE:
|
||||
{
|
||||
// stubbed for future development
|
||||
#ifdef __WM_SIZE__
|
||||
printf("got SIZE_MAXHIDE message\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SIZE_MAXIMIZED:
|
||||
{
|
||||
// stubbed for future development
|
||||
#ifdef __WM_SIZE__
|
||||
printf("got SIZE_MAXIMIZED message\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SIZE_MAXSHOW:
|
||||
{
|
||||
// stubbed for future development
|
||||
#ifdef __WM_SIZE__
|
||||
printf("got SIZE_MAXSHOW message\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SIZE_MINIMIZED:
|
||||
|
@ -155,8 +135,8 @@
|
|||
{
|
||||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
[self resizeBackingStoreFor:hwnd];
|
||||
if (flags.useWMTaskBar==YES)
|
||||
[EVENT_WINDOW(hwnd) miniaturize:self];
|
||||
if ([self usesNativeTaskbar])
|
||||
[EVENT_WINDOW(hwnd) miniaturize:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,8 +173,8 @@
|
|||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
[self resizeBackingStoreFor:hwnd];
|
||||
// fixes part one of bug [5, 25] see notes
|
||||
if (flags.useWMTaskBar==YES)
|
||||
[EVENT_WINDOW(hwnd) deminiaturize:self];
|
||||
if ([self usesNativeTaskbar])
|
||||
[EVENT_WINDOW(hwnd) deminiaturize:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,17 +184,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef __WM_SIZE__
|
||||
printf("sending GS_EVENT %d GS_SUBTYPE %d\n", [ev type], [ev subtype]);
|
||||
printf("[wParam] SIZE_FLAG is %d\n", (int)wParam);
|
||||
printf("HOLD_MENU_FOR_MOVE is %s\n", flags.HOLD_MENU_FOR_MOVE ? "TRUE" : "FALSE");
|
||||
printf("HOLD_MENU_FOR_SIZE is %s\n", flags.HOLD_MENU_FOR_SIZE ? "TRUE" : "FALSE");
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("size to:%s", [[self NSRectDetails:rect] cString]);
|
||||
printf("[hwnd rect] is %s", [[self NSRectDetails:[EVENT_WINDOW(hwnd) frame]] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
ev=nil;
|
||||
flags.HOLD_MENU_FOR_SIZE=FALSE;
|
||||
flags.HOLD_MINI_FOR_SIZE=FALSE;
|
||||
|
@ -283,17 +252,11 @@
|
|||
- (void) decodeWM_WINDOWPOSCHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_WINDOWPOSCHANGED\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_WINDOWPOSCHANGINGParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_WINDOWPOSCHANGING\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
|
@ -310,11 +273,6 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __GETMINMAXINFO__
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("%s", [[self MINMAXDetails:mm] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -330,13 +288,6 @@
|
|||
[self decodeWM_SIZEParams:hwnd :wParam :lParam];
|
||||
|
||||
//Make sure DefWindowProc gets called
|
||||
|
||||
#ifdef __EXITSIZEMOVE__
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "EXITSIZEMOVE", hwnd);
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,321 +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 Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "w32_Events.h"
|
||||
|
||||
static NSString *NSMenuWillTearOff = @"MenuWillTearOff";
|
||||
static NSString *NSMenuwillPopUP =@"MenuwillPopUP";
|
||||
static NSString *NSWindowDidCreateWindow=@"WindowDidCreateWindow";
|
||||
|
||||
@interface NSMenu (w32Menu)
|
||||
|
||||
- (void) _rightMouseDisplay: (NSEvent*)theEvent;
|
||||
- (void) setTornOff: (BOOL)flag;
|
||||
@end
|
||||
|
||||
@implementation NSMenu (w32Menu)
|
||||
|
||||
// fixme to handle context menues better on win32
|
||||
// although it works better then it used to, it still
|
||||
// needs more work.
|
||||
|
||||
- (void) _rightMouseDisplay: (NSEvent*)theEvent
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSNotification * popped;
|
||||
//printf("my menu tarnsient method\n");
|
||||
|
||||
// need to get hwnd for the window
|
||||
[self displayTransient];
|
||||
// post notification here
|
||||
popped = [NSNotification
|
||||
notificationWithName: NSMenuwillPopUP
|
||||
object: _bWindow
|
||||
userInfo: nil];
|
||||
|
||||
[nc postNotification: popped];
|
||||
|
||||
[_view mouseDown: theEvent];
|
||||
[self closeTransient];
|
||||
[_bWindow orderOut:self];
|
||||
}
|
||||
|
||||
- (void) setTornOff: (BOOL)flag
|
||||
{
|
||||
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSNotification * torn;
|
||||
NSMenu *supermenu;
|
||||
|
||||
_is_tornoff = flag;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
supermenu = [self supermenu];
|
||||
if (supermenu != nil)
|
||||
{
|
||||
[[supermenu menuRepresentation] setHighlightedItemIndex: -1];
|
||||
supermenu->_attachedMenu = nil;
|
||||
}
|
||||
|
||||
torn = [NSNotification
|
||||
notificationWithName: NSMenuWillTearOff
|
||||
object: self
|
||||
userInfo: nil];
|
||||
|
||||
[nc postNotification: torn];
|
||||
}
|
||||
[_view update];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface NSWindow (w32Window)
|
||||
|
||||
- (id) initWithContentRect: (NSRect)contentRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
backing: (NSBackingStoreType)bufferingType
|
||||
defer: (BOOL)flag;
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSWindow (w32Window)
|
||||
|
||||
- (id) initWithContentRect: (NSRect)contentRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
backing: (NSBackingStoreType)bufferingType
|
||||
defer: (BOOL)flag
|
||||
{
|
||||
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSNotification * createdWindow;
|
||||
id anObject=[self initWithContentRect: contentRect
|
||||
styleMask: aStyle
|
||||
backing: bufferingType
|
||||
defer: flag
|
||||
screen: nil];
|
||||
|
||||
createdWindow = [NSNotification
|
||||
notificationWithName: NSWindowDidCreateWindow
|
||||
object: self
|
||||
userInfo: nil];
|
||||
|
||||
[nc postNotification: createdWindow];
|
||||
|
||||
return anObject;
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation WIN32Server (w32_notifications)
|
||||
|
||||
/*
|
||||
Notification hook from application
|
||||
The default notification are:
|
||||
|
||||
NSApplicationDidFinishLaunchingNotification
|
||||
NSApplicationWillFinishLaunchingNotification
|
||||
NSApplicationWillHideNotification
|
||||
NSWindowWillMiniaturizeNotification
|
||||
|
||||
Custom Notifications:
|
||||
NSMenuWillTearOff
|
||||
NSMenuwillPopUP
|
||||
|
||||
when these are received the Win32 server can now finalize its setup.
|
||||
other hook can also be set at this point
|
||||
|
||||
syncronize the GS Env with The native Backend so we can use native calls to manage
|
||||
certain things directly.
|
||||
*/
|
||||
- (void) ApplicationWillFinishLaunching: (NSNotification*)aNotification;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (void) ApplicationDidFinishLaunching: (NSNotification*)aNotification
|
||||
{
|
||||
NSMenu * theMenu = [NSApp mainMenu];
|
||||
NSMenu * subMenu;
|
||||
NSMenuItem * anItem;
|
||||
LONG result;
|
||||
// Get our MainMenu window refference:
|
||||
|
||||
flags.menuRef = [[theMenu window] windowNumber];
|
||||
flags.HAVE_MAIN_MENU = YES;
|
||||
|
||||
// add an entry in the main menu to bring up the config window
|
||||
|
||||
[self initConfigWindow];
|
||||
// if info does not exist add it and create a submenu for it
|
||||
if ([theMenu itemWithTitle:@"Info"] == nil)
|
||||
{
|
||||
anItem = [NSMenuItem new];
|
||||
[anItem setTitle: @"Info"];
|
||||
[theMenu insertItem: anItem atIndex: 0];
|
||||
subMenu = [NSMenu new];
|
||||
[theMenu setSubmenu: subMenu forItem: anItem];
|
||||
[anItem setEnabled: YES];
|
||||
}
|
||||
|
||||
// add 'Server Preference' to the 'Info' item submenu
|
||||
subMenu = [[theMenu itemWithTitle: @"Info"] submenu];
|
||||
[subMenu addItemWithTitle: @"Server Preferences"
|
||||
action: @selector(showServerPrefs:)
|
||||
keyEquivalent: nil];
|
||||
|
||||
anItem = (NSMenuItem *)[subMenu itemWithTitle: @"Server Preferences"];
|
||||
[anItem setTarget: self];
|
||||
[anItem setEnabled: YES];
|
||||
|
||||
if (flags.HAVE_SERVER_PREFS == NO)
|
||||
{
|
||||
NSRunInformationalAlertPanel(@"Server Preferences Not Set",
|
||||
@"Please set server Preferences\nlook in "
|
||||
@"[info]->[Server Preferences]\nto change settings",
|
||||
@"OK", nil, nil);
|
||||
|
||||
[configWindow makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
/*
|
||||
* reset the style on the main menu panel so when it hides it will
|
||||
* go the the task bar. I will use WS_EX_Left for this.
|
||||
* Note that this is native code mixed with GNUStep
|
||||
*/
|
||||
if (flags.useWMStyles == YES)
|
||||
{
|
||||
ShowWindow((HWND)flags.menuRef, SW_HIDE);
|
||||
SetLastError(0);
|
||||
result = SetWindowLong((HWND)flags.menuRef, GWL_EXSTYLE, (LONG)WS_EX_LEFT);
|
||||
// should check error here...
|
||||
result = SetWindowTextW((HWND)flags.menuRef,
|
||||
(const unichar*)[[theMenu title]
|
||||
cStringUsingEncoding: NSUnicodeStringEncoding]);
|
||||
|
||||
ShowWindow((HWND)flags.menuRef, SW_SHOWNORMAL);
|
||||
|
||||
// set app icon image for win32
|
||||
}
|
||||
|
||||
|
||||
// future implimentation
|
||||
|
||||
#ifdef __WM_ACTIVE__
|
||||
printf("reseting menu style\n");
|
||||
if (result==0)
|
||||
{
|
||||
printf("setting mainMenu Style: Error %ld\n", GetLastError());
|
||||
}
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) ApplicationWillHideNotification: (NSNotification*)aNotification
|
||||
{
|
||||
flags.HOLD_MENU_FOR_MOVE=TRUE;
|
||||
flags.HOLD_MENU_FOR_SIZE=TRUE;
|
||||
|
||||
ReleaseCapture(); // if the mouse is 'stuck' release it
|
||||
|
||||
#ifdef __WM_ACTIVE__
|
||||
printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\n");
|
||||
printf("got Notification: %s\n",
|
||||
[[aNotification name] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void) WindowWillMiniaturizeNotification:(NSNotification*)aNotification
|
||||
{
|
||||
flags.HOLD_MINI_FOR_SIZE=TRUE;
|
||||
flags.HOLD_MINI_FOR_MOVE=TRUE;
|
||||
}
|
||||
|
||||
- (void) MenuWillTearOff:(NSNotification*)aNotification
|
||||
{
|
||||
LONG result;
|
||||
NSMutableString * iconTitle =[NSMutableString stringWithString:@"MENU "];
|
||||
NSMenu * theMenu=[aNotification object];
|
||||
int windowNum =[[theMenu window] windowNumber];
|
||||
|
||||
ShowWindow((HWND)windowNum, SW_HIDE);
|
||||
SetLastError(0);
|
||||
result = SetWindowLong((HWND)windowNum, GWL_EXSTYLE, (LONG)WS_EX_LEFT);
|
||||
// should check error here...
|
||||
|
||||
// set the icon title
|
||||
[iconTitle appendString: [theMenu title]];
|
||||
result = SetWindowTextW((HWND)windowNum, (const unichar*)[iconTitle
|
||||
cStringUsingEncoding: NSUnicodeStringEncoding]);
|
||||
ShowWindow((HWND)windowNum, SW_SHOWNORMAL);
|
||||
|
||||
#ifdef __APPNOTIFICATIONS__
|
||||
printf("got menu tear off Notification\n");
|
||||
printf("menu title is: %s\n", [[theMenu title] cString]);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) MenuwillPopUP:(NSNotification*)aNotification
|
||||
{
|
||||
LONG result;
|
||||
int windowNum=[[aNotification object] windowNumber];
|
||||
|
||||
ShowWindow((HWND)windowNum, SW_HIDE);
|
||||
SetLastError(0);
|
||||
result=SetWindowLong((HWND)windowNum, GWL_EXSTYLE, (LONG)WS_EX_RIGHT);
|
||||
// should check error here...
|
||||
|
||||
// set the icon title
|
||||
result = SetWindowText((HWND)windowNum, "Context menu");
|
||||
ShowWindow((HWND)windowNum, SW_SHOWNORMAL);
|
||||
|
||||
flags.HOLD_TRANSIENT_FOR_SIZE=TRUE;
|
||||
flags.HOLD_TRANSIENT_FOR_MOVE=TRUE;
|
||||
|
||||
#ifdef __APPNOTIFICATIONS__
|
||||
printf("got menu Popup Notification\n");
|
||||
printf("window title is: %s\n", [[[aNotification object] title] cString]);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) WindowDidCreateWindow:(NSNotification*)aNotification
|
||||
{
|
||||
unsigned int GSStyle;
|
||||
|
||||
NSString * GSClass=[[aNotification object] className];
|
||||
// FIXME: Implement this in NSWindow first...
|
||||
//[[aNotification object] setShowsResizeIndicator:NO];
|
||||
// set window style
|
||||
if ([GSClass isEqual:@"NSMenuPanel"]==YES)
|
||||
{
|
||||
GSStyle= [[aNotification object] styleMask];
|
||||
//windowNum=[[aNotification object] windowNumber];
|
||||
//[self resetForGSWindowStyle:(HWND)windowNum w32Style:w32style];
|
||||
//printf("GSClassName %s GS Style %u w32 Style %X\n", [GSClass cString], GSStyle, (UINT)w32style);
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
|
@ -79,13 +79,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __SETFOCUS__
|
||||
NSDebugLLog(@"Focus", @"Got focus:%d (current = %d, key = %d)",
|
||||
win_num, currentFocus, key_num);
|
||||
NSDebugLLog(@"Focus", @" result of focus request");
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -107,21 +100,11 @@
|
|||
|
||||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
flags._eventHandled=YES;
|
||||
|
||||
#ifdef __KILLFOCUS__
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "KILLFOCUS", hwnd);
|
||||
NSDebugLLog(@"Focus", @"Got KILLFOCUS (focus out) for %d", hwnd);
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_GETTEXTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_GETTEXT\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -87,7 +87,7 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
|
||||
DWORD wstyle = 0;
|
||||
|
||||
if (flags.useWMStyles==NO)
|
||||
if ([self handlesWindowDecorations] == NO)
|
||||
return WS_POPUP;
|
||||
|
||||
switch (style)
|
||||
|
@ -140,12 +140,6 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
}
|
||||
|
||||
//NSLog(@"Window wstyle %d for style %d", wstyle, style);
|
||||
#ifdef __W32_debug__
|
||||
printf("\n\n##############################################################\n");
|
||||
printf("GS Window Style %u\n", style);
|
||||
printf("Win32 Style picked %ld [hex] %X\n", wstyle, (unsigned int)wstyle);
|
||||
printf("\n\n##############################################################\n");
|
||||
#endif
|
||||
return wstyle;
|
||||
}
|
||||
|
||||
|
@ -194,30 +188,15 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef __SHOWWINDOW__
|
||||
printf("[wParam] show window %s\n", wParam ? "TRUE" : "FALSE");
|
||||
printf("[lParam] requested SW_FLAG %d\n", wParam);
|
||||
//printf("is Main Menu %d\n", _is_menu);
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_NCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_NCPAINT\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
- (LRESULT) decodeWM_ERASEBKGNDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// GS handles this for now...
|
||||
#ifdef __ERASEBKGND__
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return (LRESULT)1;
|
||||
}
|
||||
|
||||
|
@ -251,42 +230,27 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
//flags.HOLD_PAINT_FOR_SIZING=FALSE;
|
||||
|
||||
//printf("WM_PAINT\n");
|
||||
#ifdef __PAINT__
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("%s", [[self MSRectDetails:rect] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) decodeWM_SYNCPAINTParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
//#ifdef __TESTEVENT__
|
||||
//printf("WM_SYNCPAINT\n");
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
- (void) decodeWM_CAPTURECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
#ifdef __TESTEVENT__
|
||||
printf("WM_CAPTURECHANGED\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
- (HICON) decodeWM_GETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
|
||||
printf("WM_GETICON\n");
|
||||
|
||||
return currentAppIcon;
|
||||
}
|
||||
|
||||
- (HICON) decodeWM_SETICONParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
printf("WM_SETICON\n");
|
||||
return currentAppIcon;
|
||||
}
|
||||
|
||||
|
@ -318,14 +282,6 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
|
||||
ReleaseDC((HWND)hwnd, hdc);
|
||||
}
|
||||
|
||||
#ifdef __BACKING__
|
||||
NSDebugLLog(@"NSEvent", @"Change backing store to %d %d", r.right - r.left, r.bottom - r.top);
|
||||
printf("RESIZING BACKING Store\n");
|
||||
printf("%s", [[self WindowDetail:EVENT_WINDOW(hwnd)] cString]);
|
||||
printf("New Rect: %s", [[self MSRectDetails:r] cString]);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue