Properly pass the focus from the core to plug-in dialogs:
2008-03-27 Sven Neumann <sven@gimp.org> Properly pass the focus from the core to plug-in dialogs: * libgimpbase/gimpprotocol.[ch]: added a user_time member to the GimpConfig struct. Bumped the protocol version to 0x0012. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: added gimp_get_user_time() to get the timestamp of the last user interaction. * app/plug-in/gimppluginmanager-call.c (gimp_plug_in_manager_call_run): pass the timestamp to in the GimpConfig message. * libgimp/gimp.[ch]: * libgimp/gimp.def: added method to access the timestamp as set in the config message. * libgimp/gimpui.c (gimp_ui_init): construct a fake startup ID and set the DESKTOP_STARTUP_ID environment variable. svn path=/trunk/; revision=25263
This commit is contained in:

committed by
Sven Neumann

parent
cca470e093
commit
26d1021e77
@ -179,6 +179,7 @@ static gint _gdisp_ID = -1;
|
||||
static gchar *_wm_class = NULL;
|
||||
static gchar *_display_name = NULL;
|
||||
static gint _monitor_number = 0;
|
||||
static guint32 _timestamp = 0;
|
||||
static const gchar *progname = NULL;
|
||||
|
||||
static gchar write_buffer[WRITE_BUFFER_SIZE];
|
||||
@ -1222,6 +1223,7 @@ gimp_wm_class (void)
|
||||
* gimp_display_name:
|
||||
*
|
||||
* Returns the display to be used for plug-in windows.
|
||||
*
|
||||
* This is a constant value given at plug-in configuration time.
|
||||
*
|
||||
* Return value: the display name
|
||||
@ -1246,6 +1248,22 @@ gimp_monitor_number (void)
|
||||
return _monitor_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_user_time:
|
||||
*
|
||||
* Returns the timestamp of the user interaction that should be set on
|
||||
* the plug-in window. This is handled transparently. Plug-in authors
|
||||
* do not have to care about this. This is a constant value given at
|
||||
* plug-in configuration time.
|
||||
*
|
||||
* Return value: timestamp for plug-in window
|
||||
**/
|
||||
guint32
|
||||
gimp_user_time (void)
|
||||
{
|
||||
return _timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_get_progname:
|
||||
*
|
||||
@ -1712,6 +1730,7 @@ gimp_config (GPConfig *config)
|
||||
_wm_class = g_strdup (config->wm_class);
|
||||
_display_name = g_strdup (config->display_name);
|
||||
_monitor_number = config->monitor_number;
|
||||
_timestamp = config->timestamp;
|
||||
|
||||
if (config->app_name)
|
||||
g_set_application_name (config->app_name);
|
||||
|
@ -619,6 +619,7 @@ EXPORTS
|
||||
gimp_tile_width
|
||||
gimp_transform_2d
|
||||
gimp_uninstall_temp_proc
|
||||
gimp_user_time
|
||||
gimp_vectors_bezier_stroke_conicto
|
||||
gimp_vectors_bezier_stroke_cubicto
|
||||
gimp_vectors_bezier_stroke_lineto
|
||||
|
@ -321,6 +321,7 @@ gint32 gimp_default_display (void) G_GNUC_CONST;
|
||||
const gchar * gimp_wm_class (void) G_GNUC_CONST;
|
||||
const gchar * gimp_display_name (void) G_GNUC_CONST;
|
||||
gint gimp_monitor_number (void) G_GNUC_CONST;
|
||||
guint32 gimp_user_time (void) G_GNUC_CONST;
|
||||
|
||||
const gchar * gimp_get_progname (void) G_GNUC_CONST;
|
||||
|
||||
|
@ -65,9 +65,9 @@ void
|
||||
gimp_ui_init (const gchar *prog_name,
|
||||
gboolean preview)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
const gchar *display_name;
|
||||
gchar *themerc;
|
||||
GdkScreen *screen;
|
||||
|
||||
g_return_if_fail (prog_name != NULL);
|
||||
|
||||
@ -87,6 +87,17 @@ gimp_ui_init (const gchar *prog_name,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gimp_user_time ())
|
||||
{
|
||||
/* Construct a fake startup ID as we only want to pass the
|
||||
* interaction timestamp, see _gdk_windowing_set_default_display().
|
||||
*/
|
||||
gchar *startup_id = g_strdup_printf ("_TIME%u", gimp_user_time ());
|
||||
|
||||
g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE);
|
||||
g_free (startup_id);
|
||||
}
|
||||
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
themerc = gimp_personal_rc_file ("themerc");
|
||||
|
Reference in New Issue
Block a user