summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2011-11-03 19:08:03 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2011-11-03 19:08:03 -0300
commit8f20c634f9f63ae866e432357eff77422c9cab8e (patch)
tree39f21ac7df3742a5aa9f565f17819c46e56ec077
parentba0345e36dfaeac72aebcf909ee83533d61c9f66 (diff)
downloadglade-8f20c634f9f63ae866e432357eff77422c9cab8e.tar.gz
Fixed bug detecting widget including margins
-rw-r--r--ChangeLog4
-rw-r--r--gladeui/glade-design-layout.c19
2 files changed, 10 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c8df6213..772bf44e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
2011-11-03 Juan Pablo Ugarte <juanpablougarte@gmail.com>
- * gladeui/glade-design-layout.c: Added workaround for child bg bug on Adwaita theme.
+ * gladeui/glade-design-layout.c:
+ o Added workaround for child bg bug on Adwaita theme.
+ o Fixed bug detecting widget including margins
* gladeui/glade-design-view.c: cleaned up glade_design_view_style_updated()
to make it use new style context instead of modifying its own.
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index 431adacc..6814d539 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -381,7 +381,7 @@ glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
case ACTIVITY_MARGINS:
{
gboolean shift = ev->state & GDK_SHIFT_MASK;
- gboolean snap = ev->state & GDK_MOD1_MASK;
+ gboolean snap = ev->state & GDK_CONTROL_MASK;
GtkWidget *selection = priv->selection;
Margins margin = priv->margin;
@@ -471,25 +471,20 @@ static void
glade_design_layout_find_inside_container (GtkWidget *widget,
GladeFindInContainerData *data)
{
- GtkAllocation allocation;
- gint x, y, l, t;
+ gint x, y, w, h;
if (data->gwidget || !gtk_widget_get_mapped (widget))
return;
gtk_widget_translate_coordinates (data->toplevel, widget, data->x, data->y,
&x, &y);
- gtk_widget_get_allocation (widget, &allocation);
-
+
/* Margins are not part of the widget allocation */
- l = gtk_widget_get_margin_left (widget);
- t = gtk_widget_get_margin_top (widget);
-
- allocation.width += gtk_widget_get_margin_right (widget) + l;
- allocation.height += gtk_widget_get_margin_bottom (widget) + t;
+ w = gtk_widget_get_allocated_width (widget) + gtk_widget_get_margin_right (widget);
+ h = gtk_widget_get_allocated_height (widget) + gtk_widget_get_margin_bottom (widget);
- if (x >= (0-l) && x < allocation.width &&
- y >= (0-t) && y < allocation.height)
+ if (x >= (0 - gtk_widget_get_margin_left (widget)) && x < w &&
+ y >= (0 - gtk_widget_get_margin_top (widget)) && y < h)
{
if (GLADE_IS_PLACEHOLDER (widget))
data->placeholder = widget;