Skip to content

Commit 5d2af76

Browse files
committed
MyFrameMain: work around side pane layout quirk on resize
When resizing, the listboxes inside the side pane would be offset to the upper left, this rather ugly workaround prevents this. Related to 501c795 Try to revert this once a newer wxWidgets version might have fixed this.
1 parent 31e9585 commit 5d2af76

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/gui/MyFrameMain.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ BEGIN_EVENT_TABLE(MyFrameMain, FrameMain)
5656
EVT_END_PROCESS (ID_WINDOWSHARE_PROC_END, MyFrameMain::onWindowshareTerminate)
5757
EVT_FULLSCREEN (MyFrameMain::onFullScreenChanged)
5858
EVT_SYS_COLOUR_CHANGED(MyFrameMain::onSysColourChanged)
59+
EVT_SIZE(MyFrameMain::onSize)
5960
END_EVENT_TABLE()
6061

6162

@@ -791,6 +792,29 @@ void MyFrameMain::onSysColourChanged(wxSysColourChangedEvent& event)
791792

792793

793794

795+
void MyFrameMain::onSize(wxSizeEvent& event)
796+
{
797+
#ifdef __WXMAC__
798+
// Force proper layout calculation by temporarily adjusting sash positions
799+
// This mimics what happens when user manually moves the sash
800+
CallAfter([this]() {
801+
if (splitwin_main->IsSplit() && splitwin_left->IsSplit()) {
802+
// Store current sash position
803+
int current_sash = splitwin_left->GetSashPosition();
804+
805+
// Force layout recalculation by temporarily moving the sash
806+
splitwin_left->SetSashPosition(current_sash + 1);
807+
splitwin_left->SetSashPosition(current_sash);
808+
809+
// Ensure proper layout
810+
splitwin_left->Layout();
811+
}
812+
});
813+
#endif
814+
event.Skip(); // Allow the event to propagate
815+
}
816+
817+
794818
void MyFrameMain::onVNCConnGetPasswordNotify(wxCommandEvent &event)
795819
{
796820
// get sender

src/gui/MyFrameMain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class MyFrameMain: public FrameMain
107107
void onSDNotify(wxCommandEvent& event);
108108
void onFullScreenChanged(wxFullScreenEvent &event);
109109
void onSysColourChanged(wxSysColourChangedEvent& event);
110+
void onSize(wxSizeEvent& event);
110111

111112
bool saveStats(VNCConn* c, int conn_index, const wxArrayString& stats, wxString desc, bool autosave);
112113

0 commit comments

Comments
 (0)