diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-09-19 14:17:03 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-09-19 14:17:03 +0000 |
commit | 48ead3b93b680035aaf14e3c75ff464d136b8f05 (patch) | |
tree | 78b8d66f24e62a0ff982d463460f3a7ffdb07d0e /kwin/clients | |
parent | ed70a0cfa055fcd8c5243424ca8fb3e61ead2d8b (diff) | |
download | tdebase-48ead3b93b680035aaf14e3c75ff464d136b8f05.tar.gz tdebase-48ead3b93b680035aaf14e3c75ff464d136b8f05.zip |
Fix keramic and b2 window clients
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1254498 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin/clients')
-rw-r--r-- | kwin/clients/b2/b2client.cpp | 25 | ||||
-rw-r--r-- | kwin/clients/b2/b2client.h | 1 | ||||
-rw-r--r-- | kwin/clients/keramik/keramik.cpp | 42 | ||||
-rw-r--r-- | kwin/clients/keramik/keramik.h | 1 |
4 files changed, 56 insertions, 13 deletions
diff --git a/kwin/clients/b2/b2client.cpp b/kwin/clients/b2/b2client.cpp index adb594282..179eee0eb 100644 --- a/kwin/clients/b2/b2client.cpp +++ b/kwin/clients/b2/b2client.cpp @@ -26,6 +26,7 @@ #include <tqtooltip.h> #include <X11/Xlib.h> +#include <X11/Xatom.h> namespace B2 { @@ -432,6 +433,22 @@ void B2Client::init() titlebar->installEventFilter(this); } +bool B2Client::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 B2Client::addButtons(const TQString& s, const TQString tips[], B2Titlebar* tb, TQBoxLayout* titleLayout) { @@ -441,6 +458,7 @@ void B2Client::addButtons(const TQString& s, const TQString tips[], for (unsigned int i = 0; i < s.length(); i++) { switch (s[i].latin1()) { case 'M': // Menu button + if (!isModalSystemNotification()) { if (!button[BtnMenu]) { button[BtnMenu] = new B2Button(this, tb, tips[BtnMenu], Qt::LeftButton | Qt::RightButton); @@ -450,8 +468,10 @@ void B2Client::addButtons(const TQString& s, const TQString tips[], this, TQT_SLOT(menuButtonPressed())); titleLayout->addWidget(button[BtnMenu]); } - break; + } + break; case 'S': // Sticky button + if (!isModalSystemNotification()) { if (!button[BtnSticky]) { button[BtnSticky] = new B2Button(this, tb, tips[BtnSticky]); button[BtnSticky]->setPixmaps(P_PINUP); @@ -461,7 +481,8 @@ void B2Client::addButtons(const TQString& s, const TQString tips[], this, TQT_SLOT(toggleOnAllDesktops())); titleLayout->addWidget(button[BtnSticky]); } - break; + } + break; case 'H': // Help button if (providesContextHelp() && (!button[BtnHelp])) { button[BtnHelp] = new B2Button(this, tb, tips[BtnHelp]); diff --git a/kwin/clients/b2/b2client.h b/kwin/clients/b2/b2client.h index ddddf0c0a..d1062348e 100644 --- a/kwin/clients/b2/b2client.h +++ b/kwin/clients/b2/b2client.h @@ -133,6 +133,7 @@ private: void positionButtons(); void calcHiddenButtons(); bool mustDrawHandle() const; + bool isModalSystemNotification(); enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose, BtnHelp, BtnShade, BtnResize, BtnCount}; diff --git a/kwin/clients/keramik/keramik.cpp b/kwin/clients/keramik/keramik.cpp index 089c7ed69..5edf98230 100644 --- a/kwin/clients/keramik/keramik.cpp +++ b/kwin/clients/keramik/keramik.cpp @@ -33,6 +33,7 @@ #include <tqlabel.h> #include <X11/Xlib.h> +#include <X11/Xatom.h> #include "keramik.h" #include "keramik.moc" @@ -1023,6 +1024,21 @@ void KeramikClient::reset( unsigned long ) } } +bool KeramikClient::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 KeramikClient::addButtons( TQBoxLayout *layout, const TQString &s ) { @@ -1032,22 +1048,26 @@ void KeramikClient::addButtons( TQBoxLayout *layout, const TQString &s ) { // Menu button case 'M' : - if ( !button[MenuButton] ) { - button[MenuButton] = new KeramikButton( this, "menu", MenuButton, i18n("Menu"), Qt::LeftButton|Qt::RightButton ); - connect( button[MenuButton], TQT_SIGNAL( pressed() ), TQT_SLOT( menuButtonPressed() ) ); - layout->addWidget( button[MenuButton] ); + if (!isModalSystemNotification()) { + if ( !button[MenuButton] ) { + button[MenuButton] = new KeramikButton( this, "menu", MenuButton, i18n("Menu"), Qt::LeftButton|Qt::RightButton ); + connect( button[MenuButton], TQT_SIGNAL( pressed() ), TQT_SLOT( menuButtonPressed() ) ); + layout->addWidget( button[MenuButton] ); + } } break; // OnAllDesktops button case 'S' : - if ( !button[OnAllDesktopsButton] ) { - button[OnAllDesktopsButton] = new KeramikButton( this, "on_all_desktops", - OnAllDesktopsButton, isOnAllDesktops()?i18n("Not on all desktops"):i18n("On all desktops") ); - if(isOnAllDesktops()) - button[OnAllDesktopsButton]->toggle(); - connect( button[OnAllDesktopsButton], TQT_SIGNAL( clicked() ), TQT_SLOT( toggleOnAllDesktops() ) ); - layout->addWidget( button[OnAllDesktopsButton] ); + if (!isModalSystemNotification()) { + if ( !button[OnAllDesktopsButton] ) { + button[OnAllDesktopsButton] = new KeramikButton( this, "on_all_desktops", + OnAllDesktopsButton, isOnAllDesktops()?i18n("Not on all desktops"):i18n("On all desktops") ); + if(isOnAllDesktops()) + button[OnAllDesktopsButton]->toggle(); + connect( button[OnAllDesktopsButton], TQT_SIGNAL( clicked() ), TQT_SLOT( toggleOnAllDesktops() ) ); + layout->addWidget( button[OnAllDesktopsButton] ); + } } break; diff --git a/kwin/clients/keramik/keramik.h b/kwin/clients/keramik/keramik.h index e4b1df5f5..8e4a98518 100644 --- a/kwin/clients/keramik/keramik.h +++ b/kwin/clients/keramik/keramik.h @@ -174,6 +174,7 @@ namespace Keramik { inline bool maximizedVertical() const { return ( maximizeMode() & MaximizeVertical ); } + bool isModalSystemNotification(); private slots: void menuButtonPressed(); |