all repos — fluxbox @ 768d98a39d3640f24ebe13e2c304fac3436a0a0d

custom fork of the fluxbox windowmanager

head specific strut, patch from Mathieu De Zutter
fluxgen fluxgen
commit

768d98a39d3640f24ebe13e2c304fac3436a0a0d

parent

37757769634c836895d205b0a5149ffffaae9bfb

M src/Ewmh.ccsrc/Ewmh.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.cc,v 1.50 2004/09/10 15:36:04 akir Exp $ +// $Id: Ewmh.cc,v 1.51 2004/09/11 13:34:36 fluxgen Exp $ #include "Ewmh.hh"

@@ -829,9 +829,11 @@ if (winclient.property(m_net_wm_strut, 0, 4, False, XA_CARDINAL,

&ret_type, &fmt, &nitems, &bytes_after, (unsigned char **) &data) && data) { - winclient.setStrut(winclient.screen().requestStrut(data[0], data[1], - data[2], data[3])); - winclient.screen().updateAvailableWorkspaceArea(); + int head = winclient.screen().getHead(winclient); + winclient.setStrut(winclient.screen().requestStrut(head, + data[0], data[1], + data[2], data[3])); + winclient.screen().updateAvailableWorkspaceArea(); } }
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.81 2004/09/11 12:33:14 rathnor Exp $ +// $Id: Menu.cc,v 1.82 2004/09/11 13:45:16 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -79,6 +79,8 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):

m_theme(tm), m_parent(0), m_image_ctrl(imgctrl), + m_screen_x(0), + m_screen_y(0), m_screen_width(DisplayWidth(FbTk::App::instance()->display(), tm.screenNum())), m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())), m_alignment(ALIGNDONTCARE),

@@ -192,8 +194,6 @@

if (menu.sel_pixmap) m_image_ctrl.removeImage(menu.sel_pixmap); - FbTk::EventManager &evm = *FbTk::EventManager::instance(); - if (s_focused == this) s_focused = 0; }

@@ -236,6 +236,7 @@ MenuItem *item = (*it);

if (item) { menuitems.erase(it); + if (!internal_menu && item->submenu() != 0) { Menu *tmp = item->submenu(); // if menu is interal we should just hide it instead

@@ -796,6 +797,8 @@ item->isEnabled()) {

if (item->submenu()->m_parent != this) item->submenu()->m_parent = this; + + item->submenu()->setScreen(m_screen_x, m_screen_y, m_screen_width, m_screen_height); int sbl = index / menu.persub, i = index - (sbl * menu.persub); int new_x = x() + ((menu.item_w * (sbl + 1)) + menu.window.borderWidth());

@@ -821,24 +824,26 @@ new_y = (((shifted) ? menu.y_shift : y()) +

height() - item->submenu()->height()); } - if ((new_x + item->submenu()->width()) > m_screen_width) { + int borderw = item->submenu()->fbwindow().borderWidth(); + + if ((new_x + item->submenu()->width()) + 2*borderw > m_screen_x + m_screen_width) { new_x = ((shifted) ? menu.x_shift : x()) - item->submenu()->width() - menu.window.borderWidth(); } - if (new_x < 0) - new_x = 0; + if (new_x < m_screen_x) + new_x = m_screen_x; - if ((new_y + item->submenu()->height()) > m_screen_height) { - new_y = m_screen_height - item->submenu()->height() - + if ((new_y + item->submenu()->height()) > m_screen_y + m_screen_height) { + new_y = m_screen_y + m_screen_height - item->submenu()->height() - menu.window.borderWidth() * 2; } item->submenu()->moving = moving; which_sub = index; - if (new_y < 0) - new_y = 0; + if (new_y < m_screen_y) + new_y = m_screen_y; item->submenu()->move(new_x, new_y); if (! moving)

@@ -1085,10 +1090,11 @@

if (item->submenu()) { if (!item->submenu()->isVisible()) drawSubmenu(w); - } else + } else { drawItem(w, true, // clear true); // render transparency + } } } else {

@@ -1120,14 +1126,10 @@

} } - if (re.x >= 0 && re.x <= (signed) width() && - re.y >= 0 && re.y <= (signed) theme().titleHeight() && - re.button == 3) + if (re.button == 3) hide(); - } else if (re.window == menu.frame && - re.x >= 0 && re.x < (signed) width() && - re.y >= 0 && re.y < (signed) menu.frame_h) { + } else if (re.window == menu.frame) { int sbl = (re.x / menu.item_w), i = (re.y / theme().itemHeight()), ix = sbl * menu.item_w, iy = i * theme().itemHeight(),

@@ -1140,17 +1142,16 @@ if (re.x > ix && re.x < (signed) (ix + menu.item_w) &&

re.y > iy && re.y < (signed) (iy + theme().itemHeight())) { menuitems[w]->click(re.button, re.time); itemSelected(re.button, w); - // just redraw this item - drawItem(w, + drawItem(w, true, // clear true); // transparent } + } else { - drawItem(p, + drawItem(p, true, // clear true); // transparent } - } else { drawItem(p, true, // clear

@@ -1284,8 +1285,8 @@ if (menu.frame != ce.window)

return; menu.x_shift = x(), menu.y_shift = y(); - if (x() + width() > m_screen_width) { - menu.x_shift = m_screen_width - width() - 2*theme().borderWidth(); + if (x() + width() > m_screen_x + m_screen_width) { + menu.x_shift = m_screen_x + m_screen_width - width() - 2*theme().borderWidth(); shifted = true; } else if (x() < 0) { menu.x_shift = 0; //-theme().borderWidth();

@@ -1380,6 +1381,7 @@ default:

break; } } + void Menu::reconfigure() {

@@ -1513,6 +1515,13 @@ width, height);

#endif // HAVE_XRENDER +} + +void Menu::setScreen(int x, int y, int w, int h) { + m_screen_x = x; + m_screen_y = y; + m_screen_width = w; + m_screen_height = h; } }; // end namespace FbTk
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.hh,v 1.39 2004/08/29 12:35:29 rathnor Exp $ +// $Id: Menu.hh,v 1.40 2004/09/11 13:45:16 fluxgen Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH

@@ -94,6 +94,8 @@ void enterParent();

void disableTitle(); void enableTitle(); + + void setScreen(int x, int y, int w, int h); /** @name event handlers

@@ -200,7 +202,8 @@ Menu *m_parent;

ImageControl &m_image_ctrl; Menuitems menuitems; - const unsigned int m_screen_width, m_screen_height; + int m_screen_x, m_screen_y; + int m_screen_width, m_screen_height; bool moving; ///< if we're moving/draging or not bool visible; ///< menu visibility bool torn; ///< torn from parent
M src/Makefile.amsrc/Makefile.am

@@ -113,6 +113,7 @@ IconMenu.hh IconMenu.cc \

WorkspaceMenu.hh WorkspaceMenu.cc \ FocusModelMenuItem.hh \ ToggleMenu.hh \ + HeadArea.hh HeadArea.cc \ ${newwmspec_SOURCE} ${gnome_SOURCE} \ ${REMEMBER_SOURCE} ${REGEXP_SOURCE} ${TOOLBAR_SOURCE}
M src/Strut.hhsrc/Strut.hh

@@ -20,28 +20,35 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Strut.hh,v 1.3 2004/01/19 18:30:59 fluxgen Exp $ +// $Id: Strut.hh,v 1.4 2004/09/11 13:36:03 fluxgen Exp $ #ifndef STRUT_HH #define STRUT_HH class Strut { public: - Strut(int left, int right, - int top, int bottom):m_left(left), m_right(right), - m_top(top), m_bottom(bottom) { } + Strut(int head, int left, int right, + int top, int bottom, Strut* next = 0) + :m_head(head), m_left(left), m_right(right), + m_top(top), m_bottom(bottom), m_next(next) { } + inline int head() const { return m_head; } inline int left() const { return m_left; } inline int right() const { return m_right; } inline int bottom() const { return m_bottom; } inline int top() const { return m_top; } + inline Strut* next() const { return m_next; } bool operator == (const Strut &test) const { - return (left() == test.left() && + return (head() == test.head() && + left() == test.left() && right() == test.right() && top() == test.top() && bottom() == test.bottom()); } private: + Strut():m_head(0), m_left(0), m_right(0), m_top(0), m_bottom(0), m_next(0) {} + int m_head; int m_left, m_right, m_top, m_bottom; + Strut *m_next; ///< link to struts on all heads }; #endif // STRUT_HH
M src/ToolFactory.ccsrc/ToolFactory.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolFactory.cc,v 1.7 2004/08/27 14:36:12 rathnor Exp $ +// $Id: ToolFactory.cc,v 1.8 2004/09/11 13:40:57 fluxgen Exp $ #include "ToolFactory.hh"

@@ -43,6 +43,8 @@ #include "fluxbox.hh"

#include "FbTk/FbWindow.hh" +#include <utility> + namespace { class ShowMenuAboveToolbar: public FbTk::Command { public:

@@ -51,20 +53,18 @@ void execute() {

m_tbar.screen().hideMenus(); // get last button pos const XEvent &event = Fluxbox::instance()->lastEvent(); - int x = event.xbutton.x_root - (m_tbar.menu().width() / 2); - int y = event.xbutton.y_root - (m_tbar.menu().height() / 2); - - if (x < 0) - x = 0; - else if (x + m_tbar.menu().width() > m_tbar.screen().width()) - x = m_tbar.screen().width() - m_tbar.menu().width(); - - if (y < 0) - y = 0; - else if (y + m_tbar.menu().height() > m_tbar.screen().height()) - y = m_tbar.screen().height() - m_tbar.menu().height(); - - m_tbar.menu().move(x, y); + int head = m_tbar.screen().getHead(event.xbutton.x_root, event.xbutton.y_root); + std::pair<int, int> m = + m_tbar.screen().clampToHead( head, + event.xbutton.x_root - (m_tbar.menu().width() / 2), + event.xbutton.y_root - (m_tbar.menu().height() / 2), + m_tbar.menu().width(), + m_tbar.menu().height()); + m_tbar.menu().setScreen(m_tbar.screen().getHeadX(head), + m_tbar.screen().getHeadY(head), + m_tbar.screen().getHeadWidth(head), + m_tbar.screen().getHeadHeight(head)); + m_tbar.menu().move(m.first, m.second); m_tbar.menu().show(); } private:
M src/Toolbar.ccsrc/Toolbar.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.153 2004/09/11 13:33:07 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.154 2004/09/11 13:34:01 fluxgen Exp $ #include "Toolbar.hh"

@@ -488,17 +488,16 @@ if (! menu().isVisible()) {

int head = screen().getHead(be.x_root, be.y_root); int borderw = menu().fbwindow().borderWidth(); - pair<int, int> m = screen().clampToHead( head, - be.x_root - (menu().width() / 2), - be.y_root - (menu().titleWindow().height() / 2), - menu().width() + 2*borderw, - menu().height() + 2*borderw); + pair<int, int> m = screen().clampToHead(head, + be.x_root - (menu().width() / 2), + be.y_root - (menu().titleWindow().height() / 2), + menu().width() + 2*borderw, + menu().height() + 2*borderw); - menu().setScreen( - screen().getHeadX(head), - screen().getHeadY(head), - screen().getHeadWidth(head), - screen().getHeadHeight(head)); + menu().setScreen(screen().getHeadX(head), + screen().getHeadY(head), + screen().getHeadWidth(head), + screen().getHeadHeight(head)); menu().move(m.first, m.second); menu().show(); menu().grabInputFocus();
M src/fluxbox.ccsrc/fluxbox.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.253 2004/09/11 12:33:14 rathnor Exp $ +// $Id: fluxbox.cc,v 1.254 2004/09/11 13:38:58 fluxgen Exp $ #include "fluxbox.hh"

@@ -1104,28 +1104,20 @@ if (screen->getRootmenu().isVisible())

screen->getRootmenu().hide(); } else if (be.button == 2) { - int mx = be.x_root - - (screen->getWorkspacemenu().width() / 2); - int my = be.y_root - - (screen->getWorkspacemenu().titleWindow().height() / 2); - - if (mx < 0) mx = 0; - if (my < 0) my = 0; + int borderw = screen->getWorkspacemenu().fbwindow().borderWidth(); + int head = screen->getHead(be.x_root, be.y_root); - if (mx + screen->getWorkspacemenu().width() > - screen->width()) { - mx = screen->width()-1 - - screen->getWorkspacemenu().width() - - 2*screen->getWorkspacemenu().fbwindow().borderWidth(); - } - - if (my + screen->getWorkspacemenu().height() > - screen->height()) { - my = screen->height()-1 - - screen->getWorkspacemenu().height() - - 2*screen->getWorkspacemenu().fbwindow().borderWidth(); - } - screen->getWorkspacemenu().move(mx, my); + pair<int, int> m = + screen->clampToHead(head, + be.x_root - (screen->getWorkspacemenu().width() / 2), + be.y_root - (screen->getWorkspacemenu().titleWindow().height() / 2), + screen->getWorkspacemenu().width() + 2*borderw, + screen->getWorkspacemenu().height() + 2*borderw); + screen->getWorkspacemenu().move(m.first, m.second); + screen->getWorkspacemenu().setScreen(screen->getHeadX(head), + screen->getHeadY(head), + screen->getHeadWidth(head), + screen->getHeadHeight(head)); if (! screen->getWorkspacemenu().isVisible()) { screen->getWorkspacemenu().removeParent();

@@ -1135,29 +1127,23 @@ }

} else if (be.button == 3) { //calculate placement of root menu //and show/hide it - int mx = be.x_root - - (screen->getRootmenu().width() / 2); - int my = be.y_root - - (screen->getRootmenu().titleWindow().height() / 2); + int borderw = screen->getRootmenu().fbwindow().borderWidth(); + int head = screen->getHead(be.x_root, be.y_root); - if (mx < 0) mx = 0; - if (my < 0) my = 0; - - if (mx + screen->getRootmenu().width() + 2*borderw > screen->width()) { - mx = screen->width() - - screen->getRootmenu().width() - - 2*borderw; - } - - if (my + screen->getRootmenu().height() + 2*borderw > - screen->height()) { - my = screen->height() - - screen->getRootmenu().height() - - 2*borderw; - } - screen->getRootmenu().move(mx, my); + pair<int, int> m = + screen->clampToHead(head, + be.x_root - (screen->getRootmenu().width() / 2), + be.y_root - (screen->getRootmenu().titleWindow().height() / 2), + screen->getRootmenu().width() + 2*borderw, + screen->getRootmenu().height() + 2*borderw); + screen->getRootmenu().move(m.first, m.second); + screen->getRootmenu().setScreen(screen->getHeadX(head), + screen->getHeadY(head), + screen->getHeadWidth(head), + screen->getHeadHeight(head)); + if (! screen->getRootmenu().isVisible()) { checkMenu(); screen->getRootmenu().show();