1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-31 11:02:35 +01:00

Code refactoring: replaced macro 'XDND' by 'USE_DOCK_XDND' for consistency

The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'.

As the feature concerns the Dock and not DnD in general (WINGs support is
not disabled), make it a bit more clear in the macro name and document the
configure flag in the Installation Manual.

Took opportunity to compile the corresponding file only when the feature is
not disabled.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-04-06 17:58:12 +02:00
committed by Carlos R. Mafra
parent 2ebfcd9c5c
commit b4cf94aacd
14 changed files with 54 additions and 46 deletions

View File

@@ -72,7 +72,7 @@
static WMPropList *dCommand = NULL;
static WMPropList *dPasteCommand = NULL;
#ifdef XDND /* XXX was OFFIX */
#ifdef USE_DOCK_XDND
static WMPropList *dDropCommand = NULL;
#endif
static WMPropList *dAutoLaunch, *dLock;
@@ -135,7 +135,7 @@ static void make_keys(void)
dCommand = WMRetainPropList(WMCreatePLString("Command"));
dPasteCommand = WMRetainPropList(WMCreatePLString("PasteCommand"));
#ifdef XDND
#ifdef USE_DOCK_XDND
dDropCommand = WMRetainPropList(WMCreatePLString("DropCommand"));
#endif
dLock = WMRetainPropList(WMCreatePLString("Lock"));
@@ -1496,13 +1496,13 @@ 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 XDND /* was OFFIX */
#ifdef USE_DOCK_XDND
if (btn->dnd_command) {
command = WMCreatePLString(btn->dnd_command);
WMPutInPLDictionary(node, dDropCommand, command);
WMReleasePropList(command);
}
#endif /* XDND */
#endif /* USE_DOCK_XDND */
if (btn->paste_command) {
command = WMCreatePLString(btn->paste_command);
@@ -1682,7 +1682,7 @@ 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 XDND /* was OFFIX */
#ifdef USE_DOCK_XDND
cmd = WMGetFromPLDictionary(info, dDropCommand);
if (cmd)
aicon->dnd_command = wstrdup(WMGetFromPLString(cmd));
@@ -1769,7 +1769,7 @@ WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state)
wScreenKeepInside(scr, &icon->x_pos, &icon->y_pos, ICON_SIZE, ICON_SIZE);
}
}
#ifdef XDND /* was OFFIX */
#ifdef USE_DOCK_XDND
value = WMGetFromPLDictionary(clip_state, dDropCommand);
if (value && WMIsPLString(value))
icon->dnd_command = wstrdup(WMGetFromPLString(value));
@@ -2035,7 +2035,7 @@ void wDockDoAutoLaunch(WDock *dock, int workspace)
}
}
#ifdef XDND /* was OFFIX */
#ifdef USE_DOCK_XDND
static WDock *findDock(WScreen *scr, XEvent *event, int *icon_pos)
{
WDock *dock;
@@ -2117,7 +2117,7 @@ int wDockReceiveDNDDrop(WScreen *scr, XEvent *event)
}
return False;
}
#endif /* XDND */
#endif /* USE_DOCK_XDND */
Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon)
{
@@ -2221,7 +2221,7 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon
if (wPreferences.auto_arrange_icons)
wArrangeIcons(dock->screen_ptr, True);
#ifdef XDND /* was OFFIX */
#ifdef USE_DOCK_XDND
if (icon->command && !icon->dnd_command) {
int len = strlen(icon->command) + 8;
icon->dnd_command = wmalloc(len);
@@ -2401,7 +2401,7 @@ void wDockDetach(WDock *dock, WAppIcon *icon)
wfree(icon->command);
icon->command = NULL;
}
#ifdef XDND /* was OFFIX */
#ifdef USE_DOCK_XDND
if (icon->dnd_command) {
wfree(icon->dnd_command);
icon->dnd_command = NULL;
@@ -3347,7 +3347,7 @@ static void trackDeadProcess(pid_t pid, unsigned char status, WDock *dock)
char msg[PATH_MAX];
char *cmd;
#ifdef XDND
#ifdef USE_DOCK_XDND
if (icon->drop_launch)
cmd = icon->dnd_command;
else
@@ -4770,11 +4770,11 @@ static WDock * drawerRestoreState(WScreen *scr, WMPropList *drawer_state)
drawer = wDockCreate(scr, WM_DRAWER, WMGetFromPLString(value));
/* restore DnD command and paste command */
#ifdef XDND
#ifdef USE_DOCK_XDND
value = WMGetFromPLDictionary(drawer_state, dDropCommand);
if (value && WMIsPLString(value))
drawer->icon_array[0]->dnd_command = wstrdup(WMGetFromPLString(value));
#endif /* XDND */
#endif /* USE_DOCK_XDND */
value = WMGetFromPLDictionary(drawer_state, dPasteCommand);
if (value && WMIsPLString(value))
@@ -4912,14 +4912,14 @@ static WMPropList *drawerSaveState(WDock *drawer)
WMPutInPLDictionary(drawer_state, dPosition, pstr);
WMReleasePropList(pstr);
#ifdef XDND
#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 /* XDND */
#endif /* USE_DOCK_XDND */
/* Store its paste command */
if (ai->paste_command) {