mirror of https://github.com/GNOME/gimp.git
libgimp: add gimp-private.h for private stuff shared between files
instead of declaring stuff n time in various files. This also removes gimp_read_expect_msg() as public symbol from libgimp.
This commit is contained in:
parent
c1499f873e
commit
7201be78d9
|
@ -114,6 +114,7 @@ libgimp_private_sources = \
|
|||
gimpgpparams.h \
|
||||
gimpplugin-private.c \
|
||||
gimpplugin-private.h \
|
||||
gimp-private.h \
|
||||
gimpprocedure-private.c \
|
||||
gimpprocedure-private.h
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimp-private.h
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PRIVATE_H__
|
||||
#define __GIMP_PRIVATE_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#include "libgimpbase/gimpwire.h"
|
||||
|
||||
|
||||
extern GIOChannel *_gimp_writechannel;
|
||||
extern GHashTable *_gimp_temp_proc_ht;
|
||||
|
||||
|
||||
void _gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_PRIVATE_H__ */
|
|
@ -115,9 +115,9 @@
|
|||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpbase/gimpbase-private.h"
|
||||
#include "libgimpbase/gimpprotocol.h"
|
||||
#include "libgimpbase/gimpwire.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimp-private.h"
|
||||
#include "gimpgpcompat.h"
|
||||
#include "gimpgpparams.h"
|
||||
#include "gimpplugin-private.h"
|
||||
|
@ -156,9 +156,6 @@ typedef enum
|
|||
|
||||
#define WRITE_BUFFER_SIZE 1024
|
||||
|
||||
void gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type);
|
||||
|
||||
|
||||
static gint gimp_main_internal (GType plug_in_type,
|
||||
const GimpPlugInInfo *info,
|
||||
|
@ -212,8 +209,8 @@ static LPTOP_LEVEL_EXCEPTION_FILTER _prevExceptionFilter = NULL;
|
|||
static gchar *plug_in_backtrace_path = NULL;
|
||||
#endif
|
||||
|
||||
static GIOChannel *_readchannel = NULL;
|
||||
GIOChannel *_writechannel = NULL;
|
||||
static GIOChannel *_gimp_readchannel = NULL;
|
||||
GIOChannel *_gimp_writechannel = NULL;
|
||||
|
||||
#ifdef USE_WIN32_SHM
|
||||
static HANDLE shm_handle;
|
||||
|
@ -597,21 +594,21 @@ gimp_main_internal (GType plug_in_type,
|
|||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
_readchannel = g_io_channel_win32_new_fd (atoi (argv[ARG_READ_FD]));
|
||||
_writechannel = g_io_channel_win32_new_fd (atoi (argv[ARG_WRITE_FD]));
|
||||
_gimp_readchannel = g_io_channel_win32_new_fd (atoi (argv[ARG_READ_FD]));
|
||||
_gimp_writechannel = g_io_channel_win32_new_fd (atoi (argv[ARG_WRITE_FD]));
|
||||
#else
|
||||
_readchannel = g_io_channel_unix_new (atoi (argv[ARG_READ_FD]));
|
||||
_writechannel = g_io_channel_unix_new (atoi (argv[ARG_WRITE_FD]));
|
||||
_gimp_readchannel = g_io_channel_unix_new (atoi (argv[ARG_READ_FD]));
|
||||
_gimp_writechannel = g_io_channel_unix_new (atoi (argv[ARG_WRITE_FD]));
|
||||
#endif
|
||||
|
||||
g_io_channel_set_encoding (_readchannel, NULL, NULL);
|
||||
g_io_channel_set_encoding (_writechannel, NULL, NULL);
|
||||
g_io_channel_set_encoding (_gimp_readchannel, NULL, NULL);
|
||||
g_io_channel_set_encoding (_gimp_writechannel, NULL, NULL);
|
||||
|
||||
g_io_channel_set_buffered (_readchannel, FALSE);
|
||||
g_io_channel_set_buffered (_writechannel, FALSE);
|
||||
g_io_channel_set_buffered (_gimp_readchannel, FALSE);
|
||||
g_io_channel_set_buffered (_gimp_writechannel, FALSE);
|
||||
|
||||
g_io_channel_set_close_on_unref (_readchannel, TRUE);
|
||||
g_io_channel_set_close_on_unref (_writechannel, TRUE);
|
||||
g_io_channel_set_close_on_unref (_gimp_readchannel, TRUE);
|
||||
g_io_channel_set_close_on_unref (_gimp_writechannel, TRUE);
|
||||
|
||||
gp_init ();
|
||||
|
||||
|
@ -743,12 +740,12 @@ gimp_main_internal (GType plug_in_type,
|
|||
if (PLUG_IN)
|
||||
{
|
||||
if (GIMP_PLUG_IN_GET_CLASS (PLUG_IN)->init_procedures)
|
||||
gp_has_init_write (_writechannel, NULL);
|
||||
gp_has_init_write (_gimp_writechannel, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PLUG_IN_INFO.init_proc)
|
||||
gp_has_init_write (_writechannel, NULL);
|
||||
gp_has_init_write (_gimp_writechannel, NULL);
|
||||
}
|
||||
|
||||
if (gimp_debug_flags & GIMP_DEBUG_QUERY)
|
||||
|
@ -796,7 +793,7 @@ gimp_main_internal (GType plug_in_type,
|
|||
|
||||
_gimp_temp_proc_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
g_io_add_watch (_readchannel,
|
||||
g_io_add_watch (_gimp_readchannel,
|
||||
G_IO_ERR | G_IO_HUP,
|
||||
gimp_plugin_io_error_handler,
|
||||
NULL);
|
||||
|
@ -826,12 +823,12 @@ gimp_quit (void)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type)
|
||||
_gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type)
|
||||
{
|
||||
while (TRUE)
|
||||
{
|
||||
if (! gimp_wire_read_msg (_readchannel, msg, NULL))
|
||||
if (! gimp_wire_read_msg (_gimp_readchannel, msg, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
if (msg->type == type)
|
||||
|
@ -867,10 +864,10 @@ gimp_run_procedure_with_array (const gchar *name,
|
|||
proc_run.params = _gimp_value_array_to_gp_params (arguments, FALSE);
|
||||
|
||||
gp_lock ();
|
||||
if (! gp_proc_run_write (_writechannel, &proc_run, NULL))
|
||||
if (! gp_proc_run_write (_gimp_writechannel, &proc_run, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_read_expect_msg (&msg, GP_PROC_RETURN);
|
||||
_gimp_read_expect_msg (&msg, GP_PROC_RETURN);
|
||||
gp_unlock ();
|
||||
|
||||
proc_return = msg.data;
|
||||
|
@ -1260,7 +1257,7 @@ gimp_get_progname (void)
|
|||
void
|
||||
gimp_extension_ack (void)
|
||||
{
|
||||
if (! gp_extension_ack_write (_writechannel, NULL))
|
||||
if (! gp_extension_ack_write (_gimp_writechannel, NULL))
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
|
@ -1296,7 +1293,8 @@ gimp_extension_enable (void)
|
|||
|
||||
if (! callback_added)
|
||||
{
|
||||
g_io_add_watch (_readchannel, G_IO_IN | G_IO_PRI, gimp_extension_read,
|
||||
g_io_add_watch (_gimp_readchannel, G_IO_IN | G_IO_PRI,
|
||||
gimp_extension_read,
|
||||
NULL);
|
||||
|
||||
callback_added = TRUE;
|
||||
|
@ -1340,7 +1338,7 @@ gimp_extension_process (guint timeout)
|
|||
tvp = NULL;
|
||||
|
||||
FD_ZERO (&readfds);
|
||||
FD_SET (g_io_channel_unix_get_fd (_readchannel), &readfds);
|
||||
FD_SET (g_io_channel_unix_get_fd (_gimp_readchannel), &readfds);
|
||||
|
||||
if ((select_val = select (FD_SETSIZE, &readfds, NULL, NULL, tvp)) > 0)
|
||||
{
|
||||
|
@ -1363,7 +1361,7 @@ gimp_extension_process (guint timeout)
|
|||
if (timeout == 0)
|
||||
timeout = -1;
|
||||
|
||||
g_io_channel_win32_make_pollfd (_readchannel, G_IO_IN, &pollfd);
|
||||
g_io_channel_win32_make_pollfd (_gimp_readchannel, G_IO_IN, &pollfd);
|
||||
|
||||
if (g_io_channel_win32_poll (&pollfd, 1, timeout) == 1)
|
||||
gimp_single_message ();
|
||||
|
@ -1406,7 +1404,7 @@ gimp_close (void)
|
|||
|
||||
#endif
|
||||
|
||||
gp_quit_write (_writechannel, NULL);
|
||||
gp_quit_write (_gimp_writechannel, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1728,7 +1726,7 @@ gimp_loop (void)
|
|||
|
||||
while (TRUE)
|
||||
{
|
||||
if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
|
||||
if (! gimp_wire_read_msg (_gimp_readchannel, &msg, NULL))
|
||||
{
|
||||
gimp_close ();
|
||||
return;
|
||||
|
@ -1934,7 +1932,7 @@ gimp_proc_run (GPProcRun *proc_run)
|
|||
&proc_return);
|
||||
}
|
||||
|
||||
if (! gp_proc_return_write (_writechannel, &proc_return, NULL))
|
||||
if (! gp_proc_return_write (_gimp_writechannel, &proc_return, NULL))
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
|
@ -1975,7 +1973,7 @@ gimp_temp_proc_run (GPProcRun *proc_run)
|
|||
}
|
||||
}
|
||||
|
||||
if (! gp_temp_proc_return_write (_writechannel, &proc_return, NULL))
|
||||
if (! gp_temp_proc_return_write (_gimp_writechannel, &proc_return, NULL))
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
|
@ -2070,7 +2068,7 @@ gimp_single_message (void)
|
|||
GimpWireMessage msg;
|
||||
|
||||
/* Run a temp function */
|
||||
if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
|
||||
if (! gimp_wire_read_msg (_gimp_readchannel, &msg, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_process_message (&msg);
|
||||
|
|
|
@ -682,7 +682,6 @@ EXPORTS
|
|||
gimp_progress_uninstall
|
||||
gimp_progress_update
|
||||
gimp_quit
|
||||
gimp_read_expect_msg
|
||||
gimp_register_file_handler_mime
|
||||
gimp_register_file_handler_priority
|
||||
gimp_register_file_handler_raw
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpbase/gimpbase-private.h"
|
||||
#include "libgimpbase/gimpprotocol.h"
|
||||
#include "libgimpbase/gimpwire.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimp-private.h"
|
||||
#include "gimpgpcompat.h"
|
||||
#include "gimpgpparams.h"
|
||||
|
||||
|
@ -47,10 +47,6 @@ static gpointer gimp_param_copy (gpointer boxed);
|
|||
static void gimp_param_free (gpointer boxed);
|
||||
|
||||
|
||||
extern GHashTable *_gimp_temp_proc_ht;
|
||||
extern GIOChannel *_writechannel;
|
||||
|
||||
|
||||
/**
|
||||
* gimp_plug_in_info_set_callbacks:
|
||||
* @info: the PLUG_IN_INFO structure
|
||||
|
@ -327,7 +323,7 @@ gimp_install_procedure (const gchar *name,
|
|||
pspecs = g_list_prepend (pspecs, pspec);
|
||||
}
|
||||
|
||||
if (! gp_proc_install_write (_writechannel, &proc_install, NULL))
|
||||
if (! gp_proc_install_write (_gimp_writechannel, &proc_install, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
g_list_foreach (pspecs, (GFunc) g_param_spec_ref_sink, NULL);
|
||||
|
@ -432,7 +428,7 @@ gimp_uninstall_temp_proc (const gchar *name)
|
|||
|
||||
proc_uninstall.name = (gchar *) name;
|
||||
|
||||
if (! gp_proc_uninstall_write (_writechannel, &proc_uninstall, NULL))
|
||||
if (! gp_proc_uninstall_write (_gimp_writechannel, &proc_uninstall, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
found = g_hash_table_lookup_extended (_gimp_temp_proc_ht, name, &hash_name,
|
||||
|
|
|
@ -30,13 +30,11 @@
|
|||
#include "libgimpbase/gimpprotocol.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimp-private.h"
|
||||
#include "gimpgpparams.h"
|
||||
#include "gimpprocedure-private.h"
|
||||
|
||||
|
||||
extern GIOChannel *_writechannel;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
|
@ -84,7 +82,7 @@ _gimp_procedure_register (GimpProcedure *procedure)
|
|||
&proc_install.return_vals[i]);
|
||||
}
|
||||
|
||||
if (! gp_proc_install_write (_writechannel, &proc_install, NULL))
|
||||
if (! gp_proc_install_write (_gimp_writechannel, &proc_install, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
icon_type = gimp_procedure_get_icon (procedure,
|
||||
|
@ -112,6 +110,6 @@ _gimp_procedure_unregister (GimpProcedure *procedure)
|
|||
|
||||
proc_uninstall.name = (gchar *) gimp_procedure_get_name (procedure);
|
||||
|
||||
if (! gp_proc_uninstall_write (_writechannel, &proc_uninstall, NULL))
|
||||
if (! gp_proc_uninstall_write (_gimp_writechannel, &proc_uninstall, NULL))
|
||||
gimp_quit ();
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpbase/gimpprotocol.h"
|
||||
#include "libgimpbase/gimpwire.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimp-private.h"
|
||||
#include "gimptilebackendplugin.h"
|
||||
|
||||
|
||||
|
@ -90,10 +90,6 @@ static void gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
|
|||
static void gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
|
||||
GimpTile *tile);
|
||||
|
||||
/* EEK */
|
||||
void gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GimpTileBackendPlugin, _gimp_tile_backend_plugin,
|
||||
GEGL_TYPE_TILE_BACKEND)
|
||||
|
@ -328,8 +324,6 @@ static void
|
|||
gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
|
||||
GimpTile *tile)
|
||||
{
|
||||
extern GIOChannel *_writechannel;
|
||||
|
||||
GimpTileBackendPluginPrivate *priv = backend_plugin->priv;
|
||||
GPTileReq tile_req;
|
||||
GPTileData *tile_data;
|
||||
|
@ -340,10 +334,10 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
|
|||
tile_req.shadow = priv->shadow;
|
||||
|
||||
gp_lock ();
|
||||
if (! gp_tile_req_write (_writechannel, &tile_req, NULL))
|
||||
if (! gp_tile_req_write (_gimp_writechannel, &tile_req, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_read_expect_msg (&msg, GP_TILE_DATA);
|
||||
_gimp_read_expect_msg (&msg, GP_TILE_DATA);
|
||||
|
||||
tile_data = msg.data;
|
||||
if (tile_data->drawable_ID != priv->drawable_id ||
|
||||
|
@ -384,7 +378,7 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
|
|||
tile_data->data = NULL;
|
||||
}
|
||||
|
||||
if (! gp_tile_ack_write (_writechannel, NULL))
|
||||
if (! gp_tile_ack_write (_gimp_writechannel, NULL))
|
||||
gimp_quit ();
|
||||
gp_unlock ();
|
||||
|
||||
|
@ -395,8 +389,6 @@ static void
|
|||
gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
|
||||
GimpTile *tile)
|
||||
{
|
||||
extern GIOChannel *_writechannel;
|
||||
|
||||
GimpTileBackendPluginPrivate *priv = backend_plugin->priv;
|
||||
GPTileReq tile_req;
|
||||
GPTileData tile_data;
|
||||
|
@ -408,10 +400,10 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
|
|||
tile_req.shadow = 0;
|
||||
|
||||
gp_lock ();
|
||||
if (! gp_tile_req_write (_writechannel, &tile_req, NULL))
|
||||
if (! gp_tile_req_write (_gimp_writechannel, &tile_req, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_read_expect_msg (&msg, GP_TILE_DATA);
|
||||
_gimp_read_expect_msg (&msg, GP_TILE_DATA);
|
||||
|
||||
tile_info = msg.data;
|
||||
|
||||
|
@ -435,7 +427,7 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
|
|||
tile_data.data = tile->data;
|
||||
}
|
||||
|
||||
if (! gp_tile_data_write (_writechannel, &tile_data, NULL))
|
||||
if (! gp_tile_data_write (_gimp_writechannel, &tile_data, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
if (! tile_info->use_shm)
|
||||
|
@ -443,7 +435,7 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
|
|||
|
||||
gimp_wire_destroy (&msg);
|
||||
|
||||
gimp_read_expect_msg (&msg, GP_TILE_ACK);
|
||||
_gimp_read_expect_msg (&msg, GP_TILE_ACK);
|
||||
gp_unlock ();
|
||||
|
||||
gimp_wire_destroy (&msg);
|
||||
|
|
Loading…
Reference in New Issue