aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-04-25 09:07:14 (GMT)
committerrathnor <rathnor>2003-04-25 09:07:14 (GMT)
commit384603e962dcbd34bc05a220d8fbf3e88a980e80 (patch)
treed1b1a9018c48bde8efca64391ddd422f8efe19bb
parent9014e53be3ad695776be2eed5d80cbaffaa18873 (diff)
downloadfluxbox_pavel-384603e962dcbd34bc05a220d8fbf3e88a980e80.zip
fluxbox_pavel-384603e962dcbd34bc05a220d8fbf3e88a980e80.tar.bz2
add UnderMousePlacement placement policy, plus a little fix for window
positioning (Simon)
-rw-r--r--ChangeLog4
-rw-r--r--src/Screen.hh6
-rw-r--r--src/Window.cc14
-rw-r--r--src/Workspace.cc44
-rw-r--r--src/fluxbox.cc8
5 files changed, 63 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 856370f..111653a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.2: 2Changes for 0.9.2:
3*03/04/25:
4 * Add UnderMousePlacement policy, plus minor positioning fix (Simon)
5 -> Patch originally contributed by "Mike" (lgn@users.sf)
6 Screen.hh Workspace.cc fluxbox.cc Window.cc
3*03/04/21: 7*03/04/21:
4 * Fix toolbar startup and reconfigure things (Simon) 8 * Fix toolbar startup and reconfigure things (Simon)
5 (Thanks Brian Sea) 9 (Thanks Brian Sea)
diff --git a/src/Screen.hh b/src/Screen.hh
index 5b5f0de..1e010ab 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.hh,v 1.82 2003/04/20 13:45:07 fluxgen Exp $ 25// $Id: Screen.hh,v 1.83 2003/04/25 09:07:08 rathnor Exp $
26 26
27#ifndef SCREEN_HH 27#ifndef SCREEN_HH
28#define SCREEN_HH 28#define SCREEN_HH
@@ -309,8 +309,8 @@ public:
309 FluxboxWindow *createWindow(WinClient &client); 309 FluxboxWindow *createWindow(WinClient &client);
310 void setupWindowActions(FluxboxWindow &win); 310 void setupWindowActions(FluxboxWindow &win);
311 311
312 enum { ROWSMARTPLACEMENT = 1, COLSMARTPLACEMENT, CASCADEPLACEMENT, LEFTRIGHT, 312 enum { ROWSMARTPLACEMENT = 1, COLSMARTPLACEMENT, CASCADEPLACEMENT,
313 RIGHTLEFT, TOPBOTTOM, BOTTOMTOP }; 313 UNDERMOUSEPLACEMENT, LEFTRIGHT, RIGHTLEFT, TOPBOTTOM, BOTTOMTOP };
314 enum { LEFTJUSTIFY = 1, RIGHTJUSTIFY, CENTERJUSTIFY }; 314 enum { LEFTJUSTIFY = 1, RIGHTJUSTIFY, CENTERJUSTIFY };
315 315
316 /// obsolete 316 /// obsolete
diff --git a/src/Window.cc b/src/Window.cc
index 890a4e0..15f7e0e 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.144 2003/04/20 02:47:14 rathnor Exp $ 25// $Id: Window.cc,v 1.145 2003/04/25 09:07:09 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -409,9 +409,6 @@ void FluxboxWindow::init() {
409 409
410 upsize(); 410 upsize();
411 411
412 m_frame.move(wattrib.x, wattrib.y);
413 m_frame.resizeForClient(wattrib.width, wattrib.height);
414
415 bool place_window = true; 412 bool place_window = true;
416 if (fluxbox->isStartup() || transient || 413 if (fluxbox->isStartup() || transient ||
417 m_client->normal_hint_flags & (PPosition|USPosition)) { 414 m_client->normal_hint_flags & (PPosition|USPosition)) {
@@ -444,15 +441,19 @@ void FluxboxWindow::init() {
444 441
445 restoreAttributes(); 442 restoreAttributes();
446 443
444 m_frame.move(wattrib.x, wattrib.y);
445 m_frame.resizeForClient(wattrib.width, wattrib.height);
446
447 // if we're a transient then we should be on the same layer as our parent 447 // if we're a transient then we should be on the same layer as our parent
448 if (isTransient()) 448 if (isTransient())
449 getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer()); 449 getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer());
450 else // if no parent then set default layer 450 else // if no parent then set default layer
451 moveToLayer(m_layernum); 451 moveToLayer(m_layernum);
452 452
453 screen.getWorkspace(workspace_number)->addWindow(*this, place_window); 453 if (!place_window)
454 moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height());
454 455
455 moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); 456 screen.getWorkspace(workspace_number)->addWindow(*this, place_window);
456 457
457 if (shaded) { // start shaded 458 if (shaded) { // start shaded
458 shaded = false; 459 shaded = false;
@@ -471,7 +472,6 @@ void FluxboxWindow::init() {
471 } 472 }
472 473
473 setState(current_state); 474 setState(current_state);
474 m_frame.resizeForClient(wattrib.width, wattrib.height);
475 m_frame.reconfigure(); 475 m_frame.reconfigure();
476 sendConfigureNotify(); 476 sendConfigureNotify();
477 // no focus default 477 // no focus default
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 9ddce15..4d357b0 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Workspace.cc,v 1.53 2003/04/16 14:43:06 rathnor Exp $ 25// $Id: Workspace.cc,v 1.54 2003/04/25 09:07:13 rathnor Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -528,13 +528,53 @@ void Workspace::placeWindow(FluxboxWindow &win) {
528 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) 528 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT)
529 change_x = -1; 529 change_x = -1;
530 530
531
532 int win_w = win.getWidth() + screen.getBorderWidth2x(), 531 int win_w = win.getWidth() + screen.getBorderWidth2x(),
533 win_h = win.getHeight() + screen.getBorderWidth2x(); 532 win_h = win.getHeight() + screen.getBorderWidth2x();
534 533
535 int test_x, test_y, curr_x, curr_y, curr_w, curr_h; 534 int test_x, test_y, curr_x, curr_y, curr_w, curr_h;
536 535
537 switch (screen.getPlacementPolicy()) { 536 switch (screen.getPlacementPolicy()) {
537 case BScreen::UNDERMOUSEPLACEMENT: {
538 int root_x, root_y, min_y, min_x, max_y, max_x, ignore_i;
539
540 unsigned int ignore_ui;
541
542 Window ignore_w;
543
544 XQueryPointer(screen.getBaseDisplay()->getXDisplay(),
545 screen.getRootWindow(), &ignore_w, &ignore_w, &root_x, &root_y,
546 &ignore_i, &ignore_i, &ignore_ui);
547
548 test_x = root_x - (win_w / 2);
549 test_y = root_y - (win_h / 2);
550
551 min_x = (int) screen.getMaxLeft();
552 min_y = (int) screen.getMaxTop();
553 max_x = (int) screen.getMaxRight() - win_w;
554 max_y = (int) screen.getMaxBottom() - win_h;
555
556 // keep the window inside the screen
557
558 if (test_x < min_x)
559 test_x = min_x;
560
561 if (test_x > max_x)
562 test_x = max_x;
563
564 if (test_y < min_y)
565 test_y = min_y;
566
567 if (test_y > max_y)
568 test_y = max_y;
569
570 place_x = test_x;
571 place_y = test_y;
572
573 placed = true;
574
575 break;
576 } // end case UNDERMOUSEPLACEMENT
577
538 case BScreen::ROWSMARTPLACEMENT: { 578 case BScreen::ROWSMARTPLACEMENT: {
539 579
540 test_y = 0; 580 test_y = 0;
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index d2dc234..0a29fb1 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.115 2003/04/20 12:21:35 rathnor Exp $ 25// $Id: fluxbox.cc,v 1.116 2003/04/25 09:07:14 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -1776,6 +1776,10 @@ void Fluxbox::save_rc() {
1776 placement = "ColSmartPlacement"; 1776 placement = "ColSmartPlacement";
1777 break; 1777 break;
1778 1778
1779 case BScreen::UNDERMOUSEPLACEMENT:
1780 placement = "UnderMousePlacement";
1781 break;
1782
1779 default: 1783 default:
1780 case BScreen::ROWSMARTPLACEMENT: 1784 case BScreen::ROWSMARTPLACEMENT:
1781 placement = "RowSmartPlacement"; 1785 placement = "RowSmartPlacement";
@@ -2021,6 +2025,8 @@ void Fluxbox::load_rc(BScreen &screen) {
2021 screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); 2025 screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
2022 else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size)) 2026 else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size))
2023 screen.savePlacementPolicy(BScreen::COLSMARTPLACEMENT); 2027 screen.savePlacementPolicy(BScreen::COLSMARTPLACEMENT);
2028 else if (! strncasecmp(value.addr, "UnderMousePlacement", value.size))
2029 screen.savePlacementPolicy(BScreen::UNDERMOUSEPLACEMENT);
2024 else 2030 else
2025 screen.savePlacementPolicy(BScreen::CASCADEPLACEMENT); 2031 screen.savePlacementPolicy(BScreen::CASCADEPLACEMENT);
2026 } else 2032 } else