Show
Ignore:
Timestamp:
09/11/06 00:08:07 (2 years ago)
Author:
dmik
Message:

Psi: General: bringToFront() can now move a window from an inactive (invisible) XPager's page to the current (visible) one (using a bit hackish trick).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • psi/trunk/src/common.cpp

    r44 r48  
    17441744void bringToFront(QWidget *w, bool grabFocus /* = true */) 
    17451745{ 
    1746 #ifdef Q_WS_X11 
     1746#if defined(Q_WS_X11) 
    17471747        // If we're not on the current desktop, do the hide/show trick 
    17481748        long dsk, curr_dsk; 
     
    17541754                } 
    17551755        } 
    1756  
     1756#else 
    17571757        // FIXME: multi-desktop hacks for Win and Mac required 
    17581758#endif 
     
    17771777                w->raise(); 
    17781778#endif 
     1779 
     1780#if defined(Q_WS_PM) 
     1781        // When the widget is totally outside the screen bounds after making it shown, 
     1782        // we assume it's on a different (invisible) XPager's page. The assumption is 
     1783        // not so safe, but is there any other way to determine XPager is in action?.. 
     1784        QRect geo = w->frameGeometry(); 
     1785        QRect scrGeo = qApp->desktop()->screenGeometry(); 
     1786        if (!w->isMinimized() && !scrGeo.contains(geo)) { 
     1787                // We assume that XPager stores invisible pages in the coordinate space 
     1788                // beyond (0,0)x(screen_width,screen_height) wiht a 8 px gap between 
     1789                // pages. Move it to the visible page. 
     1790                int sw = scrGeo.width() + 8; 
     1791                int sh = scrGeo.height() + 8; 
     1792                int x = geo.x() % sw; 
     1793                if (x < 0) x = sw + x; 
     1794                int y = geo.y() % sh; 
     1795                if (y < 0) y = sh + y; 
     1796                w->move (x, y); 
     1797        } 
     1798#endif 
    17791799} 
    17801800