Fix keramic and b2 window clients

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1254498 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent ed70a0cfa0
commit 48ead3b93b

@ -26,6 +26,7 @@
#include <tqtooltip.h> #include <tqtooltip.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h>
namespace B2 { namespace B2 {
@ -432,6 +433,22 @@ void B2Client::init()
titlebar->installEventFilter(this); 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[], void B2Client::addButtons(const TQString& s, const TQString tips[],
B2Titlebar* tb, TQBoxLayout* titleLayout) 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++) { for (unsigned int i = 0; i < s.length(); i++) {
switch (s[i].latin1()) { switch (s[i].latin1()) {
case 'M': // Menu button case 'M': // Menu button
if (!isModalSystemNotification()) {
if (!button[BtnMenu]) { if (!button[BtnMenu]) {
button[BtnMenu] = new B2Button(this, tb, tips[BtnMenu], button[BtnMenu] = new B2Button(this, tb, tips[BtnMenu],
Qt::LeftButton | Qt::RightButton); Qt::LeftButton | Qt::RightButton);
@ -450,8 +468,10 @@ void B2Client::addButtons(const TQString& s, const TQString tips[],
this, TQT_SLOT(menuButtonPressed())); this, TQT_SLOT(menuButtonPressed()));
titleLayout->addWidget(button[BtnMenu]); titleLayout->addWidget(button[BtnMenu]);
} }
break; }
break;
case 'S': // Sticky button case 'S': // Sticky button
if (!isModalSystemNotification()) {
if (!button[BtnSticky]) { if (!button[BtnSticky]) {
button[BtnSticky] = new B2Button(this, tb, tips[BtnSticky]); button[BtnSticky] = new B2Button(this, tb, tips[BtnSticky]);
button[BtnSticky]->setPixmaps(P_PINUP); button[BtnSticky]->setPixmaps(P_PINUP);
@ -461,7 +481,8 @@ void B2Client::addButtons(const TQString& s, const TQString tips[],
this, TQT_SLOT(toggleOnAllDesktops())); this, TQT_SLOT(toggleOnAllDesktops()));
titleLayout->addWidget(button[BtnSticky]); titleLayout->addWidget(button[BtnSticky]);
} }
break; }
break;
case 'H': // Help button case 'H': // Help button
if (providesContextHelp() && (!button[BtnHelp])) { if (providesContextHelp() && (!button[BtnHelp])) {
button[BtnHelp] = new B2Button(this, tb, tips[BtnHelp]); button[BtnHelp] = new B2Button(this, tb, tips[BtnHelp]);

@ -133,6 +133,7 @@ private:
void positionButtons(); void positionButtons();
void calcHiddenButtons(); void calcHiddenButtons();
bool mustDrawHandle() const; bool mustDrawHandle() const;
bool isModalSystemNotification();
enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose, enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose,
BtnHelp, BtnShade, BtnResize, BtnCount}; BtnHelp, BtnShade, BtnResize, BtnCount};

@ -33,6 +33,7 @@
#include <tqlabel.h> #include <tqlabel.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h>
#include "keramik.h" #include "keramik.h"
#include "keramik.moc" #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 ) void KeramikClient::addButtons( TQBoxLayout *layout, const TQString &s )
{ {
@ -1032,22 +1048,26 @@ void KeramikClient::addButtons( TQBoxLayout *layout, const TQString &s )
{ {
// Menu button // Menu button
case 'M' : case 'M' :
if ( !button[MenuButton] ) { if (!isModalSystemNotification()) {
button[MenuButton] = new KeramikButton( this, "menu", MenuButton, i18n("Menu"), Qt::LeftButton|Qt::RightButton ); if ( !button[MenuButton] ) {
connect( button[MenuButton], TQT_SIGNAL( pressed() ), TQT_SLOT( menuButtonPressed() ) ); button[MenuButton] = new KeramikButton( this, "menu", MenuButton, i18n("Menu"), Qt::LeftButton|Qt::RightButton );
layout->addWidget( button[MenuButton] ); connect( button[MenuButton], TQT_SIGNAL( pressed() ), TQT_SLOT( menuButtonPressed() ) );
layout->addWidget( button[MenuButton] );
}
} }
break; break;
// OnAllDesktops button // OnAllDesktops button
case 'S' : case 'S' :
if ( !button[OnAllDesktopsButton] ) { if (!isModalSystemNotification()) {
button[OnAllDesktopsButton] = new KeramikButton( this, "on_all_desktops", if ( !button[OnAllDesktopsButton] ) {
OnAllDesktopsButton, isOnAllDesktops()?i18n("Not on all desktops"):i18n("On all desktops") ); button[OnAllDesktopsButton] = new KeramikButton( this, "on_all_desktops",
if(isOnAllDesktops()) OnAllDesktopsButton, isOnAllDesktops()?i18n("Not on all desktops"):i18n("On all desktops") );
button[OnAllDesktopsButton]->toggle(); if(isOnAllDesktops())
connect( button[OnAllDesktopsButton], TQT_SIGNAL( clicked() ), TQT_SLOT( toggleOnAllDesktops() ) ); button[OnAllDesktopsButton]->toggle();
layout->addWidget( button[OnAllDesktopsButton] ); connect( button[OnAllDesktopsButton], TQT_SIGNAL( clicked() ), TQT_SLOT( toggleOnAllDesktops() ) );
layout->addWidget( button[OnAllDesktopsButton] );
}
} }
break; break;

@ -174,6 +174,7 @@ namespace Keramik {
inline bool maximizedVertical() const { inline bool maximizedVertical() const {
return ( maximizeMode() & MaximizeVertical ); return ( maximizeMode() & MaximizeVertical );
} }
bool isModalSystemNotification();
private slots: private slots:
void menuButtonPressed(); void menuButtonPressed();

Loading…
Cancel
Save