Rename OnDpiChanged() in wxAUI to OnDPIChanged() for consistency All the other wxDPIChangedEvent handlers use the upper-case version, so rename a couple which didn't to follow them.
Fix appearance of controls in wxAuiToolBar after DPI change This was previously broken, e.g. the wxStaticText in the aui sample didn't fit into the toolbar any more after increasing the scaling.
Use more readable pane names in the AUI sample This makes debugging simpler as panes can be identified more easily.
Update AUI layout on DPI change Scale the pane and dock sizes and positions to keep the same layout in the new DPI.
Factor out wxPropertyGrid::ReallocDoubleBufferIfNeeded() No real changes, just extract the code (re)creating m_doubleBuffer into its own function to allow for its reuse in the upcoming commit.
Fix size of text in wxPropertyGrid after DPI change in wxMSW Recreate the bitmap used for double buffering on DPI change to ensure that it uses the correct scaling factor -- otherwise text was not scaled correctly after a DPI change. Closes #26490.
Fix adjusting TLW size after DPI change in wxMSW We changed the size proposed by Windows by the double of the needed amount. Call wxRect::Inflate() with one half of the needed change. This may result in 1px being lost for odd sizes but this is probably not noticeable in practice.
Decrease the size of non-resizeable TLWs on DPI change We avoid decreasing the size of the TLW on DPI change to preserve the user-set size, but this logic doesn't apply to non-resizeable windows as the user couldn't have changed their size, so do shrink them. Closes #26485.
Fix size of the icons loaded by wxICOResourceHandler Changes of b45b02c227 (Fix loading of standard icons recently broken in wxMSW, 2026-05-02) broke computation of the icon size which was left empty for the non-scaled icons. Fix this by always computing this size. See #26370.
Avoid error messages from wxGetOsDescription() under Windows The changes of 90880faafc (Output Windows 'feature update' version in wxGetOsDescription(), 2026-06-01) could result in an error message being logged if "DisplayVersion" value didn't exist in the registry. Check for its existence before trying to read it to avoid this. See #26544.
Merge branch 'aui-dpi-change' Improve handling of DPI changes in wxAUI. Currently pane positions are scaled linearly, which may result in small discrepancies between the initial layout at the given DPI and the layout at the same DPI after a change from another value, but this is still much better than not doing anything. See #26075, #26546.
Merge branch 'pg-dpi-change' Fix text size in wxPropertyGrid after DPI change. See #26549.
Merge branch 'dpi-non-resizeable' Improve TLW resizing on DPI change. See #26550.
Fix rowspan/colspan integer overflow in wxHtmlTableCell::AddCell() AddCell() reads COLSPAN and ROWSPAN from the markup into ints with no upper bound, then uses r + rowspan and c + colspan to grow the cell table and to index ypos[] in Layout(). A value near INT_MAX, e.g. in the second row, overflows the addition so the r + rowspan > m_NumRows growth check is bypassed and Layout() writes past the end of ypos[]. Clamp colspan and rowspan to the limits from the HTML spec (1000 and 65534). Closes #26554.
| ... | ... | @@ -395,7 +395,7 @@ protected: |
| 395 | 395 | void OnChar(wxKeyEvent& event);
|
| 396 | 396 | void OnCaptureLost(wxMouseCaptureLostEvent& evt);
|
| 397 | 397 | void OnSysColourChanged(wxSysColourChangedEvent& event);
|
| 398 | - void OnDpiChanged(wxDPIChangedEvent& event);
|
|
| 398 | + void OnDPIChanged(wxDPIChangedEvent& event);
|
|
| 399 | 399 | |
| 400 | 400 | protected:
|
| 401 | 401 | |
| ... | ... | @@ -657,7 +657,7 @@ protected: |
| 657 | 657 | void OnSize(wxSizeEvent& evt);
|
| 658 | 658 | void OnNavigationKeyNotebook(wxNavigationKeyEvent& event);
|
| 659 | 659 | void OnSysColourChanged(wxSysColourChangedEvent& event);
|
| 660 | - void OnDpiChanged(wxDPIChangedEvent& event);
|
|
| 660 | + void OnDPIChanged(wxDPIChangedEvent& event);
|
|
| 661 | 661 | |
| 662 | 662 | // The functions below are called by wxAuiTabCtrl via wxAuiTabEventSource.
|
| 663 | 663 | //
|
| ... | ... | @@ -640,6 +640,7 @@ protected: |
| 640 | 640 | void OnHintFadeTimer(wxTimerEvent& evt);
|
| 641 | 641 | void OnFindManager(wxAuiManagerEvent& evt);
|
| 642 | 642 | void OnSysColourChanged(wxSysColourChangedEvent& event);
|
| 643 | + void OnDPIChanged(wxDPIChangedEvent& event);
|
|
| 643 | 644 | |
| 644 | 645 | protected:
|
| 645 | 646 |
| ... | ... | @@ -1882,6 +1882,8 @@ private: |
| 1882 | 1882 | |
| 1883 | 1883 | bool ButtonTriggerKeyTest(wxPGKeyboardAction action, wxKeyEvent& event);
|
| 1884 | 1884 | |
| 1885 | + void ReallocDoubleBufferIfNeeded();
|
|
| 1886 | + |
|
| 1885 | 1887 | wxDECLARE_EVENT_TABLE();
|
| 1886 | 1888 | };
|
| 1887 | 1889 |
| ... | ... | @@ -1009,47 +1009,47 @@ MyFrame::MyFrame(wxWindow* parent, |
| 1009 | 1009 | |
| 1010 | 1010 | // add a bunch of panes
|
| 1011 | 1011 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1012 | - Name("test1").Caption("Pane Caption").
|
|
| 1012 | + Name("top").Caption("Pane Caption").
|
|
| 1013 | 1013 | Top());
|
| 1014 | 1014 | |
| 1015 | 1015 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1016 | - Name("test2").Caption("Client Size Reporter").
|
|
| 1016 | + Name("with_close").Caption("Client Size Reporter").
|
|
| 1017 | 1017 | Bottom().Position(1).
|
| 1018 | 1018 | CloseButton(true).MaximizeButton(true));
|
| 1019 | 1019 | |
| 1020 | 1020 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1021 | - Name("test3").Caption("Client Size Reporter").
|
|
| 1021 | + Name("with_close_and_maximize").Caption("Client Size Reporter").
|
|
| 1022 | 1022 | Bottom().
|
| 1023 | 1023 | CloseButton(true).MaximizeButton(true));
|
| 1024 | 1024 | |
| 1025 | 1025 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1026 | - Name("test4").Caption("Pane Caption").
|
|
| 1026 | + Name("left").Caption("Pane Caption").
|
|
| 1027 | 1027 | Left());
|
| 1028 | 1028 | |
| 1029 | 1029 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1030 | - Name("test5").Caption("No Close Button").
|
|
| 1030 | + Name("right").Caption("No Close Button").
|
|
| 1031 | 1031 | Right().CloseButton(false));
|
| 1032 | 1032 | |
| 1033 | 1033 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1034 | - Name("test6").Caption("Client Size Reporter").
|
|
| 1034 | + Name("row_1").Caption("Client Size Reporter").
|
|
| 1035 | 1035 | Right().Row(1).
|
| 1036 | 1036 | CloseButton(true).MaximizeButton(true));
|
| 1037 | 1037 | |
| 1038 | 1038 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1039 | - Name("test7").Caption("Float Client Size 111x222").
|
|
| 1039 | + Name("layer_1").Caption("Float Client Size 111x222").
|
|
| 1040 | 1040 | MinSize(FromDIP(wxSize(11,22))).
|
| 1041 | 1041 | FloatingClientSize(wxSize(111, 222)).
|
| 1042 | 1042 | Left().Layer(1).
|
| 1043 | 1043 | CloseButton(true).MaximizeButton(true));
|
| 1044 | 1044 | |
| 1045 | 1045 | m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
|
| 1046 | - Name("test8").Caption("Tree Pane").
|
|
| 1046 | + Name("tree").Caption("Tree Pane").
|
|
| 1047 | 1047 | Left().Layer(1).Position(1).
|
| 1048 | 1048 | CloseButton(true).MaximizeButton(true).MinimizeButton().
|
| 1049 | 1049 | IconMin(wxArtProvider::GetBitmapBundle(wxART_CUT, wxART_MENU)));
|
| 1050 | 1050 | |
| 1051 | 1051 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1052 | - Name("test9").Caption("Min Size 200x100").
|
|
| 1052 | + Name("minsize_200x100").Caption("Min Size 200x100").
|
|
| 1053 | 1053 | BestSize(FromDIP(wxSize(200,100))).MinSize(FromDIP(wxSize(200,100))).
|
| 1054 | 1054 | Bottom().Layer(1).
|
| 1055 | 1055 | CloseButton(true).MaximizeButton(true));
|
| ... | ... | @@ -1063,7 +1063,7 @@ MyFrame::MyFrame(wxWindow* parent, |
| 1063 | 1063 | iconSize &= ~1;
|
| 1064 | 1064 | |
| 1065 | 1065 | m_mgr.AddPane(wnd10, wxAuiPaneInfo().
|
| 1066 | - Name("test10").Caption("Text Pane with Hide Prompt").
|
|
| 1066 | + Name("text").Caption("Text Pane with Hide Prompt").
|
|
| 1067 | 1067 | Bottom().Layer(1).Position(1).
|
| 1068 | 1068 | MaximizeButton().MinimizeButton().
|
| 1069 | 1069 | Icon(wxArtProvider::GetBitmapBundle(wxART_WARNING,
|
| ... | ... | @@ -1072,7 +1072,7 @@ MyFrame::MyFrame(wxWindow* parent, |
| 1072 | 1072 | IconMin(wxArtProvider::GetBitmapBundle(wxART_PASTE, wxART_MENU)));
|
| 1073 | 1073 | |
| 1074 | 1074 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
| 1075 | - Name("test11").Caption("Fixed Pane").
|
|
| 1075 | + Name("fixed").Caption("Fixed Pane").
|
|
| 1076 | 1076 | Bottom().Layer(1).Position(2).Fixed());
|
| 1077 | 1077 | |
| 1078 | 1078 | |
| ... | ... | @@ -1102,28 +1102,28 @@ MyFrame::MyFrame(wxWindow* parent, |
| 1102 | 1102 | |
| 1103 | 1103 | // add the toolbars to the manager
|
| 1104 | 1104 | m_mgr.AddPane(tb1, wxAuiPaneInfo().
|
| 1105 | - Name("tb1").Caption("Big Toolbar").
|
|
| 1105 | + Name("horz_tb").Caption("Big Toolbar").
|
|
| 1106 | 1106 | ToolbarPane().Top());
|
| 1107 | 1107 | |
| 1108 | 1108 | m_mgr.AddPane(tb2, wxAuiPaneInfo().
|
| 1109 | - Name("tb2").Caption("Toolbar 2 (Horizontal)").
|
|
| 1109 | + Name("question_icon_tb").Caption("Toolbar 2 (Horizontal)").
|
|
| 1110 | 1110 | ToolbarPane().Top().Row(1));
|
| 1111 | 1111 | |
| 1112 | 1112 | m_mgr.AddPane(tb3, wxAuiPaneInfo().
|
| 1113 | - Name("tb3").Caption("Toolbar 3").
|
|
| 1113 | + Name("folder_icon_tb").Caption("Toolbar 3").
|
|
| 1114 | 1114 | ToolbarPane().Top().Row(1).Position(1));
|
| 1115 | 1115 | |
| 1116 | 1116 | m_mgr.AddPane(tb4, wxAuiPaneInfo().
|
| 1117 | - Name("tb4").Caption("Sample Bookmark Toolbar").
|
|
| 1117 | + Name("bookmark_tb").Caption("Sample Bookmark Toolbar").
|
|
| 1118 | 1118 | ToolbarPane().Top().Row(2));
|
| 1119 | 1119 | |
| 1120 | 1120 | m_mgr.AddPane(tb5, wxAuiPaneInfo().
|
| 1121 | - Name("tb5").Caption("Sample Vertical Toolbar").
|
|
| 1121 | + Name("vert_tb").Caption("Sample Vertical Toolbar").
|
|
| 1122 | 1122 | ToolbarPane().Left().
|
| 1123 | 1123 | GripperTop());
|
| 1124 | 1124 | |
| 1125 | 1125 | m_mgr.AddPane(new wxButton(this, wxID_ANY, _("Test Button")),
|
| 1126 | - wxAuiPaneInfo().Name("tb6").
|
|
| 1126 | + wxAuiPaneInfo().Name("button_tb").
|
|
| 1127 | 1127 | ToolbarPane().Top().Row(2).Position(1).
|
| 1128 | 1128 | LeftDockable(false).RightDockable(false));
|
| 1129 | 1129 | |
| ... | ... | @@ -1136,10 +1136,10 @@ MyFrame::MyFrame(wxWindow* parent, |
| 1136 | 1136 | if (!pane.IsToolbar())
|
| 1137 | 1137 | pane.Hide();
|
| 1138 | 1138 | }
|
| 1139 | - m_mgr.GetPane("tb1").Hide();
|
|
| 1140 | - m_mgr.GetPane("tb6").Hide();
|
|
| 1141 | - m_mgr.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0);
|
|
| 1142 | - m_mgr.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0);
|
|
| 1139 | + m_mgr.GetPane("horz_tb").Hide();
|
|
| 1140 | + m_mgr.GetPane("button_tb").Hide();
|
|
| 1141 | + m_mgr.GetPane("tree").Show().Left().Layer(0).Row(0).Position(0);
|
|
| 1142 | + m_mgr.GetPane("text").Show().Bottom().Layer(0).Row(0).Position(0);
|
|
| 1143 | 1143 | m_mgr.GetPane("notebook_content").Show();
|
| 1144 | 1144 | wxString perspectiveDefault = m_mgr.SavePerspective();
|
| 1145 | 1145 | |
| ... | ... | @@ -1650,7 +1650,7 @@ void MyFrame::OnNotebookDeleteTab(wxCommandEvent& WXUNUSED(evt)) |
| 1650 | 1650 | |
| 1651 | 1651 | void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
|
| 1652 | 1652 | {
|
| 1653 | - if (evt.pane->name == "test10")
|
|
| 1653 | + if (evt.pane->name == "text")
|
|
| 1654 | 1654 | {
|
| 1655 | 1655 | int res = wxMessageBox("Are you sure you want to close/hide this pane?",
|
| 1656 | 1656 | "wxAUI",
|
| ... | ... | @@ -2477,6 +2477,25 @@ void wxAuiToolBar::OnIdle(wxIdleEvent& evt) |
| 2477 | 2477 | |
| 2478 | 2478 | void wxAuiToolBar::OnDPIChanged(wxDPIChangedEvent& event)
|
| 2479 | 2479 | {
|
| 2480 | + for ( auto& item : m_items )
|
|
| 2481 | + {
|
|
| 2482 | + switch ( item.m_kind )
|
|
| 2483 | + {
|
|
| 2484 | + case wxITEM_NORMAL:
|
|
| 2485 | + case wxITEM_CHECK:
|
|
| 2486 | + case wxITEM_RADIO:
|
|
| 2487 | + case wxITEM_SEPARATOR:
|
|
| 2488 | + case wxITEM_LABEL:
|
|
| 2489 | + break;
|
|
| 2490 | + |
|
| 2491 | + case wxITEM_CONTROL:
|
|
| 2492 | + // Take into account the new minimum control size when
|
|
| 2493 | + // performing layout in Realize() called below.
|
|
| 2494 | + item.m_minSize = item.m_window->GetEffectiveMinSize();
|
|
| 2495 | + break;
|
|
| 2496 | + }
|
|
| 2497 | + }
|
|
| 2498 | + |
|
| 2480 | 2499 | Realize();
|
| 2481 | 2500 | |
| 2482 | 2501 | event.Skip();
|
| ... | ... | @@ -1300,7 +1300,7 @@ wxBEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl) |
| 1300 | 1300 | EVT_CHAR(wxAuiTabCtrl::OnChar)
|
| 1301 | 1301 | EVT_MOUSE_CAPTURE_LOST(wxAuiTabCtrl::OnCaptureLost)
|
| 1302 | 1302 | EVT_SYS_COLOUR_CHANGED(wxAuiTabCtrl::OnSysColourChanged)
|
| 1303 | - EVT_DPI_CHANGED(wxAuiTabCtrl::OnDpiChanged)
|
|
| 1303 | + EVT_DPI_CHANGED(wxAuiTabCtrl::OnDPIChanged)
|
|
| 1304 | 1304 | wxEND_EVENT_TABLE()
|
| 1305 | 1305 | |
| 1306 | 1306 | |
| ... | ... | @@ -1871,7 +1871,7 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event) |
| 1871 | 1871 | event.Skip();
|
| 1872 | 1872 | }
|
| 1873 | 1873 | |
| 1874 | -void wxAuiTabCtrl::OnDpiChanged(wxDPIChangedEvent& event)
|
|
| 1874 | +void wxAuiTabCtrl::OnDPIChanged(wxDPIChangedEvent& event)
|
|
| 1875 | 1875 | {
|
| 1876 | 1876 | m_art->UpdateDpi();
|
| 1877 | 1877 | event.Skip();
|
| ... | ... | @@ -2033,7 +2033,7 @@ wxBEGIN_EVENT_TABLE(wxAuiNotebook, wxBookCtrlBase) |
| 2033 | 2033 | EVT_CHILD_FOCUS(wxAuiNotebook::OnChildFocusNotebook)
|
| 2034 | 2034 | EVT_NAVIGATION_KEY(wxAuiNotebook::OnNavigationKeyNotebook)
|
| 2035 | 2035 | EVT_SYS_COLOUR_CHANGED(wxAuiNotebook::OnSysColourChanged)
|
| 2036 | - EVT_DPI_CHANGED(wxAuiNotebook::OnDpiChanged)
|
|
| 2036 | + EVT_DPI_CHANGED(wxAuiNotebook::OnDPIChanged)
|
|
| 2037 | 2037 | wxEND_EVENT_TABLE()
|
| 2038 | 2038 | |
| 2039 | 2039 | namespace
|
| ... | ... | @@ -2068,7 +2068,7 @@ void wxAuiNotebook::OnSysColourChanged(wxSysColourChangedEvent &event) |
| 2068 | 2068 | Refresh();
|
| 2069 | 2069 | }
|
| 2070 | 2070 | |
| 2071 | -void wxAuiNotebook::OnDpiChanged(wxDPIChangedEvent& event)
|
|
| 2071 | +void wxAuiNotebook::OnDPIChanged(wxDPIChangedEvent& event)
|
|
| 2072 | 2072 | {
|
| 2073 | 2073 | UpdateTabCtrlHeight();
|
| 2074 | 2074 | event.Skip();
|
| ... | ... | @@ -616,6 +616,38 @@ void wxAuiManager::OnSysColourChanged(wxSysColourChangedEvent& event) |
| 616 | 616 | event.Skip(true);
|
| 617 | 617 | }
|
| 618 | 618 | |
| 619 | +void wxAuiManager::OnDPIChanged(wxDPIChangedEvent& event)
|
|
| 620 | +{
|
|
| 621 | + event.Skip();
|
|
| 622 | + |
|
| 623 | + for( wxAuiPaneInfo& pinfo : GetAllPanes() )
|
|
| 624 | + {
|
|
| 625 | + pinfo.min_size = event.Scale(pinfo.min_size);
|
|
| 626 | + pinfo.best_size = event.Scale(pinfo.best_size);
|
|
| 627 | + |
|
| 628 | + switch ( pinfo.dock_direction )
|
|
| 629 | + {
|
|
| 630 | + case wxAUI_DOCK_LEFT:
|
|
| 631 | + case wxAUI_DOCK_RIGHT:
|
|
| 632 | + case wxAUI_DOCK_CENTER:
|
|
| 633 | + pinfo.dock_pos = event.ScaleY(pinfo.dock_pos);
|
|
| 634 | + pinfo.dock_size = event.ScaleY(pinfo.dock_size);
|
|
| 635 | + break;
|
|
| 636 | + |
|
| 637 | + case wxAUI_DOCK_TOP:
|
|
| 638 | + case wxAUI_DOCK_BOTTOM:
|
|
| 639 | + pinfo.dock_pos = event.ScaleX(pinfo.dock_pos);
|
|
| 640 | + pinfo.dock_size = event.ScaleX(pinfo.dock_size);
|
|
| 641 | + break;
|
|
| 642 | + }
|
|
| 643 | + }
|
|
| 644 | + |
|
| 645 | + // Force recreating the docks after updating the panes.
|
|
| 646 | + m_docks.clear();
|
|
| 647 | + |
|
| 648 | + Update();
|
|
| 649 | +}
|
|
| 650 | + |
|
| 619 | 651 | // creates a floating frame for the windows
|
| 620 | 652 | wxAuiFloatingFrame* wxAuiManager::CreateFloatingFrame(wxWindow* parent,
|
| 621 | 653 | const wxAuiPaneInfo& paneInfo)
|
| ... | ... | @@ -773,6 +805,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd) |
| 773 | 805 | m_frame->Bind(wxEVT_CHILD_FOCUS, &wxAuiManager::OnChildFocus, this);
|
| 774 | 806 | m_frame->Bind(wxEVT_AUI_FIND_MANAGER, &wxAuiManager::OnFindManager, this);
|
| 775 | 807 | m_frame->Bind(wxEVT_SYS_COLOUR_CHANGED, &wxAuiManager::OnSysColourChanged, this);
|
| 808 | + m_frame->Bind(wxEVT_DPI_CHANGED, &wxAuiManager::OnDPIChanged, this);
|
|
| 776 | 809 | |
| 777 | 810 | #if wxUSE_MDI
|
| 778 | 811 | // if the owner is going to manage an MDI parent frame,
|
| ... | ... | @@ -828,6 +861,7 @@ void wxAuiManager::UnInit() |
| 828 | 861 | m_frame->Unbind(wxEVT_CHILD_FOCUS, &wxAuiManager::OnChildFocus, this);
|
| 829 | 862 | m_frame->Unbind(wxEVT_AUI_FIND_MANAGER, &wxAuiManager::OnFindManager, this);
|
| 830 | 863 | m_frame->Unbind(wxEVT_SYS_COLOUR_CHANGED, &wxAuiManager::OnSysColourChanged, this);
|
| 864 | + m_frame->Unbind(wxEVT_DPI_CHANGED, &wxAuiManager::OnDPIChanged, this);
|
|
| 831 | 865 | m_frame = nullptr;
|
| 832 | 866 | }
|
| 833 | 867 | }
|
| ... | ... | @@ -330,6 +330,15 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) |
| 330 | 330 | if (m_CellInfo[r][c].rowspan < 1)
|
| 331 | 331 | m_CellInfo[r][c].rowspan = 1;
|
| 332 | 332 | |
| 333 | + // The values come straight from the markup and are used below as
|
|
| 334 | + // r + rowspan and c + colspan, which overflow for values near INT_MAX
|
|
| 335 | + // and so bypass the bounds growth, resulting in an out-of-bounds access
|
|
| 336 | + // in Layout(). Clamp them to the limits used by the HTML specification.
|
|
| 337 | + if (m_CellInfo[r][c].colspan > 1000)
|
|
| 338 | + m_CellInfo[r][c].colspan = 1000;
|
|
| 339 | + if (m_CellInfo[r][c].rowspan > 65534)
|
|
| 340 | + m_CellInfo[r][c].rowspan = 65534;
|
|
| 341 | + |
|
| 333 | 342 | if ((m_CellInfo[r][c].colspan > 1) || (m_CellInfo[r][c].rowspan > 1))
|
| 334 | 343 | {
|
| 335 | 344 | int i, j;
|
| ... | ... | @@ -618,7 +618,7 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, |
| 618 | 618 | desiredHeight = 0;
|
| 619 | 619 | }
|
| 620 | 620 | |
| 621 | - bool iconMayBeScaled = false;
|
|
| 621 | + double scale = 1.0;
|
|
| 622 | 622 | |
| 623 | 623 | // try to load the icon from this program first to allow overriding the
|
| 624 | 624 | // standard icons (although why one would want to do it considering that
|
| ... | ... | @@ -643,9 +643,10 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, |
| 643 | 643 | wxLogLastError(wxString::Format("LoadIcon(%s)", entry.name));
|
| 644 | 644 | }
|
| 645 | 645 | |
| 646 | - // LoadIcon() may scale the icon in high DPI, so get its actual
|
|
| 647 | - // size below.
|
|
| 648 | - iconMayBeScaled = true;
|
|
| 646 | + // LoadIcon() may scale the icon in high DPI, ensure we use correct
|
|
| 647 | + // scale factor for it.
|
|
| 648 | + if ( const wxWindow* win = wxApp::GetMainTopWindow() )
|
|
| 649 | + scale = win->GetDPIScaleFactor();
|
|
| 649 | 650 | }
|
| 650 | 651 | }
|
| 651 | 652 | |
| ... | ... | @@ -653,19 +654,14 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, |
| 653 | 654 | return false;
|
| 654 | 655 | |
| 655 | 656 | wxSize size;
|
| 656 | - double scale = 1.0;
|
|
| 657 | 657 | if ( hasSize )
|
| 658 | 658 | {
|
| 659 | 659 | size.x = desiredWidth;
|
| 660 | 660 | size.y = desiredHeight;
|
| 661 | 661 | }
|
| 662 | - else if ( iconMayBeScaled )
|
|
| 662 | + else
|
|
| 663 | 663 | {
|
| 664 | - // LoadIcon() returns icons of scaled size, so we must use the correct
|
|
| 665 | - // scaling factor of them.
|
|
| 666 | 664 | size = wxGetHiconSize(hicon);
|
| 667 | - if ( const wxWindow* win = wxApp::GetMainTopWindow() )
|
|
| 668 | - scale = win->GetDPIScaleFactor();
|
|
| 669 | 665 | }
|
| 670 | 666 | |
| 671 | 667 | return icon->InitFromHICON((WXHICON)hicon, size.x, size.y, scale);
|
| ... | ... | @@ -311,14 +311,24 @@ bool wxNonOwnedWindow::HandleDPIChange(const wxSize& newDPI, const wxRect& newRe |
| 311 | 311 | {
|
| 312 | 312 | const wxSize minSize = ClientToWindowSize(sizer->GetMinSize());
|
| 313 | 313 | wxSize diff = minSize - newRect.GetSize();
|
| 314 | - diff.IncTo(wxSize(0, 0));
|
|
| 314 | + |
|
| 315 | + // We don't want to shrink the window as if the user had increased
|
|
| 316 | + // it beyond its minimum size, we should not make it smaller again
|
|
| 317 | + // just because the DPI has changed, but if the window is not
|
|
| 318 | + // resizeable, then we do want to make it exactly of its minimum
|
|
| 319 | + // size because the user couldn't resize it and making it bigger
|
|
| 320 | + // than needed would just show unnecessary extra empty space.
|
|
| 321 | + if ( HasFlag(wxRESIZE_BORDER) )
|
|
| 322 | + {
|
|
| 323 | + diff.IncTo(wxSize(0, 0));
|
|
| 324 | + }
|
|
| 315 | 325 | |
| 316 | 326 | // Use wxRect::Inflate() to ensure that the center of the bigger
|
| 317 | 327 | // rectangle is at the same position as the center of the proposed
|
| 318 | 328 | // one, to prevent moving the window back to the old display from
|
| 319 | 329 | // which it might have been just moved to this one, as doing this
|
| 320 | 330 | // would result in an infinite stream of WM_DPICHANGED messages.
|
| 321 | - actualNewRect.Inflate(diff);
|
|
| 331 | + actualNewRect.Inflate(diff / 2);
|
|
| 322 | 332 | }
|
| 323 | 333 | |
| 324 | 334 | SetSize(actualNewRect);
|
| ... | ... | @@ -1241,9 +1241,12 @@ wxString wxGetOsDescription() |
| 1241 | 1241 | |
| 1242 | 1242 | if ( key.Exists() )
|
| 1243 | 1243 | {
|
| 1244 | + constexpr const char* VALUE_DISPLAY_VERSION = "DisplayVersion";
|
|
| 1245 | + |
|
| 1244 | 1246 | wxString displayVersion;
|
| 1245 | - if ( key.QueryValue("DisplayVersion", displayVersion)
|
|
| 1246 | - && !displayVersion.empty() )
|
|
| 1247 | + if ( key.HasValue(VALUE_DISPLAY_VERSION) &&
|
|
| 1248 | + key.QueryValue(VALUE_DISPLAY_VERSION, displayVersion) &&
|
|
| 1249 | + !displayVersion.empty() )
|
|
| 1247 | 1250 | {
|
| 1248 | 1251 | str << " " << displayVersion;
|
| 1249 | 1252 | }
|
| ... | ... | @@ -1367,6 +1367,15 @@ void wxPropertyGrid::OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event |
| 1367 | 1367 | void wxPropertyGrid::OnDPIChanged(wxDPIChangedEvent &event)
|
| 1368 | 1368 | {
|
| 1369 | 1369 | CalculateFontAndBitmapStuff(m_vspacing);
|
| 1370 | + |
|
| 1371 | + if ( !HasExtraStyle(wxPG_EX_NATIVE_DOUBLE_BUFFERING) )
|
|
| 1372 | + {
|
|
| 1373 | + // Recreate the back buffer with correct DPI.
|
|
| 1374 | + delete m_doubleBuffer;
|
|
| 1375 | + m_doubleBuffer = nullptr;
|
|
| 1376 | + ReallocDoubleBufferIfNeeded();
|
|
| 1377 | + }
|
|
| 1378 | + |
|
| 1370 | 1379 | Refresh();
|
| 1371 | 1380 | |
| 1372 | 1381 | if ( wxPGProperty* const selected = GetSelection() )
|
| ... | ... | @@ -4561,17 +4570,8 @@ void wxPropertyGrid::RecalculateVirtualSize( int forceXPos ) |
| 4561 | 4570 | |
| 4562 | 4571 | // -----------------------------------------------------------------------
|
| 4563 | 4572 | |
| 4564 | -void wxPropertyGrid::OnResize( wxSizeEvent& event )
|
|
| 4573 | +void wxPropertyGrid::ReallocDoubleBufferIfNeeded()
|
|
| 4565 | 4574 | {
|
| 4566 | - if ( !(m_iFlags & wxPG_FL_INITIALIZED) )
|
|
| 4567 | - return;
|
|
| 4568 | - |
|
| 4569 | - int width, height;
|
|
| 4570 | - GetClientSize(&width, &height);
|
|
| 4571 | - |
|
| 4572 | - m_width = width;
|
|
| 4573 | - m_height = height;
|
|
| 4574 | - |
|
| 4575 | 4575 | if ( !HasExtraStyle(wxPG_EX_NATIVE_DOUBLE_BUFFERING) )
|
| 4576 | 4576 | {
|
| 4577 | 4577 | double scaleFactor = GetDPIScaleFactor();
|
| ... | ... | @@ -4579,8 +4579,8 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event ) |
| 4579 | 4579 | if ( !m_doubleBuffer )
|
| 4580 | 4580 | {
|
| 4581 | 4581 | // Create double buffer bitmap to draw on, if none
|
| 4582 | - int w = wxMax(width, FromDIP(250));
|
|
| 4583 | - int h = wxMax(height + dblh, FromDIP(400));
|
|
| 4582 | + int w = wxMax(m_width, FromDIP(250));
|
|
| 4583 | + int h = wxMax(m_height + dblh, FromDIP(400));
|
|
| 4584 | 4584 | m_doubleBuffer = new wxBitmap;
|
| 4585 | 4585 | m_doubleBuffer->CreateWithLogicalSize( w, h, scaleFactor );
|
| 4586 | 4586 | }
|
| ... | ... | @@ -4590,16 +4590,30 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event ) |
| 4590 | 4590 | int h = m_doubleBuffer->GetLogicalHeight();
|
| 4591 | 4591 | |
| 4592 | 4592 | // Double buffer must be large enough
|
| 4593 | - if ( w < width || h < (height+dblh) )
|
|
| 4593 | + if ( w < m_width || h < (m_height+dblh) )
|
|
| 4594 | 4594 | {
|
| 4595 | - if ( w < width ) w = width;
|
|
| 4596 | - if ( h < (height+dblh) ) h = height + dblh;
|
|
| 4595 | + if ( w < m_width ) w = m_width;
|
|
| 4596 | + if ( h < (m_height+dblh) ) h = m_height + dblh;
|
|
| 4597 | 4597 | delete m_doubleBuffer;
|
| 4598 | 4598 | m_doubleBuffer = new wxBitmap;
|
| 4599 | 4599 | m_doubleBuffer->CreateWithLogicalSize( w, h, scaleFactor );
|
| 4600 | 4600 | }
|
| 4601 | 4601 | }
|
| 4602 | 4602 | }
|
| 4603 | +}
|
|
| 4604 | + |
|
| 4605 | +void wxPropertyGrid::OnResize( wxSizeEvent& event )
|
|
| 4606 | +{
|
|
| 4607 | + if ( !(m_iFlags & wxPG_FL_INITIALIZED) )
|
|
| 4608 | + return;
|
|
| 4609 | + |
|
| 4610 | + int width, height;
|
|
| 4611 | + GetClientSize(&width, &height);
|
|
| 4612 | + |
|
| 4613 | + m_width = width;
|
|
| 4614 | + m_height = height;
|
|
| 4615 | + |
|
| 4616 | + ReallocDoubleBufferIfNeeded();
|
|
| 4603 | 4617 | |
| 4604 | 4618 | m_pState->OnClientWidthChange( width, event.GetSize().x - m_ncWidth, true );
|
| 4605 | 4619 | m_ncWidth = event.GetSize().x;
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help