Konrad, 2026-11-13: "panel fehlt, top leiste is lila", the network settings "zu rudimentaer, keine ip config, kein dns", the global menu only while a program that has one is in front. The bar (and the launcher, the drop-down terminal, the login items) came from Xsession.d, before dtsession had loaded the session's resources and the colour server: dtbar took *background from ~/.Xdefaults (#6e1e7d, the user's base16 theme; dtbar PID 1270788 started before dtsession 1270795). Restarting dtbar in the running session gave the palette's colours. Now dtsession runs sys.sessionetc -- the first of CDE_CONFIGURATION_TOP/config and CDE_INSTALLATION_TOP/config, as sys.session is found -- before the user's sessionetc (SmRestore.c, StartEtc); it sources config/sessionetc.d, where 0080.dtlaunch, 0085.dtdropdown, 0090.dtbar and 0095.loginitems moved. The bar takes colour set 5, the programs' background, not set 6 of a menu bar (Dtbar*secondaryColorSetId: 5; measured #c6b2a8 with Default.dp). dtwm publishes the focused client as _NET_ACTIVE_WINDOW (EWMH, WmEwmh.c SetNetActiveWindow from SetKeyboardFocus and where the focus is dropped); dtbar shows a program's menus only while the active window is the menus' owner, a dialog of it (WM_TRANSIENT_FOR) or a window of the same program (WM_CLIENT_LEADER). Measured on Xvfb with dtwm, dtbar, dtpad and xterm, clicking: dtpad -> its menus, xterm -> M only, dtpad -> its menus again. Network (dtsystemsettings/network.c, docs/reference/netconfig.txt): Show: Network Status (a light and a sentence per card, Configure...) or one card with the tabs TCP/IP (Using DHCP, with manual address, Manually, Off; address, mask, router, DHCP client ID, Renew DHCP Lease; IPv6), DNS (servers, search domains, what resolv.conf has now), Wi-Fi and Ethernet; the lock and Apply Now as Accounts. McdeSys mcde_sys_net_config, _configure, _renew (replacing mcde_sys_net_dhcp, which was declared and implemented nowhere): NetBSD one block per interface in dhcpcd.conf, as ifconfig.if(5) recommends, sysinst's static address in ifconfig.IF read and moved there, applied with dhcpcd -n IF (cross-compiled with the tree's x86_64--netbsd-gcc, not run); Linux the NetworkManager profile (nmcli). mcde_sys_interfaces took the last IPv4 address (the secondary one), now the first. Measured on this host, read only: the pane shows the three cards, 172.20.10.2/28 by DHCP, router 172.20.10.1, DNS 1.1.1.1, MAC, MTU 1500; test_sysinfo (new checks: settings read, 300.1.2.3 refused) exit 0. Nothing was applied on the development host. From the review of 2026-11-12's commits: libDtTerm links libMcdeSound (977a7347c made the bell call McdeSoundEvent; dtcodegen did not link); the PLIST lacked dtphoto, dtpaint, dttoolbox, mcdesoundd, libMcdeSound, their data and the sound themes (51 entries, from the installed tree); mcdesoundd was started by nothing (sessionetc.d/0075.mcdesoundd) and took the selection from a running server; dttoolbox kept only the first line of the Selected menu and rebuilt it every 500 ms, and NewMenu returned an uninitialised pointer past 64 menus. Built and installed with make mcde-host MCDE_DIRS=install, exit 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
334 lines
9.4 KiB
C
334 lines
9.4 KiB
C
/*
|
|
* 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
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "WmGlobal.h"
|
|
#include "WmEvent.h"
|
|
#include "WmFunction.h"
|
|
#include "WmMultiHead.h"
|
|
#include "WmProperty.h"
|
|
#include "WmWinState.h"
|
|
#include "WmWrkspace.h"
|
|
#include "WmMcdeSnap.h"
|
|
|
|
static void ProcessNetWmStateAbove (ClientData *pCD, long action);
|
|
static void ProcessNetWmStateBelow (ClientData *pCD, long action);
|
|
|
|
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 ProcessNetWmStateFullscreen (ClientData *pCD, long action)
|
|
{
|
|
Boolean fullscreen = pCD->fullscreen;
|
|
|
|
switch (action)
|
|
{
|
|
case _NET_WM_STATE_REMOVE:
|
|
if (!fullscreen) return;
|
|
fullscreen = False;
|
|
break;
|
|
case _NET_WM_STATE_ADD:
|
|
if (fullscreen) return;
|
|
fullscreen = True;
|
|
break;
|
|
case _NET_WM_STATE_TOGGLE:
|
|
fullscreen = !fullscreen;
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
|
|
pCD->fullscreen = False;
|
|
SetClientState (pCD, NORMAL_STATE, GetTimestamp ());
|
|
|
|
if (fullscreen) {
|
|
pCD->fullscreen = True;
|
|
SetClientState (pCD, MAXIMIZED_STATE, GetTimestamp ());
|
|
}
|
|
}
|
|
|
|
/* MCDE: f.mcde_fullscreen (WmMcdeSnap.c) */
|
|
void McdeToggleFullscreen (ClientData *pCD)
|
|
{
|
|
ProcessNetWmStateFullscreen (pCD, _NET_WM_STATE_TOGGLE);
|
|
}
|
|
|
|
static void ProcessNetWmStateAbove (ClientData *pCD, long action)
|
|
{
|
|
/* MCDE: the flag of "Always on Top" (McdeSetAbove, WmFunction.c) */
|
|
if (action == _NET_WM_STATE_TOGGLE)
|
|
action = pCD->mcdeAbove ? _NET_WM_STATE_REMOVE : _NET_WM_STATE_ADD;
|
|
|
|
switch (action)
|
|
{
|
|
case _NET_WM_STATE_REMOVE:
|
|
McdeSetAbove (pCD, False);
|
|
break;
|
|
case _NET_WM_STATE_ADD:
|
|
ProcessNetWmStateBelow (pCD, _NET_WM_STATE_REMOVE);
|
|
McdeSetAbove (pCD, True);
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|
|
static void ProcessNetWmStateBelow (ClientData *pCD, long action)
|
|
{
|
|
if (action == _NET_WM_STATE_TOGGLE)
|
|
action = pCD == pCD->pSD->bottomClient ? _NET_WM_STATE_REMOVE :
|
|
_NET_WM_STATE_ADD;
|
|
|
|
switch (action)
|
|
{
|
|
case _NET_WM_STATE_REMOVE:
|
|
if (pCD->pSD->bottomClient == pCD) pCD->pSD->bottomClient = NULL;
|
|
break;
|
|
case _NET_WM_STATE_ADD:
|
|
pCD->pSD->bottomClient = pCD;
|
|
ProcessNetWmStateAbove (pCD, _NET_WM_STATE_REMOVE);
|
|
Do_Lower (pCD, NULL, STACK_NORMAL);
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
|
|
UpdateNetWmState (pCD->client, &wmGD.xa__NET_WM_STATE_BELOW, 1, action);
|
|
}
|
|
|
|
/**
|
|
* @brief Processes the _NET_WM_FULLSCREEN_MONITORS protocol.
|
|
*
|
|
* @param pCD
|
|
* @param top
|
|
* @param bottom
|
|
* @param left
|
|
* @param right
|
|
*/
|
|
void ProcessNetWmFullscreenMonitors (ClientData *pCD,
|
|
int top, int bottom, int left, int right)
|
|
{
|
|
WmHeadInfo_t *pHeadInfo;
|
|
|
|
pCD->fullscreenAuto = True;
|
|
|
|
if (!(pHeadInfo = GetHeadInfoById (top))) return;
|
|
pCD->fullscreenY = pHeadInfo->y_org;
|
|
free(pHeadInfo);
|
|
|
|
if (!(pHeadInfo = GetHeadInfoById (bottom))) return;
|
|
pCD->fullscreenHeight = top == bottom ? pHeadInfo->height :
|
|
pHeadInfo->y_org + pHeadInfo->height;
|
|
free(pHeadInfo);
|
|
|
|
if (!(pHeadInfo = GetHeadInfoById (left))) return;
|
|
pCD->fullscreenX = pHeadInfo->x_org;
|
|
free(pHeadInfo);
|
|
|
|
if (!(pHeadInfo = GetHeadInfoById (right))) return;
|
|
pCD->fullscreenWidth = left == right ? pHeadInfo->width :
|
|
pHeadInfo->x_org + pHeadInfo->width;
|
|
free(pHeadInfo);
|
|
|
|
pCD->fullscreenAuto = False;
|
|
}
|
|
|
|
/**
|
|
* @brief Processes the _NET_WM_STATE client message.
|
|
*
|
|
* @param pCD
|
|
* @param action
|
|
* @param firstProperty
|
|
* @param secondProperty
|
|
*/
|
|
void ProcessNetWmState (ClientData *pCD, long action,
|
|
Atom firstProperty, Atom secondProperty)
|
|
{
|
|
if (pCD->clientState & UNSEEN_STATE) return;
|
|
|
|
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);
|
|
else if (firstProperty == wmGD.xa__NET_WM_STATE_ABOVE ||
|
|
secondProperty == wmGD.xa__NET_WM_STATE_ABOVE)
|
|
ProcessNetWmStateAbove (pCD, action);
|
|
else if (firstProperty == wmGD.xa__NET_WM_STATE_BELOW ||
|
|
secondProperty == wmGD.xa__NET_WM_STATE_BELOW)
|
|
ProcessNetWmStateBelow (pCD, action);
|
|
|
|
if (!ClientInWorkspace (ACTIVE_WS, pCD))
|
|
SetClientState (pCD, pCD->clientState | UNSEEN_STATE, GetTimestamp ());
|
|
}
|
|
|
|
/**
|
|
* @brief Sets up the window manager handling of the EWMH.
|
|
*/
|
|
void SetupWmEwmh (void)
|
|
{
|
|
int scr;
|
|
|
|
enum {
|
|
XA_UTF8_STRING,
|
|
XA__NET_SUPPORTED,
|
|
XA__NET_SUPPORTING_WM_CHECK,
|
|
XA__NET_WM_NAME,
|
|
XA__NET_WM_ICON_NAME,
|
|
XA__NET_WM_VISIBLE_NAME,
|
|
XA__NET_WM_VISIBLE_ICON_NAME,
|
|
XA__NET_WM_FULLSCREEN_MONITORS,
|
|
XA__NET_WM_STATE,
|
|
XA__NET_WM_STATE_MAXIMIZED_VERT,
|
|
XA__NET_WM_STATE_MAXIMIZED_HORZ,
|
|
XA__NET_WM_STATE_FULLSCREEN,
|
|
XA__NET_WM_STATE_ABOVE,
|
|
XA__NET_WM_STATE_BELOW,
|
|
XA__NET_ACTIVE_WINDOW
|
|
};
|
|
|
|
static char *atom_names[] = {
|
|
"UTF8_STRING",
|
|
_XA__NET_SUPPORTED,
|
|
_XA__NET_SUPPORTING_WM_CHECK,
|
|
_XA__NET_WM_NAME,
|
|
_XA__NET_WM_ICON_NAME,
|
|
_XA__NET_WM_VISIBLE_NAME,
|
|
_XA__NET_WM_VISIBLE_ICON_NAME,
|
|
_XA__NET_WM_FULLSCREEN_MONITORS,
|
|
_XA__NET_WM_STATE,
|
|
_XA__NET_WM_STATE_MAXIMIZED_VERT,
|
|
_XA__NET_WM_STATE_MAXIMIZED_HORZ,
|
|
_XA__NET_WM_STATE_FULLSCREEN,
|
|
_XA__NET_WM_STATE_ABOVE,
|
|
_XA__NET_WM_STATE_BELOW,
|
|
_XA__NET_ACTIVE_WINDOW
|
|
};
|
|
|
|
Atom atoms[XtNumber(atom_names) + 1];
|
|
|
|
XInternAtoms(DISPLAY, atom_names, XtNumber(atom_names), False, atoms);
|
|
|
|
wmGD.xa_UTF8_STRING = atoms[XA_UTF8_STRING];
|
|
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_VISIBLE_NAME = atoms[XA__NET_WM_VISIBLE_NAME];
|
|
wmGD.xa__NET_WM_VISIBLE_ICON_NAME = atoms[XA__NET_WM_VISIBLE_ICON_NAME];
|
|
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_MAXIMIZED_VERT =
|
|
atoms[XA__NET_WM_STATE_MAXIMIZED_VERT];
|
|
wmGD.xa__NET_WM_STATE_MAXIMIZED_HORZ =
|
|
atoms[XA__NET_WM_STATE_MAXIMIZED_HORZ];
|
|
wmGD.xa__NET_WM_STATE_FULLSCREEN = atoms[XA__NET_WM_STATE_FULLSCREEN];
|
|
wmGD.xa__NET_WM_STATE_ABOVE = atoms[XA__NET_WM_STATE_ABOVE];
|
|
wmGD.xa__NET_WM_STATE_BELOW = atoms[XA__NET_WM_STATE_BELOW];
|
|
wmGD.xa__NET_ACTIVE_WINDOW = atoms[XA__NET_ACTIVE_WINDOW];
|
|
|
|
for (scr = 0; scr < wmGD.numScreens; ++scr)
|
|
{
|
|
Window childWindow;
|
|
WmScreenData *pSD;
|
|
|
|
pSD = &(wmGD.Screens[scr]);
|
|
|
|
if (!pSD->managed) continue;
|
|
|
|
childWindow = pSD->wmWorkspaceWin;
|
|
|
|
XChangeProperty(DISPLAY, childWindow, atoms[XA__NET_WM_NAME],
|
|
atoms[XA_UTF8_STRING], 8, PropModeReplace,
|
|
(unsigned char *)DT_WM_RESOURCE_NAME, 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],
|
|
13);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @brief Publishes the window with the keyboard focus as _NET_ACTIVE_WINDOW
|
|
* on the root of every managed screen (EWMH), None when the focus is
|
|
* on the root or on an icon. MCDE: the top bar reads it to show a
|
|
* program's menus only while one of its windows is the active one.
|
|
*
|
|
* @param pCD The client that has the focus now, or NULL
|
|
*/
|
|
void SetNetActiveWindow (ClientData *pCD)
|
|
{
|
|
Window w = None;
|
|
int scr;
|
|
|
|
if (wmGD.xa__NET_ACTIVE_WINDOW == None) return;
|
|
|
|
if (pCD && (pCD->clientState == NORMAL_STATE ||
|
|
pCD->clientState == MAXIMIZED_STATE))
|
|
w = pCD->client;
|
|
|
|
for (scr = 0; scr < wmGD.numScreens; ++scr)
|
|
{
|
|
if (!wmGD.Screens[scr].managed) continue;
|
|
|
|
XChangeProperty(DISPLAY, wmGD.Screens[scr].rootWindow,
|
|
wmGD.xa__NET_ACTIVE_WINDOW, XA_WINDOW, 32,
|
|
PropModeReplace, (unsigned char *)&w, 1);
|
|
}
|
|
}
|