plug/socket: Warn if used outside X11
Give a clear warning when either of these are realized on a non-X11 screen.
This commit is contained in:
parent
cbe5e596af
commit
aa3bf0ac14
@ -58,16 +58,14 @@
|
|||||||
*
|
*
|
||||||
* The communication between a #GtkSocket and a #GtkPlug follows the
|
* The communication between a #GtkSocket and a #GtkPlug follows the
|
||||||
* [XEmbed Protocol](http://www.freedesktop.org/Standards/xembed-spec).
|
* [XEmbed Protocol](http://www.freedesktop.org/Standards/xembed-spec).
|
||||||
* This protocol has also been implemented in other toolkits,
|
* This protocol has also been implemented in other toolkits, e.g. Qt,
|
||||||
* e.g. Qt, allowing the same level of
|
* allowing the same level of integration when embedding a Qt widget
|
||||||
* integration when embedding a Qt widget
|
|
||||||
* in GTK+ or vice versa.
|
* in GTK+ or vice versa.
|
||||||
*
|
*
|
||||||
* The #GtkPlug and #GtkSocket widgets are only available when GTK+
|
* The #GtkPlug and #GtkSocket widgets are only available when GTK+
|
||||||
* is compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
|
* is compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
|
||||||
* They can only be used on a #GdkX11Display. To use #GtkPlug and
|
* They can only be used on a #GdkX11Display. To use #GtkPlug and
|
||||||
* #GtkSocket, you need to include the `gtk/gtkx.h`
|
* #GtkSocket, you need to include the `gtk/gtkx.h` header.
|
||||||
* header.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _GtkPlugPrivate
|
struct _GtkPlugPrivate
|
||||||
@ -1029,9 +1027,14 @@ gtk_plug_realize (GtkWidget *widget)
|
|||||||
const gchar *title;
|
const gchar *title;
|
||||||
gchar *wmclass_name, *wmclass_class;
|
gchar *wmclass_name, *wmclass_class;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
|
GdkScreen *screen;
|
||||||
|
|
||||||
gtk_widget_set_realized (widget, TRUE);
|
gtk_widget_set_realized (widget, TRUE);
|
||||||
|
|
||||||
|
screen = gtk_widget_get_screen (widget);
|
||||||
|
if (!GDK_IS_X11_SCREEN (screen))
|
||||||
|
g_warning ("GtkPlug only works under X11");
|
||||||
|
|
||||||
title = gtk_window_get_title (window);
|
title = gtk_window_get_title (window);
|
||||||
_gtk_window_get_wmclass (window, &wmclass_name, &wmclass_class);
|
_gtk_window_get_wmclass (window, &wmclass_name, &wmclass_class);
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
@ -1064,7 +1067,7 @@ gtk_plug_realize (GtkWidget *widget)
|
|||||||
GdkWindow *root_window;
|
GdkWindow *root_window;
|
||||||
attributes.window_type = GDK_WINDOW_TOPLEVEL;
|
attributes.window_type = GDK_WINDOW_TOPLEVEL;
|
||||||
|
|
||||||
root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
|
root_window = gdk_screen_get_root_window (screen);
|
||||||
|
|
||||||
gdk_error_trap_push ();
|
gdk_error_trap_push ();
|
||||||
if (priv->socket_window)
|
if (priv->socket_window)
|
||||||
|
@ -101,16 +101,14 @@
|
|||||||
*
|
*
|
||||||
* The communication between a #GtkSocket and a #GtkPlug follows the
|
* The communication between a #GtkSocket and a #GtkPlug follows the
|
||||||
* [XEmbed Protocol](http://www.freedesktop.org/Standards/xembed-spec).
|
* [XEmbed Protocol](http://www.freedesktop.org/Standards/xembed-spec).
|
||||||
* This protocol has also been implemented in other toolkits,
|
* This protocol has also been implemented in other toolkits, e.g. Qt,
|
||||||
* e.g. Qt, allowing the same level of
|
* allowing the same level of integration when embedding a Qt widget
|
||||||
* integration when embedding a Qt widget
|
|
||||||
* in GTK or vice versa.
|
* in GTK or vice versa.
|
||||||
*
|
*
|
||||||
* The #GtkPlug and #GtkSocket widgets are only available when GTK+
|
* The #GtkPlug and #GtkSocket widgets are only available when GTK+
|
||||||
* is compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
|
* is compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
|
||||||
* They can only be used on a #GdkX11Display. To use #GtkPlug and
|
* They can only be used on a #GdkX11Display. To use #GtkPlug and
|
||||||
* #GtkSocket, you need to include the `gtk/gtkx.h`
|
* #GtkSocket, you need to include the `gtk/gtkx.h` header.
|
||||||
* header.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Forward declararations */
|
/* Forward declararations */
|
||||||
@ -391,9 +389,14 @@ gtk_socket_realize (GtkWidget *widget)
|
|||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
XWindowAttributes xattrs;
|
XWindowAttributes xattrs;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
|
GdkScreen *screen;
|
||||||
|
|
||||||
gtk_widget_set_realized (widget, TRUE);
|
gtk_widget_set_realized (widget, TRUE);
|
||||||
|
|
||||||
|
screen = gtk_widget_get_screen (widget);
|
||||||
|
if (!GDK_IS_X11_SCREEN (screen))
|
||||||
|
g_warning ("GtkSocket: only works under X11");
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
|
Loading…
Reference in New Issue
Block a user