[mousetweaks] Use structure bit fields to save some memory



commit 38764c9a99ac7bddee13c092c200377775a28e54
Author: Gerd Kohlberger <gerdk src gnome org>
Date:   Mon Apr 27 18:17:49 2009 +0200

    Use structure bit fields to save some memory
    
    Changes the size of MTClosure 112 -> 84 bytes.
---
 src/mt-main.h |   44 +++++++++++++++++++++-----------------------
 1 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/src/mt-main.h b/src/mt-main.h
index bc2e17c..50bfb7a 100644
--- a/src/mt-main.h
+++ b/src/mt-main.h
@@ -33,35 +33,33 @@ typedef struct _MTClosure MTClosure;
 struct _MTClosure {
     GConfClient *client;
     GtkBuilder  *ui;
-
     MtService   *service;
     MtTimer     *delay_timer;
     MtTimer     *dwell_timer;
     MtCursor    *cursor;
-
-    Display *xtst_display;
-    gint     n_screens;
-
-    gboolean dwell_drag_started;
-    gboolean dwell_gesture_started;
-    gboolean override_cursor;
-    gboolean move_release;
-
-    gint direction;
-    gint pointer_x;
-    gint pointer_y;
-    gint x_old;
-    gint y_old;
+    Display     *xtst_display;
+    gint         n_screens;
+    gint         direction;
+    gint         pointer_x;
+    gint         pointer_y;
+    gint         x_old;
+    gint         y_old;
 
     /* options */
-    gint     threshold;
-    gint     style;
-    gboolean delay_enabled;
-    gboolean dwell_enabled;
-    gboolean dwell_show_ctw;
-    gint     dwell_mode;
-    gint     dwell_dirs[4];
-    gboolean animate_cursor;
+    gint         threshold;
+    gint         style;
+    gint         dwell_mode;
+    gint         dwell_dirs[4];
+    guint        delay_enabled  : 1;
+    guint        dwell_enabled  : 1;
+    guint        dwell_show_ctw : 1;
+    guint        animate_cursor : 1;
+
+    /* state flags */
+    guint        dwell_drag_started    : 1;
+    guint        dwell_gesture_started : 1;
+    guint        override_cursor       : 1;
+    guint        move_release          : 1;
 };
 
 G_END_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]