[XForms] Re: [PATCH] Double clicking doesn't work in file selectors
Michal Szymanski
msz at astrouw.edu.pl
Tue Feb 24 09:01:24 EST 2004
On Tue, Jan 13, 2004 at 08:42:43AM +0000, Angus Leeming wrote:
> > Well I'm now a bit bifurcated :) I would like to use both your version
> > of Clive's JPEG/EXIF patch (in CVS) *and* Mike's double click patch
> > (apparently only in standard 1.0 release). This does not seem to be
> > possible at the same time without fiddling with the code which I would
> > strongly not want to do.
>
> Why not? I'd recommend that you grab an anoncvs copy of the repository and
> apply Mike's patch. When it gets merged into the repository itself, cvs will
> either report a conflict (trivially easy to resolve) or will tell you that
> your checked-out tree already contains the patch.
Well, I did try :)
Attached is the manually crafted versions of the Mike's patch applied to
the source named xforms-1.0.2 taken from
http://www.devel.lyx.org/~leeming/xforms-1.0.2.tar.gz
Experts, Author, please check it.
regards, Michal.
--
Michal Szymanski (msz at astrouw.edu.pl)
Warsaw University Observatory, Warszawa, POLAND
-------------- next part --------------
--- lib/fselect.c.orig Thu Nov 13 22:56:02 2003
+++ lib/fselect.c Mon Feb 23 14:32:13 2004
@@ -314,23 +314,16 @@
return 0;
}
#else
-/*
- * A file is selected from the browser.
- * generate ready if valid selection (e.g. double-clicked)
- * Note that if a call back is defined, never generate ready
- */
+
static void
-select_cb(FL_OBJECT * ob, long arg)
+select_cb(FL_OBJECT *ob, long isdblclick)
{
int dir;
char seltext[FL_PATH_MAX];
- static int lastline = -1, clicked;
- int dblclick, thisline;
+ int thisline;
FD_fselect *lfs = ob->form->fdui;
- const XEvent *xev = fl_last_event();
thisline = fl_get_browser(ob);
-
if (thisline <= 0)
return;
@@ -340,31 +333,9 @@
strcpy(seltext, seltext + 2);
- dblclick = (lastline == thisline && clicked &&
- fl_time_passed(FL_FS_T) < ob->click_timeout * 0.001f);
-
- lastline = thisline;
-
- clicked = (clicked || xev->type == ButtonPress);
-
- /* cursor keys can cause a single line being repeatedly selected
- causing a wrong dblclick detection */
-
- if (clicked)
- {
- if (xev->type == KeyPress || xev->type == KeyRelease)
- {
- dblclick = 0;
- clicked = 0;
- lastline = -1;
- }
- }
-
- fl_reset_time(FL_FS_T);
-
if (dir)
{
- if (dblclick)
+ if (isdblclick)
{
strcat(append_slash(lfs->dname), seltext);
fl_fix_dirname(lfs->dname);
@@ -379,7 +350,7 @@
fl_set_input(lfs->input, seltext);
strcpy(lfs->filename, seltext);
- if (dblclick)
+ if (isdblclick)
{
if (lfs->fselect_cb)
{
@@ -390,7 +361,6 @@
fl_object_qenter(lfs->ready);
}
}
- return;
}
#endif
@@ -969,6 +939,7 @@
fs->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 15, 80, 185, 180, "");
#if ATTACHABLE
fl_set_object_callback(obj, select_cb, 0);
+ fl_set_browser_dblclick_callback(obj, select_cb, 1);
#endif
fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
obj->click_timeout = FL_CLICK_TIMEOUT;
More information about the Xforms
mailing list