Группа :: Графические оболочки/Icewm
Пакет: icewm
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: icewm-1.2.25-aworkspaces-1.4.1.patch
--- src/default.h.orig 2006-04-16 20:12:31 +0400
+++ src/default.h 2006-04-21 00:09:02 +0400
@@ -50,6 +50,10 @@
XIV(bool, taskBarAutoHide, false)
XIV(bool, taskBarDoubleHeight, false)
XIV(bool, taskBarWorkspacesLeft, true)
+XIV(bool, pagerShowPreview, true)
+XIV(bool, pagerShowWindowIcons, true)
+XIV(bool, pagerShowBorders, true)
+XIV(bool, pagerShowNumbers, false)
XIV(bool, taskBarShowCPUStatus, true)
XIV(bool, taskBarShowNetStatus, true)
XIV(bool, taskBarLaunchOnSingleClick, true)
@@ -264,6 +268,10 @@
OBV("TaskBarShowCollapseButton", &taskBarShowCollapseButton, "Show a button to collapse the taskbar"),
OBV("TaskBarDoubleHeight", &taskBarDoubleHeight, "Use double-height task bar"),
OBV("TaskBarWorkspacesLeft", &taskBarWorkspacesLeft, "Place workspace pager on left, not right"),
+ OBV("PagerShowPreview", &pagerShowPreview, "Show a mini desktop preview on each workspace button"),
+ OBV("PagerShowWindowIcons", &pagerShowWindowIcons, "Draw window icons inside large enough preview windows on pager (if PagerShowPreview=1)"),
+ OBV("PagerShowBorders", &pagerShowBorders, "Draw border around workspace buttons (if PagerShowPreview=1)"),
+ OBV("PagerShowNumbers", &pagerShowNumbers, "Show number of workspace on workspace button (if PagerShowPreview=1)"),
OBV("TaskBarLaunchOnSingleClick", &taskBarLaunchOnSingleClick, "Execute taskbar applet commands (like MailCommand, ClockCommand, ...) on single click"),
#endif
OBV("WarpPointer", &warpPointer, "Move mouse when doing focusing in pointer focus mode"),
--- src/wmframe.cc.orig 2006-04-16 20:12:31 +0400
+++ src/wmframe.cc 2006-04-20 23:22:48 +0400
@@ -29,6 +29,8 @@
#include "yrect.h"
#include "yicon.h"
+#include "aworkspaces.h"
+
#include "intl.h"
static YColor *activeBorderBg = 0;
@@ -320,6 +322,14 @@
XDestroyWindow(xapp->display(), bottomLeftCorner);
XDestroyWindow(xapp->display(), bottomRightCorner);
manager->updateClientList();
+
+#ifdef CONFIG_TASKBAR
+ // update pager when unfocused windows are killed, because this
+ // does not call YWindowManager::updateFullscreenLayer()
+ if (!focused() && taskBar && taskBar->workspacesPane()) {
+ taskBar->workspacesPane()->repaint();
+ }
+#endif
}
void YFrameWindow::doManage(YFrameClient *clientw) {
@@ -707,6 +717,14 @@
cy = cur_y;
}
}
+
+#ifdef CONFIG_TASKBAR
+ // update pager when windows move/resize themselves (like xmms, gmplayer, ...),
+ // because this does not call YFrameWindow::endMoveSize()
+ if (taskBar && taskBar->workspacesPane()) {
+ taskBar->workspacesPane()->repaint();
+ }
+#endif
}
void YFrameWindow::configureClient(const XConfigureRequestEvent &configureRequest) {
--- src/aworkspaces.cc.orig 2006-04-16 20:12:31 +0400
+++ src/aworkspaces.cc 2006-04-20 23:22:48 +0400
@@ -11,6 +11,7 @@
#include "wmframe.h"
#include "yrect.h"
#include "yicon.h"
+#include "wmwinlist.h"
#include "intl.h"
@@ -20,6 +21,7 @@
#include <string.h>
#include <assert.h>
#include <errno.h>
+#include <math.h>
#include "base.h"
@@ -46,7 +48,26 @@
//setDND(true);
}
-void WorkspaceButton::handleClick(const XButtonEvent &/*up*/, int /*count*/) {
+void WorkspaceButton::handleClick(const XButtonEvent &up, int /*count*/) {
+ switch (up.button) {
+#ifdef CONFIG_WINLIST
+ case 2:
+ if (windowList)
+ windowList->showFocused(-1, -1);
+ break;
+#endif
+#ifdef CONFIG_WINMENU
+ case 3:
+ manager->popupWindowListMenu(this, up.x_root, up.y_root);
+ break;
+#endif
+ case 4:
+ manager->switchToPrevWorkspace(false);
+ break;
+ case 5:
+ manager->switchToNextWorkspace(false);
+ break;
+ }
}
void WorkspaceButton::handleDNDEnter() {
@@ -97,19 +118,24 @@
if (fWorkspaceButton) {
YResourcePaths paths("", false);
- int ht = 24;
+ int ht = smallIconSize + 8;
int leftX = 0;
for (w = 0; w < workspaceCount; w++) {
WorkspaceButton *wk = new WorkspaceButton(w, this);
if (wk) {
- ref<YIconImage> image
- (paths.loadImage("workspace/", workspaceNames[w]));
-
- if (image != null)
- wk->setImage(image);
- else
- wk->setText(workspaceNames[w]);
+ if (pagerShowPreview) {
+ wk->setSize((int) roundf((float)
+ ht * desktop->width() / desktop->height()), ht);
+ } else {
+ ref<YIconImage> image
+ (paths.loadImage("workspace/", workspaceNames[w]));
+
+ if (image != null)
+ wk->setImage(image);
+ else
+ wk->setText(workspaceNames[w]);
+ }
char * wn(newstr(my_basename(workspaceNames[w])));
char * ext(strrchr(wn, '.'));
@@ -217,4 +243,107 @@
#endif
}
+void WorkspacesPane::repaint() {
+ if (!pagerShowPreview) return;
+
+ for (int w = 0; w < workspaceCount; w++) {
+ fWorkspaceButton[w]->repaint();
+ }
+}
+
+void WorkspaceButton::paint(Graphics &g, const YRect &/*r*/) {
+ if (!pagerShowPreview) {
+ YButton::paint(g, YRect(0,0,0,0));
+ return;
+ }
+
+ int x(0), y(0), w(width()), h(height());
+
+ if (w > 1 && h > 1) {
+ YSurface surface(getSurface());
+ g.setColor(surface.color);
+ g.drawSurface(surface, x, y, w, h);
+
+ if (pagerShowBorders) {
+ x += 1; y += 1; w -= 2; h -= 2;
+ }
+
+ int wx, wy, ww, wh;
+ float sf = (float) desktop->width() / w;
+
+ YIcon *icon;
+ YColor *colors[] = {
+ surface.color,
+ surface.color->brighter(),
+ surface.color->darker(),
+ getColor(),
+ NULL, // getColor()->brighter(),
+ getColor()->darker()
+ };
+
+ for (YFrameWindow *yfw = manager->bottomLayer(WinLayerBelow);
+ yfw && yfw->getActiveLayer() <= WinLayerDock;
+ yfw = yfw->prevLayer()) {
+ if (yfw->isHidden() ||
+ !yfw->visibleOn(fWorkspace) ||
+ (yfw->frameOptions() & YFrameWindow::foIgnoreWinList))
+ continue;
+ wx = (int) roundf(yfw->x() / sf) + x;
+ wy = (int) roundf(yfw->y() / sf) + y;
+ ww = (int) roundf(yfw->width() / sf);
+ wh = (int) roundf(yfw->height() / sf);
+ if (ww < 1 || wh < 1)
+ continue;
+ if (yfw->isMaximizedVert()) { // !!! hack
+ wy = y; wh = h;
+ }
+ if (yfw->isMinimized()) {
+ g.setColor(colors[2]);
+ } else {
+ if (ww > 2 && wh > 2) {
+ if (yfw->focused())
+ g.setColor(colors[1]);
+ else
+ g.setColor(colors[2]);
+ g.fillRect(wx+1, wy+1, ww-2, wh-2);
+
+ if (pagerShowWindowIcons && ww > smallIconSize+1 &&
+ wh > smallIconSize+1 && (icon = yfw->clientIcon()) &&
+ icon->small() != null) {
+ g.drawImage(icon->small(),
+ wx + (ww-smallIconSize)/2,
+ wy + (wh-smallIconSize)/2);
+ }
+ }
+ g.setColor(colors[5]);
+ }
+ if (ww == 1 && wh == 1)
+ g.drawPoint(wx, wy);
+ else
+ g.drawRect(wx, wy, ww-1, wh-1);
+ }
+
+ if (pagerShowBorders) {
+ g.setColor(surface.color);
+ g.draw3DRect(x-1, y-1, w+1, h+1, !isPressed());
+ }
+
+ if (pagerShowNumbers) {
+ ref<YFont> font = getFont();
+
+ char label[3];
+ sprintf(label, "%ld", (fWorkspace+1) % 100);
+
+ wx = (w - font->textWidth(label)) / 2 + x;
+ wy = (h - font->height()) / 2 + font->ascent() + y;
+
+ g.setFont(font);
+ g.setColor(colors[0]);
+ g.drawChars(label, 0, strlen(label), wx+1, wy+1);
+ g.setColor(colors[3]);
+ g.drawChars(label, 0, strlen(label), wx, wy);
+ }
+ }
+}
+
#endif
--- src/aworkspaces.h.orig 2006-04-16 20:12:31 +0400
+++ src/aworkspaces.h 2006-04-20 23:22:48 +0400
@@ -22,6 +22,8 @@
virtual YSurface getSurface();
private:
+ virtual void paint(Graphics &g, const YRect &r);
+
static YTimer *fRaiseTimer;
long fWorkspace;
@@ -40,6 +42,8 @@
WorkspacesPane(YWindow *parent);
~WorkspacesPane();
+ void repaint();
+
void configure(const YRect &r, const bool resized);
WorkspaceButton *workspaceButton(long n);
--- src/movesize.cc.orig 2006-04-16 20:12:31 +0400
+++ src/movesize.cc 2006-04-20 23:22:48 +0400
@@ -18,6 +18,9 @@
#include "intl.h"
+#include "wmtaskbar.h"
+#include "aworkspaces.h"
+
#include <stdio.h>
void YFrameWindow::snapTo(int &wx, int &wy,
@@ -1001,6 +1004,12 @@
sizingWindow = 0;
manager->setWorkAreaMoveWindows(false);
+
+#ifdef CONFIG_TASKBAR
+ if (taskBar && taskBar->workspacesPane()) {
+ taskBar->workspacesPane()->repaint();
+ }
+#endif
}
void YFrameWindow::handleBeginDrag(const XButtonEvent &down, const XMotionEvent &motion) {
--- src/wmmgr.cc.orig 2006-04-16 20:12:31 +0400
+++ src/wmmgr.cc 2006-04-20 23:22:48 +0400
@@ -1674,6 +1674,12 @@
w->updateLayer();
w = w->nextLayer();
}
+
+#ifdef CONFIG_TASKBAR
+ if (taskBar && taskBar->workspacesPane()) {
+ taskBar->workspacesPane()->repaint();
+ }
+#endif
}
void YWindowManager::restackWindows(YFrameWindow *win) {