[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/win

2018-05-16 Thread Miklos Vajna
 vcl/win/gdi/salnativewidgets-luna.cxx |   51 +-
 1 file changed, 38 insertions(+), 13 deletions(-)

New commits:
commit 96bb95e64240ddeb59d623d62fa30b2a7191bfc4
Author: Miklos Vajna 
Date:   Mon May 14 09:34:52 2018 +0200

tdf#96947 vcl opengl win: fix background of menu items w/ check/radio marks

Extract the actually used bounding box from the rendering code and reuse
that for OpenGL texture purposes, so the available and the used size
can't mismatch.

The background itself is almost invisible, but the borders were lost due
to this size difference.

(cherry picked from commit b160db926b574b7e9d6696d49dbbce8dd289aade)

Change-Id: I31b3e5aa0c0106461b90bfaab3a84d45b33afd71
Reviewed-on: https://gerrit.libreoffice.org/54324
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 73e780ca1584..2370efcfec69 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -498,6 +498,31 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 }
 }
 
+/**
+ * Gives the actual rectangle used for rendering by ControlType::MenuPopup's
+ * ControlPart::MenuItemCheckMark or ControlPart::MenuItemRadioMark.
+ */
+static tools::Rectangle GetMenuPopupMarkRegion(const ImplControlValue& rValue)
+{
+tools::Rectangle aRet;
+
+const MenupopupValue& rMVal(static_cast(rValue));
+aRet.Top() = rMVal.maItemRect.Top();
+aRet.Bottom() = rMVal.maItemRect.Bottom() + 1; // see below in 
drawNativeControl
+if (AllSettings::GetLayoutRTL())
+{
+aRet.Right() = rMVal.maItemRect.Right() + 1;
+aRet.Left() = aRet.Right() - (rMVal.getNumericVal() - 
rMVal.maItemRect.Left());
+}
+else
+{
+aRet.Right() = rMVal.getNumericVal();
+aRet.Left() = rMVal.maItemRect.Left();
+}
+
+return aRet;
+}
+
 bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
 ControlType nType,
 ControlPart nPart,
@@ -1088,19 +1113,11 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 RECT aBGRect = rc;
 if( aValue.getType() == ControlType::MenuPopup )
 {
-const MenupopupValue& rMVal( static_cast(aValue) );
-aBGRect.top= rMVal.maItemRect.Top();
-aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see 
below in drawNativeControl
-if( AllSettings::GetLayoutRTL() )
-{
-aBGRect.right = rMVal.maItemRect.Right()+1;
-aBGRect.left = aBGRect.right - 
(rMVal.getNumericVal()-rMVal.maItemRect.Left());
-}
-else
-{
-aBGRect.right = rMVal.getNumericVal();
-aBGRect.left  = rMVal.maItemRect.Left();
-}
+tools::Rectangle aRectangle = 
GetMenuPopupMarkRegion(aValue);
+aBGRect.top = aRectangle.Top();
+aBGRect.left = aRectangle.Left();
+aBGRect.bottom = aRectangle.Bottom();
+aBGRect.right = aRectangle.Right();
 rc = aBGRect;
 }
 iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : 
MCB_DISABLED;
@@ -1164,6 +1181,14 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 }
 }
 
+if (pImpl && nType == ControlType::MenuPopup && (nPart == 
ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark))
+{
+cacheRect = GetMenuPopupMarkRegion(aValue);
+buttonRect = cacheRect;
+keySize = cacheRect.GetSize();
+}
+
+
 ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize);
 if (pImpl != nullptr && 
pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), 
buttonRect.Top()))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/win

2018-04-18 Thread Michael Stahl
 vcl/win/app/salinst.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c18be7816a253bb03675f74df38b41a999a02952
Author: Michael Stahl 
Date:   Tue Apr 17 18:41:39 2018 +0200

vcl: WNT: *really* avoid calling SHAddToRecentDocs() from unit tests

On Windows 10, Explorer spends ridiculous amounts of CPU with updating
its recent documents view while tests are running.
(cherry picked from commit 94c264859f621e8e7c793fad2beb6528659433bf)

It's much better to check IsHeadlessMode anyway because that is set in
more situations, and if you run soffice --headless you probably don't
want the corresponding files to show up in Explorer's Recently list.
(cherry picked from commit b07e8a7e16ba69e822a309ec280d1987f90021a3)

Change-Id: I8ada3659d05c94d072ba30859090e835a595e9ea
Reviewed-on: https://gerrit.libreoffice.org/53115
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index b13360f40b16..dcea8d53f6d7 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -930,6 +930,9 @@ OUString WinSalInstance::GetConnectionIdentifier()
 */
 void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const 
