Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable keyboard input in "split" mode #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ extern int DisplayMode;
#define split_open()
#define split_close()
#define split_redraw()
#define split_keyaction() 0
#else
#include "split.h"
#endif
Expand Down Expand Up @@ -168,9 +167,6 @@ int display_keyaction(void)
case DisplayCurses:
return mtr_curses_keyaction();

case DisplaySplit:
return split_keyaction();

case DisplayGTK:
return gtk_keyaction();
}
Expand Down
9 changes: 9 additions & 0 deletions mtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
int DisplayMode;
int display_mode;
int Interactive = 1;
int UserInput = 1;
int PrintVersion = 0;
int PrintHelp = 0;
int MaxPing = 10;
Expand Down Expand Up @@ -495,6 +496,14 @@ void parse_arg (int argc, char **argv)
DisplayMode == DisplayCSV)
Interactive = 0;

if (DisplayMode == DisplayReport ||
DisplayMode == DisplayTXT ||
DisplayMode == DisplayXML ||
DisplayMode == DisplayRaw ||
DisplayMode == DisplayCSV ||
DisplayMode == DisplaySplit)
UserInput = 0;

if (optind > argc - 1)
return;

Expand Down
3 changes: 2 additions & 1 deletion select.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "display.h"

extern int Interactive;
extern int UserInput;
extern int MaxPing;
extern int ForceMaxPing;
extern float WaitTime;
Expand Down Expand Up @@ -79,7 +80,7 @@ void select_loop(void) {

maxfd = 0;

if(Interactive) {
if(UserInput) {
FD_SET(0, &readfd);
maxfd = 1;
}
Expand Down
34 changes: 0 additions & 34 deletions split.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,37 +151,3 @@ void split_close(void)
printf("split_close()\n");
#endif
}


int split_keyaction(void)
{
#ifdef NO_CURSES
fd_set readfds;
struct timeval tv;
char c;

FD_ZERO (&readfds);
FD_SET (0, &readfds);
tv.tv_sec = 0;
tv.tv_usec = 0;

if (select (1, &readfds, NULL, NULL, &tv) > 0) {
read (0, &c, 1);
} else
return 0;
#else
char c = getch();
#endif

#if DEBUG
printf("split_keyaction()\n");
#endif
if(tolower(c) == 'q')
return ActionQuit;
if(c==3)
return ActionQuit;
if(tolower(c) == 'r')
return ActionReset;

return 0;
}