mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Add option to merge the workspace-switching functionality into the dock
The dock will have the up-right and down-left arrows to change workspaces and the clip will be disabled. That is, if option ClipMergedInDock is set to yes in GNUstep/Defaults/WindowMaker. [not thoroughly tested]
This commit is contained in:
committed by
Carlos R. Mafra
parent
36bed6a77e
commit
878a57d7b2
@@ -433,6 +433,7 @@ typedef struct WPreferences {
|
|||||||
struct {
|
struct {
|
||||||
unsigned int nodock:1; /* don't display the dock */
|
unsigned int nodock:1; /* don't display the dock */
|
||||||
unsigned int noclip:1; /* don't display the clip */
|
unsigned int noclip:1; /* don't display the clip */
|
||||||
|
unsigned int clip_merged_in_dock:1; /* disable clip, dock gets its workspace switching functionality */
|
||||||
unsigned int nodrawer:1; /* don't use drawers */
|
unsigned int nodrawer:1; /* don't use drawers */
|
||||||
unsigned int wrap_appicons_in_dock:1; /* Whether to wrap appicons when Dock is moved up and down */
|
unsigned int wrap_appicons_in_dock:1; /* Whether to wrap appicons when Dock is moved up and down */
|
||||||
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
|
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
|
|||||||
if (wm_instance)
|
if (wm_instance)
|
||||||
aicon->wm_instance = wstrdup(wm_instance);
|
aicon->wm_instance = wstrdup(wm_instance);
|
||||||
|
|
||||||
|
if (strcmp(wm_class, "WMDock") == 0 && wPreferences.flags.clip_merged_in_dock)
|
||||||
|
tile = TILE_CLIP;
|
||||||
aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile);
|
aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile);
|
||||||
|
|
||||||
#ifdef XDND
|
#ifdef XDND
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ static int getPropList();
|
|||||||
static int setJustify();
|
static int setJustify();
|
||||||
static int setClearance();
|
static int setClearance();
|
||||||
static int setIfDockPresent();
|
static int setIfDockPresent();
|
||||||
|
static int setClipMergedInDock();
|
||||||
static int setWrapAppiconsInDock();
|
static int setWrapAppiconsInDock();
|
||||||
static int setStickyIcons();
|
static int setStickyIcons();
|
||||||
static int setWidgetColor();
|
static int setWidgetColor();
|
||||||
@@ -328,6 +329,8 @@ WDefaultEntry staticOptionList[] = {
|
|||||||
NULL, getBool, setIfDockPresent, NULL, NULL},
|
NULL, getBool, setIfDockPresent, NULL, NULL},
|
||||||
{"DisableDrawers", "NO", (void *)WM_DRAWER,
|
{"DisableDrawers", "NO", (void *)WM_DRAWER,
|
||||||
NULL, getBool, setIfDockPresent, NULL, NULL},
|
NULL, getBool, setIfDockPresent, NULL, NULL},
|
||||||
|
{"ClipMergedInDock", "NO", NULL,
|
||||||
|
NULL, getBool, setClipMergedInDock, NULL, NULL},
|
||||||
{"DisableMiniwindows", "NO", NULL,
|
{"DisableMiniwindows", "NO", NULL,
|
||||||
&wPreferences.disable_miniwindows, getBool, NULL, NULL, NULL}
|
&wPreferences.disable_miniwindows, getBool, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
@@ -1147,7 +1150,7 @@ void wDefaultUpdateIcons(WScreen *scr)
|
|||||||
aicon = aicon->next;
|
aicon = aicon->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wPreferences.flags.noclip)
|
if (!wPreferences.flags.noclip || wPreferences.flags.clip_merged_in_dock)
|
||||||
wClipIconPaint(scr->clip_icon);
|
wClipIconPaint(scr->clip_icon);
|
||||||
|
|
||||||
for (dc = scr->drawers; dc != NULL; dc = dc->next)
|
for (dc = scr->drawers; dc != NULL; dc = dc->next)
|
||||||
@@ -2349,6 +2352,13 @@ static int setIfDockPresent(WScreen * scr, WDefaultEntry * entry, char *flag, lo
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int setClipMergedInDock(WScreen *scr, WDefaultEntry *entry, char *flag, void *foo)
|
||||||
|
{
|
||||||
|
wPreferences.flags.clip_merged_in_dock = *flag;
|
||||||
|
wPreferences.flags.noclip = wPreferences.flags.noclip || *flag;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int setWrapAppiconsInDock(WScreen *scr, WDefaultEntry *entry, char *flag, void *foo)
|
static int setWrapAppiconsInDock(WScreen *scr, WDefaultEntry *entry, char *flag, void *foo)
|
||||||
{
|
{
|
||||||
wPreferences.flags.wrap_appicons_in_dock = *flag;
|
wPreferences.flags.wrap_appicons_in_dock = *flag;
|
||||||
@@ -2392,7 +2402,7 @@ static int setIconTile(WScreen * scr, WDefaultEntry * entry, WTexture ** texture
|
|||||||
/* put the icon in the noticeboard hint */
|
/* put the icon in the noticeboard hint */
|
||||||
PropSetIconTileHint(scr, img);
|
PropSetIconTileHint(scr, img);
|
||||||
|
|
||||||
if (!wPreferences.flags.noclip) {
|
if (!wPreferences.flags.noclip || wPreferences.flags.clip_merged_in_dock) {
|
||||||
if (scr->clip_tile) {
|
if (scr->clip_tile) {
|
||||||
RReleaseImage(scr->clip_tile);
|
RReleaseImage(scr->clip_tile);
|
||||||
}
|
}
|
||||||
|
|||||||
35
src/dock.c
35
src/dock.c
@@ -824,6 +824,8 @@ WAppIcon *mainIconCreate(WScreen *scr, int type, char *name)
|
|||||||
case WM_DOCK:
|
case WM_DOCK:
|
||||||
default: /* to avoid a warning about btn and x_pos, basically */
|
default: /* to avoid a warning about btn and x_pos, basically */
|
||||||
btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMDock", TILE_NORMAL);
|
btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMDock", TILE_NORMAL);
|
||||||
|
if (wPreferences.flags.clip_merged_in_dock)
|
||||||
|
btn->icon->core->descriptor.handle_expose = clipIconExpose;
|
||||||
x_pos = scr->scr_width - ICON_SIZE - DOCK_EXTRA_SPACE;
|
x_pos = scr->scr_width - ICON_SIZE - DOCK_EXTRA_SPACE;
|
||||||
break;
|
break;
|
||||||
case WM_DRAWER:
|
case WM_DRAWER:
|
||||||
@@ -846,7 +848,8 @@ WAppIcon *mainIconCreate(WScreen *scr, int type, char *name)
|
|||||||
btn->x_pos = x_pos;
|
btn->x_pos = x_pos;
|
||||||
btn->y_pos = 0;
|
btn->y_pos = 0;
|
||||||
btn->docked = 1;
|
btn->docked = 1;
|
||||||
if (type == WM_CLIP)
|
if (type == WM_CLIP ||
|
||||||
|
(type == WM_DOCK && wPreferences.flags.clip_merged_in_dock))
|
||||||
scr->clip_icon = btn;
|
scr->clip_icon = btn;
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
@@ -1377,7 +1380,7 @@ void wClipIconPaint(WAppIcon *aicon)
|
|||||||
snprintf(ws_number, sizeof(ws_number), "%i", scr->current_workspace + 1);
|
snprintf(ws_number, sizeof(ws_number), "%i", scr->current_workspace + 1);
|
||||||
nlength = strlen(ws_number);
|
nlength = strlen(ws_number);
|
||||||
|
|
||||||
if (!workspace->clip->collapsed)
|
if (wPreferences.flags.noclip || !workspace->clip->collapsed)
|
||||||
color = scr->clip_title_color[CLIP_NORMAL];
|
color = scr->clip_title_color[CLIP_NORMAL];
|
||||||
else
|
else
|
||||||
color = scr->clip_title_color[CLIP_COLLAPSED];
|
color = scr->clip_title_color[CLIP_COLLAPSED];
|
||||||
@@ -1447,7 +1450,7 @@ static WMPropList *make_icon_state(WAppIcon *btn)
|
|||||||
|
|
||||||
buggy = btn->buggy_app ? dYes : dNo;
|
buggy = btn->buggy_app ? dYes : dNo;
|
||||||
|
|
||||||
if (btn == btn->icon->core->screen_ptr->clip_icon)
|
if (!wPreferences.flags.clip_merged_in_dock && btn == btn->icon->core->screen_ptr->clip_icon)
|
||||||
snprintf(buffer, sizeof(buffer), "%i,%i", btn->x_pos, btn->y_pos);
|
snprintf(buffer, sizeof(buffer), "%i,%i", btn->x_pos, btn->y_pos);
|
||||||
else
|
else
|
||||||
snprintf(buffer, sizeof(buffer), "%hi,%hi", btn->xindex, btn->yindex);
|
snprintf(buffer, sizeof(buffer), "%hi,%hi", btn->xindex, btn->yindex);
|
||||||
@@ -1958,7 +1961,7 @@ WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
* incremented in the loop above.
|
* incremented in the loop above.
|
||||||
*/
|
*/
|
||||||
} else if (old_top != dock->icon_array[0]) {
|
} else if (old_top != dock->icon_array[0]) {
|
||||||
if (old_top == scr->clip_icon)
|
if (old_top == scr->clip_icon) // TODO dande: understand the logic
|
||||||
scr->clip_icon = dock->icon_array[0];
|
scr->clip_icon = dock->icon_array[0];
|
||||||
|
|
||||||
wAppIconDestroy(old_top);
|
wAppIconDestroy(old_top);
|
||||||
@@ -3592,10 +3595,22 @@ static void iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
/* raise/lower dock */
|
/* raise/lower dock */
|
||||||
toggleLowered(dock);
|
toggleLowered(dock);
|
||||||
} else if (btn == dock->screen_ptr->clip_icon) {
|
} else if (btn == dock->screen_ptr->clip_icon) {
|
||||||
if (getClipButton(event->xbutton.x, event->xbutton.y) == CLIP_IDLE)
|
if (getClipButton(event->xbutton.x, event->xbutton.y) != CLIP_IDLE)
|
||||||
toggleCollapsed(dock);
|
|
||||||
else
|
|
||||||
handleClipChangeWorkspace(dock->screen_ptr, event);
|
handleClipChangeWorkspace(dock->screen_ptr, event);
|
||||||
|
else if (wPreferences.flags.clip_merged_in_dock) {
|
||||||
|
// Is actually the dock
|
||||||
|
if (btn->command)
|
||||||
|
{
|
||||||
|
if (!btn->launching && (!btn->running || (event->xbutton.state & ControlMask)))
|
||||||
|
launchDockedApplication(btn, False);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wShowInfoPanel(dock->screen_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
toggleCollapsed(dock);
|
||||||
} else if (wIsADrawer(dock->screen_ptr, btn)) {
|
} else if (wIsADrawer(dock->screen_ptr, btn)) {
|
||||||
toggleCollapsed(dock);
|
toggleCollapsed(dock);
|
||||||
} else if (btn->command) {
|
} else if (btn->command) {
|
||||||
@@ -3921,8 +3936,8 @@ static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aicon->yindex == 0 && aicon->xindex == 0) {
|
if (aicon->yindex == 0 && aicon->xindex == 0) {
|
||||||
if (getClipButton(event->xbutton.x, event->xbutton.y) != CLIP_IDLE
|
if (getClipButton(event->xbutton.x, event->xbutton.y) != CLIP_IDLE &&
|
||||||
&& dock->type == WM_CLIP)
|
(dock->type == WM_CLIP || (dock->type == WM_DOCK && wPreferences.flags.clip_merged_in_dock)))
|
||||||
handleClipChangeWorkspace(scr, event);
|
handleClipChangeWorkspace(scr, event);
|
||||||
else
|
else
|
||||||
handleDockMove(dock, aicon, event);
|
handleDockMove(dock, aicon, event);
|
||||||
@@ -3931,7 +3946,7 @@ static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
if (wPreferences.single_click && !hasMoved)
|
if (wPreferences.single_click && !hasMoved)
|
||||||
iconDblClick(desc, event);
|
iconDblClick(desc, event);
|
||||||
}
|
}
|
||||||
} else if (event->xbutton.button == Button2 && dock->type == WM_CLIP && aicon == scr->clip_icon) {
|
} else if (event->xbutton.button == Button2 && aicon == scr->clip_icon) {
|
||||||
if (!scr->clip_ws_menu) {
|
if (!scr->clip_ws_menu) {
|
||||||
scr->clip_ws_menu = wWorkspaceMenuMake(scr, False);
|
scr->clip_ws_menu = wWorkspaceMenuMake(scr, False);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -859,6 +859,8 @@ void wScreenRestoreState(WScreen * scr)
|
|||||||
if (!wPreferences.flags.nodock) {
|
if (!wPreferences.flags.nodock) {
|
||||||
state = WMGetFromPLDictionary(scr->session_state, dDock);
|
state = WMGetFromPLDictionary(scr->session_state, dDock);
|
||||||
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
|
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
|
||||||
|
/* If clip_merged_in_dock, setting scr->clip_icon is done by
|
||||||
|
* wDockRestoreState()->wDockCreate()->mainIconCreate() */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wPreferences.flags.noclip) {
|
if (!wPreferences.flags.noclip) {
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ typedef struct _WScreen {
|
|||||||
struct WMenu *dock_pos_menu; /* Dock position menu */
|
struct WMenu *dock_pos_menu; /* Dock position menu */
|
||||||
struct WPixmap *dock_dots; /* 3 dots for the Dock */
|
struct WPixmap *dock_dots; /* 3 dots for the Dock */
|
||||||
Window dock_shadow; /* shadow for dock buttons */
|
Window dock_shadow; /* shadow for dock buttons */
|
||||||
struct WAppIcon *clip_icon; /* The clip main icon */
|
struct WAppIcon *clip_icon; /* The clip main icon, or the dock's, if they are merged */
|
||||||
struct WMenu *clip_menu; /* Menu for clips */
|
struct WMenu *clip_menu; /* Menu for clips */
|
||||||
struct WMenu *clip_submenu; /* Workspace list for clips */
|
struct WMenu *clip_submenu; /* Workspace list for clips */
|
||||||
struct WMenu *clip_options; /* Options for Clip */
|
struct WMenu *clip_options; /* Options for Clip */
|
||||||
@@ -244,7 +244,7 @@ typedef struct _WScreen {
|
|||||||
WMScreen *wmscreen; /* for widget library */
|
WMScreen *wmscreen; /* for widget library */
|
||||||
|
|
||||||
struct RImage *icon_tile;
|
struct RImage *icon_tile;
|
||||||
struct RImage *clip_tile;
|
struct RImage *clip_tile; /* tile with arrows to change workspace */
|
||||||
struct RImage *drawer_tile; /* tile for a drawer (tile + arrow) */
|
struct RImage *drawer_tile; /* tile for a drawer (tile + arrow) */
|
||||||
Pixmap icon_tile_pixmap; /* For app supplied icons */
|
Pixmap icon_tile_pixmap; /* For app supplied icons */
|
||||||
|
|
||||||
|
|||||||
@@ -613,15 +613,14 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
|
|||||||
if (scr->dock)
|
if (scr->dock)
|
||||||
wAppIconPaint(scr->dock->icon_array[0]);
|
wAppIconPaint(scr->dock->icon_array[0]);
|
||||||
|
|
||||||
if (scr->clip_icon) {
|
if (!wPreferences.flags.noclip && (scr->workspaces[workspace]->clip->auto_collapse ||
|
||||||
if (scr->workspaces[workspace]->clip->auto_collapse ||
|
scr->workspaces[workspace]->clip->auto_raise_lower)) {
|
||||||
scr->workspaces[workspace]->clip->auto_raise_lower) {
|
|
||||||
/* to handle enter notify. This will also */
|
/* to handle enter notify. This will also */
|
||||||
XUnmapWindow(dpy, scr->clip_icon->icon->core->window);
|
XUnmapWindow(dpy, scr->clip_icon->icon->core->window);
|
||||||
XMapWindow(dpy, scr->clip_icon->icon->core->window);
|
XMapWindow(dpy, scr->clip_icon->icon->core->window);
|
||||||
} else {
|
|
||||||
wClipIconPaint(scr->clip_icon);
|
|
||||||
}
|
}
|
||||||
|
else if (scr->clip_icon != NULL) {
|
||||||
|
wClipIconPaint(scr->clip_icon);
|
||||||
}
|
}
|
||||||
wScreenUpdateUsableArea(scr);
|
wScreenUpdateUsableArea(scr);
|
||||||
wNETWMUpdateDesktop(scr);
|
wNETWMUpdateDesktop(scr);
|
||||||
|
|||||||
Reference in New Issue
Block a user