OUString& /*rMimeType*/, const OUString& rDocumentService)
 {
+if (Application::IsHeadlessModeEnabled())
+return;
+
 OUString system_path;
 osl::FileBase::RC rc = osl::FileBase::getSystemPathFromFileURL(rFileUrl, 
system_path);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/win

2018-03-13 Thread Mike Kaganski
 vcl/win/gdi/salprn.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 96cd4feb3ae133c19808ca0df2dab02595bb5588
Author: Mike Kaganski 
Date:   Sat Mar 10 18:46:07 2018 +0100

tdf#115649: ensure we own SolarMutex in the callback

The crash is caused by releasing SolarMutex we don't own; the release 
happens
in Application::Reschedule() inside SalPrintAbortProc.

The crashing callstack:

ucrtbase.dll!abort()
mergedlo.dll!comphelper::GenericSolarMutex::doRelease(bool bUnlockAll) Line 
72
mergedlo.dll!SalYieldMutex::doRelease(bool bUnlockAll) Line 177
[Inline Frame] mergedlo.dll!SolarMutexReleaser::{ctor}() Line 1473
mergedlo.dll!WinSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents) Line 550
mergedlo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 469
mergedlo.dll!SalPrintAbortProc(HDC__ * hPrnDC, int __formal) Line 1308
gdi32full.dll!vSAPCallback()
gdi32full.dll!ExtEscapeImpl()
gdi32.dll!ExtEscape()
[Frames may be missing, no binary loaded for KMUU727V.DLL]
KMUU727V.DLL!11d0dc21()

Change-Id: I955eab7894186900d0d99e28f62d87cc645e4a5a
Reviewed-on: https://gerrit.libreoffice.org/51052
Tested-by: Jenkins 
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 43bf50d5ced4b878f747075f8c0f1b32991c290e)
Reviewed-on: https://gerrit.libreoffice.org/51153
Reviewed-by: Michael Stahl 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index a961bbf4ace2..2ad7e345f8f9 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1300,6 +1300,8 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* 
nError */ )
 WinSalPrinter* pPrinter;
 boolbWhile = true;
 
+// Ensure we handle the mutex which will be released in 
WinSalInstance::DoYield
+SolarMutexGuard aSolarMutexGuard;
 do
 {
 // process messages
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/win

2017-12-08 Thread Mark Hung
 vcl/win/gdi/salfont.cxx   |3 +++
 vcl/win/gdi/winlayout.cxx |   15 +++
 2 files changed, 18 insertions(+)

New commits:
commit 84b4aae808d904325c841c3b3e778d8bc4769dab
Author: Mark Hung 
Date:   Thu Nov 30 19:42:08 2017 +0800

tdf#108302: keep the font unrotated if @font isn't available.

We will create the font in ExTextOutRenderer for glyphs that
are expected to be sideway in vertical writing, so we can reset
the font escapement and orientation if @font ( windows notation
of fonts for CJK vertical writing. ) isn't available. That will
keep the font consistent with @fonts for those glyphs expected
to be upright in vertical writing.
Note that it is necessary to change text alignment of DC when
such font is used.

Change-Id: I1a4a6e8aa232119dd136beeb6c19505d7980a534
Reviewed-on: https://gerrit.libreoffice.org/45609
Tested-by: Jenkins 
Reviewed-by: Mark Hung 
(cherry picked from commit 2392238e480ecc1d1a5e2e69789e79c10f142d6c)
Reviewed-on: https://gerrit.libreoffice.org/45919
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 20bcce07d47e..9796ab928f3b 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -826,6 +826,9 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
 memcpy( [0], aName.getStr(), 
nNameLen*sizeof(wchar_t) );
 if( nNameLen < LF_FACESIZE )
 rLogFont.lfFaceName[nNameLen] = '\0';
+// keep it upright and create the font for sideway glyphs later.
+rLogFont.lfEscapement = rLogFont.lfEscapement - 2700;
+rLogFont.lfOrientation = rLogFont.lfEscapement;
 }
 }
 }
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index d6b9cd4b57c4..409b0b447986 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -250,6 +250,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 HFONT hFont = static_cast(GetCurrentObject( hDC, OBJ_FONT ));
 HFONT hAltFont = nullptr;
 bool bUseAltFont = false;
+bool bShift = false;
 if (rLayout.getFontSelData().mbVertical)
 {
 LOGFONTW aLogFont;
@@ -260,8 +261,16 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 sizeof(aLogFont.lfFaceName)-sizeof(aLogFont.lfFaceName[0]));
 hAltFont = CreateFontIndirectW();
 }
+else
+{
+bShift = true;
+aLogFont.lfEscapement += 2700;
+aLogFont.lfOrientation = aLogFont.lfEscapement;
+hAltFont = CreateFontIndirectW();
+}
 }
 
+UINT nTextAlign = GetTextAlign ( hDC );
 int nStart = 0;
 Point aPos(0, 0);
 const GlyphItem* pGlyph;
@@ -273,7 +282,13 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 bUseAltFont = !bUseAltFont;
 SelectFont(hDC, bUseAltFont ? hAltFont : hFont);
 }
+if (bShift && pGlyph->IsVertical())
+SetTextAlign(hDC, TA_TOP|TA_LEFT);
+
 ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(), 1, nullptr);
+
+if (bShift && pGlyph->IsVertical())
+SetTextAlign(hDC, nTextAlign);
 }
 if (hAltFont)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits