mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
GtkPlug: move public members to private structures
This commit is contained in:
parent
af8efa0b46
commit
e8184f2a46
@ -80,7 +80,9 @@ _gtk_plug_windowing_unmap_toplevel (GtkPlug *plug)
|
||||
void
|
||||
_gtk_plug_windowing_set_focus (GtkPlug *plug)
|
||||
{
|
||||
_gtk_xembed_send_message (plug->socket_window,
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
_gtk_xembed_send_message (priv->socket_window,
|
||||
XEMBED_REQUEST_FOCUS, 0, 0, 0);
|
||||
}
|
||||
|
||||
@ -89,7 +91,9 @@ _gtk_plug_windowing_add_grabbed_key (GtkPlug *plug,
|
||||
guint accelerator_key,
|
||||
GdkModifierType accelerator_mods)
|
||||
{
|
||||
_gtk_xembed_send_message (plug->socket_window, XEMBED_GTK_GRAB_KEY, 0,
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
_gtk_xembed_send_message (priv->socket_window, XEMBED_GTK_GRAB_KEY, 0,
|
||||
accelerator_key, accelerator_mods);
|
||||
}
|
||||
|
||||
@ -98,7 +102,9 @@ _gtk_plug_windowing_remove_grabbed_key (GtkPlug *plug,
|
||||
guint accelerator_key,
|
||||
GdkModifierType accelerator_mods)
|
||||
{
|
||||
_gtk_xembed_send_message (plug->socket_window, XEMBED_GTK_UNGRAB_KEY, 0,
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
_gtk_xembed_send_message (priv->socket_window, XEMBED_GTK_UNGRAB_KEY, 0,
|
||||
accelerator_key, accelerator_mods);
|
||||
}
|
||||
|
||||
@ -106,6 +112,7 @@ void
|
||||
_gtk_plug_windowing_focus_to_parent (GtkPlug *plug,
|
||||
GtkDirectionType direction)
|
||||
{
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
XEmbedMessageType message = XEMBED_FOCUS_PREV; /* Quiet GCC */
|
||||
|
||||
switch (direction)
|
||||
@ -121,8 +128,8 @@ _gtk_plug_windowing_focus_to_parent (GtkPlug *plug,
|
||||
message = XEMBED_FOCUS_NEXT;
|
||||
break;
|
||||
}
|
||||
|
||||
_gtk_xembed_send_focus_message (plug->socket_window, message, 0);
|
||||
|
||||
_gtk_xembed_send_focus_message (priv->socket_window, message, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -219,6 +226,7 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
|
||||
GdkScreen *screen = gdk_drawable_get_screen (event->any.window);
|
||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||
GtkPlug *plug = GTK_PLUG (data);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
XEvent *xevent = (XEvent *)gdk_xevent;
|
||||
|
||||
GdkFilterReturn return_val;
|
||||
@ -253,7 +261,7 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
|
||||
case ReparentNotify:
|
||||
{
|
||||
XReparentEvent *xre = &xevent->xreparent;
|
||||
gboolean was_embedded = plug->socket_window != NULL;
|
||||
gboolean was_embedded = priv->socket_window != NULL;
|
||||
|
||||
GTK_NOTE (PLUGSOCKET, g_message("GtkPlug: ReparentNotify received"));
|
||||
|
||||
@ -270,14 +278,14 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
|
||||
* then add to a local window before we get notification
|
||||
* Probably need check in _gtk_plug_add_to_socket
|
||||
*/
|
||||
|
||||
if (xre->parent != GDK_WINDOW_XWINDOW (plug->socket_window))
|
||||
|
||||
if (xre->parent != GDK_WINDOW_XWINDOW (priv->socket_window))
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (plug);
|
||||
|
||||
gdk_window_set_user_data (plug->socket_window, NULL);
|
||||
g_object_unref (plug->socket_window);
|
||||
plug->socket_window = NULL;
|
||||
gdk_window_set_user_data (priv->socket_window, NULL);
|
||||
g_object_unref (priv->socket_window);
|
||||
priv->socket_window = NULL;
|
||||
|
||||
/* Emit a delete window, as if the user attempted
|
||||
* to close the toplevel. Simple as to how we
|
||||
@ -305,25 +313,26 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
|
||||
/* Start of embedding protocol */
|
||||
|
||||
GTK_NOTE (PLUGSOCKET, g_message ("GtkPlug: start of embedding"));
|
||||
plug->socket_window = gdk_window_lookup_for_display (display, xre->parent);
|
||||
if (plug->socket_window)
|
||||
|
||||
priv->socket_window = gdk_window_lookup_for_display (display, xre->parent);
|
||||
if (priv->socket_window)
|
||||
{
|
||||
gpointer user_data = NULL;
|
||||
gdk_window_get_user_data (plug->socket_window, &user_data);
|
||||
gdk_window_get_user_data (priv->socket_window, &user_data);
|
||||
|
||||
if (user_data)
|
||||
{
|
||||
g_warning (G_STRLOC "Plug reparented unexpectedly into window in the same process");
|
||||
plug->socket_window = NULL;
|
||||
priv->socket_window = NULL;
|
||||
break; /* FIXME: shouldn't this unref the plug? i.e. "goto done;" instead */
|
||||
}
|
||||
|
||||
g_object_ref (plug->socket_window);
|
||||
g_object_ref (priv->socket_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug->socket_window = gdk_window_foreign_new_for_display (display, xre->parent);
|
||||
if (!plug->socket_window) /* Already gone */
|
||||
priv->socket_window = gdk_window_foreign_new_for_display (display, xre->parent);
|
||||
if (!priv->socket_window) /* Already gone */
|
||||
break; /* FIXME: shouldn't this unref the plug? i.e. "goto done;" instead */
|
||||
}
|
||||
|
||||
|
161
gtk/gtkplug.c
161
gtk/gtkplug.c
@ -109,14 +109,15 @@ gtk_plug_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkPlug *plug = GTK_PLUG (object);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_EMBEDDED:
|
||||
g_value_set_boolean (value, plug->socket_window != NULL);
|
||||
g_value_set_boolean (value, priv->socket_window != NULL);
|
||||
break;
|
||||
case PROP_SOCKET_WINDOW:
|
||||
g_value_set_object (value, plug->socket_window);
|
||||
g_value_set_object (value, priv->socket_window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -200,14 +201,18 @@ gtk_plug_class_init (GtkPlugClass *class)
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkPlugPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_plug_init (GtkPlug *plug)
|
||||
{
|
||||
GtkWindow *window;
|
||||
GtkWindow *window = GTK_WINDOW (plug);
|
||||
|
||||
window = GTK_WINDOW (plug);
|
||||
plug->priv = G_TYPE_INSTANCE_GET_PRIVATE (plug,
|
||||
GTK_TYPE_PLUG,
|
||||
GtkPlugPrivate);
|
||||
|
||||
window->type = GTK_WINDOW_TOPLEVEL;
|
||||
}
|
||||
@ -216,20 +221,21 @@ static void
|
||||
gtk_plug_set_is_child (GtkPlug *plug,
|
||||
gboolean is_child)
|
||||
{
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
GtkWidget *widget = GTK_WIDGET (plug);
|
||||
|
||||
g_assert (!gtk_widget_get_parent (widget));
|
||||
|
||||
if (is_child)
|
||||
{
|
||||
if (plug->modality_window)
|
||||
if (priv->modality_window)
|
||||
_gtk_plug_handle_modality_off (plug);
|
||||
|
||||
if (plug->modality_group)
|
||||
if (priv->modality_group)
|
||||
{
|
||||
gtk_window_group_remove_window (plug->modality_group, GTK_WINDOW (plug));
|
||||
g_object_unref (plug->modality_group);
|
||||
plug->modality_group = NULL;
|
||||
gtk_window_group_remove_window (priv->modality_group, GTK_WINDOW (plug));
|
||||
g_object_unref (priv->modality_group);
|
||||
priv->modality_group = NULL;
|
||||
}
|
||||
|
||||
/* As a toplevel, the MAPPED flag doesn't correspond
|
||||
@ -251,10 +257,10 @@ gtk_plug_set_is_child (GtkPlug *plug,
|
||||
gtk_window_set_focus (GTK_WINDOW (plug), NULL);
|
||||
if (GTK_WINDOW (plug)->default_widget)
|
||||
gtk_window_set_default (GTK_WINDOW (plug), NULL);
|
||||
|
||||
plug->modality_group = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (plug->modality_group, GTK_WINDOW (plug));
|
||||
|
||||
|
||||
priv->modality_group = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (priv->modality_group, GTK_WINDOW (plug));
|
||||
|
||||
_gtk_window_set_is_toplevel (GTK_WINDOW (plug), TRUE);
|
||||
gtk_container_set_resize_mode (GTK_CONTAINER (plug), GTK_RESIZE_QUEUE);
|
||||
|
||||
@ -298,7 +304,7 @@ gtk_plug_get_embedded (GtkPlug *plug)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_PLUG (plug), FALSE);
|
||||
|
||||
return plug->socket_window != NULL;
|
||||
return plug->priv->socket_window != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -316,7 +322,7 @@ gtk_plug_get_socket_window (GtkPlug *plug)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_PLUG (plug), NULL);
|
||||
|
||||
return plug->socket_window;
|
||||
return plug->priv->socket_window;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,6 +336,7 @@ void
|
||||
_gtk_plug_add_to_socket (GtkPlug *plug,
|
||||
GtkSocket *socket_)
|
||||
{
|
||||
GtkPlugPrivate *priv;
|
||||
GtkWidget *widget;
|
||||
gint w, h;
|
||||
|
||||
@ -337,15 +344,16 @@ _gtk_plug_add_to_socket (GtkPlug *plug,
|
||||
g_return_if_fail (GTK_IS_SOCKET (socket_));
|
||||
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (socket_)));
|
||||
|
||||
priv = plug->priv;
|
||||
widget = GTK_WIDGET (plug);
|
||||
|
||||
gtk_plug_set_is_child (plug, TRUE);
|
||||
plug->same_app = TRUE;
|
||||
priv->same_app = TRUE;
|
||||
socket_->same_app = TRUE;
|
||||
socket_->plug_widget = widget;
|
||||
|
||||
plug->socket_window = gtk_widget_get_window (GTK_WIDGET (socket_));
|
||||
g_object_ref (plug->socket_window);
|
||||
priv->socket_window = gtk_widget_get_window (GTK_WIDGET (socket_));
|
||||
g_object_ref (priv->socket_window);
|
||||
g_signal_emit (plug, plug_signals[EMBEDDED], 0);
|
||||
g_object_notify (G_OBJECT (plug), "embedded");
|
||||
|
||||
@ -355,7 +363,7 @@ _gtk_plug_add_to_socket (GtkPlug *plug,
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
gdk_drawable_get_size (GDK_DRAWABLE (window), &w, &h);
|
||||
gdk_window_reparent (window, plug->socket_window, -w, -h);
|
||||
gdk_window_reparent (window, priv->socket_window, -w, -h);
|
||||
}
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (socket_));
|
||||
@ -400,6 +408,7 @@ void
|
||||
_gtk_plug_remove_from_socket (GtkPlug *plug,
|
||||
GtkSocket *socket_)
|
||||
{
|
||||
GtkPlugPrivate *priv;
|
||||
GtkWidget *widget;
|
||||
GdkWindow *window;
|
||||
gboolean result;
|
||||
@ -409,6 +418,7 @@ _gtk_plug_remove_from_socket (GtkPlug *plug,
|
||||
g_return_if_fail (GTK_IS_SOCKET (socket_));
|
||||
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (plug)));
|
||||
|
||||
priv = plug->priv;
|
||||
widget = GTK_WIDGET (plug);
|
||||
|
||||
if (GTK_WIDGET_IN_REPARENT (widget))
|
||||
@ -437,11 +447,11 @@ _gtk_plug_remove_from_socket (GtkPlug *plug,
|
||||
|
||||
socket_->same_app = FALSE;
|
||||
|
||||
plug->same_app = FALSE;
|
||||
if (plug->socket_window != NULL)
|
||||
priv->same_app = FALSE;
|
||||
if (priv->socket_window != NULL)
|
||||
{
|
||||
g_object_unref (plug->socket_window);
|
||||
plug->socket_window = NULL;
|
||||
g_object_unref (priv->socket_window);
|
||||
priv->socket_window = NULL;
|
||||
}
|
||||
gtk_plug_set_is_child (plug, FALSE);
|
||||
|
||||
@ -493,14 +503,21 @@ gtk_plug_construct_for_display (GtkPlug *plug,
|
||||
GdkDisplay *display,
|
||||
GdkNativeWindow socket_id)
|
||||
{
|
||||
GtkPlugPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_PLUG (plug));
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
priv = plug->priv;
|
||||
|
||||
if (socket_id)
|
||||
{
|
||||
gpointer user_data = NULL;
|
||||
|
||||
plug->socket_window = gdk_window_lookup_for_display (display, socket_id);
|
||||
if (plug->socket_window)
|
||||
priv->socket_window = gdk_window_lookup_for_display (display, socket_id);
|
||||
if (priv->socket_window)
|
||||
{
|
||||
gdk_window_get_user_data (plug->socket_window, &user_data);
|
||||
gdk_window_get_user_data (priv->socket_window, &user_data);
|
||||
|
||||
if (user_data)
|
||||
{
|
||||
@ -509,16 +526,16 @@ gtk_plug_construct_for_display (GtkPlug *plug,
|
||||
else
|
||||
{
|
||||
g_warning (G_STRLOC "Can't create GtkPlug as child of non-GtkSocket");
|
||||
plug->socket_window = NULL;
|
||||
priv->socket_window = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
g_object_ref (plug->socket_window);
|
||||
g_object_ref (priv->socket_window);
|
||||
}
|
||||
else
|
||||
plug->socket_window = gdk_window_foreign_new_for_display (display, socket_id);
|
||||
priv->socket_window = gdk_window_foreign_new_for_display (display, socket_id);
|
||||
|
||||
if (plug->socket_window) {
|
||||
if (priv->socket_window) {
|
||||
g_signal_emit (plug, plug_signals[EMBEDDED], 0);
|
||||
|
||||
g_object_notify (G_OBJECT (plug), "embedded");
|
||||
@ -559,6 +576,8 @@ gtk_plug_new_for_display (GdkDisplay *display,
|
||||
{
|
||||
GtkPlug *plug;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
plug = g_object_new (GTK_TYPE_PLUG, NULL);
|
||||
gtk_plug_construct_for_display (plug, display, socket_id);
|
||||
return GTK_WIDGET (plug);
|
||||
@ -568,11 +587,12 @@ static void
|
||||
gtk_plug_finalize (GObject *object)
|
||||
{
|
||||
GtkPlug *plug = GTK_PLUG (object);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (plug->grabbed_keys)
|
||||
if (priv->grabbed_keys)
|
||||
{
|
||||
g_hash_table_destroy (plug->grabbed_keys);
|
||||
plug->grabbed_keys = NULL;
|
||||
g_hash_table_destroy (priv->grabbed_keys);
|
||||
priv->grabbed_keys = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_plug_parent_class)->finalize (object);
|
||||
@ -582,23 +602,24 @@ static void
|
||||
gtk_plug_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkPlug *plug = GTK_PLUG (widget);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (plug->socket_window != NULL)
|
||||
if (priv->socket_window != NULL)
|
||||
{
|
||||
gdk_window_set_user_data (plug->socket_window, NULL);
|
||||
g_object_unref (plug->socket_window);
|
||||
plug->socket_window = NULL;
|
||||
gdk_window_set_user_data (priv->socket_window, NULL);
|
||||
g_object_unref (priv->socket_window);
|
||||
priv->socket_window = NULL;
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "embedded");
|
||||
}
|
||||
|
||||
if (!plug->same_app)
|
||||
if (!priv->same_app)
|
||||
{
|
||||
if (plug->modality_window)
|
||||
if (priv->modality_window)
|
||||
_gtk_plug_handle_modality_off (plug);
|
||||
|
||||
gtk_window_group_remove_window (plug->modality_group, GTK_WINDOW (plug));
|
||||
g_object_unref (plug->modality_group);
|
||||
gtk_window_group_remove_window (priv->modality_group, GTK_WINDOW (plug));
|
||||
g_object_unref (priv->modality_group);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_plug_parent_class)->unrealize (widget);
|
||||
@ -609,6 +630,7 @@ gtk_plug_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkPlug *plug = GTK_PLUG (widget);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
GtkWindow *window = GTK_WINDOW (widget);
|
||||
GdkWindow *gdk_window;
|
||||
GdkWindowAttr attributes;
|
||||
@ -647,8 +669,8 @@ gtk_plug_realize (GtkWidget *widget)
|
||||
attributes.window_type = GDK_WINDOW_TOPLEVEL;
|
||||
|
||||
gdk_error_trap_push ();
|
||||
if (plug->socket_window)
|
||||
gdk_window = gdk_window_new (plug->socket_window,
|
||||
if (priv->socket_window)
|
||||
gdk_window = gdk_window_new (priv->socket_window,
|
||||
&attributes, attributes_mask);
|
||||
else /* If it's a passive plug, we use the root window */
|
||||
gdk_window = gdk_window_new (gtk_widget_get_root_window (widget),
|
||||
@ -671,9 +693,9 @@ gtk_plug_realize (GtkWidget *widget)
|
||||
_gtk_plug_windowing_filter_func,
|
||||
widget);
|
||||
|
||||
plug->modality_group = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (plug->modality_group, window);
|
||||
|
||||
priv->modality_group = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (priv->modality_group, window);
|
||||
|
||||
_gtk_plug_windowing_realize_toplevel (plug);
|
||||
}
|
||||
else
|
||||
@ -867,9 +889,10 @@ add_grabbed_key (gpointer key, gpointer val, gpointer data)
|
||||
{
|
||||
GrabbedKey *grabbed_key = key;
|
||||
GtkPlug *plug = data;
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (!plug->grabbed_keys ||
|
||||
!g_hash_table_lookup (plug->grabbed_keys, grabbed_key))
|
||||
if (!priv->grabbed_keys ||
|
||||
!g_hash_table_lookup (priv->grabbed_keys, grabbed_key))
|
||||
{
|
||||
_gtk_plug_windowing_add_grabbed_key (plug,
|
||||
grabbed_key->accelerator_key,
|
||||
@ -901,8 +924,10 @@ add_grabbed_key_always (gpointer key,
|
||||
void
|
||||
_gtk_plug_add_all_grabbed_keys (GtkPlug *plug)
|
||||
{
|
||||
if (plug->grabbed_keys)
|
||||
g_hash_table_foreach (plug->grabbed_keys, add_grabbed_key_always, plug);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (priv->grabbed_keys)
|
||||
g_hash_table_foreach (priv->grabbed_keys, add_grabbed_key_always, plug);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -910,9 +935,10 @@ remove_grabbed_key (gpointer key, gpointer val, gpointer data)
|
||||
{
|
||||
GrabbedKey *grabbed_key = key;
|
||||
GtkPlug *plug = data;
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (!plug->grabbed_keys ||
|
||||
!g_hash_table_lookup (plug->grabbed_keys, grabbed_key))
|
||||
if (!priv->grabbed_keys ||
|
||||
!g_hash_table_lookup (priv->grabbed_keys, grabbed_key))
|
||||
{
|
||||
_gtk_plug_windowing_remove_grabbed_key (plug,
|
||||
grabbed_key->accelerator_key,
|
||||
@ -947,19 +973,20 @@ gtk_plug_keys_changed (GtkWindow *window)
|
||||
{
|
||||
GHashTable *new_grabbed_keys, *old_grabbed_keys;
|
||||
GtkPlug *plug = GTK_PLUG (window);
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
new_grabbed_keys = g_hash_table_new_full (grabbed_key_hash, grabbed_key_equal, (GDestroyNotify)grabbed_key_free, NULL);
|
||||
_gtk_window_keys_foreach (window, keys_foreach, new_grabbed_keys);
|
||||
|
||||
if (plug->socket_window)
|
||||
if (priv->socket_window)
|
||||
g_hash_table_foreach (new_grabbed_keys, add_grabbed_key, plug);
|
||||
|
||||
old_grabbed_keys = plug->grabbed_keys;
|
||||
plug->grabbed_keys = new_grabbed_keys;
|
||||
old_grabbed_keys = priv->grabbed_keys;
|
||||
priv->grabbed_keys = new_grabbed_keys;
|
||||
|
||||
if (old_grabbed_keys)
|
||||
{
|
||||
if (plug->socket_window)
|
||||
if (priv->socket_window)
|
||||
g_hash_table_foreach (old_grabbed_keys, remove_grabbed_key, plug);
|
||||
g_hash_table_destroy (old_grabbed_keys);
|
||||
}
|
||||
@ -1032,14 +1059,16 @@ gtk_plug_check_resize (GtkContainer *container)
|
||||
void
|
||||
_gtk_plug_handle_modality_on (GtkPlug *plug)
|
||||
{
|
||||
if (!plug->modality_window)
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (!priv->modality_window)
|
||||
{
|
||||
plug->modality_window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_screen (GTK_WINDOW (plug->modality_window),
|
||||
priv->modality_window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_screen (GTK_WINDOW (priv->modality_window),
|
||||
gtk_widget_get_screen (GTK_WIDGET (plug)));
|
||||
gtk_widget_realize (plug->modality_window);
|
||||
gtk_window_group_add_window (plug->modality_group, GTK_WINDOW (plug->modality_window));
|
||||
gtk_grab_add (plug->modality_window);
|
||||
gtk_widget_realize (priv->modality_window);
|
||||
gtk_window_group_add_window (priv->modality_group, GTK_WINDOW (priv->modality_window));
|
||||
gtk_grab_add (priv->modality_window);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1054,10 +1083,12 @@ _gtk_plug_handle_modality_on (GtkPlug *plug)
|
||||
void
|
||||
_gtk_plug_handle_modality_off (GtkPlug *plug)
|
||||
{
|
||||
if (plug->modality_window)
|
||||
GtkPlugPrivate *priv = plug->priv;
|
||||
|
||||
if (priv->modality_window)
|
||||
{
|
||||
gtk_widget_destroy (plug->modality_window);
|
||||
plug->modality_window = NULL;
|
||||
gtk_widget_destroy (priv->modality_window);
|
||||
priv->modality_window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,20 +45,16 @@ G_BEGIN_DECLS
|
||||
#define GTK_PLUG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PLUG, GtkPlugClass))
|
||||
|
||||
|
||||
typedef struct _GtkPlug GtkPlug;
|
||||
typedef struct _GtkPlugClass GtkPlugClass;
|
||||
typedef struct _GtkPlug GtkPlug;
|
||||
typedef struct _GtkPlugPrivate GtkPlugPrivate;
|
||||
typedef struct _GtkPlugClass GtkPlugClass;
|
||||
|
||||
|
||||
struct _GtkPlug
|
||||
{
|
||||
GtkWindow window;
|
||||
|
||||
GdkWindow *GSEAL (socket_window);
|
||||
GtkWidget *GSEAL (modality_window);
|
||||
GtkWindowGroup *GSEAL (modality_group);
|
||||
GHashTable *GSEAL (grabbed_keys);
|
||||
|
||||
guint GSEAL (same_app) : 1;
|
||||
GtkPlugPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkPlugClass
|
||||
|
@ -26,6 +26,18 @@
|
||||
#ifndef __GTK_PLUG_PRIVATE_H__
|
||||
#define __GTK_PLUG_PRIVATE_H__
|
||||
|
||||
struct _GtkPlugPrivate
|
||||
{
|
||||
GtkWidget *modality_window;
|
||||
GtkWindowGroup *modality_group;
|
||||
|
||||
GdkWindow *socket_window;
|
||||
|
||||
GHashTable *grabbed_keys;
|
||||
|
||||
guint same_app : 1;
|
||||
};
|
||||
|
||||
/* In gtkplug.c: */
|
||||
void _gtk_plug_send_delete_event (GtkWidget *widget);
|
||||
void _gtk_plug_add_all_grabbed_keys (GtkPlug *plug);
|
||||
|
Loading…
Reference in New Issue
Block a user