all repos — fluxbox @ c28bd74febd7587a2ab10c5b1b6554f6ed8a5ff3

custom fork of the fluxbox windowmanager

added autogrouping-from-tab patch from Steve Cooper
fluxgen fluxgen
commit

c28bd74febd7587a2ab10c5b1b6554f6ed8a5ff3

parent

378c946d89569afcfe61fcafcf90fa0247673da9

M src/Basemenu.hhsrc/Basemenu.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: Basemenu.hh,v 1.14 2002/05/19 12:57:47 fluxgen Exp $ +// $Id: Basemenu.hh,v 1.15 2002/08/02 12:52:44 fluxgen Exp $ #ifndef BASEMENU_HH #define BASEMENU_HH

@@ -126,6 +126,8 @@ virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false,

int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0); virtual void redrawTitle(); virtual void internal_hide(); + inline Basemenu *GetParent() { return m_parent; } + inline const Basemenu *GetParent() const { return m_parent; } }; class BasemenuItem {
M src/Rootmenu.ccsrc/Rootmenu.cc

@@ -50,7 +50,10 @@ #define MAXPATHLEN 255

#endif // MAXPATHLEN -Rootmenu::Rootmenu(BScreen *scrn) : Basemenu(scrn) { +Rootmenu::Rootmenu(BScreen *scrn) +: Basemenu(scrn), + auto_group_window(0) +{ screen = scrn; }

@@ -73,7 +76,10 @@ DisplayString(screen->getBaseDisplay()->getXDisplay()));

sprintf(displaystring + strlen(displaystring) - 1, "%d", screen->getScreenNumber()); + screen->setAutoGroupWindow(useAutoGroupWindow()); + bexec(item->exec().c_str(), displaystring); + #else // __EMX__ spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", item->exec().c_str(), NULL); #endif // !__EMX__

