Support for sticky items in TabBox list
This is needed for Plasma Active's home screen which should always be the first element in the list.
This commit is contained in:
parent
946038f3c0
commit
f644c28180
10 changed files with 52 additions and 0 deletions
|
@ -126,6 +126,9 @@ Atoms::Atoms()
|
||||||
atoms[n] = &kde_net_wm_tab_group;
|
atoms[n] = &kde_net_wm_tab_group;
|
||||||
names[n++] = (char*) "_KDE_NET_WM_TAB_GROUP";
|
names[n++] = (char*) "_KDE_NET_WM_TAB_GROUP";
|
||||||
|
|
||||||
|
atoms[n] = &kde_first_in_window_list;
|
||||||
|
names[n++] = (char*) "_KDE_FIRST_IN_WINDOWLIST";
|
||||||
|
|
||||||
assert(n <= max);
|
assert(n <= max);
|
||||||
|
|
||||||
XInternAtoms(display(), names, n, false, atoms_return);
|
XInternAtoms(display(), names, n, false, atoms_return);
|
||||||
|
|
1
atoms.h
1
atoms.h
|
@ -64,6 +64,7 @@ public:
|
||||||
Atom kde_net_wm_shadow;
|
Atom kde_net_wm_shadow;
|
||||||
Atom kde_net_wm_opaque_region;
|
Atom kde_net_wm_opaque_region;
|
||||||
Atom kde_net_wm_tab_group;
|
Atom kde_net_wm_tab_group;
|
||||||
|
Atom kde_first_in_window_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
19
client.cpp
19
client.cpp
|
@ -127,6 +127,7 @@ Client::Client(Workspace* ws)
|
||||||
, demandAttentionKNotifyTimer(NULL)
|
, demandAttentionKNotifyTimer(NULL)
|
||||||
, m_responsibleForDecoPixmap(false)
|
, m_responsibleForDecoPixmap(false)
|
||||||
, paintRedirector(0)
|
, paintRedirector(0)
|
||||||
|
, m_firstInTabBox(false)
|
||||||
, electricMaximizing(false)
|
, electricMaximizing(false)
|
||||||
, activitiesDefined(false)
|
, activitiesDefined(false)
|
||||||
, needsSessionInteract(false)
|
, needsSessionInteract(false)
|
||||||
|
@ -2393,6 +2394,24 @@ QRect Client::decorationRect() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::updateFirstInTabBox()
|
||||||
|
{
|
||||||
|
// TODO: move into KWindowInfo
|
||||||
|
Atom type;
|
||||||
|
int format, status;
|
||||||
|
unsigned long nitems = 0;
|
||||||
|
unsigned long extra = 0;
|
||||||
|
unsigned char *data = 0;
|
||||||
|
status = XGetWindowProperty(display(), window(), atoms->kde_first_in_window_list, 0, 1, false, atoms->kde_first_in_window_list, &type, &format, &nitems, &extra, &data);
|
||||||
|
if (status == Success && format == 32 && nitems == 1) {
|
||||||
|
setFirstInTabBox(true);
|
||||||
|
} else {
|
||||||
|
setFirstInTabBox(false);
|
||||||
|
}
|
||||||
|
if (data)
|
||||||
|
XFree(data);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#include "client.moc"
|
#include "client.moc"
|
||||||
|
|
8
client.h
8
client.h
|
@ -426,6 +426,13 @@ public:
|
||||||
TabBox::TabBoxClientImpl* tabBoxClient() const {
|
TabBox::TabBoxClientImpl* tabBoxClient() const {
|
||||||
return m_tabBoxClient;
|
return m_tabBoxClient;
|
||||||
}
|
}
|
||||||
|
bool isFirstInTabBox() const {
|
||||||
|
return m_firstInTabBox;
|
||||||
|
}
|
||||||
|
void setFirstInTabBox(bool enable) {
|
||||||
|
m_firstInTabBox = enable;
|
||||||
|
}
|
||||||
|
void updateFirstInTabBox();
|
||||||
|
|
||||||
//sets whether the client should be treated as a SessionInteract window
|
//sets whether the client should be treated as a SessionInteract window
|
||||||
void setSessionInteract(bool needed);
|
void setSessionInteract(bool needed);
|
||||||
|
@ -718,6 +725,7 @@ private:
|
||||||
bool m_responsibleForDecoPixmap;
|
bool m_responsibleForDecoPixmap;
|
||||||
PaintRedirector* paintRedirector;
|
PaintRedirector* paintRedirector;
|
||||||
TabBox::TabBoxClientImpl* m_tabBoxClient;
|
TabBox::TabBoxClientImpl* m_tabBoxClient;
|
||||||
|
bool m_firstInTabBox;
|
||||||
|
|
||||||
bool electricMaximizing;
|
bool electricMaximizing;
|
||||||
QuickTileMode electricMode;
|
QuickTileMode electricMode;
|
||||||
|
|
|
@ -857,6 +857,8 @@ void Client::propertyNotifyEvent(XPropertyEvent* e)
|
||||||
checkActivities();
|
checkActivities();
|
||||||
else if (e->atom == atoms->kde_net_wm_block_compositing)
|
else if (e->atom == atoms->kde_net_wm_block_compositing)
|
||||||
updateCompositeBlocking(true);
|
updateCompositeBlocking(true);
|
||||||
|
else if (e->atom == atoms->kde_first_in_window_list)
|
||||||
|
updateFirstInTabBox();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,7 @@ bool Client::manage(Window w, bool isMapped)
|
||||||
|
|
||||||
original_skip_taskbar = skip_taskbar = (info->state() & NET::SkipTaskbar) != 0;
|
original_skip_taskbar = skip_taskbar = (info->state() & NET::SkipTaskbar) != 0;
|
||||||
skip_pager = (info->state() & NET::SkipPager) != 0;
|
skip_pager = (info->state() & NET::SkipPager) != 0;
|
||||||
|
updateFirstInTabBox();
|
||||||
|
|
||||||
setupCompositing();
|
setupCompositing();
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
||||||
start = m_clientList.first();
|
start = m_clientList.first();
|
||||||
|
|
||||||
m_clientList.clear();
|
m_clientList.clear();
|
||||||
|
QList<TabBoxClient*> stickyClients;
|
||||||
|
|
||||||
switch(tabBox->config().clientSwitchingMode()) {
|
switch(tabBox->config().clientSwitchingMode()) {
|
||||||
case TabBoxConfig::FocusChainSwitching: {
|
case TabBoxConfig::FocusChainSwitching: {
|
||||||
|
@ -190,6 +191,9 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
||||||
m_clientList.prepend(add);
|
m_clientList.prepend(add);
|
||||||
} else
|
} else
|
||||||
m_clientList += add;
|
m_clientList += add;
|
||||||
|
if (add->isFirstInTabBox()) {
|
||||||
|
stickyClients << add;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
c = tabBox->nextClientFocusChain(c);
|
c = tabBox->nextClientFocusChain(c);
|
||||||
|
|
||||||
|
@ -214,6 +218,9 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
||||||
m_clientList.prepend(add);
|
m_clientList.prepend(add);
|
||||||
} else
|
} else
|
||||||
m_clientList += add;
|
m_clientList += add;
|
||||||
|
if (add->isFirstInTabBox()) {
|
||||||
|
stickyClients << add;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (index >= stacking.size() - 1) {
|
if (index >= stacking.size() - 1) {
|
||||||
c = NULL;
|
c = NULL;
|
||||||
|
@ -227,6 +234,10 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (TabBoxClient *c, stickyClients) {
|
||||||
|
m_clientList.removeAll(c);
|
||||||
|
m_clientList.prepend(c);
|
||||||
|
}
|
||||||
if (tabBox->config().isShowDesktop()) {
|
if (tabBox->config().isShowDesktop()) {
|
||||||
TabBoxClient* desktopClient = tabBox->desktopClient();
|
TabBoxClient* desktopClient = tabBox->desktopClient();
|
||||||
if (desktopClient)
|
if (desktopClient)
|
||||||
|
|
|
@ -297,6 +297,11 @@ void TabBoxClientImpl::close()
|
||||||
m_client->closeWindow();
|
m_client->closeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TabBoxClientImpl::isFirstInTabBox() const
|
||||||
|
{
|
||||||
|
return m_client->isFirstInTabBox();
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
* TabBox
|
* TabBox
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
virtual int height() const;
|
virtual int height() const;
|
||||||
virtual bool isCloseable() const;
|
virtual bool isCloseable() const;
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
virtual bool isFirstInTabBox() const;
|
||||||
|
|
||||||
Client* client() const {
|
Client* client() const {
|
||||||
return m_client;
|
return m_client;
|
||||||
|
|
|
@ -401,6 +401,7 @@ public:
|
||||||
virtual int height() const = 0;
|
virtual int height() const = 0;
|
||||||
virtual bool isCloseable() const = 0;
|
virtual bool isCloseable() const = 0;
|
||||||
virtual void close() = 0;
|
virtual void close() = 0;
|
||||||
|
virtual bool isFirstInTabBox() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue