Changeset View
Changeset View
Standalone View
Standalone View
abstract_client.cpp
Show First 20 Lines • Show All 1275 Lines • ▼ Show 20 Line(s) | |||||
1276 | } | 1276 | } | ||
1277 | 1277 | | |||
1278 | void AbstractClient::doResizeSync() | 1278 | void AbstractClient::doResizeSync() | ||
1279 | { | 1279 | { | ||
1280 | } | 1280 | } | ||
1281 | 1281 | | |||
1282 | void AbstractClient::checkQuickTilingMaximizationZones(int xroot, int yroot) | 1282 | void AbstractClient::checkQuickTilingMaximizationZones(int xroot, int yroot) | ||
1283 | { | 1283 | { | ||
1284 | QuickTileMode mode = QuickTileNone; | 1284 | QuickTileMode mode = QuickTileFlag::None; | ||
1285 | bool innerBorder = false; | 1285 | bool innerBorder = false; | ||
1286 | for (int i=0; i < screens()->count(); ++i) { | 1286 | for (int i=0; i < screens()->count(); ++i) { | ||
1287 | 1287 | | |||
1288 | if (!screens()->geometry(i).contains(QPoint(xroot, yroot))) | 1288 | if (!screens()->geometry(i).contains(QPoint(xroot, yroot))) | ||
1289 | continue; | 1289 | continue; | ||
1290 | 1290 | | |||
1291 | auto isInScreen = [i](const QPoint &pt) { | 1291 | auto isInScreen = [i](const QPoint &pt) { | ||
1292 | for (int j = 0; j < screens()->count(); ++j) { | 1292 | for (int j = 0; j < screens()->count(); ++j) { | ||
1293 | if (j == i) | 1293 | if (j == i) | ||
1294 | continue; | 1294 | continue; | ||
1295 | if (screens()->geometry(j).contains(pt)) { | 1295 | if (screens()->geometry(j).contains(pt)) { | ||
1296 | return true; | 1296 | return true; | ||
1297 | } | 1297 | } | ||
1298 | } | 1298 | } | ||
1299 | return false; | 1299 | return false; | ||
1300 | }; | 1300 | }; | ||
1301 | 1301 | | |||
1302 | QRect area = workspace()->clientArea(MaximizeArea, QPoint(xroot, yroot), desktop()); | 1302 | QRect area = workspace()->clientArea(MaximizeArea, QPoint(xroot, yroot), desktop()); | ||
1303 | if (options->electricBorderTiling()) { | 1303 | if (options->electricBorderTiling()) { | ||
1304 | if (xroot <= area.x() + 20) { | 1304 | if (xroot <= area.x() + 20) { | ||
1305 | mode |= QuickTileLeft; | 1305 | mode |= QuickTileFlag::Left; | ||
1306 | innerBorder = isInScreen(QPoint(area.x() - 1, yroot)); | 1306 | innerBorder = isInScreen(QPoint(area.x() - 1, yroot)); | ||
1307 | } else if (xroot >= area.x() + area.width() - 20) { | 1307 | } else if (xroot >= area.x() + area.width() - 20) { | ||
1308 | mode |= QuickTileRight; | 1308 | mode |= QuickTileFlag::Right; | ||
1309 | innerBorder = isInScreen(QPoint(area.right() + 1, yroot)); | 1309 | innerBorder = isInScreen(QPoint(area.right() + 1, yroot)); | ||
1310 | } | 1310 | } | ||
1311 | } | 1311 | } | ||
1312 | 1312 | | |||
1313 | if (mode != QuickTileNone) { | 1313 | if (mode != QuickTileMode(QuickTileFlag::None)) { | ||
1314 | if (yroot <= area.y() + area.height() * options->electricBorderCornerRatio()) | 1314 | if (yroot <= area.y() + area.height() * options->electricBorderCornerRatio()) | ||
1315 | mode |= QuickTileTop; | 1315 | mode |= QuickTileFlag::Top; | ||
1316 | else if (yroot >= area.y() + area.height() - area.height() * options->electricBorderCornerRatio()) | 1316 | else if (yroot >= area.y() + area.height() - area.height() * options->electricBorderCornerRatio()) | ||
1317 | mode |= QuickTileBottom; | 1317 | mode |= QuickTileFlag::Bottom; | ||
1318 | } else if (options->electricBorderMaximize() && yroot <= area.y() + 5 && isMaximizable()) { | 1318 | } else if (options->electricBorderMaximize() && yroot <= area.y() + 5 && isMaximizable()) { | ||
1319 | mode = QuickTileMaximize; | 1319 | mode = QuickTileFlag::Maximize; | ||
1320 | innerBorder = isInScreen(QPoint(xroot, area.y() - 1)); | 1320 | innerBorder = isInScreen(QPoint(xroot, area.y() - 1)); | ||
1321 | } | 1321 | } | ||
1322 | break; // no point in checking other screens to contain this... "point"... | 1322 | break; // no point in checking other screens to contain this... "point"... | ||
1323 | } | 1323 | } | ||
1324 | if (mode != electricBorderMode()) { | 1324 | if (mode != electricBorderMode()) { | ||
1325 | setElectricBorderMode(mode); | 1325 | setElectricBorderMode(mode); | ||
1326 | if (innerBorder) { | 1326 | if (innerBorder) { | ||
1327 | if (!m_electricMaximizingDelay) { | 1327 | if (!m_electricMaximizingDelay) { | ||
1328 | m_electricMaximizingDelay = new QTimer(this); | 1328 | m_electricMaximizingDelay = new QTimer(this); | ||
1329 | m_electricMaximizingDelay->setInterval(250); | 1329 | m_electricMaximizingDelay->setInterval(250); | ||
1330 | m_electricMaximizingDelay->setSingleShot(true); | 1330 | m_electricMaximizingDelay->setSingleShot(true); | ||
1331 | connect(m_electricMaximizingDelay, &QTimer::timeout, [this]() { | 1331 | connect(m_electricMaximizingDelay, &QTimer::timeout, [this]() { | ||
1332 | if (isMove()) | 1332 | if (isMove()) | ||
1333 | setElectricBorderMaximizing(electricBorderMode() != QuickTileNone); | 1333 | setElectricBorderMaximizing(electricBorderMode() != QuickTileMode(QuickTileFlag::None)); | ||
1334 | }); | 1334 | }); | ||
1335 | } | 1335 | } | ||
1336 | m_electricMaximizingDelay->start(); | 1336 | m_electricMaximizingDelay->start(); | ||
1337 | } else { | 1337 | } else { | ||
1338 | setElectricBorderMaximizing(mode != QuickTileNone); | 1338 | setElectricBorderMaximizing(mode != QuickTileMode(QuickTileFlag::None)); | ||
1339 | } | 1339 | } | ||
1340 | } | 1340 | } | ||
1341 | } | 1341 | } | ||
1342 | 1342 | | |||
1343 | void AbstractClient::keyPressEvent(uint key_code) | 1343 | void AbstractClient::keyPressEvent(uint key_code) | ||
1344 | { | 1344 | { | ||
1345 | if (!isMove() && !isResize()) | 1345 | if (!isMove() && !isResize()) | ||
1346 | return; | 1346 | return; | ||
▲ Show 20 Lines • Show All 407 Lines • Show Last 20 Lines |