summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-11-02 05:37:04 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-11-02 05:37:04 +0000
commitaccc3a3365fa56b02e647686750e5106e020c425 (patch)
tree8d5129f3e28bf612bd5fd3ec065da1e4e6ec6a7c /gtk
parent39a5a723f0381cca485fd366499a07e31b57c89f (diff)
downloadgdk-pixbuf-accc3a3365fa56b02e647686750e5106e020c425.tar.gz
Add startup notification hooks - mostly based on patch by Havoc Pennington
Sat Nov 2 00:22:33 2002 Owen Taylor <otaylor@redhat.com> Add startup notification hooks - mostly based on patch by Havoc Pennington in #96772. * gdk/gdk.h gdk/x11/gdkdisplay-x11.c gdk/{win32,linux-fb}/gdkmain-*.c: (gdk_notify_startup_complete): new function that indicates an application has finished starting up. * gdk/x11/gdkmain-x11.c gdk/x11/gdkdisplay-x11.c (_gdk_windowing_set_default_display): store value of DESKTOP_STARTUP_ID on the default screen, and clear it from the environment. * gdk/x11/gdkdisplay-x11.c: Set _NET_STARTUP_ID hint on display's group leader window. * gtk/gtkwindow.c (gtk_window_set_auto_startup_notification): function to toggle whether we automatically broadcast that we've started up, after mapping the first toplevel window. (gtk_window_map): call gdk_screen_notify_startup_complete() by default, unless enabled by above. * gtk/gtkmain.c gtk/gtkcombo.c gtk/gtktoolbar.c: Couple of warning fixes.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkcombo.c2
-rw-r--r--gtk/gtkmain.c4
-rw-r--r--gtk/gtktoolbar.c2
-rw-r--r--gtk/gtkwindow.c31
-rw-r--r--gtk/gtkwindow.h1
5 files changed, 35 insertions, 5 deletions
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index bb9e222d3..11424632a 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -535,7 +535,7 @@ gtk_combo_popup_list (GtkCombo * combo)
else
{
GTK_WIDGET_SET_FLAGS (list, GTK_CAN_FOCUS);
- gtk_widget_grab_focus (list);
+ gtk_widget_grab_focus (combo->list);
GTK_WIDGET_UNSET_FLAGS (list, GTK_CAN_FOCUS);
}
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index a21d95aca..0f0277726 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -866,8 +866,6 @@ gboolean
gtk_init_check (int *argc,
char ***argv)
{
- GdkDisplay *display;
-
if (!gtk_parse_args (argc, argv))
return FALSE;
@@ -902,7 +900,7 @@ gtk_init (int *argc, char ***argv)
{
if (!gtk_init_check (argc, argv))
{
- char *display_name_arg = gdk_get_display_arg_name ();
+ const char *display_name_arg = gdk_get_display_arg_name ();
g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : " ");
exit (1);
}
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 11d4a5e43..420e6a141 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -713,7 +713,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
gint space_size;
gint ipadding;
GtkTextDirection direction;
- gint ltr_x;
+ gint ltr_x = 0; /* Quiet GCC */
g_return_if_fail (GTK_IS_TOOLBAR (widget));
g_return_if_fail (allocation != NULL);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1c12218f6..019bb5201 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -261,6 +261,8 @@ static GtkBinClass *parent_class = NULL;
static guint window_signals[LAST_SIGNAL] = { 0 };
static GList *default_icon_list = NULL;
static guint default_icon_serial = 0;
+static gboolean disable_startup_notification = FALSE;
+static gboolean sent_startup_notification = FALSE;
static void gtk_window_set_property (GObject *object,
guint prop_id,
@@ -3548,6 +3550,13 @@ gtk_window_map (GtkWidget *widget)
if (window->frame)
gdk_window_show (window->frame);
+
+ if (!disable_startup_notification &&
+ !sent_startup_notification)
+ {
+ sent_startup_notification = TRUE;
+ gdk_notify_startup_complete ();
+ }
}
static void
@@ -6709,3 +6718,25 @@ _gtk_window_set_has_toplevel_focus (GtkWindow *window,
g_object_notify (G_OBJECT (window), "has_toplevel_focus");
}
}
+
+/**
+ * gtk_window_set_auto_startup_notification:
+ * @setting: %TRUE to automatically do startup notification
+ *
+ * By default, after showing the first #GtkWindow for each #GdkScreen,
+ * GTK+ calls gdk_screen_notify_startup_complete(). Call this
+ * function to disable the automatic startup notification. You might
+ * do this if your first window is a splash screen, and you want to
+ * delay notification until after your real main window has been
+ * shown, for example.
+ *
+ * In that example, you would disable startup notification
+ * temporarily, show your splash screen, then re-enable it so that
+ * showing the main window would automatically result in notification.
+ *
+ **/
+void
+gtk_window_set_auto_startup_notification (gboolean setting)
+{
+ disable_startup_notification = !setting;
+}
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 9afd9404f..1bd48843c 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -255,6 +255,7 @@ GList* gtk_window_get_default_icon_list (void);
gboolean gtk_window_set_default_icon_from_file (const gchar *filename,
GError **err);
+void gtk_window_set_auto_startup_notification (gboolean setting);
/* If window is set modal, input will be grabbed when show and released when hide */
void gtk_window_set_modal (GtkWindow *window,