gtk+ r20148 - in trunk: . gtk



Author: neo
Date: Sun May 25 12:53:59 2008
New Revision: 20148
URL: http://svn.gnome.org/viewvc/gtk+?rev=20148&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/gtk/gtkdrawingarea.c
   trunk/gtk/gtkprintunixdialog.c

Modified: trunk/gtk/gtkdrawingarea.c
==============================================================================
--- trunk/gtk/gtkdrawingarea.c	(original)
+++ trunk/gtk/gtkdrawingarea.c	Sun May 25 12:53:59 2008
@@ -79,25 +79,33 @@
   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;
+  if (GTK_WIDGET_NO_WINDOW (widget))
+    {
+      GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->realize (widget);
+    }
+  else
+    {
+      GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-  gdk_window_set_user_data (widget->window, darea);
+      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);
+      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 @@
 
   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));
     }

Modified: trunk/gtk/gtkprintunixdialog.c
==============================================================================
--- trunk/gtk/gtkprintunixdialog.c	(original)
+++ trunk/gtk/gtkprintunixdialog.c	Sun May 25 12:53:59 2008
@@ -1546,6 +1546,8 @@
 
   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 @@
 		    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 @@
   
   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 @@
   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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]