generic: remove redundant logout effect hack

ksmserver no longer uses custom effect for logout, for reference:
36d3e65630

bonus points for less X11 round-trips on logout

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-30 20:12:08 +03:00
parent e230b4cbc7
commit db6643a680
2 changed files with 10 additions and 41 deletions

View file

@ -61,40 +61,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void KSMShutdownFeedback::start()
{
if( KWindowSystem::compositingActive()) {
// HACK do properly
// Announce that the user MAY be logging out (Intended for the compositor)
Display* dpy = QX11Info::display();
char net_wm_cm_name[ 100 ];
sprintf( net_wm_cm_name, "_NET_WM_CM_S%d", DefaultScreen( dpy ));
Atom net_wm_cm = XInternAtom( dpy, net_wm_cm_name, False );
Window sel = XGetSelectionOwner( dpy, net_wm_cm );
Atom hack = XInternAtom( dpy, "_KWIN_LOGOUT_EFFECT", False );
bool wmsupport = false;
if( sel != None ) {
KXErrorHandler handler;
int cnt;
Atom* props = XListProperties( dpy, sel, &cnt );
if( !handler.error( false ) && props != NULL && qFind( props, props + cnt, hack ) != props + cnt )
wmsupport = true;
if( props != NULL )
XFree( props );
}
if( wmsupport ) {
// Announce that the user MAY be logging out (Intended for the compositor)
Atom announce = XInternAtom(dpy, "_KDE_LOGGING_OUT", False);
unsigned char dummy = 0;
XChangeProperty(dpy, QX11Info::appRootWindow(), announce, announce, 8, PropModeReplace,
&dummy, 1);
// Don't show our own effect
return;
}
Atom announce = XInternAtom(dpy, "_KDE_LOGGING_OUT", False);
unsigned char dummy = 0;
XChangeProperty(dpy, QX11Info::appRootWindow(), announce, announce, 8, PropModeReplace, &dummy, 1);
}
}
void KSMShutdownFeedback::stop()
{
if( KWindowSystem::compositingActive()) {
// We are no longer logging out, announce (Intended for the compositor)
// No longer logging out, announce (Intended for the compositor)
Display* dpy = QX11Info::display();
Atom announce = XInternAtom(dpy, "_KDE_LOGGING_OUT", False);
XDeleteProperty(QX11Info::display(), QX11Info::appRootWindow(), announce);

View file

@ -45,16 +45,6 @@ LogoutEffect::LogoutEffect()
logoutAtom = XInternAtom(display(), "_KDE_LOGGING_OUT", False);
effects->registerPropertyType(logoutAtom, true);
// Block KSMServer's effect
char net_wm_cm_name[100];
::memset(net_wm_cm_name, '\0', sizeof(net_wm_cm_name) * sizeof(char));
sprintf(net_wm_cm_name, "_NET_WM_CM_S%d", DefaultScreen(display()));
Atom net_wm_cm = XInternAtom(display(), net_wm_cm_name, False);
Window sel = XGetSelectionOwner(display(), net_wm_cm);
Atom hack = XInternAtom(display(), "_KWIN_LOGOUT_EFFECT", False);
XChangeProperty(display(), sel, hack, hack, 8, PropModeReplace, (unsigned char*)&hack, 1);
// the atom is not removed when effect is destroyed, this is temporary anyway
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
@ -97,11 +87,12 @@ void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
data.multiplyBrightness((1.0 - progress * 0.3));
}
}
if (w == logoutWindow ||
ignoredWindows.contains(w)) // HACK: All windows past the first ignored one should not be
// blurred as it affects the stacking order.
// All following windows are on top of the logout window and should not be altered either
if (w == logoutWindow || ignoredWindows.contains(w)) {
// HACK: All windows past the first ignored one should not be blurred as it affects the
// stacking order. All following windows are on top of the logout window and should not
// be altered either
logoutWindowPassed = true;
}
}
effects->paintWindow(w, mask, region, data);
}