13
0

Fix crash when changing UI scale on Windows

When the UI scale changes without the Recorder UI being shown
at least once, the Widgets have not yet been realized, size-groups
not evaluated, and a widget size of 1x1 is assumed.
This commit is contained in:
Robin Gareus 2021-08-10 04:15:15 +02:00
parent 738d36b5b7
commit fb8112eb7e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 17 additions and 3 deletions

View File

@ -241,6 +241,15 @@ InputPortMonitor::InputScope::InputScope (samplecnt_t rate, int l, int g, Orient
parameter_changed ("waveform-clip-level");
parameter_changed ("show-waveform-clipping");
parameter_changed ("waveform-scale");
UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &InputPortMonitor::InputScope::dpi_reset));
}
void
InputPortMonitor::InputScope::dpi_reset ()
{
if (is_realized ()) {
queue_resize ();
}
}
void
@ -282,7 +291,7 @@ InputPortMonitor::InputScope::on_size_allocate (Gtk::Allocation& a)
}
if (a.get_width () != w || a.get_height () != h) {
_surface = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, a.get_width () - 2, a.get_height () - 2);
_surface = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, std::max (1, a.get_width () - 2), std::max (1, a.get_height () - 2));
}
}
@ -444,7 +453,9 @@ InputPortMonitor::EventMeter::dpi_reset ()
_layout->get_pixel_size (_length, _extent);
_extent += 2;
_length += 2;
queue_resize ();
if (is_realized ()) {
queue_resize ();
}
}
void
@ -551,7 +562,9 @@ InputPortMonitor::EventMonitor::dpi_reset ()
_layout->get_pixel_size (_width, _height);
_width += 2;
_height += 2;
queue_resize ();
if (is_realized ()) {
queue_resize ();
}
}
void

View File

@ -64,6 +64,7 @@ private:
void on_size_allocate (Gtk::Allocation&);
private:
void dpi_reset ();
int _pos;
ARDOUR::samplecnt_t _rate;