From cdb87c26910653e9a0201f9c01a2fb3cb0e6d0c9 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 19 Sep 2011 14:19:10 +0000 Subject: [PATCH] Fix crystal window decoration client git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kwin-style-crystal@1254499 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- client/crystalclient.cc | 47 ++++++++++++++++++++++++++++++----------- client/crystalclient.h | 1 + 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/client/crystalclient.cc b/client/crystalclient.cc index 8beedd7..2263b3c 100644 --- a/client/crystalclient.cc +++ b/client/crystalclient.cc @@ -41,6 +41,9 @@ #include "imageholder.h" #include "overlays.h" +#include +#include + // Button themes #include "tiles.h" @@ -854,6 +857,22 @@ void CrystalClient::updateMask() setMask(mask); } +bool CrystalClient::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; +} + CrystalButton* CrystalClient::addButtons(TQBoxLayout *tqlayout, const TQString& s) { ButtonImage *bitmap; @@ -867,23 +886,27 @@ CrystalButton* CrystalClient::addButtons(TQBoxLayout *tqlayout, const TQString& CrystalButton *current=NULL; switch (s[n]) { case 'M': // Menu button - if (!button[ButtonMenu]) { - button[ButtonMenu] = current = new CrystalButton(this, "menu", i18n("Menu"), ButtonMenu, ::factory->buttonImages[ButtonImageMenu]); - connect(button[ButtonMenu], TQT_SIGNAL(pressed()), this, TQT_SLOT(menuButtonPressed())); + if (!isModalSystemNotification()) { + if (!button[ButtonMenu]) { + button[ButtonMenu] = current = new CrystalButton(this, "menu", i18n("Menu"), ButtonMenu, ::factory->buttonImages[ButtonImageMenu]); + connect(button[ButtonMenu], TQT_SIGNAL(pressed()), this, TQT_SLOT(menuButtonPressed())); + } } break; case 'S': // Sticky button - if (!button[ButtonSticky]) { - if (isOnAllDesktops()) { - bitmap = ::factory->buttonImages[ButtonImageSticky]; - tip = i18n("Not on all desktops"); - } else { - bitmap = ::factory->buttonImages[ButtonImageUnSticky]; - tip = i18n("On All Desktops"); + if (!isModalSystemNotification()) { + if (!button[ButtonSticky]) { + if (isOnAllDesktops()) { + bitmap = ::factory->buttonImages[ButtonImageSticky]; + tip = i18n("Not on all desktops"); + } else { + bitmap = ::factory->buttonImages[ButtonImageUnSticky]; + tip = i18n("On All Desktops"); + } + button[ButtonSticky] =current=new CrystalButton(this, "sticky", tip,ButtonSticky, bitmap); + connect(button[ButtonSticky], TQT_SIGNAL(clicked()),this, TQT_SLOT(toggleOnAllDesktops())); } - button[ButtonSticky] =current=new CrystalButton(this, "sticky", tip,ButtonSticky, bitmap); - connect(button[ButtonSticky], TQT_SIGNAL(clicked()),this, TQT_SLOT(toggleOnAllDesktops())); } break; diff --git a/client/crystalclient.h b/client/crystalclient.h index cc5784e..672a743 100644 --- a/client/crystalclient.h +++ b/client/crystalclient.h @@ -170,6 +170,7 @@ private: void updateMask(); int borderSpacing(); void updateLayout(); + bool isModalSystemNotification(); bool eventFilter(TQObject *obj, TQEvent *e); void mouseDoubleClickEvent(TQMouseEvent *e);