mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
dtwm: Add EWMH related source code.
This commit is contained in:
parent
50ea1705c7
commit
e648aab6b1
3 changed files with 331 additions and 15 deletions
|
@ -22,21 +22,21 @@ endif
|
||||||
|
|
||||||
dtwm_SOURCES = WmCDInfo.c WmCDecor.c WmCEvent.c \
|
dtwm_SOURCES = WmCDInfo.c WmCDecor.c WmCEvent.c \
|
||||||
WmCPlace.c WmColormap.c WmError.c \
|
WmCPlace.c WmColormap.c WmError.c \
|
||||||
WmEvent.c WmFeedback.c WmFunction.c \
|
WmEvent.c WmEwmh.c WmFeedback.c \
|
||||||
WmGraphics.c WmIDecor.c WmIPlace.c \
|
WmFunction.c WmGraphics.c WmIDecor.c \
|
||||||
WmIconBox.c WmImage.c WmInitWs.c \
|
WmIPlace.c WmIconBox.c WmImage.c \
|
||||||
WmKeyFocus.c WmMain.c WmManage.c \
|
WmInitWs.c WmKeyFocus.c WmMain.c \
|
||||||
WmMenu.c WmProperty.c WmProtocol.c \
|
WmManage.c WmMenu.c WmProperty.c \
|
||||||
WmResCvt.c WmResParse.c WmResource.c \
|
WmProtocol.c WmResCvt.c WmResParse.c \
|
||||||
WmSignal.c WmWinConf.c WmWinInfo.c \
|
WmResource.c WmSignal.c WmWinConf.c \
|
||||||
WmWinList.c WmWinState.c WmMultiHead.c \
|
WmWinInfo.c WmWinList.c WmWinState.c \
|
||||||
Button.c Callback.c Clock.c \
|
WmMultiHead.c Button.c Callback.c \
|
||||||
DataBaseLoad.c PanelS.c Parse.c \
|
Clock.c DataBaseLoad.c PanelS.c \
|
||||||
PopupMenu.c Session.c UI.c \
|
Parse.c PopupMenu.c Session.c \
|
||||||
WmBackdrop.c WmFP.c WmHelp.c \
|
UI.c WmBackdrop.c WmFP.c \
|
||||||
WmIPC.c WmOL.c WmParse.c \
|
WmHelp.c WmIPC.c WmOL.c \
|
||||||
WmParseP.c WmPresence.c WmWrkspace.c \
|
WmParse.c WmParseP.c WmPresence.c \
|
||||||
WmXSMP.c
|
WmWrkspace.c WmXSMP.c
|
||||||
|
|
||||||
dtfplist_SOURCES = Print.c Parse.c DataBaseLoad.c WmParse.c Session.c
|
dtfplist_SOURCES = Print.c Parse.c DataBaseLoad.c WmParse.c Session.c
|
||||||
|
|
||||||
|
|
273
cde/programs/dtwm/WmEwmh.c
Normal file
273
cde/programs/dtwm/WmEwmh.c
Normal file
|
@ -0,0 +1,273 @@
|
||||||
|
/*
|
||||||
|
* CDE - Common Desktop Environment
|
||||||
|
*
|
||||||
|
* (c) Copyright 1993-2012 The Open Group
|
||||||
|
* (c) Copyright 2012-2022 CDE Project contributors, see
|
||||||
|
* CONTRIBUTORS for details
|
||||||
|
*
|
||||||
|
* These libraries and programs are free software; you can
|
||||||
|
* redistribute them and/or modify them under the terms of the GNU
|
||||||
|
* Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation; either version 2 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* These libraries and programs are distributed in the hope that
|
||||||
|
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with these libraries and programs; if not, write
|
||||||
|
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||||
|
* Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Included Files:
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "WmGlobal.h"
|
||||||
|
#include "WmEwmh.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* include extern functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "WmMultiHead.h"
|
||||||
|
#include "WmProperty.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************<->*************************************
|
||||||
|
*
|
||||||
|
* 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,
|
||||||
|
long top, long bottom, long left, long right)
|
||||||
|
{
|
||||||
|
WmHeadInfo_t *pHeadInfo;
|
||||||
|
|
||||||
|
pCD->monitorSizeIsSet = False;
|
||||||
|
|
||||||
|
pHeadInfo = GetHeadInfoById (top);
|
||||||
|
|
||||||
|
if (!pHeadInfo) return;
|
||||||
|
|
||||||
|
pCD->monitorY = pHeadInfo->y_org;
|
||||||
|
free(pHeadInfo);
|
||||||
|
|
||||||
|
pHeadInfo = GetHeadInfoById (bottom);
|
||||||
|
|
||||||
|
if (!pHeadInfo) return;
|
||||||
|
|
||||||
|
pCD->monitorHeight = top == bottom ? pHeadInfo->height :
|
||||||
|
pHeadInfo->y_org + pHeadInfo->height;
|
||||||
|
free(pHeadInfo);
|
||||||
|
|
||||||
|
pHeadInfo = GetHeadInfoById (left);
|
||||||
|
|
||||||
|
if (!pHeadInfo) return;
|
||||||
|
|
||||||
|
pCD->monitorX = pHeadInfo->x_org;
|
||||||
|
free(pHeadInfo);
|
||||||
|
|
||||||
|
pHeadInfo = GetHeadInfoById (right);
|
||||||
|
|
||||||
|
if (!pHeadInfo) return;
|
||||||
|
|
||||||
|
pCD->monitorWidth = left == right ? pHeadInfo->width :
|
||||||
|
pHeadInfo->x_org + pHeadInfo->width;
|
||||||
|
free(pHeadInfo);
|
||||||
|
|
||||||
|
pCD->monitorSizeIsSet = True;
|
||||||
|
} /* END OF FUNCTION ProcessNetWmFullscreenMonitors */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************<->*************************************
|
||||||
|
*
|
||||||
|
* ProcessNetWmStateFullscreen (pCD, en)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* -----------
|
||||||
|
* This function retrieves the contents of the _NET_WM_STATE_FULLSCREEN
|
||||||
|
* message.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* ------
|
||||||
|
* pCD = pointer to client data
|
||||||
|
* en = enable fullscreen
|
||||||
|
*
|
||||||
|
*************************************<->***********************************/
|
||||||
|
|
||||||
|
static void ProcessNetWmStateFullscreen (ClientData *pCD, Boolean en)
|
||||||
|
{
|
||||||
|
PropMwmHints hints = {0};
|
||||||
|
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;
|
||||||
|
|
||||||
|
pHints->flags |= MWM_HINTS_DECORATIONS;
|
||||||
|
pHints->decorations = en ? WM_DECOR_NONE : WM_DECOR_DEFAULT;
|
||||||
|
|
||||||
|
XChangeProperty (DISPLAY, pCD->client, wmGD.xa_MWM_HINTS, wmGD.xa_MWM_HINTS,
|
||||||
|
32, PropModeReplace, (unsigned char *) pHints,
|
||||||
|
sizeof (PropMwmHints) / sizeof (long));
|
||||||
|
|
||||||
|
if (pHints != &hints) XFree (pHints);
|
||||||
|
|
||||||
|
pCD->isFullscreen = en;
|
||||||
|
|
||||||
|
XSendEvent (DISPLAY, ROOT_FOR_CLIENT (pCD), False, SubstructureRedirectMask,
|
||||||
|
(XEvent *) &clientMsgEvent);
|
||||||
|
|
||||||
|
if (en) XChangeProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE,
|
||||||
|
XA_ATOM, 32, PropModeReplace,
|
||||||
|
(unsigned char *) &wmGD.xa_NET_WM_STATE_FULLSCREEN,
|
||||||
|
1);
|
||||||
|
else XDeleteProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE);
|
||||||
|
} /* END OF FUNCTION ProcessNetWmStateFullscreen */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************<->*************************************
|
||||||
|
*
|
||||||
|
* ProcessEwmh (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 ProcessEwmh (ClientData *pCD, XClientMessageEvent *clientEvent)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
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 ProcessEwmh */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************<->*************************************
|
||||||
|
*
|
||||||
|
* SetupWmEwmh ()
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* -----------
|
||||||
|
* This function sets up the window manager handling of the EWMH.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Outputs:
|
||||||
|
* -------
|
||||||
|
* (wmGD) = Atoms id's are setup.
|
||||||
|
*
|
||||||
|
*************************************<->***********************************/
|
||||||
|
|
||||||
|
void SetupWmEwmh (void)
|
||||||
|
{
|
||||||
|
enum {
|
||||||
|
XA_NET_SUPPORTED,
|
||||||
|
XA_NET_WM_NAME,
|
||||||
|
XA_NET_SUPPORTING_WM_CHECK,
|
||||||
|
XA_NET_WM_FULLSCREEN_MONITORS,
|
||||||
|
XA_NET_WM_STATE,
|
||||||
|
XA_NET_WM_STATE_FULLSCREEN
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *atom_names[] = {
|
||||||
|
_XA_NET_SUPPORTED,
|
||||||
|
_XA_NET_WM_NAME,
|
||||||
|
_XA_NET_SUPPORTING_WM_CHECK,
|
||||||
|
_XA_NET_WM_FULLSCREEN_MONITORS,
|
||||||
|
_XA_NET_WM_STATE,
|
||||||
|
_XA_NET_WM_STATE_FULLSCREEN
|
||||||
|
};
|
||||||
|
|
||||||
|
int scr;
|
||||||
|
Window childWindow;
|
||||||
|
Atom atoms[XtNumber(atom_names) + 1];
|
||||||
|
|
||||||
|
XInternAtoms(DISPLAY, atom_names, XtNumber(atom_names), False, atoms);
|
||||||
|
|
||||||
|
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_FULLSCREEN = atoms[XA_NET_WM_STATE_FULLSCREEN];
|
||||||
|
|
||||||
|
for (scr = 0; scr < wmGD.numScreens; scr++)
|
||||||
|
{
|
||||||
|
childWindow = XCreateSimpleWindow(DISPLAY, wmGD.Screens[scr].rootWindow,
|
||||||
|
-1, -1, 1, 1, 0, 0, 0);
|
||||||
|
|
||||||
|
XChangeProperty(DISPLAY, childWindow, atoms[XA_NET_WM_NAME], None, 32,
|
||||||
|
PropModeReplace, "DTWM", 5);
|
||||||
|
|
||||||
|
XChangeProperty(DISPLAY, childWindow,
|
||||||
|
atoms[XA_NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
|
||||||
|
PropModeReplace, (unsigned char *)&childWindow, 1);
|
||||||
|
|
||||||
|
XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow,
|
||||||
|
atoms[XA_NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
|
||||||
|
PropModeReplace, (unsigned char *)&childWindow, 1);
|
||||||
|
|
||||||
|
XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow,
|
||||||
|
atoms[XA_NET_SUPPORTED], XA_ATOM, 32, PropModeReplace,
|
||||||
|
(unsigned char *)&atoms[XA_NET_SUPPORTING_WM_CHECK], 4);
|
||||||
|
}
|
||||||
|
} /* END OF FUNCTION SetupWmEwmh */
|
43
cde/programs/dtwm/WmEwmh.h
Normal file
43
cde/programs/dtwm/WmEwmh.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* CDE - Common Desktop Environment
|
||||||
|
*
|
||||||
|
* (c) Copyright 1993-2012 The Open Group
|
||||||
|
* (c) Copyright 2012-2022 CDE Project contributors, see
|
||||||
|
* CONTRIBUTORS for details
|
||||||
|
*
|
||||||
|
* These libraries and programs are free software; you can
|
||||||
|
* redistribute them and/or modify them under the terms of the GNU
|
||||||
|
* Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation; either version 2 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* These libraries and programs are distributed in the hope that
|
||||||
|
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with these libraries and programs; if not, write
|
||||||
|
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||||
|
* Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _Dt_WmEwmh_h_
|
||||||
|
#define _Dt_WmEwmh_h_
|
||||||
|
|
||||||
|
#define _NET_WM_STATE_REMOVE 0
|
||||||
|
#define _NET_WM_STATE_ADD 1
|
||||||
|
#define _NET_WM_STATE_TOGGLE 2
|
||||||
|
|
||||||
|
#define _XA_NET_SUPPORTED "_NET_SUPPORTED"
|
||||||
|
#define _XA_NET_WM_NAME "_NET_WM_NAME"
|
||||||
|
#define _XA_NET_SUPPORTING_WM_CHECK "_NET_SUPPORTING_WM_CHECK"
|
||||||
|
#define _XA_NET_WM_FULLSCREEN_MONITORS "_NET_WM_FULLSCREEN_MONITORS"
|
||||||
|
#define _XA_NET_WM_STATE "_NET_WM_STATE"
|
||||||
|
#define _XA_NET_WM_STATE_FULLSCREEN "_NET_WM_STATE_FULLSCREEN"
|
||||||
|
|
||||||
|
void ProcessEwmh (ClientData *pCD, XClientMessageEvent *clientEvent);
|
||||||
|
void SetupWmEwmh (void);
|
||||||
|
|
||||||
|
#endif /* _Dt_WmEwmh_h_ */
|
Loading…
Add table
Add a link
Reference in a new issue