mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Added /mouse command for enabling/disabling mouse handling
Defaults to on.
This commit is contained in:
parent
8aad45f9d3
commit
b9ac008b80
@ -119,6 +119,7 @@ static gboolean _cmd_set_gone(gchar **args, struct cmd_help_t help);
|
|||||||
static gboolean _cmd_set_autoping(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_set_autoping(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_set_titlebar(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_set_titlebar(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_set_autoaway(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_set_autoaway(gchar **args, struct cmd_help_t help);
|
||||||
|
static gboolean _cmd_set_mouse(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_vercheck(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_vercheck(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_away(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_away(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_online(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_online(gchar **args, struct cmd_help_t help);
|
||||||
@ -438,6 +439,17 @@ static struct cmd_t setting_commands[] =
|
|||||||
"Possible properties are 'version'.",
|
"Possible properties are 'version'.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
|
{ "/mouse",
|
||||||
|
_cmd_set_mouse, parse_args, 1, 1,
|
||||||
|
{ "/mouse on|off", "Use profanity mouse handling.",
|
||||||
|
{ "/mouse on|off",
|
||||||
|
"-------------",
|
||||||
|
"If set to 'on', profanity will handle mouse actions, which enabled scrolling the main window with the mouse wheel.",
|
||||||
|
"To select text, use the shift key while selcting an area.",
|
||||||
|
"If set to 'off', profanity leaves mouse handling to the terminal implementation.",
|
||||||
|
"The default is 'on', if you have strange behaviour with mouse actions, set to 'off'.",
|
||||||
|
NULL } } },
|
||||||
|
|
||||||
{ "/chlog",
|
{ "/chlog",
|
||||||
_cmd_set_chlog, parse_args, 1, 1,
|
_cmd_set_chlog, parse_args, 1, 1,
|
||||||
{ "/chlog on|off", "Chat logging to file",
|
{ "/chlog on|off", "Chat logging to file",
|
||||||
@ -911,6 +923,8 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
prefs_autocomplete_boolean_choice);
|
prefs_autocomplete_boolean_choice);
|
||||||
_parameter_autocomplete(input, size, "/chlog",
|
_parameter_autocomplete(input, size, "/chlog",
|
||||||
prefs_autocomplete_boolean_choice);
|
prefs_autocomplete_boolean_choice);
|
||||||
|
_parameter_autocomplete(input, size, "/mouse",
|
||||||
|
prefs_autocomplete_boolean_choice);
|
||||||
_parameter_autocomplete(input, size, "/history",
|
_parameter_autocomplete(input, size, "/history",
|
||||||
prefs_autocomplete_boolean_choice);
|
prefs_autocomplete_boolean_choice);
|
||||||
_parameter_autocomplete(input, size, "/vercheck",
|
_parameter_autocomplete(input, size, "/vercheck",
|
||||||
@ -2089,6 +2103,13 @@ _cmd_set_chlog(gchar **args, struct cmd_help_t help)
|
|||||||
"Chat logging", prefs_set_chlog);
|
"Chat logging", prefs_set_chlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_cmd_set_mouse(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
return _cmd_set_boolean_preference(args[0], help,
|
||||||
|
"Mouse handling", prefs_set_mouse);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cmd_set_history(gchar **args, struct cmd_help_t help)
|
_cmd_set_history(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
@ -410,6 +410,23 @@ prefs_set_splash(gboolean value)
|
|||||||
_save_prefs();
|
_save_prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
prefs_get_mouse(void)
|
||||||
|
{
|
||||||
|
// default to true
|
||||||
|
if (!g_key_file_has_key(prefs, "ui", "mouse", NULL)) {
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return g_key_file_get_boolean(prefs, "ui", "mouse", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
prefs_set_mouse(gboolean value)
|
||||||
|
{
|
||||||
|
g_key_file_set_boolean(prefs, "ui", "mouse", value);
|
||||||
|
_save_prefs();
|
||||||
|
}
|
||||||
static void
|
static void
|
||||||
_save_prefs(void)
|
_save_prefs(void)
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,8 @@ gint prefs_get_gone(void);
|
|||||||
void prefs_set_gone(gint value);
|
void prefs_set_gone(gint value);
|
||||||
gchar * prefs_get_theme(void);
|
gchar * prefs_get_theme(void);
|
||||||
void prefs_set_theme(gchar *value);
|
void prefs_set_theme(gchar *value);
|
||||||
|
gboolean prefs_get_mouse(void);
|
||||||
|
void prefs_set_mouse(gboolean value);
|
||||||
|
|
||||||
void prefs_set_notify_message(gboolean value);
|
void prefs_set_notify_message(gboolean value);
|
||||||
gboolean prefs_get_notify_message(void);
|
gboolean prefs_get_notify_message(void);
|
||||||
|
@ -125,8 +125,10 @@ ui_init(void)
|
|||||||
initscr();
|
initscr();
|
||||||
raw();
|
raw();
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
|
if (prefs_get_mouse()) {
|
||||||
mousemask(ALL_MOUSE_EVENTS, NULL);
|
mousemask(ALL_MOUSE_EVENTS, NULL);
|
||||||
mouseinterval(5);
|
mouseinterval(5);
|
||||||
|
}
|
||||||
ui_load_colours();
|
ui_load_colours();
|
||||||
refresh();
|
refresh();
|
||||||
create_title_bar();
|
create_title_bar();
|
||||||
@ -1251,6 +1253,11 @@ cons_show_ui_prefs(void)
|
|||||||
cons_show("Version checking (/vercheck) : ON");
|
cons_show("Version checking (/vercheck) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Version checking (/vercheck) : OFF");
|
cons_show("Version checking (/vercheck) : OFF");
|
||||||
|
|
||||||
|
if (prefs_get_mouse())
|
||||||
|
cons_show("Mouse handling (/mouse) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Mouse handling (/mouse) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2192,6 +2199,7 @@ _win_handle_page(const wint_t * const ch)
|
|||||||
int page_space = rows - 4;
|
int page_space = rows - 4;
|
||||||
int *page_start = &(current->y_pos);
|
int *page_start = &(current->y_pos);
|
||||||
|
|
||||||
|
if (prefs_get_mouse()) {
|
||||||
MEVENT mouse_event;
|
MEVENT mouse_event;
|
||||||
|
|
||||||
if (*ch == KEY_MOUSE) {
|
if (*ch == KEY_MOUSE) {
|
||||||
@ -2225,9 +2233,11 @@ _win_handle_page(const wint_t * const ch)
|
|||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// page up
|
// page up
|
||||||
} else if (*ch == KEY_PPAGE) {
|
if (*ch == KEY_PPAGE) {
|
||||||
*page_start -= page_space;
|
*page_start -= page_space;
|
||||||
|
|
||||||
// went past beginning, show first page
|
// went past beginning, show first page
|
||||||
|
Loading…
Reference in New Issue
Block a user