aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-03-31 11:31:21 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-04-06 19:54:26 (GMT)
commit2e8766174eaa11e7f370ba5927ed38e18efced11 (patch)
tree896956198cb9c89643e17fab9a09c62304db8486 /src
parent53de872163d61c87fa8128767ebbc218599f3835 (diff)
downloadfluxbox-2e8766174eaa11e7f370ba5927ed38e18efced11.zip
fluxbox-2e8766174eaa11e7f370ba5927ed38e18efced11.tar.bz2
place transient centered on its parent
so far, transients are simply unplaced, resulting in a static 0,0 position.
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 9129e7d..109b522 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -461,8 +461,7 @@ void FluxboxWindow::init() {
461 461
462 if (fluxbox.isStartup()) 462 if (fluxbox.isStartup())
463 m_placed = true; 463 m_placed = true;
464 else if (m_client->isTransient() || 464 else if (m_client->normal_hint_flags & (PPosition|USPosition)) {
465 m_client->normal_hint_flags & (PPosition|USPosition)) {
466 m_placed = is_visible; 465 m_placed = is_visible;
467 } else { 466 } else {
468 if (!is_visible) { 467 if (!is_visible) {
@@ -484,12 +483,20 @@ void FluxboxWindow::init() {
484 if (m_workspace_number >= screen().numberOfWorkspaces()) 483 if (m_workspace_number >= screen().numberOfWorkspaces())
485 m_workspace_number = screen().currentWorkspaceID(); 484 m_workspace_number = screen().currentWorkspaceID();
486 485
486 unsigned int real_width = frame().width();
487 unsigned int real_height = frame().height();
488 frame().applySizeHints(real_width, real_height);
489
487 // if we're a transient then we should be on the same layer and workspace 490 // if we're a transient then we should be on the same layer and workspace
488 FluxboxWindow* twin = m_client->transientFor() ? m_client->transientFor()->fbwindow() : 0; 491 FluxboxWindow* twin = m_client->transientFor() ? m_client->transientFor()->fbwindow() : 0;
489 if (twin && twin != this) { 492 if (twin && twin != this) {
490 layerItem().setLayer(twin->layerItem().getLayer()); 493 layerItem().setLayer(twin->layerItem().getLayer());
491 m_state.layernum = twin->layerNum(); 494 m_state.layernum = twin->layerNum();
492 m_workspace_number = twin->workspaceNumber(); 495 m_workspace_number = twin->workspaceNumber();
496 const int x = twin->frame().x() + (twin->frame().width() - frame().width())/2;
497 const int y = twin->frame().y() + (twin->frame().height() - frame().height())/2;
498 frame().move(x, y);
499 m_placed = true;
493 } else // if no parent then set default layer 500 } else // if no parent then set default layer
494 moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL); 501 moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL);
495 502
@@ -500,10 +507,6 @@ void FluxboxWindow::init() {
500 twin->title().logical()<<endl; 507 twin->title().logical()<<endl;
501 } 508 }
502 509
503 unsigned int real_width = frame().width();
504 unsigned int real_height = frame().height();
505 frame().applySizeHints(real_width, real_height);
506
507 screen().getWorkspace(m_workspace_number)->addWindow(*this); 510 screen().getWorkspace(m_workspace_number)->addWindow(*this);
508 if (m_placed) 511 if (m_placed)
509 moveResize(frame().x(), frame().y(), real_width, real_height); 512 moveResize(frame().x(), frame().y(), real_width, real_height);