-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port to GTK3/Xfce 4.16 #63
Conversation
- Switch libxfce4ui and libxfce4panel to version 2 - use X-XFCE-API 2.0 in desktop file - change GdkColor to GdkRGBA - replace xfce/panel specific functions with new GTK3 equivalents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some questions, otherwise looks good to me.
guint16 green_component = gdkcolor->green >> 8; | ||
guint16 blue_component = gdkcolor->blue >> 8; | ||
// convert the GdkRGBA components to 8 bit ints | ||
guint8 red_component = gdkrgba->red * 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 255
is not equivalent to >> 8
, is this a difference between the two APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! GdkRGBA stores its components in floats of range 0.0 to 1.0. Multiplying and dividing by 255 (max of a uint8) converts to/from 8 bit ints, whereas shifts will do interesting (incorrect) things.
I also have a branch (https://github.com/ad1217/xfce4-i3-workspaces-plugin/tree/gtk3-css) which I wrote last night that does away with this part entirely in favor of CSS styling, which seems to be the preferred method for GTK3 and simplifies a lot of the color-related code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your branch works for me in Arch. I've not noticed any bugs, just that only the text is coloured, rather than the coloured boxes as in the original. If you're planning to maintain this package for the future, is it beyond your scope to add a few features? It would be nice to be able to change the font and customise the background, border, and text colours for each workspace type, to make it look like the native i3 bar. Otherwise I'm just happy that functionality is restored, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ad1217 I'm going to merge this branch as-is, and you can submit your CSS branch as a follow-up (if you want to).
// convert back to floats in range 0.0 to 1.0 | ||
gdkrgba->red = red_component / 255.0; | ||
gdkrgba->green = green_component / 255.0; | ||
gdkrgba->blue = blue_component / 255.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ 255.0
is not equivalent to << 8
. You need to use 256
to get the same result, but what is wrong with using shifts?
I have not tested this extensively, but it seems to work okay on Arch with Xfce 4.16. I haven't written much C recently and never really learned GTK, so no guarantees on the sanity of any of this.