GNOME Bugzilla – Bug 628884
Use a bitfield for Widget::private_flags, ::state, ::saved_state
Last modified: 2010-09-07 04:14:21 UTC
This recovers 10 bits, since state and saved_state as uint8 both wasted 5 bits. Now we can add 10 more flags. Also, a possible future patch could just do 1-bit bitfields for the private flags instead of using manual bit twiddling.
Created attachment 169573 [details] [review] Use a bitfield for Widget::private_flags, ::state, ::saved_state
It is probably worth checking what the gtk-style-context branch does with widget states. There has been some talk about turning state into a bitfield. I see at least two new states in that branch. Another way to save bits might be to turn insensitive into a separate bit and do away with saved_state altogether.
Yeah. I think we ought to move toward the bitfield in any case, instead of manually managing this with sized ints and bit twiddling. Then it will be relatively easy to tweak how big any field is or add and remove fields. (Especially because this is all going to be private, right?) the original reason for "flags" afaik was because a bitfield can't be split between GtkObject and GtkWidget. But that doesn't apply anymore since private_flags is all for Widget. I'd propose merging this patch and when style-context rebases they can just add their fields? I'll try to reduce bits used by the expand patch
Sure, lets merge this now, and we'll tweak the bit allocation as needed for the style-context stuff.
Committed.