Let double-click select file in file browser
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 13 Apr 2011 10:23:00 +0000 (12:23 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 14 Apr 2011 19:30:18 +0000 (21:30 +0200)
A second click on the already selected entry now has the same effect as
pressing the OK button.

filebrowser/path.c

index edb43c8..a44a166 100644 (file)
@@ -730,6 +730,7 @@ SFbuttonReleaseList(w, n, event)
        XButtonReleasedEvent    *event;
 {
        SFDir   *dir;
+       static int lastClick;
 
        if(event->button == Button4 || event->button == Button5) return; // [HGM] mouse wheel does not select
        SFbuttonPressed = 0;
@@ -745,7 +746,9 @@ SFbuttonReleaseList(w, n, event)
                        dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown
                );
                SFmotionList(w, n, (XMotionEvent *) event);
+               if(lastClick == 256*n + SFcurrentInvert[n]) SFstatus = SEL_FILE_OK; // [HGM] double click implies OK
        }
+       lastClick = 256*n + SFcurrentInvert[n];
 }
 
 static int