Commit Graph

136 Commits

Author SHA1 Message Date
Jehan 9eea95255a plug-ins: remove the "Acquire" of the menu path.
This is a placeholder which is not meant to appear in the menu. Our new system
uses placeholders internally, but plug-ins cannot make use of these.

Not sure anyway if this is so useful in the cases of plug-ins. At least, I don't
feel it is for these particular use cases.
2023-04-12 22:07:08 +02:00
Jehan 4f1d0fb53b plug-ins: get rid of various gimp_image_set_file() calls.
- This is unneeded in all import procedures. See previous commit. Note though
  that this is not because of a change in previous commit. This was already
  useless previously. The file set with this PDB function was overridden by the
  core anyway (i.e. even before the previous commits).
  In app/file/file-import.c:file_import_image(), the imported file is correctly
  set (so there is no need to set it from plug-in, which anyway libgimp's
  gimp_image_set_file() was not doing) and the XCF file is reset to NULL
  (rendering the call to gimp_image_set_file() in a GimpLoadProcedure useless).
- Similarly, this is a useless call in export procedures because
  app/file/file-save.c:file_save() overrides such call too. I could only see one
  such case for JPEG export, which was quite useless.
- Finally in other types of plug-ins, setting a non-XCF file extension was
  interfering with the save feature (similarly to commit e6e73e14c7). I only
  fixed the screenshot implementations doing such a thing.
- I left a few usages which will have to be looked at more in details later.
2023-02-13 22:54:16 +01:00
Luca Bacci e360cef004 screenshot-win32-magnification-api.h: Fix coding style 2023-01-24 14:48:44 +00:00
Luca Bacci ed1e4236ba Use GetModuleHandleW ()
Also fix an unwanted ref-count increment on a module HANDLE
2023-01-24 14:48:44 +00:00
Luca Bacci f7be0cf68e Use LoadLibraryW () 2023-01-24 14:48:44 +00:00
Jehan df074bfe09 plug-ins: label and documentation of plug-ins localized plug-in side.
This is the consequence of previous commit. Plug-ins' label and
documentation are now localized before sending these data to GIMP core.
In other words, we replace N_() macros with basic gettext calls.
2022-07-05 12:23:51 +02:00
Jehan 18c37f7084 plug-ins, libgimp: override set_i18n() for all our core plug-ins.
Hence avoiding the stderr messages. These are going to be localized with
centrally installed catalogs "gimp*-std-plugins", "gimp*-script-fu" and
"gimp*-python".

We now handle core plug-in localizations differently and in particular,
with kind of a reverse logic:

- We don't consider "gimp*-std-plugins" to be the default catalog
  anymore. It made sense in the old world where we would consider the
  core plug-ins to be the most important and numerous ones. But we want
  to push a world where people are even more encouraged to develop their
  own plug-ins. These won't use the standard catalog anymore (because
  there are nearly no reasons that the strings are the same, it's only a
  confusing logic). So let's explicitly set the standard catalogs with
  DEFINE_STD_SET_I18N macro (which maps to a different catalog for
  script-fu plug-ins).
- Doing something similar for Python plug-ins which have again their own
  catalog.
- Getting rid of the INIT_I18N macro since now all the locale domain
  binding is done automatically by libgimp when using the set_i18n()
  method infrastructure.
2022-06-05 01:57:02 +02:00
Nikc 94c7f80282 Issue #4009: enables option to capture cursor in screenshot (Windows) 2022-01-19 01:28:47 +00:00
Jehan ef9c483771 plug-ins: remove KDE screenshot portal in favor of Freedesktop portal.
On recent KDE, the screenshot plug-in fails with an authorization error,
unless we add a desktop file with a special KDE-only desktop entry to
give the permission, which seems a bit over-the-top (if we were to add a
desktop file for every plug-in, and with dedicated entries to every
desktop environment out there, it's never-ending). Of course, we are not
against either, but nobody has contributed a patch doing this in the
last year anyway.

Also Méven (KDE dev) was telling us that KDE recommends to use the
Freedesktop portal nowadays. So maybe let's just move on from the
KDE-specific portal, just as we did recently for the GNOME portal too.
This should hopefully take care of all permission issues and in the same
time simplifies the code.

Note that the Freedesktop API might miss some of the features (this was
one of the reason we were avoiding putting it as priority implementation
until now, to avoid feature regression), but the more we go, the less we
have a choice. It's either this or always fighting against the current.
2021-12-17 20:14:18 +01:00
Jehan c502fb18ce plug-ins: show screenshot options dialog immediately in Freedesktop…
… portal.

Otherwise, it first takes a screenshot and proposes to either share or
tweak the "Options" (in the GNOME shell implementation at least). Doing
the other way around is much more in line with how we had done it until
now with our custom dialogs.
2021-12-14 17:59:25 +01:00
Niels De Graef 62953e6830 screenshot: Remove GNOME Shell implementation
GNOME Shell has started restricting access for it's Screenshot D-Bus API
to internal components only [1] for security reasons. In other words,
this will start failing, so remove it in favor of just using the
freedesktop portal, which should always work.

[1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970
2021-12-14 11:36:40 +00:00
Jehan 27dea4f7f7 plug-ins: various g_file_get_path() replaced by g_file_peek_path().
As explained in previous commits, the _peek_ call is advantageous
because:
- It is less bug-prone as we don't have to handle freeing the string. In
  all the cases I changed, I even spotted at least 2 cases where we were
  leaking a string (in file-mng, `temp_file_name` is never freed; and we
  were also leaking in an error case of gfig).
- As a consequence of the previous point: simpler code with less lines.
- In local file cases, the _peek_ variant does not even need to allocate
  an additional string.
- In other case, if we query several times the path, it is allocated
  once and cached so it stays efficient.
- When possible, working on the GFile rather than on a path string may
  be more robust. For instance I changed one g_unlink() into a
  g_file_delete(). Actually most reading/writing should be done with the
  GIO API when possible, but I didn't want to change too much code
  logics on this commit.
2021-10-01 18:47:30 +02:00
Jehan ca8bc2bc1d app, libgimp, pdb, plug-ins: more functions moved to get|set().
The gimp_drawable_type() is an issue though as gimp_drawable_get_type()
is already defined as a common GObject API.
Though I'm actually wondering if GimpImageType is well called. Rather
than Type, shouldn't we go with ColorModel?

sed -i 's/\<gimp_drawable_bpp\>/gimp_drawable_get_bpp/g' "$@"
sed -i 's/\<gimp_drawable_width\>/gimp_drawable_get_width/g' "$@"
sed -i 's/\<gimp_drawable_height\>/gimp_drawable_get_height/g' "$@"
sed -i 's/\<gimp_drawable_offsets\>/gimp_drawable_get_offsets/g' "$@"
2021-04-06 14:34:31 +02:00
Jehan 72d1f9cb6d plug-ins: get rid of gimp_image_(s|g)et_active_layer().
No more usage of the single active layer concept in existing plug-in
code.
2021-02-24 12:09:15 +01:00
nick758 029ffd5778 Issue #5066: Create From Screenshot Crash. 2021-01-02 19:06:03 +01:00
Jehan ba4f24e49c plug-ins: set parent_window parameter to Screenshot function of portal…
… org.freedesktop.portal.Desktop (X11 only).
If we don't set this parameter appropriately, the created dialog is not
modal/transient relatively to the main GIMP window. This is especially
annoying because in my tests (GNOME shell), the screenshot dialog would
appear behind GIMP window, which makes it feel like broken behavior.

Note that the supported handles are X11 only so far. We'll need to
generate the appropriate Wayland handles too (created from xdg_foreign
protocol).
2020-12-30 22:22:55 +01:00
Jehan aab1d0c227 plug-ins: do not show our own dialog with Freedesktop screenshot portal.
Today I have only re-tested the GNOME implementation (in particular not
the KDE one) of the portal API org.freedesktop.portal.Screenshot but I
assume it is similar because the dbus function does not provide any
useful options anyway. This is why the portal comes with its own dialog
providing the various common screenshot features (delay, window picking,
area selection, etc.). Showing our dialog first is therefore redundant.

Also I updated setting the monitor profile only in the case where the
loaded image result from the portal did not have an embedded profile. To
be fair, the GNOME implementation at least does not embed a profile to
this day. So this is only for the future case where they will finally do
the right thing and embed the display profile (or for other desktops'
implementations where they maybe already do the right thing).
2020-12-30 17:29:17 +01:00
Jehan a29ece23b9 plug-ins: screenshot_x11_available() should not always return TRUE.
This was true in the "old world" where X11 support being built-in meant
that X11 screenshot would be usable. Now we must not only check it is
built, but also that we are actually running under X11. Otherwise with a
Wayland compositor, screenshot would fail. Also it meant that the
Freedesktop portal was never tried if both X11 and Wayland support were
built-in.
2020-12-30 16:14:13 +01:00
Niels De Graef fa4eb263a0 plug-ins: screenshot: Remove GDK_NATIVE_WINDOW_POINTER
It's a GTK+ 2.0 construct, so anything within such an `#if` will be dead
code anyway.
2020-12-30 12:23:34 +01:00
Jehan 70cf57154f plug-ins: fix some warnings in Win32 screenshot code.
Fixes:
> warning: old-style function definition [-Wold-style-definition]
2020-08-02 19:49:22 +02:00
Jacob Boerema 248d2e95b8 plug-ins: enable screenshot for non x11 targets in meson build.
This also removes screenshot as an option for the meson build
since the autotools build doesn't have that option either.
2020-08-01 22:28:34 +00:00
Niels De Graef ae34e778fc meson: Use libgimp(ui)_dep in plug-ins meson files
This gives a big cleanup in the meson.build files of the plug-ins.

It's also quite a bit more maintainable, since anything that changes in
libgimp's dependencies, linkage, ... doesn't have to be copy-pasted into
each plug-in.
2020-05-11 07:01:37 +02:00
lillolollo 202012ba73 plug-ins: screenshot-win32.c forbids mixed declarations and code
(cherry picked from commit 09fb64c604)
2020-04-12 19:39:30 +00:00
Ell 4fe8217898 plug-ins: in screenshot, keep image dirty; keep history clean
In the screenshot plug-in, don't clean the image, since it's not
backed by any persistent source, and disable undo while modifying
it, so that the initial edit history is clean.
2020-02-16 23:05:12 +02:00
Oleksii Samorukov cfcf38e119 plug-ins/screenshot: fix compilation on macOS 2020-01-17 11:40:35 +01:00
Jehan ec9dbd8115 libgimpwidgets, app, plug-ins: fix last GIR warnings.
gimp_int_radio_group_new() was still complaining about the scope of
radio_button_callback(). Make it (scope notified) because it needs to
stay alive after the function returns and may be called multiple times.

Also adding a GDestroyNotify to free the callback data once the widget
is destroyed (additionally it will also serve as a notifier for bindings
to properly free the callback closure itself, not only it's data).

With this last one done, GObject Introspection generation now happens
without any warning output.
2020-01-15 14:00:19 +01:00
Michael Natterer df8d5b02ae libgimp, plug-ins: remove the "preview" parameter from gimp_ui_init()
It's dead since a looong time.
2019-09-20 19:56:00 +02:00
Michael Natterer 6468fa06c7 pdb, plug-ins: change gimp_temp_name() to gimp_temp_file() 2019-09-11 22:32:44 +02:00
Michael Natterer 6bca8c4f89 pdb, app, libgimp, plug-ins: replace most PDB filenames/URIs by GFile
and in an attack of madness, changes almost all file plug-in
code to use GFile instead of filenames, which means passing
the GFile down to the bottom and get its filename at the very
end where it's actually needed.
2019-09-11 21:48:34 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer f3fb3d1a57 Remove the second "raw-filename"/"raw-uri" parameter from file procedures
It's an ancient concept from ancient times when we didn't have URIs
and only filenames (not to speak of GFile), and actually even from
before the ancient time before that ancient time when we first had
ones and zeros, and only had zeros.
2019-09-11 00:21:03 +02:00
Michael Natterer 8a78203aed Properly prefix the values of enum GimpPDBProcType
to be GIMP_PDB_PROC_TYPE_PLUGIN, _EXTENSION etc.
2019-08-30 12:52:28 +02:00
Michael Natterer 392f00baf5 app, libgimp: get rid of all ID GTypes and ID param specs
Turn all ID param specs into object param specs (e.g. GimpParamImageID
becomes GimpParamImage) and convert between IDs and objects in
gimpgpparams.c directly above the the wire protocol, so all of app/,
libgimp/ and plug-ins/ can deal directly with objects down to the
lowest level and not care about IDs.

Use the actual object param specs for procedure arguments and return
values again instead of a plain g_param_spec_object() and bring back
the none_ok parameter.

This implies changing the PDB type checking functions to work on pure
integers instead of IDs (one can't check whether object creation is
possible if performing that check requires the object to already
exist).

For example gimp_foo_is_valid() becomes gimp_foo_id_is_valid() and is
not involved in automatic object creation magic at the protocol
level. Added wrappers which still say gimp_foo_is_valid() and take the
respective objects.

Adapted all code, and it all becomes nicer and less convoluted, even
the generated PDB wrappers in app/ and libgimp/.
2019-08-29 11:39:34 +02:00
Jehan bf79896db1 plug-ins: port (hopefully) missing Win32 screenshot code.
Seems I missed this part. Hopefully this is good now. This is untested,
not even a build test.
2019-08-26 16:50:25 +02:00
Jehan 9f0dbb5759 plug-ins: port screenshot to GimpImage/GimpDrawable. 2019-08-22 15:54:36 +02:00
Jehan ee8b467e9f libgimp: GimpSaveProcedure() now uses GimpImage/GimpDrawable object...
... as parameters.
And GimpLoadProcedure() now expects the run() function to return a
GimpImage object.
2019-08-22 15:54:36 +02:00
Jehan e0d50aa121 plug-ins: keep building all plug-ins with old API.
Build existing plug-ins with -DGIMP_DEPRECATED_REPLACE_NEW_API.
We will port the plug-ins one at a time to the new GimpImage API.
2019-08-22 15:54:36 +02:00
Michael Natterer 4cb4b3ef3a plug-ins: port all plug-ins to the new macros 2019-08-20 01:03:38 +02:00
Michael Natterer 9cabc8c8d0 libgimp, plug-ins: use the new macros everwhere
Except for gimp_param_spec_string() which is on its way back to the
core.
2019-08-19 10:02:07 +02:00
Michael Natterer 5c4fa2de51 plug-ins: port screenshot to GimpPlugIn 2019-08-15 11:48:05 +02:00
Michael Natterer b007269729 Use g_strlcpy() instead of strncpy() everywhere
except where I didn't understand the code after 10 seconds of
looking..
2019-08-14 23:52:38 +02:00
Michael Natterer 155bc75a75 libimp*, app: get rid of inline pixbufs in the API and in pluginrc
because they are deprecated.

Change GIMP_ICON_TYPE_INLINE_PIXBUF to GIMP_ICON_TYPE_PIXBUF and the
libgimp API to (icon-name, GdkPixbuf, GFile). Use the file's uri and a
PNG blob of the pixbuf to pass around on the wire and for storage in
pluginrc.
2019-08-09 00:16:35 +02:00
Massimo Valentini 6c033317ac issue 3082: screenshot plugin crashes when cancelling...
...the interactive capture dialogue
2019-06-29 18:10:23 +02:00
Jehan 3604e8e7ad Issue #3560: "Screenshot delay: __ seconds" item lacks mnemonic. 2019-06-24 12:00:51 +02:00
Ell 8954d1f386 libgimpwidgets, app, plug-ins: use GimpSpinButton everywhere
Replace all direct uses of GtkSpinButton with GimpSpinButton, so
that its modified behavior extends to all our spin buttons.
2019-03-09 07:28:52 -05:00
Ell 053e5edc93 libgimpcolor, app, modules, plug-ins: remove GEGL_ITERATOR2 define
... it's no longer needed, since GEGL commit
gegl@9dcd2cde63f95a080bf16a58c10e9ffbdd99aace.

Partially reverts commits:

6fca9959c7
cc10af72cc
49c53568d7
8edbc0d491
29f63616d2
3a2014984d
ee48ec6877
4165a315d5
764085278f
b7633c722e
6ab12061b7
754a3c5b18
22b4b647bd
55b3438328
c6d23add65
f03a84d607
822f9f0d2b
95358ca1fa
cdda37f4ee
41e8035635
6761da42b2
fb5d7832a8
97ed7817d8
46e9036578
ea9c5e6a49
24fbdfb591
beb4ecb238
4b77831e03
fcf113a39c
567ffe94ff
2018-12-02 11:15:37 -05:00
Øyvind Kolås cc10af72cc plug-ins: migrate screenshot-x11 to new iterator api 2018-09-11 02:05:13 +02:00
luz.paz 732bcb463e Misc. comment typos
Found via `codespell`
2018-07-14 19:07:43 +00:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 80997a8646 Remove most GTK_ADJUSTMENT() and (GtkAdjutment *) casts
they are obsolete in GTK+ 3.x because GtkAdjustment cannot be passed
around as GtkObject any longer, GtkObject is gone.
2018-06-24 18:15:16 +02:00