diff options
author | Laurent Montel <lmontel@mandriva.org> | 2001-08-25 09:05:49 +0000 |
---|---|---|
committer | Laurent Montel <lmontel@mandriva.org> | 2001-08-25 09:05:49 +0000 |
commit | 12c4ffaff2ad1902b4b13438997f8cadc875ef81 (patch) | |
tree | cc03a09e6204a837938dbfc33c660da30960c1a3 /krootwarning | |
parent | fbda15a24f4440557afed40d8cb0facb2e58eb6a (diff) | |
download | common-data-12c4ffaff2ad1902b4b13438997f8cadc875ef81.tar common-data-12c4ffaff2ad1902b4b13438997f8cadc875ef81.tar.gz common-data-12c4ffaff2ad1902b4b13438997f8cadc875ef81.tar.bz2 common-data-12c4ffaff2ad1902b4b13438997f8cadc875ef81.tar.xz common-data-12c4ffaff2ad1902b4b13438997f8cadc875ef81.zip |
Now krootwarning is xinerama compliante
Diffstat (limited to 'krootwarning')
-rw-r--r-- | krootwarning/krootwarning/krootwarning.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/krootwarning/krootwarning/krootwarning.cpp b/krootwarning/krootwarning/krootwarning.cpp index f0318f0..adce90a 100644 --- a/krootwarning/krootwarning/krootwarning.cpp +++ b/krootwarning/krootwarning/krootwarning.cpp @@ -29,6 +29,13 @@ #include <klocale.h> #include <kstddirs.h> +extern "C" { +#ifdef HAVE_XINERAMA +# include <X11/XKBlib.h> +# include <X11/extensions/Xinerama.h> +#endif +}; + Krootwarning::Krootwarning(QWidget *parent, const char *name) :KDialogBase( parent, "urldialog", true, i18n("Warning"), User1|User2, User1, true,i18n("Logout"),i18n("Continue") ) { @@ -67,6 +74,37 @@ void Krootwarning::initInterface() m_showAtTheNewStartUp=new QCheckBox( i18n("Don't show this window again."), page); grid->addMultiCellWidget(m_showAtTheNewStartUp,8,8,0,1); resize(400,280); + + int dw, dh, gw, gh, x, y; +#ifdef HAVE_XINERAMA + int numHeads; + XineramaScreenInfo *xineramaInfo; + if (XineramaIsActive(qt_xdisplay()) && + ((xineramaInfo = XineramaQueryScreens(qt_xdisplay(), &numHeads)))) { + dw = xineramaInfo->width; + dh = xineramaInfo->height; + XFree(xineramaInfo); + } else +#endif + { + dw = QApplication::desktop()->width(); + dh = QApplication::desktop()->height(); + } + + gw = width(); + gh = height(); + x = dw/2; + y = dh/2; + + x -= gw/2; + y -= gh/2; + + if (x + gw > dw) + x = dw - gw; + if (y + gh > dh) + y = dh - gh; + move( x < 0 ? 0 : x, y < 0 ? 0 : y ); + loadConfig(); } |