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 355343 - please add 'dropshadow' support for gdkpango renderer
please add 'dropshadow' support for gdkpango renderer
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 356032
 
 
Reported: 2006-09-10 20:50 UTC by Allison Karlitskaya (desrt)
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a possible implementation (8.36 KB, patch)
2006-09-14 01:31 UTC, Allison Karlitskaya (desrt)
none Details | Review
new patch. (8.89 KB, patch)
2006-09-14 05:23 UTC, Allison Karlitskaya (desrt)
needs-work Details | Review
new, again (9.17 KB, patch)
2006-09-14 15:19 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2006-09-10 20:50:17 UTC
the new libgnome-applet stuff has a special 'gnomeappletlabel' that draws two labels on top of each other -- one black and one white.  this is meant to allow labels on transparent panels with dark backgrounds to be more readable.

the problem is, however, that if you take a wnck window list or something then it will use gtklabel -- not gnomeappletlabel.  this means that complicated widgets that are put on the panel can't take advantage of the cool drop-shadowing effect.

in order for this to work there would need to be an attribute added to gdkpango's renderer (similar to the current emboss attribute) that would produce the drop-shadow effect.
Comment 1 Allison Karlitskaya (desrt) 2006-09-14 01:31:12 UTC
Created attachment 72748 [details] [review]
a possible implementation

this patch allows you to do the following:

  attr = gdk_pango_attr_dropshadow_new (TRUE);
  attrs = pango_attr_list_new ();
  pango_attr_list_insert (attrs, attr);
  widget = gtk_label_new ("This is a test label");
  gtk_label_set_attributes (GTK_LABEL (widget), attrs);

dropshadows are hardwired to be white on black (like nautilus)
Comment 2 Allison Karlitskaya (desrt) 2006-09-14 01:33:12 UTC
oops.  forgot to mention:  the patch contains a small documentation fix for GdkPangoAttrEmbossed.
Comment 3 Matthias Clasen 2006-09-14 03:06:59 UTC
It seems to me that dropshadow_context_black() does exactly the same
as emboss_context() except for the different color. In fact, the
whole dropshadowing seems to be the same as embossing with black
instead of white, and making sure the text color is white. 
If so, maybe we should instead generalize the emboss attribute to
allow specifying the color used for the embossing ? That would also
avoid the question what happens when you combine embossing and dropshadowing
and text color.
Comment 4 Allison Karlitskaya (desrt) 2006-09-14 03:35:39 UTC
I would have modified the embossed attribute instead of defining my own.  I'd have  changed the gboolean into a enum that allows normal/embossed/dropshadow.

You can't really do this, though, since this is a public API.  The structure is public too.

That being said: gbooleans are ints and enums are (basically) ints too....
Comment 5 Allison Karlitskaya (desrt) 2006-09-14 05:23:32 UTC
Created attachment 72750 [details] [review]
new patch.

Here's a new patch after discussion with mclasen on IRC that kills two birds with one stone.

PangoColor is used instead of GdkColor since PangoColor is used already in the GdkPangoRendererPrivate structure and since a PangoColor is a GdkColor without the 'pixel' entry for colourmap allocation.  (trivia: gdk_color_parse calls pango_color_parse!)  Also, if the user is manipulating Pango attribute lists, they clearly know about pango and shouldn't mind using some of its other fine APIs :)
Comment 6 Matthias Clasen 2006-09-14 13:55:54 UTC
+  /* "#fff" is less expensive than "white" */
+  pango_color_parse (&emboss_color, "#fff");
+

even cheaper would be

emboss_color.red   = 65535;
emboss_color.green = 65535;
emboss_color.blue  = 65535;


the docs need a "Since: 2.12"


And I hate to change my mind on that, but looking at the other attributes in 
gdkpango.h, I feel it would be more coherent to take a GdkColor in the 
constructor.

Other than that, it looks great
Comment 7 Allison Karlitskaya (desrt) 2006-09-14 15:19:28 UTC
Created attachment 72786 [details] [review]
new, again

documentation note added
api switched back to GdkColor
direct initialisation of emboss_color instead of calling pango_color_parse
Comment 8 Matthias Clasen 2006-09-15 01:06:36 UTC
I'd remove this comment

 /* less expensive than calling pango_color_parse */

After that, feel free to commit. I'd appreciate if you also add the
new public api to gdk/gdk.symbols and docs/reference/gdk/gdk-sections.txt.

Comment 9 Allison Karlitskaya (desrt) 2006-09-15 01:33:20 UTC
Thanks for the prompt review.  Committed.
Comment 10 Torsten Schoenfeld 2006-09-19 16:20:36 UTC
Apart from the changes to ChangeLog, the patch doesn't seem to be committed.
Comment 11 Allison Karlitskaya (desrt) 2006-09-19 16:39:38 UTC
GNOME developers checklist:
  * basic CVS skills........ check!

i have no idea what happened.  the changed code was still sitting on my harddrive in the same directory that i'd checked in the changelog from.  it's like the 'cvs commit' didn't recurse to gdk/ or something.

fixed now -- thanks :)