mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes. Make sure that child allocation is always >= 0 Always trigger size allocation with gtk_widget_queue_resize to prevent calling size_allocate before allocation done. gtk/gtkframe.c: Changed tests for drawability to GTK_WIDGET_DRAWABLE Always trigger size allocation with gtk_widget_queue_resize to prevent calling size_allocate before allocation done.
This commit is contained in:
parent
aedb8717f1
commit
e522ad46ba
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -1,3 +1,16 @@
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkaspectframe.c:
|
||||
Some minor improvements to rounding in aspectframes.
|
||||
Make sure that child allocation is always >= 0
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
|
||||
gtk/gtkframe.c:
|
||||
Changed tests for drawability to GTK_WIDGET_DRAWABLE
|
||||
Always trigger size allocation with gtk_widget_queue_resize
|
||||
to prevent calling size_allocate before allocation done.
|
||||
|
||||
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
|
||||
gtk-dairiki-971117-2.patch
|
||||
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
|
||||
|
@ -124,22 +124,21 @@ gtk_aspect_frame_set (GtkAspectFrame *aspect_frame,
|
||||
(aspect_frame->ratio != ratio) ||
|
||||
(aspect_frame->obey_child != obey_child))
|
||||
{
|
||||
GtkWidget * this = GTK_WIDGET(aspect_frame);
|
||||
|
||||
GtkWidget *widget = GTK_WIDGET(aspect_frame);
|
||||
|
||||
aspect_frame->xalign = xalign;
|
||||
aspect_frame->yalign = yalign;
|
||||
aspect_frame->ratio = ratio;
|
||||
aspect_frame->obey_child = obey_child;
|
||||
|
||||
if (GTK_WIDGET_MAPPED(this))
|
||||
gdk_window_clear_area (this->window,
|
||||
this->allocation.x,
|
||||
this->allocation.y,
|
||||
this->allocation.width,
|
||||
this->allocation.height);
|
||||
if (GTK_WIDGET_DRAWABLE(widget))
|
||||
gdk_window_clear_area (widget->window,
|
||||
widget->allocation.x,
|
||||
widget->allocation.y,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
gtk_widget_size_allocate (this, &this->allocation);
|
||||
gtk_widget_queue_draw (this);
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +274,7 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget,
|
||||
frame = GTK_FRAME (widget);
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (GTK_WIDGET_MAPPED (widget) &&
|
||||
if (GTK_WIDGET_DRAWABLE (widget) &&
|
||||
((widget->allocation.x != allocation->x) ||
|
||||
(widget->allocation.y != allocation->y) ||
|
||||
(widget->allocation.width != allocation->width) ||
|
||||
@ -319,14 +318,19 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget,
|
||||
GTK_CONTAINER (frame)->border_width -
|
||||
GTK_WIDGET (frame)->style->klass->ythickness);
|
||||
|
||||
if (height > width / ratio)
|
||||
/* make sure we don't allocate a negative width or height,
|
||||
* since that will be cast to a (very big) guint16 */
|
||||
width = MAX (0, width);
|
||||
height = MAX (0, height);
|
||||
|
||||
if (ratio * height > width)
|
||||
{
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = width/ratio + 0.5;
|
||||
}
|
||||
else if (width > height * ratio)
|
||||
else
|
||||
{
|
||||
child_allocation.width = ratio * height + 0.5;
|
||||
child_allocation.width = ratio*height + 0.5;
|
||||
child_allocation.height = height;
|
||||
}
|
||||
|
||||
|
@ -144,8 +144,9 @@ gtk_frame_set_label (GtkFrame *frame,
|
||||
widget->allocation.width - GTK_CONTAINER (frame)->border_width,
|
||||
widget->allocation.y + frame->label_height);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (frame));
|
||||
}
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (frame));
|
||||
}
|
||||
|
||||
void
|
||||
@ -164,7 +165,7 @@ gtk_frame_set_label_align (GtkFrame *frame,
|
||||
frame->label_xalign = xalign;
|
||||
frame->label_yalign = yalign;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (frame))
|
||||
if (GTK_WIDGET_DRAWABLE (frame))
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
@ -177,9 +178,8 @@ gtk_frame_set_label_align (GtkFrame *frame,
|
||||
widget->allocation.width - GTK_CONTAINER (frame)->border_width,
|
||||
widget->allocation.y + frame->label_height);
|
||||
|
||||
gtk_widget_size_allocate (GTK_WIDGET (frame), &(GTK_WIDGET (frame)->allocation));
|
||||
gtk_widget_queue_draw (GTK_WIDGET (frame));
|
||||
}
|
||||
gtk_widget_queue_resize (GTK_WIDGET (frame));
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,16 +194,15 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
|
||||
{
|
||||
frame->shadow_type = type;
|
||||
|
||||
if (GTK_WIDGET_MAPPED (frame))
|
||||
if (GTK_WIDGET_DRAWABLE (frame))
|
||||
{
|
||||
gdk_window_clear_area (GTK_WIDGET (frame)->window,
|
||||
GTK_WIDGET (frame)->allocation.x,
|
||||
GTK_WIDGET (frame)->allocation.y,
|
||||
GTK_WIDGET (frame)->allocation.width,
|
||||
GTK_WIDGET (frame)->allocation.height);
|
||||
gtk_widget_size_allocate (GTK_WIDGET (frame), &(GTK_WIDGET (frame)->allocation));
|
||||
gtk_widget_queue_draw (GTK_WIDGET (frame));
|
||||
}
|
||||
gtk_widget_queue_resize (GTK_WIDGET (frame));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user