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
v3.5.13-sru
tpearson 13 years ago
parent 5a63d5945b
commit f5f0024b74

@ -579,7 +579,7 @@ extern "C" int _IceTransNoListen(const char * protocol);
#endif #endif
KSMServer::KSMServer( const TQString& windowManager, bool _only_local ) KSMServer::KSMServer( const TQString& windowManager, bool _only_local )
: DCOPObject("ksmserver"), sessionGroup( "" ) : DCOPObject("ksmserver"), sessionGroup( "" ), shutdownNotifierIPDlg(0)
{ {
the_server = this; the_server = this;
clean = false; clean = false;

@ -174,6 +174,8 @@ private:
void saveCurrentSession(); void saveCurrentSession();
void saveCurrentSessionAs( TQString ); void saveCurrentSessionAs( TQString );
TQWidget* shutdownNotifierIPDlg;
private: private:
TQPtrList<KSMListener> listener; TQPtrList<KSMListener> listener;
TQPtrList<KSMClient> clients; TQPtrList<KSMClient> clients;

@ -188,7 +188,7 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm,
if (showFancyLogout) { if (showFancyLogout) {
KSMShutdownIPFeedback::showit(); // hide the UGLY logout process from the user KSMShutdownIPFeedback::showit(); // hide the UGLY logout process from the user
KSMShutdownIPDlg::showShutdownIP(); shutdownNotifierIPDlg = KSMShutdownIPDlg::showShutdownIP();
} }
if ( saveSession ) if ( saveSession )
@ -553,6 +553,10 @@ void KSMServer::killWM()
{ {
state = KillingWM; state = KillingWM;
bool iswm = false; bool iswm = false;
if (shutdownNotifierIPDlg) {
shutdownNotifierIPDlg->close();
shutdownNotifierIPDlg=0;
}
for ( KSMClient* c = clients.first(); c; c = clients.next() ) { for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
if( isWM( c )) { if( isWM( c )) {
iswm = true; iswm = true;

@ -516,10 +516,11 @@ void KSMShutdownFeedback::slotPaintEffect()
KSMShutdownIPFeedback * KSMShutdownIPFeedback::s_pSelf = 0L; KSMShutdownIPFeedback * KSMShutdownIPFeedback::s_pSelf = 0L;
KSMShutdownIPFeedback::KSMShutdownIPFeedback() KSMShutdownIPFeedback::KSMShutdownIPFeedback()
: TQWidget( 0L, "feedbackipwidget", Qt::WType_Dialog | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ), m_timeout(0) : TQWidget( 0L, "feedbackipwidget", Qt::WType_Dialog | Qt::WStyle_StaysOnTop ), m_timeout(0)
{ {
setShown(false); setShown(false);
setWindowState(WindowFullScreen);
// Try to get the root pixmap // Try to get the root pixmap
system("krootbacking &"); system("krootbacking &");
@ -1093,7 +1094,7 @@ bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sd
return result; return result;
} }
void KSMShutdownIPDlg::showShutdownIP() TQWidget* KSMShutdownIPDlg::showShutdownIP()
{ {
kapp->enableStyles(); kapp->enableStyles();
KSMShutdownIPDlg* l = new KSMShutdownIPDlg( 0 ); KSMShutdownIPDlg* l = new KSMShutdownIPDlg( 0 );
@ -1110,17 +1111,26 @@ void KSMShutdownIPDlg::showShutdownIP()
timer->start( 0, TRUE ); timer->start( 0, TRUE );
kapp->disableStyles(); kapp->disableStyles();
return l;
} }
KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent) KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
// : TQDialog( 0, "", TRUE, Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_NoBorder | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WDestructiveClose ) : TQDialog( 0, "", TRUE, Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_Title | Qt::WDestructiveClose )
: TQDialog( 0, "", TRUE, Qt::WStyle_Customize | Qt::WType_Popup | Qt::WStyle_NoBorder | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM | Qt::WDestructiveClose )
{ {
// Signal that this window should stay on top of everything else
setModal(true);
// Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False);
XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
TQVBoxLayout* vbox = new TQVBoxLayout( this ); TQVBoxLayout* vbox = new TQVBoxLayout( this );
TQFrame* frame = new TQFrame( this ); TQFrame* frame = new TQFrame( this );
frame->setFrameStyle( TQFrame::StyledPanel | TQFrame::Raised ); frame->setFrameStyle( TQFrame::NoFrame );
frame->setLineWidth( tqstyle().tqpixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) ); frame->setLineWidth( tqstyle().tqpixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) );
// we need to set the minimum size for the window // we need to set the minimum size for the window
frame->setMinimumWidth(400); frame->setMinimumWidth(400);

@ -144,7 +144,7 @@ class KSMShutdownIPDlg : public TQDialog
Q_OBJECT Q_OBJECT
public: public:
static void showShutdownIP(); static TQWidget* showShutdownIP();
protected: protected:
~KSMShutdownIPDlg(); ~KSMShutdownIPDlg();

@ -82,6 +82,9 @@ Atoms::Atoms()
atoms[n] = &net_wm_window_decohash; atoms[n] = &net_wm_window_decohash;
names[n++] = (char*) "_KDE_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; Atom fake;
atoms[n] = &fake; atoms[n] = &fake;
names[n++] = (char *) "_DT_SM_WINDOW_INFO"; names[n++] = (char *) "_DT_SM_WINDOW_INFO";

@ -42,6 +42,7 @@ class Atoms
Atom net_wm_window_shade; Atom net_wm_window_shade;
Atom net_wm_window_shapable; Atom net_wm_window_shapable;
Atom net_wm_window_decohash; Atom net_wm_window_decohash;
Atom net_wm_system_modal_notification;
Atom xdnd_aware; Atom xdnd_aware;
Atom xdnd_position; Atom xdnd_position;
Atom net_frame_extents; Atom net_frame_extents;

@ -499,6 +499,20 @@ void Client::setUserNoBorder( bool set )
updateWindowRules(); 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() void Client::updateShape()
{ {
// workaround for #19644 - tqshaped windows shouldn't have decoration // workaround for #19644 - tqshaped windows shouldn't have decoration
@ -603,6 +617,8 @@ bool Client::isMinimizable() const
{ {
if( isSpecialWindow()) if( isSpecialWindow())
return false; return false;
if( isModalSystemNotification())
return false;
if( isTransient()) if( isTransient())
{ // #66868 - let other xmms windows be minimized when the mainwindow is minimized { // #66868 - let other xmms windows be minimized when the mainwindow is minimized
bool shown_mainwindow = false; bool shown_mainwindow = false;
@ -799,6 +815,8 @@ void Client::setShade( ShadeMode mode )
{ {
if( !isShadeable()) if( !isShadeable())
return; return;
if( isModalSystemNotification())
return;
mode = rules()->checkShade( mode ); mode = rules()->checkShade( mode );
if( shade_mode == mode ) if( shade_mode == mode )
return; return;
@ -1674,6 +1692,8 @@ void Client::sendClientMessage(Window w, Atom a, Atom protocol, long data1, long
*/ */
bool Client::isCloseable() const bool Client::isCloseable() const
{ {
if( isModalSystemNotification())
return false;
return rules()->checkCloseable( motif_may_close && !isSpecialWindow()); return rules()->checkCloseable( motif_may_close && !isSpecialWindow());
} }

@ -57,6 +57,7 @@ class Client : public TQObject, public KDecorationDefines
const Client* transientFor() const; const Client* transientFor() const;
Client* transientFor(); Client* transientFor();
bool isTransient() const; bool isTransient() const;
bool isModalSystemNotification() const;
bool groupTransient() const; bool groupTransient() const;
bool wasOriginallyGroupTransient() const; bool wasOriginallyGroupTransient() const;
ClientList mainClients() const; // call once before loop , is not indirect ClientList mainClients() const; // call once before loop , is not indirect

@ -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,6 +344,7 @@ 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 (!isModalSystemNotification()) {
if (!m_button[MenuButton]){ if (!m_button[MenuButton]){
btn = createButton(MenuButton); btn = createButton(MenuButton);
if (!btn) break; if (!btn) break;
@ -335,8 +355,10 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const TQString
m_button[MenuButton] = btn; m_button[MenuButton] = btn;
} }
}
break; break;
case 'S': // OnAllDesktops button case 'S': // OnAllDesktops button
if (!isModalSystemNotification()) {
if (!m_button[OnAllDesktopsButton]){ if (!m_button[OnAllDesktopsButton]){
btn = createButton(OnAllDesktopsButton); btn = createButton(OnAllDesktopsButton);
if (!btn) break; if (!btn) break;
@ -348,6 +370,7 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const TQString
m_button[OnAllDesktopsButton] = btn; m_button[OnAllDesktopsButton] = btn;
} }
}
break; break;
case 'H': // Help button case 'H': // Help button
if ((!m_button[HelpButton]) && providesContextHelp()){ if ((!m_button[HelpButton]) && providesContextHelp()){

@ -266,6 +266,7 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
typedef TQValueVector <KCommonDecorationButton*> ButtonContainer; ///< If the entry is 0, it's a spacer. typedef TQValueVector <KCommonDecorationButton*> ButtonContainer; ///< If the entry is 0, it's a spacer.
int buttonContainerWidth(const ButtonContainer &btnContainer, bool countHidden = false) const; int buttonContainerWidth(const ButtonContainer &btnContainer, bool countHidden = false) const;
bool isModalSystemNotification();
void addButtons(ButtonContainer &btnContainer, const TQString& buttons, bool isLeft); void addButtons(ButtonContainer &btnContainer, const TQString& buttons, bool isLeft);
KCommonDecorationButton *m_button[NumButtons]; KCommonDecorationButton *m_button[NumButtons];

Loading…
Cancel
Save