vcl/osx/salinst.cxx | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
New commits: commit 7575bbe54a6afec3b289985593977579835cce3f Author: Patrick Luby <[email protected]> AuthorDate: Wed Mar 4 11:56:25 2026 -0500 Commit: Patrick Luby <[email protected]> CommitDate: Sat Mar 7 16:56:07 2026 +0100 tdf#170740 only repost the same left mouse up event once Dragging a window's titlebar with the Option key pressed may trigger live resizing. Unlike normal live resizing, live resizing while Option-dragging a window needs left mouse up events to be dispatched to end live resizing. So if we keep reposting the same left mouse up event, LibreOffice will go into an infinite loop waiting for live resizing to end. Reposting last mouse up events is still needed to prevent tdf#155092 during normal live resizing so allow last mouse up events to be reposted but only once. The purpose of reposting is to skip native event dispatching during this pass and only let native timers run. This lets pending LibreOffice resizing and repainting timers run before the left mouse up event is dispatched. Change-Id: Ide2ec9988a8258cd1acf9852a61cfc4d4c1abdef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200957 Reviewed-by: Dan Williams <[email protected]> Tested-by: Jenkins Reviewed-by: Patrick Luby <[email protected]> diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index 22b1422ce6e0..b1ec7c8ea47b 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -586,8 +586,40 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) // the front of the event queue so no more events will be // dispatched until live resizing ends. Surprisingly, live // resizing appears to end in the next mouse down event. - if ( ImplGetSVData()->mpWinData->mbIsLiveResize && [pEvent type] == NSEventTypeLeftMouseUp ) + bool bRepostEvent = false; + if ( ImplGetSVData()->mpWinData->mbIsLiveResize ) + bRepostEvent = ( [pEvent type] == NSEventTypeLeftMouseUp ); + + // tdf#170740 only repost the same left mouse up event once + // Dragging a window's titlebar with the Option key pressed + // may trigger live resizing. Unlike normal live resizing, + // live resizing while Option-dragging a window needs + // left mouse up events to be dispatched to end live + // resizing. So if we keep reposting the same left mouse up + // event, LibreOffice will go into an infinite loop waiting + // for live resizing to end. + // Reposting last mouse up events is still needed to + // prevent tdf#155092 during normal live resizing so allow + // last mouse up events to be reposted but only once. + // The purpose of reposting is to skip native event + // dispatching during this pass and only let native timers + // run. This lets pending LibreOffice resizing and + // repainting timers run before the left mouse up event is + // dispatched. + static NSEvent *pLastRepostedEvent = nil; + if ( pLastRepostedEvent ) { + [pLastRepostedEvent release]; + pLastRepostedEvent = nil; + } + // Only repost event if pLastRepostedEvent was already nil. + // Reposting an event while waiting to dispatch a previously + // reposted event can cause incorrect ordering of native events + // in the native queue. So, to be safe, resume normal event + // dispatching. + else if ( bRepostEvent ) + { + pLastRepostedEvent = [pEvent retain]; [NSApp postEvent: pEvent atStart: YES]; return false; }
