mouse wheel support
custom titlebar layout
This commit is contained in:
parent
c2ab902334
commit
341c4e04ff
4 changed files with 105 additions and 40 deletions
|
@ -1927,6 +1927,18 @@ void BScreen::buttonPressEvent(XButtonEvent *xbutton) {
|
||||||
blackbox->checkMenu();
|
blackbox->checkMenu();
|
||||||
rootmenu->show();
|
rootmenu->show();
|
||||||
}
|
}
|
||||||
|
// mouse wheel up
|
||||||
|
} else if (xbutton->button == 4) {
|
||||||
|
if (getCurrentWorkspaceID() >= getWorkspaceCount() - 1)
|
||||||
|
changeWorkspaceID(0);
|
||||||
|
else
|
||||||
|
changeWorkspaceID(getCurrentWorkspaceID() + 1);
|
||||||
|
// mouse wheel down
|
||||||
|
} else if (xbutton->button == 5) {
|
||||||
|
if (getCurrentWorkspaceID() == 0)
|
||||||
|
changeWorkspaceID(getWorkspaceCount() - 1);
|
||||||
|
else
|
||||||
|
changeWorkspaceID(getCurrentWorkspaceID() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
125
src/Window.cc
125
src/Window.cc
|
@ -55,6 +55,7 @@ extern "C" {
|
||||||
#include "Workspace.hh"
|
#include "Workspace.hh"
|
||||||
#include "Slit.hh"
|
#include "Slit.hh"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the class with default values/the window's set initial values.
|
* Initializes the class with default values/the window's set initial values.
|
||||||
|
@ -649,54 +650,86 @@ void BlackboxWindow::destroyMaximizeButton(void) {
|
||||||
|
|
||||||
|
|
||||||
void BlackboxWindow::positionButtons(bool redecorate_label) {
|
void BlackboxWindow::positionButtons(bool redecorate_label) {
|
||||||
unsigned int bw = frame.button_w + frame.bevel_w + 1,
|
string layout = blackbox->getTitlebarLayout();
|
||||||
by = frame.bevel_w + 1, lx = by, lw = frame.inside_w - by;
|
string parsed;
|
||||||
|
|
||||||
if (decorations & Decor_Iconify) {
|
bool hasclose, hasiconify, hasmaximize, haslabel;
|
||||||
if (frame.iconify_button == None) createIconifyButton();
|
hasclose = hasiconify = hasmaximize = haslabel = false;
|
||||||
|
|
||||||
XMoveResizeWindow(blackbox->getXDisplay(), frame.iconify_button, by, by,
|
string::const_iterator it, end;
|
||||||
frame.button_w, frame.button_w);
|
for (it = layout.begin(), end = layout.end(); it != end; ++it) {
|
||||||
XMapWindow(blackbox->getXDisplay(), frame.iconify_button);
|
switch(*it) {
|
||||||
XClearWindow(blackbox->getXDisplay(), frame.iconify_button);
|
case 'C':
|
||||||
|
if (! hasclose && (decorations & Decor_Close)) {
|
||||||
lx += bw;
|
hasclose = true;
|
||||||
lw -= bw;
|
parsed += *it;
|
||||||
} else if (frame.iconify_button) {
|
}
|
||||||
destroyIconifyButton();
|
break;
|
||||||
|
case 'I':
|
||||||
|
if (! hasiconify && (decorations & Decor_Iconify)) {
|
||||||
|
hasiconify = true;
|
||||||
|
parsed += *it;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
if (! hasmaximize && (decorations & Decor_Maximize)) {
|
||||||
|
hasmaximize = true;
|
||||||
|
parsed += *it;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'L':
|
||||||
|
if (! haslabel) {
|
||||||
|
haslabel = true;
|
||||||
|
parsed += *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int bx = frame.inside_w - bw;
|
if (! hasclose)
|
||||||
|
|
||||||
if (decorations & Decor_Close) {
|
|
||||||
if (frame.close_button == None) createCloseButton();
|
|
||||||
|
|
||||||
XMoveResizeWindow(blackbox->getXDisplay(), frame.close_button, bx, by,
|
|
||||||
frame.button_w, frame.button_w);
|
|
||||||
XMapWindow(blackbox->getXDisplay(), frame.close_button);
|
|
||||||
XClearWindow(blackbox->getXDisplay(), frame.close_button);
|
|
||||||
|
|
||||||
bx -= bw;
|
|
||||||
lw -= bw;
|
|
||||||
} else if (frame.close_button) {
|
|
||||||
destroyCloseButton();
|
destroyCloseButton();
|
||||||
}
|
if (! hasiconify)
|
||||||
if (decorations & Decor_Maximize) {
|
destroyCloseButton();
|
||||||
if (frame.maximize_button == None) createMaximizeButton();
|
if (! hasmaximize)
|
||||||
|
destroyCloseButton();
|
||||||
|
if (! haslabel)
|
||||||
|
parsed += 'L'; // require that the label be in the layout
|
||||||
|
|
||||||
XMoveResizeWindow(blackbox->getXDisplay(), frame.maximize_button, bx, by,
|
const unsigned int bsep = frame.bevel_w + 1; // separation between elements
|
||||||
frame.button_w, frame.button_w);
|
const unsigned int by = frame.bevel_w + 1;
|
||||||
XMapWindow(blackbox->getXDisplay(), frame.maximize_button);
|
const unsigned int ty = frame.bevel_w;
|
||||||
XClearWindow(blackbox->getXDisplay(), frame.maximize_button);
|
|
||||||
|
|
||||||
lw -= bw;
|
frame.label_w = frame.inside_w - bsep * 2 -
|
||||||
} else if (frame.maximize_button) {
|
(frame.button_w + bsep) * (parsed.size() - 1);
|
||||||
destroyMaximizeButton();
|
|
||||||
|
unsigned int x = bsep;
|
||||||
|
for (it = parsed.begin(), end = parsed.end(); it != end; ++it) {
|
||||||
|
switch(*it) {
|
||||||
|
case 'C':
|
||||||
|
if (!frame.close_button) createCloseButton();
|
||||||
|
XMoveResizeWindow(blackbox->getXDisplay(), frame.close_button, x, by,
|
||||||
|
frame.button_w, frame.button_w);
|
||||||
|
x += frame.button_w + bsep;
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
if (!frame.iconify_button) createIconifyButton();
|
||||||
|
XMoveResizeWindow(blackbox->getXDisplay(), frame.iconify_button, x, by,
|
||||||
|
frame.button_w, frame.button_w);
|
||||||
|
x += frame.button_w + bsep;
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
if (!frame.maximize_button) createMaximizeButton();
|
||||||
|
XMoveResizeWindow(blackbox->getXDisplay(), frame.maximize_button, x, by,
|
||||||
|
frame.button_w, frame.button_w);
|
||||||
|
x += frame.button_w + bsep;
|
||||||
|
break;
|
||||||
|
case 'L':
|
||||||
|
XMoveResizeWindow(blackbox->getXDisplay(), frame.label, x, ty,
|
||||||
|
frame.label_w, frame.label_h);
|
||||||
|
x += frame.label_w + bsep;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
frame.label_w = lw - by;
|
|
||||||
XMoveResizeWindow(blackbox->getXDisplay(), frame.label, lx, frame.bevel_w,
|
|
||||||
frame.label_w, frame.label_h);
|
|
||||||
if (redecorate_label) decorateLabel();
|
if (redecorate_label) decorateLabel();
|
||||||
|
|
||||||
redrawLabel();
|
redrawLabel();
|
||||||
redrawAllButtons();
|
redrawAllButtons();
|
||||||
}
|
}
|
||||||
|
@ -2369,6 +2402,18 @@ void BlackboxWindow::buttonPressEvent(XButtonEvent *be) {
|
||||||
windowmenu->hide();
|
windowmenu->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// mouse wheel up
|
||||||
|
} else if (be->button == 4) {
|
||||||
|
if ((be->window == frame.label ||
|
||||||
|
be->window == frame.title) &&
|
||||||
|
! flags.shaded)
|
||||||
|
shade();
|
||||||
|
// mouse wheel down
|
||||||
|
} else if (be->button == 5) {
|
||||||
|
if ((be->window == frame.label ||
|
||||||
|
be->window == frame.title) &&
|
||||||
|
flags.shaded)
|
||||||
|
shade();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -988,6 +988,7 @@ void Blackbox::save_rc(void) {
|
||||||
config.setValue("session.cacheLife", resource.cache_life / 60000);
|
config.setValue("session.cacheLife", resource.cache_life / 60000);
|
||||||
config.setValue("session.cacheMax", resource.cache_max);
|
config.setValue("session.cacheMax", resource.cache_max);
|
||||||
config.setValue("session.styleFile", resource.style_file);
|
config.setValue("session.styleFile", resource.style_file);
|
||||||
|
config.setValue("session.titlebarLayout", resource.titlebar_layout);
|
||||||
|
|
||||||
std::for_each(screenList.begin(), screenList.end(),
|
std::for_each(screenList.begin(), screenList.end(),
|
||||||
std::mem_fun(&BScreen::save_rc));
|
std::mem_fun(&BScreen::save_rc));
|
||||||
|
@ -1032,6 +1033,9 @@ void Blackbox::load_rc(void) {
|
||||||
|
|
||||||
if (! config.getValue("session.cacheMax", resource.cache_max))
|
if (! config.getValue("session.cacheMax", resource.cache_max))
|
||||||
resource.cache_max = 200;
|
resource.cache_max = 200;
|
||||||
|
|
||||||
|
if (! config.getValue("session.titlebarLayout", resource.titlebar_layout))
|
||||||
|
resource.titlebar_layout = "ILMC";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ private:
|
||||||
int colors_per_channel;
|
int colors_per_channel;
|
||||||
timeval auto_raise_delay;
|
timeval auto_raise_delay;
|
||||||
unsigned long cache_life, cache_max;
|
unsigned long cache_life, cache_max;
|
||||||
|
std::string titlebar_layout;
|
||||||
} resource;
|
} resource;
|
||||||
|
|
||||||
typedef std::map<Window, BlackboxWindow*> WindowLookup;
|
typedef std::map<Window, BlackboxWindow*> WindowLookup;
|
||||||
|
@ -241,6 +242,9 @@ public:
|
||||||
inline int getColorsPerChannel(void) const
|
inline int getColorsPerChannel(void) const
|
||||||
{ return resource.colors_per_channel; }
|
{ return resource.colors_per_channel; }
|
||||||
|
|
||||||
|
inline std::string getTitlebarLayout(void) const
|
||||||
|
{ return resource.titlebar_layout; }
|
||||||
|
|
||||||
inline const timeval &getAutoRaiseDelay(void) const
|
inline const timeval &getAutoRaiseDelay(void) const
|
||||||
{ return resource.auto_raise_delay; }
|
{ return resource.auto_raise_delay; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue