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

Move skipTaskbar from Client to AbstractClient

At the same time the functionality for the "original_skip_taskbar" is
splitted out. This removes the weird API with two boolean arguments to
the set method. Instead there is a dedicated method for the orignal
skip taskbar state which delegates to regular skipTaksbar.
parent 11a3eac0
......@@ -126,6 +126,31 @@ void AbstractClient::doSetSkipPager()
{
}
void AbstractClient::setSkipTaskbar(bool b)
{
int was_wants_tab_focus = wantsTabFocus();
if (b == skipTaskbar())
return;
m_skipTaskbar = b;
doSetSkipTaskbar();
updateWindowRules(Rules::SkipTaskbar);
if (was_wants_tab_focus != wantsTabFocus()) {
FocusChain::self()->update(this, isActive() ? FocusChain::MakeFirst : FocusChain::Update);
}
emit skipTaskbarChanged();
}
void AbstractClient::setOriginalSkipTaskbar(bool b)
{
m_originalSkipTaskbar = rules()->checkSkipTaskbar(b);
setSkipTaskbar(m_originalSkipTaskbar);
}
void AbstractClient::doSetSkipTaskbar()
{
}
void AbstractClient::setIcon(const QIcon &icon)
{
m_icon = icon;
......
......@@ -73,6 +73,10 @@ class AbstractClient : public Toplevel
* Whether the Client is on all desktops. That is desktop is -1.
**/
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops WRITE setOnAllDesktops NOTIFY desktopChanged)
/**
* Indicates that the window should not be included on a taskbar.
**/
Q_PROPERTY(bool skipTaskbar READ skipTaskbar WRITE setSkipTaskbar NOTIFY skipTaskbarChanged)
/**
* Indicates that the window should not be included on a Pager.
**/
......@@ -157,6 +161,15 @@ public:
}
void setSkipSwitcher(bool set);
bool skipTaskbar() const {
return m_skipTaskbar;
}
void setSkipTaskbar(bool set);
void setOriginalSkipTaskbar(bool set);
bool originalSkipTaskbar() const {
return m_originalSkipTaskbar;
}
bool skipPager() const {
return m_skipPager;
}
......@@ -340,6 +353,7 @@ public Q_SLOTS:
Q_SIGNALS:
void fullScreenChanged();
void skipTaskbarChanged();
void skipPagerChanged();
void skipSwitcherChanged();
void iconChanged();
......@@ -407,6 +421,7 @@ protected:
// TODO: remove boolean trap
virtual bool belongsToSameApplication(const AbstractClient *other, bool active_hack) const = 0;
virtual void doSetSkipTaskbar();
virtual void doSetSkipPager();
void updateColorScheme(QString path);
......@@ -415,6 +430,11 @@ private:
void handlePaletteChange();
QSharedPointer<TabBox::TabBoxClientImpl> m_tabBoxClient;
bool m_firstInTabBox = false;
bool m_skipTaskbar = false;
/**
* Unaffected by KWin
**/
bool m_originalSkipTaskbar = false;
bool m_skipPager = false;
bool m_skipSwitcher = false;
QIcon m_icon;
......
......@@ -154,8 +154,6 @@ Client::Client()
shade_mode = ShadeNone;
deleting = false;
fullscreen_mode = FullScreenNone;
skip_taskbar = false;
original_skip_taskbar = false;
hidden = false;
modal = false;
noborder = false;
......@@ -884,7 +882,7 @@ void Client::updateVisibility()
return;
if (hidden && isCurrentTab()) {
info->setState(NET::Hidden, NET::Hidden);
setSkipTaskbar(true, false); // Also hide from taskbar
setSkipTaskbar(true); // Also hide from taskbar
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
internalKeep();
else
......@@ -892,7 +890,7 @@ void Client::updateVisibility()
return;
}
if (isCurrentTab())
setSkipTaskbar(original_skip_taskbar, false); // Reset from 'hidden'
setSkipTaskbar(originalSkipTaskbar()); // Reset from 'hidden'
if (isMinimized()) {
info->setState(NET::Hidden, NET::Hidden);
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
......@@ -1190,22 +1188,9 @@ void Client::killProcess(bool ask, xcb_timestamp_t timestamp)
}
}
void Client::setSkipTaskbar(bool b, bool from_outside)
void Client::doSetSkipTaskbar()
{
int was_wants_tab_focus = wantsTabFocus();
if (from_outside) {
b = rules()->checkSkipTaskbar(b);
original_skip_taskbar = b;
}
if (b == skipTaskbar())
return;
skip_taskbar = b;
info->setState(b ? NET::SkipTaskbar : NET::States(0), NET::SkipTaskbar);
updateWindowRules(Rules::SkipTaskbar);
if (was_wants_tab_focus != wantsTabFocus())
FocusChain::self()->update(this,
isActive() ? FocusChain::MakeFirst : FocusChain::Update);
emit skipTaskbarChanged();
info->setState(skipTaskbar() ? NET::SkipTaskbar : NET::States(0), NET::SkipTaskbar);
}
void Client::doSetSkipPager()
......@@ -1692,7 +1677,7 @@ void Client::setClientShown(bool shown)
return; // nothing to change
hidden = !shown;
if (options->isInactiveTabsSkipTaskbar())
setSkipTaskbar(hidden, false); // TODO: Causes reshuffle of the taskbar
setSkipTaskbar(hidden); // TODO: Causes reshuffle of the taskbar
if (shown) {
map();
takeFocus();
......
......@@ -152,10 +152,6 @@ class Client
* Because of that no changed signal is provided.
**/
Q_PROPERTY(bool wantsInput READ wantsInput)
/**
* Indicates that the window should not be included on a taskbar.
**/
Q_PROPERTY(bool skipTaskbar READ skipTaskbar WRITE setSkipTaskbar NOTIFY skipTaskbarChanged)
/**
* The "Window Tabs" Group this Client belongs to.
**/
......@@ -292,9 +288,6 @@ public:
bool userCanSetNoBorder() const override;
void checkNoBorder();
bool skipTaskbar(bool from_outside = false) const;
void setSkipTaskbar(bool set, bool from_outside = false);
virtual Layer layer() const;
Layer belongsToLayer() const;
void invalidateLayer();
......@@ -553,6 +546,7 @@ protected:
void doSetDesktop(int desktop, int was_desk) override;
void doMinimize() override;
void doSetSkipPager() override;
void doSetSkipTaskbar() override;
private Q_SLOTS:
void delayedSetShortcut();
......@@ -573,7 +567,6 @@ Q_SIGNALS:
void transientChanged();
void modalChanged();
void moveResizedChanged();
void skipTaskbarChanged();
/**
* Emitted whenever the Client's TabGroup changed. That is whenever the Client is moved to
......@@ -749,8 +742,6 @@ private:
ShadeMode shade_mode;
Client *shade_below;
uint deleting : 1; ///< True when doing cleanup and destroying the client
uint skip_taskbar : 1;
uint original_skip_taskbar : 1; ///< Unaffected by KWin
Xcb::MotifHints m_motif;
uint hidden : 1; ///< Forcibly hidden by calling hide()
uint modal : 1; ///< NET::Modal
......@@ -935,11 +926,6 @@ inline Client::QuickTileMode Client::quickTileMode() const
return (Client::QuickTileMode)quick_tile_mode;
}
inline bool Client::skipTaskbar(bool from_outside) const
{
return from_outside ? original_skip_taskbar : skip_taskbar;
}
inline bool Client::isFullScreen() const
{
return fullscreen_mode != FullScreenNone;
......
......@@ -148,7 +148,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
// TODO: Try to obey all state information from info->state()
original_skip_taskbar = skip_taskbar = (info->state() & NET::SkipTaskbar) != 0;
setOriginalSkipTaskbar((info->state() & NET::SkipTaskbar) != 0);
setSkipPager((info->state() & NET::SkipPager) != 0);
readFirstInTabBox(firstInTabBoxCookie);
......@@ -502,7 +502,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
// I.e. obey only forcing rules
setKeepAbove(session->keepAbove);
setKeepBelow(session->keepBelow);
setSkipTaskbar(session->skipTaskbar, true);
setOriginalSkipTaskbar(session->skipTaskbar);
setSkipPager(session->skipPager);
setSkipSwitcher(session->skipSwitcher);
setShade(session->shaded ? ShadeNormal : ShadeNone);
......@@ -536,7 +536,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
setShade(rules()->checkShade(info->state() & NET::Shaded ? ShadeNormal : ShadeNone, !isMapped));
setKeepAbove(rules()->checkKeepAbove(info->state() & NET::KeepAbove, !isMapped));
setKeepBelow(rules()->checkKeepBelow(info->state() & NET::KeepBelow, !isMapped));
setSkipTaskbar(rules()->checkSkipTaskbar(info->state() & NET::SkipTaskbar, !isMapped), true);
setOriginalSkipTaskbar(rules()->checkSkipTaskbar(info->state() & NET::SkipTaskbar, !isMapped));
setSkipPager(rules()->checkSkipPager(info->state() & NET::SkipPager, !isMapped));
setSkipSwitcher(rules()->checkSkipSwitcher(false, !isMapped));
if (info->state() & NET::DemandsAttention)
......
......@@ -266,7 +266,7 @@ void WinInfo::changeState(NET::States state, NET::States mask)
if (mask & NET::KeepBelow)
m_client->setKeepBelow((state & NET::KeepBelow) != 0);
if (mask & NET::SkipTaskbar)
m_client->setSkipTaskbar((state & NET::SkipTaskbar) != 0, true);
m_client->setOriginalSkipTaskbar((state & NET::SkipTaskbar) != 0);
if (mask & NET::SkipPager)
m_client->setSkipPager((state & NET::SkipPager) != 0);
if (mask & NET::DemandsAttention)
......
......@@ -891,7 +891,7 @@ void Client::applyWindowRules()
else
unminimize();
setShade(shadeMode());
setSkipTaskbar(skipTaskbar(), true);
setOriginalSkipTaskbar(skipTaskbar());
setSkipPager(skipPager());
setSkipSwitcher(skipSwitcher());
setKeepAbove(keepAbove());
......
......@@ -147,7 +147,7 @@ void Workspace::storeClient(KConfigGroup &cg, int num, Client *c)
// the config entry is called "staysOnTop" for back. comp. reasons
cg.writeEntry(QStringLiteral("staysOnTop") + n, c->keepAbove());
cg.writeEntry(QStringLiteral("keepBelow") + n, c->keepBelow());
cg.writeEntry(QStringLiteral("skipTaskbar") + n, c->skipTaskbar(true));
cg.writeEntry(QStringLiteral("skipTaskbar") + n, c->originalSkipTaskbar());
cg.writeEntry(QStringLiteral("skipPager") + n, c->skipPager());
cg.writeEntry(QStringLiteral("skipSwitcher") + n, c->skipSwitcher());
// not really just set by user, but name kept for back. comp. reasons
......
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