Changeset View
Changeset View
Standalone View
Standalone View
useractions.cpp
Show First 20 Lines • Show All 1046 Lines • ▼ Show 20 Line(s) | 1026 | { | |||
---|---|---|---|---|---|
1047 | } | 1047 | } | ||
1048 | } | 1048 | } | ||
1049 | 1049 | | |||
1050 | void Workspace::performWindowOperation(AbstractClient* c, Options::WindowOperation op) | 1050 | void Workspace::performWindowOperation(AbstractClient* c, Options::WindowOperation op) | ||
1051 | { | 1051 | { | ||
1052 | if (!c) | 1052 | if (!c) | ||
1053 | return; | 1053 | return; | ||
1054 | if (op == Options::MoveOp || op == Options::UnrestrictedMoveOp) | 1054 | if (op == Options::MoveOp || op == Options::UnrestrictedMoveOp) | ||
1055 | Cursor::setPos(c->geometry().center()); | 1055 | Cursor::setPos(c->frameGeometry().center()); | ||
1056 | if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp) | 1056 | if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp) | ||
1057 | Cursor::setPos(c->geometry().bottomRight()); | 1057 | Cursor::setPos(c->frameGeometry().bottomRight()); | ||
1058 | switch(op) { | 1058 | switch(op) { | ||
1059 | case Options::MoveOp: | 1059 | case Options::MoveOp: | ||
1060 | c->performMouseCommand(Options::MouseMove, Cursor::pos()); | 1060 | c->performMouseCommand(Options::MouseMove, Cursor::pos()); | ||
1061 | break; | 1061 | break; | ||
1062 | case Options::UnrestrictedMoveOp: | 1062 | case Options::UnrestrictedMoveOp: | ||
1063 | c->performMouseCommand(Options::MouseUnrestrictedMove, Cursor::pos()); | 1063 | c->performMouseCommand(Options::MouseUnrestrictedMove, Cursor::pos()); | ||
1064 | break; | 1064 | break; | ||
1065 | case Options::ResizeOp: | 1065 | case Options::ResizeOp: | ||
▲ Show 20 Lines • Show All 439 Lines • ▼ Show 20 Line(s) | |||||
1505 | void Workspace::switchWindow(Direction direction) | 1505 | void Workspace::switchWindow(Direction direction) | ||
1506 | { | 1506 | { | ||
1507 | if (!active_client) | 1507 | if (!active_client) | ||
1508 | return; | 1508 | return; | ||
1509 | AbstractClient *c = active_client; | 1509 | AbstractClient *c = active_client; | ||
1510 | int desktopNumber = c->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : c->desktop(); | 1510 | int desktopNumber = c->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : c->desktop(); | ||
1511 | 1511 | | |||
1512 | // Centre of the active window | 1512 | // Centre of the active window | ||
1513 | QPoint curPos(c->pos().x() + c->geometry().width() / 2, | 1513 | QPoint curPos(c->x() + c->width() / 2, c->y() + c->height() / 2); | ||
1514 | c->pos().y() + c->geometry().height() / 2); | | |||
1515 | 1514 | | |||
1516 | if (!switchWindow(c, direction, curPos, desktopNumber)) { | 1515 | if (!switchWindow(c, direction, curPos, desktopNumber)) { | ||
1517 | auto opposite = [&] { | 1516 | auto opposite = [&] { | ||
1518 | switch(direction) { | 1517 | switch(direction) { | ||
1519 | case DirectionNorth: | 1518 | case DirectionNorth: | ||
1520 | return QPoint(curPos.x(), screens()->geometry().height()); | 1519 | return QPoint(curPos.x(), screens()->geometry().height()); | ||
1521 | case DirectionSouth: | 1520 | case DirectionSouth: | ||
1522 | return QPoint(curPos.x(), 0); | 1521 | return QPoint(curPos.x(), 0); | ||
Show All 19 Lines | 1536 | { | |||
1542 | for (auto i = clist.rbegin(); i != clist.rend(); ++i) { | 1541 | for (auto i = clist.rbegin(); i != clist.rend(); ++i) { | ||
1543 | auto client = qobject_cast<AbstractClient*>(*i); | 1542 | auto client = qobject_cast<AbstractClient*>(*i); | ||
1544 | if (!client) { | 1543 | if (!client) { | ||
1545 | continue; | 1544 | continue; | ||
1546 | } | 1545 | } | ||
1547 | if (client->wantsTabFocus() && *i != c && | 1546 | if (client->wantsTabFocus() && *i != c && | ||
1548 | client->isOnDesktop(d) && !client->isMinimized() && (*i)->isOnCurrentActivity()) { | 1547 | client->isOnDesktop(d) && !client->isMinimized() && (*i)->isOnCurrentActivity()) { | ||
1549 | // Centre of the other window | 1548 | // Centre of the other window | ||
1550 | QPoint other(client->pos().x() + client->geometry().width() / 2, | 1549 | const QPoint other(client->x() + client->width() / 2, client->y() + client->height() / 2); | ||
1551 | client->pos().y() + client->geometry().height() / 2); | | |||
1552 | 1550 | | |||
1553 | int distance; | 1551 | int distance; | ||
1554 | int offset; | 1552 | int offset; | ||
1555 | switch(direction) { | 1553 | switch(direction) { | ||
1556 | case DirectionNorth: | 1554 | case DirectionNorth: | ||
1557 | distance = curPos.y() - other.y(); | 1555 | distance = curPos.y() - other.y(); | ||
1558 | offset = qAbs(other.x() - curPos.x()); | 1556 | offset = qAbs(other.x() - curPos.x()); | ||
1559 | break; | 1557 | break; | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
1604 | 1602 | | |||
1605 | void Workspace::showWindowMenu(const QRect &pos, AbstractClient* cl) | 1603 | void Workspace::showWindowMenu(const QRect &pos, AbstractClient* cl) | ||
1606 | { | 1604 | { | ||
1607 | m_userActionsMenu->show(pos, cl); | 1605 | m_userActionsMenu->show(pos, cl); | ||
1608 | } | 1606 | } | ||
1609 | 1607 | | |||
1610 | void Workspace::showApplicationMenu(const QRect &pos, AbstractClient *c, int actionId) | 1608 | void Workspace::showApplicationMenu(const QRect &pos, AbstractClient *c, int actionId) | ||
1611 | { | 1609 | { | ||
1612 | ApplicationMenu::self()->showApplicationMenu(c->geometry().topLeft() + pos.bottomLeft(), c, actionId); | 1610 | ApplicationMenu::self()->showApplicationMenu(c->pos() + pos.bottomLeft(), c, actionId); | ||
1613 | } | 1611 | } | ||
1614 | 1612 | | |||
1615 | /** | 1613 | /** | ||
1616 | * Closes the active client. | 1614 | * Closes the active client. | ||
1617 | */ | 1615 | */ | ||
1618 | void Workspace::slotWindowClose() | 1616 | void Workspace::slotWindowClose() | ||
1619 | { | 1617 | { | ||
1620 | // TODO: why? | 1618 | // TODO: why? | ||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |