After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 519317 - Unix print dialog should not use GtkDrawingArea
Unix print dialog should not use GtkDrawingArea
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Documentation
2.12.x
Other Linux
: Normal minor
: Small fix
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-02-28 16:00 UTC by Sven Neumann
Modified: 2012-05-26 03:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
simple patch to fix this issue (1.91 KB, patch)
2008-02-28 16:07 UTC, Sven Neumann
none Details | Review
different approach, changes GtkDrawingArea to have a GTK_NO_WINDOW mode (4.58 KB, patch)
2008-03-04 14:29 UTC, Sven Neumann
committed Details | Review

Description Sven Neumann 2008-02-28 16:00:06 UTC
GtkDrawingArea has it's own GDK output window and its background is not nicely drawn by many themes. It is currently used in two places in GtkPrintUnixDialog. You can see the problem in the screenshots attached to bug #519059:

 http://bugzilla.gnome.org/attachment.cgi?id=106070&action=view

Look how the image in the Collate box is drawn on a different background than the rest of the window. A similar problem exists on the "Page Setup" tab.
Comment 1 Sven Neumann 2008-02-28 16:07:23 UTC
Created attachment 106167 [details] [review]
simple patch to fix this issue
Comment 2 Sven Neumann 2008-02-28 16:09:18 UTC
The attached patch changes the code to use a GtkEventBox instead of GtkDrawable and to draw on the parent window.

Actually, GtkEventBox is still overkill for this as we are not interested in receiving any input events. Perhaps GTK+ should provide a dedicated widget for this. But that's another issue...

Please give your OK to commit this change and decide if it should also go into the stable branch.
Comment 3 Matthias Clasen 2008-03-04 05:12:19 UTC
I don't see how this is not a theme problem ?

Of all the themes I have installed here locally, only one exhibits this problem.
And there is nothing to stop another theme from causing the same problem with an event box, afaics.
Comment 4 Sven Neumann 2008-03-04 12:01:30 UTC
An event box doesn't draw it's own background while a GtkDrawingArea does this. You can only see this with themes that draw a non-uniform background. But there is nothing the theme could do about this. The bug is clearly that GtkUnixPrintDialog is abusing a GtkDrawingArea here when it should render on the background window.
Comment 5 Sven Neumann 2008-03-04 14:29:03 UTC
Created attachment 106554 [details] [review]
different approach, changes GtkDrawingArea to have a GTK_NO_WINDOW mode

Havoc suggested a different approach on the mailing-list and I like his idea. The attached patch changes GtkDrawingArea to respect the GTK_NO_WINDOW flag. It also changes GtkPrintUnixDialog to set this flag.
Comment 6 Xan Lopez 2008-03-04 19:45:57 UTC
(In reply to comment #5)
> Created an attachment (id=106554) [edit]
> different approach, changes GtkDrawingArea to have a GTK_NO_WINDOW mode

Shouldn't you add API to get and set the NO_WINDOW mode like in GtkFixed?

Comment 7 Sven Neumann 2008-03-05 07:54:19 UTC
I don't see anything wrong about using the existing API for this. But if there's need for such an API, it can of course be added.
Comment 8 Xan Lopez 2008-03-05 08:01:53 UTC
(In reply to comment #7)
> I don't see anything wrong about using the existing API for this. But if
> there's need for such an API, it can of course be added.
> 

Right, GtkFixed actually says its API is there for compatibility reasons. I
just thought it would be good for consistency and discoverability. You could
also allow the set function to be used after realize, like in GtkEventBox, but
I guess the usefulness of that is a bit questionable.
Comment 9 Sven Neumann 2008-05-25 12:55:13 UTC
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.

We should probably add API to GtkDrawingArea as suggested in comment #6. I am keeping this report open. Will attach a patch soon...
Comment 10 Sven Neumann 2008-05-29 12:36:04 UTC
The API from GtkFixed is definitely not needed here. But something like the "visible-window" property might be useful here. Please ask me to provide a patch if you think that such an API is needed.
Comment 11 Björn Lindqvist 2008-06-28 09:37:40 UTC
(In reply to comment #9)
> 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.

The documentation for GtkDrawingArea should mention this change. It is a very common complaint that the GtkDrawingArea background has the "wrong color."

Comment 12 Matthias Clasen 2008-11-29 19:57:00 UTC
Can you provide a doc patch ?