GTK3: rulers and canvas don't use the same scale

Bug #1069172 reported by su_v
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Alex Valavanis

Bug Description

With GTK3 builds, the scale of the ruler doesn't match precisely the scale of the canvas area:

At the center of the current viewport, the ruler ticks match precisely with objects/grid/guides on the canvas, but towards the edges of the displayed canvas area, they get out-of-sync by a few screen pixel.

Steps to reproduce:
1) launch inkscape with default preferences
2) position a vertical guide at the origin 0,0 (lower left corner of the page)
3) scroll the canvas horizontally

Expected result:
Guide and rulers stay in sync precisely

Actual result:
If the canvas is scrolled and the guide displays near the edge of the current viewport, the tick on the ruler and the position of the guide get out-of-sync by a few screen pixels (proportional to the distance from the center of the current viewport).

Reproduced with Inkscape 0.48+devel 11814 on OS X 10.7.4:
- gtk3/x11 3.4.4, gtkmm 3.4.0, glib 2.32.4, glibmm 2.32.1, cairo 1.12.2
- gtk3/quartz 3.6.1, gtkmm 3.5.13, glib 2.34.1, glibmm 2.33.14, cairo 1.12.2, cairo 1.12.4

Tags: gtk3 ui
Revision history for this message
su_v (suv-lp) wrote :
description: updated
tags: added: build
tags: removed: build
tags: added: ui
tags: added: gtk3
removed: gtk3-regression
Revision history for this message
jazzynico (jazzynico) wrote :

At least you see the rulers. On Windows XP, they are replaced with a long black rectangle...

Revision history for this message
su_v (suv-lp) wrote :

<off-topic>
> On Windows XP, they are replaced with a long black rectangle...

I also get those with the Quartz backend builds (GTK+/Quartz 3.6.2, gtkmm3 3.6.0, gdl3 3.6.2, glib2 2.34.3) - the same for the background of the thumbnail preview in the file dialogs.

Interestingly wit the same builds, the rulers are ok with the Unico theme engine, but black with Adwaita, and stock (i.e. no) theme engine.
</off-topic>

Revision history for this message
jazzynico (jazzynico) wrote :

Confirmed on Debian testing, Inkscape trunk revision 11960, gtk3-3.4.2-4, gtkmm3-3.4.2-1, glib-2.33.12 and cairo-1.12.2-2.

Changed in inkscape:
status: New → Triaged
Revision history for this message
Alex Valavanis (valavanisalex) wrote :

We should have a look at the implementation in the GIMP GTK+ 3 branch. Their GTK+ 3 migration may be better tested than the upstream GTK+ 3 version I used:

http://git.gnome.org/browse/gimp/tree/libgimpwidgets/gimpruler.c?h=gtk3-port

Changed in inkscape:
importance: Undecided → High
Revision history for this message
su_v (suv-lp) wrote :

On 16/12/2012 18:24, ~suv wrote:
> <off-topic>
>> On Windows XP, they are replaced with a long black rectangle...
>
> I also get those with the Quartz backend builds (GTK+/Quartz 3.6.2,
> gtkmm3 3.6.0, gdl3 3.6.2, glib2 2.34.3) - the same for the background
> of the thumbnail preview in the file dialogs.
>
> Interestingly wit the same builds, the rulers are ok with the Unico
> theme engine, but black with Adwaita, and stock (i.e. no) theme
> engine. </off-topic>

Correcttion: AFAICT it's not about the theme _engine_, but about the particular theme itself: Ubuntu light themes and e.g. Zukitwo do style the ruler background as expected, but Adwaita (or the stock theme) doesn't: the latest version of Zukitwo (for Gnome 3.6) has migrated from Unico to Adwaita, and still renders the rulers as expected [1].

Possibly this is due to GtkRuler no longer being an official widget of GTK+ >= 3.6?

[1] <http://gnome-look.org/content/show.php?content=140562>

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Further to comment #5, we should really work through the patches to the ruler widget that have been applied since GIMP forked the code [1]. The closer we can stay to GIMP, the better! As an added advantage, GIMP appear to have a smaller delta between the GTK+ 2 and GTK+ 3 versions whan we do.

[1] http://git.gnome.org/browse/gimp/log/libgimpwidgets/gimpruler.c

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Should be fixed in lp:inkscape r11981. In Gtk+ 2 builds, we use a hack to account for a mysterious 2-px offset. In Gtk+ 3 this doesn't appear to be necessary. We should still try to figure out why it's needed for Gtk+ 2 builds though.

I've also merged in a lot of the rendering code from GIMP. Please let me know if the weird black rectangles are showing with certain themes... we can handle this as a separate bug.

Changed in inkscape:
assignee: nobody → Alex Valavanis (valavanisalex)
status: Triaged → Fix Released
Revision history for this message
su_v (suv-lp) wrote :

>Should be fixed in lp:inkscape r11981.

Confirmed on OS X 10.7.4, r11981 with GTK+/X11 3.4.4 and GTK+/Quartz 3.6.2.

> Please let me know if the weird black rectangles are showing with certain themes..

Still unchanged (r11981):
With GTK+/Quartz 3.6 on OS X 10.7.4, the background of the rulers (as well as e.g. the background of previews of SVG files in the file dialog) is rendered black if using no explicit theme engine/theme at all, and e.g. with Adwaita (gnome-themes-standard 3.6.2).

Notes:
- With GTK+ 3.6, the ruler renders as expected e.g. with Ubuntu's Radiance/Ambiance themes (using unico engine), or with Zukitwo for Gnome 3.6 (using Adwaita engine).
- AFAICT does not affect GTK+ 3.4 (ruler is fine with all tested themes).

I can file a separate report later this week…

Revision history for this message
su_v (suv-lp) wrote :

Reopening - AFAICT the fix introduces a minor glitch with GTK2 builds: both rulers render an additional line at the edge of the canvas, which didn't exist before the more recent commits, and is not present with GTK3 builds (see attached screenshot with GTK+/X11 2.24.13 using the GTK2 Adwaita theme from Gnome 3.4).

Changed in inkscape:
status: Fix Released → In Progress
Revision history for this message
su_v (suv-lp) wrote :
Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Well, I think that actually we've been using dodgy rendering in the Inkscape fork for a while. The line at the edge of the ruler widget should actually be there... see the attached image

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Oops... should have said that the attached image is a screenshot from GIMP 2.6. Note also that a Google image search for "GtkRuler image" shows numerous images of a ruler widget with the scale edge line.

Revision history for this message
su_v (suv-lp) wrote :

Reverting my earlier bug status change - I'll leave it to others to decide on whether it should be there or not.

(That line simply wasn't there in any stable Inkscape release I have used personally (0.46-0.48), also not in sodipodi 0.34, and it's not present in Inkscape's trunk GTK3 builds either, at least on OS X.)

Changed in inkscape:
status: In Progress → Fix Released
Revision history for this message
su_v (suv-lp) wrote :

<off-topic>
Mentioning it here, since AFAICT there is no specific report tracking issues with C++ification:
GTK3 builds on OS X 10.7.4, with GTK+ 3.4.4. as well as GTK+ 3.6.2 fail since r11986:

  CXX widgets/sp-color-slider.o
../../src/widgets/sp-color-slider.cpp: In function ‘gint sp_color_slider_button_press(GtkWidget*, GdkEventButton*)’:
../../src/widgets/sp-color-slider.cpp:312: error: ‘GDK_EVENT’ was not declared in this scope
../../src/widgets/sp-color-slider.cpp: In function ‘gint sp_color_slider_button_release(GtkWidget*, GdkEventButton*)’:
../../src/widgets/sp-color-slider.cpp:339: error: ‘GDK_EVENT’ was not declared in this scope
make[1]: *** [widgets/sp-color-slider.o] Error 1
make: *** [install-exec-recursive] Error 1

</off-topic>

Revision history for this message
su_v (suv-lp) wrote :

<off-topic cont.>
WRT to r11986 - with GTK2 builds, the color slider for 'Hue' in the HLS tab doesn't render correctly anymore (>= r11986)…
</off-topic>

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Build failure in Gtk+ 3 should be fixed in r11988. HSL slider error confirmed.

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Dodgy HSL slider mapping should be fixed in r11991

Revision history for this message
su_v (suv-lp) wrote :

Alex Valavanis wrote on 2012-12-24:
> Please let me know if the weird black rectangles are showing with
> certain themes...

Separate report about ruler background filed as
Bug #1094511 “GTK3: ruler background renders with solid black bg (GTK+ 3.6, default Adwaita theme)”
<https://bugs.launchpad.net/inkscape/+bug/1094511>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.