Make a NO_WINDOW widget, as it should have been since the beginning, but

Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
	have been since the beginning, but as special hack,
	allow clearing the NO_WINDOW flag to get a window widget.
This commit is contained in:
Owen Taylor 2001-11-18 23:33:21 +00:00 committed by Owen Taylor
parent 3828d02568
commit 3432dff2e0
9 changed files with 94 additions and 28 deletions

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -1,3 +1,9 @@
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.
Sun Nov 18 22:01:36 Kristian Rietveld <kristian@planet.nl>
* gtk/gtktreestore.c: return TRUE when value changed, so

View File

@ -528,7 +528,15 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
you must make sure you call gtk_container_propagate_expose()
correctly, as you must for any NO_WINDOW widgets.
GtkFixed is a little special; it is now created by default as
a NO_WINDOW widget, but if you do
GTK_WIDGET_UNSET_FLAGS (fixed, GTK_WIDGET_NO_WINDOW)
after creating a fixed widget, it will create a window and
handle it properly.
* GtkLayout no longer has the xoffset, yoffset fields, which used
to store the difference between world and window coordinates for
layout->bin_window. These coordinate systems are now always
the same.
the same.

View File

@ -144,7 +144,7 @@ gtk_fixed_child_type (GtkContainer *container)
static void
gtk_fixed_init (GtkFixed *fixed)
{
GTK_WIDGET_UNSET_FLAGS (fixed, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (fixed, GTK_NO_WINDOW);
fixed->children = NULL;
}
@ -311,27 +311,32 @@ gtk_fixed_realize (GtkWidget *widget)
g_return_if_fail (GTK_IS_FIXED (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
if (GTK_WIDGET_NO_WINDOW (widget))
GTK_WIDGET_CLASS (parent_class)->realize (widget);
else
{
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
attributes_mask);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
attributes_mask);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
}
static void
@ -390,13 +395,17 @@ gtk_fixed_size_allocate (GtkWidget *widget,
fixed = GTK_FIXED (widget);
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
if (!GTK_WIDGET_NO_WINDOW (widget))
{
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
}
border_width = GTK_CONTAINER (fixed)->border_width;
children = fixed->children;
@ -410,6 +419,13 @@ gtk_fixed_size_allocate (GtkWidget *widget,
gtk_widget_get_child_requisition (child->widget, &child_requisition);
child_allocation.x = child->x + border_width;
child_allocation.y = child->y + border_width;
if (GTK_WIDGET_NO_WINDOW (widget))
{
child_allocation.x += widget->allocation.x;
child_allocation.y += widget->allocation.y;
}
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation);