Make tooltips work in xinerama. Approved by Cristian
svn path=/trunk/kdebase/kwin/; revision=143219
This commit is contained in:
parent
0976c0ac65
commit
c7659304f7
1 changed files with 8 additions and 6 deletions
|
@ -146,14 +146,16 @@ void KWinToolTip::hideTip()
|
||||||
void KWinToolTip::positionTip()
|
void KWinToolTip::positionTip()
|
||||||
{
|
{
|
||||||
QPoint p = btn->mapToGlobal(btn->rect().bottomLeft()) + QPoint(0, 16);
|
QPoint p = btn->mapToGlobal(btn->rect().bottomLeft()) + QPoint(0, 16);
|
||||||
|
int screen = QApplication::desktop()->screenNumber(btn->mapToGlobal(btn->rect().center()));
|
||||||
|
QRect screenGeom = QApplication::desktop()->screenGeometry(screen);
|
||||||
|
|
||||||
// Ensure the tooltip is displayed within the current desktop
|
// Ensure the tooltip is displayed within the current desktop
|
||||||
if ( p.x() + width() > Workspace::self()->desktopWidget()->width() )
|
if ( screenGeom.right() < p.x() + width() )
|
||||||
p.setX( Workspace::self()->desktopWidget()->width() - width());
|
p.setX( screenGeom.right() - width());
|
||||||
if ( p.y() + height() > Workspace::self()->desktopWidget()->height() )
|
if ( screenGeom.bottom() < p.y() + height() )
|
||||||
p.setY( Workspace::self()->desktopWidget()->height() - height() );
|
p.setY( screenGeom.bottom() - height() );
|
||||||
if (p.x() < 0) p.setX(0);
|
if (p.x() < screenGeom.x()) p.setX(screenGeom.x());
|
||||||
if (p.y() < 0) p.setY(0);
|
if (p.y() < screenGeom.y()) p.setY(screenGeom.y());
|
||||||
move(p);
|
move(p);
|
||||||
|
|
||||||
// Ensure we don't get enter/leave event race conditions when a
|
// Ensure we don't get enter/leave event race conditions when a
|
||||||
|
|
Loading…
Reference in a new issue