Remove KWin::Notifications

Overall all notifications except compositing suspended by DBus were
configured by default to not have any action. This means all the time we
emit a notification we keep DBus and KDED busy for nothing.

All the cases when a notification is triggered ire also exported to
KWin scripting, so if one really needs to handle something in case a
window is moved, it could be done through a KWin script with much more
context about the event.

REVIEW: 110113
BUG: 258097
FIXED-IN: 4.11
This commit is contained in:
Martin Gräßlin 2013-04-21 13:31:13 +02:00
parent a836612a92
commit 6d0d9cfe43
10 changed files with 1 additions and 143 deletions

View file

@ -118,7 +118,6 @@ set(kwin_KDEINIT_SRCS
group.cpp
bridge.cpp
manage.cpp
notifications.cpp
overlaywindow.cpp
activation.cpp
useractions.cpp

View file

@ -40,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kstringhandler.h>
#include <KDE/KLocalizedString>
#include "notifications.h"
#include "atoms.h"
#include "group.h"
#include "rules.h"

View file

@ -52,7 +52,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "focuschain.h"
#include "workspace.h"
#include "atoms.h"
#include "notifications.h"
#include "rules.h"
#include "shadow.h"
#include "deleted.h"

View file

@ -50,6 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kactioncollection.h>
#include <KDE/KGlobal>
#include <KDE/KLocalizedString>
#include <KDE/KNotification>
#include <xcb/composite.h>
#include <xcb/damage.h>

View file

@ -37,7 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwindowsystem.h>
#include "placement.h"
#include "notifications.h"
#include "geometrytip.h"
#include "rules.h"
#include "screens.h"

View file

@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "activities.h"
#endif
#include "cursor.h"
#include "notifications.h"
#include <QX11Info>
#include "rules.h"
#include "group.h"

View file

@ -1,78 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "notifications.h"
#include <knotification.h>
#include "client.h"
namespace KWin
{
static bool forgetIt = false;
QList< Notify::EventData > Notify::pending_events;
bool Notify::raise(Event e, const QString& message, Client* c)
{
if (forgetIt)
return false; // no connection was possible, don't try each time
QString event;
KNotification::NotificationFlags flags = KNotification::CloseOnTimeout;
switch(e) {
case CompositingSuspendedDbus:
event = "compositingsuspendeddbus";
break;
default:
break;
}
if (event.isNull())
return false;
// There may be a deadlock if KNotify event is sent while KWin has X grabbed.
// If KNotify is not running, KLauncher may do X requests (startup notification, whatever)
// that will block it. And KNotifyClient waits for the launch to succeed, which means
// KLauncher waits for X and KWin waits for KLauncher. So postpone events in such case.
if (grabbedXServer()) {
EventData data;
data.event = event;
data.message = message;
data.window = c ? c->window() : 0;
data.flags = flags;
pending_events.append(data);
return true;
}
return KNotification::event(event, message, QPixmap(), NULL /* TODO c ? c->window() : 0*/, flags);
}
void Notify::sendPendingEvents()
{
while (!pending_events.isEmpty()) {
EventData data = pending_events.first();
pending_events.pop_front();
if (!forgetIt)
KNotification::event(data.event, data.message, QPixmap(), NULL /* TODO data.window*/, data.flags);
}
}
} // namespace

View file

@ -1,57 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_NOTIFICATIONS_H
#define KWIN_NOTIFICATIONS_H
#include <knotification.h>
#include <stdlib.h>
#include <QString>
#include <QList>
namespace KWin
{
class Client;
class Notify
{
public:
enum Event {
CompositingSuspendedDbus
};
static bool raise(Event, const QString& message = QString(), Client* c = NULL);
static void sendPendingEvents();
private:
struct EventData {
QString event;
QString message;
long window;
KNotification::NotificationFlags flags;
};
static QList< EventData > pending_events;
};
} // namespace
#endif

View file

@ -50,7 +50,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "atoms.h"
#include "cursor.h"
#include "notifications.h"
#include "workspace.h"
#endif
@ -286,7 +285,6 @@ void ungrabXServer()
if (--server_grab_count == 0) {
XUngrabServer(display());
XFlush(display());
Notify::sendPendingEvents();
}
}

View file

@ -55,7 +55,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cursor.h"
#include "killwindow.h"
#include "placement.h"
#include "notifications.h"
#include "outline.h"
#include "group.h"
#include "rules.h"