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 628884 - Use a bitfield for Widget::private_flags, ::state, ::saved_state
Use a bitfield for Widget::private_flags, ::state, ::saved_state
Product: gtk+
Classification: Platform
Component: .General
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
Depends on:
Blocks: 628902
Reported: 2010-09-06 13:24 UTC by Havoc Pennington
Modified: 2010-09-07 04:14 UTC
See Also:
GNOME target: ---
GNOME version: ---

Use a bitfield for Widget::private_flags, ::state, ::saved_state (2.02 KB, patch)
2010-09-06 13:24 UTC, Havoc Pennington
none Details | Review

Description Havoc Pennington 2010-09-06 13:24:54 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.
Comment 1 Havoc Pennington 2010-09-06 13:24:56 UTC
Created attachment 169573 [details] [review]
Use a bitfield for Widget::private_flags, ::state, ::saved_state
Comment 2 Matthias Clasen 2010-09-07 00:05:28 UTC
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.
Comment 3 Havoc Pennington 2010-09-07 00:14:21 UTC
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
Comment 4 Matthias Clasen 2010-09-07 03:42:47 UTC
Sure, lets merge this now, and we'll tweak the bit allocation as needed for the style-context stuff.
Comment 5 Matthias Clasen 2010-09-07 04:14:21 UTC