mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 10:52:49 +00:00
kdeui: KPassivePopup::defaultArea() optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ecb617b9c8
commit
81dea86d7c
3 changed files with 9 additions and 28 deletions
|
@ -25,24 +25,21 @@
|
||||||
#include <QBitmap>
|
#include <QBitmap>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QtGui/qevent.h>
|
#include <QPaintEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QtGui/qpolygon.h>
|
#include <QPolygon>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QX11Info>
|
||||||
|
|
||||||
#include <kvbox.h>
|
#include <kvbox.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kdialog.h>
|
#include <kdialog.h>
|
||||||
#include <kglobalsettings.h>
|
#include <kglobalsettings.h>
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
#include <qx11info_x11.h>
|
|
||||||
#include <netwm.h>
|
#include <netwm.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
@ -301,7 +298,6 @@ void KPassivePopup::hideEvent( QHideEvent * )
|
||||||
|
|
||||||
QRect KPassivePopup::defaultArea() const
|
QRect KPassivePopup::defaultArea() const
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_X11
|
|
||||||
NETRootInfo info( QX11Info::display(),
|
NETRootInfo info( QX11Info::display(),
|
||||||
NET::NumberOfDesktops |
|
NET::NumberOfDesktops |
|
||||||
NET::CurrentDesktop |
|
NET::CurrentDesktop |
|
||||||
|
@ -309,26 +305,15 @@ QRect KPassivePopup::defaultArea() const
|
||||||
-1, false );
|
-1, false );
|
||||||
info.activate();
|
info.activate();
|
||||||
NETRect workArea = info.workArea( info.currentDesktop() );
|
NETRect workArea = info.workArea( info.currentDesktop() );
|
||||||
QRect r;
|
return QRect( workArea.pos.x, workArea.pos.y, 0, 0 ); // top left
|
||||||
r.setRect( workArea.pos.x, workArea.pos.y, 0, 0 ); // top left
|
|
||||||
#else
|
|
||||||
// FIX IT
|
|
||||||
QRect r;
|
|
||||||
r.setRect( 100, 100, 200, 200 ); // top left
|
|
||||||
#endif
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KPassivePopup::positionSelf()
|
void KPassivePopup::positionSelf()
|
||||||
{
|
{
|
||||||
QRect target;
|
QRect target;
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
if ( !d->window ) {
|
if ( !d->window ) {
|
||||||
target = defaultArea();
|
target = defaultArea();
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
NETWinInfo ni( QX11Info::display(), d->window, QX11Info::appRootWindow(),
|
NETWinInfo ni( QX11Info::display(), d->window, QX11Info::appRootWindow(),
|
||||||
NET::WMIconGeometry );
|
NET::WMIconGeometry );
|
||||||
|
|
||||||
|
@ -336,8 +321,7 @@ void KPassivePopup::positionSelf()
|
||||||
// windows that skip the taskbar cleanly
|
// windows that skip the taskbar cleanly
|
||||||
if ( ni.state() & NET::SkipTaskbar ) {
|
if ( ni.state() & NET::SkipTaskbar ) {
|
||||||
target = defaultArea();
|
target = defaultArea();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
NETRect r = ni.iconGeometry();
|
NETRect r = ni.iconGeometry();
|
||||||
target.setRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
|
target.setRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
|
||||||
if ( target.isNull() ) { // bogus value, use the exact position
|
if ( target.isNull() ) { // bogus value, use the exact position
|
||||||
|
@ -348,9 +332,6 @@ void KPassivePopup::positionSelf()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
target = defaultArea();
|
|
||||||
#endif
|
|
||||||
moveNear( target );
|
moveNear( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ void KPixmapSequenceOverlayPainter::setRect(const QRect &rect)
|
||||||
|
|
||||||
void KPixmapSequenceOverlayPainter::setAlignment(Qt::Alignment align)
|
void KPixmapSequenceOverlayPainter::setAlignment(Qt::Alignment align)
|
||||||
{
|
{
|
||||||
bool restart = d->m_started;
|
const bool restart = d->m_started;
|
||||||
stop();
|
stop();
|
||||||
d->m_alignment = align;
|
d->m_alignment = align;
|
||||||
if (restart) {
|
if (restart) {
|
||||||
|
@ -203,7 +203,7 @@ void KPixmapSequenceOverlayPainter::setAlignment(Qt::Alignment align)
|
||||||
|
|
||||||
void KPixmapSequenceOverlayPainter::setOffset(const QPoint &offset)
|
void KPixmapSequenceOverlayPainter::setOffset(const QPoint &offset)
|
||||||
{
|
{
|
||||||
bool restart = d->m_started;
|
const bool restart = d->m_started;
|
||||||
stop();
|
stop();
|
||||||
d->m_offset = offset;
|
d->m_offset = offset;
|
||||||
if (restart) {
|
if (restart) {
|
||||||
|
|
|
@ -153,7 +153,7 @@ KAutoUnmountPrivate::KAutoUnmountPrivate(KAutoUnmount *qq, const QString &mountp
|
||||||
}
|
}
|
||||||
|
|
||||||
KAutoUnmount::KAutoUnmount(const QString &mountpoint, const QString &desktopFile)
|
KAutoUnmount::KAutoUnmount(const QString &mountpoint, const QString &desktopFile)
|
||||||
: d( new KAutoUnmountPrivate(this, mountpoint, desktopFile))
|
: d(new KAutoUnmountPrivate(this, mountpoint, desktopFile))
|
||||||
{
|
{
|
||||||
QDBusPendingCall pendingcall = d->m_solidInterface.asyncCall("unmountDevice", mountpoint);
|
QDBusPendingCall pendingcall = d->m_solidInterface.asyncCall("unmountDevice", mountpoint);
|
||||||
d->m_callWatcher = new QDBusPendingCallWatcher(pendingcall, this);
|
d->m_callWatcher = new QDBusPendingCallWatcher(pendingcall, this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue