o Use event widget and not signal widget to use with

* src/glade-widget.c:
	  o Use event widget and not signal widget to use with
	    gtk_widget_translate_coordinates(), this fixes the imfamous bug 327379
	  o Recurse through non-project objects when looking for widget at mouse event;
	    this fixes the internal widget selection bug (bug 338894).

	* src/glade-placeholder.c: Placeholders dont ever get selection anymore, its
	  only confusing for no reason, adds extra clicks to select relevent widgets
	  (note that every second click was going to the parent; making the parent
	  fight with the placeholder for selection... since its pointless, its gone).

	* TODO: Updated
This commit is contained in:
Tristan Van Berkom 2006-06-10 09:15:45 +00:00
parent d23f8ceafb
commit 82e48a4b50
6 changed files with 80 additions and 70 deletions

View File

@ -1,7 +1,21 @@
2006-06-10 Tristan Van Berkom <tvb@gnome.org>
* src/glade-fixed.c: Fixed bug that was using uninitialized data
to configure children at load time.
* src/glade-fixed.c:
o Fixed bug that was using uninitialized data to configure children at load time.
o Fixed that we were not disconnecting signals from removed children (doh)
* src/glade-widget.c:
o Use event widget and not signal widget to use with
gtk_widget_translate_coordinates(), this fixes the imfamous bug 327379
o Recurse through non-project objects when looking for widget at mouse event;
this fixes the internal widget selection bug (bug 338894).
* src/glade-placeholder.c: Placeholders dont ever get selection anymore, its
only confusing for no reason, adds extra clicks to select relevent widgets
(note that every second click was going to the parent; making the parent
fight with the placeholder for selection... since its pointless, its gone).
* TODO: Updated
2006-06-09 Tristan Van Berkom <tvb@gnome.org>

3
TODO
View File

@ -5,9 +5,6 @@ Tasks/Bugs Blocking glade-3 3.0:
o Toolbar editor / Popup menu editor (toolbar support now in... needs editor)
o Unify multiple property changes & dont unify default settings (bug 315600)
o Properties/undo stack glitches (bug 316900)
o Selection bug with some widgets (properly streamlining events
on widgets in the glade runtime environment) (bug 327379)
- Internal widget selection bug (bug 338894)
o View menu should be removed and deleted (bug 336576)
o Gnome stock items not recognized by glade-3 (bug 343712)
o Should indicate read-only projects (bug 337957)

View File

@ -589,6 +589,19 @@ glade_fixed_add_child_impl (GladeWidget *gwidget_fixed,
return;
}
static void
glade_fixed_remove_child_impl (GladeWidget *fixed,
GladeWidget *child,
gboolean at_mouse)
{
glade_fixed_disconnect_child (GLADE_FIXED (fixed), child);
/* Chain up for the basic unparenting */
GLADE_WIDGET_KLASS (parent_class)->remove_child
(GLADE_WIDGET (fixed), child);
}
static gboolean
glade_fixed_popup_menu (GtkWidget *widget, gpointer unused_data)
{
@ -640,12 +653,13 @@ glade_fixed_event (GtkWidget *widget,
if (GLADE_WIDGET_KLASS (parent_class)->event (widget, event, gwidget_fixed))
return TRUE;
gdk_window_get_user_data (((GdkEventAny *)event)->window, (gpointer)&event_widget);
g_assert (GTK_IS_WIDGET (event_widget));
glade_fixed_widget = glade_widget_get_from_gobject (widget);
/* carefull to use the event widget and not the signal widget
* to feed to retrieve_from_position
*/
gdk_event_get_coords (event, &x, &y);
gdk_window_get_user_data (((GdkEventAny *)event)->window, (gpointer)&event_widget);
gwidget =
GLADE_WIDGET_GET_KLASS (fixed)->retrieve_from_position
(event_widget, (int) (x + 0.5), (int) (y + 0.5));
@ -858,6 +872,7 @@ glade_fixed_class_init (GladeFixedClass *fixed_class)
gwidget_class->setup_events = glade_fixed_setup_events;
gwidget_class->event = glade_fixed_event;
gwidget_class->add_child = glade_fixed_add_child_impl;
gwidget_class->remove_child = glade_fixed_remove_child_impl;
fixed_class->configure_child = glade_fixed_configure_child_impl;
fixed_class->configure_begin = NULL;

View File

@ -420,17 +420,12 @@ glade_gtk_box_set_size (GObject *object, GValue *value)
GtkBox *box;
GList *child;
guint new_size, old_size, i;
GladeWidget *gbox = glade_widget_get_from_gobject (object);
box = GTK_BOX (object);
g_return_if_fail (GTK_IS_BOX (box));
old_size = g_list_length (box->children);
new_size = g_value_get_int (value);
if (gbox->internal)
g_print ("Setting internal widget %s size to %d\n",
gbox->name, new_size);
if (old_size == new_size)
return;
@ -503,11 +498,6 @@ glade_gtk_box_add_child (GObject *object, GObject *child)
gbox = glade_widget_get_from_gobject (object);
project = glade_widget_get_project (gbox);
if (gbox->internal)
g_print ("Adding %s to internal widget %s\n",
GLADE_IS_PLACEHOLDER (child) ? "placeholder" : "child",
gbox->name);
/*
Try to remove the last placeholder if any, this way GtkBox`s size
will not be changed.

View File

@ -338,34 +338,6 @@ glade_placeholder_button_press (GtkWidget *widget, GdkEventButton *event)
handled = TRUE;
}
else if (glade_util_has_selection (widget) == FALSE ||
g_list_length (glade_util_get_selection ()) != 1)
{
GladeWidget *gwidget;
GladeWidget *parent;
if ((gwidget = glade_widget_get_from_gobject (widget)) != NULL)
parent = gwidget->parent;
else
parent = glade_placeholder_get_parent (widget);
while (parent && GLADE_IS_FIXED (parent) == FALSE)
parent = parent->parent;
/* Dont select placeholders that are deep children
* of GladeFixed containers.
*/
if (parent == NULL)
{
glade_project_selection_clear
(glade_app_get_project (),
TRUE);
glade_util_clear_selection ();
glade_util_add_selection (widget);
handled = TRUE;
}
}
}
else if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
{

View File

@ -240,8 +240,28 @@ glade_widget_find_inside_container (GtkWidget *widget, GladeFindInContainerData
gtk_widget_translate_coordinates (data->toplevel, widget, data->x, data->y, &x, &y);
if (x >= 0 && x < widget->allocation.width && y >= 0 && y < widget->allocation.height &&
(glade_widget_get_from_gobject (widget)) && GTK_WIDGET_MAPPED(widget))
data->found = widget;
GTK_WIDGET_MAPPED(widget))
{
if (glade_widget_get_from_gobject (widget))
data->found = widget;
else if (GTK_IS_CONTAINER (widget))
{
/* Recurse and see if any project objects exist
* under this container that is not in the project
* (mostly for dialog buttons).
*/
GladeFindInContainerData search;
search.x = data->x;
search.y = data->y;
search.toplevel = data->toplevel;
search.found = NULL;
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback)
glade_widget_find_inside_container, &search);
data->found = search.found;
}
}
}
static GladeWidget *
@ -250,6 +270,7 @@ glade_widget_find_deepest_child_at_position (GtkContainer *toplevel,
int top_x, int top_y)
{
GladeFindInContainerData data;
data.x = top_x;
data.y = top_y;
data.toplevel = GTK_WIDGET (toplevel);
@ -301,19 +322,22 @@ glade_widget_button_press (GtkWidget *widget,
GladeWidget *gwidget)
{
GladeWidget *glade_widget;
GtkWidget *event_widget;
gint x = (gint) (event->x + 0.5);
gint y = (gint) (event->y + 0.5);
gboolean handled = FALSE;
glade_widget =
GLADE_WIDGET_GET_KLASS
(gwidget)->retrieve_from_position (widget, x, y);
if (glade_widget == NULL) return FALSE;
widget = GTK_WIDGET (glade_widget_get_object (glade_widget));
/* Carefull to use the event widget and not the signal widget
* to feed to retrieve_from_position
*/
gdk_window_get_user_data (event->window, (gpointer)&event_widget);
if ((glade_widget =
GLADE_WIDGET_GET_KLASS
(gwidget)->retrieve_from_position (event_widget, x, y)) == NULL)
return FALSE;
/* make sure to grab focus, since we may stop default handlers */
widget = GTK_WIDGET (glade_widget_get_object (glade_widget));
if (GTK_WIDGET_CAN_FOCUS (widget) && !GTK_WIDGET_HAS_FOCUS (widget))
gtk_widget_grab_focus (widget);
@ -2730,21 +2754,19 @@ glade_widget_set_object (GladeWidget *gwidget, GObject *new_object)
gwidget->object = g_object_ref (G_OBJECT(new_object));
g_object_set_data (G_OBJECT (new_object), "GladeWidgetDataTag", gwidget);
if (gwidget->internal == NULL)
if (/* gwidget->internal == NULL && */
g_type_is_a (gwidget->widget_class->type, GTK_TYPE_WIDGET))
{
if (g_type_is_a (gwidget->widget_class->type, GTK_TYPE_WIDGET))
{
/* Take care of events and toolkit signals.
*/
GLADE_WIDGET_GET_KLASS (gwidget)->setup_events
(gwidget, GTK_WIDGET (new_object));
glade_widget_connect_signal_handlers
(GTK_WIDGET(new_object),
G_CALLBACK
(GLADE_WIDGET_GET_KLASS (gwidget)->event),
gwidget);
}
/* Take care of events and toolkit signals.
*/
GLADE_WIDGET_GET_KLASS (gwidget)->setup_events
(gwidget, GTK_WIDGET (new_object));
glade_widget_connect_signal_handlers
(GTK_WIDGET(new_object),
G_CALLBACK
(GLADE_WIDGET_GET_KLASS (gwidget)->event),
gwidget);
}