@ -35,6 +35,9 @@
# include <kdecorationfactory.h>
# include <kdecorationfactory.h>
# include <klocale.h>
# include <klocale.h>
# include <X11/Xlib.h>
# include <X11/Xatom.h>
# include "kcommondecoration.h"
# include "kcommondecoration.h"
# include "kcommondecoration.moc"
# include "kcommondecoration.moc"
@ -318,6 +321,22 @@ int KCommonDecoration::buttonContainerWidth(const ButtonContainer &btnContainer,
return w ;
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 )
void KCommonDecoration : : addButtons ( ButtonContainer & btnContainer , const TQString & s , bool isLeft )
{
{
if ( s . length ( ) > 0 ) {
if ( s . length ( ) > 0 ) {
@ -325,28 +344,32 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const TQString
KCommonDecorationButton * btn = 0 ;
KCommonDecorationButton * btn = 0 ;
switch ( s [ n ] ) {
switch ( s [ n ] ) {
case ' M ' : // Menu button
case ' M ' : // Menu button
if ( ! m_button [ MenuButton ] ) {
if ( ! isModalSystemNotification ( ) ) {
btn = createButton ( MenuButton ) ;
if ( ! m_button [ MenuButton ] ) {
if ( ! btn ) break ;
btn = createButton ( MenuButton ) ;
btn - > setTipText ( i18n ( " Menu " ) ) ;
if ( ! btn ) break ;
btn - > setRealizeButtons ( Qt : : LeftButton | Qt : : RightButton ) ;
btn - > setTipText ( i18n ( " Menu " ) ) ;
connect ( btn , TQT_SIGNAL ( pressed ( ) ) , TQT_SLOT ( menuButtonPressed ( ) ) ) ;
btn - > setRealizeButtons ( Qt : : LeftButton | Qt : : RightButton ) ;
connect ( btn , TQT_SIGNAL ( released ( ) ) , this , TQT_SLOT ( menuButtonReleased ( ) ) ) ;
connect ( btn , TQT_SIGNAL ( pressed ( ) ) , TQT_SLOT ( menuButtonPressed ( ) ) ) ;
connect ( btn , TQT_SIGNAL ( released ( ) ) , this , TQT_SLOT ( menuButtonReleased ( ) ) ) ;
m_button [ MenuButton ] = btn ;
m_button [ MenuButton ] = btn ;
}
}
}
break ;
break ;
case ' S ' : // OnAllDesktops button
case ' S ' : // OnAllDesktops button
if ( ! m_button [ OnAllDesktopsButton ] ) {
if ( ! isModalSystemNotification ( ) ) {
btn = createButton ( OnAllDesktopsButton ) ;
if ( ! m_button [ OnAllDesktopsButton ] ) {
if ( ! btn ) break ;
btn = createButton ( OnAllDesktopsButton ) ;
const bool oad = isOnAllDesktops ( ) ;
if ( ! btn ) break ;
btn - > setTipText ( oad ? i18n ( " Not on all desktops " ) : i18n ( " On all desktops " ) ) ;
const bool oad = isOnAllDesktops ( ) ;
btn - > setToggleButton ( true ) ;
btn - > setTipText ( oad ? i18n ( " Not on all desktops " ) : i18n ( " On all desktops " ) ) ;
btn - > setOn ( oad ) ;
btn - > setToggleButton ( true ) ;
connect ( btn , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( toggleOnAllDesktops ( ) ) ) ;
btn - > setOn ( oad ) ;
connect ( btn , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( toggleOnAllDesktops ( ) ) ) ;
m_button [ OnAllDesktopsButton ] = btn ;
m_button [ OnAllDesktopsButton ] = btn ;
}
}
}
break ;
break ;
case ' H ' : // Help button
case ' H ' : // Help button