--- src/default.h.orig 2006-01-05 00:19:20.000000000 +0100 +++ src/default.h 2006-01-04 22:47:06.000000000 +0100 @@ -38,6 +38,8 @@ XIV(bool, taskBarShowStartMenu, true) XIV(bool, taskBarShowWindowListMenu, true) XIV(bool, taskBarShowWorkspaces, true) +XIV(bool, taskBarWorkspacesShowBorders, true) +XIV(bool, taskBarWorkspacesShowNumbers, true) XIV(bool, taskBarShowWindows, true) XIV(bool, taskBarShowShowDesktopButton, true) #ifdef CONFIG_TRAY @@ -247,6 +249,8 @@ OBV("TaskBarMailboxStatusBeepOnNewMail", &beepOnNewMail, "Beep when new mail arrives"), OBV("TaskBarMailboxStatusCountMessages", &countMailMessages, "Count messages in mailbox"), OBV("TaskBarShowWorkspaces", &taskBarShowWorkspaces, "Show workspace switching buttons on task bar"), + OBV("TaskBarWorkspacesShowBorders", &taskBarWorkspacesShowBorders, "Draw border around workspace switching buttons"), + OBV("TaskBarWorkspacesShowNumbers", &taskBarWorkspacesShowNumbers, "Show number of workspace on workspace switching button"), OBV("TaskBarShowWindows", &taskBarShowWindows, "Show windows on the taskbar"), OBV("TaskBarShowShowDesktopButton", &taskBarShowShowDesktopButton, "Show 'show desktop' button on taskbar"), #ifdef CONFIG_TRAY --- src/aworkspaces.h.orig 2005-08-14 20:33:08.000000000 +0200 +++ src/aworkspaces.h 2006-01-05 00:27:32.000000000 +0100 @@ -22,6 +22,9 @@ virtual YSurface getSurface(); private: + virtual void paint(Graphics &g, const YRect &r); + char *fText; + static YTimer *fRaiseTimer; long fWorkspace; @@ -40,6 +43,8 @@ WorkspacesPane(YWindow *parent); ~WorkspacesPane(); + void repaint(); + void configure(const YRect &r, const bool resized); WorkspaceButton *workspaceButton(long n); --- src/aworkspaces.cc.orig 2005-08-14 20:33:08.000000000 +0200 +++ src/aworkspaces.cc 2006-01-05 09:59:07.000000000 +0100 @@ -11,6 +11,7 @@ #include "wmframe.h" #include "yrect.h" #include "yicon.h" +#include "wmwinlist.h" #include "intl.h" @@ -42,11 +43,27 @@ WorkspaceButton::WorkspaceButton(long ws, YWindow *parent): ObjectButton(parent, (YAction *)0) { + fText = newstr(itoa(ws+1)); fWorkspace = ws; //setDND(true); } -void WorkspaceButton::handleClick(const XButtonEvent &/*up*/, int /*count*/) { +void WorkspaceButton::handleClick(const XButtonEvent &up, int /*count*/) { + switch (up.button) { + case 2: + if (windowList) + windowList->showFocused(-1, -1); + break; + case 3: + manager->popupWindowListMenu(this, up.x_root, up.y_root); + break; + case 4: + manager->switchToPrevWorkspace(false); + break; + case 5: + manager->switchToNextWorkspace(false); + break; + } } void WorkspaceButton::handleDNDEnter() { @@ -95,21 +112,13 @@ fWorkspaceButton = 0; if (fWorkspaceButton) { - YResourcePaths paths("", false); - int ht = 24; int leftX = 0; for (w = 0; w < workspaceCount; w++) { WorkspaceButton *wk = new WorkspaceButton(w, this); if (wk) { - ref image - (paths.loadImage("workspace/", workspaceNames[w])); - - if (image != null) - wk->setImage(image); - else - wk->setText(workspaceNames[w]); + wk->setSize(ht * desktop->width() / desktop->height(), ht); char * wn(newstr(my_basename(workspaceNames[w]))); char * ext(strrchr(wn, '.')); @@ -217,4 +226,83 @@ #endif } +void WorkspacesPane::repaint() { + for (int w = 0; w < workspaceCount; w++) { + fWorkspaceButton[w]->repaint(); + } +} + +void WorkspaceButton::paint(Graphics &g, const YRect &/*r*/) { + 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 (taskBarWorkspacesShowBorders) { + x += 1; y += 1; w -= 2; h -= 2; + } + + int wx, wy, ww, wh; + int sf = desktop->width() / w; + + YColor *colors[] = { + surface.color, + surface.color->brighter(), + surface.color->darker(), + getColor(), + getColor()->brighter(), + getColor()->darker() + }; + + for (YFrameWindow *yfw = manager->bottomLayer(WinLayerBelow); + yfw; yfw = yfw->prevLayer()) { + if (yfw->getActiveLayer() > WinLayerDock) + break; + if (yfw->isHidden() || !yfw->visibleOn(fWorkspace)) + continue; + wx = yfw->x() / sf + x; + wy = yfw->y() / sf + y; + ww = yfw->width() / sf; + wh = yfw->height() / sf; + if (ww < 1 || wh < 1) { + if (yfw->isRollup()) wh = 1; + else continue; + } + if (yfw->isMinimized()) { + g.setColor(colors[1]); + } 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); + } + g.setColor(colors[5]); + } + g.drawRect(wx, wy, ww-1, wh-1); + } + + if (taskBarWorkspacesShowBorders) { + g.setColor(surface.color); + g.draw3DRect(x-1, y-1, w+1, h+1, !isPressed()); + } + + if (taskBarWorkspacesShowNumbers) { + ref font = getFont(); + + wx = (w - font->textWidth(fText)) / 2 + x; + wy = (h - font->height()) / 2 + font->ascent() + y; + + g.setFont(font); + g.setColor(colors[0]); + g.drawChars(fText, 0, strlen(fText), wx+1, wy+1); + g.setColor(colors[3]); + g.drawChars(fText, 0, strlen(fText), wx, wy); + } + } +} + #endif --- src/wmmgr.cc.orig 2005-08-14 20:33:08.000000000 +0200 +++ src/wmmgr.cc 2006-01-04 22:40:19.000000000 +0100 @@ -1674,6 +1674,9 @@ w->updateLayer(); w = w->nextLayer(); } + if (taskBar && taskBar->workspacesPane()) { + taskBar->workspacesPane()->repaint(); + } } void YWindowManager::restackWindows(YFrameWindow *win) { --- src/wmstatus.h.orig 2005-08-14 20:33:08.000000000 +0200 +++ src/wmstatus.h 2006-01-04 22:40:19.000000000 +0100 @@ -15,7 +15,7 @@ virtual void paint(Graphics &g, const YRect &r); void begin(); - void end() { hide(); } + void end(); virtual const char* getStatus() = 0; --- src/wmstatus.cc.orig 2005-08-14 20:33:08.000000000 +0200 +++ src/wmstatus.cc 2006-01-04 22:40:19.000000000 +0100 @@ -20,6 +20,9 @@ #include "intl.h" +#include "wmtaskbar.h" +#include "aworkspaces.h" + #include #include @@ -84,6 +87,13 @@ show(); } +void YWindowManagerStatus::end() { + hide(); + if (taskBar && taskBar->workspacesPane()) { + taskBar->workspacesPane()->repaint(); + } +} + /******************************************************************************/ /******************************************************************************/