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.
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.
By default the new API will be used. But if we build with
GIMP_DEPRECATED_REPLACE_NEW_API macro, then the same function names will
call the old API with ids.
This way, we don't have to update all our plug-ins at once (which I
tried and is very tedious work).
Note that bindings won't have access to the deprecated API at all.
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).
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
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.
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.
2001-11-23 Sven Neumann <sven@gimp.org>
* configure.in: bumped version number to 1.3.1.
Require Glib/GTK+-1.3.11 and Pango-0.22. Removed GDK_DISABLE_COMPAT_H
and GTK_DISABLE_COMPAT_H from our default CFLAGS since they don't
exist any longer.
* RELEASE-TO-CVS.patch: removed since the glib/gtk+ API is supposed to
be frozen now.
* HACKING: removed reference to RELEASE-TO-CVS.patch
* app/gui/menus.c
* app/tools/gimptexttool.c: applied RELEASE-TO-CVS.patch to conform
to the new GTK+/Pango API.
* app/core/Makefile.am: generate marshallers with gimp_marshal prefix.
* app/core/gimpmarshal.list: added all marshallers we use.
* app/core/gimpmarshal.[ch]: regenerated.
* app/[lots of .c files]: use gimp_marshal_* for all marshallers.
* data/images/
* app/app_procs.c
* app/gui/splash.c:
* libgimpbase/Makefile.am
* libgimpbase/gimpbase.h
* libgimpbase/gimputils.[ch]: removed since they are no longer needed.
* app/gimprc.c
* plug-ins/common/ps.c
* plug-ins/gdyntext/gdyntext.c
* plug-ins/gdyntext/gdyntextcompat.c
* plug-ins/gfig/gfig.c
* plug-ins/gflare/gflare.c
* plug-ins/script-fu/script-fu-scripts.c: use glib functions instead
of gimp_strescape() and gimpstrcompress().
* cleaned up all header files: use G_BEGIN_DECLS/G_END_DECLS, declared
all _get_type function as G_GNUC_CONST.
* tools/pdbgen/enumcode.pl
* tools/pdbgen/lib.pl: make them generate header files using
G_BEGIN_DECLS/G_END_DECLS.
* pixmaps/Makefile.am
* pixmaps/wilber3.xpm: removed ...
* data/images/tips_wilber.png: ... and added here as PNG
* app/gui/tips-dialog.c: load the Wilber on demand using GdkPixbuf.
* data/images/gimp_splash.ppm: removed ...
* data/images/gimp_splash.png: ... and added as PNG
* app/app_procs.c
* app/gui/splash.[ch]: load the splash image using GdkPixbuf.
* app/gui/about-dialog.c: sink the GtkPreview.
* 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