! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
text shadows and transparent labels for "normal" icons only
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfdesktop
Component:
General

Comments

Description Andrea Santilli 2008-09-24 21:05:51 CEST
Created attachment 1832 
patch for xfdesktop

Hello,
I changed xfdesktop a bit to make it show transparent labels only for icons in GTK_STATE_NORMAL state, while keeping the labels visible for selected ones.

And I also added a text shadow for such "normal" icons when their labels are totally transparent. It is possible to choose the shadow color.

The new values can be set in the gtkrc file with the variables active-label-alpha and label-shadow-color.

The desktop looks fine and in case this change is considered interesting I could also add some options to the setup dialog.
Comment 1 Andrea Santilli 2008-09-25 06:34:44 CEST
Created attachment 1833 
fixed patch #1

sorry man, I had messed the memory and xfdesktop used to crash whenever I changed the style.

Now it just works :)
Comment 2 Andrea Santilli 2008-09-25 14:46:37 CEST
Created attachment 1834 
fixed patch #2

Memory leak fixed, now it should be fine.

The way it works is explained by this picture:
http://img232.imageshack.us/img232/6176/patchedxfdesktopxa5.jpg

I'm wondering if it could be useful to have three distinct options to hide the label backgrounds in GTK_STATE_NORMAL, GTK_STATE_ACTIVE and GTK_STATE_SELECTED and maybe have the possibility to add the text shadows in the same way too.

I'm already thinking about the GUI thing :)
Comment 3 Brian J. Tarricone (not reading bugmail) 2008-09-25 21:05:15 CEST
Ok, I'd like to see this done a little bit differently so it's completely configurable.

You should add a style prop called 'label-shadow-offset' which sets the amount of the x/y coords you add when painting the shadow.  A value of 0 for label-shadow-offset disables the shadow.  The default should be 0.

'active-label-alpha' should be called 'selected-label-alpha' since that matches with the gtk state type.  (In gtk parlance, "active" means you're currently holding the mouse button down on top of something.)  The default should be the same value for 'label-alpha'.

'label-shadow-color' should not be g_param_spec_string, but should be g_param_spec_boxed with type GDK_TYPE_COLOR.  It should have a smarter default if none is provided in gtkrc: you should take the inverse color (just XOR each color component with 0xffff) of the text color for the current state type and use that as the default shadow color.

All this introduces a little problem, though.  On the good side, it makes the shadow setting independent of the label-alpha setting.  So you can have a label background *and* have the shadow if you want.  On the downside, this means you have to choose a label-shadow-color that works with both the normal text color and selected text color.  And that also means you can't enable the shadow for normal icons but not for selected icons.

So I guess we could also add selected-label-shadow-offset and selected-label-shadow-color, but I'm not sure if that's overkill or not, but it would fix the downsides in my last paragraph.  What do you think?
Comment 4 Andrea Santilli 2008-09-27 04:08:49 CEST
Created attachment 1837 
fixed patch #3

I like the idea and I already updated the patch. Now all the points are done :)

I added label alpha and shadow color and offset for both alpha and selected states.

I also changed the color string to a GDK_TYPE_COLOR, and the shadow color defaults to the inverse of the color used for the text.

The offset has a x and y values so it is possible to set the shadow direction too. When both are set to 0 the shadow is disabled.

Still about the offset though, I had to restrict the value between -3 and 3 because of a redraw problem. Otherwise, for greater values, if an icon passes from a state with a text shadow to another without shadow and with a visible label, the old shadow won't go.

These are the new gtkrc variables:

normal-label-alpha
selected-label-alpha
normal-text-shadow-offset-x
normal-text-shadow-offset-y
selected-text-shadow-offset-x
selected-text-shadow-offset-y
normal-text-shadow-color
selected-text-shadow-color

The internal variables that store those values are organized in arrays, so that it is possible to easily extend the customizability to other states too in the future.
Comment 5 Andrea Santilli 2008-09-30 19:11:48 CEST
For the GUI I thought about something like this:

http://img257.imageshack.us/img257/2160/newiconsettingsln5.jpg

What do you think?

Btw do you use xfconf to make the dialog communicate with xfdesktop?
Comment 6 Andrea Santilli 2008-10-01 15:22:26 CEST
prolly better this that uses a table:

http://img363.imageshack.us/img363/1645/newsettingsxg0.jpg
Comment 7 Andrea Santilli 2008-10-12 04:58:24 CEST
Created attachment 1884 
fixed patch #4

Updated patch (for gtkrc config only)
Cleaner code, array weirdness dropped, and a couple of leaks fixed.
Comment 8 Brian J. Tarricone (not reading bugmail) 2008-10-12 10:05:41 CEST
Patch checked in with a few minor modifications.  Yay!
Comment 9 Andrea Santilli 2008-10-12 10:32:41 CEST
w00t! :)
Comment 10 Andrea Santilli 2008-10-15 09:01:42 CEST
Created attachment 1896 
fix for the GdkGC mess

this fixes the problem with the GdkGC object allocation/deallocation for each icon
Comment 11 Brian J. Tarricone (not reading bugmail) 2008-10-15 18:22:43 CEST
(In reply to comment #10)
> Created an attachment (id=1896) [details]
> fix for the GdkGC mess
> 
> this fixes the problem with the GdkGC object allocation/deallocation for each
> icon

I don't like static globals in general.  They should go in the XfdesktopIconView struct, and be initialized/updated in style-set, and unreffed in unrealize.
Comment 12 Andrea Santilli 2008-10-16 09:07:52 CEST
Created attachment 1898 
fix for the GdkGC mess #2

ok no static.

Bug #4412

Reported by:
Andrea Santilli
Reported on: 2008-09-24
Last modified on: 2009-07-14

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
0 users

Version

Version:
4.5.91 (4.6 beta 1)

Attachments

patch for xfdesktop (5.99 KB, patch)
2008-09-24 21:05 CEST , Andrea Santilli
no flags
fixed patch #1 (5.55 KB, patch)
2008-09-25 06:34 CEST , Andrea Santilli
no flags
fixed patch #2 (5.76 KB, patch)
2008-09-25 14:46 CEST , Andrea Santilli
no flags
fixed patch #3 (13.12 KB, patch)
2008-09-27 04:08 CEST , Andrea Santilli
no flags
fixed patch #4 (13.20 KB, patch)
2008-10-12 04:58 CEST , Andrea Santilli
no flags
fix for the GdkGC mess (3.86 KB, patch)
2008-10-15 09:01 CEST , Andrea Santilli
no flags
fix for the GdkGC mess #2 (5.17 KB, patch)
2008-10-16 09:07 CEST , Andrea Santilli
no flags

Additional information