[Libreoffice-commits] core.git: vcl/win

2023-11-13 Thread Noel Grandin (via logerrit)
 vcl/win/gdi/salprn.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 07dfeffae8cba808dbad85dfed9b6a693a1f9543
Author: Noel Grandin 
AuthorDate: Mon Nov 13 13:13:42 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Nov 13 14:02:59 2023 +0100

tdf#127547 Freeze in Microsoft Print to PDF dialog

Change-Id: I7a6ef85fae637c8359a96df1bd31d7e8f0b36512
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159369
Tested-by: Hossein 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 0631bcd37c3f..3302efa2d986 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1375,7 +1375,7 @@ void WinSalPrinter::markInvalid()
 
 // need wrappers for StarTocW/A to use structured exception handling
 // since SEH does not mix with standard exception handling's cleanup
-static int lcl_StartDocW( HDC hDC, DOCINFOW const * pInfo, WinSalPrinter* pPrt 
)
+static int lcl_StartDocW1( HDC hDC, DOCINFOW const * pInfo, WinSalPrinter* 
pPrt )
 {
 int nRet = 0;
 CATCH_DRIVER_EX_BEGIN;
@@ -1384,6 +1384,16 @@ static int lcl_StartDocW( HDC hDC, DOCINFOW const * 
pInfo, WinSalPrinter* pPrt )
 return nRet;
 }
 
+static int lcl_StartDocW( HDC hDC, DOCINFOW const * pInfo, WinSalPrinter* pPrt 
)
+{
+//tdf#127547 - Freeze/crash in Microsoft Print to PDF dialog, if we try to 
paste while
+// executing the StartDocW method, Windows will call back into us on a 
separate thread,
+// where we will attempt to take the SolarMutex.
+SolarMutexReleaser aReleaser;
+
+return lcl_StartDocW1(hDC, pInfo, pPrt);
+}
+
 bool WinSalPrinter::StartJob( const OUString* pFileName,
const OUString& rJobName,
const OUString&,


[Libreoffice-commits] core.git: vcl/win

2023-10-10 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/XTDataObject.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 01ad024d39efaa0cb77eafa80235ff9021fafbfd
Author: Mike Kaganski 
AuthorDate: Tue Oct 10 11:03:32 2023 +0200
Commit: Mike Kaganski 
CommitDate: Tue Oct 10 12:20:59 2023 +0200

Drop repeated code

Change-Id: I0bbbaaf7c24851beca78d4ed024ffc44609e0093
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157719
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/XTDataObject.cxx b/vcl/win/dtrans/XTDataObject.cxx
index 18c9144439e6..b3f5ccb30344 100644
--- a/vcl/win/dtrans/XTDataObject.cxx
+++ b/vcl/win/dtrans/XTDataObject.cxx
@@ -349,12 +349,6 @@ void CXTDataObject::renderAnyDataAndSetupStgMedium(
 throw UnsupportedFlavorException( );
 }
 
-// unfortunately not all transferables fulfill the
-// spec. and do throw an UnsupportedFlavorException
-// so we must check the any
-if ( !aAny.hasValue( ) )
-throw UnsupportedFlavorException( );
-
 Sequence< sal_Int8 > clipDataStream;
 aAny >>= clipDataStream;
 


[Libreoffice-commits] core.git: vcl/win

2023-10-08 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 70c46e0e03a758fda4e94b561fdcae722414719f
Author: Caolán McNamara 
AuthorDate: Sat Oct 7 19:34:46 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 8 14:54:54 2023 +0200

tdf#156040 pick a better "LightColor" for windows dark theme

in the absence of a better idea, do like StyleSettings::Set3DColors does

Change-Id: I9868d4eb94fb221fcbf5e3a4e4761fb2bdfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157681
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 7ebe68077ec2..7c26ea1e903f 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2706,6 +2706,13 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 GetThemeColor(hTheme, 0, 0, TMT_FILLCOLOR, );
 aStyleSettings.SetFaceColor( ImplWinColorToSal( color ) );
 aStyleSettings.SetWindowColor( ImplWinColorToSal( color ) );
+
+// tdf#156040 in the absence of a better idea, do like
+// StyleSettings::Set3DColors does
+Color aLightColor(ImplWinColorToSal(color));
+aLightColor.DecreaseLuminance(64);
+aStyleSettings.SetLightColor(aLightColor);
+
 GetThemeColor(hTheme, 0, 0, TMT_TEXTCOLOR, );
 aStyleSettings.SetWindowTextColor( ImplWinColorToSal( color ) );
 aStyleSettings.SetToolTextColor( ImplWinColorToSal( color ) );
@@ -2757,6 +2764,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetWindowColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOW ) ) );
 aStyleSettings.SetWindowTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
 aStyleSettings.SetToolTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
+aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DHILIGHT ) ) );
 aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DSHADOW ) ) );
 aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DDKSHADOW ) ) );
 aControlTextColor = ImplWinColorToSal(GetSysColor(COLOR_BTNTEXT));
@@ -2781,7 +2789,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetMenuBarTextColor( aMenuBarTextColor );
 aStyleSettings.SetMenuBarRolloverTextColor( aMenuBarRolloverTextColor );
 
-aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DHILIGHT ) ) );
 aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DLIGHT ) ) );
 aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK 
) ) );
 aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_INFOTEXT ) ) );


[Libreoffice-commits] core.git: vcl/win

2023-07-27 Thread Mike Kaganski (via logerrit)
 vcl/win/window/salframe.cxx |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 724ba1e455d4ae47a00248586487443347f1be96
Author: Mike Kaganski 
AuthorDate: Tue Jul 25 09:50:08 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jul 27 22:54:44 2023 +0200

tdf#156459: fix WM_UNICHAR implementation

It was implemented in commit c62f48790047014d7d718f949ef6298961100e6f
(INTEGRATION: CWS vcl07 (1.89.2.5.20); FILE MERGED, 2003-04-11), but
handling of non-BMP codepoints was done incorrectly: high surrogate
was calculated, but not used; and SALEVENT_KEYINPUT / SALEVENT_KEYUP
pair used a default value of the SalKeyEvent's mnCharCode. Then the
unused variable, and the macro taking its value, were commented out
in commit fd3e69a1c0d311515eb8db92dd1a72657b405a25 (INTEGRATION: CWS
warnings01 (1.125.6); FILE MERGED, 2006-06-19).

I have no idea if WM_UNICHAR is used in the wild, but *some* sources
suggest that some third-party IMEs could use it [1]; so just fix it.

[1] http://archives.miloush.net/michkap/archive/2012/05/21/10308135.html

Change-Id: I58190afd9fe295e62cb08acaefd32e99c1f383bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154996
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index d68178ea022f..25c2e2b3b281 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3606,6 +3606,9 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 return true;// ...but this will only avoid calling the 
defwindowproc
 }
 
+if (!rtl::isUnicodeCodePoint(wParam))
+return false;
+
 SalKeyEvent aKeyEvt;
 aKeyEvt.mnCode = nModCode; // Or should it be 0? - as this is 
always a character returned
 aKeyEvt.mnRepeat   = 0;
@@ -3613,12 +3616,12 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 if( wParam >= Uni_SupplementaryPlanesStart )
 {
 // character is supplementary char in UTF-32 format - must be 
converted to UTF-16 supplementary pair
-// sal_Unicode ch = (sal_Unicode) Uni_UTF32ToSurrogate1(wParam);
- nLastChar = 0;
- nLastVKChar = 0;
- pFrame->CallCallback( SalEvent::KeyInput,  );
- pFrame->CallCallback( SalEvent::KeyUp,  );
- wParam = rtl::getLowSurrogate( wParam );
+aKeyEvt.mnCharCode = rtl::getHighSurrogate(wParam);
+nLastChar = 0;
+nLastVKChar = 0;
+pFrame->CallCallback(SalEvent::KeyInput, );
+pFrame->CallCallback(SalEvent::KeyUp, );
+wParam = rtl::getLowSurrogate(wParam);
 }
 
 aKeyEvt.mnCharCode = static_cast(wParam);


[Libreoffice-commits] core.git: vcl/win

2023-07-17 Thread Sarper Akdemir (via logerrit)
 vcl/win/window/salframe.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit dc5163af166cb2afb9811dbf0443e1fcceafbb9a
Author: Sarper Akdemir 
AuthorDate: Fri Jul 14 18:04:35 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Mon Jul 17 10:09:04 2023 +0200

tdf#90023: vcl: fix tooltip displaying over two monitors on Windows

To determine the WorkArea correctly in ImplSalGetWorkArea,
pass in the mouse pointer as pParentRect.

Similarly to how it has been done on:
vcl/win/window/salframe.cxx:1393

Change-Id: I43123be315c5ea146c118e8e2a582ceaaab0a35e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154442
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 2e60f38c1f11..c911fff0840f 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1590,7 +1590,14 @@ void WinSalFrame::SetPluginParent( SystemParentData* 
pNewParent )
 void WinSalFrame::GetWorkArea( tools::Rectangle  )
 {
 RECT aRect;
-ImplSalGetWorkArea( mhWnd, , nullptr );
+
+// pass cursor's position to ImplSalGetWorkArea to determine work area on
+// multi monitor setups correctly.
+POINT aPoint;
+GetCursorPos();
+RECT aRect2{ aPoint.x, aPoint.y, aPoint.x + 2, aPoint.y + 2 };
+
+ImplSalGetWorkArea( mhWnd, ,  );
 rRect.SetLeft( aRect.left );
 rRect.SetRight( aRect.right-1 );
 rRect.SetTop( aRect.top );


[Libreoffice-commits] core.git: vcl/win

2023-06-27 Thread Noel Grandin (via logerrit)
 vcl/win/gdi/salprn.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 2c685e244f44271e0dde1960e0973da9708576fe
Author: Noel Grandin 
AuthorDate: Tue Jun 27 14:18:40 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 27 19:23:25 2023 +0200

remove this SAL_WARN

has not revealed anything interesting on jenkins

Change-Id: I15ebabc171dbb38f440ec607ea05be9b807bdea8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153648
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 71e4753995ae..78c8135a93d2 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1080,8 +1080,6 @@ void WinSalInfoPrinter::setHDC(HDC hNewDC)
 if (m_hDC)
 {
 assert(!m_pGraphics || m_hDC == m_pGraphics->getHDC());
-// we get intermittent crashes on the Windows jenkins box around here, 
let us see if there is something weird about the DC
-SAL_WARN_IF(!hNewDC, "vcl", "Graphics DC " << m_hDC);
 delete m_pGraphics;
 m_pGraphics = nullptr;
 DeleteDC(m_hDC);


[Libreoffice-commits] core.git: vcl/win

2023-06-13 Thread Michael Stahl (via logerrit)
 vcl/win/window/salframe.cxx |   52 +++-
 1 file changed, 32 insertions(+), 20 deletions(-)

New commits:
commit 889c12e98e04edb4bc25b86bf16b8cf1d9b68420
Author: Michael Stahl 
AuthorDate: Tue Jun 13 12:30:44 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Jun 13 16:07:15 2023 +0200

tdf#155794 vcl: handle WM_GETOBJECT without SolarMutex

SalFrameWndProc() handles WM_GETOBJECT by acquiring SolarMutex and
calling ImplHandleGetObject(), which again acquires the SolarMutex
inside Application::SetSettings().

This was introduced with commit db214684057e3ff2fa32d57c00507309dd6c24d6
due to thread-safety crashes but it turns out that it can be problematic.

When loading a document on a non-main thread, WinSalFrame::SetTitle()
calls SetWindowTextW which is equivalent to SendMessage(WM_SETTEXT),
while holding SolarMutex, and if the main thread doesn't finish
processing it then that's a deadlock.

Typically Desktop::Main() has already created the mxAccessBridge, so
ImplHandleGetObject() most likely doesn't need to do it, so just skip
the Settings code there in case the SolarMutex is locked by another
thread.

In case the SolarMutex is locked by another thread, do an unsafe read of
ImplGetSVData()->mxAccessBridge - this should work until ImplSVData is
deleted, by which time no Windows should exist anymore that could be
receiving messages.

This fixes part of the problem, winaccessibility also needs to stop
using SolarMutex.

Change-Id: I62b027ad06d2c3eb06a5f64b052a4acd0908f79c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152958
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index e0a99d8e8779..2e60f38c1f11 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5395,30 +5395,43 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM 
wParam )
 static bool
 ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet)
 {
-if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+uno::Reference xMSAA;
+if (ImplSalYieldMutexTryToAcquire())
 {
-// IA2 should be enabled automatically
-AllSettings aSettings = Application::GetSettings();
-MiscSettings aMisc = aSettings.GetMiscSettings();
-aMisc.SetEnableATToolSupport(true);
-// The above is enough, since aMisc changes the same shared 
ImplMiscData as used in global
-// settings, so no need to call aSettings.SetMiscSettings and 
Application::SetSettings
-
 if 
(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
-return false; // locked down somehow ?
-}
+{
+// IA2 should be enabled automatically
+AllSettings aSettings = Application::GetSettings();
+MiscSettings aMisc = aSettings.GetMiscSettings();
+aMisc.SetEnableATToolSupport(true);
+// The above is enough, since aMisc changes the same shared 
ImplMiscData as used in global
+// settings, so no need to call aSettings.SetMiscSettings and 
Application::SetSettings
+
+if 
(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+return false; // locked down somehow ?
+}
 
-ImplSVData* pSVData = ImplGetSVData();
+ImplSVData* pSVData = ImplGetSVData();
 
-// Make sure to launch Accessibility only the following criteria are 
satisfied
-// to avoid RFT interrupts regular accessibility processing
-if ( !pSVData->mxAccessBridge.is() )
-{
-if( !InitAccessBridge() )
-return false;
+// Make sure to launch Accessibility only the following criteria are 
satisfied
+// to avoid RFT interrupts regular accessibility processing
+if ( !pSVData->mxAccessBridge.is() )
+{
+if( !InitAccessBridge() )
+return false;
+}
+xMSAA.set(pSVData->mxAccessBridge, uno::UNO_QUERY);
+ImplSalYieldMutexRelease();
+}
+else
+{   // tdf#155794: access without locking: hopefully this should be fine
+// as the bridge is typically inited in Desktop::Main() already and the
+// WM_GETOBJECT is received only on the main thread and by the time in
+// VCL shutdown when ImplSvData dies there should not be Windows any
+// more that could receive messages.
+xMSAA.set(ImplGetSVData()->mxAccessBridge, uno::UNO_QUERY);
 }
 
-uno::Reference< accessibility::XMSAAService > xMSAA( 
pSVData->mxAccessBridge, uno::UNO_QUERY );
 if ( xMSAA.is() )
 {
 sal_Int32 lParam32 = static_cast(lParam);
@@ -5963,12 +5976,11 @@ static LRESULT CALLBACK SalFrameWndProc( HWND hWnd, 
UINT nMsg, WPARAM wParam, LP
 break;
 
 case WM_GETOBJECT:

[Libreoffice-commits] core.git: vcl/win

2023-03-15 Thread Noel Grandin (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |   55 ++--
 vcl/win/dtrans/WinClipboard.hxx |   13 +
 2 files changed, 27 insertions(+), 41 deletions(-)

New commits:
commit 5f661a23346858c6162356d92a9f026f288ce31d
Author: Noel Grandin 
AuthorDate: Wed Mar 15 10:07:13 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 15 09:22:33 2023 +

BaseMutex->std::mutex in CWinClipboard

Change-Id: Icabb28d58af5a1e2c5f44513fbbe18da3fd69b03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148908
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index c2fa269dfc5d..f82c56784523 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -58,8 +58,7 @@ osl::Mutex s_aClipboardSingletonMutex;
 /*XEventListener,*/
 CWinClipboard::CWinClipboard(const uno::Reference& 
rxContext,
  const OUString& aClipboardName)
-: WeakComponentImplHelper(m_aMutex)
-, m_xContext(rxContext)
+: m_xContext(rxContext)
 , m_itsName(aClipboardName)
 , m_pCurrentClipContent(nullptr)
 {
@@ -95,7 +94,7 @@ uno::Reference SAL_CALL 
CWinClipboard::getContents(
 {
 osl::MutexGuard aGuard(m_aContentMutex);
 
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -139,7 +138,7 @@ IDataObjectPtr CWinClipboard::getIDataObject()
 {
 osl::MutexGuard aGuard(m_aContentMutex);
 
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -163,7 +162,7 @@ void SAL_CALL CWinClipboard::setContents(
 {
 osl::MutexGuard aGuard(m_aContentMutex);
 
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -189,7 +188,7 @@ void SAL_CALL CWinClipboard::setContents(
 
 OUString SAL_CALL CWinClipboard::getName()
 {
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -202,7 +201,7 @@ void SAL_CALL CWinClipboard::flushClipboard()
 {
 osl::MutexGuard aGuard(m_aContentMutex);
 
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -224,7 +223,7 @@ void SAL_CALL CWinClipboard::flushClipboard()
 
 sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities()
 {
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -237,7 +236,7 @@ sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities()
 void SAL_CALL CWinClipboard::addClipboardListener(
 const uno::Reference& 
listener)
 {
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -246,13 +245,14 @@ void SAL_CALL CWinClipboard::addClipboardListener(
 throw lang::IllegalArgumentException("empty reference", 
static_cast(this),
  1);
 
-rBHelper.aLC.addInterface(cppu::UnoType::get(), 
listener);
+std::unique_lock aGuard(m_aMutex);
+maClipboardListeners.addInterface(aGuard, listener);
 }
 
 void SAL_CALL CWinClipboard::removeClipboardListener(
 const uno::Reference& 
listener)
 {
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
@@ -261,50 +261,35 @@ void SAL_CALL CWinClipboard::removeClipboardListener(
 throw lang::IllegalArgumentException("empty reference", 
static_cast(this),
  1);
 
-rBHelper.aLC.removeInterface(cppu::UnoType::get(), 
listener);
+std::unique_lock aGuard(m_aMutex);
+maClipboardListeners.removeInterface(aGuard, listener);
 }
 
 void CWinClipboard::notifyAllClipboardListener()
 {
-if (rBHelper.bDisposed)
+if (m_bDisposed)
 return;
 
-osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
-if (rBHelper.bDisposed)
+std::unique_lock aGuard(m_aMutex);
+if (m_bDisposed)
 return;
-aGuard.clear();
 
-cppu::OInterfaceContainerHelper* pICHelper = rBHelper.aLC.getContainer(
-cppu::UnoType::get());
-if (!pICHelper)
+if (!maClipboardListeners.getLength(aGuard))
 return;
 
 try
 {
-cppu::OInterfaceIteratorHelper iter(*pICHelper);
 uno::Reference 

[Libreoffice-commits] core.git: vcl/win

2023-02-12 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |   53 
 1 file changed, 34 insertions(+), 19 deletions(-)

New commits:
commit 2dded7d07ac818da920644a595b7e9331458e70d
Author: Caolán McNamara 
AuthorDate: Sun Feb 12 20:21:35 2023 +
Commit: Caolán McNamara 
CommitDate: Sun Feb 12 21:31:35 2023 +

Resolves: tdf#153566 set darkmode menubar background color

because we use it for custom menu titles backgrounds

Change-Id: I1ae679bc032d29c4901befc2f1b0cbb53d0a5d1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146842
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 5bccf6707700..638c02e38a8a 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2668,6 +2668,34 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 Color aMenuBarRolloverTextColor;
 Color aHighlightTextColor = 
ImplWinColorToSal(GetSysColor(COLOR_HIGHLIGHTTEXT));
 
+BOOL bFlatMenus = FALSE;
+SystemParametersInfoW( SPI_GETFLATMENU, 0, , 0);
+if( bFlatMenus )
+{
+aStyleSettings.SetUseFlatMenus( true );
+// flat borders for our controls etc. as well in this mode (ie, no 3d 
borders)
+// this is not active in the classic style appearance
+aStyleSettings.SetUseFlatBorders( true );
+}
+else
+{
+aStyleSettings.SetUseFlatMenus( false );
+aStyleSettings.SetUseFlatBorders( false );
+}
+
+if( bFlatMenus )
+{
+aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENUHILIGHT ) ) );
+aStyleSettings.SetMenuBarRolloverColor( ImplWinColorToSal( 
GetSysColor( COLOR_MENUHILIGHT ) ) );
+aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DSHADOW ) ) );
+}
+else
+{
+aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( 
COLOR_HIGHLIGHT ) ) );
+aStyleSettings.SetMenuBarRolloverColor( ImplWinColorToSal( 
GetSysColor( COLOR_HIGHLIGHT ) ) );
+aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DLIGHT ) ) );
+}
+
 const bool bUseDarkMode(UseDarkMode());
 
 OUString sThemeName(!bUseDarkMode ? u"colibre" : u"colibre_dark");
@@ -2711,6 +2739,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 hTheme = OpenThemeData(mhWnd, L"Toolbar");
 GetThemeColor(hTheme, 0, 0, TMT_FILLCOLOR, );
 aStyleSettings.SetInactiveTabColor( ImplWinColorToSal( color ) );
+// see ImplDrawNativeControl for dark mode
+aStyleSettings.SetMenuBarColor( aStyleSettings.GetWindowColor() );
 CloseThemeData(hTheme);
 
 hTheme = OpenThemeData(mhWnd, L"Textstyle");
@@ -2738,6 +2768,10 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENUTEXT ) ) );
 aMenuBarTextColor = ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) );
 aMenuBarRolloverTextColor = aHighlightTextColor;
+if( bFlatMenus )
+aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENUBAR ) ) );
+else
+aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENU ) ) );
 aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() );
 aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() );
 }
@@ -2801,7 +2835,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetHighlightTextColor(aHighlightTextColor);
 aStyleSettings.SetListBoxWindowHighlightColor( 
aStyleSettings.GetHighlightColor() );
 aStyleSettings.SetListBoxWindowHighlightTextColor( 
aStyleSettings.GetHighlightTextColor() );
-aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() );
 aStyleSettings.SetMenuHighlightTextColor( 
aStyleSettings.GetHighlightTextColor() );
 
 ImplSVData* pSVData = ImplGetSVData();
@@ -2810,30 +2843,12 @@ void WinSalFrame::UpdateSettings( AllSettings& 
rSettings )
 pSVData->maNWFData.maMenuBarHighlightTextColor = COL_TRANSPARENT;
 GetSalData()->mbThemeMenuSupport = false;
 aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) 
) );
-aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() );
-aStyleSettings.SetMenuBarRolloverColor( aStyleSettings.GetHighlightColor() 
);
-aStyleSettings.SetMenuBorderColor( aStyleSettings.GetLightBorderColor() ); 
// overridden below for flat menus
-aStyleSettings.SetUseFlatBorders( false );
-aStyleSettings.SetUseFlatMenus( false );
 
