summaryrefslogtreecommitdiffstats
path: root/src/askloc.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2010-09-11 18:53:59 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2010-09-11 18:53:59 +0200
commit9d7bbc6b52602933dda5f4e6d56939a8a9e9adc4 (patch)
tree2d27cbd09dcaaf5f37d90960f65d8c72bf2e83bc /src/askloc.c
parent2b5f0bec982e57f322ee0c78df1d63092ab48f75 (diff)
If compiled with "./configure --enable-mouse", most PhotoRec screens can be driven by mouse.
gpm library is dynamicaly loaded by ncurses, so this option isn't compatible with static binaries.
Diffstat (limited to 'src/askloc.c')
-rw-r--r--src/askloc.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/askloc.c b/src/askloc.c
index 1bc27f3..93b08e7 100644
--- a/src/askloc.c
+++ b/src/askloc.c
@@ -318,8 +318,45 @@ char *ask_location(const char*msg, const char *src_dir, const char *dst_org)
wrefresh(window);
do
{
+ int command=wgetch(window);
quit=ASK_LOCATION_WAITKEY;
- switch(wgetch(window))
+#if defined(KEY_MOUSE) && defined(ENABLE_MOUSE)
+ if(command==KEY_MOUSE)
+ {
+ MEVENT event;
+ if(getmouse(&event) == OK)
+ { /* When the user clicks left mouse button */
+ if((event.bstate & BUTTON1_CLICKED) || (event.bstate & BUTTON1_DOUBLE_CLICKED))
+ {
+ if(event.y >=8 && event.y<8+INTER_DIR)
+ {
+ const int pos_num_old=pos_num;
+ /* Disk selection */
+ while(pos_num > event.y-(8-offset) && current_file->prev!=&dir_list.list)
+ {
+ current_file=current_file->prev;
+ pos_num--;
+ }
+ while(pos_num < event.y-(8-offset) && current_file->next!=&dir_list.list)
+ {
+ current_file=current_file->next;
+ pos_num++;
+ }
+ quit=ASK_LOCATION_UPDATE;
+ if(((event.bstate & BUTTON1_CLICKED) && pos_num==pos_num_old) ||
+ (event.bstate & BUTTON1_DOUBLE_CLICKED))
+ command=KEY_ENTER;
+ }
+#if 0
+ else if(file_walker!=&dir_list.list && file_walker->next!=&dir_list.list)
+ {
+ }
+#endif
+ }
+ }
+ }
+#endif
+ switch(command)
{
case 'y':
case 'Y':