mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
eventbox: Remove visible-window property
The GdkWindow that was supposed to back it is gone.
This commit is contained in:
parent
5e7894feb9
commit
b71f644cf5
@ -1038,8 +1038,6 @@ GtkEventBoxClass
|
||||
gtk_event_box_new
|
||||
gtk_event_box_set_above_child
|
||||
gtk_event_box_get_above_child
|
||||
gtk_event_box_set_visible_window
|
||||
gtk_event_box_get_visible_window
|
||||
<SUBSECTION Standard>
|
||||
GTK_EVENT_BOX
|
||||
GTK_IS_EVENT_BOX
|
||||
|
@ -52,7 +52,6 @@ struct _GtkEventBoxPrivate
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_VISIBLE_WINDOW,
|
||||
PROP_ABOVE_CHILD
|
||||
};
|
||||
|
||||
@ -90,13 +89,6 @@ gtk_event_box_class_init (GtkEventBoxClass *class)
|
||||
widget_class->unmap = gtk_event_box_unmap;
|
||||
widget_class->size_allocate = gtk_event_box_size_allocate;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VISIBLE_WINDOW,
|
||||
g_param_spec_boolean ("visible-window",
|
||||
P_("Visible Window"),
|
||||
P_("Whether the event box is visible, as opposed to invisible and only used to trap events."),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ABOVE_CHILD,
|
||||
g_param_spec_boolean ("above-child",
|
||||
@ -140,10 +132,6 @@ gtk_event_box_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_VISIBLE_WINDOW:
|
||||
gtk_event_box_set_visible_window (event_box, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_ABOVE_CHILD:
|
||||
gtk_event_box_set_above_child (event_box, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -166,10 +154,6 @@ gtk_event_box_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_VISIBLE_WINDOW:
|
||||
g_value_set_boolean (value, gtk_event_box_get_visible_window (event_box));
|
||||
break;
|
||||
|
||||
case PROP_ABOVE_CHILD:
|
||||
g_value_set_boolean (value, gtk_event_box_get_above_child (event_box));
|
||||
break;
|
||||
@ -180,108 +164,6 @@ gtk_event_box_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_event_box_get_visible_window:
|
||||
* @event_box: a #GtkEventBox
|
||||
*
|
||||
* Returns whether the event box has a visible window.
|
||||
* See gtk_event_box_set_visible_window() for details.
|
||||
*
|
||||
* Returns: %TRUE if the event box window is visible
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
gboolean
|
||||
gtk_event_box_get_visible_window (GtkEventBox *event_box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_EVENT_BOX (event_box), FALSE);
|
||||
|
||||
return gtk_widget_get_has_window (GTK_WIDGET (event_box));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_event_box_set_visible_window:
|
||||
* @event_box: a #GtkEventBox
|
||||
* @visible_window: %TRUE to make the event box have a visible window
|
||||
*
|
||||
* Set whether the event box uses a visible or invisible child
|
||||
* window. The default is to use visible windows.
|
||||
*
|
||||
* In an invisible window event box, the window that the
|
||||
* event box creates is a %GDK_INPUT_ONLY window, which
|
||||
* means that it is invisible and only serves to receive
|
||||
* events.
|
||||
*
|
||||
* A visible window event box creates a visible (%GDK_INPUT_OUTPUT)
|
||||
* window that acts as the parent window for all the widgets
|
||||
* contained in the event box.
|
||||
*
|
||||
* You should generally make your event box invisible if
|
||||
* you just want to trap events. Creating a visible window
|
||||
* may cause artifacts that are visible to the user, especially
|
||||
* if the user is using a theme with gradients or pixmaps.
|
||||
*
|
||||
* The main reason to create a non input-only event box is if
|
||||
* you want to set the background to a different color or
|
||||
* draw on it.
|
||||
*
|
||||
* There is one unexpected issue for an invisible event box that has its
|
||||
* window below the child. (See gtk_event_box_set_above_child().)
|
||||
* Since the input-only window is not an ancestor window of any windows
|
||||
* that descendent widgets of the event box create, events on these
|
||||
* windows aren’t propagated up by the windowing system, but only by GTK+.
|
||||
* The practical effect of this is if an event isn’t in the event
|
||||
* mask for the descendant window (see gtk_widget_add_events()),
|
||||
* it won’t be received by the event box.
|
||||
*
|
||||
* This problem doesn’t occur for visible event boxes, because in
|
||||
* that case, the event box window is actually the ancestor of the
|
||||
* descendant windows, not just at the same place on the screen.
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
void
|
||||
gtk_event_box_set_visible_window (GtkEventBox *event_box,
|
||||
gboolean visible_window)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (GTK_IS_EVENT_BOX (event_box));
|
||||
|
||||
widget = GTK_WIDGET (event_box);
|
||||
|
||||
visible_window = visible_window != FALSE;
|
||||
|
||||
if (visible_window != gtk_widget_get_has_window (widget))
|
||||
{
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
gboolean visible = gtk_widget_get_visible (widget);
|
||||
|
||||
if (visible)
|
||||
gtk_widget_hide (widget);
|
||||
|
||||
gtk_widget_unrealize (widget);
|
||||
|
||||
gtk_widget_set_has_window (widget, visible_window);
|
||||
|
||||
gtk_widget_realize (widget);
|
||||
|
||||
if (visible)
|
||||
gtk_widget_show (widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_has_window (widget, visible_window);
|
||||
}
|
||||
|
||||
if (gtk_widget_get_visible (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
|
||||
g_object_notify (G_OBJECT (event_box), "visible-window");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_event_box_get_above_child:
|
||||
* @event_box: a #GtkEventBox
|
||||
|
@ -76,11 +76,6 @@ GType gtk_event_box_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_event_box_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_event_box_get_visible_window (GtkEventBox *event_box);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_event_box_set_visible_window (GtkEventBox *event_box,
|
||||
gboolean visible_window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_event_box_get_above_child (GtkEventBox *event_box);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_event_box_set_above_child (GtkEventBox *event_box,
|
||||
|
@ -283,7 +283,6 @@ _gtk_text_handle_ensure_widget (GtkTextHandle *handle,
|
||||
GtkStyleContext *context;
|
||||
|
||||
widget = gtk_event_box_new ();
|
||||
gtk_event_box_set_visible_window (GTK_EVENT_BOX (widget), TRUE);
|
||||
|
||||
gtk_widget_set_direction (widget, priv->windows[pos].dir);
|
||||
|
||||
|
@ -3262,14 +3262,6 @@ event_box_button_clicked (GtkWidget *widget,
|
||||
g_print ("pushed button\n");
|
||||
}
|
||||
|
||||
static void
|
||||
event_box_toggle_visible_window (GtkWidget *checkbutton,
|
||||
GtkEventBox *event_box)
|
||||
{
|
||||
gtk_event_box_set_visible_window (event_box,
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)));
|
||||
}
|
||||
|
||||
static void
|
||||
event_box_toggle_above_child (GtkWidget *checkbutton,
|
||||
GtkEventBox *event_box)
|
||||
@ -3290,7 +3282,6 @@ create_event_box (GtkWidget *widget)
|
||||
GtkWidget *separator;
|
||||
GtkWidget *event_box;
|
||||
GtkWidget *label;
|
||||
GtkWidget *visible_window_check;
|
||||
GtkWidget *above_child_check;
|
||||
|
||||
if (!window)
|
||||
@ -3332,13 +3323,6 @@ create_event_box (GtkWidget *widget)
|
||||
G_CALLBACK (event_box_button_clicked),
|
||||
NULL);
|
||||
|
||||
|
||||
visible_window_check = gtk_check_button_new_with_label("Visible Window");
|
||||
gtk_box_pack_start (GTK_BOX (box1), visible_window_check);
|
||||
g_signal_connect (visible_window_check, "toggled",
|
||||
G_CALLBACK (event_box_toggle_visible_window), event_box);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (visible_window_check), TRUE);
|
||||
|
||||
above_child_check = gtk_check_button_new_with_label("Above Child");
|
||||
gtk_box_pack_start (GTK_BOX (box1), above_child_check);
|
||||
g_signal_connect (above_child_check, "toggled",
|
||||
|
Loading…
Reference in New Issue
Block a user