aStyleSettings.SetMenuBarHighlightTextColor(aStyleSettings.GetMenuHighlightTextColor());
 aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( 
COLOR_ACTIVECAPTION ) ) );
 aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( 

[Libreoffice-commits] core.git: vcl/win

2023-02-10 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |2 +-
 vcl/win/window/salframe.cxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 86cfb4da4fdca63d92060bcfa65e808f579260f4
Author: Stephan Bergmann 
AuthorDate: Fri Feb 10 08:18:04 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Feb 10 08:59:38 2023 +

loplugin:staticaccess

Change-Id: If0a2032bede27af3176951dabaab4a165efb144d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146738
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index a0379baa7c6c..c837cb7a1c82 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -403,7 +403,7 @@ bool UseDarkMode()
 return false;
 
 bool bRet(false);
-switch (Application::GetSettings().GetMiscSettings().GetDarkMode())
+switch (MiscSettings::GetDarkMode())
 {
 case 0: // auto
 default:
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index b12fdfffbabe..5bccf6707700 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -286,7 +286,7 @@ static void UpdateDarkMode(HWND hWnd)
 auto SetPreferredAppMode = 
reinterpret_cast(GetProcAddress(hUxthemeLib, 
MAKEINTRESOURCEA(135)));
 if (SetPreferredAppMode)
 {
-switch (Application::GetSettings().GetMiscSettings().GetDarkMode())
+switch (MiscSettings::GetDarkMode())
 {
 case 0:
 SetPreferredAppMode(AllowDark);


[Libreoffice-commits] core.git: vcl/win

2023-02-10 Thread Stephan Bergmann (via logerrit)
 vcl/win/window/salframe.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit b8a3d1b7577adce9e4844f6f8915820b98b6d2d8
Author: Stephan Bergmann 
AuthorDate: Fri Feb 10 08:17:23 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Feb 10 08:18:06 2023 +

loplugin:external

Change-Id: Idde40e44254a6c545185470a1db36ab684504bec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146737
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 847156f5b2df..b12fdfffbabe 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -261,6 +261,8 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT 
*pParentRect )
 }
 }
 
+namespace {
+
 enum PreferredAppMode
 {
 AllowDark = 1,
@@ -268,6 +270,8 @@ enum PreferredAppMode
 ForceLight = 3
 };
 
+}
+
 static void UpdateDarkMode(HWND hWnd)
 {
 static bool bOSSupportsDarkMode = OSSupportsDarkMode();


[Libreoffice-commits] core.git: vcl/win

2023-02-03 Thread Stephan Bergmann (via logerrit)
 vcl/win/window/salframe.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5e0748d5bc12f789f9228d514294f8dcb0484b09
Author: Stephan Bergmann 
AuthorDate: Fri Feb 3 15:25:33 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Feb 3 15:37:32 2023 +

Avoid clang-cl -Werror,-Wparentheses

(assuming 9274d41bd72c5310491d81c6d8d938e44ed9d223 "tdf#148085 get a more
readable hyperlink color under windows dark mode" didn't introduce a = vs. 
==
typo)

Change-Id: Ifd72029836726a804bcb0e3b5441aa7943705a76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146543
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index f15a4f23e693..8c43b8448d93 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2683,7 +2683,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetInactiveTabColor( ImplWinColorToSal( color ) );
 CloseThemeData(hTheme);
 
-if (hTheme = OpenThemeData(mhWnd, L"Textstyle"))
+hTheme = OpenThemeData(mhWnd, L"Textstyle");
+if (hTheme)
 {
 GetThemeColor(hTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_NORMAL, 
TMT_TEXTCOLOR, );
 aStyleSettings.SetLinkColor(ImplWinColorToSal(color));


[Libreoffice-commits] core.git: vcl/win

2023-02-01 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 9274d41bd72c5310491d81c6d8d938e44ed9d223
Author: Caolán McNamara 
AuthorDate: Wed Feb 1 15:23:10 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 1 19:28:14 2023 +

tdf#148085 get a more readable hyperlink color under windows dark mode

Change-Id: I392206eb9fcff7fca39c6efee747486f4dfa925e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146458
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 474e48560fb9..f15a4f23e693 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2683,6 +2683,13 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 aStyleSettings.SetInactiveTabColor( ImplWinColorToSal( color ) );
 CloseThemeData(hTheme);
 
+if (hTheme = OpenThemeData(mhWnd, L"Textstyle"))
+{
+GetThemeColor(hTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_NORMAL, 
TMT_TEXTCOLOR, );
+aStyleSettings.SetLinkColor(ImplWinColorToSal(color));
+CloseThemeData(hTheme);
+}
+
 // tdf#148448 pick a warning color more likely to be readable as a
 // background in a dark theme
 aStyleSettings.SetWarningColor(Color(0xf5, 0x79, 0x00));


[Libreoffice-commits] core.git: vcl/win

2023-01-31 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 4332c58eca7df7a30e8f11b9193d7d0727c2a36c
Author: Caolán McNamara 
AuthorDate: Tue Jan 31 10:49:51 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 31 16:49:11 2023 +

tdf#153273 bodge dark scrollbar into drop downs

Change-Id: I9c53b931feb7f720f86edfbb6ae88ff5ee436cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146386
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 8631cdc950fe..1cd6245658d6 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1172,7 +1172,20 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 hTheme = getThemeHandle(mhWnd, L"Button", mWinSalGraphicsImplBase);
 break;
 case ControlType::Scrollbar:
-hTheme = getThemeHandle(mhWnd, L"Scrollbar", 
mWinSalGraphicsImplBase);
+if (bUseDarkMode)
+{
+// tdf#153273 undo the earlier SetWindowTheme, and use an 
explicit Explorer::Scrollbar
+// a) with "Scrollbar" and SetWindowTheme(... "Explorer" ...) 
then scrollbars in dialog
+// and main windows are dark, but dropdowns are light
+// b) with "Explorer::Scrollbar" and SetWindowTheme(... 
"Explorer" ...) then scrollbars
+// in dropdowns are dark, but scrollbars in dialogs and main 
windows are sort of "extra
+// dark"
+// c) with "Explorer::Scrollbar" and no SetWindowTheme both 
cases are dark
+SetWindowTheme(mhWnd, nullptr, nullptr);
+hTheme = getThemeHandle(mhWnd, L"Explorer::Scrollbar", 
mWinSalGraphicsImplBase);
+}
+else
+hTheme = getThemeHandle(mhWnd, L"Scrollbar", 
mWinSalGraphicsImplBase);
 break;
 case ControlType::Combobox:
 if( nPart == ControlPart::Entire )


[Libreoffice-commits] core.git: vcl/win

2023-01-31 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit 64b8057a6cd2fbaed6167e2be912914e9569796c
Author: Caolán McNamara 
AuthorDate: Tue Jan 31 10:22:35 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 31 15:06:37 2023 +

tdf#153287 rollover in dark mode with "Explorer" is incongruous

Using "CFD" gives a brighter border with rollover, but no notable
focus state when focused. Try a combination here to get something
decent.

Change-Id: If7844cb0f1e88410959aa622b0271c3f3954230e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146384
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 1c177a1b2a97..8631cdc950fe 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1176,7 +1176,11 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 break;
 case ControlType::Combobox:
 if( nPart == ControlPart::Entire )
+{
+if (bUseDarkMode && !(nState & ControlState::FOCUSED))
+SetWindowTheme(mhWnd, L"CFD", nullptr);
 hTheme = getThemeHandle(mhWnd, L"Edit", 
mWinSalGraphicsImplBase);
+}
 else if( nPart == ControlPart::ButtonDown )
 {
 if (bUseDarkMode)
@@ -1186,7 +1190,11 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 break;
 case ControlType::Spinbox:
 if( nPart == ControlPart::Entire )
+{
+if (bUseDarkMode && !(nState & ControlState::FOCUSED))
+SetWindowTheme(mhWnd, L"CFD", nullptr);
 hTheme = getThemeHandle(mhWnd, L"Edit", 
mWinSalGraphicsImplBase);
+}
 else
 hTheme = getThemeHandle(mhWnd, L"Spin", 
mWinSalGraphicsImplBase);
 break;
@@ -1194,6 +1202,10 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 hTheme = getThemeHandle(mhWnd, L"Spin", mWinSalGraphicsImplBase);
 break;
 case ControlType::Editbox:
+if (bUseDarkMode && !(nState & ControlState::FOCUSED))
+SetWindowTheme(mhWnd, L"CFD", nullptr);
+hTheme = getThemeHandle(mhWnd, L"Edit", mWinSalGraphicsImplBase);
+break;
 case ControlType::MultilineEditbox:
 hTheme = getThemeHandle(mhWnd, L"Edit", mWinSalGraphicsImplBase);
 break;


[Libreoffice-commits] core.git: vcl/win

2023-01-24 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |   18 ++
 1 file changed, 18 insertions(+)

New commits:
commit 668f55b65849012b359d7d6b9386113facbadc57
Author: Caolán McNamara 
AuthorDate: Tue Jan 24 10:13:20 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 24 12:32:30 2023 +

tdf#152404 crash in Windows with ctrl+alt+c during ExtTextInput

Change-Id: I73ed19eeae49ef737aae372b8f4c053f67a169c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146064
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 1f8c02f66927..4a1a7f1a88d6 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3416,6 +3416,22 @@ static void UnsetAltIfAltGr(SalKeyEvent& rKeyEvt, 
sal_uInt16 nModCode)
 }
 }
 
+// tdf#152404 Commit uncommitted text before dispatching key shortcuts. In
+// certain cases such as pressing Command-Option-C in a Writer document while
+// there is uncommitted text will call AquaSalFrame::EndExtTextInput() which
+// will dispatch a SalEvent::EndExtTextInput event. Writer's handler for that
+// event will delete the uncommitted text and then insert the committed text
+// but LibreOffice will crash when deleting the uncommitted text because
+// deletion of the text also removes and deletes the newly inserted comment.
+static void FlushIMBeforeShortCut(WinSalFrame* pFrame, SalEvent nEvent, 
sal_uInt16 nModCode)
+{
+if (pFrame->mbCandidateMode && nEvent == SalEvent::KeyInput
+&& (nModCode & (KEY_MOD1 | KEY_MOD2)))
+{
+pFrame->EndExtTextInput(EndExtTextInputFlags::Complete);
+}
+}
+
 static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
   WPARAM wParam, LPARAM lParam, LRESULT& rResult )
 {
@@ -3506,6 +3522,7 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 aKeyEvt.mnRepeat= nRepeat;
 
 UnsetAltIfAltGr(aKeyEvt, nModCode);
+FlushIMBeforeShortCut(pFrame, SalEvent::KeyInput, nModCode);
 
 nLastChar = 0;
 nLastVKChar = 0;
@@ -3661,6 +3678,7 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 aKeyEvt.mnRepeat= nRepeat;
 
 UnsetAltIfAltGr(aKeyEvt, nModCode);
+FlushIMBeforeShortCut(pFrame, nEvent, nModCode);
 
 bIgnoreCharMsg = bCharPeek;
 bool nRet = pFrame->CallCallback( nEvent,  );


[Libreoffice-commits] core.git: vcl/win

2023-01-13 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 65596d7062ac4edadeef84cc335a585ffa942fe0
Author: Caolán McNamara 
AuthorDate: Fri Jan 13 08:45:37 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Jan 13 10:32:26 2023 +

tdf#152994 actually return in this case

Change-Id: I40cb4dc4ce1fd3caa2464f92803124c3d2107afb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145433
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index b2c71bf51b78..1c177a1b2a97 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -400,7 +400,7 @@ bool UseDarkMode()
 {
 static bool bOSSupportsDarkMode = OSSupportsDarkMode();
 if (!bOSSupportsDarkMode)
-false;
+return false;
 
 HINSTANCE hUxthemeLib = LoadLibraryExW(L"uxtheme.dll", nullptr, 
LOAD_LIBRARY_SEARCH_SYSTEM32);
 if (!hUxthemeLib)


[Libreoffice-commits] core.git: vcl/win

2022-12-13 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 36898ea11bb4b51c54429648bd45f5c5b7f020d6
Author: Caolán McNamara 
AuthorDate: Mon Dec 12 15:31:22 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 13 10:59:50 2022 +

MBI_NORMAL should be PBS_NORMAL

Change-Id: I263d96e50699fe878ce153dc88ebfd00cd92415b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143999
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 60df85ba814e..b77942ed7885 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2662,9 +2662,9 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 CloseThemeData(hTheme);
 
 hTheme = OpenThemeData(mhWnd, L"Button");
-GetThemeColor(hTheme, BP_PUSHBUTTON, MBI_NORMAL, TMT_TEXTCOLOR, 
);
+GetThemeColor(hTheme, BP_PUSHBUTTON, PBS_NORMAL, TMT_TEXTCOLOR, 
);
 aControlTextColor = ImplWinColorToSal(color);
-GetThemeColor(hTheme, BP_CHECKBOX, MBI_NORMAL, TMT_TEXTCOLOR, );
+GetThemeColor(hTheme, BP_CHECKBOX, PBS_NORMAL, TMT_TEXTCOLOR, );
 aStyleSettings.SetRadioCheckTextColor( ImplWinColorToSal( color ) );
 CloseThemeData(hTheme);
 


[Libreoffice-commits] core.git: vcl/win

2022-11-23 Thread Mike Kaganski (via logerrit)
 vcl/win/window/salframe.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9b3729d63cbed7c343f6c68983a40d9fbf329958
Author: Mike Kaganski 
AuthorDate: Wed Nov 23 11:48:16 2022 +0100
Commit: Mike Kaganski 
CommitDate: Wed Nov 23 12:41:42 2022 +0100

Avoid memory leak on PostMessageW failure

In addition to leaking memory, the struct holds a couple of VclPtr,
so would prevent destroying referenced windows.

Change-Id: I258b5f32aca033a602d7b2805b33bd08ba637309
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143154
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 42c9a802c232..ad54e4f20dbb 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1045,8 +1045,10 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* 
pGraphics )
 
 bool WinSalFrame::PostEvent(std::unique_ptr pData)
 {
-bool const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, 
reinterpret_cast(pData.release()));
+bool const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, 
reinterpret_cast(pData.get()));
 SAL_WARN_IF(!ret, "vcl", "ERROR: PostMessage() failed!");
+if (ret)
+pData.release();
 return ret;
 }
 


[Libreoffice-commits] core.git: vcl/win

2022-10-24 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 87aef8ff9fa55dc8b51c6eb8ae07ab34236503c1
Author: Caolán McNamara 
AuthorDate: Mon Oct 24 10:57:31 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 24 13:11:06 2022 +0200

for windows HighContrast use COLOR_HOTLIGHT for hyperlink color

use the same thing for both unvisited and visited

Change-Id: Icce13ccb88c7ca35e655f01e8ebb8ac92869753c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141729
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 4307ed12ecbb..42c9a802c232 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2712,6 +2712,13 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 Color aHighlightButtonTextColor = aStyleSettings.GetHighContrastMode() ?
 aHighlightTextColor : aControlTextColor;
 
+if (aStyleSettings.GetHighContrastMode())
+{
+Color aLinkColor(ImplWinColorToSal(GetSysColor(COLOR_HOTLIGHT)));
+aStyleSettings.SetLinkColor(aLinkColor);
+aStyleSettings.SetVisitedLinkColor(aLinkColor);
+}
+
 aStyleSettings.SetDefaultButtonTextColor(aHighlightButtonTextColor);
 aStyleSettings.SetButtonTextColor(aControlTextColor);
 aStyleSettings.SetDefaultActionButtonTextColor(aHighlightButtonTextColor);


[Libreoffice-commits] core.git: vcl/win

2022-10-24 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 09dc6fbcd8c441cb7706857ed66d197db9f26254
Author: Caolán McNamara 
AuthorDate: Mon Oct 24 10:09:52 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 24 13:06:00 2022 +0200

Related: tdf#151641 set windows WorkspaceColor similiar to other platforms

from the same bg as the dialog/face, so we get a good "application 
background"
color in dark mode

Change-Id: Ieeb29ed1df177a91691b7b83d056af4068d0e170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141725
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 1c31c5ad06a5..4307ed12ecbb 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2705,6 +2705,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK 
) ) );
 aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_INFOTEXT ) ) );
 
+aStyleSettings.SetWorkspaceColor(aStyleSettings.GetFaceColor());
 aStyleSettings.SetDialogColor(aStyleSettings.GetFaceColor());
 aStyleSettings.SetDialogTextColor(aControlTextColor);
 


[Libreoffice-commits] core.git: vcl/win

2022-10-11 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |   68 
 1 file changed, 68 deletions(-)

New commits:
commit 8815ae462f32915209c838688b7cc86f57e280d4
Author: Stephan Bergmann 
AuthorDate: Tue Oct 11 15:47:49 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Oct 11 22:59:58 2022 +0200

loplugin:unreffun

...after the last use of that RawFontData got removed in
112d07027c4484dd571519911596d11eae897524 "vcl: Use
PhysicalFontFace::GetRawFontData() for font embedding"

Change-Id: Id85eb39b6fd946da132d53ba937032f3c58b061d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141225
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 9d618c6b9c81..75080dae4261 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -85,74 +85,6 @@ static int IntTimes256FromFixed(FIXED f)
 return nFixedTimes256;
 }
 
-namespace {
-
-// raw font data with a scoped lifetime
-class RawFontData
-{
-public:
-explicitRawFontData( HDC, DWORD nTableTag=0 );
-const unsigned char*get() const { return mpRawBytes.get(); }
-const unsigned char*steal() { return mpRawBytes.release(); }
-int   size() const { return mnByteCount; }
-
-private:
-std::unique_ptr mpRawBytes;
-unsignedmnByteCount;
-};
-
-}
-
-RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
-:   mnByteCount( 0 )
-{
-// get required size in bytes
-mnByteCount = ::GetFontData( hDC, nTableTag, 0, nullptr, 0 );
-if (mnByteCount == GDI_ERROR)
-mnByteCount = 0;
-if (!mnByteCount)
-return;
-
-// allocate the array
-mpRawBytes.reset(new unsigned char[ mnByteCount ]);
-
-// get raw data in chunks small enough for GetFontData()
-unsigned nRawDataOfs = 0;
-DWORD nMaxChunkSize = 0x10;
-for(;;)
-{
-// calculate remaining raw data to get
-DWORD nFDGet = mnByteCount - nRawDataOfs;
-if( nFDGet <= 0 )
-break;
-// #i56745# limit GetFontData requests
-if( nFDGet > nMaxChunkSize )
-nFDGet = nMaxChunkSize;
-const DWORD nFDGot = ::GetFontData( hDC, nTableTag, nRawDataOfs,
-mpRawBytes.get() + nRawDataOfs, nFDGet );
-if( !nFDGot )
-break;
-else if( nFDGot != GDI_ERROR )
-nRawDataOfs += nFDGot;
-else
-{
-// was the chunk too big? reduce it
-nMaxChunkSize /= 2;
-if( nMaxChunkSize < 0x1 )
-break;
-}
-}
-
-// cleanup if the raw data is incomplete
-if( nRawDataOfs != mnByteCount )
-{
-mpRawBytes.reset();
-// mnByteCount must correspond to mpRawBytes length
-SAL_WARN( "vcl", "Raw data of font is incomplete: " << nRawDataOfs << 
" byte(s) found whereas " << mnByteCount << " byte(s) expected!" );
-mnByteCount = 0;
-}
-}
-
 // platform specific font substitution hooks for glyph fallback enhancement
 
 namespace {


[Libreoffice-commits] core.git: vcl/win

2022-10-07 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |   40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

New commits:
commit 82ad6bc4e8c081bfb547ad10d29885cbdd0e8ea1
Author: Caolán McNamara 
AuthorDate: Fri Oct 7 12:38:58 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 7 20:26:38 2022 +0200

Related: tdf#98067 get high contrast hover/default button text color right

Normal and high contrast themes seem to behave differently
(in Windows 10)

to play more directly with themes than the usual ui try:
Press Windows Key + R and paste:
shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} 
-Microsoft.Personalization\pageColorization

High Contrast themes seem different to the others, with a high contrast
theme set then its possible to customize the colors, otherwise not.
Playing with 'Selected Text' it seems that this is the color used for
the active/hover button text color with a high contrast theme.

Change-Id: I561616fce6a6f6d781e4881bfdf8ba0abedcd75c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141051
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 95cb08e20b07..d2d2f697aeb3 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2615,6 +2615,15 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 
 StyleSettings aStyleSettings = rSettings.GetStyleSettings();
 
+// High contrast
+HIGHCONTRAST hc;
+hc.cbSize = sizeof( HIGHCONTRAST );
+if( SystemParametersInfoW( SPI_GETHIGHCONTRAST, hc.cbSize, , 0 )
+&& (hc.dwFlags & HCF_HIGHCONTRASTON) )
+aStyleSettings.SetHighContrastMode( true );
+else
+aStyleSettings.SetHighContrastMode( false );
+
 aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) );
 aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) );
 UINT blinkTime = GetCaretBlinkTime();
@@ -2630,6 +2639,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 Color aControlTextColor;
 Color aMenuBarTextColor;
 Color aMenuBarRolloverTextColor;
+Color aHighlightTextColor = 
ImplWinColorToSal(GetSysColor(COLOR_HIGHLIGHTTEXT));
 
 const bool bUseDarkMode(UseDarkMode());
 
@@ -2680,7 +2690,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetRadioCheckTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
 aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENUTEXT ) ) );
 aMenuBarTextColor = ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) );
-aMenuBarRolloverTextColor = ImplWinColorToSal( GetSysColor( 
COLOR_HIGHLIGHTTEXT ) );
+aMenuBarRolloverTextColor = aHighlightTextColor;
 }
 
 if ( std::optional aColor = 
aStyleSettings.GetPersonaMenuBarTextColor() )
@@ -2703,16 +2713,19 @@ void WinSalFrame::UpdateSettings( AllSettings& 
rSettings )
 aStyleSettings.SetDialogColor(aStyleSettings.GetFaceColor());
 aStyleSettings.SetDialogTextColor(aControlTextColor);
 
-aStyleSettings.SetDefaultButtonTextColor(aControlTextColor);
+Color aHighlightButtonTextColor = aStyleSettings.GetHighContrastMode() ?
+aHighlightTextColor : aControlTextColor;
+
+aStyleSettings.SetDefaultButtonTextColor(aHighlightButtonTextColor);
 aStyleSettings.SetButtonTextColor(aControlTextColor);
-aStyleSettings.SetDefaultActionButtonTextColor(aControlTextColor);
+aStyleSettings.SetDefaultActionButtonTextColor(aHighlightButtonTextColor);
 aStyleSettings.SetActionButtonTextColor(aControlTextColor);
 aStyleSettings.SetFlatButtonTextColor(aControlTextColor);
-aStyleSettings.SetDefaultButtonRolloverTextColor(aControlTextColor);
-aStyleSettings.SetButtonRolloverTextColor(aControlTextColor);
-aStyleSettings.SetDefaultActionButtonRolloverTextColor(aControlTextColor);
-aStyleSettings.SetActionButtonRolloverTextColor(aControlTextColor);
-aStyleSettings.SetFlatButtonRolloverTextColor(aControlTextColor);
+
aStyleSettings.SetDefaultButtonRolloverTextColor(aHighlightButtonTextColor);
+aStyleSettings.SetButtonRolloverTextColor(aHighlightButtonTextColor);
+
aStyleSettings.SetDefaultActionButtonRolloverTextColor(aHighlightButtonTextColor);
+aStyleSettings.SetActionButtonRolloverTextColor(aHighlightButtonTextColor);
+aStyleSettings.SetFlatButtonRolloverTextColor(aHighlightButtonTextColor);
 aStyleSettings.SetDefaultButtonPressedRolloverTextColor(aControlTextColor);
 aStyleSettings.SetButtonPressedRolloverTextColor(aControlTextColor);
 
aStyleSettings.SetDefaultActionButtonPressedRolloverTextColor(aControlTextColor);
@@ -2732,7 +2745,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetFieldRolloverTextColor( 
aStyleSettings.GetFieldTextColor() );
 

[Libreoffice-commits] core.git: vcl/win

2022-10-06 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 6d724a494e37412c3fd2e5d0e5e54bda177c4108
Author: Caolán McNamara 
AuthorDate: Thu Oct 6 20:54:23 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 7 00:14:39 2022 +0200

tdf#98067 get menu readable in windows high contrast mode

possibly a problem since:

commit 9c5a22d19708eae17ad9880422bd03e81ea48c5d
Date:   Thu Jun 21 17:55:53 2012 +0200

aero toolbar: Extend the drawing of the toolbar to the menubar area.

Change-Id: If76be9bf09a19992dafedf16d7e577acf1bc500d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141034
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index ec86df4e963d..331e6c36ef5b 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -891,7 +891,8 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 }
 
 // make it more compatible with Aero
-if( ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames )
+if (ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames &&
+   
!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
 {
 impl_drawAeroToolbar( hDC, rc, nPart == 
ControlPart::DrawBackgroundHorz );
 return true;
@@ -922,7 +923,8 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 }
 
 // make it more compatible with Aero
-if( ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames )
+if (ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames &&
+
!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
 {
 impl_drawAeroToolbar( hDC, rc, true );
 return true;


[Libreoffice-commits] core.git: vcl/win

2022-09-19 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit e9262729e6b41065596af8092905bafe986803e9
Author: Stephan Bergmann 
AuthorDate: Sat Sep 17 12:52:53 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Sep 19 23:14:05 2022 +0200

loplugin:unreffun (clang-cl)

...and with ScopedFontHDC::fsp gone, there appears to be no reason to keep
ScopedFontHDC::m_aFSP alive for the whole lifetime of the ScopedFontHDC
instance

Change-Id: I1028bc24f49f3bbaf6e23c09aef4459418267154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140100
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index a126dffb3ebd..058c24284cc9 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1456,15 +1456,15 @@ class ScopedFontHDC final
 public:
 explicit ScopedFontHDC(WinSalGraphics& rGraphics, const 
vcl::font::PhysicalFontFace& rFontFace)
 // use height=1000 for easier debugging (to match psprint's font units)
-: m_aFSP(rFontFace, Size(0,1000), 1000.0, 0, false)
-, m_hDC(nullptr)
+: m_hDC(nullptr)
 , m_hOrigFont(nullptr)
 {
 m_hDC = CreateCompatibleDC(rGraphics.getHDC());
 if (!m_hDC)
 return;
 
-rGraphics.ImplDoSetFont(m_hDC, m_aFSP, , m_hOrigFont);
+vcl::font::FontSelectPattern aFSP(rFontFace, Size(0,1000), 1000.0, 0, 
false);
+rGraphics.ImplDoSetFont(m_hDC, aFSP, , m_hOrigFont);
 }
 
 ~ScopedFontHDC()
@@ -1476,10 +1476,8 @@ public:
 }
 
 HDC hdc() const { return m_hDC; }
-const vcl::font::FontSelectPattern& fsp() const { return m_aFSP; }
 
 private:
-vcl::font::FontSelectPattern m_aFSP;
 HDC m_hDC;
 HFONT m_hOrigFont;
 };


[Libreoffice-commits] core.git: vcl/win

2022-09-19 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2f1ad908310918d964b2996ccf4e987b7b0af86f
Author: Caolán McNamara 
AuthorDate: Mon Sep 19 17:26:15 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Sep 19 22:25:54 2022 +0200

tdf#151052 set Windows darkmode "ToolTextColor" to same as "WindowTextColor"

they are the same in light mode, so do the same in darkmode

Change-Id: Ib0186383fcd7f8d74c7ada6826c6955a747e4ecd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140195
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 1d8d372e5053..9880613e7fa3 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2640,6 +2640,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetWindowColor( ImplWinColorToSal( color ) );
 GetThemeColor(hTheme, 0, 0, TMT_TEXTCOLOR, );
 aStyleSettings.SetWindowTextColor( ImplWinColorToSal( color ) );
+aStyleSettings.SetToolTextColor( ImplWinColorToSal( color ) );
 CloseThemeData(hTheme);
 
 hTheme = OpenThemeData(mhWnd, L"Button");
@@ -2667,6 +2668,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( 
COLOR_3DFACE ) ) );
 aStyleSettings.SetWindowColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOW ) ) );
 aStyleSettings.SetWindowTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
+aStyleSettings.SetToolTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
 aControlTextColor = ImplWinColorToSal(GetSysColor(COLOR_BTNTEXT));
 aStyleSettings.SetRadioCheckTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
 aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENUTEXT ) ) );
@@ -2717,7 +2719,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 aStyleSettings.SetGroupTextColor( aStyleSettings.GetRadioCheckTextColor() 
);
 aStyleSettings.SetLabelTextColor( aStyleSettings.GetRadioCheckTextColor() 
);
 aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() );
-aStyleSettings.SetToolTextColor( ImplWinColorToSal( GetSysColor( 
COLOR_WINDOWTEXT ) ) );
 aStyleSettings.SetFieldColor( aStyleSettings.GetWindowColor() );
 aStyleSettings.SetListBoxWindowBackgroundColor( 
aStyleSettings.GetWindowColor() );
 aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() );


[Libreoffice-commits] core.git: vcl/win

2022-09-17 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

New commits:
commit 0ce0f7f81f53d8ac416c439ca2ec9b4ebbb305a5
Author: Stephan Bergmann 
AuthorDate: Sat Sep 17 12:51:34 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Sep 17 15:40:49 2022 +0200

loplugin:staticmethods (clang-cl)

Change-Id: I875b60fba5267e158ac85d1442133f1bd4bfe560
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140099
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 75ef19c86e8a..a126dffb3ebd 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -169,14 +169,10 @@ class WinGlyphFallbackSubstititution
 {
 public:
 bool FindFontSubstitute(vcl::font::FontSelectPattern&, 
LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const override;
-private:
-bool HasMissingChars(vcl::font::PhysicalFontFace*, OUString& 
rMissingChars) const;
 };
 
-}
-
 // does a font face hold the given missing characters?
