mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-24 15:12:32 +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:
committed by
Carlos R. Mafra
parent
2ebfcd9c5c
commit
b4cf94aacd
@@ -84,7 +84,6 @@ wmaker_SOURCES = \
|
||||
usermenu.c \
|
||||
usermenu.h \
|
||||
xdnd.h \
|
||||
xdnd.c \
|
||||
xinerama.h \
|
||||
xinerama.c \
|
||||
xmodifier.h \
|
||||
@@ -108,6 +107,9 @@ 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
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include "placement.h"
|
||||
#include "misc.h"
|
||||
#include "event.h"
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
#include "xdnd.h"
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,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 XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
wXDNDMakeAwareness(aicon->icon->core->window);
|
||||
#endif
|
||||
|
||||
@@ -309,7 +309,7 @@ static WAppIcon *wAppIconCreate(WWindow *leader_win)
|
||||
aicon->wm_instance = wstrdup(leader_win->wm_instance);
|
||||
|
||||
aicon->icon = icon_create_for_wwindow(leader_win);
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
wXDNDMakeAwareness(aicon->icon->core->window);
|
||||
#endif
|
||||
|
||||
@@ -332,7 +332,7 @@ void wAppIconDestroy(WAppIcon * aicon)
|
||||
wIconDestroy(aicon->icon);
|
||||
if (aicon->command)
|
||||
wfree(aicon->command);
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
if (aicon->dnd_command)
|
||||
wfree(aicon->dnd_command);
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct WAppIcon {
|
||||
WIcon *icon;
|
||||
int x_pos, y_pos; /* absolute screen coordinate */
|
||||
char *command; /* command used to launch app */
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
char *dnd_command; /* command to use when something is */
|
||||
/* dropped on us */
|
||||
#endif
|
||||
|
||||
@@ -1316,7 +1316,7 @@ void wShowInfoPanel(WScreen *scr)
|
||||
strbuf = wstrappend(strbuf, ", MWM");
|
||||
#endif
|
||||
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
strbuf = wstrappend(strbuf, ", XDnD");
|
||||
#endif
|
||||
|
||||
|
||||
30
src/dock.c
30
src/dock.c
@@ -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) {
|
||||
|
||||
@@ -92,7 +92,7 @@ WAppIcon *wDockFindIconForWindow(WDock *dock, Window window);
|
||||
void wDockDoAutoLaunch(WDock *dock, int workspace);
|
||||
void wDockLaunchWithState(WAppIcon *btn, WSavedState *state);
|
||||
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
int wDockReceiveDNDDrop(WScreen *scr, XEvent *event);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static void updatePasteCommand(WAppIcon * icon, char *command)
|
||||
icon->paste_command = command;
|
||||
}
|
||||
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
static void updateDNDCommand(WAppIcon * icon, char *command)
|
||||
{
|
||||
if (icon->dnd_command)
|
||||
@@ -77,7 +77,7 @@ static void updateDNDCommand(WAppIcon * icon, char *command)
|
||||
}
|
||||
icon->dnd_command = command;
|
||||
}
|
||||
#endif /* XDND */
|
||||
#endif /* USE_DOCK_XDND */
|
||||
|
||||
static void updateSettingsPanelIcon(AppSettingsPanel * panel)
|
||||
{
|
||||
@@ -199,7 +199,7 @@ static void panelBtnCallback(WMWidget * self, void *data)
|
||||
text = NULL;
|
||||
}
|
||||
updateCommand(panel->editedIcon, text);
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
/* cannot free text from this, because it will be not be duplicated
|
||||
* in updateDNDCommand */
|
||||
text = WMGetTextFieldText(panel->dndCommandField);
|
||||
@@ -307,7 +307,7 @@ void ShowDockAppSettingsPanel(WAppIcon * aicon)
|
||||
panel->dndCommandLabel = WMCreateLabel(panel->dndCommandFrame);
|
||||
WMResizeWidget(panel->dndCommandLabel, 256, 18);
|
||||
WMMoveWidget(panel->dndCommandLabel, 10, 45);
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
WMSetTextFieldText(panel->dndCommandField, aicon->dnd_command);
|
||||
WMSetLabelText(panel->dndCommandLabel, _("%d will be replaced with the file name"));
|
||||
#else
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#ifdef USE_XSHAPE
|
||||
# include <X11/extensions/shape.h>
|
||||
#endif
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
#include "xdnd.h"
|
||||
#endif
|
||||
|
||||
@@ -539,7 +539,7 @@ static void saveTimestamp(XEvent * event)
|
||||
break;
|
||||
case SelectionNotify:
|
||||
w_global.timestamp.last_event = event->xselection.time;
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
wXDNDProcessSelection(event);
|
||||
#endif
|
||||
break;
|
||||
@@ -1073,10 +1073,10 @@ static void handleClientMessage(XEvent * event)
|
||||
scr->flags.ignore_focus_events = event->xclient.data.l[0] ? 1 : 0;
|
||||
} else if (wNETWMProcessClientMessage(&event->xclient)) {
|
||||
/* do nothing */
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
} else if (wXDNDProcessClientMessage(&event->xclient)) {
|
||||
/* do nothing */
|
||||
#endif /* XDND */
|
||||
#endif /* USE_DOCK_XDND */
|
||||
} else {
|
||||
/*
|
||||
* Non-standard thing, but needed by OffiX DND.
|
||||
|
||||
@@ -622,7 +622,7 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
case 'd':
|
||||
if (!scr->xdestring) {
|
||||
scr->flags.dnd_data_convertion_status = 1;
|
||||
@@ -639,7 +639,7 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
|
||||
strcat(out, scr->xdestring);
|
||||
optr += slen;
|
||||
break;
|
||||
#endif /* XDND */
|
||||
#endif /* USE_DOCK_XDND */
|
||||
|
||||
case 's':
|
||||
if (!selection) {
|
||||
|
||||
@@ -283,7 +283,7 @@ typedef struct _WScreen {
|
||||
/* for window shortcuts */
|
||||
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
|
||||
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
char *xdestring;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#include "wmspec.h"
|
||||
#include "event.h"
|
||||
#include "switchmenu.h"
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
#include "xdnd.h"
|
||||
#endif
|
||||
|
||||
@@ -469,7 +469,7 @@ void StartUp(Bool defaultScreenOnly)
|
||||
|
||||
w_global.atom.wm.ignore_focus_events = atom[20];
|
||||
|
||||
#ifdef XDND
|
||||
#ifdef USE_DOCK_XDND
|
||||
wXDNDInitializeAtoms();
|
||||
#endif
|
||||
|
||||
|
||||
14
src/xdnd.c
14
src/xdnd.c
@@ -20,19 +20,20 @@
|
||||
|
||||
/* Many part of code are ripped of an example from JX's site */
|
||||
|
||||
#include "wconfig.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef XDND
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "dock.h"
|
||||
#include "xdnd.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
static Atom _XA_XdndAware;
|
||||
static Atom _XA_XdndEnter;
|
||||
@@ -315,4 +316,3 @@ Bool wXDNDProcessClientMessage(XClientMessageEvent *event)
|
||||
}
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user