Backport Buschbeck's buff to canvas repainting

The changes in 568d9cc6 that effectively
eliminate tearing of objects as they are dragged around on the canvas
are introduced here.
parent a42a4d56
Pipeline #181377644 passed with stages
in 89 minutes and 38 seconds
......@@ -144,8 +144,6 @@ struct SPCanvasClass {
namespace {
gint const UPDATE_PRIORITY = G_PRIORITY_DEFAULT_IDLE;
GdkWindow *getWindow(SPCanvas *canvas)
{
return gtk_widget_get_window(reinterpret_cast<GtkWidget *>(canvas));
......@@ -2593,10 +2591,13 @@ gint SPCanvas::idle_handler(gpointer data)
void SPCanvas::addIdle()
{
if (_idle_id == 0) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint redrawPriority = prefs->getIntLimited("/options/redrawpriority/value", G_PRIORITY_HIGH_IDLE, G_PRIORITY_HIGH_IDLE, G_PRIORITY_DEFAULT_IDLE);
#ifdef DEBUG_PERFORMANCE
_idle_time = g_get_monotonic_time();
#endif
_idle_id = gdk_threads_add_idle_full(UPDATE_PRIORITY, idle_handler, this, nullptr);
_idle_id = gdk_threads_add_idle_full(redrawPriority, idle_handler, this, nullptr);
#ifdef DEBUG_PERFORMANCE
g_message("[%i] launched %f", _idle_id, _totalelapsed / (double)1000000);
#endif
......
......@@ -1026,7 +1026,6 @@ void InkscapePreferences::initPageUI()
_page_ui.add_line( false, _("_Zoom correction factor (in %):"), _ui_zoom_correction, "",
_("Adjust the slider until the length of the ruler on your screen matches its real length. This information is used when zooming to 1:1, 1:2, etc., to display objects in their true sizes"), true);
_ui_partialdynamic.init( _("Enable dynamic relayout for incomplete sections"), "/options/workarounds/dynamicnotdone", false);
_page_ui.add_line( false, "", _ui_partialdynamic, "",
_("When on, will allow dynamic layout of components that are not completely finished being refactored"), true);
......@@ -2004,6 +2003,20 @@ void InkscapePreferences::initPageRendering()
_page_rendering.add_line(false, _("Rendering XRay radius:"), _rendering_xray_radius, "",
_("XRay mode radius preview"), false);
{
// if these GTK constants ever change, consider adding a compatibility shim to SPCanvas::addIdle()
static_assert(G_PRIORITY_HIGH_IDLE == 100, "G_PRIORITY_HIGH_IDLE must be 100 to match preferences.xml");
static_assert(G_PRIORITY_DEFAULT_IDLE == 200, "G_PRIORITY_DEFAULT_IDLE must be 200 to match preferences.xml");
Glib::ustring redrawPriorityLabels[] = {_("Responsive"), _("Conservative")};
int redrawPriorityValues[] = {G_PRIORITY_HIGH_IDLE, G_PRIORITY_DEFAULT_IDLE};
// redraw priority
_rendering_redraw_priority.init("/options/redrawpriority/value", redrawPriorityLabels, redrawPriorityValues, G_N_ELEMENTS(redrawPriorityLabels), 0);
_page_rendering.add_line(false, _("Redraw while editing:"), _rendering_redraw_priority, "",
_("Set how quickly the canvas display is updated while editing objects"), false);
}
/* blur quality */
_blur_quality_best.init ( _("Best quality (slowest)"), "/options/blurquality/value",
BLUR_QUALITY_BEST, false, nullptr);
......
......@@ -309,7 +309,8 @@ protected:
UI::Widget::PrefCheckButton _rendering_image_outline;
UI::Widget::PrefSpinButton _rendering_cache_size;
UI::Widget::PrefSpinButton _rendering_tile_multiplier;
UI::Widget::PrefSpinButton _rendering_xray_radius;
UI::Widget::PrefSpinButton _rendering_xray_radius;
UI::Widget::PrefCombo _rendering_redraw_priority;
UI::Widget::PrefSpinButton _filter_multi_threaded;
UI::Widget::PrefCheckButton _trans_scale_stroke;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment