1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[mouse] Show message about disabled/enabled mouse

This commit is contained in:
Witold Filipczyk 2021-09-21 19:02:43 +02:00
parent 6ffa7ec6e3
commit 7feb5f4140
3 changed files with 16 additions and 5 deletions

View File

@ -25,11 +25,13 @@
#include "elinks.h" #include "elinks.h"
#include "config/options.h" #include "config/options.h"
#include "dialogs/status.h"
#include "intl/libintl.h" #include "intl/libintl.h"
#include "main/select.h" #include "main/select.h"
#include "main/timer.h" #include "main/timer.h"
#include "osdep/ascii.h" #include "osdep/ascii.h"
#include "osdep/osdep.h" #include "osdep/osdep.h"
#include "session/session.h"
#include "terminal/hardio.h" #include "terminal/hardio.h"
#include "terminal/itrm.h" #include "terminal/itrm.h"
#include "terminal/kbd.h" #include "terminal/kbd.h"
@ -97,12 +99,20 @@ enable_mouse(void)
} }
void void
toggle_mouse(void) toggle_mouse(struct session *ses)
{ {
if (mouse_enabled) if (mouse_enabled) {
disable_mouse(); disable_mouse();
else } else {
enable_mouse(); enable_mouse();
}
if (mouse_enabled) {
mem_free_set(&ses->status.window_status, stracpy(_("Mouse enabled", ses->tab->term)));
} else {
mem_free_set(&ses->status.window_status, stracpy(_("Mouse disabled", ses->tab->term)));
}
print_screen_status(ses);
} }
static int static int

View File

@ -7,6 +7,7 @@ extern "C" {
struct interlink_event; struct interlink_event;
struct itrm; struct itrm;
struct session;
/* The mouse reporting button byte looks like: /* The mouse reporting button byte looks like:
* *
@ -120,7 +121,7 @@ void send_mouse_init_sequence(int h);
void send_mouse_done_sequence(int h); void send_mouse_done_sequence(int h);
void disable_mouse(void); void disable_mouse(void);
void enable_mouse(void); void enable_mouse(void);
void toggle_mouse(void); void toggle_mouse(struct session *ses);
int decode_terminal_mouse_escape_sequence(struct itrm *itrm, struct interlink_event *ev, int el, int v); int decode_terminal_mouse_escape_sequence(struct itrm *itrm, struct interlink_event *ev, int el, int v);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -683,7 +683,7 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
case ACT_MAIN_TOGGLE_MOUSE: case ACT_MAIN_TOGGLE_MOUSE:
#ifdef CONFIG_MOUSE #ifdef CONFIG_MOUSE
toggle_mouse(); toggle_mouse(ses);
#endif #endif
break; break;