summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Neumann <sven@gimp.org>2008-05-25 12:53:59 +0000
committerSven Neumann <neo@src.gnome.org>2008-05-25 12:53:59 +0000
commitd0ffa630f53e55b1d6f0c8eb7bfde05ca4eb8fde (patch)
tree552754bc8c73010346dc57c4a57d99f9bdb25e82
parent4ebacd837624b06ae17893add8dba258d5b81334 (diff)
downloadgtk+-d0ffa630f53e55b1d6f0c8eb7bfde05ca4eb8fde.tar.gz
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
-rw-r--r--ChangeLog9
-rw-r--r--gtk/gtkdrawingarea.c53
-rw-r--r--gtk/gtkprintunixdialog.c10
3 files changed, 49 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 8366bf70aa..9970dff51e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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),
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c
index 8db572f3d5..6d9cfc9f11 100644
--- a/gtk/gtkdrawingarea.c
+++ b/gtk/gtkdrawingarea.c
@@ -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));
}
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 73ec0c42c0..da1812b4e4 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -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);