aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gtkutil.c4
-rw-r--r--src/gtkutil.h1
-rw-r--r--src/xwidget.c6
3 files changed, 11 insertions, 0 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index da4a0ae13df..382039c4047 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -147,6 +147,8 @@ struct xg_frame_tb_info
147 GtkTextDirection dir; 147 GtkTextDirection dir;
148}; 148};
149 149
150bool xg_gtk_initialized; /* Used to make sure xwidget calls are possible */
151
150static GtkWidget * xg_get_widget_from_map (ptrdiff_t idx); 152static GtkWidget * xg_get_widget_from_map (ptrdiff_t idx);
151 153
152 154
@@ -5321,6 +5323,8 @@ xg_initialize (void)
5321#ifdef HAVE_FREETYPE 5323#ifdef HAVE_FREETYPE
5322 x_last_font_name = NULL; 5324 x_last_font_name = NULL;
5323#endif 5325#endif
5326
5327 xg_gtk_initialized = true;
5324} 5328}
5325 5329
5326#endif /* USE_GTK */ 5330#endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 7dcd549f5c0..3b074073e44 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -202,5 +202,6 @@ extern void xg_initialize (void);
202 to indicate that the callback should do nothing. */ 202 to indicate that the callback should do nothing. */
203extern bool xg_ignore_gtk_scrollbar; 203extern bool xg_ignore_gtk_scrollbar;
204 204
205extern bool xg_gtk_initialized;
205#endif /* USE_GTK */ 206#endif /* USE_GTK */
206#endif /* GTKUTIL_H */ 207#endif /* GTKUTIL_H */
diff --git a/src/xwidget.c b/src/xwidget.c
index 6faac107518..6da7a0bb3f4 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -78,6 +78,8 @@ Returns the newly constructed xwidget, or nil if construction fails. */)
78 Lisp_Object title, Lisp_Object width, Lisp_Object height, 78 Lisp_Object title, Lisp_Object width, Lisp_Object height,
79 Lisp_Object arguments, Lisp_Object buffer) 79 Lisp_Object arguments, Lisp_Object buffer)
80{ 80{
81 if (!xg_gtk_initialized)
82 error ("make-xwidget: GTK has not been initialized");
81 CHECK_SYMBOL (type); 83 CHECK_SYMBOL (type);
82 CHECK_FIXNAT (width); 84 CHECK_FIXNAT (width);
83 CHECK_FIXNAT (height); 85 CHECK_FIXNAT (height);
@@ -513,6 +515,10 @@ xwidget_init_view (struct xwidget *xww,
513 struct glyph_string *s, 515 struct glyph_string *s,
514 int x, int y) 516 int x, int y)
515{ 517{
518
519 if (!xg_gtk_initialized)
520 error ("xwidget_init_view: GTK has not been initialized");
521
516 struct xwidget_view *xv = allocate_xwidget_view (); 522 struct xwidget_view *xv = allocate_xwidget_view ();
517 Lisp_Object val; 523 Lisp_Object val;
518 524