Commit c7067041 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

First try to make GladeDesignLayout use a GdkOffscreen to render its child...

First try to make GladeDesignLayout use a GdkOffscreen to render its child instead of acutally packing it
parent 070c4934
......@@ -672,23 +672,12 @@ glade_app_config_save ()
void
glade_app_set_transient_parent (GtkWindow *parent)
{
GList *projects, *objects;
GladeApp *app;
g_return_if_fail (GTK_IS_WINDOW (parent));
app = glade_app_get ();
app->priv->transient_parent = parent;
/* Loop over all projects/widgets and set_transient_for the toplevels.
*/
for (projects = glade_app_get_projects (); /* projects */
projects; projects = projects->next)
for (objects = (GList *) glade_project_get_objects (GLADE_PROJECT (projects->data)); /* widgets */
objects; objects = objects->next)
if (GTK_IS_WINDOW (objects->data))
gtk_window_set_transient_for
(GTK_WINDOW (objects->data), parent);
}
GtkWindow *
......@@ -1004,7 +993,8 @@ glade_app_add_project (GladeProject *project)
{
GObject *obj = G_OBJECT (node->data);
if (GTK_IS_WINDOW (obj))
if (GTK_IS_WIDGET (obj) &&
gtk_widget_get_has_window (GTK_WIDGET (obj)))
{
glade_project_selection_set (project, obj, TRUE);
glade_widget_show (glade_widget_get_from_gobject (obj));
......
......@@ -997,7 +997,7 @@ glade_command_add (GList *widgets,
* fix the bugs as they pop up.
*/
widget = GLADE_WIDGET (widgets->data);
if (placeholder && GTK_IS_WINDOW (widget->object) == FALSE)
if (placeholder && GWA_IS_TOPLEVEL (widget->adaptor) == FALSE)
me->project = glade_placeholder_get_project (placeholder);
else
me->project = glade_app_get_project();
......@@ -1023,9 +1023,9 @@ glade_command_add (GList *widgets,
/* Parent */
if (parent == NULL)
cdata->parent = glade_widget_get_parent (widget);
else if (placeholder && GTK_IS_WINDOW (widget->object) == FALSE)
else if (placeholder && GWA_IS_TOPLEVEL (widget->adaptor) == FALSE)
cdata->parent = glade_placeholder_get_parent (placeholder);
else if (GTK_IS_WINDOW (widget->object) == FALSE)
else if (GWA_IS_TOPLEVEL (widget->adaptor) == FALSE)
cdata->parent = parent;
/* Placeholder */
......@@ -1896,9 +1896,9 @@ glade_command_paste(GList *widgets, GladeWidget *parent, GladePlaceholder *place
g_return_if_fail (widgets != NULL);
/* if (placeholder && GTK_IS_WINDOW (widget->object) == FALSE) */
/* if (placeholder && GWA_IS_TOPLEVEL (widget->adaptor) == FALSE) */
/* target_project = glade_placeholder_get_project (placeholder); */
/* else if (parent && GTK_IS_WINDOW (widget->object) == FALSE) */
/* else if (parent && GWA_IS_TOPLEVEL (widget->adaptor) == FALSE) */
/* target_project = glade_widget_get_project (parent); */
/* else */
/* target_project = glade_app_get_project(); */
......@@ -2439,7 +2439,7 @@ find_format_rejected_object (GObject *object, gpointer fmtptr)
/* ... and widget is a non GtkWidget object */
!GTK_IS_WIDGET (widget->object) ||
/* ... and its a non-window toplevel */
(!widget->parent && !GTK_IS_WINDOW (widget->object) && !widget->internal))))
(!widget->parent && g_strcmp0 (widget->adaptor->name, "GtkWindow") && !widget->internal))))
return 0;
return -1;
......
......@@ -75,7 +75,8 @@ set_cursor (GdkCursor *gdk_cursor)
{
GObject *object = list->data;
if (GTK_IS_WINDOW (object))
if (GTK_IS_WIDGET (object) &&
gtk_widget_get_has_window (GTK_WIDGET (object)))
{
set_cursor_recurse (GTK_WIDGET (object), gdk_cursor);
}
......
......@@ -66,8 +66,6 @@ enum
struct _GladeDesignLayoutPrivate
{
GdkWindow *event_window;
GdkCursor *cursor_resize_bottom;
GdkCursor *cursor_resize_right;
GdkCursor *cursor_resize_bottom_right;
......@@ -83,7 +81,7 @@ struct _GladeDesignLayoutPrivate
static guint glade_design_layout_signals[LAST_SIGNAL] = {0};
G_DEFINE_TYPE (GladeDesignLayout, glade_design_layout, GTK_TYPE_BIN)
G_DEFINE_TYPE (GladeDesignLayout, glade_design_layout, GTK_TYPE_EVENT_BOX)
static PointerRegion
glade_design_layout_get_pointer_region (GladeDesignLayout *layout, gint x, gint y)
......@@ -94,7 +92,7 @@ glade_design_layout_get_pointer_region (GladeDesignLayout *layout, gint x, gint
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (layout);
gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN (layout)), &child_allocation);
gtk_widget_get_allocation (layout->child, &child_allocation);
if ((x >= (child_allocation.x + child_allocation.width)) &&
(x < (child_allocation.x + child_allocation.width + OUTLINE_WIDTH)))
......@@ -186,13 +184,13 @@ glade_design_layout_leave_notify_event (GtkWidget *widget, GdkEventCrossing *ev)
GtkWidget *child;
GladeDesignLayoutPrivate *priv;
if ((child = gtk_bin_get_child (GTK_BIN (widget))) == NULL)
if ((child = GLADE_DESIGN_LAYOUT (widget)->child) == NULL)
return FALSE;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
if (priv->activity == ACTIVITY_NONE)
gdk_window_set_cursor (priv->event_window, NULL);
gdk_window_set_cursor (widget->window, NULL);
return FALSE;
}
......@@ -217,6 +215,7 @@ glade_design_layout_update_child (GladeDesignLayout *layout,
gtk_widget_size_allocate (child, allocation);
gtk_widget_queue_resize (GTK_WIDGET (layout));
// gtk_window_resize (GTK_WINDOW (child), allocation->width, allocation->height);
}
......@@ -341,12 +340,12 @@ glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
gint x, y;
gint new_width, new_height;
if ((child = gtk_bin_get_child (GTK_BIN (widget))) == NULL)
if ((child = GLADE_DESIGN_LAYOUT (widget)->child) == NULL)
return FALSE;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
gdk_window_get_pointer (priv->event_window, &x, &y, NULL);
gdk_window_get_pointer (widget->window, &x, &y, NULL);
child_glade_widget = glade_widget_get_from_gobject (child);
gtk_widget_get_allocation (child, &allocation);
......@@ -397,18 +396,18 @@ glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
region = glade_design_layout_get_pointer_region (GLADE_DESIGN_LAYOUT (widget), x, y);
if (region == REGION_EAST)
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_right);
gdk_window_set_cursor (widget->window, priv->cursor_resize_right);
else if (region == REGION_SOUTH)
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_bottom);
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom);
else if (region == REGION_SOUTH_EAST ||
region == REGION_WEST_OF_SOUTH_EAST ||
region == REGION_NORTH_OF_SOUTH_EAST)
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_bottom_right);
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
else if (region == REGION_OUTSIDE)
gdk_window_set_cursor (priv->event_window, NULL);
gdk_window_set_cursor (widget->window, NULL);
}
return FALSE;
......@@ -423,12 +422,12 @@ glade_design_layout_button_press_event (GtkWidget *widget, GdkEventButton *ev)
GladeDesignLayoutPrivate *priv;
gint x, y;
if ((child = gtk_bin_get_child (GTK_BIN (widget))) == NULL)
if ((child = GLADE_DESIGN_LAYOUT (widget)->child) == NULL)
return FALSE;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
gdk_window_get_pointer (priv->event_window, &x, &y, NULL);
gdk_window_get_pointer (widget->window, &x, &y, NULL);
region = glade_design_layout_get_pointer_region (GLADE_DESIGN_LAYOUT (widget), x, y);
if (((GdkEventButton *) ev)->button == 1)
......@@ -440,27 +439,27 @@ glade_design_layout_button_press_event (GtkWidget *widget, GdkEventButton *ev)
if (region == REGION_EAST)
{
priv->activity = ACTIVITY_RESIZE_WIDTH;
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_right);
gdk_window_set_cursor (widget->window, priv->cursor_resize_right);
}
if (region == REGION_SOUTH)
{
priv->activity = ACTIVITY_RESIZE_HEIGHT;
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_bottom);
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom);
}
if (region == REGION_SOUTH_EAST)
{
priv->activity = ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_bottom_right);
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
if (region == REGION_WEST_OF_SOUTH_EAST)
{
priv->activity = ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_bottom_right);
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
if (region == REGION_NORTH_OF_SOUTH_EAST)
{
priv->activity = ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (priv->event_window, priv->cursor_resize_bottom_right);
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
}
......@@ -473,13 +472,13 @@ glade_design_layout_button_release_event (GtkWidget *widget, GdkEventButton *ev)
GladeDesignLayoutPrivate *priv;
GtkWidget *child;
if ((child = gtk_bin_get_child (GTK_BIN (widget))) == NULL)
if ((child = GLADE_DESIGN_LAYOUT (widget)->child) == NULL)
return FALSE;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
priv->activity = ACTIVITY_NONE;
gdk_window_set_cursor (priv->event_window, NULL);
gdk_window_set_cursor (widget->window, NULL);
return FALSE;
}
......@@ -500,7 +499,7 @@ glade_design_layout_size_request (GtkWidget *widget, GtkRequisition *requisition
requisition->width = 0;
requisition->height = 0;
child = gtk_bin_get_child (GTK_BIN (widget));
child = GLADE_DESIGN_LAYOUT (widget)->child;
if (child && gtk_widget_get_visible (child))
{
......@@ -546,25 +545,14 @@ glade_design_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
gtk_widget_set_allocation (widget, allocation);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
if (gtk_widget_get_realized (widget))
{
if (priv->event_window)
gdk_window_move_resize (priv->event_window,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
}
child = gtk_bin_get_child (GTK_BIN (widget));
child = GLADE_DESIGN_LAYOUT (widget)->child;
if (child && gtk_widget_get_visible (child))
{
gchild = glade_widget_get_from_gobject (child);
g_assert (gchild);
gtk_widget_get_child_requisition (child, &child_requisition);
gtk_widget_get_requisition (child, &child_requisition);
g_object_get (gchild,
"toplevel-width", &child_width,
......@@ -581,120 +569,116 @@ glade_design_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
child_allocation.width = child_width - 2 * border_width;
child_allocation.height = child_height - 2 * border_width;
gdk_window_resize (child->window, child_allocation.width, child_allocation.height);
gtk_widget_size_allocate (child, &child_allocation);
}
}
static void
glade_design_layout_map (GtkWidget *widget)
offscreen_window_to_parent (GdkWindow *offscreen_window,
double offscreen_x,
double offscreen_y,
double *parent_x,
double *parent_y,
gpointer data)
{
GladeDesignLayoutPrivate *priv;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
if (priv->event_window)
gdk_window_show (priv->event_window);
GTK_WIDGET_CLASS (glade_design_layout_parent_class)->map (widget);
*parent_x = offscreen_x;
*parent_y = offscreen_y;
}
static void
glade_design_layout_unmap (GtkWidget *widget)
offscreen_window_from_parent (GdkWindow *window,
double parent_x,
double parent_y,
double *offscreen_x,
double *offscreen_y,
gpointer data)
{
GladeDesignLayoutPrivate *priv;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
GTK_WIDGET_CLASS (glade_design_layout_parent_class)->unmap (widget);
if (priv->event_window)
gdk_window_hide (priv->event_window);
*offscreen_x = parent_x;
*offscreen_y = parent_y;
}
static void
glade_design_layout_realize (GtkWidget *widget)
static GdkWindow *
pick_offscreen_child (GdkWindow *offscreen_window,
double widget_x,
double widget_y,
GladeDesignLayout *layout)
{
GladeDesignLayoutPrivate *priv;
GtkAllocation allocation;
GtkStyle *style;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
guint border_width;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
GtkAllocation child_area;
double x, y;
gtk_widget_set_realized (widget, TRUE);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
if (layout->child && gtk_widget_get_visible (layout->child))
{
x = widget_x;
y = widget_y;
g_message ("pick_offscreen_child");
child_area = layout->child->allocation;
if (x >= 0 && x < child_area.width &&
y >= 0 && y < child_area.height)
return layout->child->window;
}
gtk_widget_get_allocation (widget, &allocation);
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask =
gtk_widget_get_events (widget) |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_EXPOSURE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y;
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, g_object_ref (window));
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_style_attach (widget);
style = gtk_widget_get_style (widget);
gtk_style_set_background (style, window, GTK_STATE_NORMAL);
return NULL;
}
static void
glade_design_layout_unrealize (GtkWidget *widget)
child_realize (GtkWidget *widget, GtkWidget *parent)
{
GladeDesignLayoutPrivate *priv;
GdkWindow *window, *new_window;
GdkWindowAttr attributes;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
window = gtk_widget_get_window (widget);
if (priv->event_window)
{
gdk_window_set_user_data (priv->event_window, NULL);
gdk_window_destroy (priv->event_window);
priv->event_window = NULL;
}
gdk_drawable_get_size (GDK_DRAWABLE (window),
&attributes.width,
&attributes.height);
attributes.window_type = GDK_WINDOW_OFFSCREEN;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.event_mask = gdk_window_get_events (window);
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
new_window = gdk_window_new (NULL, &attributes, GDK_WA_VISUAL | GDK_WA_COLORMAP);
gtk_widget_set_window (widget, new_window);
GTK_WIDGET_CLASS (glade_design_layout_parent_class)->unrealize (widget);
gdk_window_set_user_data (new_window, parent);
g_signal_connect (parent->window, "pick-embedded-child",
G_CALLBACK (pick_offscreen_child), GLADE_DESIGN_LAYOUT (parent));
gdk_offscreen_window_set_embedder (widget->window, parent->window);
g_signal_connect (widget->window, "to-embedder",
G_CALLBACK (offscreen_window_to_parent), NULL);
g_signal_connect (widget->window, "from-embedder",
G_CALLBACK (offscreen_window_from_parent), NULL);
gtk_style_set_background (widget->style, new_window, GTK_STATE_NORMAL);
gdk_window_show (new_window);
}
static void
glade_design_layout_add (GtkContainer *container, GtkWidget *widget)
{
GladeDesignLayout *layout;
GtkWidget *parent;
layout = GLADE_DESIGN_LAYOUT (container);
parent = GTK_WIDGET (container);
layout->priv->current_size_request->width = 0;
layout->priv->current_size_request->height = 0;
g_signal_connect (G_OBJECT (widget), "size-request",
G_CALLBACK (child_size_request_handler),
container);
container);
g_signal_connect_after (G_OBJECT (widget), "realize",
G_CALLBACK (child_realize),
GTK_WIDGET (container));
GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->add (container, widget);
gdk_window_lower (layout->priv->event_window);
// GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->add (container, widget);
}
static void
......@@ -771,61 +755,68 @@ draw_frame (GtkWidget *widget,
static gboolean
glade_design_layout_expose_event (GtkWidget *widget, GdkEventExpose *ev)
{
GladeDesignLayout *layout;
GtkStyle *style;
GtkAllocation allocation, child_allocation;
GtkWidget *child;
GdkWindow *window;
gint x, y, w, h;
gint border_width;
cairo_t *cr;
GladeDesignLayout *layout = GLADE_DESIGN_LAYOUT (widget);
layout = GLADE_DESIGN_LAYOUT (widget);
if (ev->window == widget->window)
{
GtkStyle *style;
GtkAllocation allocation;
GtkWidget *child;
GdkWindow *window;
gint x, y, w, h;
gint border_width;
cairo_t *cr;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
gtk_widget_get_allocation (widget, &allocation);
window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
gtk_widget_get_allocation (widget, &allocation);
child = gtk_bin_get_child (GTK_BIN (widget));
child = layout->child;
cr = gdk_cairo_create (window);
cr = gdk_cairo_create (window);
/* draw a white widget background */
glade_utils_cairo_draw_rectangle (cr,
&style->base [gtk_widget_get_state (widget)],
TRUE,
allocation.x + border_width,
allocation.y + border_width,
allocation.width - 2 * border_width,
allocation.height - 2 * border_width);
/* draw a white widget background */
glade_utils_cairo_draw_rectangle (cr,
&style->base [gtk_widget_get_state (widget)],
TRUE,
allocation.x + border_width,
allocation.y + border_width,
allocation.width - 2 * border_width,
allocation.height - 2 * border_width);
if (child && gtk_widget_get_visible (child))
{
GdkPixmap *child_pixmap = gdk_offscreen_window_get_pixmap (child->window);
if (child && gtk_widget_get_visible (child))
{
/* draw frame */
gtk_widget_get_allocation (child, &child_allocation);
x = child_allocation.x - OUTLINE_WIDTH / 2;
y = child_allocation.y - OUTLINE_WIDTH / 2;
w = child_allocation.width + OUTLINE_WIDTH;
h = child_allocation.height + OUTLINE_WIDTH;
draw_frame (widget, cr, x, y, w, h);
gdk_drawable_get_size (GDK_DRAWABLE (child_pixmap), &w, &h);
/* draw a filled rectangle in case child does not draw
* it's own background (a GTK_WIDGET_NO_WINDOW child). */
glade_utils_cairo_draw_rectangle (cr,
&style->bg[GTK_STATE_NORMAL],
TRUE,
x + OUTLINE_WIDTH / 2, y + OUTLINE_WIDTH / 2,
w - OUTLINE_WIDTH, h - OUTLINE_WIDTH);
x = allocation.x + border_width;
y = allocation.y + border_width;
GTK_WIDGET_CLASS (glade_design_layout_parent_class)->expose_event (widget, ev);
}
g_message ("aaaa %d %d %d %d ", x, y, w, h);
cairo_destroy (cr);
gdk_cairo_set_source_pixmap (cr, child_pixmap, 0, 0);
cairo_rectangle (cr, x + OUTLINE_WIDTH/2, y + OUTLINE_WIDTH/2, w, h);
cairo_paint (cr);
return TRUE;
w += border_width + OUTLINE_WIDTH;
h += border_width + OUTLINE_WIDTH;
/* draw frame */
draw_frame (widget, cr, x, y, w, h);
}
cairo_destroy (cr);
return TRUE;
}
else if (ev->window == layout->child->window)
{
g_message ("ev->window == layout->child->window");
}
return FALSE;
}
/**
......@@ -852,10 +843,10 @@ glade_design_layout_widget_event (GladeDesignLayout *layout,
gtk_widget_get_pointer (GTK_WIDGET (layout), &x, &y);
gwidget = glade_design_layout_deepest_gwidget_at_position
(GTK_CONTAINER (layout), GTK_CONTAINER (layout), x, y);
(GTK_CONTAINER (layout->child), GTK_CONTAINER (layout->child), x, y);
child = glade_design_layout_deepest_widget_at_position
(GTK_CONTAINER (layout), GTK_CONTAINER (layout), x, y);
(GTK_CONTAINER (layout->child), GTK_CONTAINER (layout->child), x, y);
/* First try a placeholder */
if (GLADE_IS_PLACEHOLDER (child) && event->type != GDK_EXPOSE)
......@@ -901,7 +892,6 @@ glade_design_layout_init (GladeDesignLayout *layout)
gtk_widget_set_has_window (GTK_WIDGET (layout), FALSE);
priv->event_window = NULL;
priv->activity = ACTIVITY_NONE;
priv->current_size_request = g_slice_new0 (GtkRequisition);
......@@ -914,6 +904,15 @@ glade_design_layout_init (GladeDesignLayout *layout)
priv->new_height = -1;
}
static gboolean
glade_design_layout_damage (GtkWidget *widget, GdkEventExpose *event)
{
gdk_window_invalidate_rect (widget->window, NULL, FALSE);
return TRUE;
}
static void
glade_design_layout_class_init (GladeDesignLayoutClass *klass)
{
......@@ -935,16 +934,18 @@ glade_design_layout_class_init (GladeDesignLayoutClass *klass)
widget_class->leave_notify_event = glade_design_layout_leave_notify_event;
widget_class->button_press_event = glade_design_layout_button_press_event;
widget_class->button_release_event = glade_design_layout_button_release_event;
widget_class->realize = glade_design_layout_realize;
widget_class->unrealize = glade_design_layout_unrealize;
widget_class->map = glade_design_layout_map;
widget_class->unmap = glade_design_layout_unmap;
widget_class->expose_event = glade_design_layout_expose_event;
widget_class->size_request = glade_design_layout_size_request;
widget_class->size_allocate = glade_design_layout_size_allocate;
klass->widget_event = glade_design_layout_widget_event_impl;
g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
GLADE_TYPE_DESIGN_LAYOUT,
g_cclosure_new (G_CALLBACK (glade_design_layout_damage),
NULL, NULL));
/**
* GladeDesignLayout::widget-event:
* @glade_design_layout: the #GladeDesignLayout containing the #GladeWidget.
......
......@@ -48,14 +48,15 @@ enum
struct _GladeDesignLayout
{
GtkBin parent_instance;
GtkEventBox parent_instance;
GtkWidget *child;
GladeDesignLayoutPrivate *priv;
};
struct _GladeDesignLayoutClass
{
GtkBinClass parent_class;
GtkEventBoxClass parent_class;
gboolean (*widget_event) (GladeProject *project,
GladeWidget *gwidget,
GdkEvent *event);
......
......@@ -324,13 +324,6 @@ glade_palette_toggled (GladePalette *palette)
* disabled so no chance of creating a non-window toplevel here
*/
widget = glade_palette_create_root_widget (palette, adaptor);
/* if this is a top level widget set the accel group */
if (widget && glade_app_get_accel_group () && GTK_IS_WINDOW (widget->object))
{
gtk_window_add_accel_group (GTK_WINDOW (widget->object),
glade_app_get_accel_group ());
}
}
}
......
......@@ -498,9 +498,14 @@ glade_popup_create_menu (GladeWidget *widget,
/* paste is placholder specific when the popup is on a placeholder */
sensitive = glade_clipboard_get_has_selection (glade_app_get_clipboard ());
non_window = FALSE;
for (list = glade_app_get_clipboard ()->selection; list; list = list->next)
if (!GTK_IS_WINDOW (GLADE_WIDGET (list->data)->object))
{
GladeWidget *gwidget = GLADE_WIDGET (list->data);
if (!GTK_IS_WIDGET (gwidget->object) ||
!gtk_widget_get_has_window (GTK_WIDGET (gwidget->object)))
non_window = TRUE;
}
if (placeholder)
glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, NULL, sensitive,
......
......@@ -200,7 +200,7 @@ glade_property_class_free (GladePropertyClass *property_class)
}
static GValue *
GValue *
glade_property_class_get_default_from_spec (GParamSpec *spec)
{
GValue *value;
......
......@@ -278,6 +278,8 @@ gint glade_property_class_compare (GladePropertyC
const GValue *value2,
GladeProjectFormat fmt);
GValue *glade_property_class_get_default_from_spec (GParamSpec *spec);
G_END_DECLS
#endif /* __GLADE_PROPERTY_CLASS_H__ */
......@@ -346,14 +346,14 @@ gwa_add_signals (GladeWidgetAdaptor *adaptor, GList **signals, GType type)
}
static GList *
gwa_list_signals (GladeWidgetAdaptor *adaptor)
gwa_list_signals (GladeWidgetAdaptor *adaptor, GType real_type)
{
GList *signals = NULL;
GType type, parent, *i, *p;
g_return_val_if_fail (adaptor->type != 0, NULL);
g_return_val_if_fail (real_type != 0, NULL);
for (type = adaptor->type; g_type_is_a (type, G_TYPE_OBJECT); type = parent)
for (type = real_type; g_type_is_a (type, G_TYPE_OBJECT); type = parent)
{
parent = g_type_parent (type);