Only reserve required electric borders for ElectricAlways
CCBUG: 293011 REVIEW: 104073
This commit is contained in:
parent
766bc27940
commit
3a6095726e
10 changed files with 70 additions and 22 deletions
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
|
||||
#include "workspace.h"
|
||||
#include "options.h"
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
|
@ -27,6 +28,11 @@ namespace KWin
|
|||
|
||||
void Workspace::updateDesktopLayout()
|
||||
{
|
||||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
if (options->electricBorders() == Options::ElectricAlways) {
|
||||
m_screenEdge.reserveDesktopSwitching(false, m_screenEdgeOrientation);
|
||||
}
|
||||
#endif
|
||||
// TODO: Is there a sane way to avoid overriding the existing grid?
|
||||
int width = rootInfo->desktopLayoutColumnsRows().width();
|
||||
int height = rootInfo->desktopLayoutColumnsRows().height();
|
||||
|
@ -36,6 +42,17 @@ void Workspace::updateDesktopLayout()
|
|||
rootInfo->desktopLayoutOrientation() == NET::OrientationHorizontal ? Qt::Horizontal : Qt::Vertical,
|
||||
width, height, 0 //rootInfo->desktopLayoutCorner() // Not really worth implementing right now.
|
||||
);
|
||||
|
||||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
m_screenEdgeOrientation = 0;
|
||||
if (width > 1)
|
||||
m_screenEdgeOrientation |= Qt::Horizontal;
|
||||
if (height > 1)
|
||||
m_screenEdgeOrientation |= Qt::Vertical;
|
||||
if (options->electricBorders() == Options::ElectricAlways) {
|
||||
m_screenEdge.reserveDesktopSwitching(true, m_screenEdgeOrientation);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Workspace::setNETDesktopLayout(Qt::Orientation orientation, int width, int height,
|
||||
|
|
|
@ -1075,10 +1075,10 @@ void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border)
|
|||
#endif
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve)
|
||||
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve, Qt::Orientations o)
|
||||
{
|
||||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
Workspace::self()->screenEdge()->reserveDesktopSwitching(reserve);
|
||||
Workspace::self()->screenEdge()->reserveDesktopSwitching(reserve, o);
|
||||
#else
|
||||
Q_UNUSED(reserve)
|
||||
#endif
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
virtual void checkElectricBorder(const QPoint &pos, Time time);
|
||||
virtual void reserveElectricBorder(ElectricBorder border);
|
||||
virtual void unreserveElectricBorder(ElectricBorder border);
|
||||
virtual void reserveElectricBorderSwitching(bool reserve);
|
||||
virtual void reserveElectricBorderSwitching(bool reserve, Qt::Orientations o);
|
||||
|
||||
virtual unsigned long xrenderBufferPicture();
|
||||
virtual void reconfigure();
|
||||
|
|
|
@ -2564,7 +2564,7 @@ bool Client::startMoveResize()
|
|||
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
||||
options->electricBorderMaximize() ||
|
||||
options->electricBorderTiling())
|
||||
workspace()->screenEdge()->reserveDesktopSwitching(true);
|
||||
workspace()->screenEdge()->reserveDesktopSwitching(true, Qt::Vertical|Qt::Horizontal);
|
||||
#endif
|
||||
if (fakeMove) // fix geom_restore position - it HAS to happen at the end, ie. when all moving is set up. inline call will lock focus!!
|
||||
handleMoveResize(QCursor::pos().x(), QCursor::pos().y(), QCursor::pos().x(), QCursor::pos().y());
|
||||
|
@ -2677,7 +2677,7 @@ void Client::leaveMoveResize()
|
|||
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
||||
options->electricBorderMaximize() ||
|
||||
options->electricBorderTiling())
|
||||
workspace()->screenEdge()->reserveDesktopSwitching(false);
|
||||
workspace()->screenEdge()->reserveDesktopSwitching(false, Qt::Vertical|Qt::Horizontal);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ X-KDE-Library=kwin4_effect_cooleffect
|
|||
|
||||
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
||||
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 182
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 183
|
||||
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
||||
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
||||
|
||||
|
@ -645,7 +645,7 @@ public:
|
|||
virtual void checkElectricBorder(const QPoint &pos, Time time) = 0;
|
||||
virtual void reserveElectricBorder(ElectricBorder border) = 0;
|
||||
virtual void unreserveElectricBorder(ElectricBorder border) = 0;
|
||||
virtual void reserveElectricBorderSwitching(bool reserve) = 0;
|
||||
virtual void reserveElectricBorderSwitching(bool reserve, Qt::Orientations o) = 0;
|
||||
|
||||
// functions that allow controlling windows/desktop
|
||||
virtual void activateWindow(KWin::EffectWindow* c) = 0;
|
||||
|
|
|
@ -583,8 +583,7 @@ WindowQuadList Scene::Window::buildQuads(bool force) const
|
|||
Client *client = dynamic_cast<Client*>(toplevel);
|
||||
QRegion contents = clientShape();
|
||||
QRegion center = toplevel->transparentRect();
|
||||
QRegion decoration = (client && Workspace::self()->decorationHasAlpha() ?
|
||||
QRegion(client->decorationRect()) : shape()) - center;
|
||||
QRegion decoration = shape() - center;
|
||||
ret = makeQuads(WindowQuadContents, contents);
|
||||
if (!client || !(center.isEmpty() || client->isShade()))
|
||||
ret += makeQuads(WindowQuadDecoration, decoration);
|
||||
|
|
|
@ -58,9 +58,6 @@ ScreenEdge::~ScreenEdge()
|
|||
void ScreenEdge::init()
|
||||
{
|
||||
reserveActions(true);
|
||||
if (options->electricBorders() == Options::ElectricAlways) {
|
||||
reserveDesktopSwitching(true);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -143,13 +140,39 @@ void ScreenEdge::reserveActions(bool isToReserve)
|
|||
}
|
||||
}
|
||||
|
||||
void ScreenEdge::reserveDesktopSwitching(bool isToReserve)
|
||||
void ScreenEdge::reserveDesktopSwitching(bool isToReserve, Qt::Orientations o)
|
||||
{
|
||||
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos)
|
||||
if (isToReserve)
|
||||
reserve(static_cast<ElectricBorder>(pos));
|
||||
else
|
||||
unreserve(static_cast<ElectricBorder>(pos));
|
||||
if (!o)
|
||||
return;
|
||||
if (isToReserve) {
|
||||
reserve(ElectricTopLeft);
|
||||
reserve(ElectricTopRight);
|
||||
reserve(ElectricBottomRight);
|
||||
reserve(ElectricBottomLeft);
|
||||
|
||||
if (o & Qt::Horizontal) {
|
||||
reserve(ElectricLeft);
|
||||
reserve(ElectricRight);
|
||||
}
|
||||
if (o & Qt::Vertical) {
|
||||
reserve(ElectricTop);
|
||||
reserve(ElectricBottom);
|
||||
}
|
||||
} else {
|
||||
unreserve(ElectricTopLeft);
|
||||
unreserve(ElectricTopRight);
|
||||
unreserve(ElectricBottomRight);
|
||||
unreserve(ElectricBottomLeft);
|
||||
|
||||
if (o & Qt::Horizontal) {
|
||||
unreserve(ElectricLeft);
|
||||
unreserve(ElectricRight);
|
||||
}
|
||||
if (o & Qt::Vertical) {
|
||||
unreserve(ElectricTop);
|
||||
unreserve(ElectricBottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenEdge::reserve(ElectricBorder border)
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
* Reserve desktop switching for screen edges, if reserve is true. Unreserve otherwise.
|
||||
* @param reserve indicated weather desktop switching should be reserved or unreseved
|
||||
*/
|
||||
void reserveDesktopSwitching(bool isToReserve);
|
||||
void reserveDesktopSwitching(bool isToReserve, Qt::Orientations o);
|
||||
/**
|
||||
* Raise electric border windows to the real top of the screen. We only need
|
||||
* to do this if an effect input window is active.
|
||||
|
|
|
@ -107,6 +107,7 @@ Workspace::Workspace(bool restore)
|
|||
, desktopGridSize_(1, 2) // Default to two rows
|
||||
, desktopGrid_(new int[2])
|
||||
, currentDesktop_(0)
|
||||
, m_screenEdgeOrientation(0)
|
||||
// Unsorted
|
||||
, active_popup(NULL)
|
||||
, active_popup_client(NULL)
|
||||
|
@ -958,7 +959,7 @@ void Workspace::slotReconfigure()
|
|||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
m_screenEdge.reserveActions(false);
|
||||
if (options->electricBorders() == Options::ElectricAlways)
|
||||
m_screenEdge.reserveDesktopSwitching(false);
|
||||
m_screenEdge.reserveDesktopSwitching(false, m_screenEdgeOrientation);
|
||||
#endif
|
||||
|
||||
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
|
||||
|
@ -996,8 +997,15 @@ void Workspace::slotReconfigure()
|
|||
|
||||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
m_screenEdge.reserveActions(true);
|
||||
if (options->electricBorders() == Options::ElectricAlways)
|
||||
m_screenEdge.reserveDesktopSwitching(true);
|
||||
if (options->electricBorders() == Options::ElectricAlways) {
|
||||
QSize desktopMatrix = rootInfo->desktopLayoutColumnsRows();
|
||||
m_screenEdgeOrientation = 0;
|
||||
if (desktopMatrix.width() > 1)
|
||||
m_screenEdgeOrientation |= Qt::Horizontal;
|
||||
if (desktopMatrix.height() > 1)
|
||||
m_screenEdgeOrientation |= Qt::Vertical;
|
||||
m_screenEdge.reserveDesktopSwitching(true, m_screenEdgeOrientation);
|
||||
}
|
||||
m_screenEdge.update();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -318,6 +318,7 @@ private:
|
|||
Outline* m_outline;
|
||||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
ScreenEdge m_screenEdge;
|
||||
Qt::Orientations m_screenEdgeOrientation;
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue