Skip to content

Commit

Permalink
ViewerWindow: centralise VNCCanvas size setting
Browse files Browse the repository at this point in the history
  • Loading branch information
bk138 committed Jan 21, 2024
1 parent e37c848 commit 8633203
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/gui/ViewerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class VNCCanvas: public wxPanel
DECLARE_EVENT_TABLE();

public:
/// Creates a new canvas with 0,0 size. Need to call adjustCanvasSize()!
VNCCanvas(wxWindow* parent, VNCConn* c);
void grab_keyboard();
void ungrab_keyboard();
Expand Down Expand Up @@ -102,11 +103,6 @@ VNCCanvas::VNCCanvas(wxWindow* parent, VNCConn* c):

update_timer.SetOwner(this, VNCCANVAS_UPDATE_TIMER_ID);
update_timer.Start(VNCCANVAS_UPDATE_TIMER_INTERVAL);

// SetSize() isn't enough...
SetInitialSize(wxSize(c->getFrameBufferWidth(), c->getFrameBufferHeight()));
CentreOnParent();
parent->Layout();
}


Expand Down Expand Up @@ -371,6 +367,7 @@ ViewerWindow::ViewerWindow(wxWindow* parent, VNCConn* conn):
*/
canvas_container->SetSizer(new wxBoxSizer(wxHORIZONTAL));
canvas = new VNCCanvas(canvas_container, conn);
adjustCanvasSize();
wxBoxSizer* sizer_vert_canvas = new wxBoxSizer(wxVERTICAL);
sizer_vert_canvas->Add(canvas, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL);
canvas_container->GetSizer()->Add(sizer_vert_canvas, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL);
Expand Down

0 comments on commit 8633203

Please sign in to comment.