1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Merge branch 'wmdrawer' into next

This commit is contained in:
Carlos R. Mafra
2013-04-12 02:14:41 +01:00
38 changed files with 3853 additions and 942 deletions

View File

@@ -111,43 +111,6 @@ static void updateLabel(WMWidget *self, void *data)
WMSetLabelText(panel->dithL, buffer);
}
static void
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon1, WMPixmap **icon2)
{
RImage *icon;
char *path;
RColor gray = { 0xae, 0xaa, 0xae, 0 };
*icon1 = NULL;
*icon2 = NULL;
path = LocateImage(file);
if (!path)
return;
*icon1 = WMCreatePixmapFromFile(scr, path);
if (!*icon1) {
wwarning(_("could not load icon %s"), path);
wfree(path);
return;
}
icon = RLoadImage(rc, path, 0);
if (!icon) {
wwarning(_("could not load icon %s"), path);
wfree(path);
return;
}
RCombineImageWithColor(icon, &gray);
if (xis) {
RCombineImagesWithOpaqueness(icon, xis, 180);
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
wwarning(_("could not process icon %s: %s"), file, RMessageForError(RErrorCode));
}
RReleaseImage(icon);
wfree(path);
}
static void createPanel(Panel *p)
{
_Panel *panel = (_Panel *) p;
@@ -342,7 +305,7 @@ static void createPanel(Panel *p)
WMSetButtonFont(panel->animB, font);
WMSetButtonText(panel->animB, _("Animations"));
WMSetButtonImagePosition(panel->animB, WIPAbove);
createImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon);
CreateImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon);
if (icon) {
WMSetButtonImage(panel->animB, icon);
WMReleasePixmap(icon);
@@ -360,7 +323,7 @@ static void createPanel(Panel *p)
WMSetButtonFont(panel->supB, font);
WMSetButtonText(panel->supB, _("Superfluous"));
WMSetButtonImagePosition(panel->supB, WIPAbove);
createImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon);
CreateImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon);
if (icon) {
WMSetButtonImage(panel->supB, icon);
WMReleasePixmap(icon);

310
WPrefs.app/Docks.c Normal file
View File

@@ -0,0 +1,310 @@
/* Workspace.c- workspace options
*
* WPrefs - Window Maker Preferences Program
*
* Copyright (c) 2012 Daniel Déchelotte (heavily inspired from file (c) Alfredo K. Kojima)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "WPrefs.h"
typedef struct _Panel {
WMBox *box;
char *sectionName;
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *autoDelayF[2];
WMLabel *autoDelayL[4];
WMButton *autoDelayB[4][5];
WMTextField *autoDelayT[4];
WMFrame *dockF;
WMButton *docksB[3];
} _Panel;
#define ICON_FILE "dockclipdrawersection"
#define ARQUIVO_XIS "xis"
#define DELAY_ICON "timer%i"
#define DELAY_ICON_S "timer%is"
static char *autoDelayStrings[4];
static char *autoDelayKeys[4] = { "ClipAutoexpandDelay", "ClipAutocollapseDelay", "ClipAutoraiseDelay", "ClipAutolowerDelay" };
static char *autoDelayPresetValues[5] = { "0", "100", "250", "600", "1000" };
static char *dockDisablingKeys[3] = { "DisableDock", "DisableClip", "DisableDrawers" };
static char *dockFiles[3] = { "dock", "clip", "drawer" };
static void showData(_Panel *panel);
static void storeData(_Panel *panel);
static void pushAutoDelayButton(WMWidget *w, void *data)
{
_Panel *panel = (_Panel *) data;
int i, j;
for (i = 0; i < 4; i++)
{
for (j = 0; j < 5; j++)
{
if (w == panel->autoDelayB[i][j])
{
WMSetTextFieldText(panel->autoDelayT[i], autoDelayPresetValues[j]);
return;
}
}
}
}
static void adjustButtonSelectionBasedOnValue(_Panel *panel, int row, char *value)
{
int j;
for (j = 0; j < 5; j++)
{
int isThatOne = !strcmp(autoDelayPresetValues[j], value);
WMSetButtonSelected(panel->autoDelayB[row][j], isThatOne);
if (isThatOne)
return;
}
}
static void autoDelayChanged(void *observerData, WMNotification *notification)
{
_Panel *panel = (_Panel *) observerData;
int row;
WMTextField *anAutoDelayT = (WMTextField *) WMGetNotificationObject(notification);
for (row = 0; row < 4; row++)
{
if (anAutoDelayT != panel->autoDelayT[row])
{
continue;
}
char *value = WMGetTextFieldText(anAutoDelayT);
adjustButtonSelectionBasedOnValue(panel, row, value);
return;
}
}
static void pushDockButton(WMWidget *w, void *data)
{
_Panel *panel = (_Panel *) data;
WMButton *button = (WMButton *) w;
if (button == panel->docksB[0] &&
!WMGetButtonSelected(panel->docksB[0]))
{
WMSetButtonSelected(panel->docksB[2], False);
}
if (button == panel->docksB[2] &&
WMGetButtonSelected(panel->docksB[2]))
{
WMSetButtonSelected(panel->docksB[0], True);
}
}
static void createPanel(Panel *p)
{
_Panel *panel = (_Panel *) p;
WMScreen *scr = WMWidgetScreen(panel->parent);
WMPixmap *icon1, *icon2;
RImage *xis = NULL;
RContext *rc = WMScreenRContext(scr);
char *path;
int i, j, k;
char *buf1, *buf2;
path = LocateImage(ARQUIVO_XIS);
if (path) {
xis = RLoadImage(rc, path, 0);
if (!xis) {
wwarning(_("could not load image file %s"), path);
}
wfree(path);
}
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Auto-delays *****************/
buf1 = wmalloc(strlen(DELAY_ICON) + 1);
buf2 = wmalloc(strlen(DELAY_ICON_S) + 1);
for (k = 0; k < 2; k++)
{
panel->autoDelayF[k] = WMCreateFrame(panel->box);
WMResizeWidget(panel->autoDelayF[k], 365, 100);
WMMoveWidget(panel->autoDelayF[k], 15, 10 + k * 110);
if (k == 0)
WMSetFrameTitle(panel->autoDelayF[k], _("Delays in milliseconds for autocollapsing clips"));
else
WMSetFrameTitle(panel->autoDelayF[k], _("Delays in milliseconds for autoraising clips"));
for (i = 0; i < 2; i++)
{
panel->autoDelayL[i + k * 2] = WMCreateLabel(panel->autoDelayF[k]);
WMResizeWidget(panel->autoDelayL[i + k * 2], 165, 20);
WMMoveWidget(panel->autoDelayL[i + k * 2], 10, 27 + 40 * i);
WMSetLabelText(panel->autoDelayL[i + k * 2], autoDelayStrings[i + k * 2]);
WMSetLabelTextAlignment(panel->autoDelayL[i + k * 2], WARight);
for (j = 0; j < 5; j++)
{
panel->autoDelayB[i + k * 2][j] = WMCreateCustomButton(panel->autoDelayF[k], WBBStateChangeMask);
WMResizeWidget(panel->autoDelayB[i + k * 2][j], 25, 25);
WMMoveWidget(panel->autoDelayB[i + k * 2][j], 175 + (25 * j), 25 + 40 * i);
WMSetButtonBordered(panel->autoDelayB[i + k * 2][j], False);
WMSetButtonImagePosition(panel->autoDelayB[i + k * 2][j], WIPImageOnly);
WMSetButtonAction(panel->autoDelayB[i + k * 2][j], pushAutoDelayButton, panel);
if (j > 0)
WMGroupButtons(panel->autoDelayB[i + k * 2][0], panel->autoDelayB[i + k * 2][j]);
sprintf(buf1, DELAY_ICON, j);
CreateImages(scr, rc, NULL, buf1, &icon1, NULL);
if (icon1) {
WMSetButtonImage(panel->autoDelayB[i + k * 2][j], icon1);
WMReleasePixmap(icon1);
} else {
wwarning(_("could not load icon file %s"), buf1);
}
sprintf(buf2, DELAY_ICON_S, j);
CreateImages(scr, rc, NULL, buf2, &icon2, NULL);
if (icon2) {
WMSetButtonAltImage(panel->autoDelayB[i + k * 2][j], icon2);
WMReleasePixmap(icon2);
} else {
wwarning(_("could not load icon file %s"), buf2);
}
}
panel->autoDelayT[i + k * 2] = WMCreateTextField(panel->autoDelayF[k]);
WMResizeWidget(panel->autoDelayT[i + k * 2], 36, 20);
WMMoveWidget(panel->autoDelayT[i + k * 2], 310, 27 + 40 * i);
WMAddNotificationObserver(autoDelayChanged, panel, WMTextDidChangeNotification, panel->autoDelayT[i + k * 2]);
}
WMMapSubwidgets(panel->autoDelayF[k]);
}
wfree(buf1);
wfree(buf2);
/***************** Enable/disable clip/dock/drawers *****************/
panel->dockF = WMCreateFrame(panel->box);
WMResizeWidget(panel->dockF, 115, 210);
WMMoveWidget(panel->dockF, 390, 10);
WMSetFrameTitle(panel->dockF, _("Dock/Clip/Drawer"));
for (i = 0; i < 3; i++)
{
panel->docksB[i] = WMCreateButton(panel->dockF, WBTToggle);
WMResizeWidget(panel->docksB[i], 56, 56);
WMMoveWidget(panel->docksB[i], 30, 20 + 62 * i);
WMSetButtonImagePosition(panel->docksB[i], WIPImageOnly);
CreateImages(scr, rc, xis, dockFiles[i], &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->docksB[i], icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->docksB[i], icon1);
WMReleasePixmap(icon1);
}
switch(i)
{
case 0:
WMSetBalloonTextForView(_("Disable/enable the application Dock (the\n"
"vertical icon bar in the side of the screen)."), WMWidgetView(panel->docksB[i]));
break;
case 1:
WMSetBalloonTextForView(_("Disable/enable the Clip (that thing with\n"
"a paper clip icon)."), WMWidgetView(panel->docksB[i]));
break;
case 2:
WMSetBalloonTextForView(_("Disable/enable Drawers (a dock that stores\n"
"application icons horizontally). The dock is required."), WMWidgetView(panel->docksB[i]));
break;
}
WMSetButtonAction(panel->docksB[i], pushDockButton, panel);
}
WMMapSubwidgets(panel->dockF);
if (xis)
RReleaseImage(xis);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
static void storeData(_Panel *panel)
{
int i;
for (i = 0; i < 4; i++)
{
SetStringForKey(WMGetTextFieldText(panel->autoDelayT[i]), autoDelayKeys[i]);
}
for (i = 0; i < 3; i++)
{
SetBoolForKey(!WMGetButtonSelected(panel->docksB[i]), dockDisablingKeys[i]);
}
}
static void showData(_Panel *panel)
{
char *value;
int i;
for (i = 0; i < 4; i++)
{
value = GetStringForKey(autoDelayKeys[i]);
WMSetTextFieldText(panel->autoDelayT[i], value);
adjustButtonSelectionBasedOnValue(panel, i, value);
}
for (i = 0; i < 3; i++)
{
WMSetButtonSelected(panel->docksB[i], !GetBoolForKey(dockDisablingKeys[i]));
}
}
Panel *InitDocks(WMScreen *scr, WMWidget *parent)
{
_Panel *panel;
autoDelayStrings[0] = _("Delay before auto-expansion");
autoDelayStrings[1] = _("Delay before auto-collapsing");
autoDelayStrings[2] = _("Delay before auto-raise");
autoDelayStrings[3] = _("Delay before auto-lowering");
panel = wmalloc(sizeof(_Panel));
memset(panel, 0, sizeof(_Panel));
panel->sectionName = _("Dock Preferences");
panel->description = _("Dock and clip features.\n"
"Enable/disable the Dock and Clip, and tune some delays.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -18,6 +18,7 @@ WPrefs_SOURCES = \
WPrefs.h \
Appearance.c \
Configurations.c \
Docks.c \
Expert.c \
Focus.c \
FontSimple.c \

View File

@@ -32,6 +32,8 @@ extern Panel *InitKeyboardShortcuts(WMScreen * scr, WMWidget * parent);
extern Panel *InitWorkspace(WMScreen * scr, WMWidget * parent);
extern Panel *InitDocks(WMScreen *scr, WMWidget *parent);
extern Panel *InitFocus(WMScreen * scr, WMWidget * parent);
extern Panel *InitPreferences(WMScreen * scr, WMWidget * parent);
@@ -392,6 +394,61 @@ char *LocateImage(char *name)
return path;
}
void CreateImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon_normal, WMPixmap **icon_greyed)
{
RImage *icon;
char *path;
RColor gray = { 0xae, 0xaa, 0xae, 0 };
path = LocateImage(file);
if (!path)
{
*icon_normal = NULL;
if (icon_greyed)
*icon_greyed = NULL;
return;
}
*icon_normal = WMCreatePixmapFromFile(scr, path);
if (!*icon_normal)
{
wwarning(_("could not load icon %s"), path);
if (icon_greyed)
*icon_greyed = NULL;
wfree(path);
return;
}
if (!icon_greyed) // Greyed-out version not requested, we are done
{
wfree(path);
return;
}
icon = RLoadImage(rc, path, 0);
if (!icon)
{
wwarning(_("could not load icon %s"), path);
*icon_greyed = NULL;
wfree(path);
return;
}
RCombineImageWithColor(icon, &gray);
if (xis)
{
RCombineImagesWithOpaqueness(icon, xis, 180);
}
*icon_greyed = WMCreatePixmapFromRImage(scr, icon, 127);
if (!*icon_greyed)
{
wwarning(_("could not process icon %s: %s"), path, RMessageForError(RErrorCode));
}
RReleaseImage(icon);
wfree(path);
}
static WMPixmap *makeTitledIcon(WMScreen * scr, WMPixmap * icon, char *title1, char *title2)
{
return WMRetainPixmap(icon);
@@ -608,6 +665,7 @@ void Initialize(WMScreen * scr)
InitPreferences(scr, WPrefs.banner);
InitPaths(scr, WPrefs.banner);
InitDocks(scr, WPrefs.banner);
InitWorkspace(scr, WPrefs.banner);
InitConfigurations(scr, WPrefs.banner);

View File

@@ -76,6 +76,13 @@ char *LocateImage(char *name);
void SetButtonAlphaImage(WMScreen *scr, WMButton *bPtr, char *file,
char *title1, char *title2);
/* Loads `file' into `icon_normal'. If `icon_greyed' is not NULL,
* combine `icon_normal' with some grey and then optionally with image
* `xis', and store it in `icon_greyed' (typically to produce a
* greyed-out, red-crossed version of `icon_normal') */
void CreateImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon_normal, WMPixmap **icon_greyed);
WMWindow *GetWindow(Panel *panel);
/* manipulate the dictionary for the WindowMaker domain */