@@ -113,3 +119,22 @@ }

} } +void Rootmenu::setAutoGroupWindow(Window window) +{ + auto_group_window = window; +} + +Window Rootmenu::useAutoGroupWindow() +{ + // Return and clear the auto-grouping state. + Window w = auto_group_window; + if (w) + auto_group_window = 0; // clear it immediately + // If not set check the parent and the parent's parent, ... + else { + Rootmenu* parent = dynamic_cast<Rootmenu*>(GetParent()); + if (parent) + w = parent->useAutoGroupWindow(); + } + return w; +}
M src/Rootmenu.hhsrc/Rootmenu.hh

@@ -32,6 +32,7 @@

class Rootmenu : public Basemenu { private: BScreen *screen; + Window auto_group_window; protected:

@@ -40,6 +41,11 @@

public: Rootmenu(BScreen *); + void setAutoGroupWindow(Window window); + + +private: + Window useAutoGroupWindow(); };
M src/Screen.ccsrc/Screen.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: Screen.cc,v 1.58 2002/07/23 17:11:59 fluxgen Exp $ +// $Id: Screen.cc,v 1.59 2002/08/02 12:52:44 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -474,7 +474,7 @@ delete obj;

} } -BScreen::~BScreen(void) { +BScreen::~BScreen() { #ifdef GNOME XDestroyWindow(getBaseDisplay()->getXDisplay(), gnome_win); #endif

@@ -548,7 +548,7 @@ delete theme;

} -void BScreen::reconfigure(void) { +void BScreen::reconfigure() { #ifdef DEBUG cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl; #endif

@@ -653,7 +653,7 @@ image_control->timeout();

} -void BScreen::rereadMenu(void) { +void BScreen::rereadMenu() { initMenu(); raiseWindows(0, 0);

@@ -661,11 +661,11 @@ rootmenu->reconfigure();

} -void BScreen::removeWorkspaceNames(void) { +void BScreen::removeWorkspaceNames() { workspaceNames.erase(workspaceNames.begin(), workspaceNames.end()); } -void BScreen::updateWorkspaceNamesAtom(void) { +void BScreen::updateWorkspaceNamesAtom() { #ifdef GNOME XTextProperty text;

@@ -741,7 +741,7 @@ return 0;

} -int BScreen::addWorkspace(void) { +int BScreen::addWorkspace() { Workspace *wkspc = new Workspace(this, workspacesList.size()); workspacesList.push_back(wkspc); //add workspace to workspacemenu

@@ -760,7 +760,7 @@

} -int BScreen::removeLastWorkspace(void) { +int BScreen::removeLastWorkspace() { if (workspacesList.size() > 1) { Workspace *wkspc = workspacesList.back();

@@ -888,7 +888,7 @@ }

} -void BScreen::updateNetizenCurrentWorkspace(void) { +void BScreen::updateNetizenCurrentWorkspace() { #ifdef NEWWMSPEC //update _NET_WM_CURRENT_DESKTOP int workspace = getCurrentWorkspaceID();

@@ -914,7 +914,7 @@

} -void BScreen::updateNetizenWorkspaceCount(void) { +void BScreen::updateNetizenWorkspaceCount() { Netizens::iterator it = netizenList.begin(); Netizens::iterator it_end = netizenList.end();

@@ -941,7 +941,7 @@

} -void BScreen::updateNetizenWindowFocus(void) { +void BScreen::updateNetizenWindowFocus() { Netizens::iterator it = netizenList.begin(); Netizens::iterator it_end = netizenList.end();

@@ -1194,7 +1194,7 @@

//--------- raiseFocus ----------- // Raise the current focused window //-------------------------------- -void BScreen::raiseFocus(void) { +void BScreen::raiseFocus() { bool have_focused = false; int focused_window_number = -1;

@@ -1210,7 +1210,7 @@ getWorkspace(fluxbox->getFocusedWindow()->getWorkspaceNumber())->

raiseWindow(fluxbox->getFocusedWindow()); } -void BScreen::initMenu(void) { +void BScreen::initMenu() { I18n *i18n = I18n::instance(); if (rootmenu) {

@@ -1571,7 +1571,7 @@ } // end of 'stat'

} -void BScreen::shutdown(void) { +void BScreen::shutdown() { fluxbox->grab(); XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), NoEventMask);

@@ -1688,7 +1688,7 @@ theme->getBevelWidth(), label, strlen(label));

} -void BScreen::hideGeometry(void) { +void BScreen::hideGeometry() { if (geom_visible) { XUnmapWindow(getBaseDisplay()->getXDisplay(), geom_window); geom_visible = false;

@@ -1735,8 +1735,17 @@ (opts & CYCLESKIPLOWERTABS) != 0 && w->isLowerTab() || // skip if lower tab

(opts & CYCLESKIPSHADED) != 0 && w->isShaded()); // skip if shaded } +//----------- useAutoGroupWindow ------------- +// Access and clear the auto-group window +//-------------------------------------------- +FluxboxWindow* BScreen::useAutoGroupWindow() { + Window w = auto_group_window; + auto_group_window = 0; + return w ? Fluxbox::instance()->searchWindow(w) : 0; +} + #ifdef GNOME -void BScreen::initGnomeAtoms(void) { +void BScreen::initGnomeAtoms() { /* create the GNOME window */ gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(),
M src/Screen.hhsrc/Screen.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: Screen.hh,v 1.39 2002/07/23 18:37:05 fluxgen Exp $ +// $Id: Screen.hh,v 1.40 2002/08/02 12:52:44 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH

@@ -181,6 +181,7 @@ inline void saveWorkspaceWarping(bool s) { resource.workspace_warping = s; }

inline void saveDesktopWheeling(bool s) { resource.desktop_wheeling = s; } inline void iconUpdate(void) { iconmenu->update(); } inline Iconmenu *getIconmenu(void) { return iconmenu; } + inline void setAutoGroupWindow(Window w = 0) { auto_group_window = w; } #ifdef HAVE_STRFTIME

@@ -229,6 +230,8 @@ void shutdown(void);

void showPosition(int, int); void showGeometry(unsigned int, unsigned int); void hideGeometry(void); + + FluxboxWindow* useAutoGroupWindow(void); void updateNetizenCurrentWorkspace(void); void updateNetizenWorkspaceCount(void);

@@ -293,6 +296,8 @@ typedef std::vector<Workspace *> Workspaces;

WorkspaceNames workspaceNames; Workspaces workspacesList; + + Window auto_group_window; struct ScreenResource { ScreenResource(ResourceManager &rm, const std::string &scrname,
M src/Tab.ccsrc/Tab.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: Tab.cc,v 1.29 2002/07/23 17:11:59 fluxgen Exp $ +// $Id: Tab.cc,v 1.30 2002/08/02 12:57:19 fluxgen Exp $ #include "Tab.hh"

@@ -654,11 +654,25 @@ void Tab::buttonPressEvent(XButtonEvent *be) {

//draw in pressed mode draw(true); - //set window to titlewindow so we can take advatage of drag function - be->window = m_win->frame.title; + //invoke root menu with auto-glueing? + if (be->button == 3) { + BScreen *screen = m_win->getScreen(); + Rootmenu *rootmenu = screen->getRootmenu(); + if (! rootmenu->isVisible()) { + Fluxbox::instance()->checkMenu(); + screen->getRootmenu()->move(be->x_root, be->y_root-rootmenu->titleHeight()); + rootmenu->setAutoGroupWindow(m_win->getClientWindow()); + rootmenu->show(); + } + } + //otherwise let the window handle the event + else { + //set window to titlewindow so we can take advantage of drag function + be->window = m_win->frame.title; - //call windows buttonpress eventhandler - m_win->buttonPressEvent(be); + //call windows buttonpress eventhandler + m_win->buttonPressEvent(be); + } } //----------- buttonReleaseEvent ----------

@@ -1186,3 +1200,17 @@ }

} return ANONE; } + +//---------- addWindowToGroup ------------ +// Add a window the the tabbed group +//---------------------------------------- +bool Tab::addWindowToGroup(FluxboxWindow *otherWindow) +{ + if (!otherWindow || otherWindow == m_win) + return false; + Tab *otherTab = otherWindow->getTab(); + if (!otherTab) + return false; + insert(otherTab); + return true; +}
M src/Tab.hhsrc/Tab.hh

@@ -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: Tab.hh,v 1.13 2002/05/19 15:35:39 fluxgen Exp $ +// $Id: Tab.hh,v 1.14 2002/08/02 12:57:19 fluxgen Exp $ #ifndef TAB_HH #define TAB_HH

@@ -81,13 +81,16 @@ const Tab *last() const { return getLast(const_cast<Tab *>(this)); }

const Tab *first() const { return getFirst(const_cast<Tab *>(this)); } const FluxboxWindow *getWindow() const { return m_win; } + Window getTabWindow() const { return m_tabwin; } unsigned int getTabWidth() const { return m_size_w; } unsigned int getTabHeight() const { return m_size_h; } - void resizeGroup(void); // used when (un)shading windows - void calcIncrease(void); + void resizeGroup(); // used when (un)shading windows + void calcIncrease(); bool configured() const { return m_configured; } void draw(bool pressed) const; + + bool addWindowToGroup(FluxboxWindow *window); static Tab *getFirst(Tab *current); static Tab *getLast(Tab *current);
M src/Window.ccsrc/Window.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: Window.cc,v 1.63 2002/07/23 17:11:59 fluxgen Exp $ +// $Id: Window.cc,v 1.64 2002/08/02 12:58:37 fluxgen Exp $ #include "Window.hh"

@@ -758,7 +758,7 @@ XGrabButton(display, Button1, AnyModifier,

frame.plate, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None); XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate); - + XGrabButton(display, Button1, Mod1Mask, frame.window, True, ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,

@@ -768,7 +768,7 @@ //----grab with "all" modifiers

grabButton(display, Button1, frame.window, fluxbox->getMoveCursor()); XGrabButton(display, Button2, Mod1Mask, frame.window, True, - ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); + ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); XGrabButton(display, Button3, Mod1Mask, frame.window, True, ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,

@@ -2787,6 +2787,17 @@

visible = true; iconic = false; + + // Auto-group? + if (!transient) { + // Grab and clear the auto-group window + FluxboxWindow* autoGroupWindow = screen->useAutoGroupWindow(); + if (autoGroupWindow) { + Tab *groupTab = autoGroupWindow->getTab(); + if (groupTab) + groupTab->addWindowToGroup(this); + } + } fluxbox->ungrab(); }