arch: drop USE_DOCK_XDND guards from shared src/

The XDND-on-dock feature was a configure-time toggle (--disable-xdnd)
gating ~25 #ifdef sites across shared src/.  This was a pre-Wayland
feature flag, not a backend distinction, but it polluted the policy
layer with build-time conditionals.

Make it unconditional:

  configure.ac    Remove --disable-xdnd and AM_CONDITIONAL.  XDND on
                  the dock is always built.
  src/Makefile.am Move xdnd.c from the if-USE_DOCK_XDND block into
                  the unconditional wmaker_SOURCES list.
  src/dock.h, dock.c, dockedapp.c, appicon.h, appicon.c, event.c,
  misc.c, startup.c, dialog.c, screen.h
                  Strip all #ifdef USE_DOCK_XDND/#endif pairs.  In
                  dockedapp.c the #else branch (rendering an 'XDnD
                  support was not compiled in' label) is dead and
                  removed.

Backend routing: the X11 backend continues to drive the XDND protocol
through xdnd.c via the existing xdnd_process_client_message /
xdnd_process_selection / xdnd_make_awareness vtable slots.  Wayland's
slots are no-ops (XWayland clients drop into the X11 path naturally
via wl_state.x_display).

src/ is now free of feature-flag guards related to DnD.
This commit is contained in:
Window Maker 2026-05-24 08:55:43 +02:00
parent d79f7b5243
commit eaea7464b2
14 changed files with 24476 additions and 85 deletions

8
+cmd
View File

@ -1,5 +1,5 @@
Xwayland :1
DISPLAY=':1' wmaker --for-real
Xwayland :3
DISPLAY=':3' gdb -batch -ex 'set confirm off' -ex 'set filename-display absolute' -ex run -ex bt -ex quit --args src/.libs/wmaker --for-real >[2=1]
WMAKER_USE_WAYLAND='1' WMAKER_WAYLAND_NESTED='1' LD_LIBRARY_PATH='/usr/local/lib' gdb -batch -ex 'set confirm off' -ex 'set filename-display absolute' -ex run -ex bt -ex quit --args src/.libs/wmaker --for-real >[2=1]
@ -10,4 +10,6 @@ make clean
make -j8 CFLAGS='-fsanitize=leak' LDFLAGS='-fsanitize=leak'
win sudo make install
git stash pop
git stash pop
git status
git diff --stat

View File

