From e28605ac6addc6b71166374e548df20ac573a899 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 6 Oct 2008 09:01:39 +0000 Subject: hopefully fixed all the dual-screen setup dialog centering problems git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2660 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/objects/class_widget.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/modules/objects') diff --git a/src/modules/objects/class_widget.cpp b/src/modules/objects/class_widget.cpp index f670ad538..2ba146bb0 100644 --- a/src/modules/objects/class_widget.cpp +++ b/src/modules/objects/class_widget.cpp @@ -1059,8 +1059,10 @@ bool KviKvsObject_widget::function_fontMetricsHeight(KviKvsObjectFunctionCall * bool KviKvsObject_widget::function_screenResolution(KviKvsObjectFunctionCall * c) { KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant((kvs_int_t)g_pApp->desktop()->width())); - a->set(1,new KviKvsVariant((kvs_int_t)g_pApp->desktop()->height())); + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + + a->set(0,new KviKvsVariant((kvs_int_t)rect.width())); + a->set(1,new KviKvsVariant((kvs_int_t)rect.height())); c->returnValue()->setArray(a); return true; } @@ -1185,7 +1187,12 @@ bool KviKvsObject_widget::function_mapFromGlobal(KviKvsObjectFunctionCall *c) bool KviKvsObject_widget::function_centerToScreen(KviKvsObjectFunctionCall *c) { - if(widget()) widget()->move((g_pApp->desktop()->width() - widget()->width())/2,(g_pApp->desktop()->height() - widget()->height())/2); + if(widget()) + { + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + widget()->move((rect.width() - widget()->width())/2,(rect.height() - widget()->height())/2); + } + return true; } -- cgit v1.3.1-10-gc9f91