gimp/app/plug-in/plug-in-shm.c

298 lines
7.3 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*/
1997-11-25 06:05:25 +08:00
#include "config.h"
1999-03-07 20:56:03 +08:00
#include <sys/types.h>
#include <errno.h>
#if defined(USE_SYSV_SHM)
#ifdef HAVE_IPC_H
#include <sys/ipc.h>
#endif
#ifdef HAVE_SHM_H
#include <sys/shm.h>
1999-03-07 21:23:06 +08:00
#endif
#elif defined(USE_POSIX_SHM)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/mman.h>
#endif /* USE_POSIX_SHM */
#include <glib-object.h>
1999-03-07 20:56:03 +08:00
1999-10-07 05:27:18 +08:00
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
1999-03-07 20:56:03 +08:00
#define STRICT
#include <windows.h>
#include <process.h>
#ifdef G_OS_WIN32
1999-03-07 20:56:03 +08:00
#include <fcntl.h>
#include <io.h>
#endif
#define USE_WIN32_SHM 1
#endif /* G_OS_WIN32 || G_WITH_CYGWIN */
1999-03-07 20:56:03 +08:00
app/Makefile.am removed... 2001-11-30 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/plug_in.[ch]: removed... * app/plug-in/Makefile.am * app/plug-in/plug-in-types.h * app/plug-in/plug-in.[ch]: ...and added here. * app/appenv.h: removed StackTraceMode and MessageHandlerType... * libgimpbase/gimpbasetypes.h: ...and added them here. * tools/pdbgen/Makefile.am: don't scan "app/apptypes.h" for enums. * tools/pdbgen/enumcode.pl: added a general check to prevent enums which are defined in libgimp* from being written to "libgimp/gimpenums.c". * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * app/core/core-types.h: include "pdb/pdb-types.h" so including "core/core-types.h" gets the whole core type space. * app/core/gimp.[ch]: added a "stack_trace_mode" parameter to the constructor and store it in the Gimp struct because the value is also passed to plug-ins and nobody should include "appenv.h". * app/gimprc.[ch]: pass the alternate_system_gimprc and alternate_gimprc filenames from the command line to gimprc_prase() so we don't need to include "appenv.h". * app/batch.[ch]: pass the "batch_cmds" as parameter, don't include "append.h". * app/app_procs.c: pass more parameters around. * app/devices.c * app/errors.c * app/gimphelp.c * app/main.c * app/core/gimpgradient.c * app/display/gimpdisplay.c * app/display/gimpdisplayshell.c * app/file/file-open.c * app/file/file-save.c * app/file/file-utils.c * app/gui/commands.c * app/gui/error-console-dialog.c * app/gui/file-dialog-utils.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/paths-dialog.c * app/gui/user-install-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/xinput_airbrush.c * app/xcf/xcf.c * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/plug_in.pdb: changed accordingly: - changed "plug-in.h" include where needed. - don't call gimp_fatal_error() directly, it's called via the log handler when calling g_error(). - don't incude "errors.h" except from main.c. - changed stack_trace and message_handler enum names. - get "stack_trace_mode" from Gimp. - removed many inclusions of "appenv.h". * app/pdb/fileops_cmds.c * app/pdb/help_cmds.c * app/pdb/message_cmds.c * app/pdb/plug_in_cmds.c * app/pdb/procedural_db.c: regenerated.
2001-12-01 08:14:14 +08:00
#include "plug-in-types.h"
new directory app/base/ 2001-05-15 Michael Natterer <mitch@gimp.org> * configure.in: new directory app/base/ * app/Makefile.am * app/boundary.[ch] * app/brush_scale.[ch] * app/gimpchecks.h * app/gimplut.[ch] * app/pixel_processor.[ch] * app/pixel_region.[ch] * app/pixel_surround.[ch] * app/temp_buf.[ch] * app/tile.[ch] * app/tile_cache.[ch] * app/tile_manager.[ch] * app/tile_manager_pvt.h * app/tile_pvt.h * app/tile_swap.[ch]: moved to base/ * app/base/Makefile.am * app/base/base-types.h * app/base/*: new directory for the sub-object pixel maniplation and storage stuff. Does not include Gtk+ or anything outside base/. Did some cleanup in all files. * app/appenums.h * app/apptypes.h * app/core/gimpimage.h: removed types which are now in base/base-types.h. * app/base/base-config.[ch] * app/gimprc.[ch]: put the config variables for base/ to their own file so base/ doesn not have to include gimprc.h (does not yet work, i.e. the variables are un-configurable right now) * app/main.c: set a log handler for "Gimp-Base". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs.[ch]: removed the color hash which maps RGB to color indices because it's a totally standalone system which has nothing to do with the paint-funcs and introduced a GimpImage dependency. paint-funcs/ should be considered on the same sub-object (glib-only) level as base/, only in a different directory. * app/core/Makefile.am * app/core/gimpimage-colorhash.[ch]: put the color hash here. * app/gimage.c: don't invalidate the color hash here... * app/core/gimpimage.c: ... but in the colormap_changed() default inplementation. Initialize the hash in class_init(). * tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums. * tools/pdbgen/enums.pl: regenerated. * app/[lots] * app/core/[of] * app/gui/[files] * app/pdb/[all] * app/tools/[over] * app/widgets/[the] * tools/pdbgen/pdb/[place]: changed #includes accordingly. And use base_config->value instead of the stuff from gimprc.h.
2001-05-15 19:25:25 +08:00
#include "base/tile.h"
Finally landed the new GimpConfig based gimprc parser. It's not finished 2002-11-18 Sven Neumann <sven@gimp.org> Finally landed the new GimpConfig based gimprc parser. It's not finished yet but we need to start somewhere. This release removes the old gimprc.[ch] files. The gimprc format changes slightly, but the changes are minimal. The Preferences dialog is temporarily disabled since it still needs to be ported. If you are are afraid, stay away from CVS for a few days ;-) * app/Makefile.am * app/gimprc.[ch]: removed the old gimprc system. * app/base/Makefile.am * app/base/base-config.[ch]: removed these files in favor of config/gimpbaseconfig.[ch]. * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: removed these files in favor of config/gimpcoreconfig.[ch]. * app/config/Makefile.am * app/config/config-types.h: moved typedefs into this new file. * app/config/gimpbaseconfig.[ch] * app/config/gimpcoreconfig.[ch] * app/config/gimpdisplayconfig.[ch] * app/config/gimpguiconfig.[ch] * app/config/gimprc.[ch] * app/config/test-config.c: brought into shape for real use. * app/base/base-types.h: include config/config-types.h here. Added a global GimpBaseConfig *base_config variable to ease migration. * app/gui/Makefile.am: temporarily disabled the preferences dialog. * app/app_procs.c * app/undo.c * app/undo_history.c * app/base/base.[ch] * app/base/gimphistogram.c * app/base/pixel-processor.c * app/base/temp-buf.c * app/base/tile-cache.c * app/core/core-types.h * app/core/gimp-documents.c * app/core/gimp.c * app/core/gimpbrush.c * app/core/gimpbrushgenerated.c * app/core/gimpcontext.c * app/core/gimpdrawable-transform.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpimagefile.c * app/core/gimpmodules.c * app/core/gimppattern.c * app/display/Makefile.am * app/display/gimpdisplay-handlers.c * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c * app/display/gimpdisplayshell-selection.c * app/display/gimpdisplayshell.[ch] * app/display/gimpnavigationview.c * app/file/file-save.c * app/gui/device-status-dialog.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gui.c * app/gui/menus.c * app/gui/paths-dialog.c * app/gui/resize-dialog.c * app/gui/session.c * app/gui/test-commands.c * app/gui/tips-dialog.c * app/gui/tips-dialog.h * app/gui/user-install-dialog.c * app/gui/view-commands.c * app/paint/gimppaintcore.c * app/plug-in/plug-in.c * app/plug-in/plug-ins.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimptexttool.[ch] * app/tools/selection_options.c * app/tools/tools.c * app/tools/transform_options.c * app/widgets/gimphelp.c * app/widgets/gimpitemfactory.c * app/widgets/gimpselectioneditor.c * app/xcf/xcf-load.c * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gimprc.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/transform_tools.pdb: use the new config system instead of the old gimprc stuff. * etc/gimprc.in * etc/gimprc_user.in: adapted to the new gimprc format. Will update the man-page later... * app/pdb/fileops_cmds.c * app/pdb/gimprc_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpgimprc_pdb.c: regenerated.
2002-11-19 04:50:31 +08:00
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
#include "core/gimp.h"
1997-11-25 06:05:25 +08:00
#include "plug-in-shm.h"
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
struct _PlugInShm
{
gint shm_ID;
guchar *shm_addr;
1997-11-25 06:05:25 +08:00
#if defined(USE_WIN32_SHM)
HANDLE shm_handle;
1999-03-07 20:56:03 +08:00
#endif
};
1999-03-07 20:56:03 +08:00
1999-05-07 04:56:07 +08:00
#define TILE_MAP_SIZE (TILE_WIDTH * TILE_HEIGHT * 4)
#define ERRMSG_SHM_DISABLE "Disabling shared memory tile transport"
void
plug_in_shm_init (Gimp *gimp)
1999-05-07 04:56:07 +08:00
{
/* allocate a piece of shared memory for use in transporting tiles
* to plug-ins. if we can't allocate a piece of shared memory then
* we'll fall back on sending the data over the pipe.
*/
#if defined(USE_SYSV_SHM)
/* Use SysV shared memory mechanisms for transferring tile data. */
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
gimp->plug_in_shm->shm_ID = shmget (IPC_PRIVATE, TILE_MAP_SIZE,
IPC_CREAT | 0600);
if (gimp->plug_in_shm->shm_ID != -1)
1999-05-07 04:56:07 +08:00
{
gimp->plug_in_shm->shm_addr = (guchar *)
shmat (gimp->plug_in_shm->shm_ID, NULL, 0);
if (gimp->plug_in_shm->shm_addr == (guchar *) -1)
{
g_warning ("shmat() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
gimp->plug_in_shm->shm_ID = -1;
}
#ifdef IPC_RMID_DEFERRED_RELEASE
if (gimp->plug_in_shm->shm_addr != (guchar *) -1)
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
1999-05-07 04:56:07 +08:00
#endif
}
else
{
g_warning ("shmget() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
}
#elif defined(USE_WIN32_SHM)
/* Use Win32 shared memory mechanisms for transferring tile data. */
gint pid;
gchar fileMapName[MAX_PATH];
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
1999-05-07 04:56:07 +08:00
/* Our shared memory id will be our process ID */
pid = GetCurrentProcessId ();
1999-05-07 04:56:07 +08:00
/* From the id, derive the file map name */
g_snprintf (fileMapName, sizeof (fileMapName), "GIMP%d.SHM", pid);
1999-05-07 04:56:07 +08:00
/* Create the file mapping into paging space */
gimp->plug_in_shm->shm_handle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
PAGE_READWRITE, 0,
TILE_MAP_SIZE,
fileMapName);
if (gimp->plug_in_shm->shm_handle)
1999-05-07 04:56:07 +08:00
{
/* Map the shared memory into our address space for use */
gimp->plug_in_shm->shm_addr = (guchar *)
MapViewOfFile (gimp->plug_in_shm->shm_handle,
FILE_MAP_ALL_ACCESS,
0, 0, TILE_MAP_SIZE);
1999-05-07 04:56:07 +08:00
/* Verify that we mapped our view */
if (gimp->plug_in_shm->shm_addr)
gimp->plug_in_shm->shm_ID = pid;
else
g_warning ("MapViewOfFile error: %d... " ERRMSG_SHM_DISABLE,
GetLastError ());
1999-05-07 04:56:07 +08:00
}
else
{
g_warning ("CreateFileMapping error: %d... " ERRMSG_SHM_DISABLE,
GetLastError ());
1999-05-07 04:56:07 +08:00
}
#elif defined(USE_POSIX_SHM)
/* Use POSIX shared memory mechanisms for transferring tile data. */
gint pid;
gchar shm_handle[32];
gint shm_fd;
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
/* Our shared memory id will be our process ID */
pid = getpid ();
/* From the id, derive the file map name */
g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d", pid);
/* Create the file mapping into paging space */
shm_fd = shm_open (shm_handle, O_RDWR | O_CREAT, 0600);
if (shm_fd != -1)
{
if (ftruncate (shm_fd, TILE_MAP_SIZE) != -1)
{
/* Map the shared memory into our address space for use */
gimp->plug_in_shm->shm_addr = (guchar *)
mmap (NULL, TILE_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
shm_fd, 0);
/* Verify that we mapped our view */
if (gimp->plug_in_shm->shm_addr != MAP_FAILED)
gimp->plug_in_shm->shm_ID = pid;
else
{
g_warning ("mmap() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shm_unlink (shm_handle);
}
}
else
{
g_warning ("ftruncate() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shm_unlink (shm_handle);
}
}
else
{
g_warning ("shm_open() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
}
#endif
1999-05-07 04:56:07 +08:00
}
1997-11-25 06:05:25 +08:00
void
plug_in_shm_exit (Gimp *gimp)
1997-11-25 06:05:25 +08:00
{
link the app in a different order as some init functions are called from 2001-10-19 Michael Natterer <mitch@gimp.org> * app/Makefile.am: link the app in a different order as some init functions are called from core/gimp.c instead of app_procs.c now. * app/app_procs.[ch]: made app_init_update_status() private and pass it as callback to various init functions. * app/plug_in.[ch]: plug_in_init() take "gimp" and "status_callback" parameters. * app/undo.c: use "gimage->gimp" instead of "the_gimp", don't include "app_procs.h". * app/core/core-types.h: added "GimpInitStatusFunc" typedef. * app/core/gimp.[ch]: gimp_initialize() and gimp_restore() now take a "status_callback" as parameter. Don't include "app_procs.h". * app/core/gimpmodules.c: putting the modules in a strong container was a bad idea because it may be impossible to finalize a GimpModuleInfo object belonging to a stalled module. * app/gui/color-area.c: use G_N_ELEMENTS(). * app/gui/session.c: don't call app_init_update_status() and don't include "app_procs.h" because this happens after the splash is hidden. * tools/pdbgen/app.pl * app/pdb/internal_procs.[ch]: pass a "status_callback" to internal_procs_init(), don't include "app_procs.h". * plug-ins/Makefile.am: build gfig, gimpressionist and imagemap again. * plug-ins/MapObject/mapobject_preview.c * plug-ins/MapObject/mapobject_ui.c: s/gdk_image_unref/g_object_unref/ * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/gimpressionist/ppmtool.[ch] * plug-ins/gimpressionist/presets.c * plug-ins/imagemap/imap_browse.[ch] * plug-ins/imagemap/imap_csim.y * plug-ins/imagemap/imap_edit_area_info.c * plug-ins/imagemap/imap_file.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_menu.c * plug-ins/imagemap/imap_polygon.c * plug-ins/imagemap/imap_popup.c * plug-ins/imagemap/imap_preferences.c * plug-ins/imagemap/imap_taglist.c * plug-ins/imagemap/imap_tools.c: ported to current GLib/Gtk+. * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_decode_xanim.c * plug-ins/gap/gap_filter_foreach.c * plug-ins/gap/gap_filter_main.c * plug-ins/gap/gap_frontends_main.c * plug-ins/gap/gap_lib.c * plug-ins/gap/gap_main.c * plug-ins/gap/gap_mod_layer.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/resize.c: half-way fixed this one too but I'm not willing to fix tons of duplicated and deprecated app/ code...
2001-10-20 00:41:09 +08:00
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (gimp->plug_in_shm != NULL);
link the app in a different order as some init functions are called from 2001-10-19 Michael Natterer <mitch@gimp.org> * app/Makefile.am: link the app in a different order as some init functions are called from core/gimp.c instead of app_procs.c now. * app/app_procs.[ch]: made app_init_update_status() private and pass it as callback to various init functions. * app/plug_in.[ch]: plug_in_init() take "gimp" and "status_callback" parameters. * app/undo.c: use "gimage->gimp" instead of "the_gimp", don't include "app_procs.h". * app/core/core-types.h: added "GimpInitStatusFunc" typedef. * app/core/gimp.[ch]: gimp_initialize() and gimp_restore() now take a "status_callback" as parameter. Don't include "app_procs.h". * app/core/gimpmodules.c: putting the modules in a strong container was a bad idea because it may be impossible to finalize a GimpModuleInfo object belonging to a stalled module. * app/gui/color-area.c: use G_N_ELEMENTS(). * app/gui/session.c: don't call app_init_update_status() and don't include "app_procs.h" because this happens after the splash is hidden. * tools/pdbgen/app.pl * app/pdb/internal_procs.[ch]: pass a "status_callback" to internal_procs_init(), don't include "app_procs.h". * plug-ins/Makefile.am: build gfig, gimpressionist and imagemap again. * plug-ins/MapObject/mapobject_preview.c * plug-ins/MapObject/mapobject_ui.c: s/gdk_image_unref/g_object_unref/ * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/gimpressionist/ppmtool.[ch] * plug-ins/gimpressionist/presets.c * plug-ins/imagemap/imap_browse.[ch] * plug-ins/imagemap/imap_csim.y * plug-ins/imagemap/imap_edit_area_info.c * plug-ins/imagemap/imap_file.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_menu.c * plug-ins/imagemap/imap_polygon.c * plug-ins/imagemap/imap_popup.c * plug-ins/imagemap/imap_preferences.c * plug-ins/imagemap/imap_taglist.c * plug-ins/imagemap/imap_tools.c: ported to current GLib/Gtk+. * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_decode_xanim.c * plug-ins/gap/gap_filter_foreach.c * plug-ins/gap/gap_filter_main.c * plug-ins/gap/gap_frontends_main.c * plug-ins/gap/gap_lib.c * plug-ins/gap/gap_main.c * plug-ins/gap/gap_mod_layer.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/resize.c: half-way fixed this one too but I'm not willing to fix tons of duplicated and deprecated app/ code...
2001-10-20 00:41:09 +08:00
#if defined (USE_SYSV_SHM)
#ifndef IPC_RMID_DEFERRED_RELEASE
if (gimp->plug_in_shm->shm_ID != -1)
1997-11-25 06:05:25 +08:00
{
shmdt (gimp->plug_in_shm->shm_addr);
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
1997-11-25 06:05:25 +08:00
}
#else /* IPC_RMID_DEFERRED_RELEASE */
if (gimp->plug_in_shm->shm_ID != -1)
{
shmdt (gimp->plug_in_shm->shm_addr);
}
#endif
1997-11-25 06:05:25 +08:00
#elif defined(USE_WIN32_SHM)
if (gimp->plug_in_shm->shm_handle)
{
CloseHandle (gimp->plug_in_shm->shm_handle);
}
#elif defined(USE_POSIX_SHM)
if (gimp->plug_in_shm->shm_ID != -1)
{
gchar shm_handle[32];
munmap (gimp->plug_in_shm->shm_addr, TILE_MAP_SIZE);
g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d",
gimp->plug_in_shm->shm_ID);
shm_unlink (shm_handle);
}
#endif
g_free (gimp->plug_in_shm);
gimp->plug_in_shm = NULL;
1997-11-25 06:05:25 +08:00
}
gint
plug_in_shm_get_ID (Gimp *gimp)
1997-11-25 06:05:25 +08:00
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
return gimp->plug_in_shm ? gimp->plug_in_shm->shm_ID : -1;
1997-11-25 06:05:25 +08:00
}
guchar *
plug_in_shm_get_addr (Gimp *gimp)
1997-11-25 06:05:25 +08:00
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (gimp->plug_in_shm != NULL, NULL);
return gimp->plug_in_shm->shm_addr;
1997-11-25 06:05:25 +08:00
}