mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-19 00:20:09 +00:00
Use a bitfield for Widget::private_flags, ::state, ::saved_state
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. https://bugzilla.gnome.org/show_bug.cgi?id=628884
This commit is contained in:
parent
d5c2cb7bcb
commit
c50db9c208
@ -256,27 +256,27 @@ struct _GtkWidget
|
||||
* GtkObject pointer.
|
||||
*/
|
||||
GtkObject object;
|
||||
|
||||
/* 16 bits of internally used private flags.
|
||||
* this will be packed into the same 4 byte alignment frame that
|
||||
* state and saved_state go. we therefore don't waste any new
|
||||
* space on this.
|
||||
|
||||
/* internally used private flags. */
|
||||
guint GSEAL (private_flags) : 16;
|
||||
|
||||
/* The state of the widget. There are only
|
||||
* 5 widget states (defined in "gtkenums.h")
|
||||
* so 3 bits.
|
||||
*/
|
||||
guint16 GSEAL (private_flags);
|
||||
|
||||
/* The state of the widget. There are actually only
|
||||
* 5 widget states (defined in "gtkenums.h").
|
||||
*/
|
||||
guint8 GSEAL (state);
|
||||
|
||||
guint GSEAL (state) : 3;
|
||||
|
||||
/* The saved state of the widget. When a widget's state
|
||||
* is changed to GTK_STATE_INSENSITIVE via
|
||||
* "gtk_widget_set_state" or "gtk_widget_set_sensitive"
|
||||
* the old state is kept around in this field. The state
|
||||
* will be restored once the widget gets sensitive again.
|
||||
*/
|
||||
guint8 GSEAL (saved_state);
|
||||
|
||||
guint GSEAL (saved_state) : 3;
|
||||
|
||||
/* unused bits in our 32-bit block */
|
||||
guint GSEAL (reserved) : 10;
|
||||
|
||||
/* The widget's name. If the widget does not have a name
|
||||
* (the name is NULL), then its name (as returned by
|
||||
* "gtk_widget_get_name") is its class's name.
|
||||
|
Loading…
Reference in New Issue
Block a user