From 36db54e7946067165652cdcdb96ce991e658aa6f Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 11 Jan 2014 16:26:04 +0000 Subject: [PATCH] CtrlCore: GTK primary work area issue #640 git-svn-id: svn://ultimatepp.org/upp/trunk@6761 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/GtkWnd.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/uppsrc/CtrlCore/GtkWnd.cpp b/uppsrc/CtrlCore/GtkWnd.cpp index f1fe6f8a5..1e5661b92 100644 --- a/uppsrc/CtrlCore/GtkWnd.cpp +++ b/uppsrc/CtrlCore/GtkWnd.cpp @@ -290,9 +290,11 @@ Rect Ctrl::GetVirtualScreenArea() Rect Ctrl::GetPrimaryWorkArea() { + GuiLock __; + int primary = gdk_screen_get_primary_monitor(gdk_screen_get_default()); Array rc; GetWorkArea(rc); - return rc.GetCount() ? rc[0] : GetVirtualScreenArea(); + return primary < rc.GetCount() ? rc[primary] : GetVirtualScreenArea(); } Rect Ctrl::GetPrimaryScreenArea() @@ -453,14 +455,16 @@ void Ctrl::WndUpdate() Rect Ctrl::GetDefaultWindowRect() { GuiLock __; - Size sz = GetPrimaryWorkArea().GetSize(); + Rect r = GetPrimaryWorkArea(); + Size sz = r.GetSize(); + static int pos = min(sz.cx / 10, 50); pos += 10; int cx = sz.cx * 2 / 3; int cy = sz.cy * 2 / 3; if(pos + cx + 50 > sz.cx || pos + cy + 50 > sz.cy) pos = 0; - return RectC(pos + 20, pos + 20, cx, cy); + return RectC(r.left + pos + 20, r.top + pos + 20, cx, cy); } ViewDraw::ViewDraw(Ctrl *ctrl)