From aca87f3d80cf0f83414918cf013ea4eb20336576 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 27 Jan 2013 15:28:36 +0000 Subject: desktop-widget: Add callback to ensure that ruler ranges are correctly updated when canvas table resizes Fixed bugs: - https://launchpad.net/bugs/950552 (bzr r12068) --- src/widgets/desktop-widget.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 8a47b345e..e6fabd50b 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -312,6 +312,22 @@ sp_desktop_widget_class_init (SPDesktopWidgetClass *klass) widget_class->realize = sp_desktop_widget_realize; } +/** + * Callback for changes in size of the canvas table (i.e. the container for + * the canvas, the rulers etc). + * + * This adjusts the range of the rulers when the dock container is adjusted + * (fixes lp:950552) + */ +static void +canvas_tbl_size_allocate(GtkWidget *widget, + GdkRectangle *allocation, + gpointer data) +{ + SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data); + sp_desktop_widget_update_rulers (dtw); +} + /** * Callback for SPDesktopWidget object initialization. */ @@ -743,6 +759,13 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) } overallTimer = 0; } + + // Ensure that ruler ranges are updated correctly whenever the canvas table + // is resized + g_signal_connect (G_OBJECT (canvas_tbl), + "size-allocate", + G_CALLBACK (canvas_tbl_size_allocate), + dtw); } /** -- cgit v1.2.3