mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 03:41:04 +00:00
Focus fixes for w32
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@18277 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
61ece14662
commit
b358280c23
5 changed files with 81 additions and 4 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2003-12-26 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Focus fixes.
|
||||
* Headers/win32/WIN32Server.h: Add flags ivar
|
||||
* Source/win32/WIN32Server.m (orderwindow:::): If useWMTaskBar
|
||||
flag set, don't show app icon and don't order out menu window.
|
||||
* Source/win32/WIN32ServerEvent.m (windowEventProc:::):
|
||||
On activation message, activate app, on deactivation message,
|
||||
deactivate app (if message comes from menu window).
|
||||
|
||||
2003-12-25 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/win32/WIN32Server.m (-_initWin32Context) set a default
|
||||
|
|
|
@ -83,6 +83,17 @@
|
|||
problem with the X-Server.
|
||||
</p>
|
||||
</desc>
|
||||
</desc>
|
||||
<term>GSUseWMTaskBar</term>
|
||||
<desc>
|
||||
<p> [W32 backend only]
|
||||
A string value which defaults to <code>YES</code>. If enabled, the
|
||||
backend assumes that miniwindows are displayed in a task bar. In
|
||||
this case, the app icon is not shown and the main menu behavior
|
||||
is changed so it is not ordered out, but minimized, so clicking
|
||||
on the minimized menu will activate the application.
|
||||
</p>
|
||||
</desc>
|
||||
<term>GSXEnableFontSet</term>
|
||||
<desc>
|
||||
<p> A string value which defaults to <code>NO</code>. If set to
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
HWND currentFocus;
|
||||
HWND desiredFocus;
|
||||
HWND currentActive;
|
||||
|
||||
struct {
|
||||
BOOL useWMTaskBar;
|
||||
} flags;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
#include <Foundation/NSConnection.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSTimer.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <AppKit/AppKitExceptions.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/NSMenu.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSEvent.h>
|
||||
|
@ -106,6 +108,8 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
*/
|
||||
- (id) initWithAttributes: (NSDictionary *)info
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
[self _initWin32Context];
|
||||
[super initWithAttributes: info];
|
||||
|
||||
|
@ -113,6 +117,14 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||
|
||||
flags.useWMTaskbar = YES;
|
||||
if ([defs stringForKey: @"GSUseWMTaskbar"] != nil
|
||||
&& [defs boolForKey: @"GSUseWMTaskbar"] == NO)
|
||||
{
|
||||
flags.useWMTaskbar = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -390,9 +402,36 @@ DWORD windowStyleForGSStyle(unsigned int style)
|
|||
- (void) orderwindow: (int) op : (int) otherWin : (int) winNum
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"orderwindow: %d : %d : %d", op, otherWin, winNum);
|
||||
|
||||
if (flags.useWMTaskBar)
|
||||
{
|
||||
/* When using this policy, we make these changes:
|
||||
- don't show the application icon window
|
||||
- Never order out the main menu, just minimize it, so that
|
||||
when the user clicks on it in the taskbar it will activate the
|
||||
application.
|
||||
*/
|
||||
int special;
|
||||
special = [[NSApp iconWindow] windowNumber];
|
||||
if (winNum == special)
|
||||
{
|
||||
return;
|
||||
}
|
||||
special = [[[NSApp mainMenu] window] windowNumber];
|
||||
if (winNum == special && op == NSWindowOut)
|
||||
{
|
||||
ShowWindow((HWND)winNum, SW_MINIMIZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (op != NSWindowOut)
|
||||
{
|
||||
ShowWindow((HWND)winNum, SW_SHOW);
|
||||
int flag = SW_SHOW;
|
||||
if (IsIconic((HWND)winNum))
|
||||
flag = SW_RESTORE;
|
||||
ShowWindow((HWND)winNum, flag);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (op)
|
||||
|
|
|
@ -370,9 +370,22 @@ static void invalidateWindow(HWND hwnd, RECT rect);
|
|||
if (LOWORD(wParam))
|
||||
currentActive = hwnd;
|
||||
break;
|
||||
case WM_ACTIVATEAPP:
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d: %s", "ACTIVATEAPP",
|
||||
hwnd, (wParam) ? "activate" : "deactivate");
|
||||
case WM_ACTIVATEAPP:
|
||||
{
|
||||
int special;
|
||||
BOOL active = [NSApp isActive];
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d: %s (app is %s)",
|
||||
"ACTIVATEAPP", hwnd, (wParam) ? "activate" : "deactivate",
|
||||
(active) ? "active" : "deactivated");
|
||||
special = [[[NSApp mainMenu] window] windowNumber];
|
||||
if (active == NO && wParam)
|
||||
{
|
||||
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
else if (special == (int)hwnd && active == YES && wParam == 0)
|
||||
[NSApp deactivate];
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEACTIVATE:
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MOUSEACTIVATE", hwnd);
|
||||
|
|
Loading…
Reference in a new issue