mirror of https://github.com/GNOME/gimp.git
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:
parent
cca470e093
commit
26d1021e77
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
||||||
|
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.
|
||||||
|
|
||||||
2008-03-27 Sven Neumann <sven@gimp.org>
|
2008-03-27 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpdockable.c (gimp_dockable_detach): open the new
|
* app/widgets/gimpdockable.c (gimp_dockable_detach): open the new
|
||||||
|
|
|
@ -50,6 +50,7 @@ gimp_gui_init (Gimp *gimp)
|
||||||
gimp->gui.help = NULL;
|
gimp->gui.help = NULL;
|
||||||
gimp->gui.get_program_class = NULL;
|
gimp->gui.get_program_class = NULL;
|
||||||
gimp->gui.get_display_name = NULL;
|
gimp->gui.get_display_name = NULL;
|
||||||
|
gimp->gui.get_user_time = NULL;
|
||||||
gimp->gui.get_theme_dir = NULL;
|
gimp->gui.get_theme_dir = NULL;
|
||||||
gimp->gui.display_get_by_id = NULL;
|
gimp->gui.display_get_by_id = NULL;
|
||||||
gimp->gui.display_get_id = NULL;
|
gimp->gui.display_get_id = NULL;
|
||||||
|
@ -226,6 +227,27 @@ gimp_get_display_name (Gimp *gimp,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_get_user_time:
|
||||||
|
* @gimp:
|
||||||
|
*
|
||||||
|
* Returns the timestamp of the last user interaction. The timestamp is
|
||||||
|
* taken from events caused by user interaction such as key presses or
|
||||||
|
* pointer movements. See gdk_x11_display_get_user_time().
|
||||||
|
*
|
||||||
|
* Return value: the timestamp of the last user interaction
|
||||||
|
*/
|
||||||
|
guint32
|
||||||
|
gimp_get_user_time (Gimp *gimp)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
|
||||||
|
|
||||||
|
if (gimp->gui.get_user_time)
|
||||||
|
return gimp->gui.get_user_time (gimp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
gimp_get_theme_dir (Gimp *gimp)
|
gimp_get_theme_dir (Gimp *gimp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,8 @@ struct _GimpGui
|
||||||
gchar * (* get_display_name) (Gimp *gimp,
|
gchar * (* get_display_name) (Gimp *gimp,
|
||||||
gint display_ID,
|
gint display_ID,
|
||||||
gint *monitor_number);
|
gint *monitor_number);
|
||||||
|
guint32 (* get_user_time) (Gimp *gimp);
|
||||||
|
|
||||||
const gchar * (* get_theme_dir) (Gimp *gimp);
|
const gchar * (* get_theme_dir) (Gimp *gimp);
|
||||||
|
|
||||||
GimpObject * (* get_empty_display) (Gimp *gimp);
|
GimpObject * (* get_empty_display) (Gimp *gimp);
|
||||||
|
@ -136,6 +138,7 @@ const gchar * gimp_get_program_class (Gimp *gimp);
|
||||||
gchar * gimp_get_display_name (Gimp *gimp,
|
gchar * gimp_get_display_name (Gimp *gimp,
|
||||||
gint display_ID,
|
gint display_ID,
|
||||||
gint *monitor_number);
|
gint *monitor_number);
|
||||||
|
guint32 gimp_get_user_time (Gimp *gimp);
|
||||||
const gchar * gimp_get_theme_dir (Gimp *gimp);
|
const gchar * gimp_get_theme_dir (Gimp *gimp);
|
||||||
|
|
||||||
gboolean gimp_pdb_dialog_new (Gimp *gimp,
|
gboolean gimp_pdb_dialog_new (Gimp *gimp,
|
||||||
|
|
|
@ -88,6 +88,7 @@ static const gchar * gui_get_program_class (Gimp *gimp);
|
||||||
static gchar * gui_get_display_name (Gimp *gimp,
|
static gchar * gui_get_display_name (Gimp *gimp,
|
||||||
gint display_ID,
|
gint display_ID,
|
||||||
gint *monitor_number);
|
gint *monitor_number);
|
||||||
|
static guint32 gui_get_user_time (Gimp *gimp);
|
||||||
static const gchar * gui_get_theme_dir (Gimp *gimp);
|
static const gchar * gui_get_theme_dir (Gimp *gimp);
|
||||||
static GimpObject * gui_get_empty_display (Gimp *gimp);
|
static GimpObject * gui_get_empty_display (Gimp *gimp);
|
||||||
static GimpObject * gui_display_get_by_ID (Gimp *gimp,
|
static GimpObject * gui_display_get_by_ID (Gimp *gimp,
|
||||||
|
@ -144,6 +145,7 @@ gui_vtable_init (Gimp *gimp)
|
||||||
gimp->gui.help = gui_help;
|
gimp->gui.help = gui_help;
|
||||||
gimp->gui.get_program_class = gui_get_program_class;
|
gimp->gui.get_program_class = gui_get_program_class;
|
||||||
gimp->gui.get_display_name = gui_get_display_name;
|
gimp->gui.get_display_name = gui_get_display_name;
|
||||||
|
gimp->gui.get_user_time = gui_get_user_time;
|
||||||
gimp->gui.get_theme_dir = gui_get_theme_dir;
|
gimp->gui.get_theme_dir = gui_get_theme_dir;
|
||||||
gimp->gui.get_empty_display = gui_get_empty_display;
|
gimp->gui.get_empty_display = gui_get_empty_display;
|
||||||
gimp->gui.display_get_by_id = gui_display_get_by_ID;
|
gimp->gui.display_get_by_id = gui_display_get_by_ID;
|
||||||
|
@ -255,6 +257,15 @@ gui_get_display_name (Gimp *gimp,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guint32
|
||||||
|
gui_get_user_time (Gimp *gimp)
|
||||||
|
{
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
return gdk_x11_display_get_user_time (gdk_display_get_default ());
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
gui_get_theme_dir (Gimp *gimp)
|
gui_get_theme_dir (Gimp *gimp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,6 +197,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
|
||||||
config.display_name = gimp_get_display_name (manager->gimp,
|
config.display_name = gimp_get_display_name (manager->gimp,
|
||||||
display_ID, &monitor);
|
display_ID, &monitor);
|
||||||
config.monitor_number = monitor;
|
config.monitor_number = monitor;
|
||||||
|
config.timestamp = gimp_get_user_time (manager->gimp);
|
||||||
|
|
||||||
proc_run.name = GIMP_PROCEDURE (procedure)->original_name;
|
proc_run.name = GIMP_PROCEDURE (procedure)->original_name;
|
||||||
proc_run.nparams = args->n_values;
|
proc_run.nparams = args->n_values;
|
||||||
|
|
|
@ -179,6 +179,7 @@ static gint _gdisp_ID = -1;
|
||||||
static gchar *_wm_class = NULL;
|
static gchar *_wm_class = NULL;
|
||||||
static gchar *_display_name = NULL;
|
static gchar *_display_name = NULL;
|
||||||
static gint _monitor_number = 0;
|
static gint _monitor_number = 0;
|
||||||
|
static guint32 _timestamp = 0;
|
||||||
static const gchar *progname = NULL;
|
static const gchar *progname = NULL;
|
||||||
|
|
||||||
static gchar write_buffer[WRITE_BUFFER_SIZE];
|
static gchar write_buffer[WRITE_BUFFER_SIZE];
|
||||||
|
@ -1222,6 +1223,7 @@ gimp_wm_class (void)
|
||||||
* gimp_display_name:
|
* gimp_display_name:
|
||||||
*
|
*
|
||||||
* Returns the display to be used for plug-in windows.
|
* Returns the display to be used for plug-in windows.
|
||||||
|
*
|
||||||
* This is a constant value given at plug-in configuration time.
|
* This is a constant value given at plug-in configuration time.
|
||||||
*
|
*
|
||||||
* Return value: the display name
|
* Return value: the display name
|
||||||
|
@ -1246,6 +1248,22 @@ gimp_monitor_number (void)
|
||||||
return _monitor_number;
|
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:
|
* gimp_get_progname:
|
||||||
*
|
*
|
||||||
|
@ -1712,6 +1730,7 @@ gimp_config (GPConfig *config)
|
||||||
_wm_class = g_strdup (config->wm_class);
|
_wm_class = g_strdup (config->wm_class);
|
||||||
_display_name = g_strdup (config->display_name);
|
_display_name = g_strdup (config->display_name);
|
||||||
_monitor_number = config->monitor_number;
|
_monitor_number = config->monitor_number;
|
||||||
|
_timestamp = config->timestamp;
|
||||||
|
|
||||||
if (config->app_name)
|
if (config->app_name)
|
||||||
g_set_application_name (config->app_name);
|
g_set_application_name (config->app_name);
|
||||||
|
|
|
@ -619,6 +619,7 @@ EXPORTS
|
||||||
gimp_tile_width
|
gimp_tile_width
|
||||||
gimp_transform_2d
|
gimp_transform_2d
|
||||||
gimp_uninstall_temp_proc
|
gimp_uninstall_temp_proc
|
||||||
|
gimp_user_time
|
||||||
gimp_vectors_bezier_stroke_conicto
|
gimp_vectors_bezier_stroke_conicto
|
||||||
gimp_vectors_bezier_stroke_cubicto
|
gimp_vectors_bezier_stroke_cubicto
|
||||||
gimp_vectors_bezier_stroke_lineto
|
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_wm_class (void) G_GNUC_CONST;
|
||||||
const gchar * gimp_display_name (void) G_GNUC_CONST;
|
const gchar * gimp_display_name (void) G_GNUC_CONST;
|
||||||
gint gimp_monitor_number (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;
|
const gchar * gimp_get_progname (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,9 @@ void
|
||||||
gimp_ui_init (const gchar *prog_name,
|
gimp_ui_init (const gchar *prog_name,
|
||||||
gboolean preview)
|
gboolean preview)
|
||||||
{
|
{
|
||||||
|
GdkScreen *screen;
|
||||||
const gchar *display_name;
|
const gchar *display_name;
|
||||||
gchar *themerc;
|
gchar *themerc;
|
||||||
GdkScreen *screen;
|
|
||||||
|
|
||||||
g_return_if_fail (prog_name != NULL);
|
g_return_if_fail (prog_name != NULL);
|
||||||
|
|
||||||
|
@ -87,6 +87,17 @@ gimp_ui_init (const gchar *prog_name,
|
||||||
#endif
|
#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);
|
gtk_init (NULL, NULL);
|
||||||
|
|
||||||
themerc = gimp_personal_rc_file ("themerc");
|
themerc = gimp_personal_rc_file ("themerc");
|
||||||
|
|
|
@ -541,6 +541,9 @@ _gp_config_read (GIOChannel *channel,
|
||||||
(guint32 *) &config->monitor_number, 1,
|
(guint32 *) &config->monitor_number, 1,
|
||||||
user_data))
|
user_data))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
if (! _gimp_wire_read_int32 (channel,
|
||||||
|
&config->timestamp, 1, user_data))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
msg->data = config;
|
msg->data = config;
|
||||||
return;
|
return;
|
||||||
|
@ -633,6 +636,10 @@ _gp_config_write (GIOChannel *channel,
|
||||||
(const guint32 *) &config->monitor_number, 1,
|
(const guint32 *) &config->monitor_number, 1,
|
||||||
user_data))
|
user_data))
|
||||||
return;
|
return;
|
||||||
|
if (! _gimp_wire_write_int32 (channel,
|
||||||
|
(const guint32 *) &config->timestamp, 1,
|
||||||
|
user_data))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -27,7 +27,7 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
/* Increment every time the protocol changes
|
/* Increment every time the protocol changes
|
||||||
*/
|
*/
|
||||||
#define GIMP_PROTOCOL_VERSION 0x0011
|
#define GIMP_PROTOCOL_VERSION 0x0012
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -82,6 +82,7 @@ struct _GPConfig
|
||||||
gchar *wm_class;
|
gchar *wm_class;
|
||||||
gchar *display_name;
|
gchar *display_name;
|
||||||
gint32 monitor_number;
|
gint32 monitor_number;
|
||||||
|
guint32 timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GPTileReq
|
struct _GPTileReq
|
||||||
|
|
Loading…
Reference in New Issue