Make the window-tabbing group of a window public via an XProperty.

This commit is contained in:
Anton Kreuzkamp 2011-11-07 20:52:21 +01:00
parent 795fbc643b
commit 98c89bcfd0
7 changed files with 29 additions and 12 deletions

View file

@ -123,6 +123,9 @@ Atoms::Atoms()
atoms[n] = &kde_net_wm_opaque_region;
names[n++] = (char*) "_KDE_NET_WM_OPAQUE_REGION";
atoms[n] = &kde_net_wm_tab_group;
names[n++] = (char*) "_KDE_NET_WM_TAB_GROUP";
assert(n <= max);
XInternAtoms(display(), names, n, false, atoms_return);

View file

@ -63,6 +63,7 @@ public:
Atom kde_net_wm_block_compositing;
Atom kde_net_wm_shadow;
Atom kde_net_wm_opaque_region;
Atom kde_net_wm_tab_group;
};

View file

@ -1834,6 +1834,14 @@ QString Client::caption(bool full) const
return full ? cap_normal + cap_suffix : cap_normal;
}
void Client::setClientGroup(ClientGroup* group)
{
client_group = group;
unsigned long data[1] = {(unsigned long)workspace()->indexOfClientGroup(group)};
XChangeProperty(display(), window(), atoms->kde_net_wm_tab_group, atoms->kde_net_wm_tab_group, 32,
PropModeReplace, (unsigned char*)(data), 1);
}
void Client::dontMoveResize()
{
buttonDown = false;

View file

@ -818,11 +818,6 @@ inline Group* Client::group()
return in_group;
}
inline void Client::setClientGroup(ClientGroup* group)
{
client_group = group;
}
inline ClientGroup* Client::clientGroup() const
{
return client_group;

View file

@ -319,7 +319,7 @@ bool Client::manage(Window w, bool isMapped)
// Create client group if the window will have a decoration
bool dontKeepInArea = false;
if (!noBorder()) {
client_group = NULL;
setClientGroup(NULL);
// Automatically add to previous groups on session restore
if (session && session->clientGroupClient && session->clientGroupClient != this && session->clientGroupClient->clientGroup())
session->clientGroupClient->clientGroup()->add(this, -1, true);
@ -349,7 +349,7 @@ bool Client::manage(Window w, bool isMapped)
}
}
if (!client_group)
client_group = new ClientGroup(this);
setClientGroup(new ClientGroup(this));
}
updateDecoration(false); // Also gravitates

View file

@ -2098,6 +2098,21 @@ void Workspace::moveItemToClientGroup(ClientGroup* oldGroup, int oldIndex,
group->add(c, index, true);
}
void Workspace::removeClientGroup(ClientGroup* group)
{
int index = clientGroups.indexOf(group);
if (index == -1) {
return;
}
clientGroups.removeAt(index);
for (; index < clientGroups.size(); index++) {
foreach (Client *c, clientGroups.at(index)->clients()) {
c->setClientGroup(c->clientGroup());
}
}
}
// To accept "mainwindow#1" to "mainwindow#2"
static QByteArray truncatedWindowRole(QByteArray a)
{

View file

@ -1225,11 +1225,6 @@ inline void Workspace::addClientGroup(ClientGroup* group)
clientGroups.append(group);
}
inline void Workspace::removeClientGroup(ClientGroup* group)
{
clientGroups.removeAll(group);
}
} // namespace
#endif