From df32af71fcad1f208f2f475bd4ab4182c0fd995f Mon Sep 17 00:00:00 2001 From: Sergii Stoian Date: Thu, 17 Sep 2020 01:42:32 +0300 Subject: [PATCH 1/2] * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): if application (window) receives WM_TAKE_FOCUS in hidden state it means WindowMaker wants us to be unhidden. Description: There are 2 protocols defined in XGServerWindow.h: WMFHideApplication and WMFHideOtherApplications. These protocols exist to help GNUstep application and WindowMaker notify each other about "Hide" and "Hide Others" actions. There are no protocols for "unhide" action. Test case steps: 1. Open application with window opened. 2. Hide application with "Hide" menu item. 3. Open WindowMaker's "Windows" menu (middle-click on desktop). 4. Select hidden application window. Application unhides, activates, restored window is focused (receives) input and "Hide" menu item unselected. --- ChangeLog | 21 +++++++++++++++++++++ Source/x11/XGServerEvent.m | 19 +++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9248cae..a7d19ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2020-09-17 Sergii Stoian + + * Source/x11/XGServerEvent.m + (_handleTakeFocusAtom:forContext:): if application (window) receives + WM_TAKE_FOCUS in hidden state it means WindowMaker wants us to be + unhidden. + + Description: There are 2 protocols defined in XGServerWindow.h: + WMFHideApplication and WMFHideOtherApplications. These protocols exist + to help GNUstep application and WindowMaker notify each other + about "Hide" and "Hide Others" actions. There are no protocols for + "unhide" action. + + Test case steps: + 1. Open application with window opened. + 2. Hide application with "Hide" menu item. + 3. Open WindowMaker's "Windows" menu (middle-click on desktop). + 4. Select hidden application window. + Application unhides, activates, restored window is focused (receives) input + and "Hide" menu item unselected. + 2020-09-16 Sergii Stoian * Source/x11/XGServerWindow.m diff --git a/Source/x11/XGServerEvent.m b/Source/x11/XGServerEvent.m index 1e56e49..22eddad 100644 --- a/Source/x11/XGServerEvent.m +++ b/Source/x11/XGServerEvent.m @@ -1977,10 +1977,21 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor events */ if ([NSApp isHidden]) { - /* This often occurs when hidding an app, since a bunch of - windows get hidden at once, and the WM is searching for a - window to take focus after each one gets hidden. */ - NSDebugLLog(@"Focus", @"WM take focus while hiding"); + if (generic.wm & XGWM_WINDOWMAKER) + { + /* If window receives WM_TAKE_FOCUS and application is in hidden + state - it's time to unhide. There's no other method to + tell us to unhide. */ + NSDebugLLog(@"Focus", @"WM take focus while hidden - unhiding."); + [NSApp unhide:nil]; + } + else + { + /* This often occurs when hidding an app, since a bunch of + windows get hidden at once, and the WM is searching for a + window to take focus after each one gets hidden. */ + NSDebugLLog(@"Focus", @"WM take focus while hiding"); + } } else if (cWin->ignore_take_focus == YES) { From fa4549e52226d91b668ccece89b8cfc837c73df6 Mon Sep 17 00:00:00 2001 From: Sergii Stoian Date: Thu, 17 Sep 2020 12:00:38 +0300 Subject: [PATCH 2/2] * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): space before argument was added. --- Source/x11/XGServerEvent.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/x11/XGServerEvent.m b/Source/x11/XGServerEvent.m index 22eddad..fb8f976 100644 --- a/Source/x11/XGServerEvent.m +++ b/Source/x11/XGServerEvent.m @@ -1983,7 +1983,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor state - it's time to unhide. There's no other method to tell us to unhide. */ NSDebugLLog(@"Focus", @"WM take focus while hidden - unhiding."); - [NSApp unhide:nil]; + [NSApp unhide: nil]; } else {