summaryrefslogtreecommitdiffstats
path: root/kwin
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-09-09 02:03:42 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-09-09 02:03:42 +0000
commitf5f0024b74d1bb0eb94937f3dc175d2b682617c2 (patch)
tree3a0ae78b135c013360df101cf7fd8a3374d0e43a /kwin
parent5a63d5945b2f886322c3ed6f5561822bcb1ed6fa (diff)
downloadtdebase-f5f0024b74d1bb0eb94937f3dc175d2b682617c2.tar.gz
tdebase-f5f0024b74d1bb0eb94937f3dc175d2b682617c2.zip
Add new _KDE_WM_MODAL_SYS_NOTIFICATION atom to disable menu/close/on-all-desktops buttons
Improve the appearance of the TDE logout sequence using the new atom git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1252231 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin')
-rw-r--r--kwin/atoms.cpp3
-rw-r--r--kwin/atoms.h1
-rw-r--r--kwin/client.cpp20
-rw-r--r--kwin/client.h1
-rw-r--r--kwin/lib/kcommondecoration.cpp61
-rw-r--r--kwin/lib/kcommondecoration.h1
6 files changed, 68 insertions, 19 deletions
diff --git a/kwin/atoms.cpp b/kwin/atoms.cpp
index 8b838fdec..165a9e72c 100644
--- a/kwin/atoms.cpp
+++ b/kwin/atoms.cpp
@@ -81,6 +81,9 @@ Atoms::Atoms()
atoms[n] = &net_wm_window_decohash;
names[n++] = (char*) "_KDE_WM_WINDOW_DECOHASH";
+
+ atoms[n] = &net_wm_system_modal_notification;
+ names[n++] = (char*) "_KDE_WM_MODAL_SYS_NOTIFICATION";
Atom fake;
atoms[n] = &fake;
diff --git a/kwin/atoms.h b/kwin/atoms.h
index caed47b79..ca9e063af 100644
--- a/kwin/atoms.h
+++ b/kwin/atoms.h
@@ -42,6 +42,7 @@ class Atoms
Atom net_wm_window_shade;
Atom net_wm_window_shapable;
Atom net_wm_window_decohash;
+ Atom net_wm_system_modal_notification;
Atom xdnd_aware;
Atom xdnd_position;
Atom net_frame_extents;
diff --git a/kwin/client.cpp b/kwin/client.cpp
index 3205b9ec7..114300821 100644
--- a/kwin/client.cpp
+++ b/kwin/client.cpp
@@ -499,6 +499,20 @@ void Client::setUserNoBorder( bool set )
updateWindowRules();
}
+bool Client::isModalSystemNotification() const
+ {
+ unsigned char *data = 0;
+ Atom actual;
+ int format, result;
+ unsigned long n, left;
+ result = XGetWindowProperty(qt_xdisplay(), window(), atoms->net_wm_system_modal_notification, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, /*(unsigned char **)*/ &data);
+ if (result == Success && data != None && format == 32 )
+ {
+ return TRUE;
+ }
+ return FALSE;
+ }
+
void Client::updateShape()
{
// workaround for #19644 - tqshaped windows shouldn't have decoration
@@ -603,6 +617,8 @@ bool Client::isMinimizable() const
{
if( isSpecialWindow())
return false;
+ if( isModalSystemNotification())
+ return false;
if( isTransient())
{ // #66868 - let other xmms windows be minimized when the mainwindow is minimized
bool shown_mainwindow = false;
@@ -799,6 +815,8 @@ void Client::setShade( ShadeMode mode )
{
if( !isShadeable())
return;
+ if( isModalSystemNotification())
+ return;
mode = rules()->checkShade( mode );
if( shade_mode == mode )
return;
@@ -1674,6 +1692,8 @@ void Client::sendClientMessage(Window w, Atom a, Atom protocol, long data1, long
*/
bool Client::isCloseable() const
{
+ if( isModalSystemNotification())
+ return false;
return rules()->checkCloseable( motif_may_close && !isSpecialWindow());
}
diff --git a/kwin/client.h b/kwin/client.h
index 4a4ed7025..9ee08efe5 100644
--- a/kwin/client.h
+++ b/kwin/client.h
@@ -57,6 +57,7 @@ class Client : public TQObject, public KDecorationDefines
const Client* transientFor() const;
Client* transientFor();
bool isTransient() const;
+ bool isModalSystemNotification() const;
bool groupTransient() const;
bool wasOriginallyGroupTransient() const;
ClientList mainClients() const; // call once before loop , is not indirect
diff --git a/kwin/lib/kcommondecoration.cpp b/kwin/lib/kcommondecoration.cpp
index d3d43ce12..4a667c7b4 100644
--- a/kwin/lib/kcommondecoration.cpp
+++ b/kwin/lib/kcommondecoration.cpp
@@ -35,6 +35,9 @@
#include <kdecorationfactory.h>
#include <klocale.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
#include "kcommondecoration.h"
#include "kcommondecoration.moc"
@@ -318,6 +321,22 @@ int KCommonDecoration::buttonContainerWidth(const ButtonContainer &btnContainer,
return w;
}
+bool KCommonDecoration::isModalSystemNotification()
+{
+ unsigned char *data = 0;
+ Atom actual;
+ int format, result;
+ unsigned long n, left;
+ Atom kde_wm_system_modal_notification;
+ kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False);
+ result = XGetWindowProperty(qt_xdisplay(), windowId(), kde_wm_system_modal_notification, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, /*(unsigned char **)*/ &data);
+ if (result == Success && data != None && format == 32 )
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const TQString& s, bool isLeft)
{
if (s.length() > 0) {
@@ -325,28 +344,32 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const TQString
KCommonDecorationButton *btn = 0;
switch (s[n]) {
case 'M': // Menu button
- if (!m_button[MenuButton]){
- btn = createButton(MenuButton);
- if (!btn) break;
- btn->setTipText(i18n("Menu") );
- btn->setRealizeButtons(Qt::LeftButton|Qt::RightButton);
- connect(btn, TQT_SIGNAL(pressed()), TQT_SLOT(menuButtonPressed()));
- connect(btn, TQT_SIGNAL(released()), this, TQT_SLOT(menuButtonReleased()));
-
- m_button[MenuButton] = btn;
+ if (!isModalSystemNotification()) {
+ if (!m_button[MenuButton]){
+ btn = createButton(MenuButton);
+ if (!btn) break;
+ btn->setTipText(i18n("Menu") );
+ btn->setRealizeButtons(Qt::LeftButton|Qt::RightButton);
+ connect(btn, TQT_SIGNAL(pressed()), TQT_SLOT(menuButtonPressed()));
+ connect(btn, TQT_SIGNAL(released()), this, TQT_SLOT(menuButtonReleased()));
+
+ m_button[MenuButton] = btn;
+ }
}
break;
case 'S': // OnAllDesktops button
- if (!m_button[OnAllDesktopsButton]){
- btn = createButton(OnAllDesktopsButton);
- if (!btn) break;
- const bool oad = isOnAllDesktops();
- btn->setTipText(oad?i18n("Not on all desktops"):i18n("On all desktops") );
- btn->setToggleButton(true);
- btn->setOn( oad );
- connect(btn, TQT_SIGNAL(clicked()), TQT_SLOT(toggleOnAllDesktops()));
-
- m_button[OnAllDesktopsButton] = btn;
+ if (!isModalSystemNotification()) {
+ if (!m_button[OnAllDesktopsButton]){
+ btn = createButton(OnAllDesktopsButton);
+ if (!btn) break;
+ const bool oad = isOnAllDesktops();
+ btn->setTipText(oad?i18n("Not on all desktops"):i18n("On all desktops") );
+ btn->setToggleButton(true);
+ btn->setOn( oad );
+ connect(btn, TQT_SIGNAL(clicked()), TQT_SLOT(toggleOnAllDesktops()));
+
+ m_button[OnAllDesktopsButton] = btn;
+ }
}
break;
case 'H': // Help button
diff --git a/kwin/lib/kcommondecoration.h b/kwin/lib/kcommondecoration.h
index 8126445ad..93427b248 100644
--- a/kwin/lib/kcommondecoration.h
+++ b/kwin/lib/kcommondecoration.h
@@ -266,6 +266,7 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
typedef TQValueVector <KCommonDecorationButton*> ButtonContainer; ///< If the entry is 0, it's a spacer.
int buttonContainerWidth(const ButtonContainer &btnContainer, bool countHidden = false) const;
+ bool isModalSystemNotification();
void addButtons(ButtonContainer &btnContainer, const TQString& buttons, bool isLeft);
KCommonDecorationButton *m_button[NumButtons];