diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d6c7c4263..9a527330ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,7 @@ set(kwin_KDEINIT_SRCS
tabbox/tabboxview.cpp
desktopchangeosd.cpp
options.cpp
+ outline.cpp
plugins.cpp
events.cpp
killwindow.cpp
diff --git a/geometry.cpp b/geometry.cpp
index 7dee292085..1c747ed29d 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -47,6 +47,7 @@ along with this program. If not, see .
#include
#include
+#include "outline.h"
namespace KWin
{
@@ -2683,7 +2684,7 @@ void Client::finishMoveResize(bool cancel)
else
workspace()->restoreElectricBorderSize(border);
electricMaximizing = false;
- workspace()->hideElectricBorderWindowOutline();
+ workspace()->outline()->hide();
}
// FRAME update();
@@ -3114,9 +3115,9 @@ void Client::setElectricBorderMaximizing(bool maximizing)
{
electricMaximizing = maximizing;
if (maximizing)
- workspace()->showElectricBorderWindowOutline();
+ workspace()->outline()->show(electricBorderMaximizeGeometry(cursorPos(), desktop()));
else
- workspace()->hideElectricBorderWindowOutline();
+ workspace()->outline()->hide();
}
QRect Client::electricBorderMaximizeGeometry(QPoint pos, int desktop)
diff --git a/outline.cpp b/outline.cpp
new file mode 100644
index 0000000000..9b5581c436
--- /dev/null
+++ b/outline.cpp
@@ -0,0 +1,172 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2011 Arthur Arlt
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+
+#include "outline.h"
+#include
+#include
+#include
+#include
+
+namespace KWin {
+
+Outline::Outline()
+ : m_initialized(false)
+{
+}
+
+Outline::~Outline()
+{
+ if (m_initialized) {
+ XDestroyWindow(QX11Info::display(), m_leftOutline);
+ XDestroyWindow(QX11Info::display(), m_rightOutline);
+ XDestroyWindow(QX11Info::display(), m_topOutline);
+ XDestroyWindow(QX11Info::display(), m_bottomOutline);
+ }
+}
+
+void Outline::show()
+{
+ showWithX();
+}
+
+void Outline::hide()
+{
+ hideWithX();
+}
+
+void Outline::show(const QRect& outlineGeometry)
+{
+ setGeometry(outlineGeometry);
+ show();
+}
+
+void Outline::setGeometry(const QRect& outlineGeometry)
+{
+ m_outlineGeometry = outlineGeometry;
+}
+
+QVector< Window > Outline::windowIds() const
+{
+ QVector windows;
+ if (m_initialized) {
+ windows.reserve(4);
+ windows << m_leftOutline << m_topOutline << m_rightOutline << m_bottomOutline;
+ }
+ return windows;
+}
+
+void Outline::showWithX()
+{
+ if (!m_initialized) {
+ XSetWindowAttributes attr;
+ attr.override_redirect = 1;
+ m_leftOutline = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr);
+ m_rightOutline = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr);
+ m_topOutline = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr);
+ m_bottomOutline = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr);
+ m_initialized = true;
+ }
+// left/right parts are between top/bottom, they don't reach as far as the corners
+ XMoveResizeWindow(QX11Info::display(), m_leftOutline, m_outlineGeometry.x(), m_outlineGeometry.y() + 5, 5, m_outlineGeometry.height() - 10);
+ XMoveResizeWindow(QX11Info::display(), m_rightOutline, m_outlineGeometry.x() + m_outlineGeometry.width() - 5, m_outlineGeometry.y() + 5, 5, m_outlineGeometry.height() - 10);
+ XMoveResizeWindow(QX11Info::display(), m_topOutline, m_outlineGeometry.x(), m_outlineGeometry.y(), m_outlineGeometry.width(), 5);
+ XMoveResizeWindow(QX11Info::display(), m_bottomOutline, m_outlineGeometry.x(), m_outlineGeometry.y() + m_outlineGeometry.height() - 5, m_outlineGeometry.width(), 5);
+ {
+ QPixmap pix(5, m_outlineGeometry.height() - 10);
+ QPainter p(&pix);
+ p.setPen(Qt::white);
+ p.drawLine(0, 0, 0, pix.height() - 1);
+ p.drawLine(4, 0, 4, pix.height() - 1);
+ p.setPen(Qt::gray);
+ p.drawLine(1, 0, 1, pix.height() - 1);
+ p.drawLine(3, 0, 3, pix.height() - 1);
+ p.setPen(Qt::black);
+ p.drawLine(2, 0, 2, pix.height() - 1);
+ p.end();
+ XSetWindowBackgroundPixmap(QX11Info::display(), m_leftOutline, pix.handle());
+ XSetWindowBackgroundPixmap(QX11Info::display(), m_rightOutline, pix.handle());
+ }
+ {
+ QPixmap pix(m_outlineGeometry.width(), 5);
+ QPainter p(&pix);
+ p.setPen(Qt::white);
+ p.drawLine(0, 0, pix.width() - 1 - 0, 0);
+ p.drawLine(4, 4, pix.width() - 1 - 4, 4);
+ p.drawLine(0, 0, 0, 4);
+ p.drawLine(pix.width() - 1 - 0, 0, pix.width() - 1 - 0, 4);
+ p.setPen(Qt::gray);
+ p.drawLine(1, 1, pix.width() - 1 - 1, 1);
+ p.drawLine(3, 3, pix.width() - 1 - 3, 3);
+ p.drawLine(1, 1, 1, 4);
+ p.drawLine(3, 3, 3, 4);
+ p.drawLine(pix.width() - 1 - 1, 1, pix.width() - 1 - 1, 4);
+ p.drawLine(pix.width() - 1 - 3, 3, pix.width() - 1 - 3, 4);
+ p.setPen(Qt::black);
+ p.drawLine(2, 2, pix.width() - 1 - 2, 2);
+ p.drawLine(2, 2, 2, 4);
+ p.drawLine(pix.width() - 1 - 2, 2, pix.width() - 1 - 2, 4);
+ p.end();
+ XSetWindowBackgroundPixmap(QX11Info::display(), m_topOutline, pix.handle());
+ }
+ {
+ QPixmap pix(m_outlineGeometry.width(), 5);
+ QPainter p(&pix);
+ p.setPen(Qt::white);
+ p.drawLine(4, 0, pix.width() - 1 - 4, 0);
+ p.drawLine(0, 4, pix.width() - 1 - 0, 4);
+ p.drawLine(0, 4, 0, 0);
+ p.drawLine(pix.width() - 1 - 0, 4, pix.width() - 1 - 0, 0);
+ p.setPen(Qt::gray);
+ p.drawLine(3, 1, pix.width() - 1 - 3, 1);
+ p.drawLine(1, 3, pix.width() - 1 - 1, 3);
+ p.drawLine(3, 1, 3, 0);
+ p.drawLine(1, 3, 1, 0);
+ p.drawLine(pix.width() - 1 - 3, 1, pix.width() - 1 - 3, 0);
+ p.drawLine(pix.width() - 1 - 1, 3, pix.width() - 1 - 1, 0);
+ p.setPen(Qt::black);
+ p.drawLine(2, 2, pix.width() - 1 - 2, 2);
+ p.drawLine(2, 0, 2, 2);
+ p.drawLine(pix.width() - 1 - 2, 0, pix.width() - 1 - 2, 2);
+ p.end();
+ XSetWindowBackgroundPixmap(QX11Info::display(), m_bottomOutline, pix.handle());
+ }
+ XClearWindow(QX11Info::display(), m_leftOutline);
+ XClearWindow(QX11Info::display(), m_rightOutline);
+ XClearWindow(QX11Info::display(), m_topOutline);
+ XClearWindow(QX11Info::display(), m_bottomOutline);
+ XMapWindow(QX11Info::display(), m_leftOutline);
+ XMapWindow(QX11Info::display(), m_rightOutline);
+ XMapWindow(QX11Info::display(), m_topOutline);
+ XMapWindow(QX11Info::display(), m_bottomOutline);
+}
+
+void Outline::hideWithX()
+{
+ XUnmapWindow(QX11Info::display(), m_leftOutline);
+ XUnmapWindow(QX11Info::display(), m_rightOutline);
+ XUnmapWindow(QX11Info::display(), m_topOutline);
+ XUnmapWindow(QX11Info::display(), m_bottomOutline);
+}
+
+} // namespace
diff --git a/outline.h b/outline.h
new file mode 100644
index 0000000000..6eddaece42
--- /dev/null
+++ b/outline.h
@@ -0,0 +1,103 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2011 Arthur Arlt
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+
+#ifndef KWIN_OUTLINE_H
+#define KWIN_OUTLINE_H
+#include
+#include
+#include
+#include
+
+namespace KWin {
+
+/**
+ * @short This class is used to show the outline of a given geometry.
+ *
+ * The class renders an outline by using four windows. One for each border of
+ * the geometry. It is possible to replace the outline with an effect. If an
+ * effect is available the effect will be used, otherwise the outline will be
+ * rendered by using the X implementation.
+ *
+ * @author Arthur Arlt
+ * @since 4.7
+ */
+class Outline {
+public:
+ Outline();
+ ~Outline();
+
+ /**
+ * Set the outline geometry.
+ * To show the outline use @link showOutline.
+ * @param outlineGeometry The geometry of the outline to be shown
+ * @see showOutline
+ */
+ void setGeometry(const QRect &outlineGeometry);
+
+ /**
+ * Shows the outline of a window using either an effect or the X implementation.
+ * To stop the outline process use @link hideOutline.
+ * @see hideOutline
+ */
+ void show();
+
+ /**
+ * Shows the outline for the given @p outlineGeometry.
+ * This is the same as setOutlineGeometry followed by showOutline directly.
+ * To stop the outline process use @link hideOutline.
+ * @param outlineGeometry The geometry of the outline to be shown
+ * @see hideOutline
+ */
+ void show(const QRect &outlineGeometry);
+
+ /**
+ * Hides shown outline.
+ * @see showOutline
+ */
+ void hide();
+
+ /**
+ * Return outline window ids
+ * @return The window ids created to represent the outline
+ */
+ QVector windowIds() const;
+private:
+
+ /**
+ * Show the window outline using the X implementation
+ */
+ void showWithX();
+
+ /**
+ * Hide previously shown outline used the X implementation
+ */
+ void hideWithX();
+
+ Window m_topOutline;
+ Window m_rightOutline;
+ Window m_bottomOutline;
+ Window m_leftOutline;
+ QRect m_outlineGeometry;
+ bool m_initialized;
+};
+
+}
+
+#endif
diff --git a/tabbox.cpp b/tabbox.cpp
index 908a92fcc2..32af748b61 100644
--- a/tabbox.cpp
+++ b/tabbox.cpp
@@ -45,6 +45,7 @@ along with this program. If not, see .
#include
#include
#include
+#include "outline.h"
// specify externals before namespace
@@ -195,6 +196,22 @@ TabBoxClient* TabBoxHandlerImpl::desktopClient() const
return NULL;
}
+void TabBoxHandlerImpl::showOutline(const QRect &outline)
+{
+ Workspace::self()->outline()->show(outline);
+}
+
+void TabBoxHandlerImpl::hideOutline()
+{
+ Workspace::self()->outline()->hide();
+}
+
+QVector< Window > TabBoxHandlerImpl::outlineWindowIds() const
+{
+ return Workspace::self()->outline()->windowIds();
+}
+
+
/*********************************************************
* TabBoxClientImpl
*********************************************************/
diff --git a/tabbox.h b/tabbox.h
index ea4ac102a4..6b579df327 100644
--- a/tabbox.h
+++ b/tabbox.h
@@ -58,6 +58,9 @@ public:
virtual void restack(TabBoxClient *c, TabBoxClient *under);
virtual TabBoxClient* clientToAddToList(TabBoxClient* client, int desktop, bool allDesktops) const;
virtual TabBoxClient* desktopClient() const;
+ virtual void hideOutline();
+ virtual void showOutline(const QRect &outline);
+ virtual QVector< Window > outlineWindowIds() const;
};
class TabBoxClientImpl : public TabBoxClient
diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp
index b178efe117..6651c8c824 100644
--- a/tabbox/tabboxhandler.cpp
+++ b/tabbox/tabboxhandler.cpp
@@ -58,10 +58,6 @@ public:
*/
void updateOutline();
/**
- * Hides the currently shown outline.
- */
- void hideOutline();
- /**
* Updates the current highlight window state
*/
void updateHighlightWindows();
@@ -122,10 +118,6 @@ TabBoxHandlerPrivate::TabBoxHandlerPrivate(TabBoxHandler *q)
TabBoxHandlerPrivate::~TabBoxHandlerPrivate()
{
delete view;
- XDestroyWindow(QX11Info::display(), outlineLeft);
- XDestroyWindow(QX11Info::display(), outlineRight);
- XDestroyWindow(QX11Info::display(), outlineTop);
- XDestroyWindow(QX11Info::display(), outlineBottom);
}
ClientModel* TabBoxHandlerPrivate::clientModel() const
@@ -144,91 +136,12 @@ void TabBoxHandlerPrivate::updateOutline()
return;
// if ( c == NULL || !m_isShown || !c->isShown( true ) || !c->isOnCurrentDesktop())
if (!isShown || view->clientModel()->data(index, ClientModel::EmptyRole).toBool()) {
- hideOutline();
+ q->hideOutline();
return;
}
TabBoxClient* c = static_cast< TabBoxClient* >(
view->clientModel()->data(index, ClientModel::ClientRole).value());
- // left/right parts are between top/bottom, they don't reach as far as the corners
- XMoveResizeWindow(QX11Info::display(), outlineLeft, c->x(), c->y() + 5, 5, c->height() - 10);
- XMoveResizeWindow(QX11Info::display(), outlineRight, c->x() + c->width() - 5, c->y() + 5, 5, c->height() - 10);
- XMoveResizeWindow(QX11Info::display(), outlineTop, c->x(), c->y(), c->width(), 5);
- XMoveResizeWindow(QX11Info::display(), outlineBottom, c->x(), c->y() + c->height() - 5, c->width(), 5);
- {
- QPixmap pix(5, c->height() - 10);
- QPainter p(&pix);
- p.setPen(Qt::white);
- p.drawLine(0, 0, 0, pix.height() - 1);
- p.drawLine(4, 0, 4, pix.height() - 1);
- p.setPen(Qt::gray);
- p.drawLine(1, 0, 1, pix.height() - 1);
- p.drawLine(3, 0, 3, pix.height() - 1);
- p.setPen(Qt::black);
- p.drawLine(2, 0, 2, pix.height() - 1);
- p.end();
- XSetWindowBackgroundPixmap(QX11Info::display(), outlineLeft, pix.handle());
- XSetWindowBackgroundPixmap(QX11Info::display(), outlineRight, pix.handle());
- }
- {
- QPixmap pix(c->width(), 5);
- QPainter p(&pix);
- p.setPen(Qt::white);
- p.drawLine(0, 0, pix.width() - 1 - 0, 0);
- p.drawLine(4, 4, pix.width() - 1 - 4, 4);
- p.drawLine(0, 0, 0, 4);
- p.drawLine(pix.width() - 1 - 0, 0, pix.width() - 1 - 0, 4);
- p.setPen(Qt::gray);
- p.drawLine(1, 1, pix.width() - 1 - 1, 1);
- p.drawLine(3, 3, pix.width() - 1 - 3, 3);
- p.drawLine(1, 1, 1, 4);
- p.drawLine(3, 3, 3, 4);
- p.drawLine(pix.width() - 1 - 1, 1, pix.width() - 1 - 1, 4);
- p.drawLine(pix.width() - 1 - 3, 3, pix.width() - 1 - 3, 4);
- p.setPen(Qt::black);
- p.drawLine(2, 2, pix.width() - 1 - 2, 2);
- p.drawLine(2, 2, 2, 4);
- p.drawLine(pix.width() - 1 - 2, 2, pix.width() - 1 - 2, 4);
- p.end();
- XSetWindowBackgroundPixmap(QX11Info::display(), outlineTop, pix.handle());
- }
- {
- QPixmap pix(c->width(), 5);
- QPainter p(&pix);
- p.setPen(Qt::white);
- p.drawLine(4, 0, pix.width() - 1 - 4, 0);
- p.drawLine(0, 4, pix.width() - 1 - 0, 4);
- p.drawLine(0, 4, 0, 0);
- p.drawLine(pix.width() - 1 - 0, 4, pix.width() - 1 - 0, 0);
- p.setPen(Qt::gray);
- p.drawLine(3, 1, pix.width() - 1 - 3, 1);
- p.drawLine(1, 3, pix.width() - 1 - 1, 3);
- p.drawLine(3, 1, 3, 0);
- p.drawLine(1, 3, 1, 0);
- p.drawLine(pix.width() - 1 - 3, 1, pix.width() - 1 - 3, 0);
- p.drawLine(pix.width() - 1 - 1, 3, pix.width() - 1 - 1, 0);
- p.setPen(Qt::black);
- p.drawLine(2, 2, pix.width() - 1 - 2, 2);
- p.drawLine(2, 0, 2, 2);
- p.drawLine(pix.width() - 1 - 2, 0, pix.width() - 1 - 2, 2);
- p.end();
- XSetWindowBackgroundPixmap(QX11Info::display(), outlineBottom, pix.handle());
- }
- XClearWindow(QX11Info::display(), outlineLeft);
- XClearWindow(QX11Info::display(), outlineRight);
- XClearWindow(QX11Info::display(), outlineTop);
- XClearWindow(QX11Info::display(), outlineBottom);
- XMapWindow(QX11Info::display(), outlineLeft);
- XMapWindow(QX11Info::display(), outlineRight);
- XMapWindow(QX11Info::display(), outlineTop);
- XMapWindow(QX11Info::display(), outlineBottom);
-}
-
-void TabBoxHandlerPrivate::hideOutline()
-{
- XUnmapWindow(QX11Info::display(), outlineLeft);
- XUnmapWindow(QX11Info::display(), outlineRight);
- XUnmapWindow(QX11Info::display(), outlineTop);
- XUnmapWindow(QX11Info::display(), outlineBottom);
+ q->showOutline(QRect(c->x(), c->y(), c->width(), c->height()));
}
void TabBoxHandlerPrivate::updateHighlightWindows()
@@ -269,11 +182,11 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
}
data[ 0 ] = currentClient ? currentClient->window() : 0L;
if (config.isShowOutline()) {
- data.resize(6);
- data[ 2 ] = outlineLeft;
- data[ 3 ] = outlineTop;
- data[ 4 ] = outlineRight;
- data[ 5 ] = outlineBottom;
+ QVector outlineWindows = q->outlineWindowIds();
+ data.resize(2+outlineWindows.size());
+ for (int i=0; iendHighlightWindows(abort);
}
if (d->config.isShowOutline()) {
- d->hideOutline();
+ hideOutline();
}
d->view->hide();
}
diff --git a/tabbox/tabboxhandler.h b/tabbox/tabboxhandler.h
index 96a1fc6dc6..af5a2c8de9 100644
--- a/tabbox/tabboxhandler.h
+++ b/tabbox/tabboxhandler.h
@@ -312,6 +312,27 @@ public:
*/
QWidget* tabBoxView() const;
+protected:
+ /**
+ * Show the outline of the current selected window
+ * @param outline The geometry of the window the outline will be shown
+ * @since 4.7
+ **/
+ virtual void showOutline(const QRect &outline) = 0;
+
+ /**
+ * Hide previously shown outline
+ * @since 4.7
+ **/
+ virtual void hideOutline() = 0;
+
+ /**
+ * Return outline window ids
+ * @return The outline window ids given in the order left, top, right, bottom
+ * @since 4.7
+ **/
+ virtual QVector outlineWindowIds() const = 0;
+
signals:
/**
* This signal is fired when the TabBoxConfig changes
@@ -320,6 +341,7 @@ signals:
void configChanged();
private:
+ friend class TabBoxHandlerPrivate;
TabBoxHandlerPrivate* d;
};
diff --git a/workspace.cpp b/workspace.cpp
index 1da25f1652..053ca6074a 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -50,6 +50,7 @@ along with this program. If not, see .
#include "atoms.h"
#include "placement.h"
#include "notifications.h"
+#include "outline.h"
#include "group.h"
#include "rules.h"
#include "kwinadaptor.h"
@@ -239,6 +240,7 @@ Workspace::Workspace(bool restore)
client_keys = new KActionCollection(this);
initShortcuts();
desktop_change_osd = new DesktopChangeOSD(this);
+ m_outline = new Outline();
init();
@@ -515,6 +517,7 @@ Workspace::~Workspace()
(*it)->release();
delete tab_box;
delete desktop_change_osd;
+ delete m_outline;
discardPopup();
XDeleteProperty(display(), rootWindow(), atoms->kwin_running);
@@ -2438,94 +2441,6 @@ bool Workspace::electricBorderEvent(XEvent* e)
return false;
}
-void Workspace::showElectricBorderWindowOutline()
-{
- if (!movingClient)
- return;
- // code copied from TabBox::updateOutline() in tabbox.cpp
- QRect c = movingClient->electricBorderMaximizeGeometry(cursorPos(), currentDesktop());
- // left/right parts are between top/bottom, they don't reach as far as the corners
- XMoveResizeWindow(QX11Info::display(), outline_left, c.x(), c.y() + 5, 5, c.height() - 10);
- XMoveResizeWindow(QX11Info::display(), outline_right, c.x() + c.width() - 5, c.y() + 5, 5, c.height() - 10);
- XMoveResizeWindow(QX11Info::display(), outline_top, c.x(), c.y(), c.width(), 5);
- XMoveResizeWindow(QX11Info::display(), outline_bottom, c.x(), c.y() + c.height() - 5, c.width(), 5);
- {
- QPixmap pix(5, c.height() - 10);
- QPainter p(&pix);
- p.setPen(Qt::white);
- p.drawLine(0, 0, 0, pix.height() - 1);
- p.drawLine(4, 0, 4, pix.height() - 1);
- p.setPen(Qt::gray);
- p.drawLine(1, 0, 1, pix.height() - 1);
- p.drawLine(3, 0, 3, pix.height() - 1);
- p.setPen(Qt::black);
- p.drawLine(2, 0, 2, pix.height() - 1);
- p.end();
- XSetWindowBackgroundPixmap(QX11Info::display(), outline_left, pix.handle());
- XSetWindowBackgroundPixmap(QX11Info::display(), outline_right, pix.handle());
- }
- {
- QPixmap pix(c.width(), 5);
- QPainter p(&pix);
- p.setPen(Qt::white);
- p.drawLine(0, 0, pix.width() - 1 - 0, 0);
- p.drawLine(4, 4, pix.width() - 1 - 4, 4);
- p.drawLine(0, 0, 0, 4);
- p.drawLine(pix.width() - 1 - 0, 0, pix.width() - 1 - 0, 4);
- p.setPen(Qt::gray);
- p.drawLine(1, 1, pix.width() - 1 - 1, 1);
- p.drawLine(3, 3, pix.width() - 1 - 3, 3);
- p.drawLine(1, 1, 1, 4);
- p.drawLine(3, 3, 3, 4);
- p.drawLine(pix.width() - 1 - 1, 1, pix.width() - 1 - 1, 4);
- p.drawLine(pix.width() - 1 - 3, 3, pix.width() - 1 - 3, 4);
- p.setPen(Qt::black);
- p.drawLine(2, 2, pix.width() - 1 - 2, 2);
- p.drawLine(2, 2, 2, 4);
- p.drawLine(pix.width() - 1 - 2, 2, pix.width() - 1 - 2, 4);
- p.end();
- XSetWindowBackgroundPixmap(QX11Info::display(), outline_top, pix.handle());
- }
- {
- QPixmap pix(c.width(), 5);
- QPainter p(&pix);
- p.setPen(Qt::white);
- p.drawLine(4, 0, pix.width() - 1 - 4, 0);
- p.drawLine(0, 4, pix.width() - 1 - 0, 4);
- p.drawLine(0, 4, 0, 0);
- p.drawLine(pix.width() - 1 - 0, 4, pix.width() - 1 - 0, 0);
- p.setPen(Qt::gray);
- p.drawLine(3, 1, pix.width() - 1 - 3, 1);
- p.drawLine(1, 3, pix.width() - 1 - 1, 3);
- p.drawLine(3, 1, 3, 0);
- p.drawLine(1, 3, 1, 0);
- p.drawLine(pix.width() - 1 - 3, 1, pix.width() - 1 - 3, 0);
- p.drawLine(pix.width() - 1 - 1, 3, pix.width() - 1 - 1, 0);
- p.setPen(Qt::black);
- p.drawLine(2, 2, pix.width() - 1 - 2, 2);
- p.drawLine(2, 0, 2, 2);
- p.drawLine(pix.width() - 1 - 2, 0, pix.width() - 1 - 2, 2);
- p.end();
- XSetWindowBackgroundPixmap(QX11Info::display(), outline_bottom, pix.handle());
- }
- XClearWindow(QX11Info::display(), outline_left);
- XClearWindow(QX11Info::display(), outline_right);
- XClearWindow(QX11Info::display(), outline_top);
- XClearWindow(QX11Info::display(), outline_bottom);
- XMapWindow(QX11Info::display(), outline_left);
- XMapWindow(QX11Info::display(), outline_right);
- XMapWindow(QX11Info::display(), outline_top);
- XMapWindow(QX11Info::display(), outline_bottom);
-}
-
-void Workspace::hideElectricBorderWindowOutline()
-{
- XUnmapWindow(QX11Info::display(), outline_left);
- XUnmapWindow(QX11Info::display(), outline_right);
- XUnmapWindow(QX11Info::display(), outline_top);
- XUnmapWindow(QX11Info::display(), outline_bottom);
-}
-
//-----------------------------------------------------------------------------
// Top menu
@@ -2941,6 +2856,11 @@ Client* Workspace::findSimilarClient(Client* c)
return found;
}
+Outline* Workspace::outline()
+{
+ return m_outline;
+}
+
} // namespace
#include "workspace.moc"
diff --git a/workspace.h b/workspace.h
index 6284487429..29960a498a 100644
--- a/workspace.h
+++ b/workspace.h
@@ -68,6 +68,7 @@ class Tile;
class TilingLayout;
class ClientGroup;
class DesktopChangeOSD;
+class Outline;
class RootInfo;
class PluginMgr;
class Placement;
@@ -219,6 +220,8 @@ public:
Position supportedTilingResizeMode(Client *c, Position currentMode);
+ Outline* outline();
+
//-------------------------------------------------
// Desktop layout
@@ -327,6 +330,8 @@ private:
// without having to remember to subtract one.
QVector tilingLayouts;
+ Outline* m_outline;
+
//-------------------------------------------------
// Unsorted
@@ -549,8 +554,6 @@ public:
void stopMousePolling();
void raiseElectricBorderWindows();
- void showElectricBorderWindowOutline();
- void hideElectricBorderWindowOutline();
public slots:
void addRepaintFull();