icewm/src/atasks.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++++- icewm/src/atasks.h | 3 ++ icewm/src/atray.cc | 33 ++++++++++++++++++------------- icewm/src/bindkey.h | 4 +++ icewm/src/default.h | 8 +++++++ icewm/src/objbar.cc | 2 +- icewm/src/themable.h | 11 ++++++++++ icewm/src/wmmgr.cc | 20 ++++++++++++++++++- icewm/src/wmtaskbar.cc | 28 +++++++++++++++----------- 9 files changed, 129 insertions(+), 30 deletions(-) diff --git a/icewm/src/atasks.cc b/icewm/src/atasks.cc index de5b880..f4b222f 100644 --- a/icewm/src/atasks.cc +++ b/icewm/src/atasks.cc @@ -220,7 +220,8 @@ void TaskBarApp::paint(Graphics &g, const YRect &/*r*/) { #endif const char *str = getFrame()->getIconTitle(); - if (strIsEmpty(str)) str = getFrame()->getTitle(); + if (strIsEmpty(str) || taskBarTitleInsteadIconName) + str = getFrame()->getTitle(); if (str) { ref font = @@ -420,6 +421,49 @@ void TaskPane::removeApp(YFrameWindow *frame) { } } +TaskBarApp *TaskPane::getCurrent() +{ + TaskBarApp *a = fFirst; + while (a) { + if (a->getFrame()->focused() && a->getFrame()->visibleNow()) + break; + a = a->getNext(); + } + return a; +} + +TaskBarApp *TaskPane::getNext() +{ + TaskBarApp *a = getCurrent(); + if (!a) + return 0; + + while (1) { + a = a->getNext(); + if (!a) + a = fFirst; + if (a->getFrame()->visibleNow()) + break; + } + return a; +} + +TaskBarApp *TaskPane::getPrev() +{ + TaskBarApp *a = getCurrent(); + if (!a) + return 0; + + while (1) { + a = a->getPrev(); + if (!a) + a = fLast; + if (a->getFrame()->visibleNow()) + break; + } + return a; +} + void TaskPane::relayoutNow() { if (!fNeedRelayout) return ; @@ -442,6 +486,8 @@ void TaskPane::relayoutNow() { int rightX = width(); w = (rightX - leftX - 2) / tc; + w -= taskButtonSepSize; + w = (taskButtonWidth && w > taskButtonWidth) ? taskButtonWidth : w; int rem = (rightX - leftX - 2) % tc; x = leftX; h = height(); @@ -460,7 +506,7 @@ void TaskPane::relayoutNow() { f->setGeometry(YRect(x, y, w1, h)); f->show(); x += w1; - x += 0; + x += taskButtonSepSize ; lc++; } else f->hide(); diff --git a/icewm/src/atasks.h b/icewm/src/atasks.h index 7c3077c..e24cd1a 100644 --- a/icewm/src/atasks.h +++ b/icewm/src/atasks.h @@ -58,6 +58,9 @@ public: void removeApp(YFrameWindow *frame); TaskBarApp *getFirst() const { return fFirst; } TaskBarApp *getLast() const { return fLast; } + TaskBarApp *getCurrent(); + TaskBarApp *getNext(); + TaskBarApp *getPrev(); void relayout() { fNeedRelayout = true; } void relayoutNow(); diff --git a/icewm/src/atray.cc b/icewm/src/atray.cc index 44abb1a..ecbaa15 100644 --- a/icewm/src/atray.cc +++ b/icewm/src/atray.cc @@ -116,29 +116,29 @@ void TrayApp::paint(Graphics &g, const YRect &/*r*/) { } else if (getFrame()->isMinimized()) { bg = minimizedTrayAppBg; fg = minimizedTrayAppFg; - bgPix = taskbuttonminimizedPixmap; + bgPix = trayPanelUseBgPixmaps ? taskbuttonminimizedPixmap : taskbackPixmap; #ifdef CONFIG_GRADIENTS - if (taskMinimizedGradient == null && taskbuttonminimizedPixbuf != null) + if (trayPanelUseBgPixmaps && taskMinimizedGradient == null && taskbuttonminimizedPixbuf != null) taskMinimizedGradient = YPixbuf::scale(taskbuttonminimizedPixbuf, sw, sh); - bgGrad = taskMinimizedGradient; + bgGrad = trayPanelUseBgPixmaps ? taskMinimizedGradient : getGradient(); #endif } else if (getFrame()->focused()) { bg = activeTrayAppBg; fg = activeTrayAppFg; - bgPix = taskbuttonactivePixmap; + bgPix = trayPanelUseBgPixmaps ? taskbuttonactivePixmap : taskbackPixmap; #ifdef CONFIG_GRADIENTS - if (taskActiveGradient == null && taskbuttonactivePixbuf != null) + if (trayPanelUseBgPixmaps && taskActiveGradient == null && taskbuttonactivePixbuf != null) taskActiveGradient = YPixbuf::scale(taskbuttonactivePixbuf, sw, sh); - bgGrad = taskActiveGradient; + bgGrad = trayPanelUseBgPixmaps ? taskActiveGradient : getGradient(); #endif } else { bg = normalTrayAppBg; fg = normalTrayAppFg; - bgPix = taskbuttonPixmap; + bgPix = trayPanelUseBgPixmaps ? taskbuttonPixmap : taskbackPixmap; #ifdef CONFIG_GRADIENTS - if (taskNormalGradient == null && taskbuttonPixbuf != null) + if (trayPanelUseBgPixmaps && taskNormalGradient == null && taskbuttonPixbuf != null) taskNormalGradient = YPixbuf::scale(taskbuttonPixbuf, sw, sh); - bgGrad = taskNormalGradient; + bgGrad = trayPanelUseBgPixmaps ? taskNormalGradient : getGradient(); #endif } @@ -156,7 +156,10 @@ void TrayApp::paint(Graphics &g, const YRect &/*r*/) { else #endif if (bgPix != null) + if (trayPanelUseBgPixmaps) g.fillPixmap(bgPix, 0, 0, width(), height(), 0, 0); + else + g.fillPixmap(bgPix, 0, 0, width(), height(), parent()->x(), parent()->y()); else { g.setColor(bg); g.fillRect(0, 0, width(), height()); @@ -168,7 +171,8 @@ void TrayApp::paint(Graphics &g, const YRect &/*r*/) { if (icon) { ref small = icon->small(); - if (small != null) g.drawImage(small, 2, 2); + //Paint the icon centered + if (small != null) g.drawImage(small, (width()-small->width())/2, (height()-small->height())/2); } } @@ -333,7 +337,7 @@ int TrayPane::getRequiredWidth() { for (TrayApp *a(fFirst); a != NULL; a = a->getNext()) if (a->getShown()) tc++; - return (tc ? 4 + tc * (height() - 4) : 1); + return (tc ? tc * height() : 0); } void TrayPane::relayoutNow() { @@ -355,9 +359,10 @@ void TrayPane::relayoutNow() { for (TrayApp *a(fFirst); a != NULL; a = a->getNext()) if (a->getShown()) tc++; - w = h = height() - 4; - x = width() - 2 - tc * w; - y = 2; + w = h = height(); + x = width() - 0 - tc * w; + x = x < 0 ? 0 : x; + y = 0; for (TrayApp *f(fFirst); f != NULL; f = f->getNext()) { if (f->getShown()) { diff --git a/icewm/src/bindkey.h b/icewm/src/bindkey.h index 65980d0..f4eac96 100644 --- a/icewm/src/bindkey.h +++ b/icewm/src/bindkey.h @@ -39,6 +39,8 @@ #define defgKeyWinSmartPlace XK_KP_Begin, kfCtrl+kfAlt+kfShift, "Ctrl+Alt+Shift+KP_5" #define defgKeySysSwitchNext XK_Tab, kfAlt, "Alt+Tab" #define defgKeySysSwitchLast XK_Tab, kfAlt+kfShift, "Alt+Shift+Tab" +#define defgKeyTaskBarSwitchNext XK_F2, kfCtrl+kfShift, "Ctrl+Shift+F2" +#define defgKeyTaskBarSwitchPrev XK_F1, kfCtrl+kfShift, "Ctrl+Shift+F1" #define defgKeySysWinNext XK_Escape, kfAlt, "Alt+Esc" #define defgKeySysWinPrev XK_Escape, kfAlt+kfShift, "Alt+Shift+Esc" #define defgKeySysWinMenu XK_Escape, kfShift, "Shift+Esc" @@ -159,6 +161,8 @@ DEF_WMKEY(gKeySysSwitchNext); DEF_WMKEY(gKeySysSwitchLast); DEF_WMKEY(gKeySysWinNext); DEF_WMKEY(gKeySysWinPrev); +DEF_WMKEY(gKeyTaskBarSwitchNext); +DEF_WMKEY(gKeyTaskBarSwitchPrev); DEF_WMKEY(gKeySysWinMenu); DEF_WMKEY(gKeySysDialog); DEF_WMKEY(gKeySysMenu); diff --git a/icewm/src/default.h b/icewm/src/default.h index a655fcb..c6af98f 100644 --- a/icewm/src/default.h +++ b/icewm/src/default.h @@ -42,7 +42,10 @@ XIV(bool, taskBarShowStartMenu, true) XIV(bool, taskBarShowWindowListMenu, true) XIV(bool, taskBarShowWorkspaces, true) XIV(bool, taskBarShowWindows, true) +XIV(int, taskBarXPos, 0) +XIV(int, taskBarLength, 0) XIV(bool, taskBarShowShowDesktopButton, true) +XIV(bool, taskBarTitleInsteadIconName, false) XIV(int, taskBarButtonWidthDivisor, 3) #ifdef CONFIG_TRAY @@ -266,6 +269,9 @@ cfoption icewm_preferences[] = { OBV("TaskBarShowWindows", &taskBarShowWindows, "Show windows on the taskbar"), OBV("TaskBarShowShowDesktopButton", &taskBarShowShowDesktopButton, "Show 'show desktop' button on taskbar"), OBV("ShowEllipsis", &showEllipsis, "Show Ellipsis in taskbar items"), + OBV("TaskBarTitleInsteadIconName", &taskBarTitleInsteadIconName, "Show the window title instead of the shorter icon title in the taskbar button"), + OIV("TaskBarXPos", &taskBarXPos, 0, 16383, "Set task bar position, in pixels from the left screen edge"), + OIV("TaskBarLength", &taskBarLength, 0, 16383, "Set task bar length in pixels (0 for full screen)"), #ifdef CONFIG_TRAY OBV("TaskBarShowTray", &taskBarShowTray, "Show windows in the tray"), OBV("TrayShowAllWindows", &trayShowAllWindows, "Show windows from all workspaces on tray"), @@ -428,6 +434,8 @@ cfoption icewm_preferences[] = { OKV("KeySysSwitchLast", gKeySysSwitchLast, ""), OKV("KeySysWinNext", gKeySysWinNext, ""), OKV("KeySysWinPrev", gKeySysWinPrev, ""), + OKV("KeyTaskBarSwitchNext", gKeyTaskBarSwitchNext, "Switch to the next window in the Task Bar"), + OKV("KeyTaskBarSwitchPrev", gKeyTaskBarSwitchPrev, "Switch to the previous window in the Task Bar"), OKV("KeySysWinMenu", gKeySysWinMenu, ""), OKV("KeySysDialog", gKeySysDialog, ""), OKV("KeySysMenu", gKeySysMenu, ""), diff --git a/icewm/src/objbar.cc b/icewm/src/objbar.cc index c958323..c68ca19 100644 --- a/icewm/src/objbar.cc +++ b/icewm/src/objbar.cc @@ -34,7 +34,7 @@ ref toolbuttonPixmap; ObjectBar::ObjectBar(YWindow *parent): YWindow(parent) { if (bgColor == 0) bgColor = new YColor(clrDefaultTaskBar); - setSize(1, 1); + setSize(0, 0); } ObjectBar::~ObjectBar() { diff --git a/icewm/src/themable.h b/icewm/src/themable.h index e967e31..a15551a 100644 --- a/icewm/src/themable.h +++ b/icewm/src/themable.h @@ -5,6 +5,11 @@ XIV(bool, prettyClock, true) XIV(bool, rolloverTitleButtons, false) +XIV(int, taskBarHeight, 0) +XIV(int, taskButtonHeight, 0) +XIV(int, taskButtonWidth, 0) +XIV(int, taskButtonSepSize, 0) +XIV(bool, trayPanelUseBgPixmaps, true) XIV(bool, trayDrawBevel, false) XIV(bool, titleBarCentered, false) @@ -154,6 +159,12 @@ cfoption icewm_themable_preferences[] = { #ifndef LITE OBV("RolloverButtonsSupported", &rolloverTitleButtons, "Does it support the 'O' title bar button images (for mouse rollover)"), #endif + OIV("TaskBarHeight", &taskBarHeight, 0, 64, "Taskbar Height (default SmallIconSize + 8)"), + OIV("TaskButtonHeight", &taskButtonHeight, 0, 64, "Height for button elements in taskbar (default TaskBarHeight)"), + OIV("TaskButtonWidth", &taskButtonWidth, 0, 256, "Width for button elements in taskpanel (default taskPanelWidth/TaskbarButtonDivisor )"), + OIV("TaskButtonSeparatorSize", &taskButtonSepSize, 0, 64, "Distance between task buttons (default 0)"), + OBV("TrayPanelUseBgPixmaps", &trayPanelUseBgPixmaps, "TrayPanel will use the some taskbutton[..].xpm pixmaps (default true)"), + OBV("TaskBarClockLeds", &prettyClock, "Task bar clock/APM uses nice pixmapped LCD display (but then it doesn't display correctly in many languages anymore, e.g. for Japanese and Korean it works only when a real font is used and not the LEDs"), OBV("TrayDrawBevel", &trayDrawBevel, "Surround the tray with plastic border"), diff --git a/icewm/src/wmmgr.cc b/icewm/src/wmmgr.cc index 991c6d4..ef2b6e8 100644 --- a/icewm/src/wmmgr.cc +++ b/icewm/src/wmmgr.cc @@ -27,6 +27,7 @@ #include "prefs.h" #include "yprefs.h" #include "yrect.h" +#include "atasks.h" XContext frameContext; XContext clientContext; @@ -183,8 +184,11 @@ void YWindowManager::grabKeys() { GRAB_WMKEY(gKeySysShowDesktop); #ifdef CONFIG_TASKBAR - if (taskBar != 0) + if (taskBar != 0) { GRAB_WMKEY(gKeySysCollapseTaskBar); + GRAB_WMKEY(gKeyTaskBarSwitchNext); + GRAB_WMKEY(gKeyTaskBarSwitchPrev); + } #endif #ifndef NO_CONFIGURE_MENUS @@ -493,7 +497,21 @@ bool YWindowManager::handleWMKey(const XKeyEvent &key, KeySym k, unsigned int /* taskBar->handleCollapseButton(); #endif return true; + +#ifdef CONFIG_TASKBAR + } else if (IS_WMKEY(k, vm, gKeyTaskBarSwitchPrev)) { + TaskBarApp *a; + if (taskBar && taskBar->taskPane() && (a = taskBar->taskPane()->getPrev())) + a->getFrame()->activateWindow(true); + return true; + } else if (IS_WMKEY(k, vm, gKeyTaskBarSwitchNext)) { + TaskBarApp *a; + if (taskBar && taskBar->taskPane() && (a = taskBar->taskPane()->getNext())) + a->getFrame()->activateWindow(true); + return true; +#endif } + return false; } diff --git a/icewm/src/wmtaskbar.cc b/icewm/src/wmtaskbar.cc index 1a86ce7..5fd1707 100644 --- a/icewm/src/wmtaskbar.cc +++ b/icewm/src/wmtaskbar.cc @@ -585,16 +585,16 @@ void TaskBar::updateLayout(int &size_w, int &size_h) { #ifndef NO_CONFIGURE_MENUS { fApplications, true, 1, true, 0, 0, true }, #endif - { fShowDesktop, true, 0, true, 0, 0, true }, + { fShowDesktop, true, 0, true, 0, 0, taskButtonHeight? false: true }, #ifdef CONFIG_WINMENU - { fWinList, true, 0, true, 0, 0, true}, + { fWinList, true, 0, true, 0, 0, taskButtonHeight? false: true}, #endif #ifndef NO_CONFIGURE_MENUS - { fObjectBar, true, 1, true, 4, 0, true }, + { fObjectBar, true, 1, true, 4, 0, taskButtonHeight? false: true }, #endif - { fWorkspaces, taskBarWorkspacesLeft, 0, true, 4, 4, true }, + { fWorkspaces, taskBarWorkspacesLeft, 0, true, 4, 4, taskButtonHeight? false: true }, - { fCollapseButton, false, 0, true, 0, 2, true }, + { fCollapseButton, false, 0, true, 0, 2, taskButtonHeight? false: true }, #ifdef CONFIG_APPLET_CLOCK { fClock, false, 1, true, 2, 2, false }, #endif @@ -623,7 +623,7 @@ void TaskBar::updateLayout(int &size_w, int &size_h) { #endif { fTray2, false, 1, true, 1, 1, false }, #ifdef CONFIG_TRAY - { fTray, false, 0, true, 1, 1, true }, + { fTray, false, 0, true, 1, 1, taskButtonHeight? false: true }, #endif }; const int wcount = sizeof(wlist)/sizeof(wlist[0]); @@ -650,6 +650,8 @@ void TaskBar::updateLayout(int &size_w, int &size_h) { { int dx, dy, dw, dh; manager->getScreenGeometry(&dx, &dy, &dw, &dh); + if (taskBarLength != 0) + dw=taskBarLength; w = dw; } @@ -673,7 +675,7 @@ void TaskBar::updateLayout(int &size_w, int &size_h) { #ifdef LITE h[0] = 16; #else - h[0] = YIcon::smallSize() + 8; + h[0] = taskBarHeight ? taskBarHeight : YIcon::smallSize() + 8; #endif } @@ -691,8 +693,8 @@ void TaskBar::updateLayout(int &size_w, int &size_h) { if (wl->expand) { yy = y[wl->row]; } else { - hh = wl->w->height(); - yy = y[wl->row] + (h[wl->row] - wl->w->height()) / 2; + hh = taskButtonHeight ? taskButtonHeight: wl->w->height(); + yy = y[wl->row] + (h[wl->row] - hh) / 2; } if (wl->left) { @@ -715,9 +717,9 @@ void TaskBar::updateLayout(int &size_w, int &size_h) { if (taskBarShowWindows) { if (fTasks) { fTasks->setGeometry(YRect(left[0], - y[0], + taskButtonHeight ? y[0] + (h[0] - taskButtonHeight)/2 : y[0], right[0] - left[0], - h[0])); + taskButtonHeight ? taskButtonHeight : h[0])); fTasks->show(); fTasks->relayout(); } @@ -767,8 +769,10 @@ void TaskBar::updateFullscreen(bool fullscreen) { void TaskBar::updateLocation() { int dx, dy, dw, dh; manager->getScreenGeometry(&dx, &dy, &dw, &dh); + if (taskBarLength != 0) + dw=taskBarLength; - int x = dx; + int x = dx+taskBarXPos; int y = dy; int w = 0; int h = 0;