Added support for WindowMaker's WMFHideApplication action.

This commit is contained in:
Sergii Stoian 2019-04-05 14:46:05 +03:00
parent f9958176db
commit b492ac87cd
5 changed files with 67 additions and 10 deletions

View file

@ -1,3 +1,16 @@
2019-04-05 Sergii Stoian <stoyan255@gmail.com>
* Headers/x11/XGServerWindow.h (GSMaxWMProtocols): increased number to support
WMFHideApplication.
* Headers/x11/XGGeneric.h: Atoms _WINDOWMAKER_WM_FUNCTION, _GNUSTEP_WM_HIDE_APP
were added.
* Source/x11/XGServerWindow.m (_setSupportedWMProtocols:): added
_GNUSTEP_WM_HIDE_APP protocol suport to the window protocols.
(hidewindow:): implementation of GSDisplayServer method.
* Source/x11/XGServerEvent.m (processEvent:): process _GNUSTEP_WM_HIDE_APP
client message.
2019-04-04 Sergii Stoian <stoyan255@ukr.net> 2019-04-04 Sergii Stoian <stoyan255@ukr.net>
* Source/x11/XGServerEvent.m (processEvent:): * Source/x11/XGServerEvent.m (processEvent:):

View file

@ -104,8 +104,10 @@ static char *atom_names[] = {
"_WINDOWMAKER_WM_PROTOCOLS", "_WINDOWMAKER_WM_PROTOCOLS",
"_WINDOWMAKER_NOTICEBOARD", "_WINDOWMAKER_NOTICEBOARD",
"_WINDOWMAKER_ICON_TILE", "_WINDOWMAKER_ICON_TILE",
"_WINDOWMAKER_WM_FUNCTION",
"_RGBA_IMAGE", "_RGBA_IMAGE",
"_GNUSTEP_WM_MINIATURIZE_WINDOW", "_GNUSTEP_WM_MINIATURIZE_WINDOW",
"_GNUSTEP_WM_HIDE_APP",
"_GNUSTEP_WM_ATTR", "_GNUSTEP_WM_ATTR",
"_GNUSTEP_TITLEBAR_STATE", "_GNUSTEP_TITLEBAR_STATE",
"_GNUSTEP_FRAME_OFFSETS", "_GNUSTEP_FRAME_OFFSETS",
@ -177,12 +179,14 @@ static char *atom_names[] = {
#define _WINDOWMAKER_WM_PROTOCOLS_ATOM atoms[59] #define _WINDOWMAKER_WM_PROTOCOLS_ATOM atoms[59]
#define _WINDOWMAKER_NOTICEBOARD_ATOM atoms[60] #define _WINDOWMAKER_NOTICEBOARD_ATOM atoms[60]
#define _WINDOWMAKER_ICON_TILE_ATOM atoms[61] #define _WINDOWMAKER_ICON_TILE_ATOM atoms[61]
#define _RGBA_IMAGE_ATOM atoms[62] #define _WINDOWMAKER_WM_FUNCTION_ATOM atoms[62]
#define _GNUSTEP_WM_MINIATURIZE_WINDOW_ATOM atoms[63] #define _RGBA_IMAGE_ATOM atoms[63]
#define _GNUSTEP_WM_ATTR_ATOM atoms[64] #define _GNUSTEP_WM_MINIATURIZE_WINDOW_ATOM atoms[64]
#define _GNUSTEP_TITLEBAR_STATE_ATOM atoms[65] #define _GNUSTEP_WM_HIDE_APP_ATOM atoms[65]
#define _GNUSTEP_FRAME_OFFSETS_ATOM atoms[66] #define _GNUSTEP_WM_ATTR_ATOM atoms[66]
#define WM_IGNORE_FOCUS_EVENTS_ATOM atoms[67] #define _GNUSTEP_TITLEBAR_STATE_ATOM atoms[67]
#define _GNUSTEP_FRAME_OFFSETS_ATOM atoms[68]
#define WM_IGNORE_FOCUS_EVENTS_ATOM atoms[69]
/* /*
* Frame offsets for window inside parent decoration window. * Frame offsets for window inside parent decoration window.

View file

@ -72,7 +72,7 @@ typedef struct {
#define WMFHideOtherApplications 10 #define WMFHideOtherApplications 10
#define WMFHideApplication 12 #define WMFHideApplication 12
#define GSMaxWMProtocols 5 #define GSMaxWMProtocols 6
/* Graphics Driver protocol. Setup in [NSGraphicsContext-contextDevice:] */ /* Graphics Driver protocol. Setup in [NSGraphicsContext-contextDevice:] */
enum { enum {

View file

@ -621,6 +621,21 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
data1: 0 data1: 0
data2: 0]; data2: 0];
} }
else if ((Atom)xEvent.xclient.data.l[0]
== generic._GNUSTEP_WM_HIDE_APP_ATOM)
{
NSDebugLLog(@"Hide", @"%lu application will be hidden", cWin->number);
eventLocation = NSMakePoint(0,0);
e = [NSEvent otherEventWithType: NSAppKitDefined
location: eventLocation
modifierFlags: 0
timestamp: 0
windowNumber: cWin->number
context: gcontext
subtype: GSAppKitAppHide
data1: 0
data2: 0];
}
else if ((Atom)xEvent.xclient.data.l[0] else if ((Atom)xEvent.xclient.data.l[0]
== generic.WM_TAKE_FOCUS_ATOM) == generic.WM_TAKE_FOCUS_ATOM)
{ {

View file

@ -1396,10 +1396,13 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
window->protocols[window->numProtocols++] = generic._NET_WM_SYNC_REQUEST_ATOM; window->protocols[window->numProtocols++] = generic._NET_WM_SYNC_REQUEST_ATOM;
#endif #endif
} }
if ((generic.wm & XGWM_WINDOWMAKER) != 0 if ((generic.wm & XGWM_WINDOWMAKER) != 0)
&& (window->win_attrs.window_style & NSMiniaturizableWindowMask) != 0)
{ {
window->protocols[window->numProtocols++] = generic._GNUSTEP_WM_MINIATURIZE_WINDOW_ATOM; if ((window->win_attrs.window_style & NSMiniaturizableWindowMask) != 0)
{
window->protocols[window->numProtocols++] = generic._GNUSTEP_WM_MINIATURIZE_WINDOW_ATOM;
}
window->protocols[window->numProtocols++] = generic._GNUSTEP_WM_HIDE_APP_ATOM;
} }
NSAssert1(window->numProtocols <= GSMaxWMProtocols, NSAssert1(window->numProtocols <= GSMaxWMProtocols,
@"Too many protocols (%d > GSMaxWMProtocols)", @"Too many protocols (%d > GSMaxWMProtocols)",
@ -2602,6 +2605,28 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
XIconifyWindow(dpy, window->ident, window->screen); XIconifyWindow(dpy, window->ident, window->screen);
} }
/* Actually this is "hide application" action.
However, key press may be received by particular window. */
- (BOOL) hidewindow: (int)win
{
gswindow_device_t *window;
if ((generic.wm & XGWM_WINDOWMAKER) == 0)
return NO;
window = [XGServer _windowWithTag: win];
[self _sendRoot: window->root
type: generic._WINDOWMAKER_WM_FUNCTION_ATOM
window: window->ident
data0: WMFHideApplication
data1: CurrentTime
data2: 0
data3: 0];
XSync(dpy, False);
return YES;
}
/** /**
Make sure we have the most up-to-date window information and then Make sure we have the most up-to-date window information and then
make sure the context has our new information make sure the context has our new information