Commit 188bbe5d authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/app_procs.[ch] initialize the error subsystem after the gimp object

2006-09-09  Sven Neumann  <sven@gimp.org>

	* app/app_procs.[ch]
	* app/main.c: initialize the error subsystem after the gimp
object
	has been created.

	* app/errors.[ch]: store a reference to the gimp object (eek)
and
	use it to call gimp_gui_ungrab() before g_on_error_query().

	* app/core/gimp-gui.[ch]
	* app/gui/gui-vtable.c: added gimp_gui_ungrab().
parent 9a1ed96a
2006-09-09 Sven Neumann <sven@gimp.org>
* app/app_procs.[ch]
* app/main.c: initialize the error subsystem after the gimp object
has been created.
* app/errors.[ch]: store a reference to the gimp object (eek) and
use it to call gimp_gui_ungrab() before g_on_error_query().
* app/core/gimp-gui.[ch]
* app/gui/gui-vtable.c: added gimp_gui_ungrab().
2006-09-09 Sven Neumann <sven@gimp.org>
* plug-ins/common/emboss.c: hopefully really fixed bug #353227
......
......@@ -159,6 +159,7 @@ app_run (const gchar *full_prog_name,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode,
GimpPDBCompatMode pdb_compat_mode)
{
......@@ -207,6 +208,8 @@ app_run (const gchar *full_prog_name,
stack_trace_mode,
pdb_compat_mode);
gimp_errors_init (gimp, full_prog_name, use_debug_handler, stack_trace_mode);
for (i = 0; i < G_N_ELEMENTS (log_domains); i++)
g_log_set_handler (log_domains[i],
G_LOG_LEVEL_MESSAGE,
......
......@@ -46,6 +46,7 @@ void app_run (const gchar *full_prog_name,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode,
GimpPDBCompatMode pdb_compat_mode);
......
......@@ -41,6 +41,7 @@ gimp_gui_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->gui.ungrab = NULL;
gimp->gui.threads_enter = NULL;
gimp->gui.threads_leave = NULL;
gimp->gui.set_busy = NULL;
......@@ -62,6 +63,15 @@ gimp_gui_init (Gimp *gimp)
gimp->gui.pdb_dialog_close = NULL;
}
void
gimp_gui_ungrab (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.ungrab)
gimp->gui.ungrab (gimp);
}
void
gimp_threads_enter (Gimp *gimp)
{
......
......@@ -24,6 +24,8 @@ typedef struct _GimpGui GimpGui;
struct _GimpGui
{
void (* ungrab) (Gimp *gimp);
void (* threads_enter) (Gimp *gimp);
void (* threads_leave) (Gimp *gimp);
......@@ -81,6 +83,8 @@ struct _GimpGui
void gimp_gui_init (Gimp *gimp);
void gimp_gui_ungrab (Gimp *gimp);
void gimp_threads_enter (Gimp *gimp);
void gimp_threads_leave (Gimp *gimp);
......
......@@ -655,7 +655,7 @@ gimp_new (const gchar *name,
g_return_val_if_fail (name != NULL, NULL);
gimp = g_object_new (GIMP_TYPE_GIMP,
"name", name,
"name", name,
NULL);
gimp->session_name = g_strdup (session_name);
......
......@@ -57,13 +57,18 @@ static G_GNUC_NORETURN void gimp_eek (const gchar *reason,
gboolean use_handler);
static Gimp *the_errors_gimp = NULL;
/* public functions */
void
gimp_errors_init (const gchar *_full_prog_name,
gimp_errors_init (Gimp *gimp,
const gchar *_full_prog_name,
gboolean _use_debug_handler,
GimpStackTraceMode _stack_trace_mode)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (_full_prog_name != NULL);
g_return_if_fail (full_prog_name == NULL);
......@@ -76,6 +81,8 @@ gimp_errors_init (const gchar *_full_prog_name,
#endif
#endif /* GIMP_UNSTABLE */
the_errors_gimp = gimp;
use_debug_handler = _use_debug_handler ? TRUE : FALSE;
stack_trace_mode = _stack_trace_mode;
full_prog_name = g_strdup (_full_prog_name);
......@@ -144,7 +151,6 @@ gimp_eek (const gchar *reason,
gboolean use_handler)
{
#ifndef G_OS_WIN32
g_printerr ("%s: %s: %s\n", gimp_filename_to_utf8 (full_prog_name),
reason, message);
......@@ -161,6 +167,10 @@ gimp_eek (const gchar *reason,
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
if (the_errors_gimp)
gimp_gui_ungrab (the_errors_gimp);
g_on_error_query (full_prog_name);
}
break;
......@@ -171,6 +181,7 @@ gimp_eek (const gchar *reason,
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
g_on_error_stack_trace (full_prog_name);
}
break;
......@@ -179,7 +190,6 @@ gimp_eek (const gchar *reason,
break;
}
}
#else
/* g_on_error_* don't do anything reasonable on Win32. */
......
......@@ -24,7 +24,8 @@
#endif
void gimp_errors_init (const gchar *full_prog_name,
void gimp_errors_init (Gimp *gimp,
const gchar *full_prog_name,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode);
......
......@@ -70,6 +70,8 @@
/* local function prototypes */
static void gui_ungrab (Gimp *gimp);
static void gui_threads_enter (Gimp *gimp);
static void gui_threads_leave (Gimp *gimp);
static void gui_set_busy (Gimp *gimp);
......@@ -121,6 +123,7 @@ gui_vtable_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->gui.ungrab = gui_ungrab;
gimp->gui.threads_enter = gui_threads_enter;
gimp->gui.threads_leave = gui_threads_leave;
gimp->gui.set_busy = gui_set_busy;
......@@ -146,6 +149,15 @@ gui_vtable_init (Gimp *gimp)
/* private functions */
static void
gui_ungrab (Gimp *gimp)
{
GdkDisplay *display = gdk_display_get_default ();
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
}
static void
gui_threads_enter (Gimp *gimp)
{
......
......@@ -313,8 +313,6 @@ main (int argc,
gimp_init_signal_handlers ();
gimp_errors_init (argv[0], use_debug_handler, stack_trace_mode);
app_run (argv[0],
filenames,
system_gimprc,
......@@ -330,6 +328,7 @@ main (int argc,
use_shm,
use_cpu_accel,
console_messages,
use_debug_handler,
stack_trace_mode,
pdb_compat_mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment