chiark / gitweb /
Button zones: Refactor, preparatory to BottomEdgeZones
[xf86-input-mtrack.git] / src / gestures.c
index 208b39ac46c40cacf8b7e12b2cf9f7b208b11a28..5922c00fcf175c9c51e6c169f24eb15242764bb4 100644 (file)
@@ -210,8 +210,14 @@ static void buttons_update(struct Gestures* gs,
                }
 
                if (emulate) {
+                       int pos = -1;
+
                        if (cfg->button_zones && earliest >= 0) {
-                               int zones, left, right, pos;
+                               pos = ms->touch[earliest].x;
+                       }
+
+                       if (pos >= 0) {
+                               int zones, left, right;
                                double width;
 
                                zones = 0;
@@ -224,7 +230,6 @@ static void buttons_update(struct Gestures* gs,
 
                                if (zones > 0) {
                                        width = ((double)cfg->pad_width)/((double)zones);
-                                       pos = ms->touch[earliest].x;
 #ifdef DEBUG_GESTURES
                                        xf86Msg(X_INFO, "buttons_update: pad width %d, zones %d, zone width %f, x %d\n",
                                                cfg->pad_width, zones, width, pos);