1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

dtwm: Respond to the following EWMH:

_NET_WM_STATE_MAXIMIZED_VERT
      _NET_WM_STATE_MAXIMIZED_HORZ

A window is maximized if both _NET_WM_STATE_MAXIMIZED_VERT and
_NET_WM_STATE_MAXIMIZED_HORZ are set.
This commit is contained in:
Liang Chang 2021-10-31 22:18:50 +08:00
parent 08ebba5225
commit c38a5a8b71
8 changed files with 316 additions and 319 deletions

View file

@ -611,9 +611,17 @@ Boolean HandleEventsOnSpecialWindows (XEvent *pEvent)
case ClientMessage: case ClientMessage:
{ {
if (pCD = InitClientData (pEvent->xclient.window)) { if (pCD = InitClientData (pEvent->xclient.window)) {
HandleClientMessageEwmh(pCD, XClientMessageEvent *clientEvent = pEvent;
(XClientMessageEvent *) pEvent);
dispatchEvent = False; if (clientEvent->message_type ==
wmGD.xa__NET_WM_FULLSCREEN_MONITORS)
{
ProcessNetWmFullscreenMonitors (pCD,
clientEvent->data.l[0], clientEvent->data.l[1],
clientEvent->data.l[2], clientEvent->data.l[3]);
dispatchEvent = False;
}
} }
break; break;
} }
@ -858,9 +866,13 @@ void HandleCPropertyNotify (ClientData *pCD, XPropertyEvent *propertyEvent)
ProcessMwmHints (pCD); ProcessMwmHints (pCD);
SetClientOffset (pCD); SetClientOffset (pCD);
} }
else else if (propertyEvent->atom == wmGD.xa__NET_WM_NAME)
{ {
HandlePropertyNotifyEwmh (pCD, propertyEvent); ProcessNetWmName (pCD);
}
else if (propertyEvent->atom == wmGD.xa__NET_WM_ICON_NAME)
{
ProcessNetWmIconName (pCD);
} }
break; break;
} }
@ -2581,22 +2593,7 @@ void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent)
} }
else if (clientEvent->data.l[0] == NormalState) else if (clientEvent->data.l[0] == NormalState)
{ {
if (pCD->enterFullscreen) newState = NORMAL_STATE;
{
Boolean enterFullscreen = pCD->enterFullscreen;
SetClientState (pCD, NORMAL_STATE, GetTimestamp ());
pCD->enterFullscreen = enterFullscreen;
newState = MAXIMIZED_STATE;
}
else
{
if (pCD->decorUpdated)
{
SetClientState (pCD, MAXIMIZED_STATE, GetTimestamp ());
}
newState = NORMAL_STATE;
}
} }
if (!ClientInWorkspace (ACTIVE_WS, pCD)) if (!ClientInWorkspace (ACTIVE_WS, pCD))
{ {
@ -2606,9 +2603,16 @@ void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent)
SetClientState (pCD, newState, GetTimestamp ()); SetClientState (pCD, newState, GetTimestamp ());
} }
else else if (clientEvent->message_type == wmGD.xa__NET_WM_FULLSCREEN_MONITORS)
{ {
HandleClientMessageEwmh (pCD, clientEvent); ProcessNetWmFullscreenMonitors (pCD,
clientEvent->data.l[0], clientEvent->data.l[1],
clientEvent->data.l[2], clientEvent->data.l[3]);
}
else if (clientEvent->message_type == wmGD.xa__NET_WM_STATE)
{
ProcessNetWmState (pCD, clientEvent->data.l[0], clientEvent->data.l[1],
clientEvent->data.l[2]);
} }
} /* END OF FUNCTION HandleClientMessage */ } /* END OF FUNCTION HandleClientMessage */

View file

