[gtk+] button: Don't include margins in input window size
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] button: Don't include margins in input window size
- Date: Tue, 12 Jan 2016 20:57:59 +0000 (UTC)
commit 788ee466b8874d940a0f0122f870ecbdcb2602d3
Author: Timm Bäder <mail baedert org>
Date: Tue Jan 12 20:18:08 2016 +0100
button: Don't include margins in input window size
And do the same thing for GtkCheckButton
https://bugzilla.gnome.org/show_bug.cgi?id=760509
gtk/gtkbutton.c | 19 +++++++++++--------
gtk/gtkcheckbutton.c | 19 +++++++++++--------
2 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 697d7e2..56452bb 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1760,14 +1760,6 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkAllocation clip;
gtk_widget_set_allocation (widget, allocation);
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (priv->event_window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
-
gtk_css_gadget_allocate (priv->gadget,
allocation,
gtk_widget_get_allocated_baseline (widget),
@@ -1792,6 +1784,17 @@ gtk_button_allocate (GtkCssGadget *gadget,
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate_with_baseline (child, (GtkAllocation *)allocation, baseline);
+ if (gtk_widget_get_realized (widget))
+ {
+ GtkAllocation border_allocation;
+ gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
+ gdk_window_move_resize (GTK_BUTTON (widget)->priv->event_window,
+ border_allocation.x,
+ border_allocation.y,
+ border_allocation.width,
+ border_allocation.height);
+ }
+
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
}
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 4db33a6..42b0d70 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -643,14 +643,6 @@ gtk_check_button_size_allocate (GtkWidget *widget,
gadget = GTK_BUTTON (widget)->priv->gadget;
gtk_widget_set_allocation (widget, allocation);
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (GTK_BUTTON (widget)->priv->event_window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
-
gtk_css_gadget_allocate (gadget,
allocation,
gtk_widget_get_allocated_baseline (widget),
@@ -732,6 +724,17 @@ gtk_check_button_allocate (GtkCssGadget *gadget,
(pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
pango_font_metrics_unref (metrics);
+ if (gtk_widget_get_realized (widget))
+ {
+ GtkAllocation border_allocation;
+ gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
+ gdk_window_move_resize (GTK_BUTTON (widget)->priv->event_window,
+ border_allocation.x,
+ border_allocation.y,
+ border_allocation.width,
+ border_allocation.height);
+ }
+
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
gdk_rectangle_union (out_clip, &check_clip, out_clip);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]