View File

@@ -44,10 +44,6 @@ typedef struct _Panel {
WMLabel *posiL;
WMLabel *posL;
WMPopUpButton *posP;
WMFrame *dockF;
WMButton *dockB;
WMButton *clipB;
} _Panel;
#define ICON_FILE "workspace"
@@ -57,8 +53,6 @@ typedef struct _Panel {
#define CYCLE_FILE "cycleworkspaces"
#define ADVANCE_FILE "advancetonewworkspace"
#define WSNAME_FILE "workspacename"
#define DOCK_FILE "dock"
#define CLIP_FILE "clip"
static char *WSNamePositions[] = {
"none",
@@ -71,40 +65,6 @@ static char *WSNamePositions[] = {
"bottomright"
};
static void
createImages(WMScreen * scr, RContext * rc, RImage * xis, char *file, WMPixmap ** icon1, WMPixmap ** icon2)
{
RImage *icon;
RColor gray = { 0xae, 0xaa, 0xae, 0 };
*icon1 = WMCreatePixmapFromFile(scr, file);
if (!*icon1) {
wwarning(_("could not load icon %s"), file);
if (icon2)
*icon2 = NULL;
return;
}
if (!icon2)
return;
icon = RLoadImage(rc, file, 0);
if (!icon) {
wwarning(_("could not load icon %s"), file);
*icon2 = NULL;
return;
}
RCombineImageWithColor(icon, &gray);
if (xis) {
RCombineImagesWithOpaqueness(icon, xis, 180);
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127))) {
wwarning(_("could not process icon %s: %s"), file, RMessageForError(RErrorCode));
*icon2 = NULL;
}
}
RReleaseImage(icon);
}
static void showData(_Panel * panel)
{
int i, idx;
@@ -116,10 +76,6 @@ static void showData(_Panel * panel)
WMSetButtonSelected(panel->newB, GetBoolForKey("AdvanceToNewWorkspace"));
WMSetButtonSelected(panel->dockB, !GetBoolForKey("DisableDock"));
WMSetButtonSelected(panel->clipB, !GetBoolForKey("DisableClip"));
str = GetStringForKey("WorkspaceNameDisplayPosition");
if (!str)
str = "center";
@@ -157,12 +113,12 @@ static void createPanel(Panel * p)
/***************** Workspace Navigation *****************/
panel->navF = WMCreateFrame(panel->box);
WMResizeWidget(panel->navF, 365, 210);
WMResizeWidget(panel->navF, 490, 210);
WMMoveWidget(panel->navF, 15, 10);
WMSetFrameTitle(panel->navF, _("Workspace Navigation"));
panel->cyclB = WMCreateSwitchButton(panel->navF);
WMResizeWidget(panel->cyclB, 280, 34);
WMResizeWidget(panel->cyclB, 410, 34);
WMMoveWidget(panel->cyclB, 75, 30);
WMSetButtonText(panel->cyclB, _("Wrap to the first workspace from the last workspace."));
@@ -170,18 +126,15 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->cyclL, 60, 60);
WMMoveWidget(panel->cyclL, 10, 15);
WMSetLabelImagePosition(panel->cyclL, WIPImageOnly);
path = LocateImage(CYCLE_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
CreateImages(scr, rc, xis, CYCLE_FILE, &icon1, NULL);
if (icon1)
{
WMSetLabelImage(panel->cyclL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
/**/ panel->linkB = WMCreateSwitchButton(panel->navF);
WMResizeWidget(panel->linkB, 280, 34);
WMResizeWidget(panel->linkB, 410, 34);
WMMoveWidget(panel->linkB, 75, 75);
WMSetButtonText(panel->linkB, _("Switch workspaces while dragging windows."));
@@ -189,18 +142,15 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->linkL, 60, 40);
WMMoveWidget(panel->linkL, 10, 80);
WMSetLabelImagePosition(panel->linkL, WIPImageOnly);
path = LocateImage(DONT_LINK_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
CreateImages(scr, rc, xis, DONT_LINK_FILE, &icon1, NULL);
if (icon1)
{
WMSetLabelImage(panel->linkL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
/**/ panel->newB = WMCreateSwitchButton(panel->navF);
WMResizeWidget(panel->newB, 280, 34);
WMResizeWidget(panel->newB, 410, 34);
WMMoveWidget(panel->newB, 75, 120);
WMSetButtonText(panel->newB, _("Automatically create new workspaces."));
@@ -208,39 +158,33 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->newL, 60, 20);
WMMoveWidget(panel->newL, 10, 130);
WMSetLabelImagePosition(panel->newL, WIPImageOnly);
path = LocateImage(ADVANCE_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
CreateImages(scr, rc, xis, ADVANCE_FILE, &icon1, NULL);
if (icon1)
{
WMSetLabelImage(panel->newL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
/**/ panel->posL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->posL, 140, 30);
WMResizeWidget(panel->posL, 200, 30);
WMMoveWidget(panel->posL, 75, 165);
WMSetLabelTextAlignment(panel->posL, WARight);
WMSetLabelText(panel->posL, _("Position of workspace\nname display"));
// WMSetLabelTextAlignment(panel->posL, WARight);
WMSetLabelText(panel->posL, _("Position of workspace name display"));
panel->posiL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->posiL, 60, 40);
WMMoveWidget(panel->posiL, 10, 160);
WMSetLabelImagePosition(panel->posiL, WIPImageOnly);
path = LocateImage(WSNAME_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
CreateImages(scr, rc, xis, WSNAME_FILE, &icon1, NULL);
if (icon1)
{
WMSetLabelImage(panel->posiL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
panel->posP = WMCreatePopUpButton(panel->navF);
WMResizeWidget(panel->posP, 125, 20);
WMMoveWidget(panel->posP, 225, 175);
WMMoveWidget(panel->posP, 290, 170);
WMAddPopUpButtonItem(panel->posP, _("Disable"));
WMAddPopUpButtonItem(panel->posP, _("Center"));
WMAddPopUpButtonItem(panel->posP, _("Top"));
@@ -252,54 +196,6 @@ static void createPanel(Panel * p)
WMMapSubwidgets(panel->navF);
/***************** Dock/Clip *****************/
panel->dockF = WMCreateFrame(panel->box);
WMResizeWidget(panel->dockF, 115, 210);
WMMoveWidget(panel->dockF, 390, 10);
WMSetFrameTitle(panel->dockF, _("Dock/Clip"));
panel->dockB = WMCreateButton(panel->dockF, WBTToggle);
WMResizeWidget(panel->dockB, 64, 64);
WMMoveWidget(panel->dockB, 25, 35);
WMSetButtonImagePosition(panel->dockB, WIPImageOnly);
path = LocateImage(DOCK_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->dockB, icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->dockB, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
WMSetBalloonTextForView(_("Disable/enable the application Dock (the\n"
"vertical icon bar in the side of the screen)."), WMWidgetView(panel->dockB));
panel->clipB = WMCreateButton(panel->dockF, WBTToggle);
WMResizeWidget(panel->clipB, 64, 64);
WMMoveWidget(panel->clipB, 25, 120);
WMSetButtonImagePosition(panel->clipB, WIPImageOnly);
path = LocateImage(CLIP_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->clipB, icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->clipB, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
WMSetBalloonTextForView(_("Disable/enable the Clip (that thing with\n"
"a paper clip icon)."), WMWidgetView(panel->clipB));
WMMapSubwidgets(panel->dockF);
if (xis)
RReleaseImage(xis);
@@ -315,9 +211,6 @@ static void storeData(_Panel * panel)
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
SetBoolForKey(!WMGetButtonSelected(panel->dockB), "DisableDock");
SetBoolForKey(!WMGetButtonSelected(panel->clipB), "DisableClip");
SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
"WorkspaceNameDisplayPosition");
}

View File

@@ -8,6 +8,7 @@ EXTRA_DIST = \
configs.tiff \
cycleworkspaces.tiff \
dock.tiff \
dockclipdrawersection.tiff \
dontlinkworkspaces.tiff \
ergonomic.tiff \
expert.tiff \

Binary file not shown.

BIN
WPrefs.app/tiff/drawer.tiff Normal file

Binary file not shown.

View File

@@ -9,6 +9,7 @@ EXTRA_DIST = \
configs.xpm \
cycleworkspaces.xpm \
dock.xpm \
dockclipdrawersection.xpm \
dontlinkworkspaces.xpm \
ergonomic.xpm \
expert.xpm \

View File

@@ -0,0 +1,307 @@
/* XPM */
static char * dockclipdrawersection_xpm[] = {
"48 48 256 2",
" c #000100",
". c #000609",
"+ c #030601",
"@ c #0B080D",
"# c #070A06",
"$ c #080E10",
"% c #110E12",
"& c #131114",
"* c #0E1315",
"= c #121311",
"- c #161417",
"; c #18171A",
"> c #191A21",
", c #1C1A1D",
"' c #1C1C24",
") c #1E1F26",
"! c #232124",
"~ c #202426",
"{ c #222421",
"] c #22232B",
"^ c #252427",
"/ c #25252D",
"( c #27282F",
"_ c #29282B",
": c #2B2B33",
"< c #2B2D2A",
"[ c #2D2E36",
"} c #303038",
"| c #323034",
"1 c #2F3335",
"2 c #34353D",
"3 c #373538",
"4 c #383941",
"5 c #3C3A3D",
"6 c #393D4A",
"7 c #3D3E46",
"8 c #403E41",
"9 c #42424B",
"0 c #3F4350",
"a c #424441",
"b c #454346",
"c c #46464F",
"d c #464845",
"e c #4A484B",
"f c #434A51",
"g c #484951",
"h c #4D4B4F",
"i c #4D4D56",
"j c #4B4E5C",
"k c #505059",
"l c #515351",
"m c #53545D",
"n c #525563",
"o c #6C5612",
"p c #4F575E",
"q c #575760",
"r c #5A585C",
"s c #6F591D",
"t c #6C5B16",
"u c #5D5B59",
"v c #5B5B64",
"w c #585C6A",
"x c #725D20",
"y c #5F5D61",
"z c #5B5F6C",
"A c #72611F",
"B c #606069",
"C c #5D616F",
"D c #5E627B",
"E c #5F6371",
"F c #7A6327",
"G c #646563",
"H c #64646D",
"I c #5E666D",
"J c #5E6578",
"K c #616668",
"L c #616572",
"M c #7C6529",
"N c #676568",
"O c #6A646E",
"P c #636774",
"Q c #676770",
"R c #656876",
"S c #666983",
"T c #676B79",
"U c #816D19",
"V c #72696F",
"W c #726C57",
"X c #706A74",
"Y c #696D70",
"Z c #6B6C75",
"` c #6F6C70",
" . c #7D6E3B",
".. c #6A6E7C",
"+. c #837024",
"@. c #6B6F89",
"#. c #6D707F",
"$. c #70717A",
"%. c #887320",
"&. c #6E718C",
"*. c #797076",
"=. c #747276",
"-. c #927503",
";. c #8B7519",
">. c #87742F",
",. c #6F7381",
"'. c #7D7367",
"). c #767382",
"!. c #717583",
"~. c #6F768A",
"{. c #8D7825",
"]. c #78767A",
"^. c #737785",
"/. c #7A7772",
"(. c #8D792D",
"_. c #8C7933",
":. c #757988",
"<. c #7B797D",
"[. c #747B8F",
"}. c #7D798A",
"|. c #807984",
"1. c #7A7B84",
"2. c #787C8A",
"3. c #837A80",
"4. c #977C32",
"5. c #877986",
"6. c #917E3F",
"7. c #777E92",
"8. c #7A7E8C",
"9. c #807D8D",
"0. c #877D7A",
"a. c #7C808F",
"b. c #837F90",
"c. c #7B8296",
"d. c #7E8291",
"e. c #887F94",
"f. c #98843E",
"g. c #90826B",
"h. c #9E8339",
"i. c #828297",
"j. c #898471",
"k. c #9D862C",
"l. c #A38525",
"m. c #818593",
"n. c #A28534",
"o. c #8D8489",
"p. c #85868F",
"q. c #85859A",
"r. c #A5872F",
"s. c #8B8590",
"t. c #838796",
"u. c #918585",
"v. c #8D8875",
"w. c #8A8697",
"x. c #9D884E",
"y. c #868A99",
"z. c #8C8993",
"A. c #AD8932",
"B. c #8C8A8E",
"C. c #8A8A9F",
"D. c #A58D33",
"E. c #AB8C2C",
"F. c #928C79",
"G. c #858CA0",
"H. c #AA8C34",
"I. c #A58B4D",
"J. c #9089A1",
"K. c #A58E3B",
"L. c #898D9C",
"M. c #AC8E3D",
"N. c #A99036",
"O. c #938D98",
"P. c #8B8F9E",
"Q. c #9B8E7D",
"R. c #8E8EA4",
"S. c #AE9037",
"T. c #B09131",
"U. c #AB9145",
"V. c #8D91A0",
"W. c #AC9331",
"X. c #9390A0",
"Y. c #8F9396",
"Z. c #8F93A2",
"`. c #AE953B",
" + c #9592A3",
".+ c #B3943C",
"++ c #A19571",
"@+ c #9195A4",
"#+ c #A49194",
"$+ c #9B94A0",
"%+ c #9B93AB",
"&+ c #B1983E",
"*+ c #9497A6",
"=+ c #9996A6",
"-+ c #979996",
";+ c #9798A2",
">+ c #B5984D",
",+ c #B09A53",
"'+ c #9D99AA",
")+ c #979BAA",
"!+ c #A098B0",
"~+ c #BC9C43",
"{+ c #9A9FA1",
"]+ c #BBA03F",
"^+ c #C2A141",
"/+ c #9EA2B1",
"(+ c #AD9EB8",
"_+ c #ACA2A8",
":+ c #AFA1AF",
"<+ c #B9A66E",
"[+ c #A9A7AB",
"}+ c #A9ABA8",
"|+ c #B7A9B6",
"1+ c #B2ABB6",
"2+ c #AFACBD",
"3+ c #B0AEB2",
"4+ c #BCABB3",
"5+ c #C7B068",
"6+ c #BDAEC8",
"7+ c #CBB46B",
"8+ c #BBB1B8",
"9+ c #D3B56E",
"0+ c #D3B769",
"a+ c #CFB86F",
"b+ c #B5BABD",
"c+ c #B8BAB7",
"d+ c #BFBDC1",
"e+ c #BFBCCD",
"f+ c #BEC1BD",
"g+ c #C6C8C5",
"h+ c #C6CCCE",
"i+ c #E0CD7B",
"j+ c #D0CDD1",
"k+ c #D2D0D4",
"l+ c #D6D4D8",
"m+ c #D7D8E2",
"n+ c #DBD8DD",
"o+ c #DADCD9",
"p+ c #D8DDE0",
"q+ c #DCDDE7",
"r+ c #F4E08D",
"s+ c #E1E2EC",
"t+ c #E3E5E1",
"u+ c #E8E5EA",
"v+ c #E5E6F0",
"w+ c #ECE9EE",
"x+ c #E9EAF4",
"y+ c #EFEDF1",
"z+ c #EDEEF8",
"A+ c #F0F2EF",
"B+ c #F4F1F6",
"C+ c #F2F3FD",
"D+ c #F8F5FA",
"E+ c #FBF8FD",
"F+ c #FCFEFB",
"G+ c #FEFFFC",
"+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ",
"+ D D D D D D D D D D D D D D D D D D D D D D D E+B+B+B+y+y+z+y+y+y+x+x+x+w+w+u+u+u+s+s+s+s+[+G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D B+=+=+*+*+ +V.P.L.L.y.y.t.m.m.d.a.8.2.:.:.^.} G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D B+'+)+)+'+*+*+Z.V.P.L.L.y.y.t.m.m.d.a.8.2.2.2 G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D z+*+)+*+*+*+Z.*+Z.1.Z Z Z $.y.m.d.a.8.2.2.2.2 G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D z+=+*+*+*+Z.=+K @ # . . . + = ^.m.8.2.:.:.^.} G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D y+*+*+*+V.P._ + + + + + + + + + 4 #.#.,.^.^.} G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D y+ +*+Z./+, + + + + + + + + /.f+g+3 $ 2 !.!.} G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D y+X.Z.*+; + + + + + + + + + -+G+G+G+% _ !.,.} G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D y+P.V.2.@ + + + + + + + + + -+G+G+G+3+! ,.,.} G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D y+L.P.B + + + + + + + + + + -+G+G+G+o+5 #.#.[ G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D x+L.L.B + + + + + + + + + + -+G+G+G+A+y #...: G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D x+L.L.B + + + + % b d a l d f+G+G+G+A+y ....: G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D w+y.y.B + + + + = t+G+G+G+G+G+G+G+G+A+r ..T : G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D w+t.y.v + + + + = o+G+G+G+G+G+G+G+G+o+3 R R : G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D u+m.t.1.$ + + + = o+G+G+G+G+G+G+G+G+g+> R R ( G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D u+m.m.y.c + + + = o+G+G+G+G+G+G+G+D+= ~ R L ( G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D u+d.m.H ^ . l a l t+G+G+G+G+G+G+G+1 + ^ L E ( G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D s+a.d.q + + G t+G+G+G+G+G+G+G+p+b + + ! E C / G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D s+8.a.m + + + + u }+g+G+o+c+u # + + + ) z z / G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D s+2.8.,.q q q m k g c 7 9 c g g g c c j z z / G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D s+2.2.2.2.:.^.^.,.,.,.#.....R R P L E z z z ] G+",
"+ D D D D D D D D D D D D D D D D D D D D D D D s+:.2.:.:.!.!.,.#.#.....T R R L E C z z w w ] G+",
"+ &.&.&.&.&.&.&.&.&.&.&.&.&.@.@.&.@.@.@.@.@.@.S Y.} 2 } } } } } } } : : : : : ( ( ( ( / / ] ) G+",
"+ D+s+s+s+s+q+q+q+q+q+q+m+m+m+b+m+m+m+m+m+m+m+B.B+n+n+n+n+n+n+n+l+l+l+l+l+l+k+k+j+j+j+j+j+j+{+G+",
"+ B+=+)+'+*+Z.=+Z.V.P.L.L.y.t.V.h 2.a.E z z R ( D+'+'+)+'+*+=+Z.V.P.L.L.y.y.t.m.m.d.a.8.2.2.2 G+",
"+ B+=+'+'+,.@ H Z.V.P.L.L.y.y.t.y.q 2.z . + | ( C+)+'+)+*+*+=+Z.V.P.L.L.y.y.t.m.m.d.a.8.2.2.2 G+",
"+ B+=+)+=+y.t.i V.P.L.y.y.t.m.m.d.m.5 2.L + 3 / C+'+)+*+=+Z.Z.V.P.L.L.y.t.t.m.d.d.a.8.2.2.:.2 G+",
"+ B+Z.*+=+P.9 t.P.L.y.y.t.m.m.d.a.8.m.7 #.E 4 / C+*+*+=+Z.Z.R.P.Q.Q.F.v.v.v.v.j.j.j.j.1.:.:.} G+",
"+ y+X.*+Z.Z.Z.P.L.y.y.t.m.m.d.a.w.s.3.<.| ^.,.] C+=+*+Z.Z.R.++>+.+T.E.E.l.H.H.H.E.T.f.<.^.^.} G+",
"+ z+X.*+V.V.P.L.y.y.t.m.m.d.J.(+o.I v ].o.! ..] C+Z.*+Z.R.0+a+7+7+5+7+5+5+5+5+5+5+h.6.].!.!.} G+",
"+ z+P.Z.P.P.L.y.y.t.m.m.C.3.%+2+1+=.v B y ^.4 ' C+V.Z.V.R.a+^+^+^+^+^+]+]+]+^+~+A 4._.].,.,.} G+",
"+ z+L.V.P.L.y.y.t.m.m.9.e.6+f 8 c V B Z #.,.!.. C+P.V.P.G.a+~+~+~+~+~+&+&+&+`..+t (._.=.#.#.} G+",
"+ z+y.P.L.y.y.t.t.w.|.|+H b 8 k H O q $.v #.#.] z+L.P.a.q.a+~+~+`.r.H.N.E.,+`.`.t {._.=.#.#.[ G+",
"+ x+y.P.y.y.t.m.:.|+:+v 8 9 B #.$.}.q.p m ....) z+L.*+< [.a+~+~+&+H.i+r+N.>+`.H.t (.>.=.....: G+",
"+ x+t.L.y.t.d.=+_+|.h 8 i Q ,.2.Z 9.r i q ....) z+V.< < [.a+~+~+`.r.0+9++.,+N.H.t %.+.` ....: G+",
"+ w+t.y.t.b.8+O.|.8 b v ..,.}.e.*.q 8 k B T T ' z+L.$.{ [.a+~+&+.+U.>+6.x.<+E.D.t %.U Y R R : G+",
"+ u+m.t.;+u.1+k 8 h Q ,.,.!+5.).c 8 i B R R R ' z+t.y.Q ~.7+~+&+&+`.`.W.S.H.N.N.t U +.` R R : G+",
"+ d+,.m.4+O.c 9 q $...t.:+B X 7 9 q Q R R R R > x+t.t.m.c.7+M.K.K.D.k.k.n.k.k.k.t %.+.` R R ( G+",
"+ w+4 P.o.B b B ,.$.e+O s.g 8 i B R R R R P P > x+m.t.d.i.<+M F F F x s s s o o o %.+.N P L ( G+",
"+ u+)+: ).0.m Q P.$+s.H 8 9 q R R R R R L L L > x+d.m.d.7..+U.I.I.x.A.h.l._.6.(.-.;. .J L L ( G+",
"+ u+,.L.k $.#+_+X.].i 8 i B R R R R T L E E C > v+a.d.8.8.g.0.^.!.!./.=.'.....R W W J E C C / G+",
"+ v+6 L L./ |._+N 8 b q H ....R R R , R C z C > v+8.a.8.2.:.^.!.!.,.#.#.....R R R L E C z z / G+",
"+ s+0 + j L.g i i 5 4 + ^ B 2 k } _ . c 7 c c $ v+2.8.2.:.^.!.!.,.#.#.....R R R L E C z z z / G+",
"+ s+0 + + n :.7 :.,.* z , w - : + #.$ * z ] + % v+2.2.2.:.^.!.,.,.#.....T R R L L E z z w w ] G+",
"+ u+2.z.p.p.8.y.2 C B ,.R #.q R k R j E c c 9 @ x+8.a.8.2.:.:.^.!.,.#.#.....R R P L E z z z ] G+",
"+ f+; ; ; ; ; - , $ & - - - - & & & % % % % $ @ h+; , ; ; ; ; - - - - - - & & * & % % % % % . G+",
"+ G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+"};

1149
WPrefs.app/xpm/drawer.xpm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -43,6 +43,7 @@
NewStyle = "new";
DisableDock = NO;
DisableClip = NO;
DisableDrawers = NO;
Superfluous = YES;
StickyIcons = NO;
SaveSessionOnExit = NO;
@@ -131,4 +132,8 @@
MenuTitleBack = (solid, black);
MenuTextBack = (solid, "rgb:aa/aa/aa");
IconBack = (dgradient, "rgb:a6/a6/b6", "rgb:51/55/61");
ClipAutocollapseDelay = 1000;
ClipAutolowerDelay = 1000;
ClipAutoexpandDelay = 600;
ClipAutoraiseDelay = 600;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -13,6 +13,7 @@ defsdata_DATA = \
defaultterm.xpm\
draw.tiff\
draw.xpm\
Drawer.png\
Ear.png\
Ftp.png\
GNUstep3D.tiff\

View File

@@ -3,6 +3,7 @@
Logo.WMPanel = {Icon = GNUstep.tiff;};
Tile.WMClip = {Icon = clip.tiff;};
WPrefs = {Icon = "/usr/share/lib/GNUstep/System/Applications/WPrefs.app/WPrefs.tiff";};
WMDrawer = { Icon = Drawer.png; };
Dockit = {Icon = GNUstep.tiff;};
WMSoundServer = {Icon = Sound.tiff;};
"*" = {Icon = defaultAppIcon.tiff;};

View File

@@ -419,6 +419,12 @@ typedef struct WPreferences {
char cycle_active_head_only; /* Cycle only windows on the active head */
char cycle_ignore_minimized; /* Ignore minimized windows when cycling */
/* All delays here are in ms. 0 means instant auto-action. */
int clip_auto_raise_delay; /* Delay after which the clip will be raised when entered */
int clip_auto_lower_delay; /* Delay after which the clip will be lowered when leaved */
int clip_auto_expand_delay; /* Delay after which the clip will expand when entered */
int clip_auto_collapse_delay; /* Delay after which the clip will collapse when leaved */
RImage *swtileImage;
RImage *swbackImage[9];
@@ -427,6 +433,9 @@ typedef struct WPreferences {
struct {
unsigned int nodock:1; /* don't display the dock */
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 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 noautolaunch:1; /* don't autolaunch apps */
unsigned int norestore:1; /* don't restore session */

View File

@@ -64,6 +64,7 @@ extern WDDomain *WDWindowAttributes;
extern XContext wWinContext;
#define MOD_MASK wPreferences.modifier_mask
#define ICON_SIZE wPreferences.icon_size
void appIconMouseDown(WObjDescriptor * desc, XEvent * event);
static void iconDblClick(WObjDescriptor * desc, XEvent * event);
@@ -129,6 +130,8 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
if (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);
#ifdef XDND
@@ -199,7 +202,7 @@ void paint_app_icon(WApplication *wapp)
{
WIcon *icon;
WScreen *scr = wapp->main_window_desc->screen_ptr;
WDock *clip = scr->workspaces[scr->current_workspace]->clip;
WDock *attracting_dock;
int x = 0, y = 0;
Bool update_icon = False;
@@ -213,13 +216,17 @@ void paint_app_icon(WApplication *wapp)
if (wapp->app_icon->docked)
return;
if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x, &y)) {
attracting_dock = scr->attracting_drawer != NULL ?
scr->attracting_drawer :
scr->workspaces[scr->current_workspace]->clip;
if (attracting_dock && attracting_dock->attract_icons &&
wDockFindFreeSlot(attracting_dock, &x, &y)) {
wapp->app_icon->attracted = 1;
if (!icon->shadowed) {
icon->shadowed = 1;
update_icon = True;
}
wDockAttachIcon(clip, wapp->app_icon, x, y, update_icon);
wDockAttachIcon(attracting_dock, wapp->app_icon, x, y, update_icon);
} else {
/* We must know if the icon is painted in the screen,
* because if painted, then PlaceIcon will return the next
@@ -238,7 +245,7 @@ void paint_app_icon(WApplication *wapp)
wapp->app_icon->next == NULL && wapp->app_icon->prev == NULL)
add_to_appicon_list(scr, wapp->app_icon);
if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
if (!attracting_dock || !wapp->app_icon->attracted || !attracting_dock->collapsed)
XMapWindow(dpy, icon->core->window);
if (wPreferences.auto_arrange_icons && !wapp->app_icon->attracted)
@@ -273,6 +280,9 @@ void removeAppIconFor(WApplication *wapp)
wAppIconPaint(wapp->app_icon);
} else if (wapp->app_icon->docked) {
wapp->app_icon->running = 0;
if (wapp->app_icon->dock->type == WM_DRAWER) {
wDrawerFillTheGap(wapp->app_icon->dock, wapp->app_icon, True);
}
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
} else {
wAppIconDestroy(wapp->app_icon);
@@ -671,24 +681,8 @@ static void iconDblClick(WObjDescriptor *desc, XEvent *event)
void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
{
WAppIcon *aicon = desc->parent;
WIcon *icon = aicon->icon;
XEvent ev;
int x = aicon->x_pos, y = aicon->y_pos;
int dx = event->xbutton.x, dy = event->xbutton.y;
int grabbed = 0;
int done = 0;
int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
WScreen *scr = icon->core->screen_ptr;
WWorkspace *workspace = scr->workspaces[scr->current_workspace];
int shad_x = 0, shad_y = 0, docking = 0, dockable, collapsed = 0;
int ix, iy;
int clickButton = event->xbutton.button;
Pixmap ghost = None;
Window wins[2];
Bool movingSingle = False;
int oldX = x;
int oldY = y;
Bool hasMoved = False;
WScreen *scr = aicon->icon->core->screen_ptr;
Bool hasMoved;
if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
return;
@@ -733,24 +727,98 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
return;
}
if (event->xbutton.state & MOD_MASK)
wLowerFrame(icon->core);
else
hasMoved = wHandleAppIconMove(aicon, event);
if (wPreferences.single_click && !hasMoved && aicon->dock != NULL)
{
iconDblClick(desc, event);
}
}
Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
{
WIcon *icon = aicon->icon;
WScreen *scr = icon->core->screen_ptr;
WDock *originalDock = aicon->dock; /* can be NULL */
WDock *lastDock = originalDock;
WDock *allDocks[scr->drawer_count + 2]; /* clip, dock and drawers (order determined at runtime) */
WDrawerChain *dc;
Bool done = False, dockable, ondock;
Bool grabbed = False;
Bool collapsed = False; /* Stores the collapsed state of lastDock, before the moving appicon entered it */
int superfluous = wPreferences.superfluous; /* we cache it to avoid problems */
int omnipresent = aicon->omnipresent; /* this must be cached */
Bool showed_all_clips = False;
int clickButton = event->xbutton.button;
Pixmap ghost = None;
Window wins[2]; /* Managing shadow window */
XEvent ev;
int x = aicon->x_pos, y = aicon->y_pos;
int ofs_x = event->xbutton.x, ofs_y = event->xbutton.y;
int shad_x = x, shad_y = y;
int ix = aicon->xindex, iy = aicon->yindex;
int i;
int oldX = x;
int oldY = y;
Bool hasMoved = False;
if (wPreferences.flags.noupdates && originalDock != NULL)
return False;
if (!(event->xbutton.state & MOD_MASK))
wRaiseFrame(icon->core);
else {
/* If Mod is pressed for an docked appicon, assume it is to undock it,
* so don't lower it */
if (originalDock == NULL)
wLowerFrame(icon->core);
}
if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, None, CurrentTime) != GrabSuccess)
wwarning("pointer grab failed for appicon move");
GrabModeAsync, None, None, CurrentTime) != GrabSuccess) {
wwarning("Pointer grab failed in wHandleAppIconMove");
}
if (wPreferences.flags.nodock && wPreferences.flags.noclip)
if (originalDock != NULL) {
dockable = True;
ondock = True;
}
else {
ondock = False;
if (wPreferences.flags.nodock && wPreferences.flags.noclip && wPreferences.flags.nodrawer)
dockable = 0;
else
dockable = canBeDocked(icon->owner);
}
/* We try the various docks in that order:
* - First, the dock the appicon comes from, if any
* - Then, the drawers
* - Then, the "dock" (WM_DOCK)
* - Finally, the clip
*/
i = 0;
if (originalDock != NULL)
allDocks[ i++ ] = originalDock;
/* Testing scr->drawers is enough, no need to test wPreferences.flags.nodrawer */
for (dc = scr->drawers; dc != NULL; dc = dc->next) {
if (dc->adrawer != originalDock)
allDocks[ i++ ] = dc->adrawer;
}
if (!wPreferences.flags.nodock && scr->dock != originalDock)
allDocks[ i++ ] = scr->dock;
if (!wPreferences.flags.noclip &&
originalDock != scr->workspaces[scr->current_workspace]->clip)
allDocks[ i++ ] = scr->workspaces[scr->current_workspace]->clip;
for ( ; i < scr->drawer_count + 2; i++) /* In case the clip, the dock, or both, are disabled */
allDocks[ i ] = NULL;
wins[0] = icon->core->window;
wins[1] = scr->dock_shadow;
XRestackWindows(dpy, wins, 2);
XMoveResizeWindow(dpy, scr->dock_shadow, aicon->x_pos, aicon->y_pos, ICON_SIZE, ICON_SIZE);
if (superfluous) {
if (icon->pixmap != None)
ghost = MakeGhostIcon(scr, icon->pixmap);
@@ -759,6 +827,8 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
XSetWindowBackgroundPixmap(dpy, scr->dock_shadow, ghost);
XClearWindow(dpy, scr->dock_shadow);
}
if (ondock)
XMapWindow(dpy, scr->dock_shadow);
while (!done) {
WMMaskEvent(dpy, PointerMotionMask | ButtonReleaseMask | ButtonPressMask
@@ -778,8 +848,8 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
case MotionNotify:
hasMoved = True;
if (!grabbed) {
if (abs(dx - ev.xmotion.x) >= MOVE_THRESHOLD
|| abs(dy - ev.xmotion.y) >= MOVE_THRESHOLD) {
if (abs(ofs_x - ev.xmotion.x) >= MOVE_THRESHOLD
|| abs(ofs_y - ev.xmotion.y) >= MOVE_THRESHOLD) {
XChangeActivePointerGrab(dpy, ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask,
wCursor[WCUR_MOVE], CurrentTime);
@@ -788,68 +858,92 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
break;
}
}
x = ev.xmotion.x_root - dx;
y = ev.xmotion.y_root - dy;
if (movingSingle)
XMoveWindow(dpy, icon->core->window, x, y);
else
if (omnipresent && !showed_all_clips) {
int i;
for (i = 0; i < scr->workspace_count; i++) {
if (i == scr->current_workspace)
continue;
wDockShowIcons(scr->workspaces[i]->clip);
/* Note: if dock is collapsed (for instance, because it
auto-collapses), its icons still won't show up */
}
showed_all_clips = True; /* To prevent flickering */
}
x = ev.xmotion.x_root - ofs_x;
y = ev.xmotion.y_root - ofs_y;
wAppIconMove(aicon, x, y);
if (dockable) {
if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y, &ix, &iy, False)) {
shad_x = scr->dock->x_pos + ix * wPreferences.icon_size;
shad_y = scr->dock->y_pos + iy * wPreferences.icon_size;
if (scr->last_dock != scr->dock && collapsed) {
scr->last_dock->collapsed = 1;
wDockHideIcons(scr->last_dock);
collapsed = 0;
WDock *theNewDock = NULL;
if (!(ev.xmotion.state & MOD_MASK) || aicon->launching || aicon->lock) {
for (i = 0; dockable && i < scr->drawer_count + 2; i++) {
WDock *theDock = allDocks[i];
if (theDock == NULL)
break;
if (wDockSnapIcon(theDock, aicon, x, y, &ix, &iy, (theDock == originalDock))) {
theNewDock = theDock;
break;
}
if (!collapsed && (collapsed = scr->dock->collapsed)) {
scr->dock->collapsed = 0;
wDockShowIcons(scr->dock);
}
if (originalDock != NULL && theNewDock == NULL &&
(aicon->launching || aicon->lock || aicon->running)) {
/* In those cases, stay in lastDock if no dock really wants us */
theNewDock = lastDock;
}
}
if (lastDock != NULL && lastDock != theNewDock) {
/* Leave lastDock in the state we found it */
if (lastDock->type == WM_DRAWER) {
wDrawerFillTheGap(lastDock, aicon, (lastDock == originalDock));
}
if (collapsed) {
lastDock->collapsed = 1;
wDockHideIcons(lastDock);
collapsed = False;
}
if (lastDock->auto_raise_lower) {
wDockLower(lastDock);
}
}
if (theNewDock != NULL) {
if (lastDock != theNewDock) {
collapsed = theNewDock->collapsed;
if (collapsed) {
theNewDock->collapsed = 0;
wDockShowIcons(theNewDock);
}
if (theNewDock->auto_raise_lower) {
wDockRaise(theNewDock);
/* And raise the moving tile above it */
wRaiseFrame(aicon->icon->core);
}
lastDock = theNewDock;
}
if (scr->dock->auto_raise_lower)
wDockRaise(scr->dock);
scr->last_dock = scr->dock;
shad_x = lastDock->x_pos + ix*wPreferences.icon_size;
shad_y = lastDock->y_pos + iy*wPreferences.icon_size;
XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
if (!docking)
if (!ondock) {
XMapWindow(dpy, scr->dock_shadow);
docking = 1;
} else if (workspace->clip &&
wDockSnapIcon(workspace->clip, aicon, x, y, &ix, &iy, False)) {
shad_x = workspace->clip->x_pos + ix * wPreferences.icon_size;
shad_y = workspace->clip->y_pos + iy * wPreferences.icon_size;
if (scr->last_dock != workspace->clip && collapsed) {
scr->last_dock->collapsed = 1;
wDockHideIcons(scr->last_dock);
collapsed = 0;
}
if (!collapsed && (collapsed = workspace->clip->collapsed)) {
workspace->clip->collapsed = 0;
wDockShowIcons(workspace->clip);
}
if (workspace->clip->auto_raise_lower)
wDockRaise(workspace->clip);
scr->last_dock = workspace->clip;
XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
if (!docking)
XMapWindow(dpy, scr->dock_shadow);
docking = 1;
} else if (docking) {
ondock = 1;
} else {
lastDock = theNewDock; // i.e., NULL
if (ondock) {
XUnmapWindow(dpy, scr->dock_shadow);
docking = 0;
/*
* Leaving that weird comment for now.
* But if we see no gap, there is no need to fill one!
* We could test ondock first and the lastDock to NULL afterwards
if (lastDock_before_it_was_null->type == WM_DRAWER) {
wDrawerFillTheGap(lastDock, aicon, (lastDock == originalDock));
} */
}
ondock = 0;
}
break;
@@ -861,59 +955,130 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
break;
XUngrabPointer(dpy, CurrentTime);
if (docking) {
Bool docked;
/* icon is trying to be docked */
Bool docked = False;
if (ondock) {
SlideWindow(icon->core->window, x, y, shad_x, shad_y);
XUnmapWindow(dpy, scr->dock_shadow);
docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy, False);
if (scr->last_dock->auto_collapse)
collapsed = 0;
if (workspace->clip &&
workspace->clip != scr->last_dock && workspace->clip->auto_raise_lower)
wDockLower(workspace->clip);
if (originalDock == NULL) { // docking an undocked appicon
docked = wDockAttachIcon(lastDock, aicon, ix, iy, False);
if (!docked) {
/* If icon could not be docked, slide it back to the old
* position */
/* AppIcon got rejected (happens only when we can't get the
command for that appicon, and the user cancels the
wInputDialog asking for one). Make the rejection obvious by
sliding the icon to its old position */
if (lastDock->type == WM_DRAWER) {
// Also fill the gap left in the drawer
wDrawerFillTheGap(lastDock, aicon, False);
}
SlideWindow(icon->core->window, x, y, oldX, oldY);
}
} else {
if (movingSingle) {
/* move back to its place */
}
else { // moving a docked appicon to a dock
if (originalDock == lastDock) {
docked = True;
wDockReattachIcon(originalDock, aicon, ix, iy);
}
else {
docked = wDockMoveIconBetweenDocks(originalDock, lastDock, aicon, ix, iy);
if (!docked) {
/* Possible scenario: user moved an auto-attracted appicon
from the clip to the dock, and cancelled the wInputDialog
asking for a command */
if (lastDock->type == WM_DRAWER) {
wDrawerFillTheGap(lastDock, aicon, False);
}
/* If aicon comes from a drawer, make some room to reattach it */
if (originalDock->type == WM_DRAWER) {
WAppIcon *aiconsToShift[ originalDock->icon_count ];
int j = 0;
for (i = 0; i < originalDock->max_icons; i++) {
WAppIcon *ai = originalDock->icon_array[ i ];
if (ai && ai != aicon &&
abs(ai->xindex) >= abs(aicon->xindex))
aiconsToShift[j++] = ai;
}
if (j != originalDock->icon_count - abs(aicon->xindex) - 1)
// Trust this never happens?
wwarning("Shifting j=%d appicons (instead of %d!) to reinsert aicon at index %d.",
j, originalDock->icon_count - abs(aicon->xindex) - 1, aicon->xindex);
wSlideAppicons(aiconsToShift, j, originalDock->on_right_side);
// Trust the appicon is inserted at exactly the same place, so its oldX/oldY are consistent with its "new" location?
}
SlideWindow(icon->core->window, x, y, oldX, oldY);
wAppIconMove(aicon, oldX, oldY);
} else {
XMoveWindow(dpy, icon->core->window, x, y);
aicon->x_pos = x;
aicon->y_pos = y;
wDockReattachIcon(originalDock, aicon, aicon->xindex, aicon->yindex);
}
if (workspace->clip && workspace->clip->auto_raise_lower)
wDockLower(workspace->clip);
else {
if (originalDock->auto_collapse && !originalDock->collapsed) {
originalDock->collapsed = 1;
wDockHideIcons(originalDock);
}
if (collapsed) {
scr->last_dock->collapsed = 1;
wDockHideIcons(scr->last_dock);
if (originalDock->auto_raise_lower)
wDockLower(originalDock);
}
}
}
// No matter what happened above, check to lower lastDock
// Don't see why I commented out the following 2 lines
/* if (lastDock->auto_raise_lower)
wDockLower(lastDock); */
/* If docked (or tried to dock) to a auto_collapsing dock, unset
* collapsed, so that wHandleAppIconMove doesn't collapse it
* right away (the timer will take care of it) */
if (lastDock->auto_collapse)
collapsed = 0;
}
else {
if (originalDock != NULL) { /* Detaching a docked appicon */
if (superfluous) {
if (!aicon->running && !wPreferences.no_animations) {
/* We need to deselect it, even if is deselected in
* wDockDetach(), because else DoKaboom() will fail.
*/
if (aicon->icon->selected)
wIconSelect(aicon->icon);
DoKaboom(scr, aicon->icon->core->window, x, y);
}
}
wDockDetach(originalDock, aicon);
if (originalDock->auto_collapse && !originalDock->collapsed) {
originalDock->collapsed = 1;
wDockHideIcons(originalDock);
}
if (originalDock->auto_raise_lower)
wDockLower(originalDock);
}
}
// Can't remember why the icon hiding is better done above than below (commented out)
// Also, lastDock is quite different from originalDock
/*
if (collapsed) {
lastDock->collapsed = 1;
wDockHideIcons(lastDock);
collapsed = 0;
}
*/
if (superfluous) {
if (ghost != None)
XFreePixmap(dpy, ghost);
XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel);
}
if (wPreferences.auto_arrange_icons)
if (showed_all_clips) {
int i;
for (i = 0; i < scr->workspace_count; i++) {
if (i == scr->current_workspace)
continue;
wDockHideIcons(scr->workspaces[i]->clip);
}
}
if (wPreferences.auto_arrange_icons && !(originalDock != NULL && docked))
/* Need to rearrange unless moving from dock to dock */
wArrangeIcons(scr, True);
if (wPreferences.single_click && !hasMoved)
iconDblClick(desc, event);
done = 1;
break;
return hasMoved;
}
}
return False; /* Never reached */
}
/* This function save the application icon and store the path in the Dictionary */
@@ -980,7 +1145,7 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m
if (!wapp->app_icon && scr->dock)
wapp->app_icon = findDockIconFor(scr->dock, main_window);
/* finally check clips */
/* check clips */
if (!wapp->app_icon) {
int i;
for (i = 0; i < scr->workspace_count; i++) {
@@ -992,6 +1157,16 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m
}
}
/* Finally check drawers */
if (!wapp->app_icon) {
WDrawerChain *dc;
for (dc = scr->drawers; dc != NULL; dc = dc->next) {
wapp->app_icon = findDockIconFor(dc->adrawer, main_window);
if (wapp->app_icon)
break;
}
}
/* If created, then set some flags */
if (wapp->app_icon) {
WWindow *mainw = wapp->main_window_desc;

View File

@@ -71,6 +71,7 @@ typedef struct WAppIcon {
WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
char *wm_class, int tile);
Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event);
void wAppIconDestroy(WAppIcon *aicon);
void wAppIconPaint(WAppIcon *aicon);

View File

@@ -113,6 +113,8 @@ static int getPropList();
static int setJustify();
static int setClearance();
static int setIfDockPresent();
static int setClipMergedInDock();
static int setWrapAppiconsInDock();
static int setStickyIcons();
static int setWidgetColor();
static int setIconTile();
@@ -332,6 +334,10 @@ WDefaultEntry staticOptionList[] = {
NULL, getBool, setIfDockPresent, NULL, NULL},
{"DisableClip", "NO", (void *)WM_CLIP,
NULL, getBool, setIfDockPresent, NULL, NULL},
{"DisableDrawers", "NO", (void *)WM_DRAWER,
NULL, getBool, setIfDockPresent, NULL, NULL},
{"ClipMergedInDock", "NO", NULL,
NULL, getBool, setClipMergedInDock, NULL, NULL},
{"DisableMiniwindows", "NO", NULL,
&wPreferences.disable_miniwindows, getBool, NULL, NULL, NULL}
};
@@ -401,6 +407,16 @@ WDefaultEntry optionList[] = {
&wPreferences.do_not_make_appicons_bounce, getBool, NULL, NULL, NULL},
{"DoubleClickTime", "250", (void *)&wPreferences.dblclick_time,
&wPreferences.dblclick_time, getInt, setDoubleClick, NULL, NULL},
{"ClipAutoraiseDelay", "600", NULL,
&wPreferences.clip_auto_raise_delay, getInt, NULL, NULL, NULL},
{"ClipAutolowerDelay", "1000", NULL,
&wPreferences.clip_auto_lower_delay, getInt, NULL, NULL, NULL},
{"ClipAutoexpandDelay", "600", NULL,
&wPreferences.clip_auto_expand_delay, getInt, NULL, NULL, NULL},
{"ClipAutocollapseDelay", "1000", NULL,
&wPreferences.clip_auto_collapse_delay, getInt, NULL, NULL, NULL},
{"WrapAppiconsInDock", "YES", NULL,
NULL, getBool, setWrapAppiconsInDock, NULL, NULL},
{"AlignSubmenus", "NO", NULL,
&wPreferences.align_menus, getBool, NULL, NULL, NULL},
{"ViKeyMenus", "NO", NULL,
@@ -1180,6 +1196,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
void wDefaultUpdateIcons(WScreen *scr)
{
WAppIcon *aicon = scr->app_icon_list;
WDrawerChain *dc;
WWindow *wwin = scr->focused_window;
while (aicon) {
@@ -1189,9 +1206,12 @@ void wDefaultUpdateIcons(WScreen *scr)
aicon = aicon->next;
}
if (!wPreferences.flags.noclip)
if (!wPreferences.flags.noclip || wPreferences.flags.clip_merged_in_dock)
wClipIconPaint(scr->clip_icon);
for (dc = scr->drawers; dc != NULL; dc = dc->next)
wDrawerIconPaint(dc->adrawer->icon_array[0]);
while (wwin) {
if (wwin->icon && wwin->flags.miniaturized)
wIconChangeImageFile(wwin->icon, NULL);
@@ -2373,16 +2393,34 @@ static int setIfDockPresent(WScreen * scr, WDefaultEntry * entry, char *flag, lo
switch (which) {
case WM_DOCK:
wPreferences.flags.nodock = wPreferences.flags.nodock || *flag;
// Drawers require the dock
wPreferences.flags.nodrawer = wPreferences.flags.nodrawer || wPreferences.flags.nodock;
break;
case WM_CLIP:
wPreferences.flags.noclip = wPreferences.flags.noclip || *flag;
break;
case WM_DRAWER:
wPreferences.flags.nodrawer = wPreferences.flags.nodrawer || *flag;
break;
default:
break;
}
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)
{
wPreferences.flags.wrap_appicons_in_dock = *flag;
return 0;
}
static int setStickyIcons(WScreen * scr, WDefaultEntry * entry, void *bar, void *foo)
{
if (scr->workspaces) {
@@ -2420,13 +2458,20 @@ static int setIconTile(WScreen * scr, WDefaultEntry * entry, WTexture ** texture
/* put the icon in the noticeboard hint */
PropSetIconTileHint(scr, img);
if (!wPreferences.flags.noclip) {
if (!wPreferences.flags.noclip || wPreferences.flags.clip_merged_in_dock) {
if (scr->clip_tile) {
RReleaseImage(scr->clip_tile);
}
scr->clip_tile = wClipMakeTile(scr, img);
}
if (!wPreferences.flags.nodrawer) {
if (scr->drawer_tile) {
RReleaseImage(scr->drawer_tile);
}
scr->drawer_tile = wDrawerMakeTile(scr, img);
}
scr->icon_tile_pixmap = pixmap;
if (scr->def_icon_rimage) {

View File

@@ -54,4 +54,7 @@ char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char *comma
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
void wDefaultPurgeInfo(WScreen *scr, char *instance, char *class);
#endif /* WMDEFAULTS_H_ */

1826
src/dock.c

File diff suppressed because it is too large Load Diff

View File

@@ -39,6 +39,7 @@ typedef struct WDock {
#define WM_DOCK 0
#define WM_CLIP 1
#define WM_DRAWER 2
int type;
WMagicNumber auto_expand_magic;
@@ -66,7 +67,7 @@ typedef struct WDock {
WDock *wDockCreate(WScreen *scr, int type);
WDock *wDockCreate(WScreen *scr, int type, char *name);
WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type);
void wDockDestroy(WDock *dock);
@@ -82,6 +83,11 @@ Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
int *ret_x, int *ret_y, int redocking);
Bool wDockFindFreeSlot(WDock *dock, int *req_x, int *req_y);
void wDockDetach(WDock *dock, WAppIcon *icon);
Bool wDockMoveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y);
void wDockReattachIcon(WDock *dock, WAppIcon *icon, int x, int y);
void wSlideAppicons(WAppIcon **appicons, int n, int to_the_left);
void wDrawerFillTheGap(WDock *drawer, WAppIcon *aicon, Bool redocking);
void wDockFinishLaunch(WDock *dock, WAppIcon *icon);
void wDockTrackWindowLaunch(WDock *dock, Window window);
@@ -98,14 +104,27 @@ void wClipSaveState(WScreen *scr);
WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace);
WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state);
void wDrawerIconPaint(WAppIcon *dicon);
void wDrawersSaveState(WScreen *scr);
void wDrawersRestoreState(WScreen *scr);
int wIsADrawer(WScreen *scr, WAppIcon *aicon);
void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace);
RImage *wClipMakeTile(WScreen *scr, RImage *normalTile);
RImage* wDrawerMakeTile(WScreen *scr, RImage *normalTile);
#define WO_FAILED 0
#define WO_NOT_APPLICABLE 1
#define WO_SUCCESS 2
typedef enum
{
P_NORMAL = 0,
P_AUTO_RAISE_LOWER,
P_KEEP_ON_TOP,
} dockPosition;
int wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent);
#endif

View File

@@ -177,8 +177,11 @@ static void panelBtnCallback(WMWidget * self, void *data)
} else {
WAppIcon *aicon = panel->editedIcon;
// Cf dock.c:dockIconPaint(WAppIcon *aicon)?
if (aicon == aicon->icon->core->screen_ptr->clip_icon)
wClipIconPaint(aicon);
else if (wIsADrawer(aicon->icon->core->screen_ptr, aicon))
wDrawerIconPaint(aicon);
else
wAppIconPaint(aicon);

View File

@@ -73,6 +73,7 @@ WWindow * NextToFocusBefore(WWindow *wwin);
void move_window(Window win, int from_x, int from_y, int to_x, int to_y);
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int to_y);
RImage * wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);

View File

@@ -246,11 +246,21 @@ static void icon_update_pixmap(WIcon *icon, RImage *image)
int theight = 0;
WScreen *scr = icon->core->screen_ptr;
if (icon->tile_type == TILE_NORMAL) {
switch (icon->tile_type) {
case TILE_NORMAL:
tile = RCloneImage(scr->icon_tile);
} else {
break;
default:
wwarning("Unknown tileType: %d.\n", icon->tile_type);
// fallthrough to TILE_CLIP (emulate previous behaviour)
case TILE_CLIP:
assert(scr->clip_tile);
tile = RCloneImage(scr->clip_tile);
break;
case TILE_DRAWER:
assert(scr->drawer_tile);
tile = RCloneImage(scr->drawer_tile);
break;
}
if (image) {

View File

@@ -28,6 +28,7 @@
#define TILE_NORMAL 0
#define TILE_CLIP 1
#define TILE_DRAWER 2
typedef struct WIcon {
WCoreWindow *core;

View File

@@ -686,8 +686,11 @@ static int real_main(int argc, char **argv)
wPreferences.flags.norestore = 1;
} else if (strcmp(argv[i], "-nodock") == 0 || strcmp(argv[i], "--no-dock") == 0) {
wPreferences.flags.nodock = 1;
wPreferences.flags.nodrawer = 1;
} else if (strcmp(argv[i], "-noclip") == 0 || strcmp(argv[i], "--no-clip") == 0) {
wPreferences.flags.noclip = 1;
} else if (strcmp(argv[i], "-nodrawer") == 0 || strcmp(argv[i], "--no-drawer") == 0) {
wPreferences.flags.nodrawer = 1;
} else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
printf("Window Maker %s\n", VERSION);
exit(0);

View File

@@ -51,6 +51,7 @@
/**** global variables *****/
extern WPreferences wPreferences;
#define ICON_SIZE wPreferences.icon_size
/* XFetchName Wrapper */
Bool wFetchName(Display *dpy, Window win, char **winname)
@@ -144,11 +145,21 @@ void move_window(Window win, int from_x, int from_y, int to_x, int to_y)
}
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
{
Window *wins[1] = { &win };
SlideWindows(wins, 1, from_x, from_y, to_x, to_y);
}
/* wins is an array of Window, sorted from left to right, the first is
* going to be moved from (from_x,from_y) to (to_x,to_y) and the
* following windows are going to be offset by (ICON_SIZE*i,0) */
void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int to_y)
{
time_t time0 = time(NULL);
float dx, dy, x = from_x, y = from_y, sx, sy, px, py;
int dx_is_bigger = 0;
int slide_delay, slide_steps, slide_slowdown;
int i;
/* animation parameters */
static struct {
@@ -216,7 +227,9 @@ void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
px = (sy == 0 ? 0 : py * dx / dy);
}
XMoveWindow(dpy, win, (int)x, (int)y);
for (i = 0; i < n; i++) {
XMoveWindow(dpy, *wins[i], (int)x + i * ICON_SIZE, (int)y);
}
XFlush(dpy);
if (slide_delay > 0) {
wusleep(slide_delay * 1000L);
@@ -226,7 +239,9 @@ void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
if (time(NULL) - time0 > MAX_ANIMATION_TIME)
break;
}
XMoveWindow(dpy, win, to_x, to_y);
for (i = 0; i < n; i++) {
XMoveWindow(dpy, *wins[i], to_x + i * ICON_SIZE, to_y);
}
XSync(dpy, 0);
/* compress expose events */

View File

@@ -94,6 +94,7 @@ static WMPropList *dApplications = NULL;
static WMPropList *dWorkspace;
static WMPropList *dDock;
static WMPropList *dClip;
static WMPropList *dDrawers = NULL;
static void make_keys(void)
{
@@ -104,6 +105,7 @@ static void make_keys(void)
dWorkspace = WMCreatePLString("Workspace");
dDock = WMCreatePLString("Dock");
dClip = WMCreatePLString("Clip");
dDrawers = WMCreatePLString("Drawers");
}
/*
@@ -842,6 +844,8 @@ void wScreenRestoreState(WScreen * scr)
if (!wPreferences.flags.nodock) {
state = WMGetFromPLDictionary(scr->session_state, dDock);
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) {
@@ -849,6 +853,10 @@ void wScreenRestoreState(WScreen * scr)
scr->clip_icon = wClipRestoreState(scr, state);
}
if (!wPreferences.flags.nodrawer) {
wDrawersRestoreState(scr);
}
wWorkspaceRestoreState(scr);
wScreenUpdateUsableArea(scr);
@@ -895,6 +903,15 @@ void wScreenSaveState(WScreen * scr)
wWorkspaceSaveState(scr, old_state);
if (!wPreferences.flags.nodrawer) {
wDrawersSaveState(scr);
} else {
if ((foo = WMGetFromPLDictionary(old_state, dDrawers)) != NULL) {
WMPutInPLDictionary(scr->session_state, dDrawers, foo);
}
}
if (wPreferences.save_session_on_exit) {
wSessionSaveState(scr);
} else {

View File

@@ -62,6 +62,12 @@ typedef struct WAppIconChain {
} WAppIconChain;
/* Drawers, which are docks, really */
typedef struct WDrawerChain {
struct WDock *adrawer;
struct WDrawerChain *next;
} WDrawerChain;
/*
* each WScreen is saved into a context associated with it's root window
*/
@@ -219,16 +225,22 @@ typedef struct _WScreen {
struct WMenu *workspace_submenu; /* workspace list for window_menu */
struct WDock *dock; /* the application dock */
struct WMenu *dock_pos_menu; /* Dock position menu */
struct WPixmap *dock_dots; /* 3 dots for the Dock */
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_submenu; /* Workspace list for clips */
struct WMenu *clip_options; /* Options for Clip */
struct WMenu *clip_ws_menu; /* workspace menu for clip */
struct WMenu *drawer_menu; /* Menu for drawers */
struct WDock *last_dock;
WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
int global_icon_count; /* How many global icons do we have */
WDrawerChain *drawers; /* Chain of drawers */
/* Cache the following two informations, as they are used quite a lot */
int drawer_count; /* Nb of drawers that */
struct WDock *attracting_drawer; /* The drawer that auto-attracts icons, or NULL */
int keymove_tick;
struct RContext *rcontext; /* wrlib context */
@@ -236,8 +248,8 @@ typedef struct _WScreen {
WMScreen *wmscreen; /* for widget library */
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) */
Pixmap icon_tile_pixmap; /* For app supplied icons */
struct RImage *def_icon_rimage; /* Default RImage icon */

View File

@@ -236,17 +236,29 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
WMReleasePropList(shortcut);
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
int i;
char *name;
char *name = NULL;
if (wapp->app_icon->dock == scr->dock) {
name = "Dock";
} else {
}
if (name == NULL) // Try the clips
{
for (i = 0; i < scr->workspace_count; i++)
if (scr->workspaces[i]->clip == wapp->app_icon->dock)
break;
assert(i < scr->workspace_count);
/*n = i+1; */
if (i < scr->workspace_count)
name = scr->workspaces[i]->name;
}
if (name == NULL) // Try the drawers
{
WDrawerChain *dc;
for (dc = scr->drawers; dc != NULL; dc = dc->next)
{
if (dc->adrawer == wapp->app_icon->dock)
break;
}
assert(dc != NULL);
name = dc->adrawer->icon_array[0]->wm_instance;
}
dock = WMCreatePLString(name);
WMPutInPLDictionary(win_state, sDock, dock);
WMReleasePropList(dock);
@@ -462,7 +474,9 @@ void wSessionRestoreState(WScreen *scr)
if (sscanf(tmp, "%i", &n) != 1) {
if (!strcasecmp(tmp, "DOCK")) {
dock = scr->dock;
} else {
}
if (dock == NULL) // Try the clips
{
for (j = 0; j < scr->workspace_count; j++) {
if (strcmp(scr->workspaces[j]->name, tmp) == 0) {
dock = scr->workspaces[j]->clip;
@@ -470,6 +484,18 @@ void wSessionRestoreState(WScreen *scr)
}
}
}
if (dock == NULL) // Try the drawers
{
WDrawerChain *dc;
for (dc = scr->drawers; dc != NULL; dc = dc->next)
{
if (strcmp(dc->adrawer->icon_array[0]->wm_instance, tmp) == 0)
{
dock = dc->adrawer;
break;
}
}
}
} else {
if (n == 0) {
dock = scr->dock;

View File

@@ -747,6 +747,14 @@ void StartUp(Bool defaultScreenOnly)
}
}
}
/* auto-launch apps in drawers */
if (!wPreferences.flags.nodrawer) {
WDrawerChain *dc;
for (dc = wScreen[j]->drawers; dc; dc = dc->next) {
wScreen[j]->last_dock = dc->adrawer;
wDockDoAutoLaunch(dc->adrawer, 0);
}
}
}
/* go to workspace where we were before restart */

View File

@@ -137,80 +137,6 @@ void DoKaboom(WScreen * scr, Window win, int x, int y)
#endif /* NORMAL_ICON_KABOOM */
}
Pixmap MakeGhostDock(WDock * dock, int sx, int dx, int y)
{
WScreen *scr = dock->screen_ptr;
XImage *img;
RImage *back, *dock_image;
Pixmap pixmap;
int i, virtual_tiles, h, j, n;
unsigned long red_mask, green_mask, blue_mask;
virtual_tiles = 0;
for (i = 0; i < dock->max_icons; i++) {
if (dock->icon_array[i] != NULL && dock->icon_array[i]->yindex > virtual_tiles)
virtual_tiles = dock->icon_array[i]->yindex;
}
virtual_tiles++;
h = virtual_tiles * wPreferences.icon_size;
h = (y + h > scr->scr_height) ? scr->scr_height - y : h;
virtual_tiles = h / wPreferences.icon_size; /* The visible ones */
if (h % wPreferences.icon_size)
virtual_tiles++; /* There is one partially visible tile at end */
img = XGetImage(dpy, scr->root_win, dx, y, wPreferences.icon_size, h, AllPlanes, ZPixmap);
if (!img)
return None;
red_mask = img->red_mask;
green_mask = img->green_mask;
blue_mask = img->blue_mask;
back = RCreateImageFromXImage(scr->rcontext, img, NULL);
XDestroyImage(img);
if (!back) {
return None;
}
for (i = 0; i < dock->max_icons; i++) {
if (dock->icon_array[i] != NULL && dock->icon_array[i]->yindex < virtual_tiles) {
Pixmap which;
j = dock->icon_array[i]->yindex * wPreferences.icon_size;
n = (h - j < wPreferences.icon_size) ? h - j : wPreferences.icon_size;
if (dock->icon_array[i]->icon->pixmap)
which = dock->icon_array[i]->icon->pixmap;
else
which = dock->icon_array[i]->icon->core->window;
img = XGetImage(dpy, which, 0, 0, wPreferences.icon_size, n, AllPlanes, ZPixmap);
if (!img) {
RReleaseImage(back);
return None;
}
img->red_mask = red_mask;
img->green_mask = green_mask;
img->blue_mask = blue_mask;
dock_image = RCreateImageFromXImage(scr->rcontext, img, NULL);
XDestroyImage(img);
if (!dock_image) {
RReleaseImage(back);
return None;
}
RCombineAreaWithOpaqueness(back, dock_image, 0, 0,
wPreferences.icon_size, n, 0, j, 30 * 256 / 100);
RReleaseImage(dock_image);
}
}
RConvertImage(scr->rcontext, back, &pixmap);
RReleaseImage(back);
return pixmap;
}
Pixmap MakeGhostIcon(WScreen * scr, Drawable drawable)
{
RImage *back;

View File

@@ -24,7 +24,6 @@
#include "dock.h"
void DoKaboom(WScreen *scr, Window win, int x, int y);
Pixmap MakeGhostDock(WDock *dock, int sx, int dx, int y);
Pixmap MakeGhostIcon(WScreen *scr, Drawable drawable);
void DoWindowBirth(WWindow *wwin);
#endif

View File

@@ -301,20 +301,6 @@
* a docked icon must be dragged out to detach it */
#define DOCK_DETTACH_THRESHOLD 3
/* Delay (in ms) after which the clip will autocollapse when leaved */
#define AUTO_COLLAPSE_DELAY 1000
/* Delay (in ms) after which the clip will autoexpand when entered.
* Set this to zero if you want instant expanding. */
#define AUTO_EXPAND_DELAY 600
/* Delay (in ms) after which the clip will be lowered when leaved */
#define AUTO_LOWER_DELAY 1000
/* Delay (in ms) after which the clip will be raised when entered.
* Set this to zero if you want instant raise. */
#define AUTO_RAISE_DELAY 600
/* Max. number of icons the dock and clip can have */
#define DOCK_MAX_ICONS 32
@@ -329,7 +315,7 @@
#define MAX_WORKSPACENAME_WIDTH 64
/* max width of window title in window list */
#define MAX_WINDOWLIST_WIDTH 160
#define MAX_WINDOWLIST_WIDTH 400
#ifndef HAVE_INOTIFY
/* Check defaults database for changes every this many milliseconds */

View File

@@ -597,6 +597,37 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
WMPLSetCaseSensitive(False);
}
void wDefaultPurgeInfo(WScreen *scr, char *instance, char *class)
{
WMPropList *value, *key, *dict;
char *buffer;
if (!AIcon) { /* Unnecessary precaution */
init_wdefaults();
}
WMPLSetCaseSensitive(True);
buffer = wmalloc(strlen(class) + strlen(instance) + 2);
sprintf(buffer, "%s.%s", instance, class);
key = WMCreatePLString(buffer);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
if (dict) {
value = WMGetFromPLDictionary(dict, AIcon);
if (value) {
WMRemoveFromPLDictionary(dict, AIcon);
}
WMRemoveFromPLDictionary(WDWindowAttributes->dictionary, key);
UpdateDomainFile(WDWindowAttributes);
}
wfree(buffer);
WMReleasePropList(key);
WMPLSetCaseSensitive(False);
}
/* --------------------------- Local ----------------------- */
static int getBool(WMPropList * key, WMPropList * value)

View File

@@ -103,7 +103,7 @@ int wWorkspaceNew(WScreen *scr)
}
if (!wPreferences.flags.noclip)
wspace->clip = wDockCreate(scr, WM_CLIP);
wspace->clip = wDockCreate(scr, WM_CLIP, NULL);
list = wmalloc(sizeof(WWorkspace *) * scr->workspace_count);
@@ -471,6 +471,8 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount)
void wWorkspaceForceChange(WScreen * scr, int workspace)
{
WWindow *tmp, *foc = NULL, *foc2 = NULL;
WWindow **toUnmap;
int toUnmapSize, toUnmapCount;
if (workspace >= MAX_WORKSPACES || workspace < 0)
return;
@@ -490,6 +492,10 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
toUnmapSize = 16;
toUnmapCount = 0;
toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *));
if ((tmp = scr->focused_window) != NULL) {
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) &&
!WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) {
@@ -504,7 +510,12 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
/* unmap windows not on this workspace */
if ((tmp->flags.mapped || tmp->flags.shaded) &&
!IS_OMNIPRESENT(tmp) && !tmp->flags.changing_workspace) {
wWindowUnmap(tmp);
if (toUnmapCount == toUnmapSize)
{
toUnmapSize *= 2;
toUnmap = wrealloc(toUnmap, toUnmapSize * sizeof(WWindow *));
}
toUnmap[toUnmapCount++] = tmp;
}
/* also unmap miniwindows not on this workspace */
if (!wPreferences.sticky_icons && tmp->flags.miniaturized &&
@@ -553,6 +564,12 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
tmp = tmp->prev;
}
while (toUnmapCount > 0)
{
wWindowUnmap(toUnmap[--toUnmapCount]);
}
wfree(toUnmap);
/* Gobble up events unleashed by our mapping & unmapping.
* These may trigger various grab-initiated focus &
* crossing events. However, we don't care about them,
@@ -606,15 +623,14 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
if (scr->dock)
wAppIconPaint(scr->dock->icon_array[0]);
if (scr->clip_icon) {
if (scr->workspaces[workspace]->clip->auto_collapse ||
scr->workspaces[workspace]->clip->auto_raise_lower) {
if (!wPreferences.flags.noclip && (scr->workspaces[workspace]->clip->auto_collapse ||
scr->workspaces[workspace]->clip->auto_raise_lower)) {
/* to handle enter notify. This will also */
XUnmapWindow(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);
wNETWMUpdateDesktop(scr);