mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Add option to allow starting DockApps with a single click
This patch is from the contrib directory. It adds an option to allow starting DockApps with a single click. It's a handy option that adds only a few lines to the code. It is a good feature patch example because it includes modifications to the WPrefs application so that the feature can be easily enabled or disabled. The one-click ability allows wmaker to integrate more seemlessly with programs like ROX-Filer which can be configured to use single or double click actions. The README in the contrib/ directory says, author: Sebastien Bauer <seb_bauer@bigfoot.com> John Morrissey <jwm@horde.net> updated for Window Maker 0.65.0 by: Daniel Richard G. <skunk@graphics.lcs.mit.edu> updated for Window Maker 0.80.2 by: Martial Daumas <martial@nasgaia.org> update for 0.80.2+ by: steve lion <steve.lion@verizon.net> and vlaad
This commit is contained in:
committed by
Carlos R. Mafra
parent
c04a2caeab
commit
f8dd3dc49e
@@ -49,6 +49,7 @@ static void showData(_Panel * panel)
|
||||
WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
|
||||
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
|
||||
WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
|
||||
WMSetButtonSelected(panel->swi[7], GetBoolForKey("SingleClickLaunch"));
|
||||
}
|
||||
|
||||
static void createPanel(Panel * p)
|
||||
@@ -59,7 +60,7 @@ static void createPanel(Panel * p)
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
panel->swi[i] = WMCreateSwitchButton(panel->box);
|
||||
WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
|
||||
WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
|
||||
@@ -73,6 +74,7 @@ static void createPanel(Panel * p)
|
||||
WMSetButtonText(panel->swi[4], _("Disable confirmation panel for the Kill command."));
|
||||
WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
|
||||
WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
|
||||
WMSetButtonText(panel->swi[7], _("Launch applications and restore windows with a single click."));
|
||||
|
||||
WMSetButtonEnabled(panel->swi[6], True);
|
||||
|
||||
@@ -95,6 +97,7 @@ static void storeDefaults(_Panel * panel)
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DontConfirmKill");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "SingleClickLaunch");
|
||||
}
|
||||
|
||||
Panel *InitExpert(WMScreen * scr, WMWidget * parent)
|
||||
|
||||
@@ -471,6 +471,7 @@ typedef struct WPreferences {
|
||||
|
||||
unsigned int workspace_border_size; /* Size in pixels of the workspace border */
|
||||
char workspace_border_position; /* Where to leave a workspace border */
|
||||
char single_click; /* single click to lauch applications */
|
||||
|
||||
RImage *swtileImage;
|
||||
RImage *swbackImage[9];
|
||||
|
||||
@@ -532,6 +532,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
Bool movingSingle = False;
|
||||
int oldX = x;
|
||||
int oldY = y;
|
||||
Bool hasMoved = False;
|
||||
|
||||
if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
|
||||
return;
|
||||
@@ -611,6 +612,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
hasMoved = True;
|
||||
if (!grabbed) {
|
||||
if (abs(dx - ev.xmotion.x) >= MOVE_THRESHOLD
|
||||
|| abs(dy - ev.xmotion.y) >= MOVE_THRESHOLD) {
|
||||
@@ -745,6 +747,9 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
if (wPreferences.auto_arrange_icons)
|
||||
wArrangeIcons(scr, True);
|
||||
|
||||
if (wPreferences.single_click && !hasMoved)
|
||||
iconDblClick(desc, event);
|
||||
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -474,6 +474,8 @@ WDefaultEntry optionList[] = {
|
||||
&wPreferences.attract, getBool, NULL},
|
||||
{"DisableBlinking", "NO", NULL,
|
||||
&wPreferences.dont_blink, getBool, NULL},
|
||||
{"SingleClickLaunch", "NO", NULL,
|
||||
&wPreferences.single_click, getBool, NULL},
|
||||
/* style options */
|
||||
{"MenuStyle", "normal", seMenuStyles,
|
||||
&wPreferences.menu_style, getEnum, setMenuStyle},
|
||||
|
||||
15
src/dock.c
15
src/dock.c
@@ -3501,7 +3501,7 @@ static void handleDockMove(WDock * dock, WAppIcon * aicon, XEvent * event)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void handleIconMove(WDock * dock, WAppIcon * aicon, XEvent * event)
|
||||
static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
|
||||
{
|
||||
WScreen *scr = dock->screen_ptr;
|
||||
Window wins[2];
|
||||
@@ -3518,6 +3518,7 @@ static void handleIconMove(WDock * dock, WAppIcon * aicon, XEvent * event)
|
||||
Bool docked;
|
||||
int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
|
||||
int omnipresent = aicon->omnipresent; /* this must be cached!!! */
|
||||
Bool hasMoved = False;
|
||||
|
||||
if (wPreferences.flags.noupdates)
|
||||
return;
|
||||
@@ -3567,6 +3568,7 @@ static void handleIconMove(WDock * dock, WAppIcon * aicon, XEvent * event)
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
hasMoved = True;
|
||||
if (!grabbed) {
|
||||
if (abs(ofs_x - ev.xmotion.x) >= MOVE_THRESHOLD
|
||||
|| abs(ofs_y - ev.xmotion.y) >= MOVE_THRESHOLD) {
|
||||
@@ -3712,9 +3714,10 @@ static void handleIconMove(WDock * dock, WAppIcon * aicon, XEvent * event)
|
||||
#ifdef DEBUG
|
||||
puts("End icon move");
|
||||
#endif
|
||||
return;
|
||||
return hasMoved;;
|
||||
}
|
||||
}
|
||||
return False; /* never reached */
|
||||
}
|
||||
|
||||
static int getClipButton(int px, int py)
|
||||
@@ -3841,9 +3844,11 @@ static void iconMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
handleClipChangeWorkspace(scr, event);
|
||||
else
|
||||
handleDockMove(dock, aicon, event);
|
||||
} else
|
||||
handleIconMove(dock, aicon, event);
|
||||
|
||||
} else {
|
||||
Bool hasMoved = handleIconMove(dock, aicon, event);
|
||||
if (wPreferences.single_click && !hasMoved)
|
||||
iconDblClick(desc, event);
|
||||
}
|
||||
} else if (event->xbutton.button == Button2 && dock->type == WM_CLIP && aicon == scr->clip_icon) {
|
||||
if (!scr->clip_ws_menu) {
|
||||
scr->clip_ws_menu = wWorkspaceMenuMake(scr, False);
|
||||
|
||||
@@ -814,6 +814,7 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
int dx = event->xbutton.x, dy = event->xbutton.y;
|
||||
int grabbed = 0;
|
||||
int clickButton = event->xbutton.button;
|
||||
Bool hasMoved = False;
|
||||
|
||||
if (WCHECK_STATE(WSTATE_MODAL))
|
||||
return;
|
||||
@@ -863,6 +864,7 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
hasMoved = True;
|
||||
if (!grabbed) {
|
||||
if (abs(dx - ev.xmotion.x) >= MOVE_THRESHOLD
|
||||
|| abs(dy - ev.xmotion.y) >= MOVE_THRESHOLD) {
|
||||
@@ -900,6 +902,8 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
|
||||
if (wPreferences.auto_arrange_icons)
|
||||
wArrangeIcons(wwin->screen_ptr, True);
|
||||
if (wPreferences.single_click && !hasMoved)
|
||||
miniwindowDblClick(desc, event);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user