From a6595e320d0b1c16143be3a3a9c0f451ce5400da Mon Sep 17 00:00:00 2001 From: Sergii Stoian Date: Tue, 2 Apr 2019 19:38:44 +0300 Subject: [PATCH] Map application icon window without focus switch for applications executed with argument `-autolaunch YES` in WindowMaker environment. --- ChangeLog | 7 +++++++ Source/x11/XGServerWindow.m | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3a922a0..1069e2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-04-02 Sergii Stoian + + * Source/x11/XGServerWindow.m: + (orderwindow:::) Map application icon window without focus flickering + for applications executed with argument `-autolaunch YES` in WindowMaker + environment. + 2019-03-26 Sergii Stoian * Source/x11/XGServerWindow.m: (setwindowlevel::) Set `Utility` window type for NSFloatingWindowLevel. diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index a77c81e..090c50e 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -2815,6 +2815,24 @@ static BOOL didCreatePixmaps; */ if ((window->win_attrs.window_style & NSIconWindowMask) != 0) { + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + if (op != NSWindowOut && window->map_state == IsUnmapped && + [[defaults objectForKey: @"autolaunch"] isEqualToString:@"YES"]) + { + XEvent ev; + + // Inform WM to ignore focus events + ev.xclient.type = ClientMessage; + ev.xclient.message_type = XInternAtom(dpy,"WM_IGNORE_FOCUS_EVENTS", False); + ev.xclient.format = 32; + ev.xclient.data.l[0] = True; + XSendEvent(dpy, ROOT, True, EnterWindowMask, &ev); + // Display application icon + XMapWindow(dpy, ROOT); + // Inform WM to process focus events again + ev.xclient.data.l[0] = False; + XSendEvent(dpy, ROOT, True, EnterWindowMask, &ev); + } return; } if ((window->win_attrs.window_style & NSMiniWindowMask) != 0)