b2e4f1279804e1d11b71bc75eeb37072c3589296.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From b2e4f1279804e1d11b71bc75eeb37072c3589296 Mon Sep 17 00:00:00 2001
  2. From: wh11204 <wh11204@2a5c6006-c6dd-42ca-98ab-0921f2732cef>
  3. Date: Sat, 18 Dec 2021 08:13:26 +0000
  4. Subject: [PATCH] * Fix scale factor detection for wxWidgets >= 3.1.4 (ticket
  5. #1132). wxWidgets changed the value returned by
  6. wxWindow::GetContentScaleFactor() in 3.1.0. In 3.1.4 they restored the
  7. pre-3.1.0 behaviour and created a new method GetDPIScaleFactor() returning
  8. what GetContentScaleFactor() was returning until then.
  9. This change broke HiDPI detection when using wxWidgets >= 3.1.4. BTW, it was already broken in
  10. 32-bit C::B because it was not DPI-aware; this has been fixed in [r12591].
  11. Update developer list in Thanks section of the About dialog.
  12. git-svn-id: https://svn.code.sf.net/p/codeblocks/code/trunk@12592 2a5c6006-c6dd-42ca-98ab-0921f2732cef
  13. ---
  14. src/sdk/globals.cpp | 4 ++++
  15. src/src/dlgabout.cpp | 4 ++--
  16. 2 files changed, 6 insertions(+), 2 deletions(-)
  17. diff --git a/src/sdk/globals.cpp b/src/sdk/globals.cpp
  18. index f05975ab0..9069305ca 100644
  19. --- a/src/sdk/globals.cpp
  20. +++ b/src/sdk/globals.cpp
  21. @@ -1186,7 +1186,11 @@ wxBitmap cbLoadBitmapScaled(const wxString& filename, wxBitmapType bitmapType, d
  22. double cbGetContentScaleFactor(const wxWindow &window)
  23. {
  24. +#if wxCHECK_VERSION(3, 1, 4)
  25. + return window.GetDPIScaleFactor();
  26. +#else
  27. return window.GetContentScaleFactor();
  28. +#endif
  29. }
  30. #ifdef __WXGTK__
  31. diff --git a/src/src/dlgabout.cpp b/src/src/dlgabout.cpp
  32. index 545f7d13a..f024d5ed5 100644
  33. --- a/src/src/dlgabout.cpp
  34. +++ b/src/src/dlgabout.cpp
  35. @@ -101,6 +101,7 @@ dlgAbout::dlgAbout(wxWindow* parent)
  36. "Damien Moore : Developer\n"
  37. "Micah Ng : Developer\n"
  38. "BlueHazzard : Developer\n"
  39. + "Miguel Gimenez : Developer\n"
  40. "Ricardo Garcia : All-hands person\n"
  41. "Paul A. Jimenez : Help and AStyle plugins\n"
  42. "Thomas Lorblanches : CodeStat and Profiler plugins\n"
  43. @@ -132,7 +133,6 @@ dlgAbout::dlgAbout(wxWindow* parent)
  44. "Alexandr Efremo : Providing OpenSuSe packages\n"
  45. "Huki : Misc. Code-Completion improvements\n"
  46. "stahta01 : Misc. patches for several enhancements\n"
  47. - "Miguel Gimenez : Misc. patches for several enhancements\n"
  48. "\n"
  49. "All contributors that provided patches.\n"
  50. "The wxWidgets project (http://www.wxwidgets.org).\n"
  51. @@ -171,7 +171,7 @@ dlgAbout::dlgAbout(wxWindow* parent)
  52. if (!desktopEnv.empty())
  53. items.push_back({_("Desktop environment"), desktopEnv });
  54. - items.push_back({_("Scaling factor"), wxString::Format("%f", GetContentScaleFactor())});
  55. + items.push_back({_("Scaling factor"), wxString::Format("%f", cbGetContentScaleFactor(*this))});
  56. items.push_back({_("Detected scaling factor"),
  57. wxString::Format("%f", cbGetActualContentScaleFactor(*this))});
  58. const wxSize displayPPI = wxGetDisplayPPI();