f2f127cf5cd97c7da6a957a3f7764cb25cc9017e.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From f2f127cf5cd97c7da6a957a3f7764cb25cc9017e Mon Sep 17 00:00:00 2001
  2. From: fuscated <fuscated@2a5c6006-c6dd-42ca-98ab-0921f2732cef>
  3. Date: Tue, 16 Mar 2021 23:28:35 +0000
  4. Subject: [PATCH] * UI: Add display info in the Help -> About -> Information
  5. dialog
  6. > There are many reports of people having trouble with either multi monitor
  7. setups or HiDPI setups. It would be a lot easier if they could gather
  8. the information form one single place.
  9. > Note0: The scaling factors are based on the scaling factors of the About
  10. dialog. In a system which supports monitors with different PPIs it might
  11. report the incorrect value.
  12. > Note1: wxGetDisplayPPI is also some global and not per display.
  13. git-svn-id: https://svn.code.sf.net/p/codeblocks/code/trunk@12305 2a5c6006-c6dd-42ca-98ab-0921f2732cef
  14. ---
  15. src/src/dlgabout.cpp | 29 +++++++++++++++++++++++++++++
  16. 1 file changed, 29 insertions(+)
  17. diff --git a/src/src/dlgabout.cpp b/src/src/dlgabout.cpp
  18. index 2afeeabac..1df51142a 100644
  19. --- a/src/src/dlgabout.cpp
  20. +++ b/src/src/dlgabout.cpp
  21. @@ -31,6 +31,7 @@
  22. #include <wx/bitmap.h>
  23. #include <wx/dcmemory.h> // wxMemoryDC
  24. +#include <wx/display.h>
  25. #include <wx/statbmp.h>
  26. #include "appglobals.h"
  27. @@ -164,10 +165,38 @@ dlgAbout::dlgAbout(wxWindow* parent)
  28. items.push_back({_("Version"), appglobals::AppActualVersion});
  29. items.push_back({_("SDK Version"), appglobals::AppSDKVersion});
  30. items.push_back({_("Scintilla Version"), scintillaStr});
  31. +
  32. items.push_back({_("Author"), _("The Code::Blocks Team")});
  33. items.push_back({_("E-mail"), appglobals::AppContactEmail});
  34. items.push_back({_("Website"), appglobals::AppUrl});
  35. + items.push_back({_("Scaling factor"), wxString::Format("%f", GetContentScaleFactor())});
  36. + items.push_back({_("Detected scaling factor"),
  37. + wxString::Format("%f", cbGetActualContentScaleFactor(*this))});
  38. + const wxSize displayPPI = wxGetDisplayPPI();
  39. + items.push_back({_("Display PPI"), wxString::Format("%dx%d", displayPPI.x, displayPPI.y)});
  40. +
  41. + unsigned displays = wxDisplay::GetCount();
  42. + items.push_back({_("Display count"), wxString::Format("%u", displays)});
  43. +
  44. + for (unsigned ii = 0; ii < displays; ++ii)
  45. + {
  46. + wxDisplay display(ii);
  47. +
  48. + Item item;
  49. + item.name = wxString::Format(_("Display %u"), ii);
  50. +
  51. + const wxString &name = display.GetName();
  52. + if (!name.empty())
  53. + item.name += " (" + name + ")";
  54. +
  55. + const wxRect geometry = display.GetGeometry();
  56. + item.value= wxString::Format(_("XY=[%d,%d]; Size=[%d,%d]; %s"), geometry.GetLeft(),
  57. + geometry.GetTop(), geometry.GetWidth(), geometry.GetHeight(),
  58. + (display.IsPrimary() ? _("Primary") : wxString()));
  59. + items.push_back(item);
  60. + }
  61. +
  62. int maxNameLength = 0;
  63. for (const Item &item : items)
  64. {