2011-06-23 10:09:17 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
|
|
|
|
|
|
|
|
Since the functionality provided in this class has been moved from
|
|
|
|
class Workspace, it is not clear who exactly has written the code.
|
|
|
|
The list below contains the copyright holders of the class Workspace.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "screenedge.h"
|
|
|
|
|
|
|
|
// KWin
|
|
|
|
#include "atoms.h"
|
2011-12-10 13:43:58 +00:00
|
|
|
#include "client.h"
|
2011-06-23 10:09:17 +00:00
|
|
|
#include "effects.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "workspace.h"
|
|
|
|
|
|
|
|
// Qt
|
|
|
|
#include <QtCore/QTimer>
|
|
|
|
#include <QtCore/QVector>
|
|
|
|
#include <QtCore/QTextStream>
|
|
|
|
#include <QtDBus/QDBusInterface>
|
|
|
|
|
|
|
|
namespace KWin {
|
|
|
|
|
|
|
|
ScreenEdge::ScreenEdge()
|
|
|
|
: QObject(NULL)
|
2011-06-28 11:50:24 +00:00
|
|
|
, m_screenEdgeWindows(ELECTRIC_COUNT, None)
|
2011-06-28 12:00:47 +00:00
|
|
|
, m_screenEdgeReserved(ELECTRIC_COUNT, 0)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScreenEdge::~ScreenEdge()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-06-25 18:08:51 +00:00
|
|
|
void ScreenEdge::init()
|
|
|
|
{
|
2011-06-27 11:02:53 +00:00
|
|
|
reserveActions(true);
|
2011-06-25 18:08:51 +00:00
|
|
|
if (options->electricBorders() == Options::ElectricAlways) {
|
2011-06-27 11:02:53 +00:00
|
|
|
reserveDesktopSwitching(true);
|
2011-06-25 18:08:51 +00:00
|
|
|
}
|
2011-06-27 11:02:53 +00:00
|
|
|
update();
|
2011-06-25 18:08:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-04 10:41:18 +00:00
|
|
|
void ScreenEdge::update(bool force)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
2011-06-25 18:17:44 +00:00
|
|
|
m_screenEdgeTimeFirst = xTime();
|
|
|
|
m_screenEdgeTimeLast = xTime();
|
|
|
|
m_screenEdgeTimeLastTrigger = xTime();
|
|
|
|
m_currentScreenEdge = ElectricNone;
|
2012-03-27 17:14:53 +00:00
|
|
|
QRect r = QRect(0, 0, displayWidth(), displayHeight());
|
2011-06-25 18:17:44 +00:00
|
|
|
m_screenEdgeTop = r.top();
|
|
|
|
m_screenEdgeBottom = r.bottom();
|
|
|
|
m_screenEdgeLeft = r.left();
|
|
|
|
m_screenEdgeRight = r.right();
|
2011-06-23 10:09:17 +00:00
|
|
|
|
|
|
|
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos) {
|
2011-07-04 10:41:18 +00:00
|
|
|
if (force || m_screenEdgeReserved[pos] == 0) {
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[pos] != None)
|
|
|
|
XDestroyWindow(display(), m_screenEdgeWindows[pos]);
|
|
|
|
m_screenEdgeWindows[pos] = None;
|
2011-07-04 10:41:18 +00:00
|
|
|
}
|
|
|
|
if (m_screenEdgeReserved[pos] == 0) {
|
2011-06-23 10:09:17 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[pos] != None)
|
2011-06-23 10:09:17 +00:00
|
|
|
continue;
|
|
|
|
XSetWindowAttributes attributes;
|
|
|
|
attributes.override_redirect = True;
|
|
|
|
attributes.event_mask = EnterWindowMask | LeaveWindowMask;
|
|
|
|
unsigned long valuemask = CWOverrideRedirect | CWEventMask;
|
|
|
|
int xywh[ELECTRIC_COUNT][4] = {
|
|
|
|
{ r.left() + 1, r.top(), r.width() - 2, 1 }, // Top
|
|
|
|
{ r.right(), r.top(), 1, 1 }, // Top-right
|
|
|
|
{ r.right(), r.top() + 1, 1, r.height() - 2 }, // Etc.
|
|
|
|
{ r.right(), r.bottom(), 1, 1 },
|
|
|
|
{ r.left() + 1, r.bottom(), r.width() - 2, 1 },
|
|
|
|
{ r.left(), r.bottom(), 1, 1 },
|
|
|
|
{ r.left(), r.top() + 1, 1, r.height() - 2 },
|
|
|
|
{ r.left(), r.top(), 1, 1 }
|
|
|
|
};
|
2011-06-25 18:17:44 +00:00
|
|
|
m_screenEdgeWindows[pos] = XCreateWindow(display(), rootWindow(),
|
2011-06-23 10:09:17 +00:00
|
|
|
xywh[pos][0], xywh[pos][1], xywh[pos][2], xywh[pos][3],
|
|
|
|
0, CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes);
|
2011-06-25 18:17:44 +00:00
|
|
|
XMapWindow(display(), m_screenEdgeWindows[pos]);
|
2011-06-23 10:09:17 +00:00
|
|
|
|
|
|
|
// Set XdndAware on the windows, so that DND enter events are received (#86998)
|
|
|
|
Atom version = 4; // XDND version
|
2011-06-25 18:17:44 +00:00
|
|
|
XChangeProperty(display(), m_screenEdgeWindows[pos], atoms->xdnd_aware, XA_ATOM,
|
2011-06-23 10:09:17 +00:00
|
|
|
32, PropModeReplace, (unsigned char*)(&version), 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::restoreSize(ElectricBorder border)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[border] == None)
|
2011-06-23 10:09:17 +00:00
|
|
|
return;
|
2012-03-27 17:14:53 +00:00
|
|
|
QRect r(0, 0, displayWidth(), displayHeight());
|
2011-06-23 10:09:17 +00:00
|
|
|
int xywh[ELECTRIC_COUNT][4] = {
|
|
|
|
{ r.left() + 1, r.top(), r.width() - 2, 1 }, // Top
|
|
|
|
{ r.right(), r.top(), 1, 1 }, // Top-right
|
|
|
|
{ r.right(), r.top() + 1, 1, r.height() - 2 }, // Etc.
|
|
|
|
{ r.right(), r.bottom(), 1, 1 },
|
|
|
|
{ r.left() + 1, r.bottom(), r.width() - 2, 1 },
|
|
|
|
{ r.left(), r.bottom(), 1, 1 },
|
|
|
|
{ r.left(), r.top() + 1, 1, r.height() - 2 },
|
|
|
|
{ r.left(), r.top(), 1, 1 }
|
|
|
|
};
|
2011-06-25 18:17:44 +00:00
|
|
|
XMoveResizeWindow(display(), m_screenEdgeWindows[border],
|
2011-06-23 10:09:17 +00:00
|
|
|
xywh[border][0], xywh[border][1], xywh[border][2], xywh[border][3]);
|
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::reserveActions(bool isToReserve)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos)
|
|
|
|
if (options->electricBorderAction(static_cast<ElectricBorder>(pos))) {
|
2011-06-27 11:02:53 +00:00
|
|
|
if (isToReserve)
|
|
|
|
reserve(static_cast<ElectricBorder>(pos));
|
2011-06-23 10:09:17 +00:00
|
|
|
else
|
2011-06-27 11:02:53 +00:00
|
|
|
unreserve(static_cast<ElectricBorder>(pos));
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::reserveDesktopSwitching(bool isToReserve)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos)
|
2011-06-27 11:02:53 +00:00
|
|
|
if (isToReserve)
|
|
|
|
reserve(static_cast<ElectricBorder>(pos));
|
2011-06-23 10:09:17 +00:00
|
|
|
else
|
2011-06-27 11:02:53 +00:00
|
|
|
unreserve(static_cast<ElectricBorder>(pos));
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::reserve(ElectricBorder border)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
if (border == ElectricNone)
|
|
|
|
return;
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeReserved[border]++ == 0)
|
2011-06-27 11:02:53 +00:00
|
|
|
QTimer::singleShot(0, this, SLOT(update()));
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::unreserve(ElectricBorder border)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
if (border == ElectricNone)
|
|
|
|
return;
|
2011-06-25 18:17:44 +00:00
|
|
|
assert(m_screenEdgeReserved[border] > 0);
|
|
|
|
if (--m_screenEdgeReserved[border] == 0)
|
2011-06-27 11:02:53 +00:00
|
|
|
QTimer::singleShot(0, this, SLOT(update()));
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::check(const QPoint& pos, Time now)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
2011-06-25 18:17:44 +00:00
|
|
|
if ((pos.x() != m_screenEdgeLeft) &&
|
|
|
|
(pos.x() != m_screenEdgeRight) &&
|
|
|
|
(pos.y() != m_screenEdgeTop) &&
|
|
|
|
(pos.y() != m_screenEdgeBottom))
|
2011-06-23 10:09:17 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
bool have_borders = false;
|
|
|
|
for (int i = 0; i < ELECTRIC_COUNT; ++i)
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[i] != None)
|
2011-06-23 10:09:17 +00:00
|
|
|
have_borders = true;
|
|
|
|
if (!have_borders)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Time treshold_set = options->electricBorderDelay(); // Set timeout
|
|
|
|
Time treshold_reset = 250; // Reset timeout
|
|
|
|
Time treshold_trigger = options->electricBorderCooldown(); // Minimum time between triggers
|
|
|
|
int distance_reset = 30; // Mouse should not move more than this many pixels
|
|
|
|
int pushback_pixels = options->electricBorderPushbackPixels();
|
|
|
|
|
|
|
|
ElectricBorder border;
|
2011-06-25 18:17:44 +00:00
|
|
|
if (pos.x() == m_screenEdgeLeft && pos.y() == m_screenEdgeTop)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricTopLeft;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.x() == m_screenEdgeRight && pos.y() == m_screenEdgeTop)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricTopRight;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.x() == m_screenEdgeLeft && pos.y() == m_screenEdgeBottom)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricBottomLeft;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.x() == m_screenEdgeRight && pos.y() == m_screenEdgeBottom)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricBottomRight;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.x() == m_screenEdgeLeft)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricLeft;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.x() == m_screenEdgeRight)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricRight;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.y() == m_screenEdgeTop)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricTop;
|
2011-06-25 18:17:44 +00:00
|
|
|
else if (pos.y() == m_screenEdgeBottom)
|
2011-06-23 10:09:17 +00:00
|
|
|
border = ElectricBottom;
|
|
|
|
else
|
|
|
|
abort();
|
|
|
|
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[border] == None)
|
2011-06-23 10:09:17 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (pushback_pixels == 0) {
|
|
|
|
// no pushback so we have to activate at once
|
2011-06-25 18:17:44 +00:00
|
|
|
m_screenEdgeTimeLast = now;
|
2012-03-26 22:40:56 +00:00
|
|
|
m_currentScreenEdge = border;
|
|
|
|
m_screenEdgePushPoint = pos;
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
2012-03-26 22:40:56 +00:00
|
|
|
|
2011-06-25 18:17:44 +00:00
|
|
|
if ((m_currentScreenEdge == border) &&
|
|
|
|
(timestampDiff(m_screenEdgeTimeLast, now) < treshold_reset) &&
|
|
|
|
(timestampDiff(m_screenEdgeTimeLastTrigger, now) > treshold_trigger) &&
|
|
|
|
((pos - m_screenEdgePushPoint).manhattanLength() < distance_reset)) {
|
|
|
|
m_screenEdgeTimeLast = now;
|
|
|
|
|
|
|
|
if (timestampDiff(m_screenEdgeTimeFirst, now) > treshold_set) {
|
|
|
|
m_currentScreenEdge = ElectricNone;
|
|
|
|
m_screenEdgeTimeLastTrigger = now;
|
2011-06-23 10:09:17 +00:00
|
|
|
if (Workspace::self()->getMovingClient()) {
|
|
|
|
// If moving a client or have force doing the desktop switch
|
|
|
|
if (options->electricBorders() != Options::ElectricDisabled)
|
2011-06-27 11:02:53 +00:00
|
|
|
switchDesktop(border, pos);
|
2011-06-23 10:09:17 +00:00
|
|
|
return; // Don't reset cursor position
|
|
|
|
} else {
|
|
|
|
if (options->electricBorders() == Options::ElectricAlways &&
|
|
|
|
(border == ElectricTop || border == ElectricRight ||
|
|
|
|
border == ElectricBottom || border == ElectricLeft)) {
|
|
|
|
// If desktop switching is always enabled don't apply it to the corners if
|
|
|
|
// an effect is applied to it (We will check that later).
|
2011-06-27 11:02:53 +00:00
|
|
|
switchDesktop(border, pos);
|
2011-06-23 10:09:17 +00:00
|
|
|
return; // Don't reset cursor position
|
|
|
|
}
|
|
|
|
switch(options->electricBorderAction(border)) {
|
|
|
|
case ElectricActionDashboard: { // Display Plasma dashboard
|
|
|
|
QDBusInterface plasmaApp("org.kde.plasma-desktop", "/App");
|
|
|
|
plasmaApp.call("toggleDashboard");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ElectricActionShowDesktop: {
|
|
|
|
Workspace::self()->setShowingDesktop(!Workspace::self()->showingDesktop());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ElectricActionLockScreen: { // Lock the screen
|
|
|
|
QDBusInterface screenSaver("org.kde.screensaver", "/ScreenSaver");
|
|
|
|
screenSaver.call("Lock");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ElectricActionPreventScreenLocking: {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ElectricActionNone: // Either desktop switching or an effect
|
|
|
|
default: {
|
|
|
|
if (effects && static_cast<EffectsHandlerImpl*>(effects)->borderActivated(border))
|
|
|
|
{} // Handled by effects
|
|
|
|
else {
|
2011-06-27 11:02:53 +00:00
|
|
|
switchDesktop(border, pos);
|
2011-06-23 10:09:17 +00:00
|
|
|
return; // Don't reset cursor position
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2011-06-25 18:17:44 +00:00
|
|
|
m_currentScreenEdge = border;
|
|
|
|
m_screenEdgeTimeFirst = now;
|
|
|
|
m_screenEdgeTimeLast = now;
|
|
|
|
m_screenEdgePushPoint = pos;
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Reset the pointer to find out whether the user is really pushing
|
|
|
|
// (the direction back from which it came, starting from top clockwise)
|
|
|
|
const int xdiff[ELECTRIC_COUNT] = { 0,
|
|
|
|
-pushback_pixels,
|
|
|
|
-pushback_pixels,
|
|
|
|
-pushback_pixels,
|
|
|
|
0,
|
|
|
|
pushback_pixels,
|
|
|
|
pushback_pixels,
|
|
|
|
pushback_pixels
|
|
|
|
};
|
|
|
|
const int ydiff[ELECTRIC_COUNT] = { pushback_pixels,
|
|
|
|
pushback_pixels,
|
|
|
|
0,
|
|
|
|
-pushback_pixels,
|
|
|
|
-pushback_pixels,
|
|
|
|
-pushback_pixels,
|
|
|
|
0,
|
|
|
|
pushback_pixels
|
|
|
|
};
|
|
|
|
QCursor::setPos(pos.x() + xdiff[border], pos.y() + ydiff[border]);
|
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
void ScreenEdge::switchDesktop(ElectricBorder border, const QPoint& _pos)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
QPoint pos = _pos;
|
|
|
|
int desk = Workspace::self()->currentDesktop();
|
|
|
|
const int OFFSET = 2;
|
|
|
|
if (border == ElectricLeft || border == ElectricTopLeft || border == ElectricBottomLeft) {
|
2012-02-20 09:25:13 +00:00
|
|
|
desk = Workspace::self()->desktopToLeft(desk, options->isRollOverDesktops());
|
2011-06-23 10:09:17 +00:00
|
|
|
pos.setX(displayWidth() - 1 - OFFSET);
|
|
|
|
}
|
|
|
|
if (border == ElectricRight || border == ElectricTopRight || border == ElectricBottomRight) {
|
2012-02-20 09:25:13 +00:00
|
|
|
desk = Workspace::self()->desktopToRight(desk, options->isRollOverDesktops());
|
2011-06-23 10:09:17 +00:00
|
|
|
pos.setX(OFFSET);
|
|
|
|
}
|
|
|
|
if (border == ElectricTop || border == ElectricTopLeft || border == ElectricTopRight) {
|
2012-02-20 09:25:13 +00:00
|
|
|
desk = Workspace::self()->desktopAbove(desk, options->isRollOverDesktops());
|
2011-06-23 10:09:17 +00:00
|
|
|
pos.setY(displayHeight() - 1 - OFFSET);
|
|
|
|
}
|
|
|
|
if (border == ElectricBottom || border == ElectricBottomLeft || border == ElectricBottomRight) {
|
2012-02-20 09:25:13 +00:00
|
|
|
desk = Workspace::self()->desktopBelow(desk, options->isRollOverDesktops());
|
2011-06-23 10:09:17 +00:00
|
|
|
pos.setY(OFFSET);
|
|
|
|
}
|
2011-12-10 13:43:58 +00:00
|
|
|
Client *c = Workspace::self()->getMovingClient();
|
|
|
|
if (c && c->rules()->checkDesktop(desk) != desk)
|
|
|
|
return; // user attempts to move a client to another desktop where it is ruleforced to not be
|
2011-06-23 10:09:17 +00:00
|
|
|
int desk_before = Workspace::self()->currentDesktop();
|
|
|
|
Workspace::self()->setCurrentDesktop(desk);
|
|
|
|
if (Workspace::self()->currentDesktop() != desk_before)
|
|
|
|
QCursor::setPos(pos);
|
|
|
|
}
|
|
|
|
|
2011-06-27 11:02:53 +00:00
|
|
|
bool ScreenEdge::isEntered(XEvent* e)
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
if (e->type == EnterNotify) {
|
|
|
|
for (int i = 0; i < ELECTRIC_COUNT; ++i)
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[i] != None && e->xcrossing.window == m_screenEdgeWindows[i]) {
|
2011-06-23 10:09:17 +00:00
|
|
|
// The user entered an electric border
|
2011-06-27 11:02:53 +00:00
|
|
|
check(QPoint(e->xcrossing.x_root, e->xcrossing.y_root), e->xcrossing.time);
|
2011-06-23 10:09:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (e->type == ClientMessage) {
|
|
|
|
if (e->xclient.message_type == atoms->xdnd_position) {
|
|
|
|
for (int i = 0; i < ELECTRIC_COUNT; ++i)
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[i] != None && e->xclient.window == m_screenEdgeWindows[i]) {
|
2011-06-23 10:09:17 +00:00
|
|
|
updateXTime();
|
2011-06-27 11:02:53 +00:00
|
|
|
check(QPoint(e->xclient.data.l[2] >> 16, e->xclient.data.l[2] & 0xffff), xTime());
|
2011-06-23 10:09:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-07-04 10:55:58 +00:00
|
|
|
void ScreenEdge::ensureOnTop()
|
2011-06-23 10:09:17 +00:00
|
|
|
{
|
|
|
|
Window* windows = new Window[ 8 ]; // There are up to 8 borders
|
|
|
|
int pos = 0;
|
|
|
|
for (int i = 0; i < ELECTRIC_COUNT; ++i)
|
2011-06-25 18:17:44 +00:00
|
|
|
if (m_screenEdgeWindows[ i ] != None)
|
|
|
|
windows[ pos++ ] = m_screenEdgeWindows[ i ];
|
2011-06-23 10:09:17 +00:00
|
|
|
if (!pos) {
|
|
|
|
delete [] windows;
|
|
|
|
return; // No borders at all
|
|
|
|
}
|
|
|
|
XRaiseWindow(display(), windows[ 0 ]);
|
|
|
|
XRestackWindows(display(), windows, pos);
|
|
|
|
delete [] windows;
|
|
|
|
}
|
2011-06-24 14:20:40 +00:00
|
|
|
|
2011-06-28 11:50:24 +00:00
|
|
|
const QVector< Window >& ScreenEdge::windows()
|
2011-06-24 14:20:40 +00:00
|
|
|
{
|
2011-06-28 11:50:24 +00:00
|
|
|
return m_screenEdgeWindows;
|
2011-06-24 14:20:40 +00:00
|
|
|
}
|
2011-06-23 10:09:17 +00:00
|
|
|
} //namespace
|
2011-06-24 14:20:40 +00:00
|
|
|
|