Commit Graph

153 Commits

Author SHA1 Message Date
Jehan 8ac5178214 libgimpwidgets: fix automake syntaxe.
Automake doesn't accept the "if else" syntax. Instead, we must add a new if/else
inside the first else block.

While I'm at it, I also add a G_GNUC_INTERNAL to the internal function
_gimp_pick_button_win32_pick(), though I don't think it's absolutely necessary
(yet explicit is better).
2022-10-11 00:29:57 +02:00
Luca Bacci d2dc2cb983 Add GimpPickButton implementation for Windows
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/8506
2022-10-07 10:45:22 +00:00
Jehan ccbf3c4bb0 app, libgimp*: add various stamp files to CLEANFILES.
Fixes:

> ERROR: files left in build directory after distclean:
2022-08-01 23:34:50 +02:00
Jehan 83e465ec16 app, libgimp*: updating autotools script in sync with meson.
Generated *enums.c now have an additional stamp no-op header include
(see last 2 commits). Sync this change into the autotools generation
scripts to prevent back and forth useless generation of these files each
time we switch from one build system to another.
2022-08-01 20:00:01 +02:00
Jehan e4cd2405a9 libgimpwidgets: do not export GResource generated functions.
This explains why the defcheck script never complained for the 2
*_get_resource() functions removed in my previous commit. These were
exported in the libgimpwidgets library on the autotools build (and not
on the meson build).

Fix the discrepancy by not exporting these symbols on autotools as well,
as I don't think this is needed on public API.

This should now fix the distcheck build for autotools.
2022-07-31 23:44:48 +02:00
Jehan c872dcbf20 app, icons, libgimpwidgets: fix icon's gresources rules.
Now the source images are in the build dirs.

Also:
- clean the EXTRA_DIST contents on autotools;
- add dependencies rules in meson gresources to make sure icons are
  built before resource build;
- finally remove a duplicate build rule in Color Makefile.
2022-01-31 21:37:20 +01:00
Yoshinori Yamakawa 2d1c447508 libgimpwidgets: Migration from GetICMProfile() to WcsGetDefaultColorProfile() 2021-12-17 21:58:03 +00:00
Niels De Graef e82f6d5b0f libgimpwidgets: Use Screenshot portal for picking
Freedesktop (XDG) portals are a collection of D-Bus APIs that work
across desktop environments, display servers and work within
containerized applications, like Flatpak. The internal implementation
can then choose to implement these in such a way that takes into account
security considerations, as well as making sure the user consents to
certain actions.

One such portal is the `Screenshot` portal, which contains a
`Screenshot()` method as well as `PickColor()`. We already use the
former for taking a screenshot, and this commit makes sure our color
picker also makes use of the latter.

By doing this, color picking is now possible on the major Wayland
compositors.

(Honestly, we should remove DE-specific backends like that of KWin, to
have less variation on the possible results of a color picking
operation).

Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/1074
2021-12-14 23:15:49 +01:00
Jehan 8025962a20 libgimpwidgets: fix meson/mingw-w64 build and relocatable builds.
While passing the DATADIR macro works fine natively on Linux, it somehow
failed with the mingw-w64 build with a very weird error:

> <command-line>: error: expected identifier or '(' before string constant

I could not understand what it means, as the '-DDATADIR="/some/path"'
syntax is completely fine as far as I can see.
Anyway since I see that DATAROOTDIR is already defined in meson config.h
(but not in the autotools build, just the meson one!), and using
datarootdir instead of datadir seems to be just fine (actually maybe
even more appropriate when it comes to looking up the hicolor
application icons), I just switched to using it.

In the same time, I realized that my code using build-time macros won't
work for relocatable builds anyway. So this commit also adds a bit of
code path variant using gimp_installation_directory() in the case of
ENABLE_RELOCATABLE_RESOURCES code path.
2021-07-06 13:37:33 +02:00
Jehan 3598562472 app, libgimpwidgets: drop the thumbnail icon feature.
From years of discussions, it turns out that:
- The thumbnailed-Wilber icon replacing the generic icon of GIMP often
  makes the application harder to spot in the icon list of running
  processes.
- In single-window mode in particular, it makes even less sense as we
  just show the one active image anyway.
- Even in multi-window mode, nowadays many OSes or desktop group windows
  of a same application under one icon. So we end up with several image
  windows under a thumbnail only showing the top image. This happens in
  KDE, GNOME, Cinnamon and Windows at least apparently (as far as is
  being reported).
- Some platforms would just use only the OS-declared icon and not care
  about runtime-declared ones. This is apparently the case on macOS, and
  also on GNOME when the desktop file is seen by the desktop
  environment. So all our code about generating thumbnailed icon is
  wasted on these platform anyway.
- When intensively testing the current behavior, I had cases when the
  icon was not properly updated. We could of course investigate and fix
  the issues, but considering all the previous points, it might make
  more sense to simply drop the feature which is mostly useless, or
  worse bothersome, hence simplify the code greatly.
- Finally API to set icons from GdkPixbuf data has been removed in GTK4.
  So long term, trying to keep this whole machinery feels like just
  making our life difficult for a feature which all OSes seem to
  deprecate and which might not be possible anymore soon (or just get
  harder and harder to implement).

Note that I don't use gtk_window_set_default_icon_name() because it
would use the icon from our theme, yet so far we are not sure it makes
sense for the application icon which we probably always want to be the
same, whatever the chosen theme. Finally I just list various common icon
sizes because GTK API doesn't seem to be clever enough yet. I can't just
give it 1 SVG image (e.g. with gtk_window_set_default_icon_from_file())
and hope it does the resizing at the last minute. It turns out it
doesn't and we get an extra-small icon. So instead, let's generate
common sizes ourselves from the same SVG.
2021-07-06 11:21:37 +02:00
Michael Schumacher 530dc883ca app, libgimp*: glib-genmarshal warns about --header --body
Using --header --body is mentioned as being deprecated, the way to get the desired result said to be
--prototypes --body now.
2021-04-17 22:50:49 +02:00
Jehan afe0bcbc58 libgimpwidgets: introspect libgimpwidgets.
Only leave behind gimpcolorscale, gimpcolorscales and gimpcolorselect
for now. There are some GI compilation errors and I don't have the time
right now to look into it. Most of libgimpwidgets is available to GI
bindings now anyway.
2019-07-30 12:53:15 +02:00
Ell 03a928409a libgimpwidgets: install gimpspinbutton.h
Added in commit 7ab9ee2686.
2018-11-19 09:28:52 -05:00
Ell 7ab9ee2686 libgimpwidgets: add GimpSpinButton
GimpSpinButton is a drop-in replacement for (and a subclass of)
GtkSpinButton.  Unlike GtkSpinButton, it avoids updating the
adjustment value when losing focus, unless the entry text has
changed.  This prevents accidental loss of precision, when the
adjustment value can't be accurately displayed in the entry.
2018-11-10 06:48:56 -05:00
Jehan 8e453330c9 configure: GLIB_COMPILE_RESOURCES is wrong when cross-compiling.
AM_PATH_GLIB_2_0 m4 macro actually computes this value using
$PKG_CONFIG. Yet $PKG_CONFIG variable is the pkg-config tool looking for
target libraries (not host), hence it would return the executable
`glib-compile-resources` built for the target.

Also using the same variable name invalidates our test: our own
AC_PATH_PROG was never run as the variable was already set. And no
environment variable could override this test anymore either. This is
why I rename the test variable to HOST_GLIB_COMPILE_RESOURCES.

(cherry picked from commit d1d9eb17e5)
2018-08-12 22:52:45 +02:00
Ell a5102a7dba */Makefile.am: add *marshal.h files to BUILT_SOURCES
In subdirs containing a generated foomarshal.h header, add the
generated sources to BUILT_SOURCES, so that they're generated
before the rest of the source files are built.  Otherwise, since
there is no rule specifying the dependency between the rest of the
source files and foomarshal.h, and since foomarshal.h is not
checked into git (and hence doesn't exist when doing a clean
build), compilation of the said source files may fail if they're
built before foomarshal.h is generated.
2018-07-24 14:05:08 -04:00
Michael Natterer 5674e31850 Generate icon resources where they are needed, and don't include .c files
Treat the gimp-core-pixbufs and gimp-icon-pixbufs resources like we
changed the cursor resources before, and clean out a lot of cruft from
icons/ (there is no need to generate stuff in all icon themes when we
include only one fallback icon from one theme).
2018-06-13 20:02:05 +02:00
Michael Natterer b75cbcb417 libgimpwidgets: install gimpbusybox.h as public header 2018-06-08 18:58:04 +02:00
Ell f847796943 app, libgimpwidgets: add generated cursor files to CLEANFILES
Needed after commit a9592a59c8.
2018-05-31 02:56:07 -04:00
Ell 000fd8e69b libgimpwidgets: add GimpBusyBox
GimpBusyBox is used to show a message indicating an operation is in
progress.  It's basically just a spinner and a label, with some
styling.

We're going to use it both in app/ and in a plug-in.
2018-05-29 16:04:28 -04:00
Michael Natterer a9592a59c8 Merge request 4 - Generated .c sources are used as headers...
...Generate .h files instead.

Generate proper .c and .h files for color-picker and tool cursors in
the directories where they are built, and stop including them in other
.c files.
2018-05-28 17:25:18 +02:00
Michael Natterer 37e24d0059 libgimpwidgets: remove gimp3migration.[ch] 2018-05-20 21:06:29 +02:00
Michael Natterer 3d4ef455d2 libgimpwidgets: move all GimpPickButton members to a private struct 2018-05-20 21:06:28 +02:00
Michael Natterer dae87ee1c7 libgimpwidgets: remove deprecated files from the build 2018-05-20 21:06:26 +02:00
luz.paz 147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
Ell 6ebc3f1b09 Makefiles: don't use -xobjective-c when linking files on Mac
Last commit caused -xobjective-c to be passed during linking on
Mac, causing object files to be treated as source files.  Add a
-xnone flag to AM_LDFLAGS, canceling the effect of -xobjective-c.

Additinally, add a -xobjective-c++ flag to AM_CXXFLAGS, so that we
can use Objective-C in C++ files on Mac, if we ever need to.
2018-04-08 04:03:55 -04:00
Ell 06950be7f0 Makefiles: don't use -xobjective-c when compiling C++ files on Mac
On Mac, pass -xobjective-c to the compiler through AM_CFLAGS, not
AM_CPPFLAGS, so that it's only used for C sources, and not C++
sources.  In the latter case, it clashes with the -std=... flag,
spewing an error.  Thanks, Partha :)
2018-04-07 16:57:52 -04:00
Jehan ef6559b38f libgimpwidgets: add private headers for GimpPickButton implementations.
Though forward declarations of the implementations are ok, it is cleaner
to have proper header files for each variant (default, kwin, quartz
right now). Of course these new header files are not installed and must
be kept private for build only.
2017-12-09 00:05:08 +01:00
Jehan 06bbf3e436 Bug 780375 - Color picker won't pick on Wayland.
Add support for KWin API, for KDE on Wayland.
Unfortunately though, KWin's "pick" API seems to have failures, so I
fallback to the default color picking when this happens. This will still
not work on Wayland, but at least won't cause regression for color
picking on KDE/X11.
See also KDE bug: https://bugs.kde.org/show_bug.cgi?id=387720
2017-12-08 23:37:24 +01:00
Ell f7d6805ebb */Makefile.am: add abbreviations to generated enum files
Update the dprod production of generated enum files to include
abbreviated value descriptions, as per the previous commits.

Add a comment for translators above the abbreviated descriptions,
specifying the full description they abbreviate.
2017-11-30 03:10:14 -05:00
Ell 188a82552b libgimpwidgets: fix double $(AM_V_GEN) in Makefile.am
Due to commit 0ef3795f0a.
2017-08-28 16:50:25 -04:00
Ell 0ef3795f0a */Makefile.am: work around a bug in the new glib-genmarshal
glib-genmarshal was rewritten in glib 2.53.4, and as of now (2.53.6)
it has a bug where it unconditionally generates marshaler bodies,
even for standard marshalers, even with --stdinc.  This causes
libgimpwidgets to define and export g_cclosure_marshal_VOID__INT()
and g_cclosure_marshal_VOID__OBJECT(), which upsets defcheck, and
breaks the build.

Work around this for now by using --header --body when generating
the marshal.c files, which includes the prototypes in the source,
instead of including the header ourselves.  This is the only code
path where the new glib-genmarshal doesn't generate bodies for
standard marshalers.  Note, however, that this usage is deprecated,
so we'll probably want to change it back once it's fixed.
2017-08-27 15:33:09 -04:00
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Jehan 8a37c928eb app, plug-ins, libgimp*: clean out all remaining trailing spaces/tabs.
Rather than just discovering them by chance, a simple grep and some
search and replace are much more efficient! :-)
Cleaning only done on C and automake files.
2016-06-02 02:04:26 +02:00
Michael Natterer 6c64cb0f16 libgimpwidgets: support saving profile in GimpColorProfileChooserDialog
Add the right action buttons, enable overwrite confirmation, and add
user-writable folders to the shortcuts pane. Also use the right API on
OS X instead of hardcoding /Library and ~/Library.
2016-05-07 01:36:23 +02:00
Jehan da1b4dac42 libgimpwidgets: missing link library for GetICMProfile() on Win32.
This function is available in gdi32 library.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd316948%28v=vs.85%29.aspx
2015-12-29 18:43:41 +01:00
Michael Natterer 71894bd787 libgimpwidgets: rename gimpstock.[ch] to gimpicons.[ch]
because stock is on its way out, so we better start renaming and
deprecating stuff sooner than later.
2015-12-12 20:44:46 +01:00
Kristian Rietveld 153b19ac56 Only build Quartz-specific color picking code on OS X/Quartz builds 2015-10-04 18:11:16 +02:00
Kristian Rietveld 0d88399eb8 Bug 753175 - color picker locks down the GUI
The common code relies on X11 pointer grabbing semantics, which does
not work well on OS X. An attempt using event taps also proved
problematic, in particular with regard to setting the mouse cursor.

This patch implements a fully separate code for use on OS X platforms.
It works by simply overlaying the desktop with big transparent windows
on which the mouse cursor is set and motion events are captured. Evil,
but it works.
2015-10-04 16:27:17 +02:00
Michael Natterer f21f6e5a28 libgimpwidgets: add gimp_widget_get_color_transform()
Which returns a GimpColorTransform to transform a GimpColorManaged's
pixels to a GtkWidget's color space, using a GimpColorConfig's
settings. This is *unfinished* API and in the end will enable simple
display color management for the app, libgimp and plug-ins.
2015-05-09 01:20:50 +02:00
Michael Natterer 6b0b774302 libgimpwidgets: add gimpwidgetsutils.[ch]
Move some functions from libgimpwidgets/gimpwidgets.[ch]
and from app/widgets/gimpwidgets-utils.[ch]. Newly add
gimp_widget_get_color_profile() which is extracted from
modules/display-filter-lcms.c.
2015-05-06 22:15:30 +02:00
Michael Natterer 6c800db1cc Use the newly added profile utility functions all over the place 2015-05-06 16:38:57 +02:00
Michael Natterer f8a9f39466 libgimpwidgets: use gtk_window_set_default_icon_name()
instead of gtk_window_set_default_icon_list() which requires having
actual GdkPixbufs around. Move the 32x32 and 48x48 wilber images to
the icon theme, and remove all inline pixbuf generation stuff from
libgimpwidgets.
2015-03-29 21:00:11 +02:00
Jehan 8c1cd7caac Makefile: fix VPATH builds for win32. 2014-09-14 18:28:26 +02:00
Daniel Sabo 5cee9408be app,gimpwidgets: Add some missing libs so the tests build 2014-03-20 03:15:50 -07:00
Michael Natterer dc6b8ec8f6 libgimpwidgets: add new widget GimpColorProfileView
which is a totally trivial GtkTextView subclass and displays
color profile information.
2014-03-16 18:36:11 +01:00
Daniel Sabo b54b59c9e8 Use EXTRA_foo_DEPENDENCIES for adding .def files
The foo_DEPENDENCIES rule replaces the default dependencies, where
EXTRA_foo_DEPENDENCIES just appends to it. This was causing libgimp
and libgimpui to build out of order.
2014-03-15 14:23:38 -07:00