Rename functions in class ScreenEdge
Since the functions were moved from Workspace to its own class ScreenEdge and the functionality was formerly called ElectricWindows, the functions still had the old names. They are now consistenly renamed without redundand naming. The function calls were updated as well in all classes where ScreenEdge is used.icc-effect-5.14.5
parent
7aecca019f
commit
6e7a249cd0
12
effects.cpp
12
effects.cpp
|
@ -870,7 +870,7 @@ Window EffectsHandlerImpl::createInputWindow(Effect* e, int x, int y, int w, int
|
|||
|
||||
// Raise electric border windows above the input windows
|
||||
// so they can still be triggered.
|
||||
Workspace::self()->screenEdge()->raiseElectricBorderWindows();
|
||||
Workspace::self()->screenEdge()->raiseWindows();
|
||||
|
||||
return win;
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ void EffectsHandlerImpl::checkInputWindowStacking()
|
|||
delete[] wins;
|
||||
// Raise electric border windows above the input windows
|
||||
// so they can still be triggered. TODO: Do both at once.
|
||||
Workspace::self()->screenEdge()->raiseElectricBorderWindows();
|
||||
Workspace::self()->screenEdge()->raiseWindows();
|
||||
}
|
||||
|
||||
QPoint EffectsHandlerImpl::cursorPos() const
|
||||
|
@ -951,22 +951,22 @@ QPoint EffectsHandlerImpl::cursorPos() const
|
|||
|
||||
void EffectsHandlerImpl::checkElectricBorder(const QPoint &pos, Time time)
|
||||
{
|
||||
Workspace::self()->screenEdge()->checkElectricBorder(pos, time);
|
||||
Workspace::self()->screenEdge()->check(pos, time);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::reserveElectricBorder(ElectricBorder border)
|
||||
{
|
||||
Workspace::self()->screenEdge()->reserveElectricBorder(border);
|
||||
Workspace::self()->screenEdge()->reserve(border);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border)
|
||||
{
|
||||
Workspace::self()->screenEdge()->unreserveElectricBorder(border);
|
||||
Workspace::self()->screenEdge()->unreserve(border);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve)
|
||||
{
|
||||
Workspace::self()->screenEdge()->reserveElectricBorderSwitching(reserve);
|
||||
Workspace::self()->screenEdge()->reserveDesktopSwitching(reserve);
|
||||
}
|
||||
|
||||
unsigned long EffectsHandlerImpl::xrenderBufferPicture()
|
||||
|
|
|
@ -377,7 +377,7 @@ bool Workspace::workspaceEvent(XEvent * e)
|
|||
if (w)
|
||||
QWhatsThis::leaveWhatsThisMode();
|
||||
}
|
||||
if (m_screenEdge.electricBorderEvent(e))
|
||||
if (m_screenEdge.isEntered(e))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ bool Workspace::workspaceEvent(XEvent * e)
|
|||
case FocusOut:
|
||||
return true; // always eat these, they would tell Qt that KWin is the active app
|
||||
case ClientMessage:
|
||||
if (m_screenEdge.electricBorderEvent(e))
|
||||
if (m_screenEdge.isEntered(e))
|
||||
return true;
|
||||
break;
|
||||
case Expose:
|
||||
|
|
12
geometry.cpp
12
geometry.cpp
|
@ -72,8 +72,8 @@ void Workspace::desktopResized()
|
|||
rootInfo->setDesktopGeometry(-1, desktop_geometry);
|
||||
|
||||
updateClientArea();
|
||||
m_screenEdge.destroyElectricBorders();
|
||||
m_screenEdge.updateElectricBorders();
|
||||
m_screenEdge.destroy();
|
||||
m_screenEdge.update();
|
||||
if (compositing())
|
||||
compositeResetTimer.start(0);
|
||||
}
|
||||
|
@ -2527,7 +2527,7 @@ bool Client::startMoveResize()
|
|||
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
||||
options->electricBorderMaximize() ||
|
||||
options->electricBorderTiling())
|
||||
workspace()->screenEdge()->reserveElectricBorderSwitching(true);
|
||||
workspace()->screenEdge()->reserveDesktopSwitching(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2592,7 +2592,7 @@ void Client::finishMoveResize(bool cancel)
|
|||
kDebug(1212) << "invalid electric mode" << electricMode << "leading to invalid array acces,\
|
||||
this should not have happened!";
|
||||
else
|
||||
workspace()->screenEdge()->restoreElectricBorderSize(border);
|
||||
workspace()->screenEdge()->restoreSize(border);
|
||||
electricMaximizing = false;
|
||||
workspace()->outline()->hide();
|
||||
}
|
||||
|
@ -2622,7 +2622,7 @@ void Client::leaveMoveResize()
|
|||
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
||||
options->electricBorderMaximize() ||
|
||||
options->electricBorderTiling())
|
||||
workspace()->screenEdge()->reserveElectricBorderSwitching(false);
|
||||
workspace()->screenEdge()->reserveDesktopSwitching(false);
|
||||
}
|
||||
|
||||
// This function checks if it actually makes sense to perform a restricted move/resize.
|
||||
|
@ -2945,7 +2945,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
|||
|
||||
if (isMove()) {
|
||||
workspace()->notifyTilingWindowMove(this, moveResizeGeom, initialMoveResizeGeom);
|
||||
workspace()->screenEdge()->checkElectricBorder(globalPos, xTime());
|
||||
workspace()->screenEdge()->check(globalPos, xTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ void Workspace::propagateClients(bool propagate_new_clients)
|
|||
// it ensures that no client will be ever shown above override-redirect
|
||||
// windows (e.g. popups).
|
||||
newWindowStack << (Window*)supportWindow->winId();
|
||||
newWindowStack << m_screenEdge.screenEdgeWindows();
|
||||
newWindowStack << m_screenEdge.windows();
|
||||
for (int i = stacking_order.size() - 1; i >= 0; i--) {
|
||||
if (stacking_order.at(i)->hiddenPreview()) {
|
||||
continue;
|
||||
|
|
|
@ -61,14 +61,14 @@ ScreenEdge::~ScreenEdge()
|
|||
|
||||
void ScreenEdge::init()
|
||||
{
|
||||
reserveElectricBorderActions(true);
|
||||
reserveActions(true);
|
||||
if (options->electricBorders() == Options::ElectricAlways) {
|
||||
reserveElectricBorderSwitching(true);
|
||||
reserveDesktopSwitching(true);
|
||||
}
|
||||
updateElectricBorders();
|
||||
update();
|
||||
}
|
||||
|
||||
void ScreenEdge::updateElectricBorders()
|
||||
void ScreenEdge::update()
|
||||
{
|
||||
m_screenEdgeTimeFirst = xTime();
|
||||
m_screenEdgeTimeLast = xTime();
|
||||
|
@ -115,7 +115,7 @@ void ScreenEdge::updateElectricBorders()
|
|||
}
|
||||
}
|
||||
|
||||
void ScreenEdge::destroyElectricBorders()
|
||||
void ScreenEdge::destroy()
|
||||
{
|
||||
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos) {
|
||||
if (m_screenEdgeWindows[pos] != None)
|
||||
|
@ -124,7 +124,7 @@ void ScreenEdge::destroyElectricBorders()
|
|||
}
|
||||
}
|
||||
|
||||
void ScreenEdge::restoreElectricBorderSize(ElectricBorder border)
|
||||
void ScreenEdge::restoreSize(ElectricBorder border)
|
||||
{
|
||||
if (m_screenEdgeWindows[border] == None)
|
||||
return;
|
||||
|
@ -143,44 +143,44 @@ void ScreenEdge::restoreElectricBorderSize(ElectricBorder border)
|
|||
xywh[border][0], xywh[border][1], xywh[border][2], xywh[border][3]);
|
||||
}
|
||||
|
||||
void ScreenEdge::reserveElectricBorderActions(bool reserve)
|
||||
void ScreenEdge::reserveActions(bool isToReserve)
|
||||
{
|
||||
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos)
|
||||
if (options->electricBorderAction(static_cast<ElectricBorder>(pos))) {
|
||||
if (reserve)
|
||||
reserveElectricBorder(static_cast<ElectricBorder>(pos));
|
||||
if (isToReserve)
|
||||
reserve(static_cast<ElectricBorder>(pos));
|
||||
else
|
||||
unreserveElectricBorder(static_cast<ElectricBorder>(pos));
|
||||
unreserve(static_cast<ElectricBorder>(pos));
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenEdge::reserveElectricBorderSwitching(bool reserve)
|
||||
void ScreenEdge::reserveDesktopSwitching(bool isToReserve)
|
||||
{
|
||||
for (int pos = 0; pos < ELECTRIC_COUNT; ++pos)
|
||||
if (reserve)
|
||||
reserveElectricBorder(static_cast<ElectricBorder>(pos));
|
||||
if (isToReserve)
|
||||
reserve(static_cast<ElectricBorder>(pos));
|
||||
else
|
||||
unreserveElectricBorder(static_cast<ElectricBorder>(pos));
|
||||
unreserve(static_cast<ElectricBorder>(pos));
|
||||
}
|
||||
|
||||
void ScreenEdge::reserveElectricBorder(ElectricBorder border)
|
||||
void ScreenEdge::reserve(ElectricBorder border)
|
||||
{
|
||||
if (border == ElectricNone)
|
||||
return;
|
||||
if (m_screenEdgeReserved[border]++ == 0)
|
||||
QTimer::singleShot(0, this, SLOT(updateElectricBorders()));
|
||||
QTimer::singleShot(0, this, SLOT(update()));
|
||||
}
|
||||
|
||||
void ScreenEdge::unreserveElectricBorder(ElectricBorder border)
|
||||
void ScreenEdge::unreserve(ElectricBorder border)
|
||||
{
|
||||
if (border == ElectricNone)
|
||||
return;
|
||||
assert(m_screenEdgeReserved[border] > 0);
|
||||
if (--m_screenEdgeReserved[border] == 0)
|
||||
QTimer::singleShot(0, this, SLOT(updateElectricBorders()));
|
||||
QTimer::singleShot(0, this, SLOT(update()));
|
||||
}
|
||||
|
||||
void ScreenEdge::checkElectricBorder(const QPoint& pos, Time now)
|
||||
void ScreenEdge::check(const QPoint& pos, Time now)
|
||||
{
|
||||
if ((pos.x() != m_screenEdgeLeft) &&
|
||||
(pos.x() != m_screenEdgeRight) &&
|
||||
|
@ -240,7 +240,7 @@ void ScreenEdge::checkElectricBorder(const QPoint& pos, Time now)
|
|||
if (Workspace::self()->getMovingClient()) {
|
||||
// If moving a client or have force doing the desktop switch
|
||||
if (options->electricBorders() != Options::ElectricDisabled)
|
||||
electricBorderSwitchDesktop(border, pos);
|
||||
switchDesktop(border, pos);
|
||||
return; // Don't reset cursor position
|
||||
} else {
|
||||
if (options->electricBorders() == Options::ElectricAlways &&
|
||||
|
@ -248,7 +248,7 @@ void ScreenEdge::checkElectricBorder(const QPoint& pos, Time now)
|
|||
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).
|
||||
electricBorderSwitchDesktop(border, pos);
|
||||
switchDesktop(border, pos);
|
||||
return; // Don't reset cursor position
|
||||
}
|
||||
switch(options->electricBorderAction(border)) {
|
||||
|
@ -274,7 +274,7 @@ void ScreenEdge::checkElectricBorder(const QPoint& pos, Time now)
|
|||
if (effects && static_cast<EffectsHandlerImpl*>(effects)->borderActivated(border))
|
||||
{} // Handled by effects
|
||||
else {
|
||||
electricBorderSwitchDesktop(border, pos);
|
||||
switchDesktop(border, pos);
|
||||
return; // Don't reset cursor position
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ void ScreenEdge::checkElectricBorder(const QPoint& pos, Time now)
|
|||
QCursor::setPos(pos.x() + xdiff[border], pos.y() + ydiff[border]);
|
||||
}
|
||||
|
||||
void ScreenEdge::electricBorderSwitchDesktop(ElectricBorder border, const QPoint& _pos)
|
||||
void ScreenEdge::switchDesktop(ElectricBorder border, const QPoint& _pos)
|
||||
{
|
||||
QPoint pos = _pos;
|
||||
int desk = Workspace::self()->currentDesktop();
|
||||
|
@ -342,13 +342,13 @@ void ScreenEdge::electricBorderSwitchDesktop(ElectricBorder border, const QPoint
|
|||
* Called when the user entered an electric border with the mouse.
|
||||
* It may switch to another virtual desktop.
|
||||
*/
|
||||
bool ScreenEdge::electricBorderEvent(XEvent* e)
|
||||
bool ScreenEdge::isEntered(XEvent* e)
|
||||
{
|
||||
if (e->type == EnterNotify) {
|
||||
for (int i = 0; i < ELECTRIC_COUNT; ++i)
|
||||
if (m_screenEdgeWindows[i] != None && e->xcrossing.window == m_screenEdgeWindows[i]) {
|
||||
// The user entered an electric border
|
||||
checkElectricBorder(QPoint(e->xcrossing.x_root, e->xcrossing.y_root), e->xcrossing.time);
|
||||
check(QPoint(e->xcrossing.x_root, e->xcrossing.y_root), e->xcrossing.time);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ bool ScreenEdge::electricBorderEvent(XEvent* e)
|
|||
for (int i = 0; i < ELECTRIC_COUNT; ++i)
|
||||
if (m_screenEdgeWindows[i] != None && e->xclient.window == m_screenEdgeWindows[i]) {
|
||||
updateXTime();
|
||||
checkElectricBorder(QPoint(e->xclient.data.l[2] >> 16, e->xclient.data.l[2] & 0xffff), xTime());
|
||||
check(QPoint(e->xclient.data.l[2] >> 16, e->xclient.data.l[2] & 0xffff), xTime());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ bool ScreenEdge::electricBorderEvent(XEvent* e)
|
|||
* Raise electric border windows to the real top of the screen. We only need
|
||||
* to do this if an effect input window is active.
|
||||
*/
|
||||
void ScreenEdge::raiseElectricBorderWindows()
|
||||
void ScreenEdge::raiseWindows()
|
||||
{
|
||||
Window* windows = new Window[ 8 ]; // There are up to 8 borders
|
||||
int pos = 0;
|
||||
|
@ -385,7 +385,7 @@ void ScreenEdge::raiseElectricBorderWindows()
|
|||
delete [] windows;
|
||||
}
|
||||
|
||||
const QVector< Window* >& ScreenEdge::screenEdgeWindows()
|
||||
const QVector< Window* >& ScreenEdge::windows()
|
||||
{
|
||||
QVector< Window* >* screenEdgeWindows = new QVector< Window* >();
|
||||
for (int i = 0; i <= ELECTRIC_COUNT; ++i) {
|
||||
|
|
24
screenedge.h
24
screenedge.h
|
@ -48,20 +48,20 @@ public:
|
|||
ScreenEdge();
|
||||
~ScreenEdge();
|
||||
void init();
|
||||
void checkElectricBorder(const QPoint& pos, Time now);
|
||||
void restoreElectricBorderSize(ElectricBorder border);
|
||||
void reserveElectricBorder(ElectricBorder border);
|
||||
void unreserveElectricBorder(ElectricBorder border);
|
||||
void reserveElectricBorderActions(bool reserve);
|
||||
void reserveElectricBorderSwitching(bool reserve);
|
||||
void raiseElectricBorderWindows();
|
||||
void destroyElectricBorders();
|
||||
bool electricBorderEvent(XEvent * e);
|
||||
const QVector< Window* >& screenEdgeWindows();
|
||||
void check(const QPoint& pos, Time now);
|
||||
void restoreSize(ElectricBorder border);
|
||||
void reserve(ElectricBorder border);
|
||||
void unreserve(ElectricBorder border);
|
||||
void reserveActions(bool isToReserve);
|
||||
void reserveDesktopSwitching(bool isToReserve);
|
||||
void raiseWindows();
|
||||
void destroy();
|
||||
bool isEntered(XEvent * e);
|
||||
const QVector< Window* >& windows();
|
||||
public Q_SLOTS:
|
||||
void updateElectricBorders();
|
||||
void update();
|
||||
private:
|
||||
void electricBorderSwitchDesktop(ElectricBorder border, const QPoint& pos);
|
||||
void switchDesktop(ElectricBorder border, const QPoint& pos);
|
||||
|
||||
ElectricBorder m_currentScreenEdge;
|
||||
Window m_screenEdgeWindows[ELECTRIC_COUNT];
|
||||
|
|
|
@ -903,9 +903,9 @@ void Workspace::slotReconfigure()
|
|||
kDebug(1212) << "Workspace::slotReconfigure()";
|
||||
reconfigureTimer.stop();
|
||||
|
||||
m_screenEdge.reserveElectricBorderActions(false);
|
||||
m_screenEdge.reserveActions(false);
|
||||
if (options->electricBorders() == Options::ElectricAlways)
|
||||
m_screenEdge.reserveElectricBorderSwitching(false);
|
||||
m_screenEdge.reserveDesktopSwitching(false);
|
||||
|
||||
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
|
||||
|
||||
|
@ -945,10 +945,10 @@ void Workspace::slotReconfigure()
|
|||
c->triggerDecorationRepaint();
|
||||
}
|
||||
|
||||
m_screenEdge.reserveElectricBorderActions(true);
|
||||
m_screenEdge.reserveActions(true);
|
||||
if (options->electricBorders() == Options::ElectricAlways)
|
||||
m_screenEdge.reserveElectricBorderSwitching(true);
|
||||
m_screenEdge.updateElectricBorders();
|
||||
m_screenEdge.reserveDesktopSwitching(true);
|
||||
m_screenEdge.update();
|
||||
|
||||
if (!compositingSuspended) {
|
||||
setupCompositing();
|
||||
|
@ -999,7 +999,7 @@ void Workspace::slotReinitCompositing()
|
|||
KGlobal::config()->reparseConfiguration();
|
||||
|
||||
// Update any settings that can be set in the compositing kcm.
|
||||
m_screenEdge.updateElectricBorders();
|
||||
m_screenEdge.update();
|
||||
|
||||
// Restart compositing
|
||||
finishCompositing();
|
||||
|
|
Loading…
Reference in New Issue