Commit d0ffa630 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

respect the GTK_NO_WINDOW flag and don't create an output window if it is

2008-05-25  Sven Neumann  <sven@gimp.org>

	* gtk/gtkdrawingarea.c (gtk_drawing_area_realize)
	(gtk_drawing_area_size_allocate): respect the GTK_NO_WINDOW flag
	and don't create an output window if it is set.

	* gtk/gtkprintunixdialog.c: set the GTK_NO_WINDOW flag for the
	drawing areas. Fixes bug #519317.


svn path=/trunk/; revision=20148
parent 4ebacd83
2008-05-25 Sven Neumann <sven@gimp.org>
* gtk/gtkdrawingarea.c (gtk_drawing_area_realize)
(gtk_drawing_area_size_allocate): respect the GTK_NO_WINDOW flag
and don't create an output window if it is set.
* gtk/gtkprintunixdialog.c: set the GTK_NO_WINDOW flag for the
drawing areas. Fixes bug #519317.
2008-05-25 Jan Arne Petersen <jpetersen@jpetersen.org>
* gtk/gtkentry.c: (gtk_entry_class_init), (get_text_area_size),
......
......@@ -79,25 +79,33 @@ gtk_drawing_area_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, darea);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
if (GTK_WIDGET_NO_WINDOW (widget))
{
GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->realize (widget);
}
else
{
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, darea);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget));
}
......@@ -113,9 +121,10 @@ gtk_drawing_area_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
if (!GTK_WIDGET_NO_WINDOW (widget))
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget));
}
......
......@@ -1546,6 +1546,8 @@ draw_collate_cb (GtkWidget *widget,
cr = gdk_cairo_create (widget->window);
cairo_translate (cr, widget->allocation.x, widget->allocation.y);
if (copies == 1)
{
paint_page (widget, cr, scale, rtl ? 40: 15, 5, reverse ? "1" : "2", text_x);
......@@ -1771,13 +1773,16 @@ create_main_page (GtkPrintUnixDialog *dialog)
0, 0);
image = gtk_drawing_area_new ();
GTK_WIDGET_SET_FLAGS (image, GTK_NO_WINDOW);
priv->collate_image = image;
gtk_widget_show (image);
gtk_widget_set_size_request (image, 70, 90);
gtk_table_attach (GTK_TABLE (table), image,
1, 2, 1, 3, GTK_FILL, 0,
0, 0);
g_signal_connect (image, "expose-event", G_CALLBACK (draw_collate_cb), dialog);
g_signal_connect (image, "expose-event",
G_CALLBACK (draw_collate_cb), dialog);
label = gtk_label_new (_("General"));
gtk_widget_show (label);
......@@ -2054,6 +2059,8 @@ draw_page_cb (GtkWidget *widget,
cr = gdk_cairo_create (widget->window);
cairo_translate (cr, widget->allocation.x, widget->allocation.y);
ratio = G_SQRT2;
w = (EXAMPLE_PAGE_AREA_SIZE - 3) / ratio;
......@@ -2317,6 +2324,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
gtk_box_pack_start (GTK_BOX (main_vbox), hbox2, TRUE, TRUE, 0);
draw = gtk_drawing_area_new ();
GTK_WIDGET_SET_FLAGS (draw, GTK_NO_WINDOW);
priv->page_layout_preview = draw;
gtk_widget_set_size_request (draw, 200, 200);
g_signal_connect (draw, "expose-event", G_CALLBACK (draw_page_cb), dialog);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment