Set a flag so instead of clearing the area in advance. That looked

Sun Apr 12 20:09:40 1998  Owen Taylor  <owt1@cornell.edu>

	* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
	instead of clearing the area in advance. That looked
	_really_ bad.

	* gtk/gtkcontainer.c (gtk_container_class_init): Changed
	"focus" to RUN_LAST.

	* gtk/gtkentry.c (gtk_entry_realize): Fixed place
	where allocation was used where requisition was meant.
	(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)

	* gtk/gtkwindow.c (gtk_window_set_default): Fixed
	assertion in when setting default to NULL>
	("Damon Chaplin" <DAChaplin@email.msn.com>)

	* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
	default widget on the toplevel, if necessary.

Sun Apr 12 02:04:21 1998  Owen Taylor  <owt1@cornell.edu>

	* gtk/gtkpreview.c: Removed unecessary and harmful
	htons/ntohs when storing properties. (X does the byte
	swapping itself)
This commit is contained in:
Owen Taylor 1998-04-13 00:20:17 +00:00 committed by Owen Taylor
parent 0dfc14aa8b
commit e6af5d49ae
15 changed files with 231 additions and 30 deletions

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

View File

@ -1,3 +1,29 @@
Sun Apr 12 20:09:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so
instead of clearing the area in advance. That looked
_really_ bad.
* gtk/gtkcontainer.c (gtk_container_class_init): Changed
"focus" to RUN_LAST.
* gtk/gtkentry.c (gtk_entry_realize): Fixed place
where allocation was used where requisition was meant.
(Found by David J N Begley <david@avarice.nepean.uws.edu.au>)
* gtk/gtkwindow.c (gtk_window_set_default): Fixed
assertion in when setting default to NULL>
("Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkwidget.c (gtk_widget_unparent): Unset the
default widget on the toplevel, if necessary.
Sun Apr 12 02:04:21 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpreview.c: Removed unecessary and harmful
htons/ntohs when storing properties. (X does the byte
swapping itself)
Sat Apr 11 02:01:31 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c (scroll_down): Removed incorrect part of

5
TODO
View File

@ -197,6 +197,11 @@ Additions:
* Scrolled windows need to be smarter about when they size-request/allocate
their children.
* Should all the default handlers really return FALSE? This can
cause confusing presses to be sent to containers that actually
want to get events on themselves.
Text/Edit widget:
Bugs:

View File

@ -181,7 +181,7 @@ gtk_container_class_init (GtkContainerClass *class)
GTK_TYPE_C_CALLBACK);
container_signals[FOCUS] =
gtk_signal_new ("focus",
GTK_RUN_FIRST,
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkContainerClass, focus),
gtk_container_marshal_signal_3,

View File

@ -462,7 +462,7 @@ gtk_entry_realize (GtkWidget *widget)
attributes.x = widget->style->klass->xthickness + INNER_BORDER;
attributes.y = widget->style->klass->ythickness + INNER_BORDER;
attributes.width = widget->allocation.width - attributes.x * 2;
attributes.height = widget->allocation.height - attributes.y * 2;
attributes.height = widget->requisition.height - attributes.y * 2;
attributes.cursor = entry->cursor = gdk_cursor_new (GDK_XTERM);
attributes_mask |= GDK_WA_CURSOR;

View File

@ -139,6 +139,7 @@ gtk_label_init (GtkLabel *label)
label->label = NULL;
label->row = NULL;
label->jtype = GTK_JUSTIFY_CENTER;
label->needs_clear = 0;
gtk_label_set (label, "");
}
@ -311,6 +312,23 @@ gtk_label_expose (GtkWidget *widget,
gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area);
gdk_gc_set_clip_rectangle (widget->style->fg_gc[state], &event->area);
/* We clear the whole allocation here so that if a partial
* expose is triggered we don't just clear part and mess up
* when the queued redraw comes along. (There will always
* be a complete queued redraw when the needs_clear flag
* is set.)
*/
if (label->needs_clear)
{
gdk_window_clear_area (widget->window,
widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
label->needs_clear = FALSE;
}
x = widget->allocation.x + misc->xpad +
(widget->allocation.width - widget->requisition.width)
* misc->xalign + 0.5;
@ -377,25 +395,13 @@ static void
gtk_label_state_changed (GtkWidget *widget,
guint previous_state)
{
if (GTK_WIDGET_NO_WINDOW (widget) &&
GTK_WIDGET_DRAWABLE (widget))
gdk_window_clear_area (widget->window,
widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
GTK_LABEL (widget)->needs_clear = 1;
}
static void
gtk_label_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
if (GTK_WIDGET_NO_WINDOW (widget) &&
GTK_WIDGET_DRAWABLE (widget))
gdk_window_clear_area (widget->window,
widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
GTK_LABEL (widget)->needs_clear = 1;
}

View File

@ -43,6 +43,7 @@ struct _GtkLabel
char *label;
GSList *row;
guint jtype : 2;
gint needs_clear : 1;
};
struct _GtkLabelClass

View File

@ -20,7 +20,6 @@
#include <string.h>
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include "gdk/gdkx.h"
#include "gtkpreview.h"
#include "gtksignal.h"
@ -304,14 +303,13 @@ gtk_preview_uninit ()
0, sizeof (GtkPreviewProp), FALSE,
NULL, NULL, NULL, (guchar**) &prop))
{
prop->ref_count = ntohs (prop->ref_count) - 1;
prop->ref_count = prop->ref_count - 1;
if (prop->ref_count == 0)
{
gdk_property_delete (NULL, property);
}
else
{
prop->ref_count = htons (prop->ref_count);
gdk_property_change (NULL, property, property, 16,
GDK_PROP_MODE_REPLACE,
(guchar*) prop, 5);
@ -1508,12 +1506,12 @@ gtk_get_preview_prop (guint *nred,
0, sizeof (GtkPreviewProp), FALSE,
NULL, NULL, NULL, (guchar**) &prop))
{
*nred = ntohs (prop->nred_shades);
*ngreen = ntohs (prop->ngreen_shades);
*nblue = ntohs (prop->nblue_shades);
*ngray = ntohs (prop->ngray_shades);
*nred = prop->nred_shades;
*ngreen = prop->ngreen_shades;
*nblue = prop->nblue_shades;
*ngray = prop->ngray_shades;
prop->ref_count = htons (ntohs (prop->ref_count) + 1);
prop->ref_count = prop->ref_count + 1;
gdk_property_change (NULL, property, property, 16,
GDK_PROP_MODE_REPLACE,
(guchar*) prop, 5);
@ -1535,11 +1533,11 @@ gtk_set_preview_prop (guint nred,
property = gdk_atom_intern ("GTK_PREVIEW_INFO", FALSE);
prop.ref_count = htons (1);
prop.nred_shades = htons (nred);
prop.ngreen_shades = htons (ngreen);
prop.nblue_shades = htons (nblue);
prop.ngray_shades = htons (ngray);
prop.ref_count = 1;
prop.nred_shades = nred;
prop.ngreen_shades = ngreen;
prop.nblue_shades = nblue;
prop.ngray_shades = ngray;
gdk_property_change (NULL, property, property, 16,
GDK_PROP_MODE_REPLACE,

View File

@ -1148,6 +1148,15 @@ gtk_widget_unparent (GtkWidget *widget)
if (child == widget)
gtk_window_set_focus (GTK_WINDOW (toplevel), NULL);
child = GTK_WINDOW (toplevel)->default_widget;
while (child && child != widget)
child = child->parent;
if (child == widget)
gtk_window_set_default (GTK_WINDOW (toplevel), NULL);
}
/* Remove the widget and all its children from toplevel->resize_widgets

View File

@ -353,7 +353,7 @@ gtk_window_set_default (GtkWindow *window,
{
g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GTK_WIDGET_CAN_DEFAULT (defaultw));
g_return_if_fail ((defaultw == NULL) || GTK_WIDGET_CAN_DEFAULT (defaultw));
if (window->default_widget != defaultw)
{