* mouse.h: Put return codes from the mouse callback to an enum.

Remove MOU_ENDLOOP and MOU_LOCK - they are interpreted like
MOU_NORMAL.  Adjust all dependencies.
* dlg.c: Use MOU_NORMAL instead of 0 for mouse_status.
This commit is contained in:
Pavel Roskin 2002-09-22 05:49:17 +00:00
parent 577f69c223
commit 774b97e94c
5 changed files with 25 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2002-09-22 Pavel Roskin <proski@gnu.org>
* mouse.h: Put return codes from the mouse callback to an enum.
Remove MOU_ENDLOOP and MOU_LOCK - they are interpreted like
MOU_NORMAL. Adjust all dependencies.
* dlg.c: Use MOU_NORMAL instead of 0 for mouse_status.
2002-09-21 Pavel Roskin <proski@gnu.org>
* main.c (process_args): Print only data directory and nothing

View File

@ -710,7 +710,6 @@ dlg_mouse_event (Dlg_head * h, Gpm_Event * event)
Gpm_Event new_event;
int x = event->x;
int y = event->y;
int ret_value;
/* kludge for the menubar: start at h->first, not current */
/* Must be careful in the insertion order to the dlg list */
@ -731,12 +730,13 @@ dlg_mouse_event (Dlg_head * h, Gpm_Event * event)
new_event.x -= widget->x;
new_event.y -= widget->y;
ret_value = widget->mouse ? (*widget->mouse) (&new_event, widget) :
MOU_NORMAL;
if (!widget->mouse)
return MOU_NORMAL;
return ret_value;
return (*widget->mouse) (&new_event, widget);
} while (item != starting_widget);
return 0;
return MOU_NORMAL;
}
/* Run dialog routines */
@ -769,7 +769,7 @@ void init_dlg (Dlg_head *h)
current_dlg = h;
/* Initialize the mouse status */
h->mouse_status = 0;
h->mouse_status = MOU_NORMAL;
/* Redraw the screen */
dlg_redraw (h);

View File

@ -42,10 +42,15 @@ typedef struct Gpm_Event {
#endif /* !HAVE_LIBGPM */
/* General mouse support definitions */
/* General (i.e. both for xterm and gpm) mouse support definitions */
typedef int (*mouse_h)(Gpm_Event *, void *);
/* Constants returned from the mouse callback */
enum { MOU_NORMAL, MOU_REPEAT };
/* Mouse callback */
typedef int (*mouse_h) (Gpm_Event *, void *);
/* Type of mouse support */
typedef enum {
MOUSE_NONE, /* Not detected yet */
MOUSE_DISABLED, /* Explicitly disabled by -d */
@ -66,14 +71,7 @@ void init_mouse (void);
void enable_mouse (void);
void disable_mouse (void);
/* Constants returned from mouse handlers */
#define MOU_NORMAL 0x00
#define MOU_REPEAT 0x01
#define MOU_ENDLOOP 0x02
#define MOU_LOCK 0x04
/* Mouse wheel events. GPM doesn't seem to support them yet. */
/* Mouse wheel events */
#define GPM_B_UP 8
#define GPM_B_DOWN 16

View File

@ -533,7 +533,7 @@ static void maybe_chdir (WTree *tree)
static int event_callback (Gpm_Event *event, WTree *tree)
{
if (!(event->type & GPM_UP))
return MOU_ENDLOOP;
return MOU_NORMAL;
if (tree->is_panel)
event->y--;
@ -556,7 +556,7 @@ static int event_callback (Gpm_Event *event, WTree *tree)
chdir_sel (tree);
}
}
return MOU_ENDLOOP;
return MOU_NORMAL;
}
/* Search tree for text */

View File

@ -2042,11 +2042,11 @@ listbox_event (Gpm_Event *event, WListbox *l)
case listbox_finish:
h->ret_value = B_ENTER;
dlg_stop (h);
return MOU_ENDLOOP;
return MOU_NORMAL;
case listbox_cback:
if ((*l->cback)(l) == listbox_finish)
return MOU_ENDLOOP;
return MOU_NORMAL;
}
}
return MOU_NORMAL;