From eb358d77291eba677141bab113dc27d7aabb0f3e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:44:04 +0200 Subject: Merging upstream version 4:24.2.2. Signed-off-by: Daniel Baumann --- vcl/inc/osx/salnsmenu.h | 10 +- vcl/inc/osx/salprn.h | 2 + vcl/inc/salprn.hxx | 2 + vcl/inc/unx/genprn.h | 2 + vcl/inc/win/salprn.h | 2 + vcl/osx/salmenu.cxx | 13 +- vcl/osx/salnsmenu.mm | 80 ++++ vcl/osx/salprn.cxx | 5 + vcl/osx/vclnsapp.mm | 49 +-- vcl/qa/cppunit/pdfexport/data/tdf159817.fodt | 607 +++++++++++++++++++++++++++ vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 56 +++ vcl/qt5/QtFrame.cxx | 14 + vcl/qt5/QtInstance.cxx | 5 + vcl/source/control/button.cxx | 6 +- vcl/source/control/combobox.cxx | 9 +- vcl/source/gdi/mtfxmldump.cxx | 2 - vcl/source/gdi/pdfwriter_impl.cxx | 2 +- vcl/source/gdi/print.cxx | 8 + vcl/source/outdev/stack.cxx | 6 - vcl/source/window/paint.cxx | 2 +- vcl/source/window/tabpage.cxx | 5 +- vcl/source/window/window.cxx | 1 + vcl/unx/generic/print/genprnpsp.cxx | 5 + vcl/unx/gtk3/salnativewidgets-gtk.cxx | 20 +- vcl/win/gdi/salprn.cxx | 16 + 25 files changed, 863 insertions(+), 66 deletions(-) create mode 100644 vcl/qa/cppunit/pdfexport/data/tdf159817.fodt (limited to 'vcl') diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h index 696abca2fc..9e0f9acf68 100644 --- a/vcl/inc/osx/salnsmenu.h +++ b/vcl/inc/osx/salnsmenu.h @@ -35,17 +35,25 @@ class AquaSalMenuItem; { AquaSalMenu* mpMenu; } ++ (BOOL)dispatchSpecialKeyEquivalents:(NSEvent*)pEvent; - (id)initWithMenu:(AquaSalMenu*)pMenu; - (void)menuNeedsUpdate:(NSMenu*)pMenu; - (void)setSalMenu:(AquaSalMenu*)pMenu; @end -@interface SalNSMenuItem : NSMenuItem +@interface SalNSMenuItem : NSMenuItem { AquaSalMenuItem* mpMenuItem; } - (id)initWithMenuItem:(AquaSalMenuItem*)pMenuItem; - (void)menuItemTriggered:(id)aSender; +- (BOOL)validateMenuItem:(NSMenuItem*)pMenuItem; +@end + +@interface SalNSMainMenu : NSMenu +{ +} +- (BOOL)performKeyEquivalent:(NSEvent*)pEvent; @end #endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index 9c26e171db..cd26279517 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -84,6 +84,8 @@ class AquaSalInfoPrinter : public SalInfoPrinter virtual OUString GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nPaperBin ) override; virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData, sal_uInt16 nPaperSource) override; + virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData, + sal_uInt16 nPaperBin) override; virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ) override; virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData ) override; diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index ae0b313dab..05dca2fcab 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -84,6 +84,8 @@ public: virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) = 0; virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData, sal_uInt16 nPaperSource) = 0; + virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData, + sal_uInt16 nPaperSource) = 0; // fills m_aPaperFormats and sets m_bPapersInit to true virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0; diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index abe84b71ca..b4fb2c8b35 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -47,6 +47,8 @@ public: virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override; virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData, sal_uInt16 nPaperSource) override; + virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData, + sal_uInt16 nPaperBin) override; virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override; virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override; }; diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index b0ec1697c3..d44687d8e0 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -71,6 +71,8 @@ public: virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override; virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData, sal_uInt16 nPaperSource) override; + virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData, + sal_uInt16 nPaperBin) override; virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override; virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index b3d02587f4..6ea16a6588 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -125,7 +125,9 @@ static void initAppMenu() NSMenu* pAppMenu = nil; NSMenuItem* pNewItem = nil; - NSMenu* pMainMenu = [[[NSMenu alloc] initWithTitle: @"Main Menu"] autorelease]; + // Related: tdf#126638 use NSMenu subclass to catch and redirect key + // shortcuts when a modal window is displayed + SalNSMainMenu* pMainMenu = [[[SalNSMainMenu alloc] initWithTitle: @"Main Menu"] autorelease]; pNewItem = [pMainMenu addItemWithTitle: @"Application" action: nil keyEquivalent: @""]; @@ -230,12 +232,19 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) : { mpMenu = [[SalNSMenu alloc] initWithMenu: this]; [mpMenu setDelegate: reinterpret_cast< id >(mpMenu)]; + + // Related: tdf#126638 enable the menu's "autoenabledItems" property + // Enable the menu's "autoenabledItems" property so that + // -[SalNSMenuItem validateMenuItem:] will be called before handling + // a key shortcut and the menu item can be temporarily disabled if a + // modal window is displayed. + [mpMenu setAutoenablesItems: YES]; } else { mpMenu = [NSApp mainMenu]; + [mpMenu setAutoenablesItems: NO]; } - [mpMenu setAutoenablesItems: NO]; } AquaSalMenu::~AquaSalMenu() diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm index b2df2da7e5..31627a35ea 100644 --- a/vcl/osx/salnsmenu.mm +++ b/vcl/osx/salnsmenu.mm @@ -30,6 +30,53 @@ #include @implementation SalNSMenu + ++(BOOL)dispatchSpecialKeyEquivalents: (NSEvent*)pEvent +{ + if( pEvent && [pEvent type] == NSEventTypeKeyDown ) + { + unsigned int nModMask = ([pEvent modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)); + if( nModMask == NSEventModifierFlagCommand ) + { + if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] ) + { + if( [NSApp sendAction: @selector(paste:) to: nil from: nil] ) + return YES; + } + else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"c"] ) + { + if( [NSApp sendAction: @selector(copy:) to: nil from: nil] ) + return YES; + } + else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"x"] ) + { + if( [NSApp sendAction: @selector(cut:) to: nil from: nil] ) + return YES; + } + else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"a"] ) + { + if( [NSApp sendAction: @selector(selectAll:) to: nil from: nil] ) + return YES; + } + else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"z"] ) + { + if( [NSApp sendAction: @selector(undo:) to: nil from: nil] ) + return YES; + } + } + else if( nModMask == (NSEventModifierFlagCommand|NSEventModifierFlagShift) ) + { + if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"Z"] ) + { + if( [NSApp sendAction: @selector(redo:) to: nil from: nil] ) + return YES; + } + } + } + + return NO; +} + -(id)initWithMenu: (AquaSalMenu*)pMenu { mpMenu = pMenu; @@ -167,6 +214,19 @@ OSL_FAIL( "menubar item without frame !" ); } } + +-(BOOL)validateMenuItem: (NSMenuItem *)pMenuItem +{ + // Related: tdf#126638 disable all menu items when displaying modal windows + // For some unknown reason, key shortcuts are dispatched to the LibreOffice + // menu items instead of the modal window so disable all LibreOffice menu + // items while a native modal dialog such as the native Open, Save, or + // Print dialog is displayed. + if (!pMenuItem || [NSApp modalWindow]) + return NO; + + return [pMenuItem isEnabled]; +} @end @implementation OOStatusItemView @@ -257,5 +317,25 @@ SAL_WNODEPRECATED_DECLARATIONS_POP } @end +@implementation SalNSMainMenu + +- (BOOL)performKeyEquivalent:(NSEvent*)pEvent +{ + BOOL bRet = [super performKeyEquivalent: pEvent]; + + // tdf#126638 dispatch key shortcut events to modal windows + // Some modal windows, such as the native Open and Save dialogs, + // return NO from -[NSWindow performKeyEquivalent:]. Fortunately, + // the main menu's -[NSMenu performKeyEquivalent:] is then called + // so we can catch and redirect any modal window's key shortcut + // events without triggering the modal window's "disallowed + // action" beep. + if( !bRet && [NSApp modalWindow] ) + bRet = [SalNSMenu dispatchSpecialKeyEquivalents: pEvent]; + + return bRet; +} + +@end /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 3de45d9e80..3fe37a9ab5 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -270,6 +270,11 @@ sal_uInt16 AquaSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup*, sa return 0xffff; } +sal_uInt16 AquaSalInfoPrinter::GetSourceIndexByPaperBin(const ImplJobSetup*, sal_uInt16) +{ + return 0; +} + sal_uInt32 AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, PrinterCapType i_nType ) { switch( i_nType ) diff --git a/vcl/osx/vclnsapp.mm b/vcl/osx/vclnsapp.mm index 5daf923ce1..cd60cb0b0c 100644 --- a/vcl/osx/vclnsapp.mm +++ b/vcl/osx/vclnsapp.mm @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -170,44 +171,8 @@ // precondition: this ONLY works because CMD-V (paste), CMD-C (copy) and CMD-X (cut) are // NOT localized, that is the same in all locales. Should this be // different in any locale, this hack will fail. - unsigned int nModMask = ([pEvent modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)); - if( nModMask == NSEventModifierFlagCommand ) - { - - if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] ) - { - if( [NSApp sendAction: @selector(paste:) to: nil from: nil] ) - return; - } - else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"c"] ) - { - if( [NSApp sendAction: @selector(copy:) to: nil from: nil] ) - return; - } - else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"x"] ) - { - if( [NSApp sendAction: @selector(cut:) to: nil from: nil] ) - return; - } - else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"a"] ) - { - if( [NSApp sendAction: @selector(selectAll:) to: nil from: nil] ) - return; - } - else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"z"] ) - { - if( [NSApp sendAction: @selector(undo:) to: nil from: nil] ) - return; - } - } - else if( nModMask == (NSEventModifierFlagCommand|NSEventModifierFlagShift) ) - { - if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"Z"] ) - { - if( [NSApp sendAction: @selector(redo:) to: nil from: nil] ) - return; - } - } + if( [SalNSMenu dispatchSpecialKeyEquivalents:pEvent] ) + return; } } [super sendEvent: pEvent]; @@ -315,6 +280,14 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { (void)app; + + // Related: tdf#126638 disable all menu items when displaying modal windows + // Although -[SalNSMenuItem validateMenuItem:] disables almost all menu + // items when a modal window is displayed, the standard Quit menu item + // does not get disabled so disable it here. + if ([NSApp modalWindow]) + return NSTerminateCancel; + NSApplicationTerminateReply aReply = NSTerminateNow; { SolarMutexGuard aGuard; diff --git a/vcl/qa/cppunit/pdfexport/data/tdf159817.fodt b/vcl/qa/cppunit/pdfexport/data/tdf159817.fodt new file mode 100644 index 0000000000..6aa986bdc6 --- /dev/null +++ b/vcl/qa/cppunit/pdfexport/data/tdf159817.fodt @@ -0,0 +1,607 @@ + + + + LibreOfficeDev/24.8.0.0.alpha0$MacOSX_AARCH64 LibreOffice_project/d8978a8c4ffabd6b36a691fd3e2df685638082342003-10-02T15:57:292024-03-03T15:16:09.338790904880P124DT12H36M25S2024-02-21T10:01:49.801000000Fichiers PDF + + + 0 + 0 + 20717 + 10631 + false + false + + + view2 + 11534 + 5101 + 0 + 0 + 20715 + 10629 + 0 + 1 + false + 140 + false + false + false + true + false + false + + + + + 0 + true + false + false + false + true + false + true + false + + true + false + false + false + false + true + false + false + 0 + false + false + false + false + false + true + false + false + false + false + false + true + false + 449756 + true + true + true + false + false + false + false + false + false + false + true + true + false + false + true + false + 20255833 + false + false + false + false + false + false + true + false + false + false + false + true + false + + true + false + false + false + true + false + false + true + false + false + false + 0 + false + true + false + false + false + true + false + 1 + false + false + true + low-resolution + Canon iP7200 series + false + 0 + + true + true + + + false + false + true + true + false + false + false + false + false + false + false + NQH+/0Nhbm9uIGlQNzIwMCBzZXJpZXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ2Fub24gaVA3MjAwIHNlcmllcy1BaXJQcmludAAAAAAWAAQABAAAAAAAAAAEAAhSAAAEdAAAAAAAABIAQ09NUEFUX0RVUExFWF9NT0RFEwBEdXBsZXhNb2RlOjpVbmtub3duDABQUklOVEVSX05BTUUTAENhbm9uIGlQNzIwMCBzZXJpZXMLAERSSVZFUl9OQU1FHABDYW5vbiBpUDcyMDAgc2VyaWVzLUFpclByaW50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page 0/ 1Votre paraphe : + + + + + + + + + + + + + Page 1/ 1Votre paraphe : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propriétaire Locataire Occupant à titre gratuit + + Incendie + + + + + \ No newline at end of file diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index d2811f32fb..38e3629497 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -41,6 +41,7 @@ #include #include +#include using namespace ::com::sun::star; @@ -4851,6 +4852,61 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf156528) bounds.getHeight(), 1); } +// Form controls coordinates scrambled when exporting to pdf with unchecked form creation in Writer +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf159817) +{ + aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + + // Enable PDF/UA + uno::Sequence aFilterData( + comphelper::InitPropertySequence({ { "ExportFormFields", uno::Any(false) } })); + aMediaDescriptor["FilterData"] <<= aFilterData; + saveAsPDF(u"tdf159817.fodt"); + + std::unique_ptr pPdfDocument = parsePDFExport(); + + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + std::unique_ptr pPdfPage = pPdfDocument->openPage(/*nIndex=*/0); + CPPUNIT_ASSERT(pPdfPage); + std::unique_ptr pTextPage = pPdfPage->getTextPage(); + CPPUNIT_ASSERT(pTextPage); + + // So I extracted these values by using SAL_WARN(... << ...getMinimum()), but it appears + // that the C++ stream operators do not output double values with sufficient resolution for me + // to recreate those values in code, sigh, so resort to rounding things. + auto roundPoint = [&pPdfPage](int i) { + auto p = pPdfPage->getObject(i)->getBounds().getMinimum(); + return basegfx::B2DPoint(std::floor(p.getX() * 10) / 10.0, + std::floor(p.getY() * 10) / 10.0); + }; + // before the fix these co-ordinates would have been way further down the page + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(8.6, 677.3), roundPoint(13)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(9.3, 677.9), roundPoint(14)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(9.8, 678.5), roundPoint(15)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(85.0, 677.3), roundPoint(16)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(85.6, 677.9), roundPoint(17)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(170.1, 677.3), roundPoint(18)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(170.6, 677.9), roundPoint(19)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(0.0, 654.0), roundPoint(20)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(0.6, 654.6), roundPoint(21)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.3, 655.5), roundPoint(22)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.3, 655.5), roundPoint(23)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.2, 655.5), roundPoint(24)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.2, 655.5), roundPoint(25)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.4, 655.5), roundPoint(26)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.4, 655.5), roundPoint(27)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.1, 655.5), roundPoint(28)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.1, 655.5), roundPoint(29)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.5, 655.5), roundPoint(30)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.5, 655.5), roundPoint(31)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.0, 655.5), roundPoint(32)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.0, 655.5), roundPoint(33)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(28.3, 641.4), roundPoint(34)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(28.3, 623.7), roundPoint(35)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(28.3, 623.8), roundPoint(36)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(138.6, 623.7), roundPoint(37)); +} + } // end anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 24dcb5ff6f..6aff814aac 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -376,6 +376,20 @@ void QtFrame::SetIcon(sal_uInt16 nIcon) QIcon aIcon = QIcon::fromTheme(appicon); m_pQWidget->window()->setWindowIcon(aIcon); + + if (QGuiApplication::platformName() == "wayland" && m_pQWidget->window()->isVisible()) + { + // Qt currently doesn't provide API to directly set the app_id for a single + // window/toplevel on Wayland, but the one set for the application is picked up + // on hide/show, so do that. + // An alternative would be to use private Qt API and low-level wayland API to set the + // app_id directly, s. discussion in QTBUG-77182. + const QString sOrigDesktopFileName = QGuiApplication::desktopFileName(); + QGuiApplication::setDesktopFileName(appicon); + m_pQWidget->window()->hide(); + m_pQWidget->window()->show(); + QGuiApplication::setDesktopFileName(sOrigDesktopFileName); + } } void QtFrame::SetMenu(SalMenu*) {} diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 4880c1bdec..f87cdef934 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -708,6 +708,11 @@ std::unique_ptr QtInstance::CreateQApplication(int& nArgc, char** // for scaled icons in the native menus QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif + // force Qt::HighDpiScaleFactorRoundingPolicy::Round, which is the Qt 5 default + // policy and prevents incorrect rendering with the Qt 6 default policy + // Qt::HighDpiScaleFactorRoundingPolicy::PassThrough (tdf#159915) + QGuiApplication::setHighDpiScaleFactorRoundingPolicy( + Qt::HighDpiScaleFactorRoundingPolicy::Round); FreeableCStr session_manager; if (getenv("SESSION_MANAGER") != nullptr) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index ac06f445e0..138f17d0d4 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2530,6 +2530,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, if ( !maImage ) { MapMode aResMapMode( MapUnit::Map100thMM ); + Point aPos = pDev->LogicToPixel( rPos ); Size aSize = GetSizePixel(); Size aImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode ); Size aBrd1Size = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode ); @@ -2563,7 +2564,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, pDev->SetTextColor( GetTextColor() ); pDev->SetTextFillColor(); - ImplDraw( pDev, nFlags, rPos, aSize, + ImplDraw( pDev, nFlags, aPos, aSize, aImageSize, aStateRect, aMouseRect ); Point aCenterPos = aStateRect.Center(); @@ -3353,6 +3354,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) { MapMode aResMapMode( MapUnit::Map100thMM ); + Point aPos = pDev->LogicToPixel( rPos ); Size aSize = GetSizePixel(); Size aImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode ); Size aBrd1Size = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode ); @@ -3389,7 +3391,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, pDev->SetTextColor( GetTextColor() ); pDev->SetTextFillColor(); - ImplDraw( pDev, nFlags, rPos, aSize, + ImplDraw( pDev, nFlags, aPos, aSize, aImageSize, aStateRect, aMouseRect ); pDev->SetLineColor(); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 2a979b70b0..82520cc765 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1152,6 +1152,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags { GetMainWindow()->ApplySettings(*pDev); + Point aPos = pDev->LogicToPixel( rPos ); Size aSize = GetSizePixel(); vcl::Font aFont = GetMainWindow()->GetDrawPixelFont( pDev ); @@ -1167,7 +1168,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags bool bBackground = IsControlBackground(); if ( bBorder || bBackground ) { - tools::Rectangle aRect( rPos, aSize ); + tools::Rectangle aRect( aPos, aSize ); // aRect.Top() += nEditHeight; if ( bBorder ) { @@ -1191,7 +1192,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags // First, draw the edit part Size aOrigSize(m_pImpl->m_pSubEdit->GetSizePixel()); m_pImpl->m_pSubEdit->SetSizePixel(Size(aSize.Width(), nEditHeight)); - m_pImpl->m_pSubEdit->Draw( pDev, rPos, nFlags ); + m_pImpl->m_pSubEdit->Draw( pDev, aPos, nFlags ); m_pImpl->m_pSubEdit->SetSizePixel(aOrigSize); // Second, draw the listbox @@ -1219,14 +1220,14 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags } } - tools::Rectangle aClip( rPos, aSize ); + tools::Rectangle aClip( aPos, aSize ); pDev->IntersectClipRegion( aClip ); sal_Int32 nLines = static_cast( nTextHeight > 0 ? (aSize.Height()-nEditHeight)/nTextHeight : 1 ); if ( !nLines ) nLines = 1; const sal_Int32 nTEntry = IsReallyVisible() ? m_pImpl->m_pImplLB->GetTopEntry() : 0; - tools::Rectangle aTextRect( rPos, aSize ); + tools::Rectangle aTextRect( aPos, aSize ); aTextRect.AdjustLeft(3*nOnePixel ); aTextRect.AdjustRight( -(3*nOnePixel) ); diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index e6b1adc80e..2792297fee 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -63,8 +63,6 @@ OUString collectPushFlags(vcl::PushFlags nFlags) aStrings.emplace_back("PushTextLanguage"); if (nFlags & vcl::PushFlags::OVERLINECOLOR) aStrings.emplace_back("PushOverlineColor"); - if (nFlags & vcl::PushFlags::RTLENABLED) - aStrings.emplace_back("PushRTLEnabled"); OUString aString; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index c7ef07ff49..a5365e681b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2775,7 +2775,7 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace, aLine.setLength(0); aLine.append(OString::number(nStream) + " 0 obj\n<>\nstream\n"); if (!writeBuffer(aLine)) return false; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 401d38118c..2519e5ca44 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1487,6 +1487,14 @@ sal_uInt16 Printer::GetPaperBinBySourceIndex(sal_uInt16 nPaperSource) const return mpInfoPrinter->GetPaperBinBySourceIndex( &maJobSetup.ImplGetConstData(), nPaperSource ); } +sal_uInt16 Printer::GetSourceIndexByPaperBin(sal_uInt16 nPaperBin) const +{ + if (IsDisplayPrinter()) + return 0; + + return mpInfoPrinter->GetSourceIndexByPaperBin( &maJobSetup.ImplGetConstData(), nPaperBin); +} + void Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate ) { mnCopyCount = nCopy; diff --git a/vcl/source/outdev/stack.cxx b/vcl/source/outdev/stack.cxx index 129348051e..72ef63af55 100644 --- a/vcl/source/outdev/stack.cxx +++ b/vcl/source/outdev/stack.cxx @@ -84,9 +84,6 @@ void OutputDevice::Push(vcl::PushFlags nFlags) if (nFlags & vcl::PushFlags::REFPOINT && mbRefPoint) rState.mpRefPoint = maRefPoint; - if (nFlags & vcl::PushFlags::RTLENABLED) - rState.mbRTLEnabled = IsRTLEnabled(); - if (mpAlphaVDev) mpAlphaVDev->Push(); } @@ -187,9 +184,6 @@ void OutputDevice::Pop() SetRefPoint(); } - if ( rState.mnFlags & vcl::PushFlags::RTLENABLED ) - EnableRTL( rState.mbRTLEnabled ); - maOutDevStateStack.pop_back(); mpMetaFile = pOldMetaFile; diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index a98703ca25..de2222b4bc 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1523,7 +1523,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP VclPtrInstance pMaskedDevice(*i_pTargetOutDev, DeviceFormat::WITH_ALPHA); - pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() ); + pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel(), true, true ); pMaskedDevice->EnableRTL( IsRTLEnabled() ); aMtf.WindStart(); aMtf.Play(*pMaskedDevice); diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 612b17d272..b97becf2e0 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -163,6 +163,7 @@ void TabPage::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& void TabPage::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags ) { + Point aPos = pDev->LogicToPixel( rPos ); Size aSize = GetSizePixel(); Wallpaper aWallpaper = GetBackground(); @@ -174,14 +175,14 @@ void TabPage::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags pDev->SetLineColor(); if ( aWallpaper.IsBitmap() ) - pDev->DrawBitmapEx( rPos, aSize, aWallpaper.GetBitmap() ); + pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() ); else { if( aWallpaper.GetColor() == COL_AUTO ) pDev->SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); else pDev->SetFillColor( aWallpaper.GetColor() ); - pDev->DrawRect( tools::Rectangle( rPos, aSize ) ); + pDev->DrawRect( tools::Rectangle( aPos, aSize ) ); } pDev->Pop(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c3fa7fb3d7..d683f9b415 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -224,6 +224,7 @@ void Window::dispose() Reference< XComponent> xC( mpWindowImpl->mxAccessible, UNO_QUERY ); if ( xC.is() ) xC->dispose(); + mpWindowImpl->mxAccessible.clear(); } ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index ce5a45624d..1e7edb8e09 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -643,6 +643,11 @@ sal_uInt16 PspSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup*, sal return 0xffff; } +sal_uInt16 PspSalInfoPrinter::GetSourceIndexByPaperBin(const ImplJobSetup*, sal_uInt16) +{ + return 0; +} + sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, PrinterCapType nType ) { switch( nType ) diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx index bfdeed4238..391baed222 100644 --- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx @@ -355,7 +355,6 @@ static GtkWidget* gCacheWindow; static GtkWidget* gDumbContainer; #if GTK_CHECK_VERSION(4, 0, 0) static GtkWidget* gVScrollbar; -static GtkWidget* gHScrollbar; static GtkWidget* gTextView; #else static GtkWidget* gComboBox; @@ -363,6 +362,7 @@ static GtkWidget* gListBox; static GtkWidget* gSpinBox; static GtkWidget* gTreeViewWidget; #endif +static GtkWidget* gHScrollbar; static GtkWidget* gEntryBox; namespace @@ -2625,10 +2625,11 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) // set scrollbar settings gint min_slider_length = 21; + GtkRequisition natural_horz_scroll_size; + gtk_widget_get_preferred_size(gHScrollbar, nullptr, &natural_horz_scroll_size); + #if GTK_CHECK_VERSION(4, 0, 0) - GtkRequisition natural_size; - gtk_widget_get_preferred_size(gHScrollbar, nullptr, &natural_size); - aStyleSet.SetScrollBarSize(natural_size.height); + aStyleSet.SetScrollBarSize(natural_horz_scroll_size.height); #else // Grab some button style attributes Size aSize; @@ -2646,6 +2647,10 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) if (has_forward || has_backward || has_forward2 || has_backward2) QuerySize(mpHScrollbarButtonStyle, aSize); + // Recent breeze (Mar 2024) has 17 vs 10, while Adwaita still reports 14 vs 14. + if (natural_horz_scroll_size.height > aSize.Height()) + aSize.setHeight(natural_horz_scroll_size.height); + aStyleSet.SetScrollBarSize(aSize.Height()); gtk_style_context_get(mpVScrollbarSliderStyle, gtk_style_context_get_state(mpVScrollbarSliderStyle), @@ -2932,15 +2937,16 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) mpToolButtonStyle = gtk_widget_get_style_context(GTK_WIDGET(pButton)); #endif + gHScrollbar = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, nullptr); + gtk_fixed_put(GTK_FIXED(gDumbContainer), gHScrollbar, 0, 0); + gtk_widget_show(gHScrollbar); + #if GTK_CHECK_VERSION(4, 0, 0) gVScrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, nullptr); gtk_fixed_put(GTK_FIXED(gDumbContainer), gVScrollbar, 0, 0); gtk_widget_show(gVScrollbar); mpVScrollbarStyle = gtk_widget_get_style_context(gVScrollbar); - gHScrollbar = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, nullptr); - gtk_fixed_put(GTK_FIXED(gDumbContainer), gHScrollbar, 0, 0); - gtk_widget_show(gHScrollbar); mpHScrollbarStyle = gtk_widget_get_style_context(gHScrollbar); gTextView = gtk_text_view_new(); diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 065b060196..aeb3e2b876 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1215,6 +1215,22 @@ sal_uInt16 WinSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup* pSet return 0xffff; } +sal_uInt16 WinSalInfoPrinter::GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin) +{ + DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, nullptr, pSetupData ); + if (nBins != GDI_ERROR) + { + auto pBuffer = std::make_unique(nBins); + DWORD nBins = ImplDeviceCaps( this, DC_BINS, reinterpret_cast(pBuffer.get()), pSetupData ); + if (nBins != GDI_ERROR && nBins > nPaperBin) + { + return *(pBuffer.get() + nPaperBin); + } + } + return 0; +} + + sal_uInt32 WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) { DWORD nRet; -- cgit v1.2.3