Commit 1fcd1120 authored by Martin Flöser's avatar Martin Flöser

Move auto-raise handling to AbstractClient

Adds QTimer to AbstractClient and introduces new protected method to
start the timer.
parent 25e3af59
......@@ -193,4 +193,25 @@ void AbstractClient::doSetKeepBelow()
{
}
void AbstractClient::startAutoRaise()
{
delete m_autoRaiseTimer;
m_autoRaiseTimer = new QTimer(this);
connect(m_autoRaiseTimer, &QTimer::timeout, this, &AbstractClient::autoRaise);
m_autoRaiseTimer->setSingleShot(true);
m_autoRaiseTimer->start(options->autoRaiseInterval());
}
void AbstractClient::cancelAutoRaise()
{
delete m_autoRaiseTimer;
m_autoRaiseTimer = nullptr;
}
void AbstractClient::autoRaise()
{
workspace()->raiseClient(this);
cancelAutoRaise();
}
}
......@@ -107,6 +107,8 @@ public:
}
void setKeepBelow(bool);
void cancelAutoRaise();
virtual void updateMouseGrab();
virtual QString caption(bool full = true, bool stripped = false) const = 0;
virtual bool isMinimized() const = 0;
......@@ -117,7 +119,6 @@ public:
virtual bool isFullScreen() const = 0;
// TODO: remove boolean trap
virtual AbstractClient *findModal(bool allow_itself = false) = 0;
virtual void cancelAutoRaise() = 0;
virtual bool isTransient() const;
/**
* Returns true for "special" windows and false for windows which are "normal"
......@@ -227,6 +228,8 @@ protected:
m_firstInTabBox = enable;
}
void setIcon(const QIcon &icon);
void startAutoRaise();
void autoRaise();
/**
* Called from ::setActive once the active value got updated, but before the changed signal
* is emitted.
......@@ -259,6 +262,7 @@ private:
bool m_active = false;
bool m_keepAbove = false;
bool m_keepBelow = false;
QTimer *m_autoRaiseTimer = nullptr;
};
}
......
......@@ -114,7 +114,6 @@ Client::Client()
, m_motif(atoms->motif_wm_hints)
, blocks_compositing(false)
, m_cursor(Qt::ArrowCursor)
, autoRaiseTimer(NULL)
, shadeHoverTimer(NULL)
, delayedMoveResizeTimer(NULL)
, m_colormap(XCB_COLORMAP_NONE)
......@@ -2105,18 +2104,6 @@ void Client::updateAllowedActions(bool force)
}
}
void Client::autoRaise()
{
workspace()->raiseClient(this);
cancelAutoRaise();
}
void Client::cancelAutoRaise()
{
delete autoRaiseTimer;
autoRaiseTimer = 0;
}
void Client::debug(QDebug& stream) const
{
print<QDebug>(stream);
......
......@@ -492,7 +492,6 @@ public:
void toggleShade();
void showContextHelp();
void cancelShadeHoverTimer();
void cancelAutoRaise() override;
void checkActiveModal();
StrutRect strutRect(StrutArea area) const;
StrutRects strutRects() const;
......@@ -604,7 +603,6 @@ public Q_SLOTS:
void updateCaption();
private Q_SLOTS:
void autoRaise();
void shadeHover();
void shadeUnhover();
......@@ -884,7 +882,6 @@ private:
MaximizeMode max_mode;
QRect geom_restore;
QRect geom_fs_restore;
QTimer* autoRaiseTimer;
QTimer* shadeHoverTimer;
QTimer* delayedMoveResizeTimer;
xcb_colormap_t m_colormap;
......
......@@ -957,11 +957,7 @@ void Client::enterNotifyEvent(xcb_enter_notify_event_t *e)
currentPos != workspace()->focusMousePosition() &&
workspace()->topClientOnDesktop(VirtualDesktopManager::self()->current(),
options->isSeparateScreenFocus() ? screen() : -1) != this) {
delete autoRaiseTimer;
autoRaiseTimer = new QTimer(this);
connect(autoRaiseTimer, SIGNAL(timeout()), this, SLOT(autoRaise()));
autoRaiseTimer->setSingleShot(true);
autoRaiseTimer->start(options->autoRaiseInterval());
startAutoRaise();
}
if (isDesktop() || isDock())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment