summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-06-20 23:29:19 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-06-20 23:29:19 +0000
commit5830bf89b5bb3eb48fa84ed690a726be3a82e129 (patch)
treeffccd98b302bb7b4e18bc2acca6500d5f4cfe648
parent4251a51edc15c41799d87d3e26761c2064507df6 (diff)
downloadgtk+-5830bf89b5bb3eb48fa84ed690a726be3a82e129.tar.gz
Add a singleton object that we can use to get notification when displays
Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com> * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c gdk/win32/gdkdisplay-win32.c: Add a singleton object that we can use to get notification when displays appear / disappear or the default display changes. gdk_set_default_display() => gdk_display_manager_set_default_display() gdk_list_displays() => gdk_display_manager_list_displays(). (#85696) * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler generation. * gdk/gdkintl.h: Add this. * gtk/gtkmain.c: Add gtk_parse_args() that initializes GTK+ without opening a display. * gtk/gtkmain.c: Set things up so if a module exports gtk_module_init() and gtk_module_display_init(), then we treat it as multihead aware, otherwise, we only initialize it after the default display is set.
-rw-r--r--ChangeLog25
-rw-r--r--ChangeLog.pre-2-1025
-rw-r--r--ChangeLog.pre-2-225
-rw-r--r--ChangeLog.pre-2-425
-rw-r--r--ChangeLog.pre-2-625
-rw-r--r--ChangeLog.pre-2-825
-rw-r--r--docs/reference/gtk/tmpl/gtk-unused.sgml9
-rw-r--r--docs/reference/gtk/tmpl/gtkfilesel.sgml4
-rw-r--r--docs/reference/gtk/tmpl/gtkmain.sgml19
-rw-r--r--docs/reference/gtk/tmpl/gtkstyle.sgml10
-rw-r--r--gdk/Makefile.am83
-rw-r--r--gdk/gdk.c5
-rw-r--r--gdk/gdk.h1
-rw-r--r--gdk/gdkdisplay.c63
-rw-r--r--gdk/gdkintl.h24
-rw-r--r--gdk/gdkmarshalers.list1
-rw-r--r--gdk/win32/gdkdisplay-win32.c3
-rw-r--r--gdk/x11/gdkdisplay-x11.c3
-rw-r--r--gtk/gtkmain.c202
-rw-r--r--gtk/gtkmain.h11
-rw-r--r--po/POTFILES.in1
21 files changed, 437 insertions, 152 deletions
diff --git a/ChangeLog b/ChangeLog
index c537802d41..52ac383c95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c
+ gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c
+ gdk/win32/gdkdisplay-win32.c: Add a singleton object that
+ we can use to get notification when displays
+ appear / disappear or the default display changes.
+
+ gdk_set_default_display() => gdk_display_manager_set_default_display()
+ gdk_list_displays() => gdk_display_manager_list_displays().
+ (#85696)
+
+ * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler
+ generation.
+
+ * gdk/gdkintl.h: Add this.
+
+ * gtk/gtkmain.c: Add gtk_parse_args() that initializes
+ GTK+ without opening a display.
+
+ * gtk/gtkmain.c: Set things up so if a module
+ exports gtk_module_init() and gtk_module_display_init(),
+ then we treat it as multihead aware, otherwise,
+ we only initialize it after the default display is set.
+
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index c537802d41..52ac383c95 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,28 @@
+Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c
+ gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c
+ gdk/win32/gdkdisplay-win32.c: Add a singleton object that
+ we can use to get notification when displays
+ appear / disappear or the default display changes.
+
+ gdk_set_default_display() => gdk_display_manager_set_default_display()
+ gdk_list_displays() => gdk_display_manager_list_displays().
+ (#85696)
+
+ * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler
+ generation.
+
+ * gdk/gdkintl.h: Add this.
+
+ * gtk/gtkmain.c: Add gtk_parse_args() that initializes
+ GTK+ without opening a display.
+
+ * gtk/gtkmain.c: Set things up so if a module
+ exports gtk_module_init() and gtk_module_display_init(),
+ then we treat it as multihead aware, otherwise,
+ we only initialize it after the default display is set.
+
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index c537802d41..52ac383c95 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,28 @@
+Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c
+ gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c
+ gdk/win32/gdkdisplay-win32.c: Add a singleton object that
+ we can use to get notification when displays
+ appear / disappear or the default display changes.
+
+ gdk_set_default_display() => gdk_display_manager_set_default_display()
+ gdk_list_displays() => gdk_display_manager_list_displays().
+ (#85696)
+
+ * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler
+ generation.
+
+ * gdk/gdkintl.h: Add this.
+
+ * gtk/gtkmain.c: Add gtk_parse_args() that initializes
+ GTK+ without opening a display.
+
+ * gtk/gtkmain.c: Set things up so if a module
+ exports gtk_module_init() and gtk_module_display_init(),
+ then we treat it as multihead aware, otherwise,
+ we only initialize it after the default display is set.
+
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index c537802d41..52ac383c95 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,28 @@
+Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c
+ gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c
+ gdk/win32/gdkdisplay-win32.c: Add a singleton object that
+ we can use to get notification when displays
+ appear / disappear or the default display changes.
+
+ gdk_set_default_display() => gdk_display_manager_set_default_display()
+ gdk_list_displays() => gdk_display_manager_list_displays().
+ (#85696)
+
+ * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler
+ generation.
+
+ * gdk/gdkintl.h: Add this.
+
+ * gtk/gtkmain.c: Add gtk_parse_args() that initializes
+ GTK+ without opening a display.
+
+ * gtk/gtkmain.c: Set things up so if a module
+ exports gtk_module_init() and gtk_module_display_init(),
+ then we treat it as multihead aware, otherwise,
+ we only initialize it after the default display is set.
+
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index c537802d41..52ac383c95 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,28 @@
+Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c
+ gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c
+ gdk/win32/gdkdisplay-win32.c: Add a singleton object that
+ we can use to get notification when displays
+ appear / disappear or the default display changes.
+
+ gdk_set_default_display() => gdk_display_manager_set_default_display()
+ gdk_list_displays() => gdk_display_manager_list_displays().
+ (#85696)
+
+ * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler
+ generation.
+
+ * gdk/gdkintl.h: Add this.
+
+ * gtk/gtkmain.c: Add gtk_parse_args() that initializes
+ GTK+ without opening a display.
+
+ * gtk/gtkmain.c: Set things up so if a module
+ exports gtk_module_init() and gtk_module_display_init(),
+ then we treat it as multihead aware, otherwise,
+ we only initialize it after the default display is set.
+
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index c537802d41..52ac383c95 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,28 @@
+Thu Jun 20 16:49:00 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkdisplaymanager.[ch] gdk/gdk.[ch] gdk/gdkdisplay.c
+ gdk/gdkinternals.h gdk/x11/gdkdisplay-x11.c
+ gdk/win32/gdkdisplay-win32.c: Add a singleton object that
+ we can use to get notification when displays
+ appear / disappear or the default display changes.
+
+ gdk_set_default_display() => gdk_display_manager_set_default_display()
+ gdk_list_displays() => gdk_display_manager_list_displays().
+ (#85696)
+
+ * gdk/Makefile.am gdk/gdkmarshalers.list: Add marshaler
+ generation.
+
+ * gdk/gdkintl.h: Add this.
+
+ * gtk/gtkmain.c: Add gtk_parse_args() that initializes
+ GTK+ without opening a display.
+
+ * gtk/gtkmain.c: Set things up so if a module
+ exports gtk_module_init() and gtk_module_display_init(),
+ then we treat it as multihead aware, otherwise,
+ we only initialize it after the default display is set.
+
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
diff --git a/docs/reference/gtk/tmpl/gtk-unused.sgml b/docs/reference/gtk/tmpl/gtk-unused.sgml
index 143d5ddb62..4d2776cfb7 100644
--- a/docs/reference/gtk/tmpl/gtk-unused.sgml
+++ b/docs/reference/gtk/tmpl/gtk-unused.sgml
@@ -2830,6 +2830,15 @@ Creates a border around the arrows of a #GtkSpinButton. The type of border is de
@Returns:
+<!-- ##### FUNCTION gtk_style_get_font_for_display ##### -->
+<para>
+
+</para>
+
+@display:
+@style:
+@Returns:
+
<!-- ##### FUNCTION gtk_text_buffer_paste_primary ##### -->
<para>
diff --git a/docs/reference/gtk/tmpl/gtkfilesel.sgml b/docs/reference/gtk/tmpl/gtkfilesel.sgml
index 8176095128..a426eb3e74 100644
--- a/docs/reference/gtk/tmpl/gtkfilesel.sgml
+++ b/docs/reference/gtk/tmpl/gtkfilesel.sgml
@@ -135,8 +135,8 @@ Creates a new file selection dialog box. By default it will contain a #GtkCList
<para>
</para>
-@filesel:
-@filename:
+@filesel:
+@filename:
<!-- ##### FUNCTION gtk_file_selection_get_filename ##### -->
diff --git a/docs/reference/gtk/tmpl/gtkmain.sgml b/docs/reference/gtk/tmpl/gtkmain.sgml
index 9e96f7bb5a..885a793d99 100644
--- a/docs/reference/gtk/tmpl/gtkmain.sgml
+++ b/docs/reference/gtk/tmpl/gtkmain.sgml
@@ -106,27 +106,15 @@ functions such as g_signal_connect().
<!-- ##### FUNCTION gtk_init ##### -->
<para>
-Call this function before using any other GTK+ functions in your GUI
-applications. It will initialize everything needed to operate the toolkit and
-parses some standard command line options. <parameter>argc</parameter> and
-<parameter>argv</parameter> are adjusted accordingly so your own code will
-never see those standard arguments.
</para>
<note>
<para>
-This function will terminate your program if it was unable to initialize
-the GUI for some reason. If you want your program to fall back to a
-textual interface you want to call gtk_init_check() instead.
</para>
</note>
-@argc: Address of the <parameter>argc</parameter> parameter of your
-<function>main</function> function. Changed if any arguments were
-handled.
-@argv: Address of the <parameter>argv</parameter> parameter of
-<function>main()</function>. Any parameters understood by gtk_init()
-are stripped before return.
+@argc:
+@argv:
<!-- ##### FUNCTION gtk_init_check ##### -->
@@ -144,8 +132,7 @@ with the user - for example a curses or command line interface.
<function>main()</function> function.
@argv: A reference to the <parameter>argv</parameter> of the
<function>main()</function> function.
-@Returns: %TRUE if the GUI has been successfully initialized,
-%FALSE otherwise.
+@Returns:
<!-- ##### FUNCTION gtk_exit ##### -->
diff --git a/docs/reference/gtk/tmpl/gtkstyle.sgml b/docs/reference/gtk/tmpl/gtkstyle.sgml
index 0275f4ef3a..2f2fb10f64 100644
--- a/docs/reference/gtk/tmpl/gtkstyle.sgml
+++ b/docs/reference/gtk/tmpl/gtkstyle.sgml
@@ -179,16 +179,6 @@ Returns whether the style is attached to a window.
@Returns:
-<!-- ##### FUNCTION gtk_style_get_font_for_display ##### -->
-<para>
-
-</para>
-
-@display:
-@style:
-@Returns:
-
-
<!-- ##### FUNCTION gtk_style_set_font ##### -->
<para>
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 5b89251424..8881a31244 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -6,6 +6,7 @@ DIST_SUBDIRS=linux-fb win32 x11
EXTRA_DIST = \
gdkconfig.h.win32 \
gdk.def \
+ gdkmarshalers.list \
makefile.mingw \
makefile.mingw.in \
makeenums.pl \
@@ -86,32 +87,33 @@ LDFLAGS = @STRIP_BEGIN@ \
#
# Note: files added here may need to be be propagated to gdk_headers in gtk/Makefile.am
#
-gdk_public_h_sources = @STRIP_BEGIN@ \
- gdk.h \
- gdkcolor.h \
- gdkcursor.h \
- gdkdnd.h \
- gdkdrawable.h \
- gdkevents.h \
- gdkfont.h \
- gdkgc.h \
- gdkkeysyms.h \
- gdki18n.h \
- gdkimage.h \
- gdkinput.h \
- gdkkeys.h \
- gdkpango.h \
- gdkpixbuf.h \
- gdkpixmap.h \
- gdkproperty.h \
- gdkregion.h \
- gdkrgb.h \
- gdkselection.h \
- gdktypes.h \
- gdkvisual.h \
- gdkwindow.h \
- gdkdisplay.h \
- gdkscreen.h \
+gdk_public_h_sources = @STRIP_BEGIN@ \
+ gdk.h \
+ gdkcolor.h \
+ gdkcursor.h \
+ gdkdnd.h \
+ gdkdrawable.h \
+ gdkevents.h \
+ gdkfont.h \
+ gdkgc.h \
+ gdkkeysyms.h \
+ gdki18n.h \
+ gdkimage.h \
+ gdkinput.h \
+ gdkkeys.h \
+ gdkdisplaymanager.h \
+ gdkpango.h \
+ gdkpixbuf.h \
+ gdkpixmap.h \
+ gdkproperty.h \
+ gdkregion.h \
+ gdkrgb.h \
+ gdkselection.h \
+ gdktypes.h \
+ gdkvisual.h \
+ gdkwindow.h \
+ gdkdisplay.h \
+ gdkscreen.h \
@STRIP_END@
gdk_headers = @STRIP_BEGIN@ \
@@ -133,6 +135,8 @@ gdk_c_sources = @STRIP_BEGIN@ \
gdkkeyuni.c \
gdkimage.c \
gdkinternals.h \
+ gdkintl.h \
+ gdkdisplaymanager.c \
gdkpango.c \
gdkpixbuf-drawable.c \
gdkpixbuf-render.c \
@@ -157,9 +161,10 @@ gdk_c_sources = @STRIP_BEGIN@ \
gdkincludedir = $(includedir)/gtk-2.0/gdk
gdkinclude_HEADERS = $(gdk_headers)
-libgdk_x11_2_0_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c
-libgdk_linux_fb_2_0_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c
-libgdk_win32_2_0_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c
+# gdkmarshalers.c is commented out becuase it is currently an empty file
+libgdk_x11_2_0_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c gdkmarshalers.h # gdkmarshalers.c
+libgdk_linux_fb_2_0_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c gdkmarshalers.h # gdkmarshalers.c
+libgdk_win32_2_0_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c # gdkmarshalers.c
libgdk_x11_2_0_la_LIBADD = x11/libgdk-x11.la
libgdk_linux_fb_2_0_la_LIBADD = linux-fb/libgdk-linux-fb.la
@@ -191,10 +196,10 @@ if DISABLE_EXPLICIT_DEPS
endif
#note: not gdkconfig.h
-BUILT_SOURCES = stamp-gc-h @REBUILD@ gdkenumtypes.h
+BUILT_SOURCES = stamp-gc-h
# Generate built header without using automake-1.4 BUILT_SOURCES
-$(libgdk_x11_2_0_la_OBJECTS) $(libgdk_linux_fb_2_0_la_OBJECTS) $(libgdk_win32_2_0_la_OBJECTS): gdkenumtypes.h
+$(libgdk_x11_2_0_la_OBJECTS) $(libgdk_linux_fb_2_0_la_OBJECTS) $(libgdk_win32_2_0_la_OBJECTS): gdkenumtypes.h gdkmarshalers.h
$(srcdir)/gdkenumtypes.h: stamp-gdkenumtypes.h
@true
@@ -211,7 +216,7 @@ stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) Makefile
$(srcdir)/gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) Makefile
( cd $(srcdir) && glib-mkenums \
--fhead "#define GDK_ENABLE_BROKEN\n#include \"gdk.h\"" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
@@ -219,6 +224,20 @@ $(srcdir)/gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) Makefile
&& cp xgen-getc $(srcdir)/gdkenumtypes.c \
&& rm -f xgen-getc
+#
+# Marshaller generation
+#
+$(srcdir)/gdkmarshalers.h: @REBUILD@ gdkmarshalers.list
+ cd $(srcdir) && \
+ ( @GLIB_GENMARSHAL@ --prefix=gdk_marshal gdkmarshalers.list --header > gdkmarshalers.tmp \
+ && mv gdkmarshalers.tmp gdkmarshalers.h ) \
+ || ( rm -f gdkmarshalers.tmp && exit 1 )
+$(srcdir)/gdkmarshalers.c: @REBUILD@ gdkmarshalers.list
+ cd $(srcdir) && \
+ $( @GLIB_GENMARSHAL@ --prefix=gdk_marshal gdkmarshalers.list --body > gdkmarshalers.tmp \
+ && mv gdkmarshalers.tmp gdkmarshalers.c ) \
+ || ( rm -f gdkmarshalers.tmp && exit 1 )
+
gdkconfig.h: stamp-gc-h
@if test -f gdkconfig.h; then :; \
else rm -f stamp-gc-h; $(MAKE) stamp-gc-h; fi
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 98e0590ebf..b81f7d3e14 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -287,7 +287,7 @@ gdk_parse_args (int *argc,
gint i;
if (gdk_initialized)
- return TRUE;
+ return;
gdk_initialized = TRUE;
@@ -399,7 +399,8 @@ gdk_init_check (int *argc,
if (display)
{
- gdk_set_default_display (display);
+ gdk_display_manager_set_default_display (gdk_display_manager_get (),
+ display);
return TRUE;
}
else
diff --git a/gdk/gdk.h b/gdk/gdk.h
index cc624530c7..1773398119 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -39,6 +39,7 @@
#include <gdk/gdkimage.h>
#include <gdk/gdkinput.h>
#include <gdk/gdkkeys.h>
+#include <gdk/gdkdisplaymanager.h>
#include <gdk/gdkpango.h>
#include <gdk/gdkpixbuf.h>
#include <gdk/gdkpixmap.h>
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 9a746d4978..d4fa23a330 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -31,8 +31,6 @@ static void gdk_display_class_init (GdkDisplayClass *class);
static void gdk_display_init (GdkDisplay *display);
static void gdk_display_finalize (GObject *object);
-static GdkDisplay *default_display = NULL;
-
static GObjectClass *parent_class;
GType
@@ -90,8 +88,9 @@ gdk_display_finalize (GObject *object)
_gdk_displays = g_slist_remove (_gdk_displays, display);
- if (default_display == display)
- default_display = NULL;
+ if (gdk_get_default_display() == display)
+ gdk_display_manager_set_default_display (gdk_display_manager_get(),
+ NULL);
parent_class->finalize (object);
}
@@ -110,62 +109,6 @@ gdk_display_close (GdkDisplay *display)
}
/**
- * gdk_set_default_display:
- * @display: a #GdkDisplay
- *
- * Sets @display as the default display.
- **/
-void
-gdk_set_default_display (GdkDisplay *display)
-{
- default_display = display;
-
- _gdk_windowing_set_default_display (display);
-}
-
-/**
- * gdk_get_default_display:
- *
- * Gets the default #GdkDisplay.
- *
- * Returns: a #GdkDisplay, or %NULL if there is no default
- * display.
- */
-GdkDisplay *
-gdk_get_default_display (void)
-{
- return default_display;
-}
-
-/**
- * gdk_get_default_screen:
- *
- * Gets the default screen for the default display. (See
- * gdk_get_default_display ()).
- *
- * Returns: a #GdkScreen.
- */
-GdkScreen *
-gdk_get_default_screen (void)
-{
- return gdk_display_get_default_screen (gdk_get_default_display ());
-}
-
-/**
- * gdk_list_displays:
- *
- * List all currently open displays.
- *
- * Return value: a newly allocated #GSList of #GdkDisplay objects.
- * Free this list with g_slist_free() when you are done with it.
- **/
-GSList *
-gdk_list_displays (void)
-{
- return g_slist_copy (_gdk_displays);
-}
-
-/**
* gdk_display_get_event:
* @display: a #GdkDisplay
*
diff --git a/gdk/gdkintl.h b/gdk/gdkintl.h
new file mode 100644
index 0000000000..7cb426e9c3
--- /dev/null
+++ b/gdk/gdkintl.h
@@ -0,0 +1,24 @@
+#ifndef __GDKINTL_H__
+#define __GDKINTL_H__
+
+#include "config.h"
+
+#ifdef ENABLE_NLS
+#include<libintl.h>
+#define _(String) dgettext(GETTEXT_PACKAGE,String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#else /* NLS is disabled */
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#endif
+
+#endif
diff --git a/gdk/gdkmarshalers.list b/gdk/gdkmarshalers.list
new file mode 100644
index 0000000000..e22aea6aa5
--- /dev/null
+++ b/gdk/gdkmarshalers.list
@@ -0,0 +1 @@
+VOID:OBJECT
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 296ae1d85f..0e9c4356ae 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -51,6 +51,9 @@ gdk_open_display (const gchar *display_name)
_gdk_input_init ();
_gdk_dnd_init ();
+ g_signal_emit_by_name (gdk_display_manager_get (),
+ "display_opened", _gdk_display);
+
return _gdk_display;
}
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 4f2861105a..738a34095c 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -199,7 +199,8 @@ gdk_open_display (const gchar *display_name)
_gdk_input_init (display);
_gdk_dnd_init (display);
- g_signal_emit_by_name (gdk_library_get(), "display_opened", display);
+ g_signal_emit_by_name (gdk_display_manager_get(),
+ "display_opened", display);
return display;
}
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index eb33e039f2..73c007e026 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -70,6 +70,7 @@ typedef struct _GtkInitFunction GtkInitFunction;
typedef struct _GtkQuitFunction GtkQuitFunction;
typedef struct _GtkClosure GtkClosure;
typedef struct _GtkKeySnooperData GtkKeySnooperData;
+typedef struct _GtkModuleInfo GtkModuleInfo;
struct _GtkInitFunction
{
@@ -101,6 +102,12 @@ struct _GtkKeySnooperData
guint id;
};
+struct _GtkModuleInfo
+{
+ GtkModuleInitFunc init_func;
+ GtkModuleDisplayInitFunc display_init_func;
+};
+
static gint gtk_quit_invoke_function (GtkQuitFunction *quitf);
static void gtk_quit_destroy (GtkQuitFunction *quitf);
static gint gtk_invoke_key_snoopers (GtkWidget *grab_widget,
@@ -127,6 +134,13 @@ const guint gtk_micro_version = GTK_MICRO_VERSION;
const guint gtk_binary_age = GTK_BINARY_AGE;
const guint gtk_interface_age = GTK_INTERFACE_AGE;
+static GSList *gtk_modules;
+
+/* Saved argc,argv for delayed module initialization
+ */
+static gint gtk_argc = 0;
+static gchar **gtk_argv = NULL;
+
static guint gtk_main_loop_level = 0;
static gint gtk_initialized = FALSE;
static GList *current_events = NULL;
@@ -466,10 +480,11 @@ find_module (const gchar *name)
}
static GSList *
-load_module (GSList *gtk_modules,
+load_module (GSList *module_list,
const gchar *name)
{
GtkModuleInitFunc modinit_func = NULL;
+ GtkModuleInfo *info;
GModule *module = NULL;
if (g_module_supported ())
@@ -479,11 +494,16 @@ load_module (GSList *gtk_modules,
g_module_symbol (module, "gtk_module_init", (gpointer *) &modinit_func) &&
modinit_func)
{
- if (!g_slist_find (gtk_modules, (gconstpointer) modinit_func))
+ if (!g_slist_find (module_list, (gconstpointer) modinit_func))
{
g_module_make_resident (module);
- gtk_modules = g_slist_prepend (gtk_modules,
- (gpointer) modinit_func);
+ info = g_new (GtkModuleInfo, 1);
+
+ info->init_func = modinit_func;
+ g_module_symbol (module, "gtk_module_display_init",
+ (gpointer *) &info->display_init_func);
+
+ module_list = g_slist_prepend (module_list, info);
}
else
{
@@ -501,24 +521,24 @@ load_module (GSList *gtk_modules,
g_module_close (module);
}
- return gtk_modules;
+ return module_list;
}
static GSList *
load_modules (const char *module_str)
{
gchar **module_names = pango_split_file_list (module_str);
- GSList *gtk_modules = NULL;
+ GSList *module_list = NULL;
gint i;
for (i = 0; module_names[i]; i++)
- gtk_modules = load_module (gtk_modules, module_names[i]);
+ module_list = load_module (module_list, module_names[i]);
- gtk_modules = g_slist_reverse (gtk_modules);
+ module_list = g_slist_reverse (module_list);
g_strfreev (module_names);
- return gtk_modules;
+ return module_list;
}
static gboolean do_setlocale = TRUE;
@@ -545,13 +565,75 @@ gtk_disable_setlocale (void)
#undef gtk_init_check
+static void
+default_display_notify_cb (GdkDisplayManager *display_manager)
+{
+ GSList *slist;
+
+ /* Initialize non-multihead-aware modules when the
+ * default display is first set to a non-NULL value.
+ */
+ static gboolean initialized = FALSE;
+
+ if (!gdk_get_default_display () || initialized)
+ return;
+
+ initialized = TRUE;
+
+ for (slist = gtk_modules; slist; slist = slist->next)
+ {
+ if (slist->data)
+ {
+ GtkModuleInfo *info = slist->data;
+
+ if (!info->display_init_func)
+ info->init_func (&gtk_argc, &gtk_argv);
+ }
+ }
+}
+
+static void
+display_opened_cb (GdkDisplayManager *display_manager,
+ GdkDisplay *display)
+{
+ GSList *slist;
+
+ for (slist = gtk_modules; slist; slist = slist->next)
+ {
+ if (slist->data)
+ {
+ GtkModuleInfo *info = slist->data;
+
+ if (info->display_init_func)
+ info->display_init_func (display);
+ }
+ }
+}
+
+/**
+ * gdk_parse_args:
+ * @argc: the number of command line arguments.
+ * @argv: the array of command line arguments.
+ *
+ * Parses command line arguments, and initializes global
+ * attributes of GTK+, but does not actually open a connection
+ * to a display. (See gdk_open_display(), gdk_get_display_arg_name())
+ *
+ * Any arguments used by GTK or GDK are removed from the array and
+ * @argc and @argv are updated accordingly.
+ *
+ * You shouldn't call this function explicitely if you are using
+ * gtk_init(), or gtk_init_check().
+ *
+ * Return value: %TRUE if initialization succeeded, otherwise %FALSE.
+ **/
gboolean
-gtk_init_check (int *argc,
- char ***argv)
+gtk_parse_args (int *argc,
+ char ***argv)
{
GString *gtk_modules_string = NULL;
- GSList *gtk_modules = NULL;
GSList *slist;
+ GdkDisplayManager *display_manager;
const gchar *env_string;
if (gtk_initialized)
@@ -572,13 +654,8 @@ gtk_init_check (int *argc,
if (!setlocale (LC_ALL, ""))
g_warning ("Locale not supported by C library.\n\tUsing the fallback 'C' locale.");
}
-
- /* Initialize "gdk". We pass along the 'argc' and 'argv'
- * parameters as they contain information that GDK uses
- */
- if (!gdk_init_check (argc, argv))
- return FALSE;
+ gdk_parse_args (argc, argv);
gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
#ifdef G_ENABLE_DEBUG
@@ -697,6 +774,11 @@ gtk_init_check (int *argc,
*argc -= k;
}
}
+
+ gtk_argv = g_malloc ((gtk_argc + 1) * sizeof (char*));
+ for (i = 0; i < gtk_argc; i++)
+ gtk_argv[i] = g_strdup ((*argv)[i]);
+ gtk_argv[gtk_argc] = NULL;
}
if (gtk_debug_flags & GTK_DEBUG_UPDATES)
@@ -738,25 +820,97 @@ gtk_init_check (int *argc,
*/
gtk_initialized = TRUE;
- /* initialize gtk modules
+ display_manager = gdk_display_manager_get ();
+ g_signal_connect (display_manager, "notify::default-display",
+ G_CALLBACK (default_display_notify_cb), NULL);
+ g_signal_connect (display_manager, "display-opened",
+ G_CALLBACK (display_opened_cb), NULL);
+
+ /* initialize multhead aware gtk modules; for other modules,
+ * we wait until we have a display open;
*/
for (slist = gtk_modules; slist; slist = slist->next)
{
if (slist->data)
{
- GtkModuleInitFunc modinit;
-
- modinit = (GtkModuleInitFunc) slist->data;
- modinit (argc, argv);
+ GtkModuleInfo *info = slist->data;
+
+ if (info->display_init_func)
+ info->init_func (argc, argv);
}
}
- g_slist_free (gtk_modules);
return TRUE;
}
+#undef gtk_init_check
+
+/**
+ * gtk_init_check:
+ * @argc: Address of the <parameter>argc</parameter> parameter of your
+ * <function>main()</function> function. Changed if any arguments were
+ * handled.
+ * @argv: Address of the <parameter>argv</parameter> parameter of
+ * <function>main()</function>. Any parameters understood by gtk_init()
+ * are stripped before return.
+ *
+ * This function does the same work as gtk_init() with only
+ * a single change: It does not terminate the program if the GUI can't be
+ * initialized. Instead it returns %FALSE on failure.
+ *
+ * This way the application can fall back to some other means of communication
+ * with the user - for example a curses or command line interface.
+ *
+ * Return value: %TRUE if the GUI has been successfully initialized,
+ * %FALSE otherwise.
+ **/
+gboolean
+gtk_init_check (int *argc,
+ char ***argv)
+{
+ GdkDisplay *display;
+
+ if (!gtk_parse_args (argc, argv))
+ return FALSE;
+
+ if (gdk_get_default_display ())
+ return TRUE;
+
+ display = gdk_open_display (gdk_get_display_arg_name ());
+
+ if (display)
+ {
+ gdk_display_manager_set_default_display (gdk_display_manager_get (),
+ display);
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
#undef gtk_init
+/**
+ * gtk_init_check:
+ * @argc: Address of the <parameter>argc</parameter> parameter of your
+ * <function>main()</function> function. Changed if any arguments were
+ * handled.
+ * @argv: Address of the <parameter>argv</parameter> parameter of
+ * <function>main()</function>. Any parameters understood by gtk_init()
+ * are stripped before return.
+ *
+ * Call this function before using any other GTK+ functions in your GUI
+ * applications. It will initialize everything needed to operate the toolkit and
+ * parses some standard command line options. <parameter>argc</parameter> and
+ * <parameter>argv</parameter> are adjusted accordingly so your own code will
+ * never see those standard arguments.
+ *
+ * <note><para>
+ * This function will terminate your program if it was unable to initialize
+ * the GUI for some reason. If you want your program to fall back to a
+ * textual interface you want to call gtk_init_check() instead.
+ * </para></note>
+ **/
void
gtk_init (int *argc, char ***argv)
{
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 7ca018e586..7837bfc29c 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -54,11 +54,12 @@ extern "C" {
#endif /* GTK_DISABLE_DEPRECATED */
-typedef void (*GtkModuleInitFunc) (gint *argc,
- gchar ***argv);
-typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
- GdkEventKey *event,
- gpointer func_data);
+typedef void (*GtkModuleInitFunc) (gint *argc,
+ gchar ***argv);
+typedef void (*GtkModuleDisplayInitFunc) (GdkDisplay *display);
+typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
+ GdkEventKey *event,
+ gpointer func_data);
/* Gtk version.
*/
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2cbc0639fe..1bd4e85945 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -17,6 +17,7 @@ gdk-pixbuf/io-tiff.c
gdk-pixbuf/io-wbmp.c
gdk-pixbuf/io-xbm.c
gdk-pixbuf/io-xpm.c
+gdk/gdkdisplaymanager.c
gtk/gtkaccellabel.c
gtk/gtkalignment.c
gtk/gtkarrow.c