`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, we should try to use
`g_object_notify_by_pspec()` instead.
When run with GIMP_DEBUG=Gtk we get a lot of debug warnings for GimpRuler and once in a while for GtkScrolledWindow that State 0
doesn't match state 128 set via gtk_style_context_set_state (). This happens because we didn't enter the current state flags of
the widget but 0 and apparently Gtk isn't happy about that.
Let's fix this by using the actual state flags by calling gtk_widget_get_state_flags.
Make better subvision, as well as ruler steps, based on what seems to be
the common trends for rulers of these 3 units (inch, foot and yard), but
also based on common conversion needs.
Main changes are:
- Always subdivide inches by 2, down to 1/256, and get rid of the gap
where inches division jumped from 1/16 to 1/192 (which is not even a
multiple of 2).
- Add the 72 steps to inch ruler (1 fathom).
- Replace the 2 feet by a 3 feet (1 yard) step.
- Use base-10 steps for yard (there don't seem to be bigger units in the
imperial/US measurement system which needs specific steps).
- Add the 1/36 yard (= 1 inch) division.
- Below 1/12 feet and 1/36 yard, divide by multiples of 2 (inch-style).
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
Add CSS names using gtk_widget_class_set_css_name(), remove styling in
code and instead do it properly in CSS, so far in the System theme.
All horribly incomplete but a start.
gimp_ruler_draw_pos(): when remembering the just drawn rectangle's
position, don't just unconditionally overwrite the previous position's
rectangle. Instead, if the previous position's rectangle has not been
cleared yet (has a non-zero size), remember the union of old and new
rectangle.
Why this only happened to the vertical ruler with statusbar off is
beyond my mind, it should have always produced artifacts.
Unrelated: make sure the idle function is removed if we decide to
immediately redraw in gimp_ruler_set_position().
Ever since 72617e42b, whenever the user generated a lot of mouse
input, we would constantly queue redraws to the rulers. These redraws
had a higher idle priority than updating the canvas, so we would
rarely get around to canvas updates, which made certain tools
(painting with dynamics, the blend tool) feel very unresponsive.
This fixes it by only redrawing the rulers if the mouse has moved
far from the last location, or if there are no idle handlers with
a priority above LOW.
We now avoid drawing rulers in the position property setter and use
gtk's region invalidation instead. Previously, we were basically
redrawing the ruler inside the mouse event handler, which is pure evil.
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
and completely separate configure and sanity checks for gdk-pixbuf
from GTK+, because it's now distributed as a separate package. Remove
all sorts of conditional compiling based on GDK_CHECK_VERSION() and
CAIRO_VERSION.
Add a list of "track widgets" to GimpRuler and connect to their
motion-notify-event. Correctly translate the motion event's x/y to the
ruler's coordinate system when updating the marker.