mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
dtwm: optimize EWMH processing.
This commit is contained in:
parent
a90666402c
commit
0011ed2f70
4 changed files with 58 additions and 79 deletions
|
@ -748,18 +748,6 @@ void HandleCPropertyNotify (ClientData *pCD, XPropertyEvent *propertyEvent)
|
|||
break;
|
||||
}
|
||||
|
||||
case XA_WM_NAME:
|
||||
{
|
||||
ProcessWmWindowTitle (pCD, FALSE /*not first time*/);
|
||||
break;
|
||||
}
|
||||
|
||||
case XA_WM_ICON_NAME:
|
||||
{
|
||||
ProcessWmIconTitle (pCD, FALSE /*not first time*/);
|
||||
break;
|
||||
}
|
||||
|
||||
case XA_WM_CLASS:
|
||||
{
|
||||
|
||||
|
@ -868,13 +856,15 @@ void HandleCPropertyNotify (ClientData *pCD, XPropertyEvent *propertyEvent)
|
|||
ProcessMwmHints (pCD);
|
||||
SetClientOffset (pCD);
|
||||
}
|
||||
else if (propertyEvent->atom == wmGD.xa__NET_WM_NAME)
|
||||
else if (propertyEvent->atom == XA_WM_NAME ||
|
||||
propertyEvent->atom == wmGD.xa__NET_WM_NAME)
|
||||
{
|
||||
ProcessNetWmName (pCD);
|
||||
ProcessWmWindowTitle (pCD, FALSE /*not first time*/);
|
||||
}
|
||||
else if (propertyEvent->atom == wmGD.xa__NET_WM_ICON_NAME)
|
||||
else if (propertyEvent->atom == XA_WM_ICON_NAME ||
|
||||
propertyEvent->atom == wmGD.xa__NET_WM_ICON_NAME)
|
||||
{
|
||||
ProcessNetWmIconName (pCD);
|
||||
ProcessWmIconTitle (pCD, FALSE /*not first time*/);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -145,30 +145,6 @@ static void ProcessNetWmStateMaximized (ClientData *pCD, long action)
|
|||
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.
|
||||
*
|
||||
|
@ -246,26 +222,6 @@ void ProcessNetWmState (ClientData *pCD, long action,
|
|||
UpdateNetWmState (pCD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Processes the _NET_WM_NAME property.
|
||||
*
|
||||
* @param pCD
|
||||
*/
|
||||
void ProcessNetWmName (ClientData *pCD)
|
||||
{
|
||||
ProcessNetWmNameNetWmIconName (pCD, wmGD.xa__NET_WM_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Processes the _NET_WM_ICON_NAME property.
|
||||
*
|
||||
* @param pCD
|
||||
*/
|
||||
void ProcessNetWmIconName (ClientData *pCD)
|
||||
{
|
||||
ProcessNetWmNameNetWmIconName (pCD, wmGD.xa__NET_WM_ICON_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets up the window manager handling of the EWMH.
|
||||
*/
|
||||
|
@ -326,7 +282,7 @@ void SetupWmEwmh (void)
|
|||
|
||||
XChangeProperty(DISPLAY, childWindow, atoms[XA__NET_WM_NAME],
|
||||
atoms[XA_UTF8_STRING], 8, PropModeReplace,
|
||||
DT_WM_RESOURCE_NAME, 5);
|
||||
(unsigned char *)DT_WM_RESOURCE_NAME, 5);
|
||||
|
||||
XChangeProperty(DISPLAY, childWindow,
|
||||
atoms[XA__NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _Dt_WmEwmh_h_
|
||||
#define _Dt_WmEwmh_h_
|
||||
#ifndef WMEWMH_H
|
||||
#define WMEWMH_H
|
||||
|
||||
#define _NET_WM_STATE_REMOVE 0
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
|
@ -46,8 +46,6 @@ void ProcessNetWmFullscreenMonitors (ClientData *pCD,
|
|||
long top, long bottom, long left, long right);
|
||||
void ProcessNetWmState (ClientData *pCD, long action,
|
||||
long firstProperty, long secondProperty);
|
||||
void ProcessNetWmName (ClientData *pCD);
|
||||
void ProcessNetWmIconName (ClientData *pCD);
|
||||
void SetupWmEwmh (void);
|
||||
|
||||
#endif /* _Dt_WmEwmh_h_ */
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "WmCDecor.h"
|
||||
#include "WmCPlace.h"
|
||||
#include "WmError.h"
|
||||
#include "WmEwmh.h"
|
||||
#include "WmIDecor.h"
|
||||
#include "WmIPlace.h"
|
||||
#include "WmIconBox.h"
|
||||
|
@ -420,7 +419,6 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags)
|
|||
*/
|
||||
|
||||
ProcessWmWindowTitle (pCD, TRUE);
|
||||
ProcessNetWmName (pCD);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -428,7 +426,6 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags)
|
|||
*/
|
||||
|
||||
ProcessWmIconTitle (pCD, TRUE);
|
||||
ProcessNetWmIconName (pCD);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -2204,16 +2201,35 @@ WmICCCMToXmString (XTextProperty *wmNameProp)
|
|||
void
|
||||
ProcessWmWindowTitle (ClientData *pCD, Boolean firstTime)
|
||||
{
|
||||
Atom actualType;
|
||||
int actualFormat;
|
||||
unsigned long nitems;
|
||||
unsigned long leftover;
|
||||
char *netWmNameProp;
|
||||
XTextProperty wmNameProp;
|
||||
XmString title_xms = NULL;
|
||||
Window win = pCD->client;
|
||||
Boolean hasWmName = HasProperty (pCD, XA_WM_NAME);
|
||||
Boolean hasNetWmName = HasProperty (pCD, wmGD.xa__NET_WM_NAME);
|
||||
|
||||
if ((pCD->clientDecoration & MWM_DECOR_TITLE) &&
|
||||
(!firstTime || HasProperty (pCD, XA_WM_NAME)) &&
|
||||
XGetWMName(DISPLAY, pCD->client, &wmNameProp))
|
||||
(!firstTime || hasWmName || hasNetWmName))
|
||||
{
|
||||
title_xms = WmICCCMToXmString(&wmNameProp);
|
||||
if (wmNameProp.value)
|
||||
XFree ((char*)wmNameProp.value);
|
||||
if ((!firstTime || hasNetWmName) &&
|
||||
XGetWindowProperty (DISPLAY, win, wmGD.xa__NET_WM_NAME, 0L,
|
||||
1000000L, False, wmGD.xa_UTF8_STRING,
|
||||
&actualType, &actualFormat, &nitems, &leftover,
|
||||
(unsigned char **) &netWmNameProp) == Success)
|
||||
{
|
||||
title_xms = XmStringCreateLocalized (netWmNameProp);
|
||||
XFree (netWmNameProp);
|
||||
}
|
||||
else if ((!firstTime || hasWmName) &&
|
||||
XGetWMName(DISPLAY, win, &wmNameProp))
|
||||
{
|
||||
title_xms = WmICCCMToXmString(&wmNameProp);
|
||||
if (wmNameProp.value) XFree ((char*)wmNameProp.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (title_xms)
|
||||
|
@ -2418,17 +2434,36 @@ FixSubpanelEmbeddedClientGeometry (ClientData *pCD)
|
|||
void
|
||||
ProcessWmIconTitle (ClientData *pCD, Boolean firstTime)
|
||||
{
|
||||
Atom actualType;
|
||||
int actualFormat;
|
||||
unsigned long nitems;
|
||||
unsigned long leftover;
|
||||
char *netWmIconNameProp;
|
||||
XTextProperty wmIconNameProp;
|
||||
XmString icon_xms = NULL;
|
||||
Window win = pCD->client;
|
||||
Boolean hasWmIconName = HasProperty (pCD, XA_WM_ICON_NAME);
|
||||
Boolean hasNetWmIconName = HasProperty (pCD, wmGD.xa__NET_WM_ICON_NAME);
|
||||
|
||||
if ((pCD->clientFunctions & MWM_FUNC_MINIMIZE) &&
|
||||
(pCD->transientLeader == NULL) &&
|
||||
(!firstTime || HasProperty(pCD, XA_WM_ICON_NAME)) &&
|
||||
XGetWMIconName (DISPLAY, pCD->client, &wmIconNameProp))
|
||||
(!firstTime || hasWmIconName || hasNetWmIconName))
|
||||
{
|
||||
icon_xms = WmICCCMToXmString(&wmIconNameProp);
|
||||
if (wmIconNameProp.value)
|
||||
XFree ((char*)wmIconNameProp.value);
|
||||
if ((!firstTime || hasNetWmIconName) &&
|
||||
XGetWindowProperty (DISPLAY, win, wmGD.xa__NET_WM_ICON_NAME, 0L,
|
||||
1000000L, False, wmGD.xa_UTF8_STRING, &actualType,
|
||||
&actualFormat, &nitems, &leftover,
|
||||
(unsigned char **) &netWmIconNameProp) == Success)
|
||||
{
|
||||
icon_xms = XmStringCreateLocalized (netWmIconNameProp);
|
||||
XFree (netWmIconNameProp);
|
||||
}
|
||||
else if ((!firstTime || hasWmIconName) &&
|
||||
XGetWMIconName (DISPLAY, win, &wmIconNameProp))
|
||||
{
|
||||
icon_xms = WmICCCMToXmString(&wmIconNameProp);
|
||||
if (wmIconNameProp.value) XFree ((char*)wmIconNameProp.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (icon_xms)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue