summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWHR <msl0000023508@gmail.com>2022-05-17 12:53:15 +0800
committerBenBE <BenBE@geshi.org>2022-05-19 20:23:22 +0200
commitd22667725a980e75a3c635567ec5c9400bcde02b (patch)
tree60aa1ddfb56d9c212972f7a49e3d169dba944031
parentef4cbae5ea7d327b8ba27dedd645bd7b86b5fd88 (diff)
Call mousemask(3X) to truly enable or disable mouse control
-rw-r--r--Action.c1
-rw-r--r--CRT.c22
-rw-r--r--CRT.h2
3 files changed, 18 insertions, 7 deletions
diff --git a/Action.c b/Action.c
index 99c0fe0b..27a9ef5d 100644
--- a/Action.c
+++ b/Action.c
@@ -88,6 +88,7 @@ static void Action_runSetup(State* st) {
ScreenManager_run(scr, NULL, NULL, "Setup");
ScreenManager_delete(scr);
if (st->settings->changed) {
+ CRT_setMouse(st->settings->enableMouse);
Header_writeBackToSettings(st->header);
}
}
diff --git a/CRT.c b/CRT.c
index 583b6266..868f2377 100644
--- a/CRT.c
+++ b/CRT.c
@@ -900,6 +900,20 @@ void CRT_resetSignalHandlers(void) {
signal(SIGQUIT, SIG_DFL);
}
+void CRT_setMouse(bool enabled) {
+#ifdef HAVE_GETMOUSE
+ if (enabled) {
+#if NCURSES_MOUSE_VERSION > 1
+ mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
+#else
+ mousemask(BUTTON1_RELEASED, NULL);
+#endif
+ } else {
+ mousemask(0, NULL);
+ }
+#endif
+}
+
void CRT_init(const Settings* settings, bool allowUnicode) {
redirectStderr();
@@ -993,13 +1007,7 @@ IGNORE_WCASTQUAL_END
#endif
CRT_treeStrAscii;
-#ifdef HAVE_GETMOUSE
-#if NCURSES_MOUSE_VERSION > 1
- mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
-#else
- mousemask(BUTTON1_RELEASED, NULL);
-#endif
-#endif
+ CRT_setMouse(settings->enableMouse);
CRT_degreeSign = initDegreeSign();
}
diff --git a/CRT.h b/CRT.h
index eae4722d..297e8964 100644
--- a/CRT.h
+++ b/CRT.h
@@ -185,6 +185,8 @@ extern int CRT_scrollWheelVAmount;
extern ColorScheme CRT_colorScheme;
+void CRT_setMouse(bool enabled);
+
void CRT_init(const Settings* settings, bool allowUnicode);
void CRT_done(void);

© 2014-2024 Faster IT GmbH | imprint | privacy policy