Changeset View
Changeset View
Standalone View
Standalone View
placement.cpp
Show All 28 Lines | |||||
29 | #include "options.h" | 29 | #include "options.h" | ||
30 | #include "rules.h" | 30 | #include "rules.h" | ||
31 | #include "screens.h" | 31 | #include "screens.h" | ||
32 | #endif | 32 | #endif | ||
33 | 33 | | |||
34 | #include <QRect> | 34 | #include <QRect> | ||
35 | #include <QTextStream> | 35 | #include <QTextStream> | ||
36 | 36 | | |||
37 | #include <cmath> | ||||
zzag: Unused include, remove it? | |||||
38 | | ||||
37 | namespace KWin | 39 | namespace KWin | ||
38 | { | 40 | { | ||
39 | 41 | | |||
40 | #ifndef KCMRULES | 42 | #ifndef KCMRULES | ||
41 | 43 | | |||
42 | KWIN_SINGLETON_FACTORY(Placement) | 44 | KWIN_SINGLETON_FACTORY(Placement) | ||
43 | 45 | | |||
44 | Placement::Placement(QObject*) | 46 | Placement::Placement(QObject*) | ||
▲ Show 20 Lines • Show All 451 Lines • ▼ Show 20 Line(s) | 497 | // top-right corner | |||
496 | // use the default placement for now | 498 | // use the default placement for now | ||
497 | place(c, area, Default); | 499 | place(c, area, Default); | ||
498 | } | 500 | } | ||
499 | 501 | | |||
500 | void Placement::placeOnScreenDisplay(AbstractClient *c, const QRect &area) | 502 | void Placement::placeOnScreenDisplay(AbstractClient *c, const QRect &area) | ||
501 | { | 503 | { | ||
502 | Q_ASSERT(area.isValid()); | 504 | Q_ASSERT(area.isValid()); | ||
503 | 505 | | |||
504 | // place at lower 1/3 of the screen | 506 | // place at lower area of the screen | ||
505 | const int x = area.left() + (area.width() - c->width()) / 2; | 507 | const int x = area.left() + (area.width() - c->width()) / 2; | ||
506 | const int y = area.top() + 2 * (area.height() - c->height()) / 3; | 508 | const int y = area.top() + 2 * area.height() / 3 - c->height() / 2; | ||
ndavis: why 0.37? | |||||
Existing magic number used for positioning is replaced with a different one to adjust the position. ngraham: Existing magic number used for positioning is replaced with a different one to adjust the… | |||||
507 | 509 | | |||
508 | c->move(QPoint(x, y)); | 510 | c->move(QPoint(x, y)); | ||
509 | } | 511 | } | ||
510 | 512 | | |||
511 | void Placement::placeTransient(AbstractClient *c) | 513 | void Placement::placeTransient(AbstractClient *c) | ||
512 | { | 514 | { | ||
513 | const auto parent = c->transientFor(); | 515 | const auto parent = c->transientFor(); | ||
514 | const QRect screen = Workspace::self()->clientArea(parent->isFullScreen() ? FullScreenArea : PlacementArea, parent); | 516 | const QRect screen = Workspace::self()->clientArea(parent->isFullScreen() ? FullScreenArea : PlacementArea, parent); | ||
▲ Show 20 Lines • Show All 463 Lines • Show Last 20 Lines |
Unused include, remove it?