Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Set a flag so instead of clearing the area in advance. That looked
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Owen Taylor authored and Owen Taylor committed Apr 13, 1998
1 parent 0dfc14a commit e6af5d4
Show file tree
Hide file tree
Showing 15 changed files with 231 additions and 30 deletions.
26 changes: 26 additions & 0 deletions ChangeLog
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions ChangeLog.pre-2-0
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions ChangeLog.pre-2-10
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions ChangeLog.pre-2-2
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions ChangeLog.pre-2-4
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions ChangeLog.pre-2-6
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions ChangeLog.pre-2-8
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions TODO
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkcontainer.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkentry.c
Expand Up @@ -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;

Expand Down
34 changes: 20 additions & 14 deletions gtk/gtklabel.c
Expand Up @@ -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, "");
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

1 change: 1 addition & 0 deletions gtk/gtklabel.h
Expand Up @@ -43,6 +43,7 @@ struct _GtkLabel
char *label;
GSList *row;
guint jtype : 2;
gint needs_clear : 1;
};

struct _GtkLabelClass
Expand Down
24 changes: 11 additions & 13 deletions gtk/gtkpreview.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions gtk/gtkwidget.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gtk/gtkwindow.c
Expand Up @@ -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)
{
Expand Down

0 comments on commit e6af5d4

Please sign in to comment.