Gimp/libgimpwidgets
Lukas Oberhuber 1baeffc913 macos: Fix 7690 (slow drawing)
Gets drawing in the canvas speed on retina displays up to the speed
of FullHD displays on macOS, making 2.99 usable on macOS.

Generic change:

Changes the cursor_label to delay the drawing phase to the idle
queue, from immediate draw on all platforms.

Before the fix in 32049afd (using a deprecated function in Gtk3)
any draws on this label forced a full canvas redraw. This is due
to a quirk in how GtkLabel functions.

The redraw occurred because GtkLabels resize themselves and everything
around them by sending a resize  message any time they receive new
text. These resizes then trigger the full canvas resize which triggers
a full canvas redraw that cannot be optimized by either Gtk or Big Sur.

MacOS changes:

Only redraws the cursor position label and each of the horizontal and
vertical rules (cursor tracking widgets) 3 times a second max for a
total of 9 redraws a second (ideally out of 60, though I don't believe
under any circumstances that GIMP achieves a 60fps).

Each of the cursor tracking widgets gets its own timeslice, and so
will not redraw when the other cursor tracking widgets are drawing.

This is required because Big Sur is merging all draw rects into
one large rect, dramatically slowing down draws.

This timeslicing ensures that draw rects are maintained at the smallest
possible size. So the typical redraw is a small rect around the
brush. However, 9 times a second, the rect will include one of the
3 cursor tracking widgets (rulers and cursor label).

Additionally, the code tries to minimize resizing the width of the
cursor label by checking if the widget is too small for the text,
then setting the char_width to a greater size so that resizes won't
be that common.

This improves the appearance of the widget as it no longer
constantly jumps about in size on each cursor move.

Here is a discussion of the issue:
https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/572#note_1389445

Reviewer's (Jehan) notes:

* The whole issue about GtkLabel resizing is no more after 32049afd. It 
  is normal for a widget to request a resize when needed. We just don't
  want the statusbar to resize and triggering canvas redraws.
* Changing cursor position text into an idle function generally makes
  sense.
  Also it reverts commit 6de9ea7022 which had a bug I hadn't realized
  when I accepted it: when we test for time, we don't know yet if it
  will be the last position change, hence we could "refuse" the last
  update. Therefore displayed cursor position would end up outdated
  on macOS. This new implementation doesn't have the problem (the last
  idle update always happens after the last move).
* The change about giving 1/3 timeslices to side canvas components 
  (rulers and statusbar) is a complete hack to work around the fact that
  macOs doesn't report properly each damaged rectangle. Instead it
  returns a huge bounding box. The workaround here is to expose these
  area separately.
  We have not been able to find a proper solution yet. This is the only
  reason why I accept this code, for macOS only, to at least have
  something usable there.
  See discussions in MRs gimp!572 and gimp-macos-build!86. With these 2 
  MRs, Lukas reported GIMP 2.99 to perform even better than GIMP 2.10 on
  Monterey, though it could not be tested on Big Sur unfortunately.
* Lastly the set_width_chars() thing is also an ugly hack which I will
  try later to revisit (see !581). I only accepted it (with mandatory 
  macOS-only macro) to have an acceptable state for release after seeing
  a screencast where the label size indeed "jumps around" on macOS.
2022-02-19 01:25:51 +00:00
..
.gitignore libgimp*: add GI's .dirstamp to .gitigore 2019-08-03 19:50:17 +02:00
gimpbrowser.c GIR: Try to return more specific GtkWidget subclass 2020-12-25 15:05:16 +01:00
gimpbrowser.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpbusybox.c libgimbase: merge gimpparam.h into gimpparamspecs.h 2019-07-31 10:16:21 +02:00
gimpbusybox.h libgimp*: lots of doc fixes and new docs for structs and enums 2019-07-24 01:18:30 +02:00
gimpbutton.c Cleanup GObject signal marshallers 2020-04-01 21:20:01 +00:00
gimpbutton.h libgimp*: fix some parameter inconsistencies to silence GI warnings 2019-08-07 22:05:12 +02:00
gimpcairo-utils.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpcairo-utils.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcellrenderercolor.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpcellrenderercolor.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcellrenderertoggle.c themes: issue #7303. Add on-hover indicator around... 2022-02-16 04:07:50 +00:00
gimpcellrenderertoggle.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpchainbutton.c libgimpwidgets: fix Gtk warning about wrong state for GimpChainLine. 2021-01-27 22:47:00 -05:00
gimpchainbutton.h libgimpwidgets: fix some glitches noticed when updating docs 2019-07-23 19:33:48 +02:00
gimpcolorarea.c libgimpwidgets: new GimpLabelColor widget (color area with a label). 2022-02-17 23:13:42 +01:00
gimpcolorarea.h libgimpwidgets: new gimp_color_area_enable_drag() API. 2022-02-17 23:13:42 +01:00
gimpcolorbutton.c Cleanup GObject signal marshallers 2020-04-01 21:20:01 +00:00
gimpcolorbutton.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolordisplay.c Cleanup GObject signal marshallers 2020-04-01 21:20:01 +00:00
gimpcolordisplay.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolordisplaystack.c Remove use of custom marshallers in favor of GLib ones 2021-08-13 18:01:13 +00:00
gimpcolordisplaystack.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorhexentry.c libgimpcolor: Fix gimp_rgb_list_names() for introspection 2021-12-02 12:43:57 +01:00
gimpcolorhexentry.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolornotebook.c Remove unnecessary gimpmarshal.h and gimpwidgetsmarshal.h includes. 2021-08-13 18:01:13 +00:00
gimpcolornotebook.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorprofilechooserdialog.c libgimpwidgets: add more docs 2019-07-24 19:11:58 +02:00
gimpcolorprofilechooserdialog.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorprofilecombobox.c libgimpconfig: get rid of filenames in all config related APIs 2019-09-21 12:55:12 +02:00
gimpcolorprofilecombobox.h libgimpconfig: get rid of filenames in all config related APIs 2019-09-21 12:55:12 +02:00
gimpcolorprofilestore-private.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorprofilestore.c libgimpconfig: get rid of filenames in all config related APIs 2019-09-21 12:55:12 +02:00
gimpcolorprofilestore.h libgimpconfig: get rid of filenames in all config related APIs 2019-09-21 12:55:12 +02:00
gimpcolorprofileview.c libgimpwidgets: add more docs 2019-07-24 19:11:58 +02:00
gimpcolorprofileview.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorscale.c libgimp*, plug-ins: fix some warnings 2021-05-24 20:36:31 +00:00
gimpcolorscale.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorscaleentry.c libgimpwidgets, plug-ins: remove legacy gimp_color_scale_entry_new(). 2020-11-01 02:23:03 +01:00
gimpcolorscaleentry.h libgimpwidgets, plug-ins: remove legacy gimp_color_scale_entry_new(). 2020-11-01 02:23:03 +01:00
gimpcolorscales.c app, libgimpwidgets, modules, plug-ins: code changes after GimpScaleEntry… 2020-11-05 18:06:52 +01:00
gimpcolorscales.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorselect.c colorselector: Rename signal emitters 2020-05-03 23:23:44 +02:00
gimpcolorselect.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorselection.c Remove unnecessary gimpmarshal.h and gimpwidgetsmarshal.h includes. 2021-08-13 18:01:13 +00:00
gimpcolorselection.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpcolorselector.c Remove use of custom marshallers in favor of GLib ones 2021-08-13 18:01:13 +00:00
gimpcolorselector.h colorselector: Rename signal emitters 2020-05-03 23:23:44 +02:00
gimpcontroller.c libgimbase: merge gimpparam.h into gimpparamspecs.h 2019-07-31 10:16:21 +02:00
gimpcontroller.h libgimp*: lots of doc fixes and new docs for structs and enums 2019-07-24 01:18:30 +02:00
gimpdialog.c gir: Mark gimp_dialog_new() parent nullable 2020-05-05 19:14:58 +02:00
gimpdialog.h libgimpwidgets: make a proper function out of the macro... 2019-07-30 14:05:08 +02:00
gimpeevl.c libgimpwidgets: free leaked GError. 2021-08-22 12:22:50 +02:00
gimpeevl.h libgimpwidgets: fix percentage use in size-entry arithmetic when lower-bound != 0 2020-01-06 21:35:52 +02:00
gimpenumcombobox.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpenumcombobox.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpenumlabel.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpenumlabel.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpenumstore.c gir: (skip) functions with varargs 2020-05-21 13:49:38 +02:00
gimpenumstore.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpenumwidgets.c gimpenumwidgets: Apply (transfer none) annotation 2020-05-18 13:00:58 +02:00
gimpenumwidgets.h libgimpwidgets: add GDestroyNotify to all enum widgets callback_data 2019-08-08 00:01:10 +02:00
gimpfileentry.c libgimpwidgets: store GimpFileEntry private data in appropriate struct. 2020-10-30 11:02:20 +01:00
gimpfileentry.h libgimpwidgets: store GimpFileEntry private data in appropriate struct. 2020-10-30 11:02:20 +01:00
gimpframe.c GimpFrame: Switch to using the GtkContainer::add signal 2021-11-18 11:43:14 +01:00
gimpframe.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimphelpui.c GimpHelpFunc: don't annotate (closure) 2020-05-09 00:16:15 +02:00
gimphelpui.h libgimpwidgets: add a GDestroyNotify for gimp_help_connect()'s user_data 2019-08-09 13:11:30 +02:00
gimphintbox.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimphintbox.h libgimpwidgets: declare GimpHintBox with public instance and class 2019-07-24 15:11:51 +02:00
gimpicons.c Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpicons.h icons: new lock icons. 2021-12-23 12:47:28 +01:00
gimpintcombobox.c gimpintcombobox: Add (array length) annotation 2020-12-25 15:04:21 +01:00
gimpintcombobox.h gir: Add (closure) tags 2020-05-04 21:31:30 +02:00
gimpintstore.c gir: (skip) functions with varargs 2020-05-21 13:49:38 +02:00
gimpintstore.h libgimpwidgets: reorder enum GimpIntStoreColumns 2019-11-19 21:06:05 +01:00
gimplabelcolor.c libgimpwidgets: add a "mnemonic-widget-changed" signal to GimpLabeled. 2022-02-17 23:24:05 +01:00
gimplabelcolor.h libgimpwidgets: allow editable GimpLabelColor. 2022-02-17 23:13:42 +01:00
gimplabeled.c libgimpwidgets: add a "mnemonic-widget-changed" signal to GimpLabeled. 2022-02-17 23:24:05 +01:00
gimplabeled.h libgimpwidgets: add a "mnemonic-widget-changed" signal to GimpLabeled. 2022-02-17 23:24:05 +01:00
gimplabelentry.c libgimpwidgets: new GimpLabelEntry widget and associated prop API… 2022-02-17 23:13:42 +01:00
gimplabelentry.h libgimpwidgets: new GimpLabelEntry widget and associated prop API… 2022-02-17 23:13:42 +01:00
gimplabelintwidget.c libgimpwidgets: fix missing doc comments and annotations. 2020-11-20 11:36:11 +01:00
gimplabelintwidget.h libgimpwidgets: new gimp_label_int_widget_get_widget() function. 2020-11-20 01:47:18 +01:00
gimplabelspin.c Issue #6446: Typo fixes. 2021-02-24 12:33:03 +01:00
gimplabelspin.h libgimpwidgets: improved gimp_prop_scale_entry_new(), new function… 2020-11-25 02:32:22 +01:00
gimpmemsizeentry.c GIR: Try to return more specific GtkWidget subclass 2020-12-25 15:05:16 +01:00
gimpmemsizeentry.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpnumberpairentry.c app, libgimp*, plug-ins: Changed gendered terms to be gender-neutral 2021-11-14 11:22:24 +00:00
gimpnumberpairentry.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpoffsetarea.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpoffsetarea.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppageselector.c gir: Mark more (out) annotations 2020-05-08 17:11:14 +02:00
gimppageselector.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppatheditor.c GIR: Add some missing (nullable) annotations 2020-12-25 15:02:09 +01:00
gimppatheditor.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppickbutton-default.c Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppickbutton-default.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppickbutton-kwin.c Issue 1878: Eyedrop tool doesn't work when screen composing (KWin)... 2019-05-07 18:49:35 +09:00
gimppickbutton-kwin.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppickbutton-private.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppickbutton-quartz.c macos: version 10.7 long no longer supported 2022-02-07 13:34:04 +00:00
gimppickbutton-quartz.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppickbutton-xdg.c libgimpwidgets: Use Screenshot portal for picking 2021-12-14 23:15:49 +01:00
gimppickbutton-xdg.h libgimpwidgets: Use Screenshot portal for picking 2021-12-14 23:15:49 +01:00
gimppickbutton.c libgimpwidgets: Use Screenshot portal for picking 2021-12-14 23:15:49 +01:00
gimppickbutton.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppreview.c GIR: Try to return more specific GtkWidget subclass 2020-12-25 15:05:16 +01:00
gimppreview.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppreviewarea.c gir: Add more missing (array) and (out) annotations 2020-05-04 21:29:42 +02:00
gimppreviewarea.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimppropwidgets.c app, libgimpwidgets: move gimp_prop_spin_scale_new() and… 2022-02-19 00:14:44 +01:00
gimppropwidgets.h app, libgimpwidgets: move gimp_prop_spin_scale_new() and… 2022-02-19 00:14:44 +01:00
gimpquerybox.c libgimpwidgets: add GDestroyNotify for gimp_query_foo_box() user_data 2019-08-07 22:48:06 +02:00
gimpquerybox.h Fix some gtk-doc comments and GIR annotations 2020-05-08 15:26:42 +02:00
gimpruler.c macos: Fix 7690 (slow drawing) 2022-02-19 01:25:51 +00:00
gimpruler.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpscaleentry.c libgimpwidgets: Stop using deprecated APIs 2021-10-19 20:53:45 +00:00
gimpscaleentry.h libgimpwidgets: make GimpScaleEntry a child class of GimpLabelSpin. 2020-11-05 18:06:52 +01:00
gimpscrolledpreview.c libgimpwidgets: use GtkGestureDrag in ScrolledPreview 2021-12-12 22:27:48 +01:00
gimpscrolledpreview.h libgimpwidgets: use GtkGestureDrag in ScrolledPreview 2021-12-12 22:27:48 +01:00
gimpsizeentry.c libgimpwidgets: free leaked GError. 2021-08-22 12:22:50 +02:00
gimpsizeentry.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpspinbutton.c libgimpwidgets: handle Enter/Esc keys in GimpSpinButton 2020-07-14 13:00:55 +03:00
gimpspinbutton.h libgimpwidgets: add GimpSpinButton 2018-11-10 06:48:56 -05:00
gimpspinscale.c libgimpwidgets, themes: more compact GimpSpinScale. 2022-02-17 23:13:42 +01:00
gimpspinscale.h app, libgimpwidgets: move GimpSpinScale to libgimpwidgets. 2022-02-17 23:13:42 +01:00
gimpstringcombobox.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpstringcombobox.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpunitcombobox.c libgimpwidgets: more docs and annotations for GimpUnitComboBox 2019-08-08 00:40:03 +02:00
gimpunitcombobox.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimpunitstore.c libgimpwidgets: UnitStore: Fix conflicting names 2020-05-10 12:06:33 +00:00
gimpunitstore.h libgimpwidgets: UnitStore: Fix conflicting names 2020-05-10 12:06:33 +00:00
gimpwidgets-error.c Use "Returns:" to annotate return values 2019-08-03 07:53:47 +00:00
gimpwidgets-error.h Add other misc. typo fixes 2019-08-13 11:50:51 -04:00
gimpwidgets-private.c app, libgimp, libgimpwidgets: fix "Application icon missing" in tests. 2021-12-23 13:39:43 +01:00
gimpwidgets-private.h libgimpwidgets: new GimpLabelColor widget (color area with a label). 2022-02-17 23:13:42 +01:00
gimpwidgets.c gir: (skip) functions with varargs 2020-05-21 13:49:38 +02:00
gimpwidgets.def app, libgimpwidgets: move gimp_prop_spin_scale_new() and… 2022-02-19 00:14:44 +01:00
gimpwidgets.h libgimpwidgets: new GimpLabelColor widget (color area with a label). 2022-02-17 23:13:42 +01:00
gimpwidgetsenums.c libgimpwidgets: keep gimpwidgetsenums.h in alphabetical order 2019-06-01 16:41:59 +02:00
gimpwidgetsenums.h libgimpwidgets: Introduce GIMP_ZOOM_PINCH 2021-04-22 17:45:32 +00:00
gimpwidgetsmarshal.list Remove use of custom marshallers in favor of GLib ones 2021-08-13 18:01:13 +00:00
gimpwidgetstypes.h libgimpwidgets: new GimpLabelColor widget (color area with a label). 2022-02-17 23:13:42 +01:00
gimpwidgetsutils.c app, libgimpwidgets: new gimp_event_triggers_context_menu() and use it… 2021-12-23 12:55:11 +01:00
gimpwidgetsutils.h app, libgimpwidgets: new gimp_event_triggers_context_menu() and use it… 2021-12-23 12:55:11 +01:00
gimpzoommodel.c libgimpwidgets: Introduce GIMP_ZOOM_PINCH 2021-04-22 17:45:32 +00:00
gimpzoommodel.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Makefile.am app, icons, libgimpwidgets: fix icon's gresources rules. 2022-01-31 21:37:20 +01:00
Makefile.gi libgimpwidgets: new GimpLabelColor widget (color area with a label). 2022-02-17 23:13:42 +01:00
meson.build libgimpwidgets: new GimpLabelColor widget (color area with a label). 2022-02-17 23:13:42 +01:00
test-eevl.c libgimpwidgets: fix percentage use in size-entry arithmetic when lower-bound != 0 2020-01-06 21:35:52 +02:00
test-preview-area.c Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00