@ -548,19 +548,13 @@ AS_IF([test "x$enable_modelock" = "xyes"],
dnl XDND Drag-nd-Drop support
dnl =========================
m4_divert_push([INIT_PREPARE])dnl
AC_ARG_ENABLE([xdnd],
[AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
[AS_CASE(["$enableval"],
[yes|no], [],
[AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
[enable_xdnd=yes])
m4_divert_pop([INIT_PREPARE])dnl
AS_IF([test "x$enable_xdnd" = "xyes"],
[supported_core="$supported_core XDnD"
AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
[unsupported="$unsupported XDnd"])
AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_xdnd" != "xno"])
dnl Drag-and-Drop on the dock is always enabled. The XDND code path is
dnl backend-routed: the X11 backend implements it via xdnd.c; the
dnl Wayland backend is a no-op (XWayland clients drop into the X11
dnl path naturally). No build-time toggle.
supported_core="$supported_core XDnD"
dnl Support for ICCCM 2.0 Window Manager replacement

24465
configure~ Executable file

File diff suppressed because it is too large Load Diff

View File

@ -83,6 +83,7 @@ wmaker_SOURCES = \
texture.h \
usermenu.c \
usermenu.h \
xdnd.c \
xdnd.h \
xinerama.h \
xinerama.c \
@ -120,9 +121,6 @@ wmaker_SOURCES = \
wsmap.c \
wsmap.h
if USE_DOCK_XDND
wmaker_SOURCES += xdnd.c
endif
if USE_MWM_HINTS
wmaker_SOURCES += motif.h motif.c
endif

View File

@ -49,9 +49,7 @@
#include "placement.h"
#include "misc.h"
#include "event.h"
#ifdef USE_DOCK_XDND
#include "xdnd.h"
#endif
/*
* icon_file for the dock is got from the preferences file by
@ -128,9 +126,7 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *w
tile = TILE_CLIP;
aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile);
#ifdef USE_DOCK_XDND
wm_backend->xdnd_make_awareness(aicon->icon->core->window);
#endif
/* will be overriden by dock */
aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
@ -312,9 +308,7 @@ static WAppIcon *wAppIconCreate(WWindow *leader_win)
aicon->wm_instance = wstrdup(leader_win->wm_instance);
aicon->icon = icon_create_for_wwindow(leader_win);
#ifdef USE_DOCK_XDND
wm_backend->xdnd_make_awareness(aicon->icon->core->window);
#endif
/* will be overriden if docked */
aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
@ -335,10 +329,8 @@ void wAppIconDestroy(WAppIcon * aicon)
wIconDestroy(aicon->icon);
if (aicon->command)
wfree(aicon->command);
#ifdef USE_DOCK_XDND
if (aicon->dnd_command)
wfree(aicon->dnd_command);
#endif
if (aicon->wm_instance)
wfree(aicon->wm_instance);

View File

@ -37,10 +37,8 @@ typedef struct WAppIcon {
WIcon *icon;
int x_pos, y_pos; /* absolute screen coordinate */
char *command; /* command used to launch app */
#ifdef USE_DOCK_XDND
char *dnd_command; /* command to use when something is */
/* dropped on us */
#endif
char *paste_command; /* command to run when
* something is pasted */
char *wm_class;

View File

@ -1430,9 +1430,7 @@ void wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, ", MWM");
#endif
#ifdef USE_DOCK_XDND
strbuf = wstrappend(strbuf, ", XDnD");
#endif
#ifdef USE_XRES
strbuf = wstrappend(strbuf, ", XRes");

View File

@ -73,9 +73,7 @@
static WMPropList *dCommand = NULL;
static WMPropList *dPasteCommand = NULL;
#ifdef USE_DOCK_XDND
static WMPropList *dDropCommand = NULL;
#endif
static WMPropList *dAutoLaunch, *dLock;
static WMPropList *dName, *dForced, *dBuggyApplication, *dYes, *dNo;
static WMPropList *dHost, *dDock, *dClip;
@ -136,9 +134,7 @@ static void make_keys(void)
dCommand = WMRetainPropList(WMCreatePLString("Command"));
dPasteCommand = WMRetainPropList(WMCreatePLString("PasteCommand"));
#ifdef USE_DOCK_XDND
dDropCommand = WMRetainPropList(WMCreatePLString("DropCommand"));
#endif
dLock = WMRetainPropList(WMCreatePLString("Lock"));
dAutoLaunch = WMRetainPropList(WMCreatePLString("AutoLaunch"));
dName = WMRetainPropList(WMCreatePLString("Name"));
@ -1422,14 +1418,11 @@ static WMPropList *make_icon_state(WAppIcon *btn)
if (btn->dock != btn->icon->core->screen_ptr->dock && (btn->xindex != 0 || btn->yindex != 0))
WMPutInPLDictionary(node, dOmnipresent, omnipresent);
#ifdef USE_DOCK_XDND
if (btn->dnd_command) {
command = WMCreatePLString(btn->dnd_command);
WMPutInPLDictionary(node, dDropCommand, command);
WMReleasePropList(command);
}
#endif /* USE_DOCK_XDND */
if (btn->paste_command) {
command = WMCreatePLString(btn->paste_command);
WMPutInPLDictionary(node, dPasteCommand, command);
@ -1609,11 +1602,9 @@ static WAppIcon *restore_icon_state(WScreen *scr, WMPropList *info, int type, in
aicon->icon->core->descriptor.parent_type = WCLASS_DOCK_ICON;
aicon->icon->core->descriptor.parent = aicon;
#ifdef USE_DOCK_XDND
cmd = WMGetFromPLDictionary(info, dDropCommand);
if (cmd)
aicon->dnd_command = wstrdup(WMGetFromPLString(cmd));
#endif
cmd = WMGetFromPLDictionary(info, dPasteCommand);
if (cmd)
@ -1696,11 +1687,9 @@ WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state)
wScreenKeepInside(scr, &icon->x_pos, &icon->y_pos, ICON_SIZE, ICON_SIZE);
}
}
#ifdef USE_DOCK_XDND
value = WMGetFromPLDictionary(clip_state, dDropCommand);
if (value && WMIsPLString(value))
icon->dnd_command = wstrdup(WMGetFromPLString(value));
#endif
value = WMGetFromPLDictionary(clip_state, dPasteCommand);
if (value && WMIsPLString(value))
@ -1974,7 +1963,6 @@ void wDockDoAutoLaunch(WDock *dock, int workspace)
}
}
#ifdef USE_DOCK_XDND
static WDock *findDock(WScreen *scr, WMEvent *event, int *icon_pos)
{
WDock *dock;
@ -2058,8 +2046,6 @@ int wDockReceiveDNDDrop(WScreen *scr, WMEvent *event)
}
return False;
}
#endif /* USE_DOCK_XDND */
Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon)
{
WWindow *wwin;
@ -2162,13 +2148,11 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon
if (wPreferences.auto_arrange_icons)
wArrangeIcons(dock->screen_ptr, True);
#ifdef USE_DOCK_XDND
if (icon->command && !icon->dnd_command) {
int len = strlen(icon->command) + 8;
icon->dnd_command = wmalloc(len);
snprintf(icon->dnd_command, len, "%s %%d", icon->command);
}
#endif
if (icon->command && !icon->paste_command) {
int len = strlen(icon->command) + 8;
@ -2341,12 +2325,10 @@ void wDockDetach(WDock *dock, WAppIcon *icon)
wfree(icon->command);
icon->command = NULL;
}
#ifdef USE_DOCK_XDND
if (icon->dnd_command) {
wfree(icon->dnd_command);
icon->dnd_command = NULL;
}
#endif
if (icon->paste_command) {
wfree(icon->paste_command);
icon->paste_command = NULL;
@ -3291,11 +3273,9 @@ static void trackDeadProcess(pid_t pid, unsigned int status, void *cdata)
char msg[PATH_MAX];
char *cmd;
#ifdef USE_DOCK_XDND
if (icon->drop_launch)
cmd = icon->dnd_command;
else
#endif
if (icon->paste_launch)
cmd = icon->paste_command;
else
@ -4696,12 +4676,9 @@ static WDock * drawerRestoreState(WScreen *scr, WMPropList *drawer_state)
drawer = wDockCreate(scr, WM_DRAWER, WMGetFromPLString(value));
/* restore DnD command and paste command */
#ifdef USE_DOCK_XDND
value = WMGetFromPLDictionary(drawer_state, dDropCommand);
if (value && WMIsPLString(value))
drawer->icon_array[0]->dnd_command = wstrdup(WMGetFromPLString(value));
#endif /* USE_DOCK_XDND */
value = WMGetFromPLDictionary(drawer_state, dPasteCommand);
if (value && WMIsPLString(value))
drawer->icon_array[0]->paste_command = wstrdup(WMGetFromPLString(value));
@ -4845,15 +4822,12 @@ static WMPropList *drawerSaveState(WDock *drawer)
WMPutInPLDictionary(drawer_state, dPosition, pstr);
WMReleasePropList(pstr);
#ifdef USE_DOCK_XDND
/* Store its DnD command */
if (ai->dnd_command) {
pstr = WMCreatePLString(ai->dnd_command);
WMPutInPLDictionary(drawer_state, dDropCommand, pstr);
WMReleasePropList(pstr);
}
#endif /* USE_DOCK_XDND */
/* Store its paste command */
if (ai->paste_command) {
pstr = WMCreatePLString(ai->paste_command);

View File

@ -93,9 +93,7 @@ void wDockDoAutoLaunch(WDock *dock, int workspace);
void wDockLaunchWithState(WAppIcon *btn, WSavedState *state);
void wDockSwap(WDock *dock);
#ifdef USE_DOCK_XDND
int wDockReceiveDNDDrop(WScreen *scr, WMEvent *event);
#endif
void wClipIconPaint(WAppIcon *aicon);
void wClipSaveState(WScreen *scr);

View File

@ -64,7 +64,6 @@ static void updatePasteCommand(WAppIcon * icon, char *command)
icon->paste_command = command;
}
#ifdef USE_DOCK_XDND
static void updateDNDCommand(WAppIcon * icon, char *command)
{
if (icon->dnd_command)
@ -75,8 +74,6 @@ static void updateDNDCommand(WAppIcon * icon, char *command)
}
icon->dnd_command = command;
}
#endif /* USE_DOCK_XDND */
static void updateSettingsPanelIcon(AppSettingsPanel * panel)
{
char *file;
@ -199,12 +196,10 @@ static void panelBtnCallback(WMWidget * self, void *data)
text = NULL;
}
updateCommand(panel->editedIcon, text);
#ifdef USE_DOCK_XDND
/* cannot free text from this, because it will be not be duplicated
* in updateDNDCommand */
text = WMGetTextFieldText(panel->dndCommandField);
updateDNDCommand(panel->editedIcon, text);
#endif
text = WMGetTextFieldText(panel->pasteCommandField);
updatePasteCommand(panel->editedIcon, text);
@ -325,16 +320,8 @@ void ShowDockAppSettingsPanel(WAppIcon * aicon)
panel->dndCommandLabel = WMCreateLabel(panel->dndCommandFrame);
WMResizeWidget(panel->dndCommandLabel, WMScaleX(260), WMScaleY(18));
WMMoveWidget(panel->dndCommandLabel, WMScaleX(10), WMScaleY(45));
#ifdef USE_DOCK_XDND
WMSetTextFieldText(panel->dndCommandField, aicon->dnd_command);
WMSetLabelText(panel->dndCommandLabel, _("%d will be replaced with the file name"));
#else
WMSetTextFieldEditable(panel->dndCommandField, False);
WMSetLabelText(panel->dndCommandLabel, _("XDnD support was not compiled in"));
WMSetFrameTitleColor(panel->dndCommandFrame, WMDarkGrayColor(scr->wmscreen));
WMSetLabelTextColor(panel->dndCommandLabel, WMDarkGrayColor(scr->wmscreen));
#endif
WMMapSubwidgets(panel->dndCommandFrame);
panel->iconFrame = WMCreateFrame(vbox);

View File

@ -63,9 +63,7 @@
#include "wsmap.h"
#include "backend/x11/x11_compat.h"
#include "backend/x11/x11_event.h"
#ifdef USE_DOCK_XDND
#include "xdnd.h"
#endif
#define MOD_MASK wPreferences.modifier_mask
@ -415,10 +413,8 @@ static void saveTimestamp(WMEvent * event)
case WME_SELECTION_REQUEST:
case WME_SELECTION:
w_global.timestamp.last_event = event->u.selection.time;
#ifdef USE_DOCK_XDND
if (event->type == WME_SELECTION)
wm_backend->xdnd_process_selection(event);
#endif
break;
}
}
@ -949,10 +945,8 @@ static void handleClientMessage(WMEvent * event)
scr->flags.ignore_focus_events = event->u.clientMessage.data.l[0] ? 1 : 0;
} else if (wm_backend->netwm_process_client_message(event)) {
/* do nothing */
#ifdef USE_DOCK_XDND
} else if (wm_backend->xdnd_process_client_message(event)) {
/* do nothing */
#endif /* USE_DOCK_XDND */
} else {
/*
* Non-standard thing, but needed by OffiX DND.

View File

@ -480,7 +480,6 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
}
break;
#ifdef USE_DOCK_XDND
case 'd':
if (!scr->xdestring) {
scr->flags.dnd_data_convertion_status = 1;
@ -497,8 +496,6 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
strcat(out, scr->xdestring);
optr += slen;
break;
#endif /* USE_DOCK_XDND */
case 's':
if (!selection) {
selection = getselection(scr);

View File

@ -302,9 +302,7 @@ typedef struct _WScreen {
/* for window shortcuts */
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
#ifdef USE_DOCK_XDND
char *xdestring;
#endif
struct NetData *netdata;

View File

@ -54,9 +54,7 @@
#include "wmspec.h"
#include "event.h"
#include "switchmenu.h"
#ifdef USE_DOCK_XDND
#include "xdnd.h"
#endif
#include "xutil.h"
@ -317,9 +315,7 @@ void StartUp(Bool defaultScreenOnly)
w_global.atom.wm.ignore_focus_events = atom[21];
#ifdef USE_DOCK_XDND
wm_backend->xdnd_init();
#endif
/* cursors */
wm_backend->cursors_init();