Commit b64e67ce authored by Frederik Gladhorn's avatar Frederik Gladhorn

Remove disabled TabGroup feature

Summary:
This has been commented out since 2014, I doubt it will come back.
This is a big amount of code, maintenance will be easier without it.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: romangg, graesslin, kwin

Tags: #kwin, #documentation

Differential Revision: https://phabricator.kde.org/D23069
parent a98b8207
......@@ -395,7 +395,6 @@ set(kwin_KDEINIT_SRCS
client_machine.cpp
cursor.cpp
debug_console.cpp
tabgroup.cpp
focuschain.cpp
globalshortcuts.cpp
input.cpp
......
......@@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tabbox.h"
#endif
#include "screenedge.h"
#include "tabgroup.h"
#include "useractions.h"
#include "workspace.h"
......@@ -125,96 +124,11 @@ bool AbstractClient::isTransient() const
return false;
}
void AbstractClient::setTabGroup(TabGroup* group)
{
tab_group = group;
emit tabGroupChanged();
}
void AbstractClient::setClientShown(bool shown)
{
Q_UNUSED(shown)
}
bool AbstractClient::untab(const QRect &toGeometry, bool clientRemoved)
{
TabGroup *group = tab_group;
if (group && group->remove(this)) { // remove sets the tabgroup to "0", therefore the pointer is cached
if (group->isEmpty()) {
delete group;
}
if (clientRemoved)
return true; // there's been a broadcast signal that this client is now removed - don't touch it
setClientShown(!(isMinimized() || isShade()));
bool keepSize = toGeometry.size() == size();
bool changedSize = false;
if (quickTileMode() != QuickTileMode(QuickTileFlag::None)) {
changedSize = true;
setQuickTileMode(QuickTileFlag::None); // if we leave a quicktiled group, assume that the user wants to untile
}
if (toGeometry.isValid()) {
if (maximizeMode() != MaximizeRestore) {
changedSize = true;
maximize(MaximizeRestore); // explicitly calling for a geometry -> unmaximize
}
if (keepSize && changedSize) {
setGeometryRestore(geometry()); // checkWorkspacePosition() invokes it
QPoint cpoint = Cursor::pos();
QPoint point = cpoint;
point.setX((point.x() - toGeometry.x()) * geometryRestore().width() / toGeometry.width());
point.setY((point.y() - toGeometry.y()) * geometryRestore().height() / toGeometry.height());
auto geometry_restore = geometryRestore();
geometry_restore.moveTo(cpoint-point);
setGeometryRestore(geometry_restore);
} else {
setGeometryRestore(toGeometry); // checkWorkspacePosition() invokes it
}
setGeometry(geometryRestore());
checkWorkspacePosition();
}
return true;
}
return false;
}
bool AbstractClient::tabTo(AbstractClient *other, bool behind, bool activate)
{
Q_ASSERT(other && other != this);
if (tab_group && tab_group == other->tabGroup()) { // special case: move inside group
tab_group->move(this, other, behind);
return true;
}
GeometryUpdatesBlocker blocker(this);
const bool wasBlocking = signalsBlocked();
blockSignals(true); // prevent client emitting "retabbed to nowhere" cause it's about to be entabbed the next moment
untab();
blockSignals(wasBlocking);
TabGroup *newGroup = other->tabGroup() ? other->tabGroup() : new TabGroup(other);
if (!newGroup->add(this, other, behind, activate)) {
if (newGroup->count() < 2) { // adding "c" to "to" failed for whatever reason
newGroup->remove(other);
delete newGroup;
}
return false;
}
return true;
}
void AbstractClient::syncTabGroupFor(QString property, bool fromThisClient)
{
if (tab_group)
tab_group->sync(property.toLatin1().data(), fromThisClient ? this : tab_group->current());
}
bool AbstractClient::isCurrentTab() const
{
return !tab_group || tab_group->current() == this;
}
MaximizeMode AbstractClient::requestedMaximizeMode() const
{
return maximizeMode();
......@@ -1195,14 +1109,6 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint
if (!isDesktop()) // No point in changing the opacity of the desktop
setOpacity(qMax(opacity() - 0.1, 0.1));
break;
case Options::MousePreviousTab:
if (tabGroup())
tabGroup()->activatePrev();
break;
case Options::MouseNextTab:
if (tabGroup())
tabGroup()->activateNext();
break;
case Options::MouseClose:
closeWindow();
break;
......@@ -1258,7 +1164,6 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint
updateCursor();
break;
}
case Options::MouseDragTab:
case Options::MouseNothing:
default:
replay = true;
......@@ -1405,10 +1310,6 @@ void AbstractClient::updateGeometryBeforeUpdateBlocking()
m_geometryBeforeUpdateBlocking = geometry();
}
void AbstractClient::updateTabGroupStates(TabGroup::States)
{
}
void AbstractClient::doMove(int, int)
{
}
......@@ -1742,8 +1643,8 @@ bool AbstractClient::processDecorationButtonPress(QMouseEvent *event, bool ignor
com = active ? options->commandActiveTitlebar3() : options->commandInactiveTitlebar3();
if (event->button() == Qt::LeftButton
&& com != Options::MouseOperationsMenu // actions where it's not possible to get the matching
&& com != Options::MouseMinimize // mouse release event
&& com != Options::MouseDragTab) {
&& com != Options::MouseMinimize) // mouse release event
{
setMoveResizePointerMode(mousePosition());
setMoveResizePointerButtonDown(true);
setMoveOffset(event->pos());
......@@ -1763,7 +1664,6 @@ bool AbstractClient::processDecorationButtonPress(QMouseEvent *event, bool ignor
com == Options::MouseActivate ||
com == Options::MouseActivateRaiseAndPassClick ||
com == Options::MouseActivateAndPassClick ||
com == Options::MouseDragTab ||
com == Options::MouseNothing);
}
......
......@@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "toplevel.h"
#include "options.h"
#include "rules.h"
#include "tabgroup.h"
#include "cursor.h"
#include <memory>
......@@ -75,12 +74,6 @@ class KWIN_EXPORT AbstractClient : public Toplevel
*/
Q_PROPERTY(bool fullScreenable READ isFullScreenable)
/**
* Whether this Client is the currently visible Client in its Client Group (Window Tabs).
* For change connect to the visibleChanged signal on the Client's Group.
*/
Q_PROPERTY(bool isCurrentTab READ isCurrentTab)
/**
* Whether this Client is active or not. Use Workspace::activateClient() to activate a Client.
* @see Workspace::activateClient
......@@ -318,11 +311,6 @@ class KWIN_EXPORT AbstractClient : public Toplevel
*/
Q_PROPERTY(bool unresponsive READ unresponsive NOTIFY unresponsiveChanged)
/**
* The "Window Tabs" Group this Client belongs to.
*/
Q_PROPERTY(KWin::TabGroup* tabGroup READ tabGroup NOTIFY tabGroupChanged SCRIPTABLE false)
/**
* The color scheme set on this client
* Absolute file path, or name of palette in the user's config directory following KColorSchemes format.
......@@ -494,36 +482,9 @@ public:
return m_minimized;
}
virtual void setFullScreen(bool set, bool user = true) = 0;
// Tabbing functions
Q_INVOKABLE inline bool tabBefore(AbstractClient *other, bool activate) { return tabTo(other, false, activate); }
Q_INVOKABLE inline bool tabBehind(AbstractClient *other, bool activate) { return tabTo(other, true, activate); }
/**
* Syncs the *dynamic* @p property @p fromThisClient or the currentTab() to
* all members of the tabGroup() (if there is one)
*
* eg. if you call:
* @code
* client->setProperty("kwin_tiling_floats", true);
* client->syncTabGroupFor("kwin_tiling_floats", true)
* @endcode
* all clients in this tabGroup will have property("kwin_tiling_floats").toBool() == true
*
* WARNING: non dynamic properties are ignored - you're not supposed to alter/update such explicitly
*/
Q_INVOKABLE void syncTabGroupFor(QString property, bool fromThisClient = false);
TabGroup *tabGroup() const;
/**
* Set tab group - this is to be invoked by TabGroup::add/remove(client) and NO ONE ELSE
*/
void setTabGroup(TabGroup* group);
virtual void setClientShown(bool shown);
Q_INVOKABLE bool untab(const QRect &toGeometry = QRect(), bool clientRemoved = false);
/**
* When a click is done in the decoration and it calls the group
* to change the visible client it starts to move-resize the new
* client, this function stops it.
*/
bool isCurrentTab() const;
virtual QRect geometryRestore() const = 0;
/**
* The currently applied maximize mode
......@@ -917,11 +878,6 @@ Q_SIGNALS:
void hasApplicationMenuChanged(bool);
void applicationMenuActiveChanged(bool);
void unresponsiveChanged(bool);
/**
* Emitted whenever the Client's TabGroup changed. That is whenever the Client is moved to
* another group, but not when a Client gets added or removed to the Client's ClientGroup.
*/
void tabGroupChanged();
protected:
AbstractClient();
......@@ -1053,13 +1009,6 @@ protected:
*/
void addRepaintDuringGeometryUpdates();
/**
* Convenient method to update the TabGroup states if there is one present.
* Marked as virtual as TabGroup does not yet handle AbstractClient, but only
* subclasses of AbstractClient. Given that the default implementation does nothing.
*/
virtual void updateTabGroupStates(TabGroup::States states);
/**
* @returns whether the Client is currently in move resize mode
*/
......@@ -1303,7 +1252,6 @@ private:
QKeySequence _shortcut;
WindowRules m_rules;
TabGroup* tab_group = nullptr;
static bool s_haveResizeEffect;
};
......@@ -1371,11 +1319,6 @@ inline void AbstractClient::setPendingGeometryUpdate(PendingGeometry_t update)
m_pendingGeometryUpdate = update;
}
inline TabGroup* AbstractClient::tabGroup() const
{
return tab_group;
}
}
Q_DECLARE_METATYPE(KWin::AbstractClient*)
......
......@@ -388,8 +388,6 @@ void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
}
flags &= ~ActivityFocus;
}
if (c->tabGroup() && c->tabGroup()->current() != c)
c->tabGroup()->setCurrent(c);
if (!c->isShown(true)) { // shouldn't happen, call activateClient() if needed
qCWarning(KWIN_CORE) << "takeActivity: not shown" ;
return;
......@@ -466,15 +464,6 @@ bool Workspace::activateNextClient(AbstractClient* c)
AbstractClient* get_focus = NULL;
// precedence on keeping the current tabgroup active. to the user that's the same window
if (c && c->tabGroup() && c->isShown(false)) {
if (c == c->tabGroup()->current())
c->tabGroup()->activateNext();
get_focus = c->tabGroup()->current();
if (get_focus == c) // single tab case - should not happen
get_focus = NULL;
}
const int desktop = VirtualDesktopManager::self()->current();
if (!get_focus && showingDesktop())
......
......@@ -60,7 +60,6 @@ Atoms::Atoms()
, net_wm_sync_request_counter(QByteArrayLiteral("_NET_WM_SYNC_REQUEST_COUNTER"))
, net_wm_sync_request(QByteArrayLiteral("_NET_WM_SYNC_REQUEST"))
, kde_net_wm_shadow(QByteArrayLiteral("_KDE_NET_WM_SHADOW"))
, kde_net_wm_tab_group(QByteArrayLiteral("_KDE_NET_WM_TAB_GROUP"))
, kde_first_in_window_list(QByteArrayLiteral("_KDE_FIRST_IN_WINDOWLIST"))
, kde_color_sheme(QByteArrayLiteral("_KDE_NET_WM_COLOR_SCHEME"))
, kde_skip_close_animation(QByteArrayLiteral("_KDE_NET_WM_SKIP_CLOSE_ANIMATION"))
......
......@@ -69,7 +69,6 @@ public:
Xcb::Atom net_wm_sync_request_counter;
Xcb::Atom net_wm_sync_request;
Xcb::Atom kde_net_wm_shadow;
Xcb::Atom kde_net_wm_tab_group;
Xcb::Atom kde_first_in_window_list;
Xcb::Atom kde_color_sheme;
Xcb::Atom kde_skip_close_animation;
......
......@@ -170,17 +170,6 @@ Client::Client()
}
});
connect(this, &Client::tabGroupChanged, this,
[this] {
auto group = tabGroup();
if (group) {
unsigned long data[] = {qHash(group)}; //->id();
m_client.changeProperty(atoms->kde_net_wm_tab_group, XCB_ATOM_CARDINAL, 32, 1, data);
}
else
m_client.deleteProperty(atoms->kde_net_wm_tab_group);
});
// SELI TODO: Initialize xsizehints??
}
......@@ -257,8 +246,7 @@ void Client::releaseWindow(bool on_shutdown)
// Only when the window is being unmapped, not when closing down KWin (NETWM sections 5.5,5.7)
info->setDesktop(0);
info->setState(0, info->state()); // Reset all state flags
} else
untab();
}
xcb_connection_t *c = connection();
m_client.deleteProperty(atoms->kde_net_wm_user_creation_time);
m_client.deleteProperty(atoms->net_frame_extents);
......@@ -614,7 +602,7 @@ bool Client::noBorder() const
bool Client::userCanSetNoBorder() const
{
return !isFullScreen() && !isShade() && !tabGroup();
return !isFullScreen() && !isShade();
}
void Client::setNoBorder(bool set)
......@@ -774,9 +762,6 @@ void Client::doMinimize()
updateVisibility();
updateAllowedActions();
workspace()->updateMinimizedOfTransients(this);
// Update states of all other windows in this group
if (tabGroup())
tabGroup()->updateStates(this, TabGroup::Minimized);
}
QRect Client::iconGeometry() const
......@@ -826,10 +811,6 @@ void Client::setShade(ShadeMode mode)
decoration->borders(border_left, border_right, border_top, border_bottom);
#endif
// Update states of all other windows in this group
if (tabGroup())
tabGroup()->updateStates(this, TabGroup::Shaded);
if (was_shade == isShade()) {
// Decoration may want to update after e.g. hover-shade changes
emit shadeChanged();
......@@ -912,9 +893,7 @@ void Client::shadeHover()
void Client::shadeUnhover()
{
if (!tabGroup() || tabGroup()->current() == this ||
tabGroup()->current()->shadeMode() == ShadeNormal)
setShade(ShadeNormal);
setShade(ShadeNormal);
cancelShadeHoverTimer();
}
......@@ -934,7 +913,7 @@ void Client::updateVisibility()
{
if (deleting)
return;
if (hidden && isCurrentTab()) {
if (hidden) {
info->setState(NET::Hidden, NET::Hidden);
setSkipTaskbar(true); // Also hide from taskbar
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
......@@ -943,8 +922,7 @@ void Client::updateVisibility()
internalHide();
return;
}
if (isCurrentTab())
setSkipTaskbar(originalSkipTaskbar()); // Reset from 'hidden'
setSkipTaskbar(originalSkipTaskbar()); // Reset from 'hidden'
if (isMinimized()) {
info->setState(NET::Hidden, NET::Hidden);
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
......@@ -1270,10 +1248,6 @@ void Client::doSetDesktop(int desktop, int was_desk)
Q_UNUSED(desktop)
Q_UNUSED(was_desk)
updateVisibility();
// Update states of all other windows in this group
if (tabGroup())
tabGroup()->updateStates(this, TabGroup::Desktop);
}
/**
......@@ -1377,10 +1351,6 @@ void Client::updateActivities(bool includeTransients)
FocusChain::self()->update(this, FocusChain::MakeFirst);
updateVisibility();
updateWindowRules(Rules::Activity);
// Update states of all other windows in this group
if (tabGroup())
tabGroup()->updateStates(this, TabGroup::Activity);
}
/**
......@@ -1596,8 +1566,6 @@ void Client::setClientShown(bool shown)
if (shown != hidden)
return; // nothing to change
hidden = !shown;
if (options->isInactiveTabsSkipTaskbar())
setSkipTaskbar(hidden); // TODO: Causes reshuffle of the taskbar
if (shown) {
map();
takeFocus();
......@@ -1606,8 +1574,7 @@ void Client::setClientShown(bool shown)
} else {
unmap();
// Don't move tabs to the end of the list when another tab get's activated
if (isCurrentTab())
FocusChain::self()->update(this, FocusChain::MakeLast);
FocusChain::self()->update(this, FocusChain::MakeLast);
addWorkspaceRepaint(visibleRect());
}
}
......@@ -2106,13 +2073,6 @@ bool Client::belongsToSameApplication(const AbstractClient *other, SameApplicati
return Client::belongToSameApplication(this, c2, checks);
}
void Client::updateTabGroupStates(TabGroup::States states)
{
if (auto t = tabGroup()) {
t->updateStates(this, states);
}
}
QSize Client::resizeIncrements() const
{
return m_geometryHints.resizeIncrements();
......
......@@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// kwin
#include "options.h"
#include "rules.h"
#include "tabgroup.h"
#include "abstract_client.h"
#include "xcbutils.h"
// Qt
......@@ -346,8 +345,6 @@ private:
bool buttonReleaseEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root);
bool motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x_root, int y_root);
Client* findAutogroupCandidate() const;
protected:
void debug(QDebug& stream) const override;
void addDamage(const QRegion &damage) override;
......@@ -362,7 +359,6 @@ protected:
void doSetSkipSwitcher() override;
bool belongsToDesktop() const override;
void setGeometryRestore(const QRect &geo) override;
void updateTabGroupStates(TabGroup::States states) override;
void doMove(int x, int y) override;
bool doStartMoveResize() override;
void doPerformMoveResize() override;
......@@ -596,8 +592,7 @@ inline Group* Client::group()
inline bool Client::isShown(bool shaded_is_shown) const
{
return !isMinimized() && (!isShade() || shaded_is_shown) && !hidden &&
(!tabGroup() || tabGroup()->current() == this);
return !isMinimized() && (!isShade() || shaded_is_shown) && !hidden;
}
inline bool Client::isHiddenInternal() const
......
......@@ -43,7 +43,6 @@ Deleted::Deleted()
, m_minimized(false)
, m_modal(false)
, m_wasClient(false)
, m_wasCurrentTab(true)
, m_decorationRenderer(nullptr)
, m_fullscreen(false)
, m_keepAbove(false)
......@@ -131,7 +130,6 @@ void Deleted::copyToDeleted(Toplevel* c)
connect(c, &AbstractClient::windowClosed, this, &Deleted::mainClientClosed);
}
m_fullscreen = client->isFullScreen();
m_wasCurrentTab = client->isCurrentTab();
m_keepAbove = client->keepAbove();
m_keepBelow = client->keepBelow();
m_caption = client->caption();
......
......@@ -87,9 +87,6 @@ public:
return m_fullscreen;
}
bool isCurrentTab() const {
return m_wasCurrentTab;
}
bool keepAbove() const {
return m_keepAbove;
}
......@@ -220,7 +217,6 @@ private:
bool m_modal;
QList<AbstractClient*> m_mainClients;
bool m_wasClient;
bool m_wasCurrentTab;
Decoration::Renderer *m_decorationRenderer;
double m_opacity;
NET::WindowType m_type = NET::Unknown;
......
......@@ -42,8 +42,7 @@ you can configure how titlebars and windows react to
mouse clicks. <guilabel>Moving</guilabel> allows you to configure how
windows move and place themselves when started. The
<guilabel>Advanced</guilabel> options cover some specialized options
like <quote>window tabbing</quote> and <quote>window
shading</quote>.
like <quote>window shading</quote>.
</para>
<note>
......@@ -279,7 +278,7 @@ restores the window to its normal size.
<para>Similar options are available for <guilabel>Wheel event</guilabel>.
</para>
<!--FIXME Raise/Lower Shade/Unshade Maximize/Restore Keep Above/Below Move to Previous/Next Desktop Change Opacity Switch to Window Tab to the Left/Reght -->
<!--FIXME Raise/Lower Shade/Unshade Maximize/Restore Keep Above/Below Move to Previous/Next Desktop Change Opacity -->
<tip>
<para>
......@@ -340,7 +339,7 @@ are already on top.
</varlistentry>
<!--FIXME missing:
Minimize, Shade, Close, Start Window Tab Drag
Minimize, Shade, Close
-->
<varlistentry>
......@@ -531,7 +530,7 @@ Increase Opacity + Decrease Opacity
<!--FIXME
Mouse Wheel has different choices:
Raise/Lower, Shade/Unshade, Maximize/Restore, Keep Above/Below,
Move to Previous/Next Desktop, Change Opacity, Switch to Window Tab to the Left/Right
Move to Previous/Next Desktop, Change Opacity
Nothing
-->
......@@ -639,19 +638,6 @@ the spinbox to configure the delay un-shading.
</variablelist>
<variablelist>
<title>Window Tabbing</title>
<varlistentry>
<term><guilabel>Automatically group similar windows</guilabel></term>
<listitem><para>When turned on attempt to automatically detect when a newly opened window is
related to an existing one and place them in the same window group.</para></listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Switch to automatically grouped windows immediately</guilabel></term>
<listitem><para>When turned on immediately switch to any new window tabs that were
automatically added to the current group.</para></listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Placement</guilabel></term>
......
......@@ -561,8 +561,7 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
Client *c = static_cast<Client*>(t);
disconnect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotClientShown);
setupClientConnections(c);
if (!c->tabGroup()) // the "window" has already been there
emit windowAdded(c->effectWindow());
emit windowAdded(c->effectWindow());
}
void EffectsHandlerImpl::slotShellClientShown(Toplevel *t)
......@@ -1856,7 +1855,6 @@ TOPLEVEL_HELPER(bool, isOutline, isOutline)
CLIENT_HELPER_WITH_DELETED(bool, isMinimized, isMinimized, false)
CLIENT_HELPER_WITH_DELETED(bool, isModal, isModal, false)
CLIENT_HELPER_WITH_DELETED(bool, isFullScreen, isFullScreen, false)
CLIENT_HELPER_WITH_DELETED(bool, isCurrentTab, isCurrentTab, false)
CLIENT_HELPER_WITH_DELETED(bool, keepAbove, keepAbove, false)
CLIENT_HELPER_WITH_DELETED(bool, keepBelow, keepBelow, false)
CLIENT_HELPER_WITH_DELETED(QString, caption, caption, QString());
......@@ -1864,6 +1862,12 @@ CLIENT_HELPER_WITH_DELETED(QVector<uint>, desktops, x11DesktopIds, QVector<uint>
#undef CLIENT_HELPER_WITH_DELETED
// legacy from tab groups, can be removed when no effects use this any more.
bool EffectWindowImpl::isCurrentTab() const
{
return true;
}
QString EffectWindowImpl::windowClass() const
{
return toplevel->resourceName() + QLatin1Char(' ') + toplevel->resourceClass();
......
......@@ -1436,10 +1436,6 @@ bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const
return false;
}
if (!w->isCurrentTab()) {
return false;