diff --git a/cde/programs/dtwm/Makefile.am b/cde/programs/dtwm/Makefile.am index cfebf0f04..548f7271f 100644 --- a/cde/programs/dtwm/Makefile.am +++ b/cde/programs/dtwm/Makefile.am @@ -22,21 +22,21 @@ endif dtwm_SOURCES = WmCDInfo.c WmCDecor.c WmCEvent.c \ WmCPlace.c WmColormap.c WmError.c \ - WmEvent.c WmFeedback.c WmFunction.c \ - WmGraphics.c WmIDecor.c WmIPlace.c \ - WmIconBox.c WmImage.c WmInitWs.c \ - WmKeyFocus.c WmMain.c WmManage.c \ - WmMenu.c WmProperty.c WmProtocol.c \ - WmResCvt.c WmResParse.c WmResource.c \ - WmSignal.c WmWinConf.c WmWinInfo.c \ - WmWinList.c WmWinState.c WmMultiHead.c \ - Button.c Callback.c Clock.c \ - DataBaseLoad.c PanelS.c Parse.c \ - PopupMenu.c Session.c UI.c \ - WmBackdrop.c WmFP.c WmHelp.c \ - WmIPC.c WmOL.c WmParse.c \ - WmParseP.c WmPresence.c WmWrkspace.c \ - WmXSMP.c + WmEvent.c WmEwmh.c WmFeedback.c \ + WmFunction.c WmGraphics.c WmIDecor.c \ + WmIPlace.c WmIconBox.c WmImage.c \ + WmInitWs.c WmKeyFocus.c WmMain.c \ + WmManage.c WmMenu.c WmProperty.c \ + WmProtocol.c WmResCvt.c WmResParse.c \ + WmResource.c WmSignal.c WmWinConf.c \ + WmWinInfo.c WmWinList.c WmWinState.c \ + WmMultiHead.c Button.c Callback.c \ + Clock.c DataBaseLoad.c PanelS.c \ + Parse.c PopupMenu.c Session.c \ + UI.c WmBackdrop.c WmFP.c \ + WmHelp.c WmIPC.c WmOL.c \ + WmParse.c WmParseP.c WmPresence.c \ + WmWrkspace.c WmXSMP.c dtfplist_SOURCES = Print.c Parse.c DataBaseLoad.c WmParse.c Session.c diff --git a/cde/programs/dtwm/WmCDecor.c b/cde/programs/dtwm/WmCDecor.c index aa296c775..c8d6f3a79 100644 --- a/cde/programs/dtwm/WmCDecor.c +++ b/cde/programs/dtwm/WmCDecor.c @@ -2280,9 +2280,10 @@ void RegenerateClientFrame (ClientData *pcd) } /* resize base window */ - XResizeWindow (DISPLAY, pcd->clientBaseWin, BaseWindowWidth (pcd), - BaseWindowHeight (pcd)); - + XMoveResizeWindow (DISPLAY, pcd->clientBaseWin, + BaseWindowX (pcd), BaseWindowY (pcd), + BaseWindowWidth (pcd), BaseWindowHeight (pcd)); + /* resize the stretcher windows */ if (SHOW_RESIZE_CURSORS(pcd) && (decor & MWM_DECOR_RESIZEH)) { XMoveResizeWindow (DISPLAY, diff --git a/cde/programs/dtwm/WmCEvent.c b/cde/programs/dtwm/WmCEvent.c index 59d224e23..9ce30f7ac 100644 --- a/cde/programs/dtwm/WmCEvent.c +++ b/cde/programs/dtwm/WmCEvent.c @@ -44,8 +44,10 @@ */ #include "WmCEvent.h" #include "WmCDecor.h" +#include "WmCDInfo.h" #include "WmColormap.h" #include "WmEvent.h" +#include "WmEwmh.h" #include "WmFeedback.h" #include "WmFunction.h" #include "WmIDecor.h" @@ -508,6 +510,7 @@ Boolean HandleEventsOnSpecialWindows (XEvent *pEvent) { Boolean dispatchEvent = True; WmScreenData *pSD; + ClientData *pCD; /* @@ -604,6 +607,15 @@ Boolean HandleEventsOnSpecialWindows (XEvent *pEvent) } break; } + + case ClientMessage: + { + if (pCD = InitClientData (pEvent->xclient.window)) { + ProcessEwmh (pCD, (XClientMessageEvent *) pEvent); + dispatchEvent = False; + } + break; + } } } @@ -828,6 +840,22 @@ void HandleCPropertyNotify (ClientData *pCD, XPropertyEvent *propertyEvent) ProcessColormapList (ACTIVE_PSD, pCD); } } + else if (propertyEvent->atom == wmGD.xa_MWM_HINTS) { + long suppliedReturn; + XSizeHints hintsReturn = {0}; + + XGetWMNormalHints (DISPLAY, pCD->client, &hintsReturn, + &suppliedReturn); + + hintsReturn.flags |= P_MAX_SIZE; + hintsReturn.max_width = -1; + hintsReturn.max_height = -1; + + XSetWMNormalHints (DISPLAY, pCD->client, &hintsReturn); + + ProcessMwmHints (pCD); + SetClientOffset (pCD); + } break; } } @@ -2547,7 +2575,20 @@ void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent) } else if (clientEvent->data.l[0] == NormalState) { - newState = NORMAL_STATE; + if (pCD->isFullscreen) + { + SetClientState (pCD, NORMAL_STATE, GetTimestamp ()); + newState = MAXIMIZED_STATE; + } + else + { + if (pCD->decorUpdated) + { + SetClientState (pCD, MAXIMIZED_STATE, GetTimestamp ()); + } + + newState = NORMAL_STATE; + } } if (!ClientInWorkspace (ACTIVE_WS, pCD)) { @@ -2557,7 +2598,10 @@ void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent) SetClientState (pCD, newState, GetTimestamp ()); } - + else + { + ProcessEwmh (pCD, clientEvent); + } } /* END OF FUNCTION HandleClientMessage */ diff --git a/cde/programs/dtwm/WmEwmh.c b/cde/programs/dtwm/WmEwmh.c new file mode 100644 index 000000000..fbafdf9bb --- /dev/null +++ b/cde/programs/dtwm/WmEwmh.c @@ -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 */ diff --git a/cde/programs/dtwm/WmEwmh.h b/cde/programs/dtwm/WmEwmh.h new file mode 100644 index 000000000..5dd7d9480 --- /dev/null +++ b/cde/programs/dtwm/WmEwmh.h @@ -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_ */ diff --git a/cde/programs/dtwm/WmGlobal.h b/cde/programs/dtwm/WmGlobal.h index 10718ebad..891c4fb2e 100644 --- a/cde/programs/dtwm/WmGlobal.h +++ b/cde/programs/dtwm/WmGlobal.h @@ -1628,6 +1628,13 @@ typedef struct _ClientData Window clientBaseWin; /* for matte & reparenting */ int xBorderWidth; /* original X border width */ FrameInfo frameInfo; /* frame geometry data */ + Boolean decorUpdated; /* True => decoration updated */ + Boolean isFullscreen; /* True => fullscreen */ + Boolean monitorSizeIsSet; /* True => X, Y, W, H is set */ + int monitorX; /* monitor X loc */ + int monitorY; /* monitor Y loc */ + int monitorWidth; /* monitor width */ + int monitorHeight; /* monitor height */ /* client window frame graphic data: */ @@ -1826,6 +1833,7 @@ typedef struct _WmGlobalData Widget topLevelW1; /* from which WM components hang */ Boolean confirmDialogMapped; /* confirm dialog is mapped */ XtAppContext mwmAppContext; /* application context for mwm */ + XContext tmpWindowContextType; /* temporary window context */ XContext windowContextType; /* window context for XSaveContext */ XContext screenContextType; /* screen context for XSaveContext */ #ifndef IBM_169380 @@ -1927,6 +1935,9 @@ typedef struct _WmGlobalData Atom xa_SM_CLIENT_ID; Atom xa_WMSAVE_HINT; + Atom xa_NET_WM_FULLSCREEN_MONITORS; + Atom xa_NET_WM_STATE; + Atom xa_NET_WM_STATE_FULLSCREEN; /* atoms used for workspace management: */ diff --git a/cde/programs/dtwm/WmInitWs.c b/cde/programs/dtwm/WmInitWs.c index 4e41ba54d..c70b2c195 100644 --- a/cde/programs/dtwm/WmInitWs.c +++ b/cde/programs/dtwm/WmInitWs.c @@ -87,6 +87,7 @@ typedef struct #include "WmColormap.h" #include "WmError.h" #include "WmEvent.h" +#include "WmEwmh.h" #include "WmFeedback.h" #include "WmFunction.h" #include "WmIDecor.h" @@ -410,6 +411,7 @@ void InitWmGlobal (int argc, char *argv [], char *environ []) * Do (pre-toolkit) initialization: */ + wmGD.tmpWindowContextType = XUniqueContext (); wmGD.windowContextType = XUniqueContext (); wmGD.screenContextType = XUniqueContext (); #ifndef IBM_169380 @@ -1001,6 +1003,9 @@ void InitWmGlobal (int argc, char *argv [], char *environ []) /* setup window manager inter-client communications conventions handling */ SetupWmICCC (); + /* setup EWMH handling */ + SetupWmEwmh (); + /* * Use the WM_SAVE_YOURSELF protocol * for notification of when to save ourself diff --git a/cde/programs/dtwm/WmMultiHead.c b/cde/programs/dtwm/WmMultiHead.c index dc3eb811f..b42f1e130 100644 --- a/cde/programs/dtwm/WmMultiHead.c +++ b/cde/programs/dtwm/WmMultiHead.c @@ -113,3 +113,59 @@ WmHeadInfo_t *GetHeadInfo(const ClientData *pcd) { /* No valid screen */ return NULL; } + + +/*************************************<->************************************* + * + * GetHeadInfoById (id) + * + * + * Description: + * ----------- + * Search for the head by ID. + * + * + * Inputs: + * ------ + * + * + * Outputs: + * ------- + * Return = head metrics on success, NULL on failure. + * + * + * Comments: + * -------- + * + * Can fail if: + * + * - MultiHead(eg. Xinerama) is not active + * - malloc error + * - id is less than 0 + * + *************************************<->***********************************/ +WmHeadInfo_t *GetHeadInfoById(int id) { + WmHeadInfo_t *WmHI = NULL; + + if (!DtXI) + DtXI = _DtXineramaInit(DISPLAY); + + if (id < 0 || !DtXI) + return NULL; + + if (!(WmHI = (WmHeadInfo_t *)malloc(sizeof(WmHeadInfo_t)))) { +#ifdef DEBUG + fprintf(stderr, "(dtwm) _GetHeadInfoById: malloc failed\n"); +#endif + + free(DtXI); + return NULL; + } + + if (_DtXineramaGetScreen(DtXI, id, + &WmHI->width, &WmHI->height, &WmHI->x_org, &WmHI->y_org)) + return WmHI; + + free(WmHI); + return NULL; +} diff --git a/cde/programs/dtwm/WmMultiHead.h b/cde/programs/dtwm/WmMultiHead.h index 000cbdb6d..3e4884472 100644 --- a/cde/programs/dtwm/WmMultiHead.h +++ b/cde/programs/dtwm/WmMultiHead.h @@ -33,5 +33,6 @@ typedef struct _WmHeadInfo { } WmHeadInfo_t, *WmHeadInfoPtr_t; WmHeadInfo_t *GetHeadInfo(const ClientData *pcd); +WmHeadInfo_t *GetHeadInfoById(int id); #endif /* _WmMultiHead_h */ diff --git a/cde/programs/dtwm/WmWinConf.c b/cde/programs/dtwm/WmWinConf.c index c3dd6aa81..397a7c785 100644 --- a/cde/programs/dtwm/WmWinConf.c +++ b/cde/programs/dtwm/WmWinConf.c @@ -1934,6 +1934,12 @@ void ProcessNewConfiguration (ClientData *pCD, int x, int y, unsigned int width, newMax = True; } + if (pCD->decorUpdated) + { + changedValues = CWWidth | CWHeight; + pCD->decorUpdated = False; + } + /* * If the configuration has changed, update client data * diff --git a/cde/programs/dtwm/WmWinInfo.c b/cde/programs/dtwm/WmWinInfo.c index 9688aaa98..f1dc6d185 100644 --- a/cde/programs/dtwm/WmWinInfo.c +++ b/cde/programs/dtwm/WmWinInfo.c @@ -89,7 +89,7 @@ WmWorkspaceData *pIconBoxInitialWS; /*************************************<->************************************* * - * GetClientInfo (pSD, clientWindow, manageFlags) + * InitClientData (clientWindow) * * * Description: @@ -100,13 +100,9 @@ WmWorkspaceData *pIconBoxInitialWS; * * Inputs: * ------ - * pSD = pointer to screen data for screen that client lives in - * * clientWindow = window id for the client window that is to be managed * - * manageFlags = flags that indicate wm state info * - * * Outputs: * ------- * Return = pointer to an initialized client data structure for the @@ -114,13 +110,23 @@ WmWorkspaceData *pIconBoxInitialWS; * *************************************<->***********************************/ -ClientData * -GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags) - +ClientData * +InitClientData (Window clientWindow) { ClientData *pCD; - XSetWindowAttributes sAttributes; + if (!XFindContext (DISPLAY, clientWindow, wmGD.windowContextType, + (caddr_t *)&pCD)) + { + XDeleteContext(DISPLAY, clientWindow, wmGD.tmpWindowContextType); + return (pCD); + } + + if (!XFindContext (DISPLAY, clientWindow, wmGD.tmpWindowContextType, + (caddr_t *)&pCD)) + { + return (pCD); + } /* * Allocate and initialize a client data structure: @@ -133,13 +139,15 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags) return (NULL); } - + XSaveContext (DISPLAY, clientWindow, wmGD.tmpWindowContextType, + (caddr_t)pCD); + + /* * Initialize the data structure: */ pCD->client = clientWindow; - pCD->clientID = ++(pSD->clientCounter); pCD->clientFlags = WM_INITIALIZATION; pCD->iconFlags = 0; pCD->thisIconBox = NULL; @@ -200,7 +208,6 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags) pCD->maxWidth = pCD->maxWidthLimit = BIGSIZE; pCD->maxHeight = pCD->maxHeightLimit = BIGSIZE; pCD->maxConfig = FALSE; - pCD->pSD = pSD; pCD->dataType = CLIENT_DATA_TYPE; pCD->window_status = 0L; @@ -210,6 +217,59 @@ GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags) pCD->smClientID = (String)NULL; + pCD->decorUpdated = False; + pCD->isFullscreen = False; + pCD->monitorSizeIsSet = False; + + return (pCD); +} /* END OF FUNCTION InitClientData */ + + + +/*************************************<->************************************* + * + * GetClientInfo (pSD, clientWindow, manageFlags) + * + * + * Description: + * ----------- + * This function is used to get client window data. + * + * + * Inputs: + * ------ + * pSD = pointer to screen data for screen that client lives in + * + * clientWindow = window id for the client window that is to be managed + * + * manageFlags = flags that indicate wm state info + * + * + * Outputs: + * ------- + * Return = pointer to an initialized client data structure for the + * specified client window + * + *************************************<->***********************************/ + +ClientData * +GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags) + +{ + ClientData *pCD; + XSetWindowAttributes sAttributes; + + if (!(pCD = InitClientData (clientWindow))) + { + return (NULL); + } + + XDeleteContext(DISPLAY, clientWindow, wmGD.tmpWindowContextType); + + pCD->clientID = ++(pSD->clientCounter); + pCD->pSD = pSD; + + /* * Do special processing for client windows that are controlled by * the window manager. @@ -3793,7 +3853,11 @@ ProcessMwmHints (ClientData *pCD) { if (pHints->flags & MWM_HINTS_FUNCTIONS) { - if (pHints->functions & MWM_FUNC_ALL) + if (pHints->functions == WM_FUNC_DEFAULT) + { + pCD->clientFunctions = WM_FUNC_ALL; + } + else if (pHints->functions & WM_FUNC_DEFAULT) { /* client indicating inapplicable functions */ pCD->clientFunctions &= ~(pHints->functions); @@ -3822,7 +3886,11 @@ ProcessMwmHints (ClientData *pCD) if (pHints->flags & MWM_HINTS_DECORATIONS) { - if (pHints->decorations & MWM_DECOR_ALL) + if (pHints->decorations == WM_DECOR_DEFAULT) + { + pCD->clientDecoration = WM_DECOR_ALL; + } + else if (pHints->decorations & WM_DECOR_DEFAULT) { /* client indicating decorations to be removed */ pCD->clientDecoration &= ~(pHints->decorations); @@ -3931,5 +3999,6 @@ ProcessMwmHints (ClientData *pCD) pCD->decor = pCD->clientDecoration; /* !!! combine decor ... !!! */ + pCD->decorUpdated = True; } /* END OF ProcessMwmHints */ diff --git a/cde/programs/dtwm/WmWinInfo.h b/cde/programs/dtwm/WmWinInfo.h index 9ccdcd42c..e9405344f 100644 --- a/cde/programs/dtwm/WmWinInfo.h +++ b/cde/programs/dtwm/WmWinInfo.h @@ -39,6 +39,7 @@ extern void FixWindowConfiguration (ClientData *pCD, unsigned int *pWidth, extern void FixWindowSize (ClientData *pCD, unsigned int *pWidth, unsigned int *pHeight, unsigned int widthInc, unsigned int heightInc); +extern ClientData *InitClientData (Window clientWindow); extern ClientData *GetClientInfo (WmScreenData *pSD, Window clientWindow, long manageFlags); extern ClientData *GetWmClientInfo (WmWorkspaceData *pWS, ClientData *pCD, diff --git a/cde/programs/dtwm/WmWinState.c b/cde/programs/dtwm/WmWinState.c index 5c02c0d36..22ab205c0 100644 --- a/cde/programs/dtwm/WmWinState.c +++ b/cde/programs/dtwm/WmWinState.c @@ -181,6 +181,7 @@ void SetClientStateWithEventMask (ClientData *pCD, int newState, Time setTime, u * WM_STATE property is set in WithdrawWindow. */ + XDeleteProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE); UnManageWindow (pCD); break; } @@ -616,17 +617,29 @@ void ConfigureNewState (ClientData *pcd) } else { - /* - * Update client config to reflect underlying head, if MultiHead is active - */ - if (WmHI = GetHeadInfo(pcd)) { - FrameToClient(pcd, &WmHI->x_org, &WmHI->y_org, - &WmHI->width, &WmHI->height); - pcd->maxX = WmHI->x_org; - pcd->maxY = WmHI->y_org; - pcd->maxWidth = WmHI->width; - pcd->maxHeight = WmHI->height; - } + if (pcd->isFullscreen && pcd->monitorSizeIsSet) + { + pcd->maxX = pcd->monitorX; + pcd->maxY = pcd->monitorY; + pcd->maxWidth = pcd->monitorWidth; + pcd->maxHeight = pcd->monitorHeight; + + FrameToClient(pcd, &pcd->maxX, &pcd->maxY, &pcd->maxWidth, + &pcd->maxHeight); + } + else if (WmHI = GetHeadInfo(pcd)) { + /* + * Update client config to reflect underlying head, if MultiHead is + * active + */ + FrameToClient(pcd, &WmHI->x_org, &WmHI->y_org, + &WmHI->width, &WmHI->height); + pcd->maxX = WmHI->x_org; + pcd->maxY = WmHI->y_org; + pcd->maxWidth = WmHI->width; + pcd->maxHeight = WmHI->height; + free(WmHI); + } XResizeWindow (DISPLAY, pcd->client, (unsigned int) pcd->maxWidth,