-bool 
WinGlyphFallbackSubstititution::HasMissingChars(vcl::font::PhysicalFontFace* 
pFace, OUString& rMissingChars) const
+bool HasMissingChars(vcl::font::PhysicalFontFace* pFace, OUString& 
rMissingChars)
 {
 FontCharMapRef xFontCharMap = pFace->GetFontCharMap();
 
@@ -205,8 +201,6 @@ bool 
WinGlyphFallbackSubstititution::HasMissingChars(vcl::font::PhysicalFontFace
 return nMatchCount > 0;
 }
 
-namespace
-{
 //used by 2-level font fallback
 vcl::font::PhysicalFontFamily* findDevFontListByLocale(const 
vcl::font::PhysicalFontCollection ,
 const LanguageTag& 
rLanguageTag )


[Libreoffice-commits] core.git: vcl/win

2022-09-17 Thread Stephan Bergmann (via logerrit)
 vcl/win/window/salframe.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 9bed2b595688e73a72688852ec5d949d59fb7c2a
Author: Stephan Bergmann 
AuthorDate: Sat Sep 17 12:58:10 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Sep 17 14:33:15 2022 +0200

-Werror,-Wshadow (clang-cl)

Change-Id: I58d99d17baf8dc13e4dc951bf281d7c7c358d259
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140101
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index c16a8fd2e8d1..fce43c02602b 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1326,17 +1326,17 @@ void WinSalFrame::SetPosSize( tools::Long nX, 
tools::Long nY, tools::Long nWidth
 {
 // center window
 
-HWND hWndParent = ::GetParent( mhWnd );
+HWND hWndParent2 = ::GetParent( mhWnd );
 // Search for TopLevel Frame
-while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_CHILD) )
-hWndParent = ::GetParent( hWndParent );
+while ( hWndParent2 && (GetWindowStyle( hWndParent2 ) & WS_CHILD) )
+hWndParent2 = ::GetParent( hWndParent2 );
 // if the Window has a Parent, then center the window to
 // the parent, in the other case to the screen
-if ( hWndParent && !IsIconic( hWndParent ) &&
- (GetWindowStyle( hWndParent ) & WS_VISIBLE) )
+if ( hWndParent2 && !IsIconic( hWndParent2 ) &&
+ (GetWindowStyle( hWndParent2 ) & WS_VISIBLE) )
 {
 RECT aParentRect;
-GetWindowRect( hWndParent,  );
+GetWindowRect( hWndParent2,  );
 int nParentWidth= aParentRect.right-aParentRect.left;
 int nParentHeight   = aParentRect.bottom-aParentRect.top;
 


[Libreoffice-commits] core.git: vcl/win

2022-09-14 Thread Noel Grandin (via logerrit)
 vcl/win/app/salinfo.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 970b87bb7b7d77ef12dbcad6ed7caa8edd92e413
Author: Noel Grandin 
AuthorDate: Wed Sep 14 15:09:05 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 14 20:30:42 2022 +0200

should be releasing the DC here

Change-Id: If2460da367356ef04ca344542c2c82f8283c9e67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139935
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 2787797a6ce5..c028939fd65a 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -133,6 +133,7 @@ bool WinSalSystem::initMonitors()
 m_aMonitors[ i ].m_aName = rDev + " (" + OUString::number( 
nInstance ) + ")";
 }
 }
+ReleaseDC(nullptr, aDesktopRC);
 }
 
 return m_aMonitors.size() > 0;


[Libreoffice-commits] core.git: vcl/win

2022-09-12 Thread Samuel Mehrbrodt (via logerrit)
 vcl/win/window/salframe.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 0d5fcb9abdead51a55f1f611d59fd0128ace57a8
Author: Samuel Mehrbrodt 
AuthorDate: Thu Sep 1 14:19:50 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Sep 12 08:46:39 2022 +0200

Fix dropdown mispositioned

Only skip the relative positioning when the window is indeed a dialog.

Follow up fix for a49245e04d45735aa76ad7720657c83530ba9ed8

Change-Id: Idbd8327a943c512f0a617cb0ca72e9caeb2e61e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139204
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 1335c61ad170..c16a8fd2e8d1 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1257,13 +1257,16 @@ void WinSalFrame::SetPosSize( tools::Long nX, 
tools::Long nY, tools::Long nWidth
 nWidth  = aWinRect.right - aWinRect.left + 1;
 nHeight = aWinRect.bottom - aWinRect.top + 1;
 
+HWND hWndParent = ImplGetParentHwnd(mhWnd);
 // For dialogs (WS_POPUP && WS_DLGFRAME), we need to find the "real" 
parent,
 // in case multiple dialogs are stacked on each other
-// (wo don't want to position the second dialog relative to the first one, 
but relative to the main window)
-HWND hWndParent = ImplGetParentHwnd(mhWnd);
-while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_POPUP) &&  
(GetWindowStyle( hWndParent ) & WS_DLGFRAME) )
+// (we don't want to position the second dialog relative to the first one, 
but relative to the main window)
+if ( (GetWindowStyle( mhWnd ) & WS_POPUP) &&  (GetWindowStyle( mhWnd ) & 
WS_DLGFRAME) ) // mhWnd is a dialog
 {
-hWndParent = ::ImplGetParentHwnd( hWndParent );
+while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_POPUP) &&  
(GetWindowStyle( hWndParent ) & WS_DLGFRAME) )
+{
+hWndParent = ::ImplGetParentHwnd( hWndParent );
+}
 }
 
 if ( !(nPosSize & SWP_NOMOVE) && hWndParent )


[Libreoffice-commits] core.git: vcl/win

2022-09-09 Thread Michael Weghorn (via logerrit)
 vcl/win/gdi/DWriteTextRenderer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c9974818bdf9ab8ccf2f8db140ff6b2b3eb1c461
Author: Michael Weghorn 
AuthorDate: Fri Sep 9 11:56:17 2022 +0100
Commit: خالد حسني 
CommitDate: Sat Sep 10 07:55:11 2022 +0200

win: Explicitly cast glyph ID to 16 bit

After

commit ba02639c9c17d75e73fc2eff83e64c116fcdaeb2
Date:   Wed Sep 7 11:00:26 2022 +0200

vcl: Make glyph IDs 32bit

, my clang-cl Windows build would otherwise fail as follows:

[build CXX] vcl/win/gdi/DWriteTextRenderer.cxx
[build CUS] postprocess/images

C:/tools/cygwin/home/michael/development/git/libreoffice/vcl/win/gdi/DWriteTextRenderer.cxx(264,39):
 error: non-constant-expression cannot be narrowed from type 'sal_GlyphId' (aka 
'unsigned int') to 'UINT16'
  (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
UINT16 glyphIndices[] = { pGlyph->glyphId() };
  ^

C:/tools/cygwin/home/michael/development/git/libreoffice/vcl/win/gdi/DWriteTextRenderer.cxx(264,39):
 note: insert an explicit cast to silence this issue
UINT16 glyphIndices[] = { pGlyph->glyphId() };
  ^
  static_cast( )
1 error generated.

Change-Id: Ifa4fcdd98331378b5d9340f961e0bc4d7e842fe2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139721
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 835e09e7eed9..c160166a541e 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -261,7 +261,7 @@ bool 
D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
 const GlyphItem* pGlyph;
 while (rLayout.GetNextGlyph(, aPos, nStart))
 {
-UINT16 glyphIndices[] = { pGlyph->glyphId() };
+UINT16 glyphIndices[] = { static_cast(pGlyph->glyphId()) };
 FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) / 
fHScale };
 DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
 D2D1_POINT_2F baseline = { static_cast(aPos.getX() - 
bounds.Left()) / fHScale,


[Libreoffice-commits] core.git: vcl/win

2022-09-06 Thread Mike Kaganski (via logerrit)
 vcl/win/window/salobj.cxx |  122 +-
 1 file changed, 37 insertions(+), 85 deletions(-)

New commits:
commit a71f537c0243fd89b7bc153889fee0a65fed6726
Author: Mike Kaganski 
AuthorDate: Tue Sep 6 15:01:05 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Sep 6 18:59:07 2022 +0200

Simplify SalSysObj(Child)WndProcW

Change-Id: I578410db327c98cde5e6e2a9f802e4de5b64a539
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139492
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx
index e2ba3856b1de..05ad16b0d4cd 100644
--- a/vcl/win/window/salobj.cxx
+++ b/vcl/win/window/salobj.cxx
@@ -258,62 +258,52 @@ void ImplSalPostDispatchMsg( const MSG* pMsg )
 pSalData->mnSalObjWantKeyEvt = 0;
 }
 
-static LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, 
LPARAM lParam, int& rDef )
+static LRESULT CALLBACK SalSysObjWndProcW(HWND hWnd, UINT nMsg, WPARAM wParam, 
LPARAM lParam)
 {
-WinSalObject*   pSysObj;
-LRESULT nRet = 0;
-
 switch( nMsg )
 {
 case WM_ERASEBKGND:
-nRet = 1;
-rDef = FALSE;
-break;
+return 1;
 case WM_PAINT:
 {
 PAINTSTRUCT aPs;
 BeginPaint( hWnd,  );
 EndPaint( hWnd,  );
-rDef = FALSE;
 }
-break;
+return 0;
 
 case WM_PARENTNOTIFY:
-{
-UINT nNotifyMsg = LOWORD( wParam );
-if ( (nNotifyMsg == WM_LBUTTONDOWN) ||
+if (UINT nNotifyMsg = LOWORD(wParam);
+ (nNotifyMsg == WM_LBUTTONDOWN) ||
  (nNotifyMsg == WM_RBUTTONDOWN) ||
  (nNotifyMsg == WM_MBUTTONDOWN) )
 {
 ImplSalYieldMutexAcquireWithWait();
-pSysObj = GetSalObjWindowPtr( hWnd );
+WinSalObject* pSysObj = GetSalObjWindowPtr(hWnd);
 if ( pSysObj && !pSysObj->IsMouseTransparent() )
 pSysObj->CallCallback( SalObjEvent::ToTop );
 ImplSalYieldMutexRelease();
 }
-}
 break;
 
 case WM_MOUSEACTIVATE:
-{
 ImplSalYieldMutexAcquireWithWait();
-pSysObj = GetSalObjWindowPtr( hWnd );
-if ( pSysObj && !pSysObj->IsMouseTransparent() )
+if (WinSalObject* pSysObj = GetSalObjWindowPtr(hWnd);
+pSysObj && !pSysObj->IsMouseTransparent())
 {
 bool const ret = PostMessageW( hWnd, SALOBJ_MSG_TOTOP, 0, 0 );
 SAL_WARN_IF(!ret, "vcl", "ERROR: PostMessage() failed!");
 }
 ImplSalYieldMutexRelease();
-}
 break;
 
 case SALOBJ_MSG_TOTOP:
 if ( ImplSalYieldMutexTryToAcquire() )
 {
-pSysObj = GetSalObjWindowPtr( hWnd );
-pSysObj->CallCallback( SalObjEvent::ToTop );
+if (WinSalObject* pSysObj = GetSalObjWindowPtr(hWnd))
+pSysObj->CallCallback(SalObjEvent::ToTop);
 ImplSalYieldMutexRelease();
-rDef = FALSE;
+return 0;
 }
 else
 {
@@ -325,7 +315,7 @@ static LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT 
nMsg, WPARAM wParam, L
 case SALOBJ_MSG_POSTFOCUS:
 if ( ImplSalYieldMutexTryToAcquire() )
 {
-pSysObj = GetSalObjWindowPtr( hWnd );
+WinSalObject* pSysObj = GetSalObjWindowPtr(hWnd);
 HWNDhFocusWnd = ::GetFocus();
 SalObjEvent nEvent;
 if ( hFocusWnd && ImplIsSysWindowOrChild( hWnd, hFocusWnd ) )
@@ -340,67 +330,44 @@ static LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT 
nMsg, WPARAM wParam, L
 bool const ret = PostMessageW(hWnd, SALOBJ_MSG_POSTFOCUS, 0, 
0);
 SAL_WARN_IF(!ret, "vcl", "ERROR: PostMessage() failed!");
 }
-rDef = FALSE;
-break;
+return 0;
 
 case WM_SIZE:
-{
-HWND hWndChild = GetWindow( hWnd, GW_CHILD );
-if ( hWndChild )
+if (HWND hWndChild = GetWindow(hWnd, GW_CHILD))
 {
 SetWindowPos( hWndChild,
   nullptr, 0,  0, static_cast(LOWORD( lParam 
)), static_cast(HIWORD( lParam )),
   SWP_NOZORDER | SWP_NOACTIVATE );
 }
-}
-rDef = FALSE;
-break;
+return 0;
 
 case WM_CREATE:
 {
 // Save the window instance at the window handle.
-// Can also be used for the A-Version, because the struct
-// to access lpCreateParams is the same structure
 CREATESTRUCTW* pStruct = 

[Libreoffice-commits] core.git: vcl/win

2022-09-06 Thread Mike Kaganski (via logerrit)
 vcl/win/window/salframe.cxx |   22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

New commits:
commit e835b00dc46e3c06dc833c5d4a98c3f40bc98864
Author: Mike Kaganski 
AuthorDate: Tue Sep 6 09:50:02 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Sep 6 10:01:27 2022 +0200

Deduplicate screen rect handling

Change-Id: I5aacadff5ada74c6bc83ac698c87bca75e85ba0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139468
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 0f2d18547bc4..a3941450f6aa 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -756,27 +756,21 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* 
pFrame,
 
 try
 {
+tools::Rectangle aRect;
 sal_Int32 nMonitors = Application::GetScreenCount();
 if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < nMonitors) )
 {
-tools::Rectangle aRect = Application::GetScreenPosSizePixel( 
pFrame->mnDisplay );
-nScreenX = aRect.Left();
-nScreenY = aRect.Top();
-nScreenDX = aRect.GetWidth();
-nScreenDY = aRect.GetHeight();
+aRect = Application::GetScreenPosSizePixel(pFrame->mnDisplay);
 }
 else
 {
-tools::Rectangle aCombined = Application::GetScreenPosSizePixel( 0 
);
-for( sal_Int32 i = 1 ; i < nMonitors ; i++ )
-{
-aCombined.Union( Application::GetScreenPosSizePixel( i ) );
-}
-nScreenX  = aCombined.Left();
-nScreenY  = aCombined.Top();
-nScreenDX = aCombined.GetWidth();
-nScreenDY = aCombined.GetHeight();
+for (sal_Int32 i = 0; i < nMonitors; i++)
+aRect.Union(Application::GetScreenPosSizePixel(i));
 }
+nScreenX = aRect.Left();
+nScreenY = aRect.Top();
+nScreenDX = aRect.GetWidth();
+nScreenDY = aRect.GetHeight();
 }
 catch( Exception& )
 {


[Libreoffice-commits] core.git: vcl/win

2022-08-29 Thread Samuel Mehrbrodt (via logerrit)
 vcl/win/window/salframe.cxx |   23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit a49245e04d45735aa76ad7720657c83530ba9ed8
Author: Samuel Mehrbrodt 
AuthorDate: Mon Aug 29 13:57:10 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Aug 29 15:34:17 2022 +0200

Don't position dialogs relative to other dialogs

When calling setPosSize on a dialog, and there are other dialogs on top of 
it,
the dialog was positioned relative to its parent dialog.

Fix this, so that dialogs are always positioned relative to the main window 
(if there is one).

Revert of/Follow up to 8750c812c9b808ee980f7e0ce0e6ce91e75e1424

Change-Id: I69f189865b118f9bc20077d48591fbd9e83b014f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138994
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index da8a12bf81a9..0f2d18547bc4 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1263,23 +1263,30 @@ void WinSalFrame::SetPosSize( tools::Long nX, 
tools::Long nY, tools::Long nWidth
 nWidth  = aWinRect.right - aWinRect.left + 1;
 nHeight = aWinRect.bottom - aWinRect.top + 1;
 
-if ( !(nPosSize & SWP_NOMOVE) && ::GetParent( mhWnd ) )
+// For dialogs (WS_POPUP && WS_DLGFRAME), we need to find the "real" 
parent,
+// in case multiple dialogs are stacked on each other
+// (wo don't want to position the second dialog relative to the first one, 
but relative to the main window)
+HWND hWndParent = ImplGetParentHwnd(mhWnd);
+while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_POPUP) &&  
(GetWindowStyle( hWndParent ) & WS_DLGFRAME) )
+{
+hWndParent = ::ImplGetParentHwnd( hWndParent );
+}
+
+if ( !(nPosSize & SWP_NOMOVE) && hWndParent )
 {
 RECT aParentRect;
-GetClientRect( ImplGetParentHwnd( mhWnd ),  );
+GetClientRect( hWndParent,  );
 if( AllSettings::GetLayoutRTL() )
 nX = (aParentRect.right - aParentRect.left) - nWidth-1 - nX;
 
-//#110386#, do not transform coordinates for system child windows 
and dialogs
-if( !(GetWindowStyle( mhWnd ) & WS_CHILD) &&
-!(GetWindowStyle( mhWnd ) & WS_DLGFRAME) )
+//#110386#, do not transform coordinates for system child windows
+if( !(GetWindowStyle( mhWnd ) & WS_CHILD) )
 {
 POINT aPt;
 aPt.x = nX;
 aPt.y = nY;
 
-HWND parentHwnd = ImplGetParentHwnd( mhWnd );
-WinSalFrame* pParentFrame = GetWindowPtr( parentHwnd );
+WinSalFrame* pParentFrame = GetWindowPtr( hWndParent );
 if ( pParentFrame && pParentFrame->mnShowState == 
SW_SHOWMAXIMIZED )
 {
 // #i42485#: parent will be shown maximized in which case
@@ -1289,7 +1296,7 @@ void WinSalFrame::SetPosSize( tools::Long nX, tools::Long 
nY, tools::Long nWidth
 aPt.y +=  pParentFrame->maGeometry.y();
 }
 else
-ClientToScreen( parentHwnd,  );
+ClientToScreen( hWndParent,  );
 
 nX = aPt.x;
 nY = aPt.y;


[Libreoffice-commits] core.git: vcl/win

2022-08-17 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |5 -
 vcl/win/window/salframe.cxx   |3 ---
 2 files changed, 8 deletions(-)

New commits:
commit db4c4676b70bb5f9a1c169735e8fbe92b097a57b
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 19:30:10 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 17 12:40:02 2022 +0200

Related: tdf#118320 don't require experimental to be set anymore

Change-Id: Iba42eaa820001651a596b9708504fcc796b406ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138381
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index fe7aabdc0405..ec86df4e963d 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -400,10 +399,6 @@ static bool implDrawNativeMenuMark(HDC hDC, HTHEME hTheme, 
RECT rc, ControlPart
 
 bool UseDarkMode()
 {
-static bool bExperimental = 
officecfg::Office::Common::Misc::ExperimentalMode::get();
-if (!bExperimental)
-return false;
-
 HINSTANCE hUxthemeLib = LoadLibraryExW(L"uxtheme.dll", nullptr, 
LOAD_LIBRARY_SEARCH_SYSTEM32);
 if (!hUxthemeLib)
 return false;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 6dad2785179c..da8a12bf81a9 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -256,9 +256,6 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT 
*pParentRect )
 
 static void UpdateDarkMode(HWND hWnd)
 {
-static bool bExperimental = 
officecfg::Office::Common::Misc::ExperimentalMode::get();
-if (!bExperimental)
-return;
 static bool bOSSupportsDarkMode = OSSupportsDarkMode();
 if (!bOSSupportsDarkMode)
 return;


[Libreoffice-commits] core.git: vcl/win

2022-08-15 Thread Samuel Mehrbrodt (via logerrit)
 vcl/win/window/salframe.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 8750c812c9b808ee980f7e0ce0e6ce91e75e1424
Author: Samuel Mehrbrodt 
AuthorDate: Thu Aug 11 11:53:35 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Aug 15 14:00:50 2022 +0200

Fix mispositioning when only quickstarter is active

When positioning a dialog via external UNO connection,
and no LibreOffice window is visible (only quickstarter is running),
the window was mispositioned.

The ClientToScreen call changes the requested position, so skip that
for dialogs too.

Change-Id: I7656ec66b6aeccdc1fa306f5e05cf72b3cb87214
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138135
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 598b5ea70fa8..6dad2785179c 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1273,8 +1273,9 @@ void WinSalFrame::SetPosSize( tools::Long nX, tools::Long 
nY, tools::Long nWidth
 if( AllSettings::GetLayoutRTL() )
 nX = (aParentRect.right - aParentRect.left) - nWidth-1 - nX;
 
-//#110386#, do not transform coordinates for system child windows
-if( !(GetWindowStyle( mhWnd ) & WS_CHILD) )
+//#110386#, do not transform coordinates for system child windows 
and dialogs
+if( !(GetWindowStyle( mhWnd ) & WS_CHILD) &&
+!(GetWindowStyle( mhWnd ) & WS_DLGFRAME) )
 {
 POINT aPt;
 aPt.x = nX;


[Libreoffice-commits] core.git: vcl/win

2022-06-25 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |  181 ++--
 1 file changed, 93 insertions(+), 88 deletions(-)

New commits:
commit 1759fb1f50015a4ce4f8b9843891e71a615b5a2e
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 13 18:57:11 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 25 18:46:57 2022 +0200

WIN flatten and assert some code

Thanks to Mike Kaganski to come up with the correct asserts.

Change-Id: I01b2b0026fc4de67a14fa803357a4c28951088ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135810
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 9306d35d77fe..b419a259c450 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -44,7 +44,7 @@
 #include 
 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -3959,18 +3959,6 @@ static void UpdateFrameGeometry(WinSalFrame* pFrame)
 pFrame->updateScreenNumber();
 }
 
-static void ImplCallMoveHdl( HWND hWnd )
-{
-WinSalFrame* pFrame = GetWindowPtr( hWnd );
-if ( pFrame )
-{
-pFrame->CallCallback( SalEvent::Move, nullptr );
-// to avoid doing Paint twice by VCL and SAL
-//if ( IsWindowVisible( hWnd ) && !pFrame->mbInShow )
-//UpdateWindow( hWnd );
-}
-}
-
 static void ImplCallClosePopupsHdl( HWND hWnd )
 {
 WinSalFrame* pFrame = GetWindowPtr( hWnd );
@@ -3980,40 +3968,51 @@ static void ImplCallClosePopupsHdl( HWND hWnd )
 }
 }
 
-static void ImplHandleMoveMsg( HWND hWnd )
+static void ImplCallMoveHdl(HWND hWnd)
 {
-WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, SAL_MSG_POSTMOVE );
-if ( pFrame )
-{
-UpdateFrameGeometry(pFrame);
+WinSalFrame* pFrame = ProcessOrDeferMessage(hWnd, SAL_MSG_POSTMOVE);
+if (!pFrame)
+return;
 
-if ( GetWindowStyle( hWnd ) & WS_VISIBLE )
-pFrame->mbDefPos = false;
+pFrame->CallCallback(SalEvent::Move, nullptr);
 
-// protect against recursion
-if ( !pFrame->mbInMoveMsg )
-{
-// adjust window again for FullScreenMode
-pFrame->mbInMoveMsg = true;
-if (pFrame->isFullScreen())
-ImplSalFrameFullScreenPos( pFrame );
-pFrame->mbInMoveMsg = false;
-}
+ImplSalYieldMutexRelease();
+}
 
-pFrame->UpdateFrameState();
+static void ImplHandleMoveMsg(HWND hWnd, LPARAM lParam)
+{
+WinSalFrame* pFrame = GetWindowPtr( hWnd );
+if (!pFrame)
+return;
 
-// Call Hdl
-//#93851 if we call this handler, VCL floating windows are not updated 
correctly
-ImplCallMoveHdl( hWnd );
+UpdateFrameGeometry(pFrame);
 
-ImplSalYieldMutexRelease();
+#ifdef NDEBUG
+(void) lParam;
+#endif
+assert(IsIconic(hWnd) || (pFrame->maGeometry.x() == 
static_cast(LOWORD(lParam;
+assert(IsIconic(hWnd) || (pFrame->maGeometry.y() == 
static_cast(HIWORD(lParam;
+
+if (GetWindowStyle(hWnd) & WS_VISIBLE)
+pFrame->mbDefPos = false;
+
+// protect against recursion
+if (!pFrame->mbInMoveMsg)
+{
+// adjust window again for FullScreenMode
+pFrame->mbInMoveMsg = true;
+if (pFrame->isFullScreen())
+ImplSalFrameFullScreenPos(pFrame);
+pFrame->mbInMoveMsg = false;
 }
+
+pFrame->UpdateFrameState();
+
+ImplCallMoveHdl(hWnd);
 }
 
 static void ImplCallSizeHdl( HWND hWnd )
 {
-// as Windows can send these messages also, we have to use
-// the Solar semaphore
 WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, SAL_MSG_POSTCALLSIZE );
 if (!pFrame)
 return;
@@ -4026,7 +4025,7 @@ static void ImplCallSizeHdl( HWND hWnd )
 ImplSalYieldMutexRelease();
 }
 
-static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, LPARAM)
+static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 if ((wParam == SIZE_MAXSHOW) || (wParam == SIZE_MAXHIDE))
 return;
@@ -4036,7 +4035,15 @@ static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, 
LPARAM)
 return;
 
 UpdateFrameGeometry(pFrame);
+
+#ifdef NDEBUG
+(void) lParam;
+#endif
+assert(pFrame->maGeometry.width() == 
static_cast(LOWORD(lParam)));
+assert(pFrame->maGeometry.height() == 
static_cast(HIWORD(lParam)));
+
 pFrame->UpdateFrameState();
+
 ImplCallSizeHdl(hWnd);
 
 WinSalTimer* pTimer = 
static_cast(ImplGetSVData()->maSchedCtx.mpSalTimer);
@@ -4047,30 +4054,30 @@ static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, 
LPARAM)
 static void ImplHandleFocusMsg( HWND hWnd )
 {
 WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, SAL_MSG_POSTFOCUS );
-if ( pFrame )
-{
-if ( !WinSalFrame::mbInReparent )
-{
-bool bGotFocus = ::GetFocus() == hWnd;
-if ( bGotFocus )
-{
-if ( IsWindowVisible( hWnd ) && !pFrame->mbInShow )
- 

[Libreoffice-commits] core.git: vcl/win

2022-06-23 Thread Stephan Bergmann (via logerrit)
 vcl/win/window/salframe.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5bb5763e2f208cddd114fe96466bdfa2ed3bdbf3
Author: Stephan Bergmann 
AuthorDate: Thu Jun 23 13:45:29 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 23 18:18:22 2022 +0200

Silence another unhelpful loplugin:redundantfcast

...after 37ec4442d70339dc8ec5fb8e4ec8984420b6e14d "o3tl: ensure that the
initializer of enumarray contains enough elements", in Windows-only code

Change-Id: I1373a5d777240104d88a892bcf048acf3e7392fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136334
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index fac5bbfac242..9306d35d77fe 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2024,6 +2024,7 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle )
 
 static o3tl::enumarray aImplPtrTab =
 {
+// [-loplugin:redundantfcast]:
 ImplPtrData{ nullptr, IDC_ARROW, 0 },   // 
POINTER_ARROW
 ImplPtrData{ nullptr, nullptr, SAL_RESID_POINTER_NULL },// POINTER_NULL
 ImplPtrData{ nullptr, IDC_WAIT, 0 },// POINTER_WAIT


[Libreoffice-commits] core.git: vcl/win

2022-06-04 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |   47 
 1 file changed, 18 insertions(+), 29 deletions(-)

New commits:
commit 428cc8da98ddb73f8abeaa3bddb555f3bd896a29
Author: Jan-Marek Glogowski 
AuthorDate: Fri Jun 3 00:24:24 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 4 20:25:54 2022 +0200

WIN refactor geometry updating

Change-Id: I34e710c022e6362dc2381327eb896610c35bcbf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135425
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 6f3b3ca507e5..2ae47ec57630 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -131,6 +131,22 @@ bool WinSalFrame::mbInReparent = false;
 static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
 static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* 
pParentRect = nullptr );
 
+static void UpdateGeometry(WinSalFrame* pFrame, RECT& aRect)
+{
+RECT aRect2 = aRect;
+AdjustWindowRectEx(, GetWindowStyle(pFrame->mhWnd),
+   FALSE, GetWindowExStyle(pFrame->mhWnd));
+tools::Long nTopDeco = abs(aRect.top - aRect2.top);
+tools::Long nLeftDeco = abs(aRect.left - aRect2.left);
+tools::Long nBottomDeco = abs(aRect.bottom - aRect2.bottom);
+tools::Long nRightDeco = abs(aRect.right - aRect2.right);
+
+pFrame->maState.mnX = aRect.left + nLeftDeco;
+pFrame->maState.mnY = aRect.top + nTopDeco;
+pFrame->maState.mnWidth = aRect.right - aRect.left - nLeftDeco - 
nRightDeco;
+pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco - 
nBottomDeco;
+}
+
 static void ImplSaveFrameState( WinSalFrame* pFrame )
 {
 // save position, size and state for GetWindowState()
@@ -154,42 +170,15 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
 WINDOWPLACEMENT aPlacement;
 aPlacement.length = sizeof(aPlacement);
 if( GetWindowPlacement( pFrame->mhWnd,  ) )
-{
-RECT aRect = aPlacement.rcNormalPosition;
-RECT aRect2 = aRect;
-AdjustWindowRectEx( , GetWindowStyle( pFrame->mhWnd ),
-FALSE,  GetWindowExStyle( pFrame->mhWnd ) 
);
-tools::Long nTopDeco = abs( aRect.top - aRect2.top );
-tools::Long nLeftDeco = abs( aRect.left - aRect2.left );
-tools::Long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
-tools::Long nRightDeco = abs( aRect.right - aRect2.right );
-
-pFrame->maState.mnX  = aRect.left + nLeftDeco;
-pFrame->maState.mnY  = aRect.top + nTopDeco;
-pFrame->maState.mnWidth  = aRect.right - aRect.left - 
nLeftDeco - nRightDeco;
-pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco 
- nBottomDeco;
-}
+UpdateGeometry(pFrame, aPlacement.rcNormalPosition);
 }
 else
 {
 RECT aRect;
 GetWindowRect( pFrame->mhWnd,  );
-
-// to be consistent with Unix, the frame state is without(!) 
decoration
-RECT aRect2 = aRect;
-AdjustWindowRectEx( , GetWindowStyle( pFrame->mhWnd ),
-FALSE, GetWindowExStyle( pFrame->mhWnd ) );
-tools::Long nTopDeco = abs( aRect.top - aRect2.top );
-tools::Long nLeftDeco = abs( aRect.left - aRect2.left );
-tools::Long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
-tools::Long nRightDeco = abs( aRect.right - aRect2.right );
+UpdateGeometry(pFrame, aRect);
 
 pFrame->maState.mnState &= 
~WindowStateState(WindowStateState::Minimized | WindowStateState::Maximized);
-// subtract decoration
-pFrame->maState.mnX  = aRect.left+nLeftDeco;
-pFrame->maState.mnY  = aRect.top+nTopDeco;
-pFrame->maState.mnWidth  = 
aRect.right-aRect.left-nLeftDeco-nRightDeco;
-pFrame->maState.mnHeight = 
aRect.bottom-aRect.top-nTopDeco-nBottomDeco;
 if ( bVisible )
 pFrame->mnShowState = SW_SHOWNORMAL;
 pFrame->mbRestoreMaximize = false;


[Libreoffice-commits] core.git: vcl/win

2022-05-31 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salmenu.cxx |   30 ++
 1 file changed, 2 insertions(+), 28 deletions(-)

New commits:
commit 483f3125ecd4744cbcc2f8fd3cdf243d81a601ff
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 31 21:14:00 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue May 31 22:45:40 2022 +0200

WIN drop effectively empty ImplDrawMenuBar

.. as VisibleMenuBar() just always returns false.

Change-Id: Ie793d84d57970cbf08b81b6ec0350b9b5fd4192c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135210
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx
index 6f8dc8bff283..91a15284aeb5 100644
--- a/vcl/win/window/salmenu.cxx
+++ b/vcl/win/window/salmenu.cxx
@@ -96,19 +96,6 @@ std::unique_ptr WinSalInstance::CreateMenuItem( 
const SalItemParams
 return std::unique_ptr(pSalMenuItem);
 }
 
-static void ImplDrawMenuBar( SalMenu *pMenu )
-{
-if( pMenu->VisibleMenuBar() )
-{
-// redrawing the menubar all the time actually seems to be unnecessary 
(it just flickers)
-/*
-WinSalMenu *pMenuBar = ImplFindMenuBar( pMenu );
-if( pMenuBar && pMenuBar->mhWnd )
-::DrawMenuBar( pMenuBar->mhWnd );
-*/
-}
-}
-
 /*
  * WinSalMenu
  */
@@ -166,10 +153,7 @@ void WinSalMenu::InsertItem( SalMenuItem* pSalMenuItem, 
unsigned nPos )
 if(!::InsertMenuItemW( mhMenu, nPos, TRUE, >mInfo ))
 myerr = GetLastError();
 else
-{
 pWItem->mpSalMenu = this;
-ImplDrawMenuBar( this );
-}
 }
 }
 
@@ -194,7 +178,6 @@ void WinSalMenu::RemoveItem( unsigned nPos )
 {
 if( pSalMenuItem )
 pSalMenuItem->mpSalMenu = nullptr;
-ImplDrawMenuBar( this );
 }
 }
 }
@@ -220,7 +203,6 @@ static void ImplRemoveItemById( WinSalMenu *pSalMenu, 
unsigned nItemId )
 {
 if( pSalMenuItem )
 pSalMenuItem->mpSalMenu = nullptr;
-ImplDrawMenuBar( pSalMenu );
 }
 }
 
@@ -247,21 +229,17 @@ void WinSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, 
SalMenu* pSubMenu, unsig
 
 if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, >mInfo ) )
 myerr = GetLastError();
-else
-ImplDrawMenuBar( this );
 }
 }
 
 void WinSalMenu::CheckItem( unsigned nPos, bool bCheck )
 {
-if( static_cast( -1 ) != ::CheckMenuItem( mhMenu, nPos, 
MF_BYPOSITION|(bCheck ? MF_CHECKED : MF_UNCHECKED) ) )
-ImplDrawMenuBar( this );
+::CheckMenuItem(mhMenu, nPos, MF_BYPOSITION|(bCheck ? MF_CHECKED : 
MF_UNCHECKED));
 }
 
 void WinSalMenu::EnableItem( unsigned nPos, bool bEnable )
 {
-if( -1 != ::EnableMenuItem( mhMenu, nPos, MF_BYPOSITION|(bEnable ? 
MF_ENABLED : (MF_DISABLED|MF_GRAYED) ) ) )
-ImplDrawMenuBar( this );
+::EnableMenuItem(mhMenu, nPos, MF_BYPOSITION|(bEnable ? MF_ENABLED : 
(MF_DISABLED|MF_GRAYED)));
 }
 
 void WinSalMenu::SetItemImage( unsigned /*nPos*/, SalMenuItem* pSalMenuItem, 
const Image& rImage )
@@ -298,8 +276,6 @@ void WinSalMenu::SetItemText( unsigned nPos, SalMenuItem* 
pSalMenuItem, const OU
 
 if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, >mInfo ))
 myerr = GetLastError();
-else
-ImplDrawMenuBar( this );
 }
 }
 
@@ -323,8 +299,6 @@ void WinSalMenu::SetAccelerator( unsigned nPos, 
SalMenuItem* pSalMenuItem, const
 
 if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, >mInfo ))
 myerr = GetLastError();
-else
-ImplDrawMenuBar( this );
 }
 }
 


