summaryrefslogtreecommitdiff
path: root/vcl/win
AgeCommit message (Collapse)Author
2017-09-21Workaround static Task destruction errorJan-Marek Glogowski
A task has to get the SchedulerLock to remove itself from the Scheduler list. This doesn't work, if the Task is static, as the static Scheduler might be destroyed earlier. In this case we fail with the following backtrace: #0 SchedulerMutex::acquire #1 Task::~Task #2 __run_exit_handlers Thanks to Michael Stahl to catching this backtrace. As a workaround this marks static tasks, so they ignore the SchedulerMutex in the destructor, We also mark all scheduled Tasks as "static" in DeInitScheduler, as their cleanup was already done. In the end all Tasks should be removed from static objects. Change-Id: I38be3206378b9449193efaccbc96896ac8de9478 Reviewed-on: https://gerrit.libreoffice.org/42574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2017-09-19Inconsistent declarations of ImplSalYieldMutexAcquireWithWaitStephan Bergmann
...introduced with 3840aede596e6fc24f7ed7df9100fb028134aac6 "Unify SolarMutex implementations" (causing link failure and clang-cl loplugin:unreffun with 64 bit Windows builds) Change-Id: I273d15e74ad88648ebbccb33f1348497779cc488
2017-09-19Unify SolarMutex implementationsJan-Marek Glogowski
All backends implement the SolarMutex in mostly the same way. So this consolidates this code into a GenericSolarMutex. We still need the abstract SolarMutex class for the fake AKA fascade implementation in dbaccess. The patch also replaces various places of direct mutex usage with either SolarMutexGuard or SolarMutexReleaser objects. Change-Id: Ia0146dd6c51a3b9a513cc6af34a66def58aad831 Reviewed-on: https://gerrit.libreoffice.org/42325 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2017-09-18Acknowledge that WinSalGraphicsImpl::drawPolyLine modifies pPtAryStephan Bergmann
Change-Id: Idde44857f8ace883cc759321c71e2ca7a4359334 Reviewed-on: https://gerrit.libreoffice.org/42406 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-18Use even more WIN32_LEAN_AND_MEANMike Kaganski
Change-Id: I538fe5b41156366e0e87b3a93e58a3947afd18f5 Reviewed-on: https://gerrit.libreoffice.org/42398 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-16Use more WIN32_LEAN_AND_MEANMike Kaganski
https://msdn.microsoft.com/en-us/aa383745 Change-Id: I83528dc8e6a5e119e7aa816219d35f1ea3723b96 Reviewed-on: https://gerrit.libreoffice.org/42338 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-13Change assertion failure to SAL_WARNTor Lillqvist
I hit it multiple times and have no interest in figuring out why. Or time. Change-Id: I3f22c8b62fdcf987b760ac16bfe8a21a8870d33e Reviewed-on: https://gerrit.libreoffice.org/42212 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2017-09-11Translate German comments/debug strings (leftovers in dirs vbahelper and vcl)Johnny_M
Translates leftovers found using a custom regex. Additionally: - Translated the "SGV Fonts for StarView" INI file parameter group in vcl/source/filter/sgf.ini and .../sgvtext.cxx Change-Id: I1360aac1a2f3fa825f86d77ac1b05e2de9ffb007 Reviewed-on: https://gerrit.libreoffice.org/42145 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-09-05Resolves: tdf#112180: avoid crash with specific ttfCaolán McNamara
Change-Id: I8cde147279173bffec0c991eb7676f5d4641138d Reviewed-on: https://gerrit.libreoffice.org/41935 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-03tdf#112180: avoid crash with specific ttfJulien Nabet
by synchronizing announced size of data (mnByteCount) with the real size of data (mpRawBytes) Change-Id: I973bec9deb1150b630d1df32c89b33c253e4b3d2 Reviewed-on: https://gerrit.libreoffice.org/41860 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-08-31loplugin:constparams: vcl (clang-cl)Stephan Bergmann
Change-Id: Iabcbb6e09616a28c0d8927d11af3da47e48cbd90
2017-08-21fix bogus always-true assertsMichael Stahl
Most of these were converted from OSL_ASSERT Change-Id: Ia95a758cdebf72ee80d00866644d92e6bb915071
2017-08-18loplugin:implicitboolconversion (clang-cl)Stephan Bergmann
...after 2bb282656a19a399a101dbeadf157d10d4d5e4f4 "SalFrame Handle* methods can return bool" Change-Id: I15659eafc27e8402aeb407418e656d546c554f06
2017-08-18loplugin:oncevar (clang-cl)Stephan Bergmann
Change-Id: I118da42ad7a42e4d081fd9901e230a0318a77f73
2017-08-17remove UL/L suffixes from integer constants on the RHS of expressionsNoel Grandin
Change-Id: I899a8126c9d971601fea6c77eca165718aea0ac5 Reviewed-on: https://gerrit.libreoffice.org/41237 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17remove UL/L suffixes from shift-by-constant expressionsNoel Grandin
Change-Id: Ia470f643e3eefeccc14183133603db260460bd53 Reviewed-on: https://gerrit.libreoffice.org/41212 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-01tdf#109997 WIN don't post a callback event directlyJan-Marek Glogowski
I doesn't seem possible to post an event deterministically to the end of the Windows message queue and then process this queued events "in order". PeekMessage and now even DispatchMessage process events out of order - that's how this assert was hit. I was quite sure it would not hit, but a simple resize proved me wrong. And the assert just proved that all my assumptions were wrong :-( So this gives up the whole idea of a short-circuit message queue handling on Windows for busy processing of LO Idles and goes back to some kind of the original "always timer" implementation. Since the "parallel" processing of LO events after system messages during DoYield was dropped, this might be slower; or not. In the end this simplifies the main loop almost to the starting point, except for a little busy loop, if we wait for an Idle event timer - not so busy acually, as we just switch to another local thread, which hopefully is our idle timer waiting to fire. A short-circuit with a little detour. Change-Id: Id63a2a9e2a3b1501ad50a2c6f308a36efe55e68f
2017-07-25WIN don't process the SendMessage from DoYieldJan-Marek Glogowski
Actually we just want to remove the SAL_MSG_TIMER_CALLBACK messages, but this seems to be impossible using PeekMessage, without the side effect of processing some messages: "During this call, the system delivers pending, nonqueued messages... Then the first queued message that matches the specified filter is retrieved.". But it is actually enought to ignore the SAL_MSG_THREADYIELD message send using SendMessage from DoYield, which can be filtered by using PM_QS_POSTMESSAGE. Probably this should be resolved not using PeekMessage at all by using a variable to hold the time of the last posted SAL_MSG_TIMER_CALLBACK message, so we just run the callback once, if our time is <= MSG time and ignore the multiple queued messages. Same for mbOnIdleRunScheduler handling. Change-Id: Ifacb20aa38e6b5aca908e5411cf2e100f702ad1f
2017-07-25tdf#109281 add fallback to GDI back when we can't bind a DCTomaž Vajngerl
Change-Id: Ibaa0a86562cdeaff989c2a548efa03ea24933213 Reviewed-on: https://gerrit.libreoffice.org/40398 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2017-07-24WIN don't yield the scheduler in PeekMessageJan-Marek Glogowski
The scheduler is restarting the timer at the end of the most important task search. It uses PeekMessage PM_REMOVE to remove old SAL_MSG_TIMER_CALLBACK messages from the queue. Without PM_NOYIELD, in combination with an other thread yielding using SAL_MSG_THREADYIELD, this could re-start scheduling inside these PeekMessage calls, resulting in various assertions inside the scheduler code, most time due to the changed ascheduler list in "assert( pPrevSchedulerData->mpNext == pSchedulerData )". Change-Id: Ia96b6c0e06ffc3126b1428723b53f4b2112f8a5f
2017-07-24Add some const and fix some scheduler loggingJan-Marek Glogowski
Change-Id: Id20767ff2be34a21896d3ce2b76f3944acdb1b77
2017-07-24WIN use Reschedule instead of own dispatch loopsJan-Marek Glogowski
Since we're filtering the wakeup timer event in the main dispatch loop, we should use Application::Reschedule in the Backend. Change-Id: Ie02c3533e8a6a7905281f129489e4f6f53f74692
2017-07-21migrate to boost::gettextCaolán McNamara
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") * ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching MODULE .mo files * UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui goes from l10n target to normal one, so the res/lang.zips of UI files go away * translation via Translation::get(hrc-define-key, imbued-std::locale) * python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there to keep finding the .hrc file uniform) so magic numbers can go away there * java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation mechanism * en-US res files go away, their strings are now the .hrc keys in the source code * remaining .res files are replaced by .mo files * in .res/.ui-lang-zip files, the old scheme missing translations of strings results in inserting the english original so something can be found, now the standard fallback of using the english original from the source key is used, so partial translations shrink dramatically in size * extract .hrc strings with hrcex which backs onto xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap * extract .ui strings with uiex which backs onto xgettext --add-comments --no-wrap * qtz for gettext translations is generated at runtime as ascii-ified crc32 of content + "|" + msgid * [API CHANGE] remove deprecated binary .res resouce loader related uno apis com::sun::star::resource::OfficeResourceLoader com::sun::star::resource::XResourceBundleLoader com::sun::star::resource::XResourceBundle when translating strings via uno apis com.sun.star.resource.StringResourceWithLocation can continue to be used Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
2017-07-20tdf#107166 improve AA mode selection, retry, more checksTomaž Vajngerl
Major problem when setting the render mode and the text antialias mode is that when you set the render mode to something that isn't compatible with the text antialias mode, then every next call will cause an error (invalid parameters). So we need to be sure that we never set incompatible modes. Additionally we just need to set it one time when we create the surface and not every time we draw. If we get the D2DERR_RECREATE_TARGET we can create a new render target and retry the whole call. Somethimes this is not possible so we try 3 times and the give up. We need to add more checks where we exit early or not continue with some calls as any additional calls could taint the draw state and some things wouldn't be drawn. For example if we calculate the sizes of 0 glyphs we shouldn't continue with binding the hDC with an "empty" rectangle. This will fail and cause some text that is called afterwards to not draw. Change-Id: Iabbdbd7956e90ea84aea96824c0d985ca9020c59 Reviewed-on: https://gerrit.libreoffice.org/40211 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-07-20tdf#109123 WIN Run instant timerout with low priorityJan-Marek Glogowski
This busy-lock happens, because user messages have a higher priority then some system messages. What happens: 1. The main system loop picks up the LO scheduler 2. The idle worker (IW) is started 3. IW checks using AnyInput( VCL_INPUT_ANY ) for system events 4. A system event is found 5. The LO scheduler gets posted again 6. The main system loop picks up the LO scheduler instead of the system message => goto 2 Normally it's suggested to use WM_TIMER in this case, as these messages are supposed to have the lowest priority. But this doesn't work, if you use PostMessage to generate them and SetTimer doesn't accept a 0ms timeout. At least PeakMessage also picks up the WM_TIMER message before the system message, probably because PostMessage is somehow related to the threads queue - who knows. In the end this implements a manual, low priority event, which is checked at the end of the ImplSalYield function. It just runs, if there is nothing else to do. We still have to emit the timer callback event, as ImplSalYield may wait in GetMessage, but wParam now indicates, if it's a wakeup and can be ignored. We use the same event, so it's easier to filter. Thanks to Mike Kaganski for the missing information and ideas for the final implementation. Change-Id: Ib8e4f214ab8d3731d5594d68f38f46982c2eb36d Reviewed-on: https://gerrit.libreoffice.org/40190 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2017-07-20Annotate some more Timers and IdlesJan-Marek Glogowski
Change-Id: Ic8ca00db385ed59bb16744581f9d7cc0fcbb4f5b Reviewed-on: https://gerrit.libreoffice.org/40188 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2017-07-17Fix typosAndrea Gelmini
Change-Id: I0fec2abc1bed9c0cfcd78d1b0f6daebc335831be Reviewed-on: https://gerrit.libreoffice.org/39982 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2017-07-17loplugin:unnecessaryparen: vcl (clang-cl)Stephan Bergmann
Change-Id: I3d31a5b56007451a9982602b488ae6ac1baf1f50
2017-07-17loplugin:implicitboolconversion: vcl (clang-cl)Stephan Bergmann
Change-Id: I81ae357574e5020a5e2dfb7162d451b985c18766
2017-07-17DWrite: resolve unreachable code warningTomaž Vajngerl
Change-Id: I5b9ffefcf8022366236328f0ca89982172b76feb Reviewed-on: https://gerrit.libreoffice.org/40021 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-07-17DWrite: HRESULT checks for debug modeTomaž Vajngerl
Change-Id: I4913b6e3d3c1766151571c467416e62409c8e260 Reviewed-on: https://gerrit.libreoffice.org/40020 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-07-17WIN revert to Sleep(1) for yieldJan-Marek Glogowski
There are multiple ways on Windows to yield a thread: * SwitchToThread: yields to any thread on same processor * Sleep(0): yields to any thread of same or higher priority on any processor * Sleep(1): yields to any thread on any processor So we stay with Sleep(1), as it also seems the only call, which actually does some sleep and is not a busy wait. Change-Id: I85c69b2f32dba9869bbddc1a572b3a63c366c5d1
2017-07-17WIN annotate GdiPlusBuffer TimerJan-Marek Glogowski
Change-Id: Ia7aa081848647314e14b5ccd3063d51700f2b6c6
2017-07-17DWrite: move impl. of some methods to the cxxTomaž Vajngerl
Change-Id: I34b4163176dc5a4a8f5cd326918df375c3475a1a Reviewed-on: https://gerrit.libreoffice.org/40019 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-07-17factor out DWrite renderer from winlayoutTomaž Vajngerl
Change-Id: I7093d86593677a7d15f5b7f55aa0f29be2154f5a Reviewed-on: https://gerrit.libreoffice.org/40018 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-07-15tdf#38915: don't wait on message queue if application already has quit.Mike Kaganski
Despite precautions in Application::Execute() and ImplYield(), in my testing I sometimes see that soffice is waiting in ImplSalYield()'s GetMessageW() when ImplGetSVData()->maAppData.mbAppQuit is true, so that soffice.bin hangs in the background. I suspect that this is related to the bug. Some obscure code path seems to be able to get here after the flag is already set. So, test also in ImplSalYield() right before GetMessageW() to make sure. Another possibility is that we get here when the flag is not set yet, and gets set while already waiting, but that would mean this happens in a different thread. Change-Id: Idb19eabcca8b5c24eac0ca76950edc1bf1e5bccb Reviewed-on: https://gerrit.libreoffice.org/39996 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-07-13WIN shorten DoYield by using existing functionsJan-Marek Glogowski
This also adds an sal_uLong nCount parameter to ImplSalYieldMutexAcquireWithWait, so it can be called like ImplSalAcquireYieldMutex and actually uses the result from the deferred DoYield. Change-Id: Ie3b466ad03e7ed8c35a62f41c09d09757865364d
2017-07-13WIN just wait for the Yield mutex in the timeroutJan-Marek Glogowski
Don't re-schedule a timeout, simply wait in the timer callback. Change-Id: Ib46eb6dbf57f29c85ffdbd6492922020f7785d30
2017-07-13WIN simplify system timer / LO event handlingJan-Marek Glogowski
This removes a level of indirection for the timer callback handling. It also ensures we just have a single timeout message queued. Also drops the 16bit MAX duration limit, as CreateTimerQueueTimer uses a DWORD for the DueTime parameter, which is always UINT32. CreateTimerQueueTimer already sets the period to 0, which makes it a one-shot timer, but there is also the WT_EXECUTEONLYONCE, which enforces the Period parameter to be 0. Change-Id: I549142394334bdc098f053b42f222b23cf4fcecd
2017-07-13WIN unify deferred message handlingJan-Marek Glogowski
Moves the common code into ProcessOrDeferMessage. All callers (try to) aquire the mutex before getting the WinSalFrame pointer, except for ImplHandleDeferredPaintMsg. This was probably an oversight, so this reverses the order in this function, so the GetWindowPtr is now always protected by the Solar mutex. Change-Id: Icb8f34f7e8716f0faa90a95903b1681f7489aed2
2017-07-13WIN cleanup paint message handlingJan-Marek Glogowski
Makes PAINT handling function use the POSTPAINT handling function and unifies the locking behaviour, so we now check the frame before trying to aquire the lock in both functions. Change-Id: Ia6bac6e24d95e680830c5405f0ab34cbed6e9688
2017-07-13Drop special idle handlingJan-Marek Glogowski
Idles are just instant timers, which should most time have a low priority, By dropping most special idle handling we'll just schedule by priority. This also reverts SalYieldResult back to a bool, which just indicates if any event was processed. Change-Id: Ia0b91b06dffb77af066f01838d8f9483523bf67d
2017-07-13Refactor Scheduler global dataJan-Marek Glogowski
Move all Scheduler members of ImplSVData into ImplSchedulerContext and make ImplSchedulerContext a member of ImplSVData. Change-Id: I186bebdfb5701543595848968235b5a56b6598e9
2017-07-13Add some Scheduler unit tests and loggingJan-Marek Glogowski
1. calling Start() for invoked tasks 2. correctly schedule by priority 3. self-stopping AutoTimer This also adds SAL_INFO output to Scheduler and Task to log the scheduling processing tasks. Change-Id: I3c8a708d1fd51c550320f8af3f9486c43c32e358
2017-07-12fix crash when aInkBoxes might be emptyMarkus Mohrhard
e.g. http://crashreport.libreoffice.org/stats/signature/WinFontInstance::CacheGlyphToAtlas(bool,HDC__%20*,HFONT__%20*,int,SalGraphics%20&) Change-Id: I0f32b549c687c2da6534f59a13ce1c5d57047829 Reviewed-on: https://gerrit.libreoffice.org/39874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2017-07-06tdf#106990 set cleartype setting / force to use GDI render modeTomaž Vajngerl
With this we read the system setting for cleartype and set it to the render target we are using. Additionally we set the GDI like rendering mode which forces that the text is rendered similar as this was done with GDI. Change-Id: If6fb72bc371accf50278c968c94e625aee3f0953 Reviewed-on: https://gerrit.libreoffice.org/39602 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-05loplugin:casttovoid (clang-cl): vclStephan Bergmann
Change-Id: I4c54f7edc0422382e1cd7fca95c2e7ab2b4bab1c
2017-07-03loplugin:oncevar (clang-cl): vclStephan Bergmann
Change-Id: I0459978c2cfb61cd7251f0e8d9a30f1f19c02c11
2017-06-17loplugin:unusedfields in vcl part3Noel Grandin
Change-Id: I5a6319ba1667af6e9b7b92c22f858188c28c4c61 Reviewed-on: https://gerrit.libreoffice.org/38835 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-30vcl: replace dynamic lookups of Windows 7 APIs with static callsMichael Stahl
Change-Id: I5d4c4bb98e271e69c45b8e7f989f9b21d287c0bb