@ -23,50 +23,163 @@
* Floor, Boston, MA 02110-1301 USA * Floor, Boston, MA 02110-1301 USA
*/ */
/* #include <stdlib.h>
* Included Files:
*/
#include "WmGlobal.h" #include "WmGlobal.h"
#include "WmEvent.h"
#include "WmEwmh.h" #include "WmEwmh.h"
/*
* include extern functions
*/
#include "WmMultiHead.h" #include "WmMultiHead.h"
#include "WmProperty.h" #include "WmProperty.h"
#include "WmWinState.h"
#include "WmWrkspace.h"
static unsigned long GetWindowProperty (Window w, Atom property, Atom reqType,
unsigned char **propReturn)
{
Atom actualType;
int actualFormat;
unsigned long nitems;
unsigned long leftover;
if (XGetWindowProperty (DISPLAY, w, property, 0L, 1000000L, False, reqType,
/*************************************<->************************************* &actualType, &actualFormat, &nitems, &leftover,
* propReturn) != Success) goto err;
* ProcessNetWmFullscreenMonitors (pCD, top, bottom, left, right)
*
*
* Description:
* -----------
* This function retrieves the contents of the _NET_WM_FULLSCREEN_MONITORS
* message.
*
*
*
* Inputs:
* ------
* pCD = pointer to client data
* top = the monitor whose top edge defines the top edge of the fullscreen
* window
* bottom = the monitor whose bottom edge defines the bottom edge of the
* fullscreen window
* left = the monitor whose left edge defines the left edge of the fullscreen
* window
* right = the monitor whose right edge defines the right edge of the
* fullscreen window
*
*************************************<->***********************************/
static void ProcessNetWmFullscreenMonitors (ClientData *pCD, if (actualType != reqType) goto err;
long top, long bottom, long left, long right)
return nitems;
err:
XFree (*propReturn);
return 0;
}
static void UpdateNetWmState (ClientData *pCD)
{
unsigned long nitems;
unsigned long natoms = 0;
Atom *netWmState;
Atom *atoms;
nitems = GetWindowProperty (pCD->client, wmGD.xa__NET_WM_STATE, XA_ATOM,
(unsigned char **) &netWmState);
atoms = malloc ((nitems + 2) * sizeof (Atom)); if (!atoms) goto done;
for (int i = 0; i < nitems; ++i)
if (netWmState[i] == wmGD.xa__NET_WM_STATE_FULLSCREEN ||
netWmState[i] == wmGD.xa__NET_WM_STATE_MAXIMIZED_VERT ||
netWmState[i] == wmGD.xa__NET_WM_STATE_MAXIMIZED_HORZ)
continue;
else
atoms[natoms++] = netWmState[i];
if (pCD->maxConfig)
{
if (pCD->isFullscreen)
{
atoms[natoms++] = wmGD.xa__NET_WM_STATE_FULLSCREEN;
}
else
{
atoms[natoms++] = wmGD.xa__NET_WM_STATE_MAXIMIZED_VERT;
atoms[natoms++] = wmGD.xa__NET_WM_STATE_MAXIMIZED_HORZ;
}
}
XChangeProperty (DISPLAY, pCD->client, wmGD.xa__NET_WM_STATE, XA_ATOM, 32,
PropModeReplace, (unsigned char *) atoms, natoms);
done:
XFree (netWmState);
XFree (atoms);
}
static void ProcessNetWmStateFullscreen (ClientData *pCD, long action)
{
switch (action)
{
case _NET_WM_STATE_REMOVE:
if (!pCD->isFullscreen) return;
pCD->isFullscreen = False;
break;
case _NET_WM_STATE_ADD:
if (pCD->isFullscreen) return;
pCD->isFullscreen = True;
break;
case _NET_WM_STATE_TOGGLE:
pCD->isFullscreen = !pCD->isFullscreen;
break;
default:
return;
}
SetClientState (pCD, NORMAL_STATE, GetTimestamp ());
if (pCD->isFullscreen)
SetClientState (pCD, MAXIMIZED_STATE, GetTimestamp ());
}
static void ProcessNetWmStateMaximized (ClientData *pCD, long action)
{
int newState;
switch (action)
{
case _NET_WM_STATE_REMOVE:
if (pCD->clientState != MAXIMIZED_STATE) return;
newState = NORMAL_STATE;
break;
case _NET_WM_STATE_ADD:
if (pCD->clientState == MAXIMIZED_STATE) return;
newState = MAXIMIZED_STATE;
break;
case _NET_WM_STATE_TOGGLE:
newState = pCD->clientState == MAXIMIZED_STATE ?
NORMAL_STATE : MAXIMIZED_STATE;
break;
default:
return;
}
SetClientState (pCD, newState, GetTimestamp ());
}
static void ProcessNetWmNameNetWmIconName (ClientData *pCD, Atom name)
{
unsigned long nitems;
unsigned char *netNameProp;
XTextProperty nameProp = {0};
nitems = GetWindowProperty(pCD->client, name, wmGD.xa_UTF8_STRING,
&netNameProp);
if (!nitems) goto done;
if (Xutf8TextListToTextProperty (DISPLAY, (char **) &netNameProp, 1,
XUTF8StringStyle, &nameProp) != Success) goto done;
if (name == wmGD.xa__NET_WM_NAME)
XSetWMName (DISPLAY, pCD->client, &nameProp);
else if (name == wmGD.xa__NET_WM_ICON_NAME)
XSetWMIconName (DISPLAY, pCD->client, &nameProp);
done:
XFree (netNameProp);
XFree ((char*) nameProp.value);
}
/**
* @brief Processes the _NET_WM_FULLSCREEN_MONITORS protocol.
*
* @param pCD
* @param top
* @param bottom
* @param left
* @param right
*/
void ProcessNetWmFullscreenMonitors (ClientData *pCD,
long top, long bottom, long left, long right)
{ {
WmHeadInfo_t *pHeadInfo; WmHeadInfo_t *pHeadInfo;
@ -103,251 +216,123 @@ static void ProcessNetWmFullscreenMonitors (ClientData *pCD,
free(pHeadInfo); free(pHeadInfo);
pCD->monitorSizeIsSet = True; pCD->monitorSizeIsSet = True;
} /* END OF FUNCTION ProcessNetWmFullscreenMonitors */ }
/**
* @brief Processes the _NET_WM_STATE client message.
/*************************************<->************************************* *
* * @param pCD
* ProcessNetWmStateFullscreen (pCD, en) * @param action
* * @param firstProperty
* * @param secondProperty
* Description: */
* ----------- void ProcessNetWmState (ClientData *pCD, long action,
* This function retrieves the contents of the _NET_WM_STATE_FULLSCREEN long firstProperty, long secondProperty)
* message.
*
*
*
* Inputs:
* ------
* pCD = pointer to client data
* en = enable fullscreen
*
*************************************<->***********************************/
static void ProcessNetWmStateFullscreen (ClientData *pCD, Boolean en)
{ {
PropMwmHints hints = {0}; if (pCD->clientState & UNSEEN_STATE) return;
PropMwmHints *pHints = GetMwmHints (pCD);
XClientMessageEvent clientMsgEvent = {
.type = ClientMessage,
.window = pCD->client,
.message_type = wmGD.xa_WM_CHANGE_STATE,
.format = 32,
.data.l[0] = NormalState
};
if (!pHints) pHints = &hints; if (firstProperty == wmGD.xa__NET_WM_STATE_MAXIMIZED_VERT &&
secondProperty == wmGD.xa__NET_WM_STATE_MAXIMIZED_HORZ ||
firstProperty == wmGD.xa__NET_WM_STATE_MAXIMIZED_HORZ &&
secondProperty == wmGD.xa__NET_WM_STATE_MAXIMIZED_VERT)
ProcessNetWmStateMaximized (pCD, action);
else if (firstProperty == wmGD.xa__NET_WM_STATE_FULLSCREEN ||
secondProperty == wmGD.xa__NET_WM_STATE_FULLSCREEN)
ProcessNetWmStateFullscreen (pCD, action);
pHints->flags |= MWM_HINTS_DECORATIONS; if (!ClientInWorkspace (ACTIVE_WS, pCD))
pHints->decorations = en ? WM_DECOR_NONE : WM_DECOR_DEFAULT; SetClientState (pCD, pCD->clientState | UNSEEN_STATE, GetTimestamp ());
XChangeProperty (DISPLAY, pCD->client, wmGD.xa_MWM_HINTS, wmGD.xa_MWM_HINTS, UpdateNetWmState (pCD);
32, PropModeReplace, (unsigned char *) pHints, }
sizeof (PropMwmHints) / sizeof (long));
if (pHints != &hints) XFree (pHints); /**
* @brief Processes the _NET_WM_NAME property.
pCD->enterFullscreen = en; *
* @param pCD
XSendEvent (DISPLAY, ROOT_FOR_CLIENT (pCD), False, SubstructureRedirectMask, */
(XEvent *) &clientMsgEvent); void ProcessNetWmName (ClientData *pCD)
} /* END OF FUNCTION ProcessNetWmStateFullscreen */
/*************************************<->*************************************
*
* ProcessNetWmNameNetWmIconName (pCD, atom)
*
*
* Description:
* -----------
* This function retrieves the contents of the _NET_WM_NAME or
* _NET_WM_ICON_NAME property on the cient window.
*
*
* Inputs:
* ------
* pCD = pointer to client data structure
* atom = _NET_WM_NAME or _NET_WM_ICON_NAME
*
*************************************<->***********************************/
static void ProcessNetWmNameNetWmIconName (ClientData *pCD, Atom atom)
{ {
Atom actualType; ProcessNetWmNameNetWmIconName (pCD, wmGD.xa__NET_WM_NAME);
int actualFormat; }
unsigned long nitems;
unsigned long leftover;
unsigned char *netNameProp = NULL;
XTextProperty nameProp = {0};
if (XGetWindowProperty (DISPLAY, pCD->client, atom, 0L, 1000000L, False, /**
wmGD.xa_UTF8_STRING, &actualType, &actualFormat, * @brief Processes the _NET_WM_ICON_NAME property.
&nitems, &leftover, &netNameProp) != Success) *
goto done; * @param pCD
*/
if (actualType != wmGD.xa_UTF8_STRING) goto done; void ProcessNetWmIconName (ClientData *pCD)
if (actualFormat != 8) goto done;
if (Xutf8TextListToTextProperty (DISPLAY, (char **) &netNameProp, 1,
XUTF8StringStyle, &nameProp) != Success) goto done;
if (atom == wmGD.xa_NET_WM_NAME)
XSetWMName (DISPLAY, pCD->client, &nameProp);
else if (atom == wmGD.xa_NET_WM_ICON_NAME)
XSetWMIconName (DISPLAY, pCD->client, &nameProp);
done:
if (netNameProp) XFree (netNameProp);
if (nameProp.value) XFree ((char*) nameProp.value);
} /* END OF FUNCTION ProcessNetWmNameNetWmIconName */
/*************************************<->*************************************
*
* HandleClientMessageEwmh (pCD, clientEvent)
*
*
* Description:
* -----------
* This function retrieves the contents of the EWMH message.
*
*
* Inputs:
* ------
* pCD = pointer to client data
* clientEvent = pointer to a client message event on the root window
*
*************************************<->***********************************/
void HandleClientMessageEwmh (ClientData *pCD, XClientMessageEvent *clientEvent)
{ {
int i; ProcessNetWmNameNetWmIconName (pCD, wmGD.xa__NET_WM_ICON_NAME);
}
if (clientEvent->message_type == wmGD.xa_NET_WM_FULLSCREEN_MONITORS)
{
ProcessNetWmFullscreenMonitors (pCD,
clientEvent->data.l[0], clientEvent->data.l[1],
clientEvent->data.l[2], clientEvent->data.l[3]);
}
else if (clientEvent->message_type == wmGD.xa_NET_WM_STATE)
{
for (i = 1; i < 3; ++i)
{
if (clientEvent->data.l[i] == wmGD.xa_NET_WM_STATE_FULLSCREEN)
{
ProcessNetWmStateFullscreen (pCD, clientEvent->data.l[0]);
}
}
}
} /* END OF FUNCTION HandleClientMessageEwmh */
/*************************************<->*************************************
*
* HandlePropertyNotifyEwmh (pCD, clientEvent)
*
*
* Description:
* -----------
* This function handles PropertyNotify events (indicating EWMH property
* changes) that are reported to the client window.
*
*
* Inputs:
* ------
* pCD = pointer to client data
* clientEvent = pointer to a client message event on the root window
*
*************************************<->***********************************/
void HandlePropertyNotifyEwmh (ClientData *pCD, XPropertyEvent *propertyEvent)
{
if (propertyEvent->atom == wmGD.xa_NET_WM_NAME ||
propertyEvent->atom == wmGD.xa_NET_WM_ICON_NAME)
{
ProcessNetWmNameNetWmIconName (pCD, propertyEvent->atom);
}
} /* END OF FUNCTION HandlePropertyNotifyEwmh */
/*************************************<->*************************************
*
* SetupWmEwmh ()
*
*
* Description:
* -----------
* This function sets up the window manager handling of the EWMH.
*
*
* Outputs:
* -------
* (wmGD) = Atoms id's are setup.
*
*************************************<->***********************************/
/**
* @brief Sets up the window manager handling of the EWMH.
*/
void SetupWmEwmh (void) void SetupWmEwmh (void)
{ {
enum { enum {
XA_UTF8_STRING, XA_UTF8_STRING,
XA_NET_SUPPORTED, XA__NET_SUPPORTED,
XA_NET_SUPPORTING_WM_CHECK, XA__NET_SUPPORTING_WM_CHECK,
XA_NET_WM_NAME, XA__NET_WM_NAME,
XA_NET_WM_ICON_NAME, XA__NET_WM_ICON_NAME,
XA_NET_WM_FULLSCREEN_MONITORS, XA__NET_WM_FULLSCREEN_MONITORS,
XA_NET_WM_STATE, XA__NET_WM_STATE,
XA_NET_WM_STATE_FULLSCREEN XA__NET_WM_STATE_FULLSCREEN,
XA__NET_WM_STATE_MAXIMIZED_VERT,
XA__NET_WM_STATE_MAXIMIZED_HORZ
}; };
static char *atom_names[] = { static char *atom_names[] = {
"UTF8_STRING", "UTF8_STRING",
_XA_NET_SUPPORTED, _XA__NET_SUPPORTED,
_XA_NET_SUPPORTING_WM_CHECK, _XA__NET_SUPPORTING_WM_CHECK,
_XA_NET_WM_NAME, _XA__NET_WM_NAME,
_XA_NET_WM_ICON_NAME, _XA__NET_WM_ICON_NAME,
_XA_NET_WM_FULLSCREEN_MONITORS, _XA__NET_WM_FULLSCREEN_MONITORS,
_XA_NET_WM_STATE, _XA__NET_WM_STATE,
_XA_NET_WM_STATE_FULLSCREEN _XA__NET_WM_STATE_FULLSCREEN,
_XA__NET_WM_STATE_MAXIMIZED_VERT,
_XA__NET_WM_STATE_MAXIMIZED_HORZ
}; };
int scr;
Window childWindow; Window childWindow;
Atom atoms[XtNumber(atom_names) + 1]; Atom atoms[XtNumber(atom_names) + 1];
XInternAtoms(DISPLAY, atom_names, XtNumber(atom_names), False, atoms); XInternAtoms(DISPLAY, atom_names, XtNumber(atom_names), False, atoms);
wmGD.xa_UTF8_STRING = atoms[XA_UTF8_STRING]; wmGD.xa_UTF8_STRING = atoms[XA_UTF8_STRING];
wmGD.xa_NET_WM_NAME = atoms[XA_NET_WM_NAME]; wmGD.xa__NET_WM_NAME = atoms[XA__NET_WM_NAME];
wmGD.xa_NET_WM_ICON_NAME = atoms[XA_NET_WM_ICON_NAME]; wmGD.xa__NET_WM_ICON_NAME = atoms[XA__NET_WM_ICON_NAME];
wmGD.xa_NET_WM_FULLSCREEN_MONITORS = atoms[XA_NET_WM_FULLSCREEN_MONITORS]; wmGD.xa__NET_WM_FULLSCREEN_MONITORS = atoms[XA__NET_WM_FULLSCREEN_MONITORS];
wmGD.xa_NET_WM_STATE = atoms[XA_NET_WM_STATE]; wmGD.xa__NET_WM_STATE = atoms[XA__NET_WM_STATE];
wmGD.xa_NET_WM_STATE_FULLSCREEN = atoms[XA_NET_WM_STATE_FULLSCREEN]; wmGD.xa__NET_WM_STATE_FULLSCREEN = atoms[XA__NET_WM_STATE_FULLSCREEN];
wmGD.xa__NET_WM_STATE_MAXIMIZED_VERT =
atoms[XA__NET_WM_STATE_MAXIMIZED_VERT];
wmGD.xa__NET_WM_STATE_MAXIMIZED_HORZ =
atoms[XA__NET_WM_STATE_MAXIMIZED_HORZ];
for (scr = 0; scr < wmGD.numScreens; scr++) for (int scr = 0; scr < wmGD.numScreens; ++scr)
{ {
childWindow = XCreateSimpleWindow(DISPLAY, wmGD.Screens[scr].rootWindow, childWindow = XCreateSimpleWindow(DISPLAY, wmGD.Screens[scr].rootWindow,
-1, -1, 1, 1, 0, 0, 0); -1, -1, 1, 1, 0, 0, 0);
XChangeProperty(DISPLAY, childWindow, atoms[XA_NET_WM_NAME], XChangeProperty(DISPLAY, childWindow, atoms[XA__NET_WM_NAME],
atoms[XA_UTF8_STRING], 8, PropModeReplace, "DTWM", 5); atoms[XA_UTF8_STRING], 8, PropModeReplace,
DT_WM_RESOURCE_NAME, 5);
XChangeProperty(DISPLAY, childWindow, XChangeProperty(DISPLAY, childWindow,
atoms[XA_NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32, atoms[XA__NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
PropModeReplace, (unsigned char *)&childWindow, 1); PropModeReplace, (unsigned char *)&childWindow, 1);
XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow, XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow,
atoms[XA_NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32, atoms[XA__NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
PropModeReplace, (unsigned char *)&childWindow, 1); PropModeReplace, (unsigned char *)&childWindow, 1);
XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow, XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow,
atoms[XA_NET_SUPPORTED], XA_ATOM, 32, PropModeReplace, atoms[XA__NET_SUPPORTED], XA_ATOM, 32, PropModeReplace,
(unsigned char *)&atoms[XA_NET_SUPPORTING_WM_CHECK], 6); (unsigned char *)&atoms[XA__NET_SUPPORTING_WM_CHECK],
8);
} }
} /* END OF FUNCTION SetupWmEwmh */ }

View file

@ -26,21 +26,26 @@
#ifndef _Dt_WmEwmh_h_ #ifndef _Dt_WmEwmh_h_
#define _Dt_WmEwmh_h_ #define _Dt_WmEwmh_h_
#define _NET_WM_STATE_REMOVE 0 #define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1 #define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2 #define _NET_WM_STATE_TOGGLE 2
#define _XA_NET_SUPPORTED "_NET_SUPPORTED" #define _XA__NET_SUPPORTED "_NET_SUPPORTED"
#define _XA_NET_SUPPORTING_WM_CHECK "_NET_SUPPORTING_WM_CHECK" #define _XA__NET_SUPPORTING_WM_CHECK "_NET_SUPPORTING_WM_CHECK"
#define _XA_NET_WM_NAME "_NET_WM_NAME" #define _XA__NET_WM_NAME "_NET_WM_NAME"
#define _XA_NET_WM_ICON_NAME "_NET_WM_ICON_NAME" #define _XA__NET_WM_ICON_NAME "_NET_WM_ICON_NAME"
#define _XA_NET_WM_FULLSCREEN_MONITORS "_NET_WM_FULLSCREEN_MONITORS" #define _XA__NET_WM_FULLSCREEN_MONITORS "_NET_WM_FULLSCREEN_MONITORS"
#define _XA_NET_WM_STATE "_NET_WM_STATE" #define _XA__NET_WM_STATE "_NET_WM_STATE"
#define _XA_NET_WM_STATE_FULLSCREEN "_NET_WM_STATE_FULLSCREEN" #define _XA__NET_WM_STATE_FULLSCREEN "_NET_WM_STATE_FULLSCREEN"
#define _XA__NET_WM_STATE_MAXIMIZED_VERT "_NET_WM_STATE_MAXIMIZED_VERT"
#define _XA__NET_WM_STATE_MAXIMIZED_HORZ "_NET_WM_STATE_MAXIMIZED_HORZ"
void HandleClientMessageEwmh (ClientData *pCD, void ProcessNetWmFullscreenMonitors (ClientData *pCD,
XClientMessageEvent *clientEvent); long top, long bottom, long left, long right);
void HandlePropertyNotifyEwmh (ClientData *pCD, XPropertyEvent *propertyEvent); void ProcessNetWmState (ClientData *pCD, long action,
long firstProperty, long secondProperty);
void ProcessNetWmName (ClientData *pCD);
void ProcessNetWmIconName (ClientData *pCD);
void SetupWmEwmh (void); void SetupWmEwmh (void);
#endif /* _Dt_WmEwmh_h_ */ #endif /* _Dt_WmEwmh_h_ */

View file

@ -1628,8 +1628,7 @@ typedef struct _ClientData
Window clientBaseWin; /* for matte & reparenting */ Window clientBaseWin; /* for matte & reparenting */
int xBorderWidth; /* original X border width */ int xBorderWidth; /* original X border width */
FrameInfo frameInfo; /* frame geometry data */ FrameInfo frameInfo; /* frame geometry data */
Boolean decorUpdated; /* True => decoration updated */ Boolean isFullscreen; /* True => fullscreen */
Boolean enterFullscreen; /* True => enter fullscreen */
Boolean monitorSizeIsSet; /* True => X, Y, W, H is set */ Boolean monitorSizeIsSet; /* True => X, Y, W, H is set */
int monitorX; /* monitor X loc */ int monitorX; /* monitor X loc */
int monitorY; /* monitor Y loc */ int monitorY; /* monitor Y loc */
@ -1936,11 +1935,13 @@ typedef struct _WmGlobalData
Atom xa_WMSAVE_HINT; Atom xa_WMSAVE_HINT;
Atom xa_UTF8_STRING; Atom xa_UTF8_STRING;
Atom xa_NET_WM_NAME; Atom xa__NET_WM_NAME;
Atom xa_NET_WM_ICON_NAME; Atom xa__NET_WM_ICON_NAME;
Atom xa_NET_WM_FULLSCREEN_MONITORS; Atom xa__NET_WM_FULLSCREEN_MONITORS;
Atom xa_NET_WM_STATE; Atom xa__NET_WM_STATE;
Atom xa_NET_WM_STATE_FULLSCREEN; Atom xa__NET_WM_STATE_FULLSCREEN;
Atom xa__NET_WM_STATE_MAXIMIZED_VERT;
Atom xa__NET_WM_STATE_MAXIMIZED_HORZ;
/* atoms used for workspace management: */ /* atoms used for workspace management: */

View file

@ -1008,7 +1008,7 @@ void WithdrawWindow (ClientData *pCD)
} }
} }
XDeleteProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE); XDeleteProperty (DISPLAY, pCD->client, wmGD.xa__NET_WM_STATE);
XUnmapWindow (DISPLAY, pCD->client); XUnmapWindow (DISPLAY, pCD->client);
XReparentWindow (DISPLAY, pCD->client, ROOT_FOR_CLIENT(pCD), x, y); XReparentWindow (DISPLAY, pCD->client, ROOT_FOR_CLIENT(pCD), x, y);