[Libreoffice-commits] core.git: vcl/win

2022-05-14 Thread Mike Kaganski (via logerrit)
 vcl/win/gdi/winlayout.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit f321113d71cca569624a848bdcb898cb04460137
Author: Mike Kaganski 
AuthorDate: Sat May 14 11:56:19 2022 +0100
Commit: Mike Kaganski 
CommitDate: Sat May 14 14:56:23 2022 +0200

Only obtain these after trying the cache

Change-Id: Ia1ce426bb4734b669e3715776561cb94a1c6292f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134192
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 673b223a263f..8371c9577225 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -214,10 +214,6 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, 
hb_tag_t nTableTag, void* pU
 static o3tl::lru_map 
gCache(50);
 
 WinFontInstance* pFont = static_cast(pUserData);
-HDC hDC = pFont->GetGraphics()->getHDC();
-HFONT hFont = pFont->GetHFONT();
-assert(hDC);
-assert(hFont);
 
 BlobCacheKey cacheKey{ 
rtl::Reference(pFont->GetFontFace()),
nTableTag };
@@ -228,6 +224,11 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, 
hb_tag_t nTableTag, void* pU
 return it->second.mpBlob;
 }
 
+HDC hDC = pFont->GetGraphics()->getHDC();
+HFONT hFont = pFont->GetHFONT();
+assert(hDC);
+assert(hFont);
+
 sal_uLong nLength = 0;
 unsigned char* pBuffer = nullptr;
 


[Libreoffice-commits] core.git: vcl/win

2022-05-02 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit bc7ea0a75911a782c0008be64508cbf3e0d74cc3
Author: Stephan Bergmann 
AuthorDate: Mon May 2 08:47:34 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Mon May 2 14:39:17 2022 +0200

loplugin:stringviewparam

Change-Id: Ife277f789270f80a40cd711a9235e41bbb3384ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133686
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index acaca76584a3..bc112a26d2ee 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1090,7 +1091,7 @@ void ImplReleaseTempFonts(SalData& rSalData, bool bAll)
 }
 }
 
-static OUString lcl_GetFontFamilyName(const OUString& rFontFileURL)
+static OUString lcl_GetFontFamilyName(std::u16string_view rFontFileURL)
 {
 // Create temporary file name
 OUString aTempFileURL;


[Libreoffice-commits] core.git: vcl/win

2022-04-16 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salprn.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 590eb262e7841ff8d62246487ce9fb428ea5a9e6
Author: Stephan Bergmann 
AuthorDate: Fri Apr 15 21:45:14 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Apr 16 10:37:38 2022 +0200

-Werror,-Wunused-const-variable

...since a8383345174d91f6e722128e1d53c9a4ebc18195 "No Win16-style WIN.INI 
since
Windows Vista"

Change-Id: I36fa3f6516a6bd9ac6593e01163c1f3427933e42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133090
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 724c4f18e2e1..98d39dc02455 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -89,9 +89,6 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::ui::dialogs;
 
-const wchar_t aImplWindows[] = L"windows";
-const wchar_t aImplDevice[]  = L"device";
-
 static DEVMODEW const * SAL_DEVMODE_W( const ImplJobSetup* pSetupData )
 {
 DEVMODEW const * pRet = nullptr;


[Libreoffice-commits] core.git: vcl/win

2022-04-15 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit a0f9f8ddaaa4ca14c9cc37259e2ac5dce63b3c77
Author: Caolán McNamara 
AuthorDate: Fri Apr 15 13:50:10 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 15 16:16:35 2022 +0200

tdf#148448 pick a warning color more likely to be readable in dark theme

I can't see anything that is useful which could be used to derive this
so just pick a better hard coded color

Change-Id: Ia351e636ed3a44e9af79147b2d9dfcf347bd8ea9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133068
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index bbfd7843502a..6f3b3ca507e5 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2695,6 +2695,10 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 aMenuBarTextColor = ImplWinColorToSal( color );
 aMenuBarRolloverTextColor = ImplWinColorToSal( color );
 CloseThemeData(hTheme);
+
+// tdf#148448 pick a warning color more likely to be readable as a
+// background in a dark theme
+aStyleSettings.SetWarningColor(Color(0xf5, 0x79, 0x00));
 }
 else
 {


[Libreoffice-commits] core.git: vcl/win

2022-04-15 Thread Stephan Bergmann (via logerrit)
 vcl/win/dtrans/ftransl.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 6457b72667de2a203e25a18b0f58cde67d41bbf4
Author: Stephan Bergmann 
AuthorDate: Thu Apr 14 23:01:05 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 15 08:38:25 2022 +0200

loplugin:stringviewparam

Change-Id: Iac1655373f5f30e3499fa5335405fb422fa8dc9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133054
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/dtrans/ftransl.cxx b/vcl/win/dtrans/ftransl.cxx
index 2d5ecd492754..ad41a95b0ae2 100644
--- a/vcl/win/dtrans/ftransl.cxx
+++ b/vcl/win/dtrans/ftransl.cxx
@@ -17,6 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+#include 
+
+#include 
 #include 
 
 #include "ftransl.hxx"
@@ -418,9 +423,9 @@ void findStdFormatIdOrNativeFormatNameForFullMediaType(
 }
 }
 
-bool isTextPlainMediaType( const OUString& fullMediaType )
+bool isTextPlainMediaType( std::u16string_view fullMediaType )
 {
-return fullMediaType.equalsIgnoreAsciiCase("text/plain");
+return o3tl::equalsIgnoreAsciiCase(fullMediaType, u"text/plain");
 }
 
 DataFlavor mkDataFlv(const OUString& cnttype, const OUString& hpname, Type 
dtype)


[Libreoffice-commits] core.git: vcl/win

2022-04-14 Thread Mike Kaganski (via logerrit)
 vcl/win/gdi/salprn.cxx |   29 +
 1 file changed, 5 insertions(+), 24 deletions(-)

New commits:
commit a8383345174d91f6e722128e1d53c9a4ebc18195
Author: Mike Kaganski 
AuthorDate: Thu Apr 14 14:41:33 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri Apr 15 07:06:57 2022 +0200

No Win16-style WIN.INI since Windows Vista

Change-Id: I75bc8c7c61e863747cdfc65fb4ed7603c0eb1c0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133034
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 835c571785a6..724c4f18e2e1 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -224,31 +225,11 @@ OUString WinSalInstance::GetDefaultPrinter()
 GetDefaultPrinterW( nullptr,  );
 if( nChars )
 {
-LPWSTR  pStr = static_cast(std::malloc(nChars*sizeof(WCHAR)));
-OUString aDefPrt;
-if( GetDefaultPrinterW( pStr,  ) )
-{
-aDefPrt = o3tl::toU(pStr);
-}
-std::free( pStr );
-if( !aDefPrt.isEmpty() )
-return aDefPrt;
-}
-
-// get default printer from win.ini
-wchar_t szBuffer[256];
-GetProfileStringW( aImplWindows, aImplDevice, L"", szBuffer, 
SAL_N_ELEMENTS( szBuffer ) );
-if ( szBuffer[0] )
-{
-// search for printer name
-wchar_t* pBuf = szBuffer;
-wchar_t* pTmp = pBuf;
-while ( *pTmp && (*pTmp != ',') )
-pTmp++;
-return OUString( o3tl::toU(pBuf), static_cast(pTmp-pBuf) );
+std::vector pStr(nChars);
+if (GetDefaultPrinterW(pStr.data(), ))
+return OUString(o3tl::toU(pStr.data()));
 }
-else
-return OUString();
+return OUString();
 }
 
 static DWORD ImplDeviceCaps( WinSalInfoPrinter const * pPrinter, WORD nCaps,


[Libreoffice-commits] core.git: vcl/win

2022-04-08 Thread Mark Hung (via logerrit)
 vcl/win/window/salframe.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 2b2d1c08c94fdc3982971c2b19ea241f05e578c9
Author: Mark Hung 
AuthorDate: Mon Apr 4 20:12:36 2022 +0800
Commit: Mark Hung 
CommitDate: Fri Apr 8 15:23:54 2022 +0200

tdf#143447 ignore IME candidate window state.

Some traditional Chinese IMEs ( Input Method Editors ) under
Windows10 send WM_IME_NOTIFY with IMN_OPENCANDIDATE but not
IMN_CLOSECANDIDATE. The behavior is different if users configure
the IME and enable "legacy" option.

That caused the cursor been hidden, misled by mbCandidateMode.

The patch ignores the candidate window mode in case the length
of the composition string is 0, assume in that case candidate
window is useless, and resets the candidate window mode when
composition ended to maintain the state as much as we can.

Change-Id: I91a1c23ee1a031313243e032653f50f39b0f2a3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132512
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index cd9449c1a4ae..bbfd7843502a 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5153,7 +5153,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
 if ( (nTextLen > 0) || !(lParam & GCS_RESULTSTR) )
 {
 // End the mode, if the last character is deleted
-if ( !nTextLen && !pFrame->mbCandidateMode )
+if ( !nTextLen )
 {
 pFrame->CallCallback( SalEvent::ExtTextInput,  );
 pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
@@ -5238,7 +5238,10 @@ static bool ImplHandleIMEEndComposition( HWND hWnd )
 if ( pFrame && pFrame->mbHandleIME )
 {
 if ( pFrame->mbAtCursorIME )
+{
+pFrame->mbCandidateMode = false;
 bDef = false;
+}
 }
 
 ImplSalYieldMutexRelease();


[Libreoffice-commits] core.git: vcl/win

2022-03-24 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit a0202e0b8c5757c3dbb5f0938a4305fbe2db9429
Author: Stephan Bergmann 
AuthorDate: Thu Mar 24 08:07:55 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 24 16:13:26 2022 +0100

loplugin:external

Change-Id: I6b18a514358488ed8a03b42313c3986c2b3fc9df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132021
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index a322046d66bf..f62d8ef7134b 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -346,6 +346,8 @@ bool OSSupportsDarkMode()
 return bRet;
 }
 
+namespace {
+
 enum PreferredAppMode
 {
 Default,
@@ -355,6 +357,8 @@ enum PreferredAppMode
 Max
 };
 
+}
+
 extern "C" {
 VCLPLUG_WIN_PUBLIC SalInstance* create_SalInstance()
 {


[Libreoffice-commits] core.git: vcl/win

2022-03-24 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 14393256231c69ed143ddede4e7532ed8faa6a88
Author: Stephan Bergmann 
AuthorDate: Thu Mar 24 08:08:47 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 24 10:54:16 2022 +0100

loplugin:external

> vcl/win/gdi/salnativewidgets-luna.cxx(399,6): error: externally available 
entity 'UseDarkMode' is not previously declared in an included file (if it is 
only used in this translation unit, make it static; otherwise, provide a 
declaration of it in an included file) [loplugin:external]
> bool UseDarkMode()
> ~^

Change-Id: Idca63c3b9f25629db31cde48bc3c975f943a25f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132022
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 1266c022bb89..f23ddc03eb0b 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 


[Libreoffice-commits] core.git: vcl/win

2022-03-21 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 29c4d47161dab81971029717ce358de59f52f8c3
Author: Caolán McNamara 
AuthorDate: Mon Mar 21 11:34:53 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 21 13:50:12 2022 +0100

Related: tdf#118320 tabpane is too white in darkmode

the only reliable darkmode hammers are a button or drawing with some
solid color derived from a theme element, try a button here

Change-Id: I842a415020abd26dc60e51438f9fd3c961ecd830
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131902
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index a544bf03c77d..1266c022bb89 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -750,7 +750,12 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 
 if( nType == ControlType::TabPane )
 {
-iPart = TABP_PANE;
+// tabpane in tabcontrols gets drawn in "darkmode" as if it was a
+// a "light" theme, so bodge this by drawing with a button instead
+if (UseDarkMode())
+iPart = BP_PUSHBUTTON;
+else
+iPart = TABP_PANE;
 return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption);
 }
 
@@ -1172,10 +1177,10 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 hTheme = getThemeHandle(mhWnd, L"Combobox", mpImpl.get());
 }
 break;
-case ControlType::TabPane:
 case ControlType::TabBody:
 hTheme = getThemeHandle(mhWnd, L"Tab", mpImpl.get());
 break;
+case ControlType::TabPane:
 case ControlType::TabItem:
 if (bUseDarkMode)
 {


[Libreoffice-commits] core.git: vcl/win

2022-03-21 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c51140847efa90897253011bd0382a32440d73e3
Author: Caolán McNamara 
AuthorDate: Mon Mar 21 10:54:09 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 21 13:01:11 2022 +0100

Related: tdf#118320 swap TILES_SELECTED and TILES_FOCUSED

so the selected tab gets the same bg as the tab page

Change-Id: I26222cf755c4c30f8712fb7a4690c84784d9b508
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131898
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index b58731f1db42..a544bf03c77d 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -825,13 +825,13 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 iState = PBS_DISABLED;
 break;
 case TILES_SELECTED:
-iState = PBS_PRESSED;
+iState = PBS_DEFAULTED;
 break;
 case TILES_HOT:
 iState = PBS_HOT;
 break;
 case TILES_FOCUSED:
-iState = PBS_DEFAULTED;
+iState = PBS_PRESSED;
 break;
 default:
 iState = PBS_NORMAL;


[Libreoffice-commits] core.git: vcl/win

2022-03-19 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 892ef6e8b6888b3029041ab150b409f81a5c31b0
Author: Caolán McNamara 
AuthorDate: Fri Mar 18 21:29:00 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 19 22:10:42 2022 +0100

Related: tdf#118320 let windows icon theme know when a dark theme is 
preferred

Change-Id: I7569814a575e3d7c216e790eb162397d312fa0e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131843
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 5965e9225058..cd9449c1a4ae 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2662,7 +2662,12 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 Color aMenuBarTextColor;
 Color aMenuBarRolloverTextColor;
 
-if (UseDarkMode())
+const bool bUseDarkMode(UseDarkMode());
+
+OUString sThemeName(!bUseDarkMode ? u"colibre" : u"colibre_dark");
+aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode);
+
+if (bUseDarkMode)
 {
 SetWindowTheme(mhWnd, L"Explorer", nullptr);
 


[Libreoffice-commits] core.git: vcl/win

2022-03-19 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   37 +-
 1 file changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 348407dfdf5fd41b99f5998463eb032128799555
Author: Caolán McNamara 
AuthorDate: Sat Mar 19 19:42:48 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 19 21:52:25 2022 +0100

Related: tdf#118320 tabitems appear as light in darkmode

so use a Button theme and matching button properties for drawing those
instead as a workaround

Change-Id: I5ba0e360adc109e80ab7ecb1ff2fd5bc84028b61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131852
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 805db681a211..b58731f1db42 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -813,6 +813,32 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 iState = TILES_FOCUSED;// may need to draw focus rect
 else
 iState = TILES_NORMAL;
+
+// tabitem in tabcontrols gets drawn in "darkmode" as if it was a
+// a "light" theme, so bodge this by drawing with a button instead
+if (UseDarkMode())
+{
+iPart = BP_PUSHBUTTON;
+switch (iState)
+{
+case TILES_DISABLED:
+iState = PBS_DISABLED;
+break;
+case TILES_SELECTED:
+iState = PBS_PRESSED;
+break;
+case TILES_HOT:
+iState = PBS_HOT;
+break;
+case TILES_FOCUSED:
+iState = PBS_DEFAULTED;
+break;
+default:
+iState = PBS_NORMAL;
+break;
+}
+}
+
 return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption);
 }
 
@@ -1148,9 +1174,18 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 break;
 case ControlType::TabPane:
 case ControlType::TabBody:
-case ControlType::TabItem:
 hTheme = getThemeHandle(mhWnd, L"Tab", mpImpl.get());
 break;
+case ControlType::TabItem:
+if (bUseDarkMode)
+{
+// tabitem in tabcontrols gets drawn in "darkmode" as if it 
was a
+// a "light" theme, so bodge this by drawing with a button 
instead
+hTheme = getThemeHandle(mhWnd, L"Button", mpImpl.get());
+}
+else
+hTheme = getThemeHandle(mhWnd, L"Tab", mpImpl.get());
+break;
 case ControlType::Toolbar:
 if( nPart == ControlPart::Entire || nPart == ControlPart::Button )
 hTheme = getThemeHandle(mhWnd, L"Toolbar", mpImpl.get());


[Libreoffice-commits] core.git: vcl/win

2022-03-19 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit c43c4a00089b1965c7ef69ef40c9e645dffc2e43
Author: Caolán McNamara 
AuthorDate: Fri Mar 18 21:09:29 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 19 11:40:26 2022 +0100

Related: tdf#118320 darkmode DrawThemeBackground doesn't work for tab bodies

so just draw it as solid window color

Change-Id: I4e452a7d6a21be91da8e23901746064fd33ee386
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131842
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index c4113b877f1f..805db681a211 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -756,6 +756,17 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 
 if( nType == ControlType::TabBody )
 {
+// tabbody in main window gets drawn in white in "darkmode", so bodge 
this here
+if (UseDarkMode())
+{
+Color 
aColor(Application::GetSettings().GetStyleSettings().GetWindowColor());
+ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(),
+ aColor.GetGreen(),
+ aColor.GetBlue(;
+FillRect(hDC, , hbrush.get());
+return true;
+}
+
 iPart = TABP_BODY;
 return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption);
 }
@@ -840,7 +851,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 rc.top = 0; // extend potential gradient to cover menu bar 
as well
 }
 
