all repos — fluxbox @ 384603e962dcbd34bc05a220d8fbf3e88a980e80

custom fork of the fluxbox windowmanager

add UnderMousePlacement placement policy, plus a little fix for window
positioning (Simon)
rathnor rathnor
commit

384603e962dcbd34bc05a220d8fbf3e88a980e80

parent

9014e53be3ad695776be2eed5d80cbaffaa18873

5 files changed, 63 insertions(+), 13 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,9 @@

(Format: Year/Month/Day) Changes for 0.9.2: +*03/04/25: + * Add UnderMousePlacement policy, plus minor positioning fix (Simon) + -> Patch originally contributed by "Mike" (lgn@users.sf) + Screen.hh Workspace.cc fluxbox.cc Window.cc *03/04/21: * Fix toolbar startup and reconfigure things (Simon) (Thanks Brian Sea)
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.82 2003/04/20 13:45:07 fluxgen Exp $ +// $Id: Screen.hh,v 1.83 2003/04/25 09:07:08 rathnor Exp $ #ifndef SCREEN_HH #define SCREEN_HH

@@ -309,8 +309,8 @@ FluxboxWindow *createWindow(Window clientwin);

FluxboxWindow *createWindow(WinClient &client); void setupWindowActions(FluxboxWindow &win); - enum { ROWSMARTPLACEMENT = 1, COLSMARTPLACEMENT, CASCADEPLACEMENT, LEFTRIGHT, - RIGHTLEFT, TOPBOTTOM, BOTTOMTOP }; + enum { ROWSMARTPLACEMENT = 1, COLSMARTPLACEMENT, CASCADEPLACEMENT, + UNDERMOUSEPLACEMENT, LEFTRIGHT, RIGHTLEFT, TOPBOTTOM, BOTTOMTOP }; enum { LEFTJUSTIFY = 1, RIGHTJUSTIFY, CENTERJUSTIFY }; /// obsolete
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.144 2003/04/20 02:47:14 rathnor Exp $ +// $Id: Window.cc,v 1.145 2003/04/25 09:07:09 rathnor Exp $ #include "Window.hh"

@@ -409,9 +409,6 @@ }

upsize(); - m_frame.move(wattrib.x, wattrib.y); - m_frame.resizeForClient(wattrib.width, wattrib.height); - bool place_window = true; if (fluxbox->isStartup() || transient || m_client->normal_hint_flags & (PPosition|USPosition)) {

@@ -444,15 +441,19 @@ workspace_number = screen.getCurrentWorkspaceID();

restoreAttributes(); + m_frame.move(wattrib.x, wattrib.y); + m_frame.resizeForClient(wattrib.width, wattrib.height); + // if we're a transient then we should be on the same layer as our parent if (isTransient()) getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer()); else // if no parent then set default layer moveToLayer(m_layernum); - screen.getWorkspace(workspace_number)->addWindow(*this, place_window); + if (!place_window) + moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); - moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); + screen.getWorkspace(workspace_number)->addWindow(*this, place_window); if (shaded) { // start shaded shaded = false;

@@ -471,7 +472,6 @@ deiconify(); //we're omnipresent and visible

} setState(current_state); - m_frame.resizeForClient(wattrib.width, wattrib.height); m_frame.reconfigure(); sendConfigureNotify(); // no focus default
M src/Workspace.ccsrc/Workspace.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: Workspace.cc,v 1.53 2003/04/16 14:43:06 rathnor Exp $ +// $Id: Workspace.cc,v 1.54 2003/04/25 09:07:13 rathnor Exp $ #include "Workspace.hh"

@@ -528,13 +528,53 @@ change_y = -1;

if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) change_x = -1; - int win_w = win.getWidth() + screen.getBorderWidth2x(), win_h = win.getHeight() + screen.getBorderWidth2x(); int test_x, test_y, curr_x, curr_y, curr_w, curr_h; switch (screen.getPlacementPolicy()) { + case BScreen::UNDERMOUSEPLACEMENT: { + int root_x, root_y, min_y, min_x, max_y, max_x, ignore_i; + + unsigned int ignore_ui; + + Window ignore_w; + + XQueryPointer(screen.getBaseDisplay()->getXDisplay(), + screen.getRootWindow(), &ignore_w, &ignore_w, &root_x, &root_y, + &ignore_i, &ignore_i, &ignore_ui); + + test_x = root_x - (win_w / 2); + test_y = root_y - (win_h / 2); + + min_x = (int) screen.getMaxLeft(); + min_y = (int) screen.getMaxTop(); + max_x = (int) screen.getMaxRight() - win_w; + max_y = (int) screen.getMaxBottom() - win_h; + + // keep the window inside the screen + + if (test_x < min_x) + test_x = min_x; + + if (test_x > max_x) + test_x = max_x; + + if (test_y < min_y) + test_y = min_y; + + if (test_y > max_y) + test_y = max_y; + + place_x = test_x; + place_y = test_y; + + placed = true; + + break; + } // end case UNDERMOUSEPLACEMENT + case BScreen::ROWSMARTPLACEMENT: { test_y = 0;
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.115 2003/04/20 12:21:35 rathnor Exp $ +// $Id: fluxbox.cc,v 1.116 2003/04/25 09:07:14 rathnor Exp $ #include "fluxbox.hh"

@@ -1776,6 +1776,10 @@ case BScreen::COLSMARTPLACEMENT:

placement = "ColSmartPlacement"; break; + case BScreen::UNDERMOUSEPLACEMENT: + placement = "UnderMousePlacement"; + break; + default: case BScreen::ROWSMARTPLACEMENT: placement = "RowSmartPlacement";

@@ -2021,6 +2025,8 @@ if (! strncasecmp(value.addr, "RowSmartPlacement", value.size))

screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size)) screen.savePlacementPolicy(BScreen::COLSMARTPLACEMENT); + else if (! strncasecmp(value.addr, "UnderMousePlacement", value.size)) + screen.savePlacementPolicy(BScreen::UNDERMOUSEPLACEMENT); else screen.savePlacementPolicy(BScreen::CASCADEPLACEMENT); } else