mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
Further cleanup of windows server code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@26924 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
55ddd077cb
commit
f0ff2b2bb7
6 changed files with 63 additions and 209 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-10-17 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/win32/WIN32Server.h,
|
||||||
|
* Source/win32/WIN32Server.m,
|
||||||
|
* Source/win32/w32_activate.m,
|
||||||
|
* Source/win32/w32_movesize.m,
|
||||||
|
* Source/win32/w32_general.m: Removed unused and unneeded code
|
||||||
|
left over from the last cleanup. This code was mostly setting
|
||||||
|
server flags that never got read or using falgs that never were set.
|
||||||
|
|
||||||
2008-10-14 Fred Kiefer <FredKiefer@gmx.de>
|
2008-10-14 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/winlib/WIN32GState.m: Removed unneeded code. General cleanup.
|
* Source/winlib/WIN32GState.m: Removed unneeded code. General cleanup.
|
||||||
|
|
|
@ -72,24 +72,8 @@
|
||||||
DWORD windowStyleForGSStyle(unsigned int style);
|
DWORD windowStyleForGSStyle(unsigned int style);
|
||||||
|
|
||||||
typedef struct w32serverFlags {
|
typedef struct w32serverFlags {
|
||||||
|
|
||||||
int _last_WM_ACTIVATE;
|
|
||||||
int menuRef; // reference to menu window
|
|
||||||
unsigned int currentGS_Style; // what style is current event window
|
|
||||||
BOOL HOLD_MENU_FOR_MOVE; // override GS move event on hide
|
|
||||||
BOOL HOLD_MENU_FOR_SIZE; // override GS size event on hide
|
|
||||||
BOOL HOLD_MINI_FOR_SIZE; // override GS size event on miniturize
|
BOOL HOLD_MINI_FOR_SIZE; // override GS size event on miniturize
|
||||||
BOOL HOLD_MINI_FOR_MOVE; // override GS move event on miniturize
|
|
||||||
BOOL HOLD_TRANSIENT_FOR_SIZE; // override GS size event on popup context
|
|
||||||
BOOL HOLD_TRANSIENT_FOR_MOVE; // override GS move event on popup context
|
|
||||||
BOOL HAVE_MAIN_MENU; // do we have a main menu?
|
|
||||||
BOOL HOLD_PAINT_FOR_SIZING;
|
|
||||||
BOOL _is_menu; // is event window the main menu?
|
|
||||||
BOOL _eventHandled; // did we handle the event?
|
BOOL _eventHandled; // did we handle the event?
|
||||||
BOOL _is_cache; // is the event window a cache rep
|
|
||||||
BOOL _hasGSClassName; // does the event window have a GSclassName
|
|
||||||
int lastEventType;
|
|
||||||
int hold;
|
|
||||||
} serverFlags;
|
} serverFlags;
|
||||||
|
|
||||||
@interface WIN32Server : GSDisplayServer
|
@interface WIN32Server : GSDisplayServer
|
||||||
|
@ -104,11 +88,6 @@ typedef struct w32serverFlags {
|
||||||
HWND desiredFocus;
|
HWND desiredFocus;
|
||||||
HWND currentActive;
|
HWND currentActive;
|
||||||
HICON currentAppIcon;
|
HICON currentAppIcon;
|
||||||
// config window
|
|
||||||
NSWindow *configWindow;
|
|
||||||
NSPopUpButton * styleButton;
|
|
||||||
NSButton * taskbarButton;
|
|
||||||
NSButton * saveButton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) handlesWindowDecorations;
|
- (BOOL) handlesWindowDecorations;
|
||||||
|
|
|
@ -531,18 +531,7 @@ NSLog(@"Callback");
|
||||||
{
|
{
|
||||||
flags._eventHandled = NO;
|
flags._eventHandled = NO;
|
||||||
|
|
||||||
flags._is_menu = NO;
|
|
||||||
if ((HWND)flags.menuRef == hwnd && flags.HAVE_MAIN_MENU == YES)
|
|
||||||
flags._is_menu = YES;
|
|
||||||
// note some cache windows are needed..... just get the zeros
|
|
||||||
flags._is_cache = [[EVENT_WINDOW(hwnd) className] isEqual: @"GSCacheW"];
|
|
||||||
|
|
||||||
flags._hasGSClassName = NO;
|
|
||||||
if ([EVENT_WINDOW(hwnd) className] != nil)
|
|
||||||
flags._hasGSClassName = YES;
|
|
||||||
|
|
||||||
// future house keeping can go here
|
// future house keeping can go here
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LRESULT) windowEventProc: (HWND)hwnd : (UINT)uMsg
|
- (LRESULT) windowEventProc: (HWND)hwnd : (UINT)uMsg
|
||||||
|
@ -869,17 +858,11 @@ NSLog(@"Callback");
|
||||||
DWORD wstyle;
|
DWORD wstyle;
|
||||||
DWORD estyle;
|
DWORD estyle;
|
||||||
|
|
||||||
flags.currentGS_Style = style;
|
|
||||||
|
|
||||||
wstyle = [self windowStyleForGSStyle: style];
|
wstyle = [self windowStyleForGSStyle: style];
|
||||||
estyle = [self exwindowStyleForGSStyle: style];
|
estyle = [self exwindowStyleForGSStyle: style];
|
||||||
|
|
||||||
r = GSScreenRectToMS(frame, style, self);
|
r = GSScreenRectToMS(frame, style, self);
|
||||||
|
|
||||||
/*
|
|
||||||
* from here down is reused and unmodified from WIN32EventServer.m
|
|
||||||
* which has been removed form the subproject
|
|
||||||
*/
|
|
||||||
NSDebugLLog(@"WTrace", @"window: %@ : %d : %d : %d", NSStringFromRect(frame),
|
NSDebugLLog(@"WTrace", @"window: %@ : %d : %d : %d", NSStringFromRect(frame),
|
||||||
type, style, screen);
|
type, style, screen);
|
||||||
NSDebugLLog(@"WTrace", @" device frame: %d, %d, %d, %d",
|
NSDebugLLog(@"WTrace", @" device frame: %d, %d, %d, %d",
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
- (LRESULT) decodeWM_ACTIVEParams:(WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
- (LRESULT) decodeWM_ACTIVEParams:(WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||||
{
|
{
|
||||||
// decode our params
|
// decode our params
|
||||||
flags._last_WM_ACTIVATE = LOWORD(wParam);
|
int last_WM_ACTIVATE = LOWORD(wParam);
|
||||||
//int minimized = HIWORD(wParam);
|
//int minimized = HIWORD(wParam);
|
||||||
|
|
||||||
switch (flags._last_WM_ACTIVATE)
|
switch (last_WM_ACTIVATE)
|
||||||
{
|
{
|
||||||
case WA_ACTIVE: //deactivate
|
case WA_ACTIVE: //deactivate
|
||||||
{
|
{
|
||||||
|
@ -66,48 +66,16 @@
|
||||||
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam
|
- (LRESULT) decodeWM_ACTIVEAPPParams: (HWND)hwnd : (WPARAM)wParam
|
||||||
: (LPARAM)lParam
|
: (LPARAM)lParam
|
||||||
{
|
{
|
||||||
BOOL active = [NSApp isActive];
|
|
||||||
|
|
||||||
switch ((int)wParam)
|
switch ((int)wParam)
|
||||||
{
|
{
|
||||||
case TRUE:
|
case TRUE:
|
||||||
{
|
{
|
||||||
if (active==YES)
|
[NSApp activateIgnoringOtherApps: YES];
|
||||||
{
|
flags._eventHandled = YES;
|
||||||
if (flags._is_menu==YES) // have menu and app active
|
|
||||||
{
|
|
||||||
// future implimentation if needed
|
|
||||||
}
|
|
||||||
else // Not a menu and app is active
|
|
||||||
{
|
|
||||||
// window is Visable
|
|
||||||
if ([EVENT_WINDOW(hwnd) isVisible]==YES)
|
|
||||||
{
|
|
||||||
// future implimentation if needed
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// future implimentation if needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // app is not active
|
|
||||||
{
|
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
|
||||||
flags._eventHandled=YES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FALSE:
|
case FALSE:
|
||||||
{
|
{
|
||||||
if (flags._is_menu==YES)
|
|
||||||
{
|
|
||||||
// future implimentation if needed
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// future implimentation if needed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,6 @@
|
||||||
break;
|
break;
|
||||||
case SC_MINIMIZE:
|
case SC_MINIMIZE:
|
||||||
flags.HOLD_MINI_FOR_SIZE=TRUE;
|
flags.HOLD_MINI_FOR_SIZE=TRUE;
|
||||||
flags.HOLD_MINI_FOR_MOVE=TRUE;
|
|
||||||
break;
|
break;
|
||||||
case SC_MONITORPOWER:
|
case SC_MONITORPOWER:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -53,164 +53,79 @@
|
||||||
data2: rect.origin.y];
|
data2: rect.origin.y];
|
||||||
|
|
||||||
|
|
||||||
if (hwnd == (HWND)flags.menuRef)
|
//need native code here?
|
||||||
{
|
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||||
//need native code here?
|
|
||||||
if (flags.HOLD_MENU_FOR_MOVE == FALSE)
|
|
||||||
{
|
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (flags.HOLD_TRANSIENT_FOR_MOVE == FALSE)
|
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
|
||||||
}
|
|
||||||
|
|
||||||
flags.HOLD_MENU_FOR_MOVE=FALSE;
|
|
||||||
flags.HOLD_MINI_FOR_MOVE=FALSE;
|
|
||||||
flags.HOLD_TRANSIENT_FOR_MOVE=FALSE;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LRESULT) decodeWM_SIZEParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
- (LRESULT) decodeWM_SIZEParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
||||||
{
|
{
|
||||||
NSPoint eventLocation;
|
|
||||||
NSRect rect;
|
|
||||||
RECT r;
|
|
||||||
NSEvent *ev =nil;
|
|
||||||
|
|
||||||
GetWindowRect(hwnd, &r);
|
|
||||||
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
|
||||||
eventLocation = rect.origin;
|
|
||||||
|
|
||||||
switch ((int)wParam)
|
switch ((int)wParam)
|
||||||
{
|
{
|
||||||
case SIZE_MAXHIDE:
|
case SIZE_MAXHIDE:
|
||||||
{
|
{
|
||||||
// stubbed for future development
|
// stubbed for future development
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIZE_MAXIMIZED:
|
case SIZE_MAXIMIZED:
|
||||||
{
|
{
|
||||||
// stubbed for future development
|
// stubbed for future development
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIZE_MAXSHOW:
|
case SIZE_MAXSHOW:
|
||||||
{
|
{
|
||||||
// stubbed for future development
|
// stubbed for future development
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIZE_MINIMIZED:
|
case SIZE_MINIMIZED:
|
||||||
{
|
{
|
||||||
if (flags.HOLD_MINI_FOR_SIZE == TRUE) //// this is fix for [5, 25 bug]
|
if (flags.HOLD_MINI_FOR_SIZE == TRUE) // this is fix for [5, 25 bug]
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* FIXME ... RFM 06-Mr-2008....
|
[EVENT_WINDOW(hwnd) miniaturize: self];
|
||||||
* I don't understand the following code sending
|
break;
|
||||||
* a resize event to the gui when a window is minimised.
|
}
|
||||||
* Minimising a GNUstep window does NOT change its size,
|
break;
|
||||||
* rather it causes it to be hidden and replace by its
|
|
||||||
* miniwindow counterpart.
|
|
||||||
* Probably the correct action therefore is to ensure that the
|
|
||||||
* gui knows the window is miniaturised and do nothing else.
|
|
||||||
* If we send a resize event telling the gui that its window is
|
|
||||||
* now tiny, it will most likely mess up most drawing in the
|
|
||||||
* window.
|
|
||||||
*/
|
|
||||||
if (1)
|
|
||||||
{
|
|
||||||
[EVENT_WINDOW(hwnd) miniaturize: self];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Original unused code follows: */
|
|
||||||
|
|
||||||
// make event
|
|
||||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
|
||||||
location: eventLocation
|
|
||||||
modifierFlags: 0
|
|
||||||
timestamp: 0
|
|
||||||
windowNumber: (int)hwnd
|
|
||||||
context: GSCurrentContext()
|
|
||||||
subtype: GSAppKitWindowResized
|
|
||||||
data1: rect.size.width
|
|
||||||
data2: rect.size.height];
|
|
||||||
|
|
||||||
if (hwnd == (HWND)flags.menuRef)
|
|
||||||
{
|
|
||||||
if (flags.HOLD_MENU_FOR_SIZE == FALSE)
|
|
||||||
{
|
|
||||||
[[NSApp mainMenu] setMenuChangedMessagesEnabled: YES];
|
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
|
||||||
[self resizeBackingStoreFor: hwnd];
|
|
||||||
[EVENT_WINDOW(hwnd) miniaturize: self];
|
|
||||||
[[NSApp mainMenu] setMenuChangedMessagesEnabled: NO];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (flags.HOLD_TRANSIENT_FOR_SIZE == FALSE)
|
|
||||||
{
|
|
||||||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
|
||||||
[self resizeBackingStoreFor: hwnd];
|
|
||||||
if ([self usesNativeTaskbar])
|
|
||||||
{
|
|
||||||
[EVENT_WINDOW(hwnd) miniaturize: self];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIZE_RESTORED:
|
case SIZE_RESTORED:
|
||||||
{
|
{
|
||||||
// make event
|
NSPoint eventLocation;
|
||||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
NSRect rect;
|
||||||
location: eventLocation
|
RECT r;
|
||||||
modifierFlags: 0
|
NSEvent *ev =nil;
|
||||||
timestamp: 0
|
|
||||||
windowNumber: (int)hwnd
|
GetWindowRect(hwnd, &r);
|
||||||
context: GSCurrentContext()
|
rect = MSScreenRectToGS(r, [EVENT_WINDOW(hwnd) styleMask], self);
|
||||||
subtype: GSAppKitWindowResized
|
eventLocation = rect.origin;
|
||||||
data1: rect.size.width
|
|
||||||
data2: rect.size.height];
|
// make event
|
||||||
|
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||||
|
location: eventLocation
|
||||||
|
modifierFlags: 0
|
||||||
|
timestamp: 0
|
||||||
|
windowNumber: (int)hwnd
|
||||||
|
context: GSCurrentContext()
|
||||||
|
subtype: GSAppKitWindowResized
|
||||||
|
data1: rect.size.width
|
||||||
|
data2: rect.size.height];
|
||||||
|
|
||||||
if (hwnd == (HWND)flags.menuRef)
|
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||||
{
|
[self resizeBackingStoreFor: hwnd];
|
||||||
if (flags.HOLD_MENU_FOR_SIZE == FALSE)
|
// fixes part one of bug [5, 25] see notes
|
||||||
{
|
if ([self usesNativeTaskbar])
|
||||||
[EVENT_WINDOW(hwnd) _setVisible: YES];
|
[EVENT_WINDOW(hwnd) deminiaturize:self];
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
}
|
||||||
[self resizeBackingStoreFor: hwnd];
|
break;
|
||||||
//[EVENT_WINDOW(hwnd) deminiaturize:self];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (flags.HOLD_TRANSIENT_FOR_SIZE == FALSE)
|
|
||||||
{
|
|
||||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
|
||||||
[self resizeBackingStoreFor: hwnd];
|
|
||||||
// fixes part one of bug [5, 25] see notes
|
|
||||||
if ([self usesNativeTaskbar])
|
|
||||||
[EVENT_WINDOW(hwnd) deminiaturize:self];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ev = nil;
|
|
||||||
flags.HOLD_MENU_FOR_SIZE = FALSE;
|
|
||||||
flags.HOLD_MINI_FOR_SIZE = FALSE;
|
flags.HOLD_MINI_FOR_SIZE = FALSE;
|
||||||
flags.HOLD_TRANSIENT_FOR_SIZE = FALSE;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue