Having windows ID as guint32 is a mistake. Different systems have
different protocols. In Wayland in particular, Windows handles are
exchanged as strings. What this commit does is the following:
In core:
- get_window_id() virtual function in core GimpProgress is changed to
return a GBytes, as a generic "data" to represent a window differently
on different systems.
- All implementations of get_window_id() in various classes implementing
this interface are updated accordingly:
* GimpSubProgress
* GimpDisplay returns the handle of its shell.
* GimpDisplayShell now creates its window handle at construction with
libgimpwidget's gimp_widget_set_native_handle() and simply return
this handle every time it's requested.
* GimpFileDialog also creates its window handle at construction with
gimp_widget_set_native_handle().
- gimp_window_set_transient_for() in core is changed to take a
GimpProgress as argument (instead of a guint32 ID), requests and
process the ID itself, according to the running platform. In
particular, the following were improved:
* Unlike old code, it will work even if the window is not visible yet.
In such a case, the function simply adds a signal handler to set
transient at mapping. It makes it easier to use it at construction
in a reliable way.
* It now works for Wayland too, additionally to X11.
- GimpPdbProgress now exchanges a GBytes too with the command
GIMP_PROGRESS_COMMAND_GET_WINDOW.
- display_get_window_id() in gimp-gui.h also returns a GBytes now.
PDB/libgimp:
- gimp_display_get_window_handle() and gimp_progress_get_window_handle()
now return a GBytes to represent a window handle in an opaque way
(depending on the running platform).
In libgimp:
- GimpProgress's get_window() virtual function changed to return a
GBytes and renamed get_window_handle().
- In particular GimpProgressBar is the only implementation of
get_window_handle(). It creates its handle at object construction with
libgimpwidget's gimp_widget_set_native_handle() and the virtual
method's implementation simply returns the GBytes.
In libgimpUi:
- gimp_ui_get_display_window() and gimp_ui_get_progress_window() were
removed. We should not assume anymore that it is possible to create a
GdkWindow to be used. For instance this is not possible with Wayland
which has its own way to set a window transient with a string handle.
- gimp_window_set_transient_for_display() and
gimp_window_set_transient() now use an internal implementation similar
to core gimp_window_set_transient_for(), with the same improvements
(works even at construction when the window is not visible yet + works
for Wayland too).
In libgimpwidgets:
- New gimp_widget_set_native_handle() is a helper function used both in
core and libgimp* libraries for widgets which we want to be usable as
possible parents. It takes care of getting the relevant window handle
(depending on the running platform) and stores it in a given pointer,
either immediately or after a callback once the widget is mapped. So
it can be used at construction. Also it sets a handle for X11 or
Wayland.
In plug-ins:
- Screenshot uses the new gimp_progress_get_window_handle() directly now
in its X11 code path and creates out of it a GdkWindows itself with
gdk_x11_window_foreign_new_for_display().
Our inter-process transient implementation only worked for X11, and with
this commit, it works for Wayland too.
There is code for Windows but it is currently disabled as it apparently
hangs (there is a comment in-code which links to this old report:
https://bugzilla.gnome.org/show_bug.cgi?id=359538). NikcDC tested
yesterday with re-enabling the code and said they experienced a freeze.
;-(
Finally there is no infrastructure yet to make this work on macOS and
apparently there is no implementation of window handle in GDK for macOS
that I could find. I'm not sure if macOS doesn't have this concept of
setting transient on another processus's window or GDK is simply lacking
the implementation.
Fix the dependency by making the stamp an actual (yet empty/no-op)
header file which is included by all generated source file. This way, we
ensure that meson rebuild .o files when the .pdb sources are changed.
This is the second solution proposed by eli-schwartz here:
https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080053413
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/.
No need of is_id_arg() anymore in pdb/lib.pl. Let's reuse the {id}
value. Also I had to add an additional trick for GimpDisplay which we
will now generate as such in libgimp PDB files, but still need to show
as GimpObject on app/pdb/.
As previously, only the new classes and the PDB generation for a first
step.
This means that all functions which were returning or taking as
parameter an image id (as gint32) are now taking a GimpImage object
instead.
The PDB is still passing around an id only over the wire. But we create
an object for plug-ins to work on.
This is quite a huge API break, but is probably the best bet for the
future quality. It will make nicer API instrospection (and nicer API in
binding), will fix the issues with pspec on GimpImageID in Python
bindings (which makes the current Python API unusable as soon as we need
to work on images, which is most of our plug-ins!), etc.
Also it will allow to use signals on images, which will be a great asset
when we will finally have bi-directionnal communications (i.e. plug-ins
would be able to connect to image changes, destructions, and whatnot).
So a value array can now we created like this:
array = gimp_value_array_new_from_types (&error_msg,
G_TYPE_STRING, "foo",
G_TYPE_INT, 23,
G_TYPE_NONE);
Change PDB generation to use this, which makes for much nicer code in
the libgimp wrappers, and only set arrays separately instead of all
values.
This reverts commit 833666d462.
The _pdb files are an implementation detail and we do not want
separate doc sections for them, the conflicts need so be resolved in
another way.
Otherwise we get a few duplicate sections since some of the non-PDB
files are named similarly.
Fix this GObject introspection warning and other similar warnings:
> libgimp/gimp_pdb.c:28: Warning: Gimp: multiple comment blocks
> documenting 'SECTION:gimp:' identifier (already seen at gimp.c:129).
All foo_pdb.c functions in libgimp regenerated. I have reviewed this a
dozen times, but please have a look, there might well be glitches and
our public API is sortof important...
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.
2009-01-17 Michael Natterer <mitch@gimp.org>
* all files with a GPL header and all COPYING files:
Change licence to GPLv3 (and to LGPLv3 for libgimp).
Cleaned up some copyright headers and regenerated the parsers in
the ImageMap plugin.
svn path=/trunk/; revision=27913
2007-04-12 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/display.pdb (display_delete): added a note that
calling this function may cause data loss.
* app/pdb/display_cmds.c
* libgimp/gimpdisplay_pdb.c: regenerated.
svn path=/trunk/; revision=22243
2006-06-14 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/[many].pdb: in help texts, refer to other
procedures using_c_syntax(). This way gtk-doc can cross-reference
them correctly in libgimp, and app.pl will transform them
'to-canonical-names' for PDB registering.
* app/pdb/[many]_cmds.c
* libgimp/[many]_pdb.c: regenerated.
2005-09-05 Sven Neumann <sven@gimp.org>
Address bug #307971:
* app/core/gimp-gui.[ch]
* app/display/gimpdisplay.[ch]
* app/gui/gui-vtable.c
* tools/pdbgen/pdb/display.pdb: added PDB function to obtain a
window handle on an image display.
* app/pdb/display_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimpdisplay_pdb.[ch]: regenerated.
* libgimp/gimpui.[ch]: added functions to set a GtkWindow transient
to an image display.
* plug-ins/common/gauss.c: use the new function exemplarily.
* libgimp/gimp.def
* libgimp/gimpui.def: updated.
2005-08-03 Michael Natterer <mitch@gimp.org>
Changed naming scheme for PDB procedure names from
random_crap_that_traditionally_has_underscores to
enforced-canonical-identifiers. I'm pretty sure some things are
broken after this commit. More changes to come...
* libgimpbase/gimpbase.def
* libgimpbase/gimputils.[ch]: added gimp_canonicalize_identifier().
* app/pdb/procedural_db.[ch] (struct ProcRecord): added
"gchar *original_name" to keep a procedure's original name as
reigstered by plug-ins (compat cruft).
(procedural_db_init_procs): canonicalized list of deprecated
procedures.
* app/plug-in/plug-in-proc-def.c (plug_in_proc_def_free): free
original_name.
* app/plug-in/plug-in-message.c: canonicalize procedure names
which are received over the wire.
* app/plug-in/plug-in-rc.c: serialize the original_name and create
the canonicalized name on-the-fly when deserializing.
* app/plug-in/plug-in-run.c: pass the original_name to plug-ins
when running them because they strcmp() the passed procedure name.
* app/plug-in/plug-ins.c (plug_ins_add_to_db): pass
canonical procedure names to procedural_db_execute().
(plug_ins_file_proc_compare): special-case "gimp-xcf", not "gimp_xcf".
* app/xcf/xcf.c: changed static XCF procedures accordingly.
* tools/pdbgen/app.pl
* tools/pdbgen/lib.pl: do some trivial substitutions to generate
canonicalized names in app/, and C identifiers with underscores in
libgimp/.
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/fileops.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/patterns.pdb
* tools/pdbgen/pdb/plug_in.pdb
* tools/pdbgen/pdb/procedural_db.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/transform_tools.pdb: canonicaloized procedure
names in calls to std_pdb_deprecated() and in procedure names in
generated C code.
* app/pdb/*_cmds.c
* libgimp/*_pdb.c: regenerated.
2004-11-29 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/display.pdb: make it work as documented (fail
if the new_image already has a display). Also fail if the
old_image doesn't have any display (changed docs accordingly).
On success, take over the initial reference count of the new
image, just as the gimp_display_new() PDB wrapper does.
Fixes bug #159051.
* app/pdb/display_cmds.c
* libgimp/gimpdisplay_pdb.c: regenerated.
2002-12-03 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/display.pdb
* tools/pdbgen/pdb/layer.pdb: applied a modified version of a
patch from Wolfgang Hofer <hof@gimp.org> that adds two new PDB
functions needed for GAP: gimp_displays_reconnect() and
gimp_layer_new_from_drawable() (bug #77508).
* app/pdb/display_cmds.c
* app/pdb/internal_procs.c
* app/pdb/layer_cmds.c
* libgimp/gimpdisplay_pdb.[ch]
* libgimp/gimplayer_pdb.[ch]: regenerated.
* configure.in: $srcdir != $builddir fix for GIMP_CONTRIBUTORS
* plug-ins/common/plugin-defs.pl: More tidying up after Daniel Egger
* tools/pdbgen/Makefile.am: parse pdb defs only once for app and lib
* tools/pdbgen/lib.pl
* tools/pdbgen/pdb/procedural_db.pdb: all void rets now return a
boolean for success/failure
-Yosh
2000-06-01 Michael Natterer <mitch@gimp.org>
Sven Neumann <sven@gimp.org>
Completed the new file structure. Yet only few of the _pdb.[ch]
files are based upon generated code and nothing is really
autogenerated...
* app/Makefile.am
* app/gdisplay_cmds.c -> app/display_cmds.c
* app/gimage_cmds.c -> app/image_cmds.c
* app/gimage_mask_cmds.c -> app/selection_cmds.c
* app/internal_procs.c: related change
* libgimp/Makefile.am
* libgimp/gimp.h
* libgimp/gimp_pdb.h
* libgimp/gimpdisplay_pdb.[ch]
* libgimp/gimpimage_pdb.[ch]
* libgimp/gimpselection_pdb.[ch]: replaced with code based on files
generated using pdbgen
* libgimp/gimpchannelops_pdb.[ch]
* libgimp/gimpcolor_pdb.[ch]
* libgimp/gimpedit_pdb.[ch]
* libgimp/gimpfloatingsel_pdb.[ch]
* libgimp/gimpgimprc_pdb.[ch]
* libgimp/gimptexttool_pdb.[ch]
* libgimp/gimptools_pdb.[ch]
* libgimp/gimpundo_pdb.[ch]: new files based on generated code
* libgimp/gimpgradientselect.[ch]
* libgimp/gimpimage.[ch]
* libgimp/gimpselection.[ch]: new files wrapping around the
autogenerated PDB wrappers as found in *_pdb.[ch]. This is necessary
since the number of parameters or their order is different from the
PDP calls.
* plug-ins/common/CEL.c: plugged memleak
* plug-ins/common/aa.c: removed compiler warning
* tools/pdbgen/Makefile.am
* tools/pdbgen/groups.pl
* tools/pdbgen/pdb/gdisplay.pdb -> display.pdb
* tools/pdbgen/pdb/gimage.pdb -> image.pdb
* tools/pdbgen/pdb/gimage_mask.pdb -> selection.pdb
* tools/pdbgen/pdb/channel_ops.pdb
* tools/pdbgen/pdb/color.pdb
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/floating_sel.pdb
* tools/pdbgen/pdb/gimprc.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/tools.pdb
* tools/pdbgen/pdb/undo.pdb: made them create libgimp code