View file

@ -1934,12 +1934,6 @@ void ProcessNewConfiguration (ClientData *pCD, int x, int y, unsigned int width,
newMax = True; newMax = True;
} }
if (pCD->decorUpdated)
{
changedValues = CWWidth | CWHeight;
pCD->decorUpdated = False;
}
/* /*
* If the configuration has changed, update client data * If the configuration has changed, update client data
* *

View file

@ -56,6 +56,7 @@
#include "WmCDecor.h" #include "WmCDecor.h"
#include "WmCPlace.h" #include "WmCPlace.h"
#include "WmError.h" #include "WmError.h"
#include "WmEwmh.h"
#include "WmIDecor.h" #include "WmIDecor.h"
#include "WmIPlace.h" #include "WmIPlace.h"
#include "WmIconBox.h" #include "WmIconBox.h"
@ -218,8 +219,7 @@ InitClientData (Window clientWindow)
pCD->smClientID = (String)NULL; pCD->smClientID = (String)NULL;
pCD->decorUpdated = False; pCD->isFullscreen = False;
pCD->enterFullscreen = False;
pCD->monitorSizeIsSet = False; pCD->monitorSizeIsSet = False;
for (i = 0; i < STRETCH_COUNT; ++i) pCD->clientStretchWin[i] = (Window)0L; for (i = 0; i < STRETCH_COUNT; ++i) pCD->clientStretchWin[i] = (Window)0L;
@ -261,7 +261,6 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags)
{ {
ClientData *pCD; ClientData *pCD;
XSetWindowAttributes sAttributes; XSetWindowAttributes sAttributes;
XPropertyEvent propertyEvent;
if (!(pCD = InitClientData (clientWindow))) if (!(pCD = InitClientData (clientWindow)))
{ {
@ -421,8 +420,7 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags)
*/ */
ProcessWmWindowTitle (pCD, TRUE); ProcessWmWindowTitle (pCD, TRUE);
propertyEvent.atom = wmGD.xa_NET_WM_NAME; ProcessNetWmName (pCD);
HandlePropertyNotifyEwmh (pCD, &propertyEvent);
/* /*
@ -430,8 +428,7 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags)
*/ */
ProcessWmIconTitle (pCD, TRUE); ProcessWmIconTitle (pCD, TRUE);
propertyEvent.atom = wmGD.xa_NET_WM_ICON_NAME; ProcessNetWmIconName (pCD);
HandlePropertyNotifyEwmh (pCD, &propertyEvent);
/* /*
@ -3861,7 +3858,11 @@ ProcessMwmHints (ClientData *pCD)
{ {
if (pHints->flags & MWM_HINTS_FUNCTIONS) if (pHints->flags & MWM_HINTS_FUNCTIONS)
{ {
if (pHints->functions == WM_FUNC_DEFAULT) if (pHints->functions == WM_FUNC_NONE)
{
pCD->clientFunctions = WM_FUNC_NONE;
}
else if (pHints->functions == WM_FUNC_DEFAULT)
{ {
pCD->clientFunctions = WM_FUNC_ALL; pCD->clientFunctions = WM_FUNC_ALL;
} }
@ -3873,7 +3874,7 @@ ProcessMwmHints (ClientData *pCD)
else else
{ {
/* client indicating applicable functions */ /* client indicating applicable functions */
pCD->clientFunctions &= pHints->functions; pCD->clientFunctions |= pHints->functions;
} }
#if 0 #if 0
if (!(pCD->clientFlags & GOT_DT_WM_HINTS) && if (!(pCD->clientFlags & GOT_DT_WM_HINTS) &&
@ -3894,7 +3895,11 @@ ProcessMwmHints (ClientData *pCD)
if (pHints->flags & MWM_HINTS_DECORATIONS) if (pHints->flags & MWM_HINTS_DECORATIONS)
{ {
if (pHints->decorations == WM_DECOR_DEFAULT) if (pHints->decorations == WM_DECOR_NONE)
{
pCD->clientDecoration = WM_DECOR_NONE;
}
else if (pHints->decorations == WM_DECOR_DEFAULT)
{ {
pCD->clientDecoration = WM_DECOR_ALL; pCD->clientDecoration = WM_DECOR_ALL;
} }
@ -3906,7 +3911,7 @@ ProcessMwmHints (ClientData *pCD)
else else
{ {
/* client indicating decorations to be added */ /* client indicating decorations to be added */
pCD->clientDecoration &= pHints->decorations; pCD->clientDecoration |= pHints->decorations;
} }
/* /*
@ -4007,6 +4012,5 @@ ProcessMwmHints (ClientData *pCD)
pCD->decor = pCD->clientDecoration; /* !!! combine decor ... !!! */ pCD->decor = pCD->clientDecoration; /* !!! combine decor ... !!! */
pCD->decorUpdated = True;
} /* END OF ProcessMwmHints */ } /* END OF ProcessMwmHints */

View file

@ -604,21 +604,27 @@ static void SetupWindowStateWithEventMask (ClientData *pCD, int newState,
void ConfigureNewState (ClientData *pcd) void ConfigureNewState (ClientData *pcd)
{ {
WmHeadInfo_t *WmHI = NULL; if (pcd->maxConfig && !pcd->isFullscreen)
if (pcd->maxConfig)
{ {
pcd->maxConfig = FALSE; pcd->maxConfig = FALSE;
RegenerateClientFrame(pcd); RegenerateClientFrame(pcd);
XResizeWindow (DISPLAY, pcd->client, XResizeWindow (DISPLAY, pcd->client,
(unsigned int) pcd->clientWidth, (unsigned int) pcd->clientWidth,
(unsigned int) pcd->clientHeight); (unsigned int) pcd->clientHeight);
XDeleteProperty (DISPLAY, pcd->client, wmGD.xa_NET_WM_STATE);
} }
else else
{ {
if (pcd->enterFullscreen && pcd->monitorSizeIsSet) long decor;
WmHeadInfo_t *WmHI;
if (pcd->isFullscreen)
{
decor = pcd->decor;
pcd->decor = WM_DECOR_NONE;
SetClientOffset (pcd);
}
if (pcd->isFullscreen && pcd->monitorSizeIsSet)
{ {
pcd->maxX = pcd->monitorX; pcd->maxX = pcd->monitorX;
pcd->maxY = pcd->monitorY; pcd->maxY = pcd->monitorY;
@ -648,15 +654,13 @@ void ConfigureNewState (ClientData *pcd)
pcd->maxConfig = TRUE; pcd->maxConfig = TRUE;
RegenerateClientFrame(pcd); RegenerateClientFrame(pcd);
if (pcd->enterFullscreen) if (pcd->isFullscreen)
XChangeProperty (DISPLAY, pcd->client, wmGD.xa_NET_WM_STATE, {
XA_ATOM, 32, PropModeReplace, pcd->decor = decor;
(unsigned char *) &wmGD.xa_NET_WM_STATE_FULLSCREEN, SetClientOffset (pcd);
1); }
} }
pcd->enterFullscreen = False;
SendConfigureNotify (pcd); SendConfigureNotify (pcd);
/* /*