+2004-05-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/gdktypes.h (GdkModifierType): Add a comment about unused
+ bits.
+
+ * gtk/gtkstock.c (real_add, gtk_stock_lookup): Use an unused
+ modifier bit to mark stock item which need to be freed
+ eventually. (#140654, Michal Pasternak, Scott Tsai)
+
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Add missing
+2004-05-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/gdktypes.h (GdkModifierType): Add a comment about unused
+ bits.
+
+ * gtk/gtkstock.c (real_add, gtk_stock_lookup): Use an unused
+ modifier bit to mark stock item which need to be freed
+ eventually. (#140654, Michal Pasternak, Scott Tsai)
+
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Add missing
+2004-05-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/gdktypes.h (GdkModifierType): Add a comment about unused
+ bits.
+
+ * gtk/gtkstock.c (real_add, gtk_stock_lookup): Use an unused
+ modifier bit to mark stock item which need to be freed
+ eventually. (#140654, Michal Pasternak, Scott Tsai)
+
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Add missing
+2004-05-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/gdktypes.h (GdkModifierType): Add a comment about unused
+ bits.
+
+ * gtk/gtkstock.c (real_add, gtk_stock_lookup): Use an unused
+ modifier bit to mark stock item which need to be freed
+ eventually. (#140654, Michal Pasternak, Scott Tsai)
+
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Add missing
GDK_BUTTON3_MASK = 1 << 10,
GDK_BUTTON4_MASK = 1 << 11,
GDK_BUTTON5_MASK = 1 << 12,
- /* The next few modifiers are used by XKB, so we skip to the end
+ /* The next few modifiers are used by XKB, so we skip to the end.
+ * Bits 16 - 28 are currently unused, but will eventually
+ * be used for "virtual modifiers". Bit 29 is used internally.
*/
GDK_RELEASE_MASK = 1 << 30,
GDK_MODIFIER_MASK = GDK_RELEASE_MASK | 0x1fff
static GHashTable *stock_hash = NULL;
static void init_stock_hash (void);
+/* We use an unused modifier bit to mark stock items which
+ * must be freed when they are removed from the hash table.
+ */
+#define NON_STATIC_MASK (1 << 29)
+
static void
real_add (const GtkStockItem *items,
guint n_items,
{
gpointer old_key, old_value;
const GtkStockItem *item = &items[i];
+
+ if (item->modifier & NON_STATIC_MASK)
+ {
+ g_warning ("Bit 29 set in stock accelerator.\n");
+ copy = TRUE;
+ }
+
if (copy)
- item = gtk_stock_item_copy (item);
+ {
+ item = gtk_stock_item_copy (item);
+ ((GtkStockItem *)item)->modifier |= NON_STATIC_MASK;
+ }
if (g_hash_table_lookup_extended (stock_hash, item->stock_id,
&old_key, &old_value))
{
g_hash_table_remove (stock_hash, old_key);
- gtk_stock_item_free (old_value);
+ if (((GtkStockItem *)old_value)->modifier & NON_STATIC_MASK)
+ gtk_stock_item_free (old_value);
}
g_hash_table_insert (stock_hash,
if (found)
{
*item = *found;
+ item->modifier &= ~NON_STATIC_MASK;
if (item->label)
item->label = dgettext (item->translation_domain, item->label);
}