-// menubar in main window gets drawn in white in "darkmode", so 
bodge this here
+// toolbar in main window gets drawn in white in "darkmode", so 
bodge this here
 if (UseDarkMode())
 {
 Color 
aColor(Application::GetSettings().GetStyleSettings().GetWindowColor());


[Libreoffice-commits] core.git: vcl/win

2022-01-07 Thread Stephan Bergmann (via logerrit)
 vcl/win/dtrans/MtaOleClipb.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5dda4fb74a7f961d067d4a5b8760d96466ebd0be
Author: Stephan Bergmann 
AuthorDate: Fri Jan 7 08:16:16 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 7 20:24:41 2022 +0100

-Werror,-Wshadow

...after c35f81148fb18ba070516edcbb4d61899235 "Use
sal::systools::CoInitializeGuard and sal::systools::ThrowIfFailed"

Change-Id: I3df9fd523820e1d3651480d51ebbaafaafa3ed48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128095
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx
index 6f7304fe3828..e0e08773e4a4 100644
--- a/vcl/win/dtrans/MtaOleClipb.cxx
+++ b/vcl/win/dtrans/MtaOleClipb.cxx
@@ -713,7 +713,7 @@ DWORD WINAPI 
CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID p
 MsgWaitForMultipleObjects(2, pInst->m_hClipboardChangedNotifierEvents, 
false, INFINITE,
   QS_ALLINPUT | QS_ALLPOSTMESSAGE);
 
-ClearableMutexGuard aGuard( pInst->m_ClipboardChangedEventCountMutex );
+ClearableMutexGuard aGuard2( pInst->m_ClipboardChangedEventCountMutex 
);
 
 if ( pInst->m_ClipboardChangedEventCount > 0 )
 {
@@ -721,7 +721,7 @@ DWORD WINAPI 
CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID p
 if ( 0 == pInst->m_ClipboardChangedEventCount )
 ResetEvent( pInst->m_hClipboardChangedEvent );
 
-aGuard.clear( );
+aGuard2.clear( );
 
 // nobody should touch m_pfncClipViewerCallback while we do
 MutexGuard aClipViewerGuard( pInst->m_pfncClipViewerCallbackMutex 
);
@@ -731,7 +731,7 @@ DWORD WINAPI 
CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID p
 pInst->m_pfncClipViewerCallback( );
 }
 else
-aGuard.clear( );
+aGuard2.clear( );
 }
 
 return 0;


[Libreoffice-commits] core.git: vcl/win

2022-01-07 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/source.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 54add6c702cfef4898ae750caa98c3d18c6f60a3
Author: Mike Kaganski 
AuthorDate: Fri Jan 7 13:45:52 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 7 19:08:32 2022 +0100

Use CreateThread instead of _beginthreadex

Change-Id: Idae8112f0684f6d3aac70c4450eedc77e48432dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128121
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/source.cxx b/vcl/win/dtrans/source.cxx
index 34471730bcd3..d91e39b026e0 100644
--- a/vcl/win/dtrans/source.cxx
+++ b/vcl/win/dtrans/source.cxx
@@ -48,7 +48,7 @@ using namespace com::sun::star::awt::MouseButton;
 using namespace com::sun::star::awt;
 using namespace com::sun::star::lang;
 
-static unsigned __stdcall DndOleSTAFunc(LPVOID pParams);
+static DWORD WINAPI DndOleSTAFunc(_In_ LPVOID pParams);
 
 DragSource::DragSource( const Reference& rxContext):
 WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo 
>(m_aMutex),
@@ -120,9 +120,8 @@ void DragSource::StartDragImpl(
 
 // The thread accesses members of this instance but does not call acquire.
 // Hopefully this instance is not destroyed before the thread has 
terminated.
-unsigned threadId;
-HANDLE hThread= reinterpret_cast(_beginthreadex(
-nullptr, 0, DndOleSTAFunc, this, 0, ));
+DWORD threadId;
+HANDLE hThread = CreateThread(nullptr, 0, DndOleSTAFunc, this, 0, 
);
 
 // detach from thread
 CloseHandle(hThread);
@@ -305,7 +304,7 @@ dtrans_DragSource_get_implementation(
 carries out a drag and drop operation by calling
 DoDragDrop. The thread also notifies all
 XSourceListener. */
-unsigned __stdcall DndOleSTAFunc(LPVOID pParams)
+DWORD WINAPI DndOleSTAFunc(_In_ LPVOID pParams)
 {
 osl_setThreadName("DragSource DndOleSTAFunc");
 


[Libreoffice-commits] core.git: vcl/win

2022-01-07 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/MtaOleClipb.cxx |   14 +++---
 vcl/win/dtrans/MtaOleClipb.hxx |   14 +-
 2 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit b5d9fefe0e3ac56eef247c90b137d4b6d7a667c6
Author: Mike Kaganski 
AuthorDate: Fri Jan 7 13:42:20 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 7 18:21:42 2022 +0100

Use CreateThread instead of _beginthreadex

Change-Id: I7c272880d6567bc669d4c3c2684aa2e0daeca1b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128120
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx
index 4faba21367f2..6f7304fe3828 100644
--- a/vcl/win/dtrans/MtaOleClipb.cxx
+++ b/vcl/win/dtrans/MtaOleClipb.cxx
@@ -246,8 +246,8 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
 
 s_theMtaOleClipboardInst = this;
 
-m_hOleThread = reinterpret_cast(_beginthreadex(
-nullptr, 0, CMtaOleClipboard::oleThreadProc, this, 0, _uOleThreadId 
));
+m_hOleThread = CreateThread(
+nullptr, 0, CMtaOleClipboard::oleThreadProc, this, 0, _uOleThreadId 
);
 OSL_ASSERT( nullptr != m_hOleThread );
 
 // setup the clipboard changed notifier thread
@@ -258,9 +258,9 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
 m_hClipboardChangedNotifierEvents[1] = CreateEventW( nullptr, 
MANUAL_RESET, INIT_NONSIGNALED, nullptr );
 OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[1] );
 
-unsigned uThreadId;
-m_hClipboardChangedNotifierThread = 
reinterpret_cast(_beginthreadex(
-nullptr, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, 
this, 0,  ));
+DWORD uThreadId;
+m_hClipboardChangedNotifierThread = CreateThread(
+nullptr, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, 
this, 0,  );
 
 OSL_ASSERT( nullptr != m_hClipboardChangedNotifierThread );
 }
@@ -680,7 +680,7 @@ unsigned int CMtaOleClipboard::run( )
 return nRet;
 }
 
-unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID pParam )
+DWORD WINAPI CMtaOleClipboard::oleThreadProc( _In_ LPVOID pParam )
 {
 osl_setThreadName("CMtaOleClipboard::run()");
 
@@ -691,7 +691,7 @@ unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID 
pParam )
 return pInst->run( );
 }
 
-unsigned int WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( 
LPVOID pParam )
+DWORD WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID 
pParam )
 {
 
osl_setThreadName("CMtaOleClipboard::clipboardChangedNotifierThreadProc()");
 CMtaOleClipboard* pInst = static_cast< CMtaOleClipboard* >( pParam );
diff --git a/vcl/win/dtrans/MtaOleClipb.hxx b/vcl/win/dtrans/MtaOleClipb.hxx
index c406f81aafd3..a76b85e3b059 100644
--- a/vcl/win/dtrans/MtaOleClipb.hxx
+++ b/vcl/win/dtrans/MtaOleClipb.hxx
@@ -75,15 +75,15 @@ private:
 LRESULT onClipboardUpdate();
 
 static LRESULT CALLBACK mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARAM 
wParam, LPARAM lParam );
-static unsigned int WINAPI oleThreadProc( LPVOID pParam );
+static DWORD WINAPI oleThreadProc( _In_ LPVOID pParam );
 
-static unsigned int WINAPI clipboardChangedNotifierThreadProc( LPVOID 
pParam );
+static DWORD WINAPI clipboardChangedNotifierThreadProc( _In_ LPVOID pParam 
);
 
 bool WaitForThreadReady( ) const;
 
 private:
 HANDLE  m_hOleThread;
-unsignedm_uOleThreadId;
+DWORD   m_uOleThreadId;
 HANDLE  m_hEvtThrdReady;
 HWNDm_hwndMtaOleReqWnd;
 HANDLE  m_hEvtWndDisposed;
@@ -103,12 +103,8 @@ private:
 
 static CMtaOleClipboard*s_theMtaOleClipboardInst;
 
-// not allowed
-private:
-CMtaOleClipboard( const CMtaOleClipboard& );
-CMtaOleClipboard& operator=( const CMtaOleClipboard& );
-
-friend LRESULT CALLBACK mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARAM 
wParam, LPARAM lParam );
+CMtaOleClipboard( const CMtaOleClipboard& ) = delete;
+CMtaOleClipboard& operator=( const CMtaOleClipboard& ) = delete;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: vcl/win

2022-01-03 Thread Mike Kaganski (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit cce57fd94e9335c5dd5f3725a5fe54f5d3929e8d
Author: Mike Kaganski 
AuthorDate: Mon Jan 3 12:42:04 2022 +0100
Commit: Mike Kaganski 
CommitDate: Mon Jan 3 14:24:17 2022 +0100

Don't call it second time

Change-Id: Ie2195bd1059c41b1b58f828649d5908b3b9a844d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127775
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index af2608bf02fa..a8d508c9b44d 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1077,8 +1077,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
 tools::Rectangle aRectangle = GetMenuPopupMarkRegion(aValue);
 if (!aRectangle.IsEmpty())
 {
-cacheRect = GetMenuPopupMarkRegion(aValue);
-buttonRect = cacheRect;
+cacheRect = buttonRect = aRectangle;
 keySize = cacheRect.GetSize();
 }
 }


[Libreoffice-commits] core.git: vcl/win

2022-01-02 Thread Mike Kaganski (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   71 ++
 1 file changed, 38 insertions(+), 33 deletions(-)

New commits:
commit 4494966015fbdf544928a9f6d1105d57e7a8212a
Author: Mike Kaganski 
AuthorDate: Sat Jan 1 13:42:09 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jan 2 09:03:57 2022 +0100

Factor out drawing native menu mark into a separate function

Change-Id: I87da929d5311c72189f6c22f910b33f3a03393c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127847
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index fe784c66872c..af2608bf02fa 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -393,6 +393,42 @@ static tools::Rectangle GetMenuPopupMarkRegion(const 
ImplControlValue& rValue)
 return aRet;
 }
 
+static bool implDrawNativeMenuMark(HDC hDC, HTHEME hTheme, RECT rc, 
ControlPart nPart,
+   ControlState nState, const 
ImplControlValue& aValue,
+   OUString const& aCaption)
+{
+if (aValue.getType() == ControlType::MenuPopup)
+{
+tools::Rectangle aRectangle = GetMenuPopupMarkRegion(aValue);
+rc.top = aRectangle.Top();
+rc.left = aRectangle.Left();
+rc.bottom = aRectangle.Bottom();
+rc.right = aRectangle.Right();
+}
+int iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : MCB_DISABLED;
+ImplDrawTheme(hTheme, hDC, MENU_POPUPCHECKBACKGROUND, iState, rc, 
aCaption);
+if (nPart == ControlPart::MenuItemCheckMark)
+iState = (nState & ControlState::ENABLED) ? MC_CHECKMARKNORMAL : 
MC_CHECKMARKDISABLED;
+else
+iState = (nState & ControlState::ENABLED) ? MC_BULLETNORMAL : 
MC_BULLETDISABLED;
+// tdf#133697: Get true size of mark, to avoid stretching
+if (auto oSize = ImplGetThemeSize(hTheme, hDC, MENU_POPUPCHECK, iState, 
))
+{
+// center the mark inside the passed rectangle
+if (const auto dx = (rc.right - rc.left - oSize->Width() + 1) / 2; dx 
> 0)
+{
+rc.left += dx;
+rc.right = rc.left + oSize->Width();
+}
+if (const auto dy = (rc.bottom - rc.top - oSize->Height() + 1) / 2; dy 
> 0)
+{
+rc.top += dy;
+rc.bottom = rc.top + oSize->Height();
+}
+}
+return ImplDrawTheme(hTheme, hDC, MENU_POPUPCHECK, iState, rc, aCaption);
+}
+
 static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
 ControlType nType,
 ControlPart nPart,
@@ -978,39 +1014,8 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 }
 else if( nPart == ControlPart::MenuItemCheckMark || nPart == 
ControlPart::MenuItemRadioMark )
 {
-if( nState & ControlState::PRESSED )
-{
-if( aValue.getType() == ControlType::MenuPopup )
-{
-tools::Rectangle aRectangle = 
GetMenuPopupMarkRegion(aValue);
-rc.top = aRectangle.Top();
-rc.left = aRectangle.Left();
-rc.bottom = aRectangle.Bottom();
-rc.right = aRectangle.Right();
-}
-iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : 
MCB_DISABLED;
-ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, 
iState, rc, aCaption );
-if( nPart == ControlPart::MenuItemCheckMark )
-iState = (nState & ControlState::ENABLED) ? 
MC_CHECKMARKNORMAL : MC_CHECKMARKDISABLED;
-else
-iState = (nState & ControlState::ENABLED) ? 
MC_BULLETNORMAL : MC_BULLETDISABLED;
-// tdf#133697: Get true size of mark, to avoid stretching
-if (auto oSize = ImplGetThemeSize(hTheme, hDC, 
MENU_POPUPCHECK, iState, ))
-{
-// center the mark inside the passed rectangle
-if (const auto dx = (rc.right - rc.left - 
oSize->Width() + 1) / 2; dx > 0)
-{
-rc.left += dx;
-rc.right = rc.left + oSize->Width();
-}
-if (const auto dy = (rc.bottom - rc.top - 
oSize->Height() + 1) / 2; dy > 0)
-{
-rc.top += dy;
-rc.bottom = rc.top + oSize->Height();
-}
-}
-return ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECK, 
iState, rc, aCaption );
-}
+if (nState & ControlState::PRESSED)
+return implDrawNativeMenuMark(hDC, hTheme, 

[Libreoffice-commits] core.git: vcl/win

2021-12-30 Thread Mike Kaganski (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   41 --
 1 file changed, 30 insertions(+), 11 deletions(-)

New commits:
commit 089e0cb2cce6ee6f80ed1b77e333e83234fd3961
Author: Mike Kaganski 
AuthorDate: Thu Dec 30 13:54:27 2021 +0300
Commit: Mike Kaganski 
CommitDate: Thu Dec 30 18:34:11 2021 +0100

tdf#133697: use true bullet size to avoid stretching in scaled UI

Change-Id: I7fcff6234fa6ee5dcb47a6c32651a9bae5f056c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127741
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 801a93ffb425..fe784c66872c 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -229,12 +229,18 @@ static bool ImplDrawTheme( HTHEME hTheme, HDC hDC, int 
iPart, int iState, RECT r
 return (hr == S_OK);
 }
 
+// TS_TRUE returns optimal size
+static std::optional ImplGetThemeSize(HTHEME hTheme, HDC hDC, int iPart, 
int iState, LPCRECT pRect, THEMESIZE eTS = TS_TRUE)
+{
+if (SIZE aSz; SUCCEEDED(GetThemePartSize(hTheme, hDC, iPart, iState, 
pRect, eTS, )))
+return Size(aSz.cx, aSz.cy);
+return {};
+}
+
 static tools::Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, 
int iState, const tools::Rectangle& /* aRect */, THEMESIZE eTS = TS_TRUE )
 {
-SIZE aSz;
-HRESULT hr = GetThemePartSize( hTheme, hDC, iPart, iState, nullptr, eTS, 
 ); // TS_TRUE returns optimal size
-if( hr == S_OK )
-return tools::Rectangle( 0, 0, aSz.cx, aSz.cy );
+if (const std::optional oSz = ImplGetThemeSize(hTheme, hDC, iPart, 
iState, nullptr, eTS))
+return tools::Rectangle( 0, 0, oSz->Width(), oSz->Height() );
 else
 return tools::Rectangle();
 }
@@ -974,22 +980,35 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 {
 if( nState & ControlState::PRESSED )
 {
-RECT aBGRect = rc;
 if( aValue.getType() == ControlType::MenuPopup )
 {
 tools::Rectangle aRectangle = 
GetMenuPopupMarkRegion(aValue);
-aBGRect.top = aRectangle.Top();
-aBGRect.left = aRectangle.Left();
-aBGRect.bottom = aRectangle.Bottom();
-aBGRect.right = aRectangle.Right();
-rc = aBGRect;
+rc.top = aRectangle.Top();
+rc.left = aRectangle.Left();
+rc.bottom = aRectangle.Bottom();
+rc.right = aRectangle.Right();
 }
 iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : 
MCB_DISABLED;
-ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, 
iState, aBGRect, aCaption );
+ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, 
iState, rc, aCaption );
 if( nPart == ControlPart::MenuItemCheckMark )
 iState = (nState & ControlState::ENABLED) ? 
MC_CHECKMARKNORMAL : MC_CHECKMARKDISABLED;
 else
 iState = (nState & ControlState::ENABLED) ? 
MC_BULLETNORMAL : MC_BULLETDISABLED;
+// tdf#133697: Get true size of mark, to avoid stretching
+if (auto oSize = ImplGetThemeSize(hTheme, hDC, 
MENU_POPUPCHECK, iState, ))
+{
+// center the mark inside the passed rectangle
+if (const auto dx = (rc.right - rc.left - 
oSize->Width() + 1) / 2; dx > 0)
+{
+rc.left += dx;
+rc.right = rc.left + oSize->Width();
+}
+if (const auto dy = (rc.bottom - rc.top - 
oSize->Height() + 1) / 2; dy > 0)
+{
+rc.top += dy;
+rc.bottom = rc.top + oSize->Height();
+}
+}
 return ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECK, 
iState, rc, aCaption );
 }
 else


[Libreoffice-commits] core.git: vcl/win

2021-12-22 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/winlayout.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 4a0f329eda7e1878dd2b78cf4529f98c9e253762
Author: Stephan Bergmann 
AuthorDate: Wed Dec 22 09:11:05 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 22 12:48:27 2021 +0100

-Werror,-Wunused-variable

Change-Id: Ia43a7f973d08794a4fc8cd0b1060df8f33759b6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127297
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 83033e9f6be8..04178bf877d2 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -96,7 +96,6 @@ bool ExTextOutRenderer::operator()(GenericSalLayout const& 
rLayout, SalGraphics&
 
 if (pWinFont->IsCJKVerticalFont() && pGlyph->IsVertical())
 {
-tools::Rectangle aRect;
 nNewTextAlign = VTA_CENTER | TA_BOTTOM;
 nYOffset = nGlyphOffset;
 }


[Libreoffice-commits] core.git: vcl/win

2021-10-29 Thread Stephan Bergmann (via logerrit)
 vcl/win/dtrans/ImplHelper.cxx |   16 +++
 vcl/win/window/salframe.cxx   |   44 +-
 2 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit 166399c5017c05406ecae4132e817f2b206170d8
Author: Stephan Bergmann 
AuthorDate: Fri Oct 29 09:20:10 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 29 13:25:25 2021 +0200

loplugin:indentation (clang-cl)

Change-Id: If23252e7640a9cfc9dd9feab4416ae832feddaf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124403
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/dtrans/ImplHelper.cxx b/vcl/win/dtrans/ImplHelper.cxx
index 227876b19cb8..84c7383b2ce7 100644
--- a/vcl/win/dtrans/ImplHelper.cxx
+++ b/vcl/win/dtrans/ImplHelper.cxx
@@ -241,17 +241,17 @@ bool CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC 
petcSrc )
 if ( petcDest != petcSrc )
 {
 
-petcDest->cfFormat = petcSrc->cfFormat;
+petcDest->cfFormat = petcSrc->cfFormat;
 
-petcDest->ptd  = nullptr;
-if ( nullptr != petcSrc->ptd )
-petcDest->ptd  = CopyTargetDevice(petcSrc->ptd);
+petcDest->ptd  = nullptr;
+if ( nullptr != petcSrc->ptd )
+petcDest->ptd  = CopyTargetDevice(petcSrc->ptd);
 
-petcDest->dwAspect = petcSrc->dwAspect;
-petcDest->lindex   = petcSrc->lindex;
-petcDest->tymed= petcSrc->tymed;
+petcDest->dwAspect = petcSrc->dwAspect;
+petcDest->lindex   = petcSrc->lindex;
+petcDest->tymed= petcSrc->tymed;
 
-bRet = true;
+bRet = true;
 }
 }
 __except( EXCEPTION_EXECUTE_HANDLER )
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 8d3f52d9c354..6593b2fbebb6 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5328,41 +5328,41 @@ static LRESULT ImplHandleIMEReconvertString( HWND hWnd, 
LPARAM lParam )
 UINT nImeProps = ImmGetProperty( GetKeyboardLayout( 0 ), IGP_SETCOMPSTR );
 if( (nImeProps & SCS_CAP_SETRECONVERTSTRING) == 0 )
 {
-// This IME does not support reconversion.
-return 0;
+// This IME does not support reconversion.
+return 0;
 }
 
 if( !pReconvertString )
 {
-// The first call for reconversion.
-pFrame->CallCallback( SalEvent::StartReconversion, nullptr );
+// The first call for reconversion.
+pFrame->CallCallback( SalEvent::StartReconversion, nullptr );
 
-// Retrieve the surrounding text from the focused control.
-pFrame->CallCallback( SalEvent::SurroundingTextRequest,  );
+// Retrieve the surrounding text from the focused control.
+pFrame->CallCallback( SalEvent::SurroundingTextRequest,  );
 
-if( aEvt.maText.isEmpty())
-{
-return 0;
-}
+if( aEvt.maText.isEmpty())
+{
+return 0;
+}
 
-nRet = sizeof(RECONVERTSTRING) + (aEvt.maText.getLength() + 1) * 
sizeof(WCHAR);
+nRet = sizeof(RECONVERTSTRING) + (aEvt.maText.getLength() + 1) * 
sizeof(WCHAR);
 }
 else
 {
-// The second call for reconversion.
+// The second call for reconversion.
 
-// Retrieve the surrounding text from the focused control.
-pFrame->CallCallback( SalEvent::SurroundingTextRequest,  );
-nRet = sizeof(RECONVERTSTRING) + (aEvt.maText.getLength() + 1) * 
sizeof(WCHAR);
+// Retrieve the surrounding text from the focused control.
+pFrame->CallCallback( SalEvent::SurroundingTextRequest,  );
+nRet = sizeof(RECONVERTSTRING) + (aEvt.maText.getLength() + 1) * 
sizeof(WCHAR);
 
-pReconvertString->dwStrOffset = sizeof(RECONVERTSTRING);
-pReconvertString->dwStrLen = aEvt.maText.getLength();
-pReconvertString->dwCompStrOffset = aEvt.mnStart * sizeof(WCHAR);
-pReconvertString->dwCompStrLen = aEvt.mnEnd - aEvt.mnStart;
-pReconvertString->dwTargetStrOffset = pReconvertString->dwCompStrOffset;
-pReconvertString->dwTargetStrLen = pReconvertString->dwCompStrLen;
+pReconvertString->dwStrOffset = sizeof(RECONVERTSTRING);
+pReconvertString->dwStrLen = aEvt.maText.getLength();
+pReconvertString->dwCompStrOffset = aEvt.mnStart * sizeof(WCHAR);
+pReconvertString->dwCompStrLen = aEvt.mnEnd - aEvt.mnStart;
+pReconvertString->dwTargetStrOffset = 
pReconvertString->dwCompStrOffset;
+pReconvertString->dwTargetStrLen = pReconvertString->dwCompStrLen;
 
-memcpy( pReconvertString + 1, aEvt.maText.getStr(), 
(aEvt.maText.getLength() + 1) * sizeof(WCHAR) );
+memcpy( pReconvertString + 1, aEvt.maText.getStr(), 
(aEvt.maText.getLength() + 1) * sizeof(WCHAR) );
 }
 
 // just return the required size of buffer to reconvert.


[Libreoffice-commits] core.git: vcl/win vcl/workben

2021-10-05 Thread Julien Nabet (via logerrit)
 vcl/win/dtrans/DOTransferable.cxx |1 -
 vcl/win/dtrans/DataFmtTransl.cxx  |1 -
 vcl/win/dtrans/FetcList.cxx   |1 -
 vcl/win/dtrans/clipboardmanager.cxx   |5 ++---
 vcl/win/dtrans/ftransl.cxx|9 -
 vcl/win/gdi/salnativewidgets-luna.cxx |4 +---
 vcl/workben/win/dnd/atlwindow.cxx |1 -
 7 files changed, 7 insertions(+), 15 deletions(-)

New commits:
commit 311964173ff0591a01d81715b1cc48b1ffa14abf
Author: Julien Nabet 
AuthorDate: Tue Oct 5 18:24:03 2021 +0200
Commit: Julien Nabet 
CommitDate: Tue Oct 5 20:08:05 2021 +0200

drop 'using namespace std' in vcl (Windows part)

Change-Id: I8516e48f5e4a7266aef35ba2e31ebd107bf8169b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123112
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/dtrans/DOTransferable.cxx 
b/vcl/win/dtrans/DOTransferable.cxx
index 61edcb9a9348..7b9f28203d7e 100644
--- a/vcl/win/dtrans/DOTransferable.cxx
+++ b/vcl/win/dtrans/DOTransferable.cxx
@@ -37,7 +37,6 @@
 #include 
 #include 
 
-using namespace std;
 using namespace osl;
 using namespace cppu;
 using namespace com::sun::star::uno;
diff --git a/vcl/win/dtrans/DataFmtTransl.cxx b/vcl/win/dtrans/DataFmtTransl.cxx
index 5e2382213a0e..5daf0b453f27 100644
--- a/vcl/win/dtrans/DataFmtTransl.cxx
+++ b/vcl/win/dtrans/DataFmtTransl.cxx
@@ -36,7 +36,6 @@
 #include 
 #include 
 
-using namespace std;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::datatransfer;
 using namespace com::sun::star::lang;
diff --git a/vcl/win/dtrans/FetcList.cxx b/vcl/win/dtrans/FetcList.cxx
index e9a1c0dac5f1..5ace3cdca6e4 100644
--- a/vcl/win/dtrans/FetcList.cxx
+++ b/vcl/win/dtrans/FetcList.cxx
@@ -36,7 +36,6 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::datatransfer;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::container;
-using namespace std;
 
 LCID   CFormatRegistrar::m_TxtLocale   = 0;
 sal_uInt32 CFormatRegistrar::m_TxtCodePage = GetACP( );
