all repos — fluxbox @ bc8e67136f9df2d0475f0e2f01e03976aabfa259

custom fork of the fluxbox windowmanager

fixed autohide issue and toolbar menu
fluxgen fluxgen
commit

bc8e67136f9df2d0475f0e2f01e03976aabfa259

parent

89a3b058d6d8f7ede6d3bb516f88c93d48c1bea5

1 files changed, 35 insertions(+), 4 deletions(-)

jump to
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.112 2003/08/19 21:28:57 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.113 2003/08/23 15:42:48 fluxgen Exp $ #include "Toolbar.hh"

@@ -161,7 +161,7 @@

namespace { class SetToolbarPlacementCmd: public FbTk::Command { public: - explicit SetToolbarPlacementCmd(Toolbar &tbar, Toolbar::Placement place):m_tbar(tbar), m_place(place) { } + SetToolbarPlacementCmd(Toolbar &tbar, Toolbar::Placement place):m_tbar(tbar), m_place(place) { } void execute() { m_tbar.setPlacement(m_place); m_tbar.reconfigure();

@@ -172,6 +172,32 @@ Toolbar &m_tbar;

Toolbar::Placement m_place; }; +class ShowMenuAboveToolbar: public FbTk::Command { +public: + explicit ShowMenuAboveToolbar(Toolbar &tbar):m_tbar(tbar) { } + void execute() { + + // 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); + m_tbar.menu().show(); + } +private: + Toolbar &m_tbar; +}; }; // end anonymous // toolbar frame

@@ -258,7 +284,11 @@ frame.bevel_w = 1;

frame.grab_x = frame.grab_y = 0; // add toolbar items - m_item_list.push_back(new WorkspaceNameTool(frame.window, m_workspace_theme, screen())); + WorkspaceNameTool *item = new WorkspaceNameTool(frame.window, m_workspace_theme, screen()); + using namespace FbTk; + RefCount<Command> showmenu(new ShowMenuAboveToolbar(*this)); + item->button().setOnClick(showmenu); + m_item_list.push_back(item); m_item_list.push_back(new IconbarTool(frame.window, m_iconbar_theme, screen())); m_item_list.push_back(new SystemTray(frame.window)); m_item_list.push_back(new ClockTool(frame.window, m_clock_theme, screen()));

@@ -279,7 +309,8 @@ frame.window.showSubwindows();

frame.window.show(); scrn.resourceManager().unlock(); - + // setup to listen to child events + FbTk::EventManager::instance()->addParent(*this, window()); // get everything together reconfigure();