diff --git a/vcl/win/dtrans/clipboardmanager.cxx 
b/vcl/win/dtrans/clipboardmanager.cxx
index 8cea07171f78..2e04d39e1457 100644
--- a/vcl/win/dtrans/clipboardmanager.cxx
+++ b/vcl/win/dtrans/clipboardmanager.cxx
@@ -34,7 +34,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::uno;
 using namespace cppu;
 using namespace osl;
-using namespace std;
 
 using ::dtrans::ClipboardManager;
 
@@ -105,11 +104,11 @@ void SAL_CALL ClipboardManager::addClipboard( const 
Reference< XClipboard >& xCl
 ClearableMutexGuard aGuard(m_aMutex);
 if (!rBHelper.bDisposed && !rBHelper.bInDispose)
 {
-pair< const OUString, Reference< XClipboard > > value (
+std::pair< const OUString, Reference< XClipboard > > value (
 aName.getLength() ? aName : m_aDefaultName,
 xClipboard );
 
-pair< ClipboardMap::iterator, bool > p = m_aClipboardMap.insert(value);
+std::pair< ClipboardMap::iterator, bool > p = 
m_aClipboardMap.insert(value);
 aGuard.clear();
 
 // insert failed, element must exist already
diff --git a/vcl/win/dtrans/ftransl.cxx b/vcl/win/dtrans/ftransl.cxx
index 45ab9a79ef64..ea3735832e93 100644
--- a/vcl/win/dtrans/ftransl.cxx
+++ b/vcl/win/dtrans/ftransl.cxx
@@ -40,7 +40,6 @@ const css::uno::Type CppuType_String   = 
::cppu::UnoType::get();
 
 using namespace osl;
 using namespace cppu;
-using namespace std;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::datatransfer;
@@ -353,7 +352,7 @@ void findDataFlavorForStandardFormatId( sal_Int32 
aStandardFormatId, DataFlavor&
 standard clipboard format id appear before the other
 entries with CF_INVALID
 */
-vector< FormatEntry >::const_iterator citer = 
std::find_if(g_TranslTable.begin(), g_TranslTable.end(),
+std::vector< FormatEntry >::const_iterator citer = 
std::find_if(g_TranslTable.begin(), g_TranslTable.end(),
 [](const FormatEntry& rEntry) {
 return rEntry.aStandardFormatId == aStandardFormatId
 || rEntry.aStandardFormatId == CF_INVALID;
@@ -364,7 +363,7 @@ void findDataFlavorForStandardFormatId( sal_Int32 
aStandardFormatId, DataFlavor&
 
 void findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, 
DataFlavor& aDataFlavor )
 {
-vector< FormatEntry >::const_iterator citer = 
std::find_if(g_TranslTable.begin(), g_TranslTable.end(),
+std::vector< FormatEntry >::const_iterator citer = 
std::find_if(g_TranslTable.begin(), g_TranslTable.end(),
 [](const FormatEntry& rEntry) {
 return 
aNativeFormatName.equalsIgnoreAsciiCase(rEntry.aNativeFormatName); });
 if (citer != g_TranslTable.end())
@@ -385,7 +384,7 @@ void findStandardFormatIdForCharset( const OUString& 
aCharset, Any& aAny )
 
 void setStandardFormatIdForNativeFormatName( const OUString& 
aNativeFormatName, Any& 

[Libreoffice-commits] core.git: vcl/win

2021-09-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/gdi/salfont.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 3476106890ea2a00e6f949c918f6c05e17c66a36
Author: Jan-Marek Glogowski 
AuthorDate: Mon Sep 27 18:26:17 2021 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Sep 28 13:02:04 2021 +0200

tdf#144754 WIN de-assert ReleaseFonts / setFont

DeInitGraphics might already have reset the default HDC font,
while the WinSalGraphics still has a font fallback stack. Not
sure why this didn't trigger the existing assert before.
Quite probably there was an existing lifecycle bug.

Regression from commit 42f9d4335bfa4b7299224801fd7ccdd97ae92fbf
("WIN always (de-)init WinSalGraphics")

Change-Id: Ie5826e632310a0d69e8f9617cf6f3629bc31f152
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122726
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index c3ad1eb5817d..6dd8365e6955 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -856,16 +856,22 @@ HFONT 
WinSalGraphics::ImplDoSetFont(vcl::font::FontSelectPattern const & i_rFont
 
 void WinSalGraphics::SetFont(LogicalFontInstance* pFont, int nFallbackLevel)
 {
+// check that we don't change the first font while ScopedFont has replaced 
HFONT
+assert(!mpWinFontEntry[0].is() || nFallbackLevel != 0 || 
mpWinFontEntry[0]->GetHFONT());
+assert(nFallbackLevel >= 0 && nFallbackLevel < MAX_FALLBACK);
+
 // return early if there is no new font
 if( !pFont )
 {
 if (!mpWinFontEntry[nFallbackLevel].is())
 return;
 
-// select original DC font
-assert(mhDefFont);
-::SelectFont(getHDC(), mhDefFont);
-mhDefFont = nullptr;
+// DeInitGraphics doesn't free the cached fonts, so mhDefFont might be 
nullptr
+if (mhDefFont)
+{
+::SelectFont(getHDC(), mhDefFont);
+mhDefFont = nullptr;
+}
 
 // release no longer referenced font handles
 for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )


[Libreoffice-commits] core.git: vcl/win

2021-09-15 Thread Noel Grandin (via logerrit)
 vcl/win/gdi/salprn.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 3372f93173b900c087073078a01d31916bf47783
Author: Noel Grandin 
AuthorDate: Wed Sep 15 16:01:13 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 15 20:24:03 2021 +0200

add some logging for intermittent windows jenkins crash

Change-Id: I8ad589dd8d0a64f75179d3330c80c9c43a21ff32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122155
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index e7a6936364f5..0c5057797682 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1105,6 +1105,8 @@ WinSalInfoPrinter::~WinSalInfoPrinter()
 if ( mpGraphics )
 {
 mpGraphics->DeInitGraphics();
+// we get intermittent crashes on the Windows jenkins box around here, 
let us see if there is something weird about the DC
+SAL_WARN("vcl", "Graphics DC " << mpGraphics->getHDC());
 DeleteDC( mpGraphics->getHDC() );
 delete mpGraphics;
 }


[Libreoffice-commits] core.git: vcl/win

2021-09-04 Thread Noel Grandin (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 86fa9c907387e96c9c93f1e17239730271fedbfd
Author: Noel Grandin 
AuthorDate: Fri Sep 3 14:41:57 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 4 08:12:13 2021 +0200

fix comment left behind

in commit e25ba7dc57229d1cb9794abd1ca23c0d87ebecb3
   use a dummy clipboard when running unit tests

Change-Id: If5f57d1777dddbd70771299c8e161b33da10711d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121600
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 39094d9e5e0f..2c33fe72e9c9 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -327,12 +327,12 @@ uno::Sequence SAL_CALL 
CWinClipboard::getSupportedServiceNames()
 return { "com.sun.star.datatransfer.clipboard.SystemClipboard" };
 }
 
-// We run unit tests in parallel, which is a problem when touching a shared 
resource
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 dtrans_CWinClipboard_get_implementation(css::uno::XComponentContext* context,
 css::uno::Sequence 
const& args)
 {
-// the system clipboard, so rather use the dummy GenericClipboard.
+// We run unit tests in parallel, which is a problem when touching a 
shared resource
+// like the system clipboard, so rather use the dummy GenericClipboard.
 static const bool bRunningUnitTest = getenv("LO_TESTNAME");
 
 if (bRunningUnitTest)


[Libreoffice-commits] core.git: vcl/win

2021-06-30 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |   21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit ce9e6972148c657994beb74f671e51bec5be6689
Author: Caolán McNamara 
AuthorDate: Wed Jun 30 15:58:57 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 30 21:48:05 2021 +0200

tdf#70633 unset Alt if detected as AltGr in both KeyInput branches

we are unsetting Alt if the modifier is AltGr in one SalEvent::KeyInput
case but not in another. If I replicate the unset of Alt if AlrGr in
the other place then both UTF-16 parts of the codepoint get accepted
and the described input case works

Change-Id: Ifa8a5afbb1853ef3d5f388fd5e7bd3bbc048e260
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118170
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 8e4abcdbd66e..45361d8baef0 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3353,6 +3353,16 @@ bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode 
aUnicode, LanguageType aLangT
 return bRet;
 }
 
+static void UnsetAltIfAltGr(SalKeyEvent& rKeyEvt, sal_uInt16 nModCode)
+{
+if ((nModCode & (KEY_MOD1 | KEY_MOD2)) == (KEY_MOD1 | KEY_MOD2) &&
+rKeyEvt.mnCharCode)
+{
+// this is actually AltGr and should not be handled as Alt
+rKeyEvt.mnCode &= ~(KEY_MOD1 | KEY_MOD2);
+}
+}
+
 static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
   WPARAM wParam, LPARAM lParam, LRESULT& rResult )
 {
@@ -3441,8 +3451,12 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 aKeyEvt.mnCode |= nModCode;
 aKeyEvt.mnCharCode  = ImplGetCharCode( pFrame, wParam );
 aKeyEvt.mnRepeat= nRepeat;
+
+UnsetAltIfAltGr(aKeyEvt, nModCode);
+
 nLastChar = 0;
 nLastVKChar = 0;
+
 bool nRet = pFrame->CallCallback( SalEvent::KeyInput,  );
 pFrame->CallCallback( SalEvent::KeyUp,  );
 return nRet;
@@ -3593,12 +3607,7 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 aKeyEvt.mnCode |= nModCode;
 aKeyEvt.mnRepeat= nRepeat;
 
-if ((nModCode & (KEY_MOD1 | KEY_MOD2)) == (KEY_MOD1 | 
KEY_MOD2) &&
-aKeyEvt.mnCharCode)
-{
-// this is actually AltGr and should not be handled as Alt
-aKeyEvt.mnCode &= ~(KEY_MOD1 | KEY_MOD2);
-}
+UnsetAltIfAltGr(aKeyEvt, nModCode);
 
 bIgnoreCharMsg = bCharPeek;
 bool nRet = pFrame->CallCallback( nEvent,  );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-06-17 Thread László Németh (via logerrit)
 vcl/win/window/salframe.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 3bae5216881a2b8d84066a81b5e2f728675000f0
Author: László Németh 
AuthorDate: Wed Jun 16 14:31:32 2021 +0200
Commit: László Németh 
CommitDate: Thu Jun 17 09:46:01 2021 +0200

tdf#115281 sc Windows: fix shortcut text Ctrl+` in View menu

In View->Show Formula, shortcut text was only "Ctrl" instead
of the complete "Ctrl+`".

Follow-up to commit 3f9fcf0e7f154e49bbffeaea925edb6055add494
"tdf#103388 Show the backtick used in shortcut in Calc View menu".

Change-Id: Icef8904bac0b663d9702e62fcdc0ab1f0f4bd1ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117332
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 559598b20446..8e4abcdbd66e 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2519,6 +2519,9 @@ OUString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode )
 case KEY_BRACKETRIGHT:
 cSVCode = ']';
 break;
+case KEY_QUOTELEFT:
+cSVCode = '`';
+break;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-06-14 Thread Mike Kaganski (via logerrit)
 vcl/win/app/salinfo.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 3c472ffe90bf5c496411c6d37ae832d9181c4ec9
Author: Mike Kaganski 
AuthorDate: Mon Jun 14 21:48:37 2021 +0200
Commit: Mike Kaganski 
CommitDate: Tue Jun 15 06:22:03 2021 +0200

Revert "tdf#142832: a blind fix - calculate rectangle size properly"

This reverts commit 57d122258437c0a14b303a8d961aa5e8f6f67f57.

Reason for revert:
As mentioned in 
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect,

> In conformance with conventions for the RECT structure, the bottom-
> right coordinates of the returned rectangle are exclusive. In other
> words, the pixel at (right, bottom) lies immediately outside the
> rectangle.

So it was incorrect change.

Change-Id: I2b29871a5d9b944ce2f9119edb2e87c53d9ae298
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117212
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 547e54ce54f6..2787797a6ce5 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -65,8 +65,10 @@ bool WinSalSystem::handleMonitorCallback( sal_IntPtr 
hMonitor, sal_IntPtr, sal_I
 if( it != m_aDeviceNameToMonitor.end() )
 {
 DisplayMonitor& rMon( m_aMonitors[ it->second ] );
-rMon.m_aArea = tools::Rectangle(aInfo.rcMonitor.left, 
aInfo.rcMonitor.top,
-aInfo.rcMonitor.right, 
aInfo.rcMonitor.bottom);
+rMon.m_aArea = tools::Rectangle( Point( aInfo.rcMonitor.left,
+ aInfo.rcMonitor.top ),
+  Size( aInfo.rcMonitor.right - 
aInfo.rcMonitor.left,
+aInfo.rcMonitor.bottom - 
aInfo.rcMonitor.top ) );
 if( (aInfo.dwFlags & MONITORINFOF_PRIMARY) != 0 )
 m_nPrimary = it->second;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-06-14 Thread Mike Kaganski (via logerrit)
 vcl/win/app/salinfo.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 57d122258437c0a14b303a8d961aa5e8f6f67f57
Author: Mike Kaganski 
AuthorDate: Mon Jun 14 19:06:26 2021 +0200
Commit: Mike Kaganski 
CommitDate: Mon Jun 14 21:11:07 2021 +0200

tdf#142832: a blind fix - calculate rectangle size properly

The size was calculated wrong - it needed a "+1". But a rectangle
constructor taking L, T, R, and B is actually simpler.

Change-Id: I4152f9b43f0ae8f1829038645fcf83bae156c618
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117129
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 2787797a6ce5..547e54ce54f6 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -65,10 +65,8 @@ bool WinSalSystem::handleMonitorCallback( sal_IntPtr 
hMonitor, sal_IntPtr, sal_I
 if( it != m_aDeviceNameToMonitor.end() )
 {
 DisplayMonitor& rMon( m_aMonitors[ it->second ] );
-rMon.m_aArea = tools::Rectangle( Point( aInfo.rcMonitor.left,
- aInfo.rcMonitor.top ),
-  Size( aInfo.rcMonitor.right - 
aInfo.rcMonitor.left,
-aInfo.rcMonitor.bottom - 
aInfo.rcMonitor.top ) );
+rMon.m_aArea = tools::Rectangle(aInfo.rcMonitor.left, 
aInfo.rcMonitor.top,
+aInfo.rcMonitor.right, 
aInfo.rcMonitor.bottom);
 if( (aInfo.dwFlags & MONITORINFOF_PRIMARY) != 0 )
 m_nPrimary = it->second;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win vcl/WinResTarget_vcl.mk

2021-05-24 Thread Mike Kaganski (via logerrit)
 vcl/WinResTarget_vcl.mk  |1 +
 vcl/win/src/fatcross.cur |binary
 2 files changed, 1 insertion(+)

New commits:
commit abfa48b54307d659dc2f6f890c9855d06f1cbf7d
Author: Mike Kaganski 
AuthorDate: Mon May 24 11:35:41 2021 +0200
Commit: Mike Kaganski 
CommitDate: Mon May 24 12:41:58 2021 +0200

tdf#142390: fix fatcross cursor on Windows

Make it 1-bit cursor resource instead of 32-bit icon; and add it to
the appropriate makefile.

Change-Id: Icd140f7065f6ec94683e94201d96187f38ab683b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115962
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/WinResTarget_vcl.mk b/vcl/WinResTarget_vcl.mk
index f7195b432ae2..c32f5e3538b6 100644
--- a/vcl/WinResTarget_vcl.mk
+++ b/vcl/WinResTarget_vcl.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_WinResTarget_add_dependencies,vcl/salsrc,\
 vcl/win/src/chart.cur \
 vcl/win/src/dline.cur \
 vcl/win/src/movebw.cur \
+vcl/win/src/fatcross.cur \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/win/src/fatcross.cur b/vcl/win/src/fatcross.cur
index 68f095f15fd4..9f92d04029a5 100644
Binary files a/vcl/win/src/fatcross.cur and b/vcl/win/src/fatcross.cur differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-05-18 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |8 
 1 file changed, 8 deletions(-)

New commits:
commit 674e4b01b0d95dc4fe364ee483693557a71ae9ef
Author: Stephan Bergmann 
AuthorDate: Tue May 18 14:41:28 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 19 07:25:31 2021 +0200

-Werror,-Wunused-function (clang-cl)

...since 5686c1aca40beb9514d40c86b4a3780a8a1334ba "vcl: use 
DWriteTextRenderer
for vertical writing."

Change-Id: Ia215fb10f9b39fc41f16b6568ce9f461f78f1df4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115745
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 473f743d3cee..2830d6048590 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -760,14 +760,6 @@ void WinSalGraphics::SetTextColor( Color nColor )
 ::SetTextColor( getHDC(), aCol );
 }
 
-static int CALLBACK SalEnumQueryFontProcExW( const LOGFONTW*,
-  const TEXTMETRICW*,
-  DWORD, LPARAM lParam )
-{
-*reinterpret_cast(lParam) = true;
-return 0;
-}
-
 void ImplGetLogFontFromFontSelect( const FontSelectPattern& rFont,
const PhysicalFontFace* pFontFace,
LOGFONTW& rLogFont )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-05-07 Thread Mark Hung (via logerrit)
 vcl/win/gdi/salfont.cxx |   22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

New commits:
commit f0653d01e15ed9f0e0e862a0679ae6ac88a2cb07
Author: Mark Hung 
AuthorDate: Wed May 5 21:53:41 2021 +0800
Commit: Mark Hung 
CommitDate: Sat May 8 06:37:05 2021 +0200

vcl: vertical writing in WinFontInstance::ImplGetGlyphBoundRect.

Identity matrix isn't enough for vertical writing. For those glyphs
that is vertical, they have to be rotated 90 degrees.

Change-Id: Ia5f1f8ac9cea89aec2c98b88058ec79f733fc238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115148
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 6fd4836e3040..39f67e26a057 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1254,7 +1254,7 @@ void WinSalGraphics::ClearDevFontCache()
 ImplReleaseTempFonts(*GetSalData(), false);
 }
 
-bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& 
rRect, bool) const
+bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& 
rRect, bool bIsVertical) const
 {
 assert(m_pGraphics);
 HDC hDC = m_pGraphics->getHDC();
@@ -1269,8 +1269,24 @@ bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId 
nId, tools::Rectangle& r
 
 // use unity matrix
 MAT2 aMat;
-aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 );
-aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 );
+const FontSelectPattern& rFSD = GetFontSelectPattern();
+
+// Use identity matrix for fonts requested in horizontal
+// writing (LTR or RTL), or rotated glyphs in vertical writing.
+if (!rFSD.mbVertical || !bIsVertical)
+{
+aMat.eM11 = aMat.eM22 = FixedFromDouble(1.0);
+aMat.eM12 = aMat.eM21 = FixedFromDouble(0.0);
+}
+else
+{
+constexpr double nCos = 0.0;
+constexpr double nSin = 1.0;
+aMat.eM11 = FixedFromDouble(nCos);
+aMat.eM12 = FixedFromDouble(nSin);
+aMat.eM21 = FixedFromDouble(-nSin);
+aMat.eM22 = FixedFromDouble(nCos);
+}
 
 UINT nGGOFlags = GGO_METRICS;
 nGGOFlags |= GGO_GLYPH_INDEX;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-30 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c112868f6cc6a3ba937778435dcca1fe986bf124
Author: Stephan Bergmann 
AuthorDate: Fri Apr 30 08:04:40 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 30 08:43:46 2021 +0200

loplugin:stringadd (clang-cl)

Change-Id: I132643eb73129e1319af36b7c8aac36a516714b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114896
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 18605f2f17d4..1771120e42c8 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -908,7 +908,7 @@ OUString WinSalInstance::getOSVersion()
 + OUString::number(vi2.dwMinorVersion));
 aVer.append(" ");
 if (vi2.szCSDVersion[0])
-aVer.append(o3tl::toU(vi2.szCSDVersion)).append(" ");
+aVer.append(OUString::Concat(o3tl::toU(vi2.szCSDVersion)) 
+ " ");
 aVer.append("Build " + OUString::number(vi2.dwBuildNumber));
 bHaveVerFromRtlGetVersion = true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-27 Thread Julien Nabet (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 45779b685b8b1e75ce750bbb20b30cee8fd40851
Author: Julien Nabet 
AuthorDate: Mon Apr 26 15:42:18 2021 +0200
Commit: Julien Nabet 
CommitDate: Tue Apr 27 11:21:37 2021 +0200

Replace "Persistant" by "Persistent"in WinClipboard (vcl/win)

since now we have it in idl files with the historically wrong "Persistant"
after these:
in offapi/com/sun/star/datatransfer/clipboard/RenderingCapabilities.idl
"Persistant" is deprecated since e738683f98559af330a1cc36d8d0a1be11abb355
author  Julien Nabet   2020-09-12 12:00:49 +0200
committer   Stephan Bergmann   2020-09-17 15:20:27 
+0200
commit  e738683f98559af330a1cc36d8d0a1be11abb355 (patch)
treefd0e07d574d9ff7656d613f6b88f473951dd5b12
parent  b33f22678431a57be7e77822e977b66c33680290 (diff)
Add "Persistent", deprecate "Persistant" in RenderingCapabilities

in offapi/type_reference/offapi.idl
author  Stephan Bergmann   2021-04-13 10:14:59 +0200
committer   Stephan Bergmann   2021-04-13 11:47:37 
+0200
commit  bce31cac427d7119cd8ccec64bdfa820706cbfcc (patch)
treeed4a7e0b2c406e350b18136f88add9370b98
parent  5e5c7e10a5fde5ed93c541d439ce016e35d5d65a (diff)
Update the reference rdbs to libreoffice-7.1.0.3

Change-Id: I047dc0bc7956f3b14c6319df85f0707ec6addd9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114669
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 2253c1691785..a2ecb7427d44 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -229,7 +229,7 @@ sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities()
   static_cast(this));
 
 using namespace datatransfer::clipboard::RenderingCapabilities;
-return (Delayed | Persistant);
+return (Delayed | Persistent);
 }
 
 // XClipboardNotifier
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salbmp.cxx |   16 
 1 file changed, 16 deletions(-)

New commits:
commit ddd9082c397b97e4aa43daf998f3fe36cb8bb724
Author: Stephan Bergmann 
AuthorDate: Tue Apr 27 08:41:01 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Apr 27 11:09:35 2021 +0200

-Werror,-Wunused-function (clang-cl)

Change-Id: Ic5f4ca1147217d830ea3492b4f42116e15cbae80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114691
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 0218ca408eec..4602565ece51 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -53,22 +53,6 @@
 #undef max
 #endif
 
-static void ImplSetPixel4( sal_uInt8* pScanline, tools::Long nX, const BYTE 
cIndex )
-{
-BYTE& rByte = pScanline[ nX >> 1 ];
-
-if ( nX & 1 )
-{
-rByte &= 0xf0;
-rByte |= cIndex & 0x0f;
-}
-else
-{
-rByte &= 0x0f;
-rByte |= cIndex << 4;
-}
-}
-
 WinSalBitmap::WinSalBitmap()
 :   SalBitmap(),
 basegfx::SystemDependentDataHolder(),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-09 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d5f88932b60b79a8a677583f70c16d600c159935
Author: Stephan Bergmann 
AuthorDate: Fri Apr 9 15:28:18 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 9 17:01:10 2021 +0200

loplugin:noexceptmove (clang-cl)

Change-Id: I55f5c725ac65058f5424f472cb71a84c9e3322f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113873
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index a246ae7096c1..0f82d1af5bc6 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -186,7 +186,7 @@ struct BlobReference
 {
 hb_blob_reference(mpBlob);
 }
-BlobReference(BlobReference&& other)
+BlobReference(BlobReference&& other) noexcept
 : mpBlob(other.mpBlob)
 {
 other.mpBlob = nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-09 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/fileregistration.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit bbcf3a2dd4d02b90397cafcb41d539dba79c9204
Author: Stephan Bergmann 
AuthorDate: Fri Apr 9 15:25:58 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 9 16:36:57 2021 +0200

loplugin:nullptr (clang-cl)

Change-Id: I41a8fa48b762d8f4da1c23785a86d651cfb4aa89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113851
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/fileregistration.cxx b/vcl/win/app/fileregistration.cxx
index 2555cede8d2d..2347e46c4b61 100644
--- a/vcl/win/app/fileregistration.cxx
+++ b/vcl/win/app/fileregistration.cxx
@@ -91,11 +91,11 @@ static bool IsDefaultAppInstalledInReg()
 return false;
 
 WCHAR szProcPath[MAX_LONG_PATH];
-if (!GetModuleFileNameW(NULL, szProcPath, MAX_LONG_PATH))
+if (!GetModuleFileNameW(nullptr, szProcPath, MAX_LONG_PATH))
 return false;
 
 WCHAR szFullProcPath[MAX_LONG_PATH];
-if (!GetFullPathNameW(szProcPath, MAX_LONG_PATH, szFullProcPath, NULL))
+if (!GetFullPathNameW(szProcPath, MAX_LONG_PATH, szFullProcPath, nullptr))
 return false;
 
 if (!GetLongPathNameW(szFullProcPath, szFullProcPath, MAX_LONG_PATH))
@@ -104,7 +104,7 @@ static bool IsDefaultAppInstalledInReg()
 if (!GetLongPathNameW(szRegPath, szRegPath, MAX_LONG_PATH))
 return false;
 
-if (wcslen(szRegPath) > 0 && wcsstr(szFullProcPath, szRegPath) != NULL)
+if (wcslen(szRegPath) > 0 && wcsstr(szFullProcPath, szRegPath) != nullptr)
 return true;
 
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-07 Thread Luboš Luňák (via logerrit)
 vcl/win/gdi/winlayout.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 2736f7693a3099469599a0f9ebb132fe69651649
Author: Luboš Luňák 
AuthorDate: Wed Apr 7 14:51:32 2021 +
Commit: Luboš Luňák 
CommitDate: Wed Apr 7 19:47:19 2021 +0200

cache also GetFontData() failures

When drawing some documents such as tdf#141278 GetFontData() is
30+% of CPU time.
While at it, also fix the broken refcounting because of missing
operator=.

Change-Id: Ie62328b8e1c4ff700558796609f4bc6ad7e03a85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113745
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index e4baa93f55eb..a246ae7096c1 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -186,11 +186,18 @@ struct BlobReference
 {
 hb_blob_reference(mpBlob);
 }
-BlobReference(BlobReference const& other)
+BlobReference(BlobReference&& other)
 : mpBlob(other.mpBlob)
 {
-hb_blob_reference(mpBlob);
+other.mpBlob = nullptr;
+}
+BlobReference& operator=(BlobReference&& other)
+{
+std::swap(mpBlob, other.mpBlob);
+return *this;
 }
+BlobReference(const BlobReference& other) = delete;
+BlobReference& operator=(BlobReference& other) = delete;
 ~BlobReference() { hb_blob_destroy(mpBlob); }
 };
 }
@@ -242,13 +249,14 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, 
hb_tag_t nTableTag, void* pU
 SelectObject(hDC, hOrigFont);
 
 if (!pBuffer)
+{ // Cache also failures.
+gCache.insert({ cacheKey, BlobReference(nullptr) });
 return nullptr;
+}
 
 hb_blob_t* pBlob
 = hb_blob_create(reinterpret_cast(pBuffer), nLength, 
HB_MEMORY_MODE_READONLY,
  pBuffer, [](void* data) { delete[] 
static_cast(data); });
-if (!pBlob)
-return pBlob;
 gCache.insert({ cacheKey, BlobReference(pBlob) });
 return pBlob;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-04-01 Thread Mike Kaganski (via logerrit)
 vcl/win/app/fileregistration.cxx |   34 +-
 1 file changed, 13 insertions(+), 21 deletions(-)

New commits:
commit 7a743920c7fd46b2709186be5a344ba81b54b19d
Author: Mike Kaganski 
AuthorDate: Thu Apr 1 09:44:46 2021 +0300
Commit: Mike Kaganski 
CommitDate: Thu Apr 1 11:56:36 2021 +0200

Simplify CheckFileExtRegistration

Change-Id: I49a01e9cae16a408c6be11fe0501f489c3db6e3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113438
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/app/fileregistration.cxx b/vcl/win/app/fileregistration.cxx
index 7454f5e0c2f4..2555cede8d2d 100644
--- a/vcl/win/app/fileregistration.cxx
+++ b/vcl/win/app/fileregistration.cxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
@@ -155,11 +155,11 @@ void CheckFileExtRegistration(weld::Window* pDialogParent)
 if (bUninit)
 CoUninitialize();
 });
-sal::systools::COMReference pAAR = 
nullptr;
+sal::systools::COMReference pAAR;
 try
 {
-pAAR = 
sal::systools::COMReference().CoCreateInstance(
-CLSID_ApplicationAssociationRegistration, nullptr, 
CLSCTX_INPROC_SERVER);
+pAAR.CoCreateInstance(CLSID_ApplicationAssociationRegistration, 
nullptr,
+  CLSCTX_INPROC_SERVER);
 }
 catch (...)
 {
@@ -167,30 +167,22 @@ void CheckFileExtRegistration(weld::Window* pDialogParent)
 return;
 }
 
-std::map formats = {
-{ ".odp", "LibreOffice.ImpressDocument.1" },
-{ ".odt", "LibreOffice.WriterDocument.1" },
-{ ".ods", "LibreOffice.CalcDocument.1" },
+static const std::pair formats[] = {
+{ L".odp", L"LibreOffice.ImpressDocument.1" },
+{ L".odt", L"LibreOffice.WriterDocument.1" },
+{ L".ods", L"LibreOffice.CalcDocument.1" },
 };
 OUString aNonDefaults;
-bool isNotDefault = false;
 
-for (std::map::iterator it = formats.begin(); it != 
formats.end(); it++)
+for (const auto & [ szExt, szProgId ] : formats)
 {
-if (IsPathDefaultForClass(pAAR, o3tl::toW(it->first.getStr()),
-  o3tl::toW(it->second.getStr()))
-== S_FALSE)
-{
-isNotDefault = true;
-aNonDefaults += it->first;
-aNonDefaults += "\n";
-}
+if (IsPathDefaultForClass(pAAR, szExt, szProgId) == S_FALSE)
+aNonDefaults += OUString::Concat(o3tl::toU(szExt)) + "\n";
 }
 
-if (isNotDefault)
+if (!aNonDefaults.isEmpty())
 {
-OUString aMsg(VclResId(STR_FILEEXT_NONDEFAULT_ASK_MSG));
-aMsg = aMsg.replaceFirst("$1", aNonDefaults);
+OUString 
aMsg(VclResId(STR_FILEEXT_NONDEFAULT_ASK_MSG).replaceFirst("$1", aNonDefaults));
 
 VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
 ScopedVclPtr pDlg(pFact->CreateFileExtCheckDialog(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-03-09 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 24dd6c5f9861340fafccad9504a99a939cbba0a6
Author: Mike Kaganski 
AuthorDate: Tue Mar 9 22:16:48 2021 +0100
Commit: Mike Kaganski 
CommitDate: Wed Mar 10 06:26:00 2021 +0100

Fix comment after renaming variable

Change-Id: I4bf7b2cf76d26060dcb0acfdf9796d339f7dcbc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112220
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 23b20449e0c5..5ec56690b17e 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -206,7 +206,7 @@ void SAL_CALL CWinClipboard::flushClipboard()
 throw lang::DisposedException("object is already disposed",
   static_cast(this));
 
-// actually it should be ClearableMutexGuard aGuard( m_ClipContentMutex );
+// actually it should be ClearableMutexGuard aGuard( m_aContentCacheMutex 
);
 // but it does not work since FlushClipboard does a callback and frees 
DataObject
 // which results in a deadlock in onReleaseDataObject.
 // FlushClipboard had to be synchron in order to prevent shutdown until all
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-03-09 Thread Stephan Bergmann (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 067b22aeff5ff256be393dc2aa14acdf0300427a
Author: Stephan Bergmann 
AuthorDate: Mon Mar 8 17:39:58 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Mar 9 09:30:34 2021 +0100

loplugin:redundantstatic (clang-cl)

Change-Id: Ieb4d3a008d84a16de490413b92b506a59dee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112178
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 2100510b5d34..407325b14280 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -324,7 +324,7 @@ uno::Sequence SAL_CALL 
CWinClipboard::getSupportedServiceNames()
 
 // We run unit tests in parallel, which is a problem when touching a shared 
resource
 // the system clipboard, so rather use the dummy GenericClipboard.
-static const bool bRunningUnitTest = getenv("LO_TESTNAME");
+const bool bRunningUnitTest = getenv("LO_TESTNAME");
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 dtrans_CWinClipboard_get_implementation(css::uno::XComponentContext* context,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-03-08 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/DOTransferable.cxx |   19 ---
 vcl/win/dtrans/DOTransferable.hxx |7 +--
 2 files changed, 1 insertion(+), 25 deletions(-)

New commits:
commit 818a84c4b232518780ff12415a6dad50b3625d5d
Author: Mike Kaganski 
AuthorDate: Sat Mar 6 13:04:24 2021 +0100
Commit: Mike Kaganski 
CommitDate: Mon Mar 8 09:06:22 2021 +0100

[API CHANGE] Remove unused XSystemTransferable interface from 
CDOTransferable

This interface is only implemented on Windows' transferable; it is
not used anywhere in the codebase, and its implementation is wrong:
it passes COM interface pointer as 32-bit integer (thus truncating
64-bit pointers on Win64) to different processes, where the pointer
has no value.

This reverts commit 772fb7b3e482d537482437f5cd898093522d3fb5.

Change-Id: I828c6595ac3f7836a3c72d5498efb279938407ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112072
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/DOTransferable.cxx 
b/vcl/win/dtrans/DOTransferable.cxx
index 029a21402bac..61edcb9a9348 100644
--- a/vcl/win/dtrans/DOTransferable.cxx
+++ b/vcl/win/dtrans/DOTransferable.cxx
@@ -575,23 +575,4 @@ bool CDOTransferable::compareDataFlavors(
 return bRet;
 }
 
-css::uno::Any SAL_CALL CDOTransferable::getData( const Sequence< sal_Int8>& 
aProcessId  )
-{
-Any retVal;
-
-sal_Int8 const * arProcCaller= aProcessId.getConstArray();
-sal_uInt8 arId[16];
-rtl_getGlobalProcessId(arId);
-if( ! memcmp( arId, arProcCaller,16))
-{
-if (m_rDataObject.is())
-{
-IDataObject* pObj= m_rDataObject.get();
-pObj->AddRef();
-retVal.setValue( , cppu::UnoType::get());
-}
-}
-return retVal;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/dtrans/DOTransferable.hxx 
b/vcl/win/dtrans/DOTransferable.hxx
index 0e652f9b6a0d..e42555ce6143 100644
--- a/vcl/win/dtrans/DOTransferable.hxx
+++ b/vcl/win/dtrans/DOTransferable.hxx
@@ -37,8 +37,7 @@
 class CFormatEtc;
 
 class CDOTransferable : public ::cppu::WeakImplHelper<
-css::datatransfer::XTransferable,
-css::datatransfer::XSystemTransferable>
+css::datatransfer::XTransferable>
 {
 public:
 typedef css::uno::Sequence< sal_Int8 > ByteSequence_t;
@@ -51,10 +50,6 @@ public:
 
 virtual sal_Bool SAL_CALL isDataFlavorSupported( const 
css::datatransfer::DataFlavor& aFlavor ) override;
 
-// XSystemTransferable
-
-virtual css::uno::Any SAL_CALL getData( const 
css::uno::Sequence& aProcessId  ) override;
-
 explicit CDOTransferable(
 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
 const css::uno::Reference& 
xClipboard,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-03-05 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/DOTransferable.cxx |2 +-
 vcl/win/dtrans/TxtCnvtHlp.cxx |4 ++--
 vcl/win/dtrans/TxtCnvtHlp.hxx |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit adcddde9a99e77f9209cc5e2186cb9268990e34a
Author: Mike Kaganski 
AuthorDate: Fri Mar 5 14:48:01 2021 +0100
Commit: Mike Kaganski 
CommitDate: Sat Mar 6 08:02:31 2021 +0100

Use int where API expects int

Change-Id: Icda2aeeccb6196191b0b4af4b86f3d094e598cb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111930
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/DOTransferable.cxx 
b/vcl/win/dtrans/DOTransferable.cxx
index 7a911a0fa567..029a21402bac 100644
--- a/vcl/win/dtrans/DOTransferable.cxx
+++ b/vcl/win/dtrans/DOTransferable.cxx
@@ -536,7 +536,7 @@ OUString CDOTransferable::synthesizeUnicodeText( )
 // convert the text
 MultiByteToWideCharEx( cpForTxtCnvt,
reinterpret_cast( aTextSequence.getArray( ) 
),
-   sal::static_int_cast(-1), // Huh ?
+   -1,
stgTransferHelper,
false);
 
diff --git a/vcl/win/dtrans/TxtCnvtHlp.cxx b/vcl/win/dtrans/TxtCnvtHlp.cxx
index a0c09a1badf5..d7ab386fc1fc 100644
--- a/vcl/win/dtrans/TxtCnvtHlp.cxx
+++ b/vcl/win/dtrans/TxtCnvtHlp.cxx
@@ -58,7 +58,7 @@ static int CalcBuffSizeForTextConversion( UINT code_page, 
LPCWSTR lpWideCharStri
 
 int MultiByteToWideCharEx( UINT cp_src,
LPCSTR lpMultiByteString,
-   sal_uInt32 lenStr,
+   int lenStr,
CStgTransferHelper& refDTransHelper,
BOOL bEnsureTrailingZero )
 {
@@ -92,7 +92,7 @@ int MultiByteToWideCharEx( UINT cp_src,
 
 int WideCharToMultiByteEx( UINT cp_dest,
LPCWSTR lpWideCharString,
-   sal_uInt32 lenStr,
+   int lenStr,
CStgTransferHelper& refDTransHelper,
BOOL bEnsureTrailingZero )
 {
diff --git a/vcl/win/dtrans/TxtCnvtHlp.hxx b/vcl/win/dtrans/TxtCnvtHlp.hxx
index 70bd4e32ab67..5294879337d0 100644
--- a/vcl/win/dtrans/TxtCnvtHlp.hxx
+++ b/vcl/win/dtrans/TxtCnvtHlp.hxx
@@ -28,13 +28,13 @@
 
 int MultiByteToWideCharEx( UINT cp_src,
LPCSTR lpMultiByteString,
-   sal_uInt32 lenStr,
+   int lenStr,
CStgTransferHelper& refDTransHelper,
BOOL bEnsureTrailingZero = TRUE );
 
 int WideCharToMultiByteEx( UINT cp_dest,
LPCWSTR lpWideCharString,
-   sal_uInt32 lenStr,
+   int lenStr,
CStgTransferHelper& refDTransHelper,
BOOL bEnsureTrailingZero = TRUE );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-03-05 Thread Mike Kaganski (via logerrit)
 vcl/win/dtrans/DOTransferable.cxx |  110 --
 vcl/win/dtrans/DOTransferable.hxx |   19 --
 vcl/win/dtrans/DataFmtTransl.cxx  |4 -
 vcl/win/dtrans/DataFmtTransl.hxx  |2 
 vcl/win/dtrans/FetcList.cxx   |5 -
 vcl/win/dtrans/WinClipboard.cxx   |   36 +---
 vcl/win/dtrans/WinClipboard.hxx   |6 +-
 vcl/win/dtrans/XTDataObject.cxx   |6 +-
 vcl/win/dtrans/target.cxx |3 -
 9 files changed, 113 insertions(+), 78 deletions(-)

New commits:
commit 7b6c0e63e64eb2ad1e83bd744a0d20f78c7a6b84
Author: Mike Kaganski 
AuthorDate: Fri Mar 5 20:45:08 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sat Mar 6 07:11:57 2021 +0100

tdf#140813: Use GetUpdatedClipboardFormats to enumerate clipboard formats

We really don't have to provide plain text formats other than Unicode, so
we may avoid checking CF_LOCALE data when initializing flavor list. Let's
pretend that any textual format in the clipboard is Unicode, and ensure
that we only actually access system clipboard when we paste.

Change-Id: Ife30f57605a42d59233bfcb97f8bc297b3ace463
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112044
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/dtrans/DOTransferable.cxx 
b/vcl/win/dtrans/DOTransferable.cxx
index 0c61dd77..7a911a0fa567 100644
--- a/vcl/win/dtrans/DOTransferable.cxx
+++ b/vcl/win/dtrans/DOTransferable.cxx
@@ -25,6 +25,7 @@
 #include "DOTransferable.hxx"
 #include "ImplHelper.hxx"
 #include "WinClip.hxx"
+#include "WinClipboard.hxx"
 #include "DTransHelper.hxx"
 #include "TxtCnvtHlp.hxx"
 #include "MimeAttrib.hxx"
@@ -208,19 +209,6 @@ bool cmpAllContentTypeParameter(
 
 } // end namespace
 
-Reference< XTransferable > CDOTransferable::create( const Reference< 
XComponentContext >& rxContext,
-   
  IDataObjectPtr pIDataObject )
-{
-CDOTransferable* pTransf = new CDOTransferable(rxContext, pIDataObject);
-Reference refDOTransf(pTransf);
-
-pTransf->acquire();
-pTransf->initFlavorList();
-pTransf->release();
-
-return refDOTransf;
-}
-
 CDOTransferable::CDOTransferable(
 const Reference< XComponentContext >& rxContext, IDataObjectPtr 
rDataObject ) :
 m_rDataObject( rDataObject ),
@@ -229,6 +217,20 @@ CDOTransferable::CDOTransferable(
 m_bUnicodeRegistered( false ),
 m_TxtFormatOnClipboard( CF_INVALID )
 {
+initFlavorList();
+}
+
+CDOTransferable::CDOTransferable(
+const Reference& rxContext,
+const css::uno::Reference& 
xClipboard,
+const std::vector& rFormats)
+: m_xClipboard(xClipboard)
+, m_xContext(rxContext)
+, m_DataFormatTranslator(rxContext)
+, m_bUnicodeRegistered(false)
+, m_TxtFormatOnClipboard(CF_INVALID)
+{
+initFlavorListFromFormatList(rFormats);
 }
 
 Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor )
@@ -312,6 +314,7 @@ sal_Bool SAL_CALL CDOTransferable::isDataFlavorSupported( 
const DataFlavor& aFla
 
 void CDOTransferable::initFlavorList( )
 {
+std::vector aFormats;
 sal::systools::COMReference pEnumFormatEtc;
 HRESULT hr = m_rDataObject->EnumFormatEtc( DATADIR_GET,  );
 if ( SUCCEEDED( hr ) )
@@ -321,39 +324,38 @@ void CDOTransferable::initFlavorList( )
 FORMATETC fetc;
 while ( S_OK == pEnumFormatEtc->Next( 1, , nullptr ) )
 {
-// we use locales only to determine the
-// charset if there is text on the cliboard
-// we don't offer this format
-if ( CF_LOCALE == fetc.cfFormat )
-continue;
-
-DataFlavor aFlavor = formatEtcToDataFlavor( fetc );
+aFormats.push_back(fetc.cfFormat);
+// see MSDN IEnumFORMATETC
+CoTaskMemFree( fetc.ptd );
+}
+initFlavorListFromFormatList(aFormats);
+}
+}
 
-// if text or oemtext is offered we also pretend to have unicode 
text
-if ( CDataFormatTranslator::isOemOrAnsiTextFormat( fetc.cfFormat ) 
&&
- !m_bUnicodeRegistered )
+void CDOTransferable::initFlavorListFromFormatList(const 
std::vector& rFormats)
+{
+for (sal_uInt32 cfFormat : rFormats)
+{
+// we use locales only to determine the
+// charset if there is text on the cliboard
+// we don't offer this format
+if (CF_LOCALE == cfFormat)
+continue;
+
+// if text or oemtext is offered we pretend to have unicode text
+if (CDataFormatTranslator::isTextFormat(cfFormat))
+{
+if (!m_bUnicodeRegistered)
 {
-addSupportedFlavor( aFlavor );
-
-m_TxtFormatOnClipboard = fetc.cfFormat;
+m_TxtFormatOnClipboard = cfFormat;
 m_bUnicodeRegistered   = true;
 
-// register unicode text as accompany format
-

[Libreoffice-commits] core.git: vcl/win

2021-02-24 Thread Noel Grandin (via logerrit)
 vcl/win/gdi/salbmp.cxx |   33 +++--
 1 file changed, 11 insertions(+), 22 deletions(-)

New commits:
commit e9db00584d30411ae07cfe8aa9660ba3636cc39a
Author: Noel Grandin 
AuthorDate: Wed Feb 24 10:11:38 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Feb 24 19:21:01 2021 +0100

use unique_ptr in WinSalBitmap

Change-Id: I8ca55870094443f7eb670df06de34ad0ed87ad8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111445
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 2418c10a1770..2f427cc5e70d 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -237,14 +237,14 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
 {
 Gdiplus::Bitmap* pRetval(nullptr);
 WinSalBitmap* pSalRGB = this;
-WinSalBitmap* pExtraWinSalRGB = nullptr;
+std::unique_ptr pExtraWinSalRGB;
 
 if(!pSalRGB->ImplGethDIB())
 {
 // we need DIB for success with AcquireBuffer, create a replacement 
WinSalBitmap
-pExtraWinSalRGB = new WinSalBitmap();
+pExtraWinSalRGB.reset(new WinSalBitmap());
 pExtraWinSalRGB->Create(*pSalRGB, pSalRGB->GetBitCount());
-pSalRGB = pExtraWinSalRGB;
+pSalRGB = pExtraWinSalRGB.get();
 }
 
 BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
@@ -313,11 +313,6 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
 pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
 }
 
-if(pExtraWinSalRGB)
-{
-delete pExtraWinSalRGB;
-}
-
 return pRetval;
 }
 
@@ -325,14 +320,14 @@ Gdiplus::Bitmap* 
WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
 {
 Gdiplus::Bitmap* pRetval(nullptr);
 WinSalBitmap* pSalRGB = this;
-WinSalBitmap* pExtraWinSalRGB = nullptr;
+std::unique_ptr pExtraWinSalRGB;
 
 if(!pSalRGB->ImplGethDIB())
 {
 // we need DIB for success with AcquireBuffer, create a replacement 
WinSalBitmap
-pExtraWinSalRGB = new WinSalBitmap();
+pExtraWinSalRGB.reset(new WinSalBitmap());
 pExtraWinSalRGB->Create(*pSalRGB, pSalRGB->GetBitCount());
-pSalRGB = pExtraWinSalRGB;
+pSalRGB = pExtraWinSalRGB.get();
 }
 
 BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
@@ -352,14 +347,14 @@ Gdiplus::Bitmap* 
WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
 }
 
 WinSalBitmap* pSalA = const_cast< WinSalBitmap* >();
-WinSalBitmap* pExtraWinSalA = nullptr;
+std::unique_ptr pExtraWinSalA;
 
 if(!pSalA->ImplGethDIB())
 {
 // we need DIB for success with AcquireBuffer, create a replacement 
WinSalBitmap
-pExtraWinSalA = new WinSalBitmap();
+pExtraWinSalA.reset(new WinSalBitmap());
 pExtraWinSalA->Create(*pSalA, pSalA->GetBitCount());
-pSalA = pExtraWinSalA;
+pSalA = pExtraWinSalA.get();
 }
 
 BitmapBuffer* pA = pSalA->AcquireBuffer(BitmapAccessMode::Read);
@@ -447,10 +442,7 @@ Gdiplus::Bitmap* 
WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
 pSalA->ReleaseBuffer(pA, BitmapAccessMode::Read);
 }
 
-if(pExtraWinSalA)
-{
-delete pExtraWinSalA;
-}
+pExtraWinSalA.reset();
 
 if(pExtraRGB)
 {
@@ -464,10 +456,7 @@ Gdiplus::Bitmap* 
WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
 pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
 }
 
-if(pExtraWinSalRGB)
-{
-delete pExtraWinSalRGB;
-}
+pExtraWinSalRGB.reset();
 
 return pRetval;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-02-11 Thread Luboš Luňák (via logerrit)
 vcl/win/app/salinst.cxx |  185 
 1 file changed, 18 insertions(+), 167 deletions(-)

New commits:
commit 843af72bcc9047867588e29c8e10b84a5e58d70e
Author: Luboš Luňák 
AuthorDate: Wed Feb 10 16:37:17 2021 +
Commit: Luboš Luňák 
CommitDate: Thu Feb 11 11:07:11 2021 +0100

make win32 variant AnyInput() not deliver events (tdf#140293)

Win32 API PeekMessage() actually may deliver events, despite
what the name may suggest, even with PM_NOREMOVE argument.
That means this is problematic for use in AnyInput(), as that
function should just check the event queue but not do anything
with it. Using GetQueueStatus() should solve the problem.

See 
https://lists.freedesktop.org/archives/libreoffice/2021-February/086788.html
for further details.

Change-Id: I10d3423f89f6f050534625110113dee60959f7a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110718
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Luboš Luňák 
Tested-by: Jenkins

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index ea4c9420beb0..18605f2f17d4 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -665,116 +665,8 @@ LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, 
WPARAM wParam, LPARAM lPa
 return nRet;
 }
 
-namespace {
-
-struct MsgRange
-{
-UINT nStart;
-UINT nEnd;
-};
-
-}
-
-static std::vector GetOtherRanges( VclInputFlags nType )
-{
-assert( nType != VCL_INPUT_ANY );
-
-// this array must be kept sorted!
-const UINT nExcludeMsgIds[] =
-{
-0,
-
-WM_MOVE, // 3
-WM_SIZE, // 5
-WM_PAINT, // 15
-WM_KEYDOWN, // 256
-WM_TIMER, // 275
-
-WM_MOUSEFIRST, // 512
-513,
-514,
-515,
-516,
-517,
-518,
-519,
-520,
-WM_MOUSELAST, // 521
-
-SAL_MSG_POSTMOVE, // WM_USER+136
-SAL_MSG_POSTCALLSIZE, // WM_USER+137
-
-SAL_MSG_TIMER_CALLBACK, // WM_USER+162
-
-UINT_MAX
-};
-const unsigned MAX_EXCL = SAL_N_ELEMENTS( nExcludeMsgIds );
-
-bool aExcludeMsgList[ MAX_EXCL ] = { false, };
-std::vector aResult;
-
-// set the excluded values
-if ( !(nType & VclInputFlags::MOUSE) )
-{
-for ( unsigned i = 0; nExcludeMsgIds[ 6 + i ] <= WM_MOUSELAST; ++i )
-aExcludeMsgList[ 6 + i ] = true;
-}
-
-if ( !(nType & VclInputFlags::KEYBOARD) )
-aExcludeMsgList[ 4 ] = true;
-
-if ( !(nType & VclInputFlags::PAINT) )
-{
-aExcludeMsgList[ 1 ] = true;
-aExcludeMsgList[ 2 ] = true;
-aExcludeMsgList[ 3 ] = true;
-aExcludeMsgList[ 16 ] = true;
-aExcludeMsgList[ 17 ] = true;
-}
-
-if ( !(nType & VclInputFlags::TIMER) )
-{
-aExcludeMsgList[ 5 ]  = true;
-aExcludeMsgList[ 18 ]  = true;
-}
-
-// build the message ranges to check
-MsgRange aRange = { 0, 0 };
-bool doEnd = true;
-for ( unsigned i = 1; i < MAX_EXCL; ++i )
-{
-if ( aExcludeMsgList[ i ] )
-{
-if ( !doEnd )
-{
-if ( nExcludeMsgIds[ i ] == aRange.nStart )
-++aRange.nStart;
-else
-doEnd = true;
-}
-if ( doEnd )
-{
-aRange.nEnd = nExcludeMsgIds[ i ] - 1;
-aResult.push_back( aRange );
-doEnd = false;
-aRange.nStart = aRange.nEnd + 2;
-}
-}
-}
-
-if ( aRange.nStart != UINT_MAX )
-{
-aRange.nEnd = UINT_MAX;
-aResult.push_back( aRange );
-}
-
-return aResult;
-}
-
 bool WinSalInstance::AnyInput( VclInputFlags nType )
 {
-MSG aMsg;
-
 if ( nType & VclInputFlags::TIMER )
 {
 const WinSalTimer* pTimer = static_cast( 
ImplGetSVData()->maSchedCtx.mpSalTimer );
@@ -782,81 +674,40 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
 return true;
 }
 
+// Note: Do not use PeekMessage(), despite the name it may dispatch events,
+// even with PM_NOREMOVE specified, which may lead to unwanted recursion.
+
 if ( (nType & VCL_INPUT_ANY) == VCL_INPUT_ANY )
 {
 // revert bugfix for #108919# which never reported timeouts when 
called from the timer handler
 // which made the application completely unresponsive during 
background formatting
-if ( PeekMessageW( , nullptr, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+if ( GetQueueStatus( QS_ALLEVENTS ))
 return true;
 }
 else
 {
-const bool bCheck_KEYBOARD (nType & VclInputFlags::KEYBOARD);
-const bool bCheck_OTHER(nType & VclInputFlags::OTHER);
-
-// If there is a modifier key event, it counts as OTHER
-// Previously we were simply ignoring these events...
-if ( bCheck_KEYBOARD || bCheck_OTHER )
-

[Libreoffice-commits] core.git: vcl/win

2021-02-04 Thread Noel Grandin (via logerrit)
 vcl/win/app/salinst.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 14eff34dd10c047de222813eb16198b295b31d54
Author: Noel Grandin 
AuthorDate: Thu Feb 4 08:44:45 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 4 09:22:18 2021 +0100

fix sporadic crash in sd_misc_tests on windows

we end up trying to process a timer message, but from inside
the vcl de-init function, which means the timer stuff has already
been de-initialised.

Change-Id: I94703219754f1ccabd3065fc5ea437f39264197b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110397
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 828bd8fec248..ea4c9420beb0 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -557,6 +557,12 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM 
wParam, LPARAM lParam, b
 SAL_INFO("vcl.gdi.wndproc", "SalComWndProc(nMsg=" << nMsg << ", wParam=" 
<< wParam
 << ", lParam=" << lParam << "); inSendMsg: " 
<< bIsOtherThreadMessage);
 
+if (ImplGetSVData()->mbDeInit)
+{
+SAL_WARN("vcl.gdi.wndproc", "ignoring timer event because we are 
shutting down");
+return 0;
+}
+
 switch ( nMsg )
 {
 case SAL_MSG_THREADYIELD:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-01-29 Thread Andrea Gelmini (via logerrit)
 vcl/win/app/salinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c6ff20f1c101372be46a2583ec0c83ff021690a9
Author: Andrea Gelmini 
AuthorDate: Fri Jan 29 19:53:31 2021 +0100
Commit: Julien Nabet 
CommitDate: Fri Jan 29 22:09:38 2021 +0100

Fix typo

Change-Id: Ie9dab2d4813b986bf7eb4e2f7dee37171e9be9fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110162
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 08519b0f8f8d..828bd8fec248 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -477,8 +477,8 @@ bool ImplSalYield(const bool bWait, const bool 
bHandleAllCurrentEvents)
 }
 }
 
-// If we enabled ForceRealTimer mode skipping our direct timout processing,
-// mainly because some Windows API call spawns it's own nested message 
loop,
+// If we enabled ForceRealTimer mode skipping our direct timeout 
processing,
+// mainly because some Windows API call spawns its own nested message loop,
 // switch back to our own processing (like after window resize or move)
 if ( pTimer )
 pTimer->SetForceRealTimer( false );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2021-01-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/app/salinst.cxx |   79 +---
 1 file changed, 42 insertions(+), 37 deletions(-)

New commits:
commit dbac52a2b56337c2086a18bf6cf3ebe6ac0c785e
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jan 28 06:11:33 2021 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jan 28 15:20:55 2021 +0100

WIN refactor ImplSalYield

While looking for some reason for multiple ABORTED Jenkins runs,
presumely due to unprocessed Idles, I found the ImplSalYield code
way too hard to follow, so this restructures the PeekMessage loop
and adds some better comments to make that easier.

We now bail out a bit earlier in m_nNoYieldLock mode and also
account for eventual tick wraps in single message mode, which
isn't needed, as we already just process one message, but it
removes additional conditions and further simplifies the code.
We also now explicitly report GetMessageW non-message return
codes.

Change-Id: Ibd745d5540dd9998570ece9aeb0d37886b627eb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110042
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 00069d82499b..08519b0f8f8d 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -408,45 +409,39 @@ static LRESULT ImplSalDispatchMessage( const MSG* pMsg )
 return lResult;
 }
 
-bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
+// probably can't be static, because of SalTimer friend? (static gives C4211)
+bool ImplSalYield(const bool bWait, const bool bHandleAllCurrentEvents)
 {
+// used to abort further message processing on tick count wraps
 static sal_uInt32 nLastTicks = 0;
-MSG aMsg;
-bool bWasMsg = false, bOneEvent = false, bWasTimeoutMsg = false;
-ImplSVData *const pSVData = ImplGetSVData();
-WinSalTimer* pTimer = static_cast( 
pSVData->maSchedCtx.mpSalTimer );
-const bool bNoYieldLock = (GetSalData()->mpInstance->m_nNoYieldLock > 0);
 
-assert( !bNoYieldLock );
-if ( bNoYieldLock )
+// we should never yield in m_nNoYieldLock mode!
+const bool bNoYieldLock = (GetSalData()->mpInstance->m_nNoYieldLock > 0);
+assert(!bNoYieldLock);
+if (bNoYieldLock)
 return false;
 
-sal_uInt32 nCurTicks = 0;
-if ( bHandleAllCurrentEvents )
-nCurTicks = GetTickCount();
+MSG aMsg;
+bool bWasMsg = false, bWasTimeoutMsg = false;
+WinSalTimer* pTimer = 
static_cast(ImplGetSVData()->maSchedCtx.mpSalTimer);
+
+sal_uInt32 nCurTicks = GetTickCount();
 
-bool bHadNewerEvent = false;
 do
 {
-bOneEvent = PeekMessageW( , nullptr, 0, 0, PM_REMOVE );
-if ( bOneEvent )
-{
-bWasMsg = true;
-TranslateMessage(  );
-LRESULT nRet = ImplSalDispatchMessage(  );
-
-if ( !bWasTimeoutMsg )
-bWasTimeoutMsg = (SAL_MSG_TIMER_CALLBACK == aMsg.message)
-&& static_cast( nRet );
-
-if ( bHandleAllCurrentEvents
-&& !bHadNewerEvent && aMsg.time > nCurTicks
-&& (nLastTicks <= nCurTicks || aMsg.time < nLastTicks) )
-bHadNewerEvent = true;
-bOneEvent = !bHadNewerEvent;
-}
+if (!PeekMessageW(, nullptr, 0, 0, PM_REMOVE))
+break;
 
-if ( !(bHandleAllCurrentEvents && bOneEvent) )
+bWasMsg = true;
+TranslateMessage();
+LRESULT nRet = ImplSalDispatchMessage();
+
+bWasTimeoutMsg |= (SAL_MSG_TIMER_CALLBACK == aMsg.message) && 
static_cast(nRet);
+
+if (!bHandleAllCurrentEvents)
+break;
+
+if ((aMsg.time > nCurTicks) && (nLastTicks <= nCurTicks || aMsg.time < 
nLastTicks))
 break;
 }
 while( true );
@@ -461,20 +456,30 @@ bool ImplSalYield( bool bWait, bool 
bHandleAllCurrentEvents )
 bWasMsg = true;
 }
 
-if ( bHandleAllCurrentEvents )
-nLastTicks = nCurTicks;
+nLastTicks = nCurTicks;
 
 if ( bWait && !bWasMsg )
 {
-if ( GetMessageW( , nullptr, 0, 0 ) )
+switch (GetMessageW(, nullptr, 0, 0))
 {
-bWasMsg = true;
-TranslateMessage(  );
-ImplSalDispatchMessage(  );
+case -1:
+SAL_WARN("vcl.schedule", "GetMessageW failed: " << 
WindowsErrorString(GetLastError()));
+// should we std::abort() / SalAbort here?
+break;
+case 0:
+SAL_INFO("vcl.schedule", "GetMessageW received WM_QUIT while 
waiting");
+break;
+default:
+bWasMsg = true;
+TranslateMessage();
+ImplSalDispatchMessage();
+break;
 }
 }
 
-// we're back in the main loop after resize 

[Libreoffice-commits] core.git: vcl/win

2020-12-16 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit f5ab8bcbfd20ecce4a358f62ee3f81b8b968a5de
Author: Jan-Marek Glogowski 
AuthorDate: Mon Dec 14 10:47:04 2020 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Wed Dec 16 18:02:15 2020 +0100

WIN don't notify clipboard change with SolarMutex

Regression from commit 52a7eb58f5c137b6de76cc49be07dd43c42a6d6c
("WIN replace clipboard update thread with Idle"). Previously the
notification was done without the SolarMutex. Now it's run via
an Idle and SolarMutex is required by the Scheduler, so release
it. Foreign contents is again protected by the clipboard lock.

And also unlock the SolarMutex in getContents, to prevent a
deadlock in the clipboard STA thread, if it's already processing
other request, like CXNotifyingDataObject::GetData, blocking on
the SolarMutex.

Change-Id: I6855b045b3065289ec7833498f6785ee31eda61c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107675
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 121b945ff4e9..4135b5cef93c 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -27,6 +27,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include "XNotifyingDataObject.hxx"
@@ -90,6 +92,9 @@ CWinClipboard::~CWinClipboard()
 
 uno::Reference SAL_CALL 
CWinClipboard::getContents()
 {
+DBG_TESTSOLARMUTEX();
+SolarMutexReleaser aReleaser;
+
 osl::MutexGuard aGuard(m_aMutex);
 
 if (rBHelper.bDisposed)
@@ -243,7 +248,8 @@ void SAL_CALL CWinClipboard::removeClipboardListener(
 
 IMPL_LINK_NOARG(CWinClipboard, ClipboardContentChangedHdl, Timer*, void)
 {
-m_foreignContent.clear();
+DBG_TESTSOLARMUTEX();
+SolarMutexReleaser aReleaser;
 
 if (rBHelper.bDisposed)
 return;
@@ -261,7 +267,11 @@ IMPL_LINK_NOARG(CWinClipboard, ClipboardContentChangedHdl, 
Timer*, void)
 try
 {
 cppu::OInterfaceIteratorHelper iter(*pICHelper);
-uno::Reference rXTransf(getContents());
+uno::Reference rXTransf;
+{
+SolarMutexGuard aGuard;
+rXTransf.set(getContents());
+}
 datatransfer::clipboard::ClipboardEvent 
aClipbEvent(static_cast(this),
 rXTransf);
 
@@ -342,6 +352,8 @@ void WINAPI CWinClipboard::onWM_CLIPBOARDUPDATE()
 if (!s_pCWinClipbImpl)
 return;
 
+s_pCWinClipbImpl->m_foreignContent.clear();
+
 if (!s_pCWinClipbImpl->m_aNotifyClipboardChangeIdle.IsActive())
 s_pCWinClipbImpl->m_aNotifyClipboardChangeIdle.Start();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-12-14 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/saltimer.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 14372e301f0198067e4965ac1a234d9f9d21e3b2
Author: Stephan Bergmann 
AuthorDate: Mon Dec 14 22:32:28 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 14 23:19:32 2020 +0100

Silence warning C4189: local variable is initialized but not referenced

Change-Id: Ie36d7c4dfee5115b5909ed58a0b16b367e05866d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107734
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 571988df4d23..1ccab54e96c8 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -62,8 +62,10 @@ void WinSalTimer::ImplStop()
 
 void WinSalTimer::ImplStart( sal_uInt64 nMS )
 {
+#if !defined NDEBUG
 SalData* pSalData = GetSalData();
 assert( !pSalData->mpInstance || pSalData->mnAppThreadId == 
GetCurrentThreadId() );
+#endif
 
 // DueTime parameter is a DWORD, which is always an unsigned 32bit
 if (nMS > SAL_MAX_UINT32)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-12-14 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/saltimer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c8f61430b5760c7baabebff9c3159092975d4a88
Author: Stephan Bergmann 
AuthorDate: Mon Dec 14 22:30:13 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 14 23:08:42 2020 +0100

Reuse pInst

Change-Id: I91e5a469344ab951225e61237b462ed58ed796be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107733
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 5a4760ad5e11..571988df4d23 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -45,7 +45,7 @@ void WinSalTimer::ImplStop()
 if ( m_bSetTimerRunning )
 {
 m_bSetTimerRunning = false;
-KillTimer( GetSalData()->mpInstance->mhComWnd, m_aWmTimerId );
+KillTimer( pInst->mhComWnd, m_aWmTimerId );
 }
 m_bDirectTimeout = false;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-12-14 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 4376820074abc4d70765675ef5a4adae8f58effe
Author: Stephan Bergmann 
AuthorDate: Mon Dec 14 10:33:13 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 14 11:09:13 2020 +0100

Silence MSVC warning C4189 "local variable is initialized but not 
referenced"

Change-Id: I346cf6cf148cd3b4ac851f8c441d54c858f55935
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107674
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index b8859e8996c2..8bdc810bffa2 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -155,6 +155,7 @@ void SalYieldMutex::doAcquire( sal_uInt32 nLockCount )
 // wait for SalYieldMutex::release() to set the condition
 osl::Condition::Result res = m_condition.wait();
 assert(osl::Condition::Result::result_ok == res);
+(void) res;
 }
 while ( true );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-12-13 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/dtrans/MtaOleClipb.cxx  |  137 
 vcl/win/dtrans/MtaOleClipb.hxx  |   26 ---
 vcl/win/dtrans/WinClipboard.cxx |   24 ---
 vcl/win/dtrans/WinClipboard.hxx |5 +
 4 files changed, 36 insertions(+), 156 deletions(-)

New commits:
commit 9617bc9544cd569066ff187c3672a87fe28fe17f
Author: Jan-Marek Glogowski 
AuthorDate: Tue Sep 22 10:40:23 2020 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sun Dec 13 12:18:47 2020 +0100

WIN replace clipboard update thread with Idle

Little "fallout" patch when moving code from /dtrans/** to
/vcl/win/dtrans and merging CWinClipbImpl into CWinClipboard
while I tried to reproduce tdf#62196...

And since we now process the notification in the main thread, we
can get rid of m_pfncClipViewerCallbackMutex, which brings us down
from 6 (!) to 4 mutexes (if Mike counted correct) in the Windows
clipboard code... ok, technically the scheduler / Idle adds its
mutex to this count, but that is not related to the clipboard
handling on Windows ;-)

This also moves the UnregisterClassW into the OLE thread, which
already calls RegisterClassW, to be more consistent.

This now also gets merged, because it seem to fix a deadlocks when
running CppunitTest_sc_macros_test in a loop, which is unclear
where it comes from and I can't reproduce. Tinderboxes and Gerrit
also still seem fine.

Change-Id: Iacbda0bdf6c98f27f6e59964d541524cb45ade24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107168
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx
index d894ae7b5a48..7b8b2b637385 100644
--- a/vcl/win/dtrans/MtaOleClipb.cxx
+++ b/vcl/win/dtrans/MtaOleClipb.cxx
@@ -45,12 +45,7 @@
 
 #include 
 
-//  namespace directives
-
-using osl::MutexGuard;
-using osl::ClearableMutexGuard;
-
-namespace /* private */
+namespace
 {
 const wchar_t g_szWndClsName[] = L"MtaOleReqWnd###";
 
@@ -231,12 +226,7 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
 m_hwndMtaOleReqWnd( nullptr ),
 // signals that the window is destroyed - to stop waiting any winproc 
result
 m_hEvtWndDisposed(CreateEventW(nullptr, MANUAL_RESET, INIT_NONSIGNALED, 
nullptr)),
-m_MtaOleReqWndClassAtom( 0 ),
-m_pfncClipViewerCallback( nullptr ),
-m_bRunClipboardNotifierThread( true ),
-m_hClipboardChangedEvent( m_hClipboardChangedNotifierEvents[0] ),
-m_hTerminateClipboardChangedNotifierEvent( 
m_hClipboardChangedNotifierEvents[1] ),
-m_ClipboardChangedEventCount( 0 )
+m_pfncClipViewerCallback(nullptr)
 {
 OSL_ASSERT( nullptr != m_hEvtThrdReady );
 SAL_WARN_IF(!m_hEvtWndDisposed, "dtrans", "CreateEventW failed: 
m_hEvtWndDisposed is nullptr");
@@ -246,20 +236,6 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
 m_hOleThread = reinterpret_cast(_beginthreadex(
 nullptr, 0, CMtaOleClipboard::oleThreadProc, this, 0, _uOleThreadId 
));
 OSL_ASSERT( nullptr != m_hOleThread );
-
-// setup the clipboard changed notifier thread
-
-m_hClipboardChangedNotifierEvents[0] = CreateEventW( nullptr, 
MANUAL_RESET, INIT_NONSIGNALED, nullptr );
-OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[0] );
-
-m_hClipboardChangedNotifierEvents[1] = CreateEventW( nullptr, 
MANUAL_RESET, INIT_NONSIGNALED, nullptr );
-OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[1] );
-
-unsigned uThreadId;
-m_hClipboardChangedNotifierThread = 
reinterpret_cast(_beginthreadex(
-nullptr, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, 
this, 0,  ));
-
-OSL_ASSERT( nullptr != m_hClipboardChangedNotifierThread );
 }
 
 // dtor
@@ -270,35 +246,13 @@ CMtaOleClipboard::~CMtaOleClipboard( )
 if ( nullptr != m_hEvtThrdReady )
 ResetEvent( m_hEvtThrdReady );
 
-// terminate the clipboard changed notifier thread
-m_bRunClipboardNotifierThread = false;
-SetEvent( m_hTerminateClipboardChangedNotifierEvent );
-
-// unblock whoever could still wait for event processing
-if (m_hEvtWndDisposed)
-SetEvent(m_hEvtWndDisposed);
-
-sal_uInt32 dwResult = WaitForSingleObject(
-m_hClipboardChangedNotifierThread, MAX_WAIT_SHUTDOWN );
-
-OSL_ENSURE( dwResult == WAIT_OBJECT_0, "clipboard notifier thread could 
not terminate" );
-
-if ( nullptr != m_hClipboardChangedNotifierThread )
-CloseHandle( m_hClipboardChangedNotifierThread );
-
-if ( nullptr != m_hClipboardChangedNotifierEvents[0] )
-CloseHandle( m_hClipboardChangedNotifierEvents[0] );
-
-if ( nullptr != m_hClipboardChangedNotifierEvents[1] )
-CloseHandle( m_hClipboardChangedNotifierEvents[1] );
-
 // end the thread
 // because DestroyWindow can only be called
 // from within the thread that created the window
 sendMessage( MSG_SHUTDOWN );
 
 // wait for thread shutdown
-dwResult = 

[Libreoffice-commits] core.git: vcl/win

2020-12-07 Thread Andrea Gelmini (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4841ea2e3f8aa62ce89efb9aef94662cf3f3fa1f
Author: Andrea Gelmini 
AuthorDate: Sun Dec 6 15:49:31 2020 +0100
Commit: Julien Nabet 
CommitDate: Mon Dec 7 19:42:17 2020 +0100

Fix typo

Change-Id: I4d2955576925ef6d44b32447d953dc75bf41cf37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107293
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b3b70320dd05..4d0638035190 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2344,8 +2344,8 @@ bool WinSalGraphicsImpl::drawPolyLine(
 const double fFactor(fLineWidth == 0 ? 1.0 : 1.0 / fLineWidth);
 
 // tdf#134128. ODF adds caps to the dashes and dots, but GDI makes 
caps from the
-// dash or dot themselve. We tweak aDashArray to look the same in GDI 
(e.g. Impress edit mode)
-// and other renderes (e.g. Impress slide show), while keeping the 
total length of the
+// dash or dot themselves. We tweak aDashArray to look the same in GDI 
(e.g. Impress edit mode)
+// and other renders (e.g. Impress slide show), while keeping the 
total length of the
 // pattern.
 // Patterns are always a sequence dash space dash space ...
 if (eLineCap != css::drawing::LineCap_BUTT)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-12-03 Thread Regina Henschel (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |   35 +++
 1 file changed, 31 insertions(+), 4 deletions(-)

New commits:
commit 24d770799660d3ec94ee7add435645794426042b
Author: Regina Henschel 
AuthorDate: Thu Dec 3 23:53:43 2020 +0100
Commit: Noel Grandin 
CommitDate: Fri Dec 4 07:23:10 2020 +0100

tdf#134128 Use Gdiplus::DashCapRound for round dash or dot.

If Skia and OpenGL are disabled, rendering in edit mode shows no round
dashes and dots on Windows. This becomes especially visible, when
importing OOXML documents. In that case it looks as if dots are lost.
The patch uses now Gdiplus::DashCapRound instead of the previously
used Gdiplus::DashCapFlat, and it adds a similar tweak as in OOXML
import and increases the dash length by the cap size for rendering.

Change-Id: I98a258809ef253a2cacb7c5c94f2b26b89ee2488
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107181
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index de022280c4b2..b3b70320dd05 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2343,12 +2343,39 @@ bool WinSalGraphicsImpl::drawPolyLine(
 std::vector aDashArray(pStroke->size());
 const double fFactor(fLineWidth == 0 ? 1.0 : 1.0 / fLineWidth);
 
-for(size_t a(0); a < pStroke->size(); a++)
+// tdf#134128. ODF adds caps to the dashes and dots, but GDI makes 
caps from the
+// dash or dot themselve. We tweak aDashArray to look the same in GDI 
(e.g. Impress edit mode)
+// and other renderes (e.g. Impress slide show), while keeping the 
total length of the
+// pattern.
+// Patterns are always a sequence dash space dash space ...
+if (eLineCap != css::drawing::LineCap_BUTT)
 {
-aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+size_t nSize = pStroke->size();
+// We want to treat dash and space in pairs. There should be no 
odd size. If so, we ignore
+// last item.
+nSize /= 2;
+for(size_t a(0); a < nSize; a++)
+{
+double fDashLengthRel = (*pStroke)[2 * a] * fFactor;
+double fSpaceLengthRel = (*pStroke)[2 * a + 1] * fFactor;
+// GDI allows only positive lengths for space, Skia negative 
lengths too. Thus the
+// appearance is different, in case space is too small.
+double fCorrect = fSpaceLengthRel - 1.0 <= 0 ? fSpaceLengthRel 
- 0.01 : 1.0;
+aDashArray[2 * a] = Gdiplus::REAL(fDashLengthRel + fCorrect);
+aDashArray[2 * a + 1] = Gdiplus::REAL(fSpaceLengthRel - 
fCorrect);
+}
 }
-
-aPen.SetDashCap(Gdiplus::DashCapFlat);
+else
+{
+for(size_t a(0); a < pStroke->size(); a++)
+{
+aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+}
+}
+if (eLineCap == css::drawing::LineCap_ROUND)
+aPen.SetDashCap(Gdiplus::DashCapRound);
+else
+aPen.SetDashCap(Gdiplus::DashCapFlat); // "square" doesn't exist 
in Gdiplus
 aPen.SetDashOffset(Gdiplus::REAL(0.0));
 aPen.SetDashPattern(aDashArray.data(), aDashArray.size());
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-11-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/DWriteTextRenderer.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 092ec538045f443dce3e45ff73064eb46d0a4fc0
Author: Stephan Bergmann 
AuthorDate: Fri Nov 27 11:10:56 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 27 14:26:58 2020 +0100

DWRITE_GLYPH_METRICS members are of INT32 and UINT32 types

Change-Id: Ie09e0150bf73efd552e3a3b455ffc395d6b6370c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106754
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 185925ae7967..abf9be7d5f86 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -349,10 +349,10 @@ std::vector 
D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t
 auto pOut = aOut.begin();
 for (auto  : metrics)
 {
-const long left  = m.leftSideBearing,
-   top   = m.topSideBearing - m.verticalOriginY,
-   right = m.advanceWidth - m.rightSideBearing,
-   bottom = INT32(m.advanceHeight) - m.verticalOriginY - 
m.bottomSideBearing;
+const auto left  = m.leftSideBearing;
+const auto top   = m.topSideBearing - m.verticalOriginY;
+const auto right = m.advanceWidth - m.rightSideBearing;
+const auto bottom = INT32(m.advanceHeight) - m.verticalOriginY - 
m.bottomSideBearing;
 
 // Scale to screen space.
 pOut->SetLeft( std::floor(left * mlfEmHeight / 
aFontMetrics.designUnitsPerEm) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-11-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4ca0a15af2a1bd9386f5a0d93e9616cf1d818535
Author: Stephan Bergmann 
AuthorDate: Fri Nov 27 11:07:53 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 27 14:26:31 2020 +0100

RECT members are of type LONG

Change-Id: I8c0ad0878903c729be7149f81f5844a4baea7883
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106753
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 793b061e0e5c..9b50c7405d52 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -437,10 +437,10 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 {
 if ( rc.top == 0 && bHorizontal )
 {
-const long GRADIENT_HEIGHT = 32;
+const int GRADIENT_HEIGHT = 32;
 
-long gradient_break = rc.top;
-long gradient_bottom = rc.bottom - 1;
+LONG gradient_break = rc.top;
+LONG gradient_bottom = rc.bottom - 1;
 GRADIENT_RECT g_rect[1] = { { 0, 1 } };
 
 // very slow gradient at the top (if we have space for that)
@@ -478,7 +478,7 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 // when done for the vertical ones too
 if ( bHorizontal )
 {
-long from_x, from_y, to_x, to_y;
+LONG from_x, from_y, to_x, to_y;
 
 from_x = rc.left;
 to_x = rc.right;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2020-11-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 25aad15042f45682211ab318dc0e2c004d61c72c
Author: Stephan Bergmann 
AuthorDate: Fri Nov 27 11:05:57 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 27 14:03:35 2020 +0100

LOGFONTW::lfHeight is of type LONG

Change-Id: Iec7e8e84b8a6ee9e4ddbbbf5708bf9040418bbb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106752
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 95b95861586f..793b061e0e5c 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1425,7 +1425,7 @@ bool WinSalGraphics::getNativeControlRegion(  ControlType 
nType,
 aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
 if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( 
aNonClientMetrics ), , 0 ) )
 {
-long nFontHeight = aNonClientMetrics.lfMessageFont.lfHeight;
+LONG nFontHeight = aNonClientMetrics.lfMessageFont.lfHeight;
 if( nFontHeight < 0 )
 nFontHeight = -nFontHeight;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   4   >