mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 10:13:12 +02:00
core: add mouse support (task #5435), free cursor movement, hook_focus, fix bugs with key "^" (bug #32072, bug #21381), fix bugs with bar windows, completion and /buffer
New features and bugs fixed: - mouse support: new command /mouse, new option weechat.look.mouse, new key context "mouse" - free movement of cursor: new command /cursor, new key context "cursor" - new hook_focus (used by cursor and mouse) - info "cursor_mode" - bugs fixed with key "^" - allow plugin name in /buffer name - fix bugs with bar windows: do not create bar windows for hidden bars - fix completion bug when two words for completion are equal but with different case - automatic scroll direction in /bar scroll (x/y is now optional)
This commit is contained in:
@@ -30,6 +30,7 @@ gui-curses-chat.c
|
||||
gui-curses-color.c
|
||||
gui-curses-key.c
|
||||
gui-curses-main.c
|
||||
gui-curses-mouse.c
|
||||
gui-curses-term.c
|
||||
gui-curses-window.c)
|
||||
|
||||
@@ -68,6 +69,8 @@ IF(LIBINTL_LIBRARY)
|
||||
LIST(APPEND EXTRA_LIBS ${LIBINTL_LIBRARY})
|
||||
ENDIF(LIBINTL_LIBRARY)
|
||||
|
||||
LIST(APPEND EXTRA_LIBS "m")
|
||||
|
||||
ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC})
|
||||
|
||||
INCLUDE_DIRECTORIES(.. ../../core ../../plugins)
|
||||
|
||||
@@ -30,13 +30,15 @@ weechat_curses_LDADD = ./../../core/lib_weechat_core.a \
|
||||
$(PLUGINS_LFLAGS) \
|
||||
$(NCURSES_LFLAGS) \
|
||||
$(GCRYPT_LFLAGS) \
|
||||
$(GNUTLS_LFLAGS)
|
||||
$(GNUTLS_LFLAGS) \
|
||||
-lm
|
||||
|
||||
weechat_curses_SOURCES = gui-curses-bar-window.c \
|
||||
gui-curses-chat.c \
|
||||
gui-curses-color.c \
|
||||
gui-curses-key.c \
|
||||
gui-curses-main.c \
|
||||
gui-curses-mouse.c \
|
||||
gui-curses-term.c \
|
||||
gui-curses-window.c \
|
||||
gui-curses.h
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "../gui-bar-window.h"
|
||||
#include "../gui-chat.h"
|
||||
#include "../gui-color.h"
|
||||
#include "../gui-cursor.h"
|
||||
#include "../gui-window.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -89,6 +90,9 @@ gui_bar_window_objects_free (struct t_gui_bar_window *bar_window)
|
||||
void
|
||||
gui_bar_window_create_win (struct t_gui_bar_window *bar_window)
|
||||
{
|
||||
if (CONFIG_BOOLEAN(bar_window->bar->options[GUI_BAR_OPTION_HIDDEN]))
|
||||
return;
|
||||
|
||||
if (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar)
|
||||
{
|
||||
delwin (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar);
|
||||
@@ -152,14 +156,15 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
|
||||
int *x, int *y,
|
||||
const char *string,
|
||||
int reset_color_before_display,
|
||||
int hide_chars_if_scrolling)
|
||||
int hide_chars_if_scrolling,
|
||||
int *index_item, int *index_subitem, int *index_line)
|
||||
{
|
||||
int x_with_hidden, size_on_screen, low_char, hidden;
|
||||
char utf_char[16], *next_char, *output;
|
||||
|
||||
if (!string || !string[0])
|
||||
return 1;
|
||||
|
||||
|
||||
wmove (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, *y, *x);
|
||||
|
||||
if (reset_color_before_display)
|
||||
@@ -239,6 +244,40 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
|
||||
bar_window->cursor_x += bar_window->x;
|
||||
bar_window->cursor_y += bar_window->y;
|
||||
break;
|
||||
case GUI_COLOR_BAR_START_ITEM:
|
||||
string += 2;
|
||||
if (*index_item < 0)
|
||||
{
|
||||
*index_item = 0;
|
||||
*index_subitem = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*index_subitem)++;
|
||||
if (*index_subitem >= bar_window->items_subcount[*index_item])
|
||||
{
|
||||
(*index_item)++;
|
||||
*index_subitem = 0;
|
||||
}
|
||||
}
|
||||
*index_line = 0;
|
||||
gui_bar_window_coords_add (bar_window,
|
||||
(*index_item >= bar_window->items_count) ? -1 : *index_item,
|
||||
(*index_item >= bar_window->items_count) ? -1 : *index_subitem,
|
||||
*index_line,
|
||||
*x + bar_window->x,
|
||||
*y + bar_window->y);
|
||||
break;
|
||||
case GUI_COLOR_BAR_START_LINE_ITEM:
|
||||
string += 2;
|
||||
(*index_line)++;
|
||||
gui_bar_window_coords_add (bar_window,
|
||||
*index_item,
|
||||
*index_subitem,
|
||||
*index_line,
|
||||
*x + bar_window->x,
|
||||
*y + bar_window->y);
|
||||
break;
|
||||
default:
|
||||
string++;
|
||||
break;
|
||||
@@ -353,10 +392,11 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
int length_screen_before_cursor, length_screen_after_cursor;
|
||||
int diff, max_length, optimal_number_of_lines;
|
||||
int some_data_not_displayed, separator_horizontal, separator_vertical;
|
||||
int index_item, index_subitem, index_line;
|
||||
|
||||
if (!gui_init_ok)
|
||||
return;
|
||||
|
||||
|
||||
if (!str_start_input[0])
|
||||
{
|
||||
snprintf (str_start_input, sizeof (str_start_input), "%c%c%c",
|
||||
@@ -384,6 +424,12 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
bar_window->cursor_x = -1;
|
||||
bar_window->cursor_y = -1;
|
||||
|
||||
/* remove coords */
|
||||
gui_bar_window_coords_free (bar_window);
|
||||
index_item = -1;
|
||||
index_subitem = -1;
|
||||
index_line = 0;
|
||||
|
||||
filling = gui_bar_get_filling (bar_window->bar);
|
||||
|
||||
content = gui_bar_window_content_get_with_filling (bar_window, window);
|
||||
@@ -547,7 +593,10 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
{
|
||||
if (!gui_bar_window_print_string (bar_window, filling,
|
||||
&x, &y,
|
||||
items[line], 1, 1))
|
||||
items[line], 1, 1,
|
||||
&index_item,
|
||||
&index_subitem,
|
||||
&index_line))
|
||||
{
|
||||
some_data_not_displayed = 1;
|
||||
}
|
||||
@@ -571,7 +620,10 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
while (x < bar_window->width)
|
||||
{
|
||||
gui_bar_window_print_string (bar_window, filling,
|
||||
&x, &y, " ", 0, 0);
|
||||
&x, &y, " ", 0, 0,
|
||||
&index_item,
|
||||
&index_subitem,
|
||||
&index_line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,7 +670,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]),
|
||||
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* move cursor if it was asked in an item content (input_text does that
|
||||
* to move cursor in user input text)
|
||||
@@ -632,7 +684,12 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
x = bar_window->width - 2;
|
||||
wmove (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, y, x);
|
||||
wrefresh (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar);
|
||||
move (bar_window->cursor_y, bar_window->cursor_x);
|
||||
if (!gui_cursor_mode)
|
||||
{
|
||||
gui_window_cursor_x = bar_window->cursor_x;
|
||||
gui_window_cursor_y = bar_window->cursor_y;
|
||||
move (bar_window->cursor_y, bar_window->cursor_x);
|
||||
}
|
||||
}
|
||||
else
|
||||
wnoutrefresh (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar);
|
||||
|
||||
@@ -209,6 +209,8 @@ gui_chat_string_next_char (struct t_gui_window *window,
|
||||
case GUI_COLOR_BAR_START_INPUT_CHAR:
|
||||
case GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR:
|
||||
case GUI_COLOR_BAR_MOVE_CURSOR_CHAR:
|
||||
case GUI_COLOR_BAR_START_ITEM:
|
||||
case GUI_COLOR_BAR_START_LINE_ITEM:
|
||||
string++;
|
||||
break;
|
||||
}
|
||||
|
||||
+200
-155
@@ -40,8 +40,10 @@
|
||||
#include "../gui-key.h"
|
||||
#include "../gui-buffer.h"
|
||||
#include "../gui-color.h"
|
||||
#include "../gui-input.h"
|
||||
#include "../gui-cursor.h"
|
||||
#include "../gui-completion.h"
|
||||
#include "../gui-input.h"
|
||||
#include "../gui-mouse.h"
|
||||
#include "../gui-window.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -79,145 +81,193 @@ gui_key_default_bindings (int context)
|
||||
int i;
|
||||
char key_str[32], command[32];
|
||||
|
||||
switch (context)
|
||||
if (context == GUI_KEY_CONTEXT_DEFAULT)
|
||||
{
|
||||
case GUI_KEY_CONTEXT_DEFAULT:
|
||||
BIND(/* RC */ "ctrl-M", "/input return");
|
||||
BIND(/* RC */ "ctrl-J", "/input return");
|
||||
BIND(/* tab */ "ctrl-I", "/input complete_next");
|
||||
BIND(/* s-tab */ "meta2-Z", "/input complete_previous");
|
||||
BIND(/* ^R */ "ctrl-R", "/input search_text");
|
||||
BIND(/* basckpace */ "ctrl-H", "/input delete_previous_char");
|
||||
BIND(/* basckpace */ "ctrl-?", "/input delete_previous_char");
|
||||
BIND(/* ^_ */ "ctrl-_", "/input undo");
|
||||
BIND(/* m-_ */ "meta-_", "/input redo");
|
||||
BIND(/* del */ "meta2-3~", "/input delete_next_char");
|
||||
BIND(/* ^D */ "ctrl-D", "/input delete_next_char");
|
||||
BIND(/* ^W */ "ctrl-W", "/input delete_previous_word");
|
||||
BIND(/* ^X */ "ctrl-X", "/input switch_active_buffer");
|
||||
BIND(/* m-d */ "meta-d", "/input delete_next_word");
|
||||
BIND(/* ^K */ "ctrl-K", "/input delete_end_of_line");
|
||||
BIND(/* m-r */ "meta-r", "/input delete_line");
|
||||
BIND(/* ^T */ "ctrl-T", "/input transpose_chars");
|
||||
BIND(/* ^U */ "ctrl-U", "/input delete_beginning_of_line");
|
||||
BIND(/* ^Y */ "ctrl-Y", "/input clipboard_paste");
|
||||
BIND(/* home */ "meta2-1~", "/input move_beginning_of_line");
|
||||
BIND(/* home */ "meta2-H", "/input move_beginning_of_line");
|
||||
BIND(/* home */ "meta2-7~", "/input move_beginning_of_line");
|
||||
BIND(/* home */ "meta-OH", "/input move_beginning_of_line");
|
||||
BIND(/* ^A */ "ctrl-A", "/input move_beginning_of_line");
|
||||
BIND(/* end */ "meta2-4~", "/input move_end_of_line");
|
||||
BIND(/* end */ "meta2-F", "/input move_end_of_line");
|
||||
BIND(/* end */ "meta2-8~", "/input move_end_of_line");
|
||||
BIND(/* end */ "meta-OF", "/input move_end_of_line");
|
||||
BIND(/* ^E */ "ctrl-E", "/input move_end_of_line");
|
||||
BIND(/* left */ "meta2-D", "/input move_previous_char");
|
||||
BIND(/* ^B */ "ctrl-B", "/input move_previous_char");
|
||||
BIND(/* right */ "meta2-C", "/input move_next_char");
|
||||
BIND(/* ^F */ "ctrl-F", "/input move_next_char");
|
||||
BIND(/* m-b */ "meta-b", "/input move_previous_word");
|
||||
BIND(/* ^left */ "meta-Od", "/input move_previous_word");
|
||||
BIND(/* ^left */ "meta-OD", "/input move_previous_word");
|
||||
BIND(/* m-f */ "meta-f", "/input move_next_word");
|
||||
BIND(/* ^right */ "meta-Oc", "/input move_next_word");
|
||||
BIND(/* ^right */ "meta-OC", "/input move_next_word");
|
||||
BIND(/* up */ "meta2-A", "/input history_previous");
|
||||
BIND(/* down */ "meta2-B", "/input history_next");
|
||||
BIND(/* ^up */ "meta-Oa", "/input history_global_previous");
|
||||
BIND(/* ^up */ "meta-OA", "/input history_global_previous");
|
||||
BIND(/* ^up */ "meta2-1;5A", "/input history_global_previous");
|
||||
BIND(/* ^down */ "meta-Ob", "/input history_global_next");
|
||||
BIND(/* ^down */ "meta-OB", "/input history_global_next");
|
||||
BIND(/* ^down */ "meta2-1;5B", "/input history_global_next");
|
||||
BIND(/* m-a */ "meta-a", "/input jump_smart");
|
||||
BIND(/* m-j,m-l */ "meta-jmeta-l", "/input jump_last_buffer");
|
||||
BIND(/* m-j,m-r */ "meta-jmeta-r", "/server raw");
|
||||
BIND(/* m-j,m-s */ "meta-jmeta-s", "/server jump");
|
||||
BIND(/* m-h */ "meta-h", "/input hotlist_clear");
|
||||
BIND(/* m-k */ "meta-k", "/input grab_key_command");
|
||||
BIND(/* m-u */ "meta-u", "/input scroll_unread");
|
||||
BIND(/* ^S^U */ "ctrl-Sctrl-U", "/input set_unread");
|
||||
BIND(/* ^Cb */ "ctrl-Cb", "/input insert \\x02");
|
||||
BIND(/* ^Cc */ "ctrl-Cc", "/input insert \\x03");
|
||||
BIND(/* ^Ci */ "ctrl-Ci", "/input insert \\x1D");
|
||||
BIND(/* ^Co */ "ctrl-Co", "/input insert \\x0F");
|
||||
BIND(/* ^Cr */ "ctrl-Cr", "/input insert \\x12");
|
||||
BIND(/* ^Cu */ "ctrl-Cu", "/input insert \\x15");
|
||||
BIND(/* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
BIND(/* m-right */ "meta2-1;3C", "/buffer +1");
|
||||
BIND(/* m-down */ "meta-meta2-B", "/buffer +1");
|
||||
BIND(/* m-down */ "meta2-1;3B", "/buffer +1");
|
||||
BIND(/* F6 */ "meta2-17~", "/buffer +1");
|
||||
BIND(/* ^N */ "ctrl-N", "/buffer +1");
|
||||
BIND(/* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
BIND(/* m-left */ "meta2-1;3D", "/buffer -1");
|
||||
BIND(/* m-up */ "meta-meta2-A", "/buffer -1");
|
||||
BIND(/* m-up */ "meta2-1;3A", "/buffer -1");
|
||||
BIND(/* F5 */ "meta2-15~", "/buffer -1");
|
||||
BIND(/* ^P */ "ctrl-P", "/buffer -1");
|
||||
BIND(/* pgup */ "meta2-5~", "/window page_up");
|
||||
BIND(/* pgup */ "meta2-I", "/window page_up");
|
||||
BIND(/* pgdn */ "meta2-6~", "/window page_down");
|
||||
BIND(/* pgdn */ "meta2-G", "/window page_down");
|
||||
BIND(/* m-pgup */ "meta-meta2-5~", "/window scroll_up");
|
||||
BIND(/* m-pgup */ "meta2-5;3~", "/window scroll_up");
|
||||
BIND(/* m-pgdn */ "meta-meta2-6~", "/window scroll_down");
|
||||
BIND(/* m-pgdn */ "meta2-6;3~", "/window scroll_down");
|
||||
BIND(/* m-home */ "meta-meta2-1~", "/window scroll_top");
|
||||
BIND(/* m-home */ "meta-meta2-7~", "/window scroll_top");
|
||||
BIND(/* m-end */ "meta-meta2-4~", "/window scroll_bottom");
|
||||
BIND(/* m-end */ "meta-meta2-8~", "/window scroll_bottom");
|
||||
BIND(/* m-n */ "meta-n", "/window scroll_next_highlight");
|
||||
BIND(/* m-p */ "meta-p", "/window scroll_previous_highlight");
|
||||
BIND(/* F9 */ "meta2-20~", "/bar scroll title * x-50%");
|
||||
BIND(/* F10 */ "meta2-21~", "/bar scroll title * x+50%");
|
||||
BIND(/* F11 */ "meta2-23~", "/bar scroll nicklist * y-100%");
|
||||
BIND(/* F12 */ "meta2-24~", "/bar scroll nicklist * y+100%");
|
||||
BIND(/* m-F11 */ "meta-meta2-23~", "/bar scroll nicklist * yb");
|
||||
BIND(/* m-F12 */ "meta-meta2-24~", "/bar scroll nicklist * ye");
|
||||
BIND(/* ^L */ "ctrl-L", "/window refresh");
|
||||
BIND(/* F7 */ "meta2-18~", "/window -1");
|
||||
BIND(/* F8 */ "meta2-19~", "/window +1");
|
||||
BIND(/* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
|
||||
BIND(/* m-w,m-up */ "meta-wmeta2-1;3A", "/window up");
|
||||
BIND(/* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
|
||||
BIND(/* m-w,m-down */ "meta-wmeta2-1;3B", "/window down");
|
||||
BIND(/* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
|
||||
BIND(/* m-w,m-right */ "meta-wmeta2-1;3C", "/window right");
|
||||
BIND(/* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
|
||||
BIND(/* m-w,m-left */ "meta-wmeta2-1;3D", "/window left");
|
||||
BIND(/* m-w,m-b */ "meta-wmeta-b", "/window balance");
|
||||
BIND(/* m-w,m-s */ "meta-wmeta-s", "/window swap");
|
||||
BIND(/* m-z */ "meta-z", "/window zoom");
|
||||
BIND(/* m-= */ "meta-=", "/filter toggle");
|
||||
BIND(/* m-0 */ "meta-0", "/buffer *10");
|
||||
BIND(/* m-1 */ "meta-1", "/buffer *1");
|
||||
BIND(/* m-2 */ "meta-2", "/buffer *2");
|
||||
BIND(/* m-3 */ "meta-3", "/buffer *3");
|
||||
BIND(/* m-4 */ "meta-4", "/buffer *4");
|
||||
BIND(/* m-5 */ "meta-5", "/buffer *5");
|
||||
BIND(/* m-6 */ "meta-6", "/buffer *6");
|
||||
BIND(/* m-7 */ "meta-7", "/buffer *7");
|
||||
BIND(/* m-8 */ "meta-8", "/buffer *8");
|
||||
BIND(/* m-9 */ "meta-9", "/buffer *9");
|
||||
BIND(/* m-< */ "meta-<", "/input jump_previously_visited_buffer");
|
||||
BIND(/* m-> */ "meta->", "/input jump_next_visited_buffer");
|
||||
|
||||
/* bind meta-j + {01..99} to switch to buffers # > 10 */
|
||||
for (i = 1; i < 100; i++)
|
||||
{
|
||||
sprintf (key_str, "meta-j%02d", i);
|
||||
sprintf (command, "/buffer %d", i);
|
||||
BIND(key_str, command);
|
||||
}
|
||||
break;
|
||||
case GUI_KEY_CONTEXT_SEARCH:
|
||||
BIND(/* RC */ "ctrl-M", "/input search_stop");
|
||||
BIND(/* RC */ "ctrl-J", "/input search_stop");
|
||||
BIND(/* ^R */ "ctrl-R", "/input search_switch_case");
|
||||
BIND(/* up */ "meta2-A", "/input search_previous");
|
||||
BIND(/* down */ "meta2-B", "/input search_next");
|
||||
break;
|
||||
BIND(/* Enter */ "ctrl-M", "/input return");
|
||||
BIND(/* Enter */ "ctrl-J", "/input return");
|
||||
BIND(/* tab */ "ctrl-I", "/input complete_next");
|
||||
BIND(/* s-tab */ "meta2-Z", "/input complete_previous");
|
||||
BIND(/* ^R */ "ctrl-R", "/input search_text");
|
||||
BIND(/* basckpace */ "ctrl-H", "/input delete_previous_char");
|
||||
BIND(/* basckpace */ "ctrl-?", "/input delete_previous_char");
|
||||
BIND(/* ^_ */ "ctrl-_", "/input undo");
|
||||
BIND(/* m-_ */ "meta-_", "/input redo");
|
||||
BIND(/* del */ "meta2-3~", "/input delete_next_char");
|
||||
BIND(/* ^D */ "ctrl-D", "/input delete_next_char");
|
||||
BIND(/* ^W */ "ctrl-W", "/input delete_previous_word");
|
||||
BIND(/* ^X */ "ctrl-X", "/input switch_active_buffer");
|
||||
BIND(/* m-d */ "meta-d", "/input delete_next_word");
|
||||
BIND(/* ^K */ "ctrl-K", "/input delete_end_of_line");
|
||||
BIND(/* m-r */ "meta-r", "/input delete_line");
|
||||
BIND(/* ^T */ "ctrl-T", "/input transpose_chars");
|
||||
BIND(/* ^U */ "ctrl-U", "/input delete_beginning_of_line");
|
||||
BIND(/* ^Y */ "ctrl-Y", "/input clipboard_paste");
|
||||
BIND(/* home */ "meta2-1~", "/input move_beginning_of_line");
|
||||
BIND(/* home */ "meta2-H", "/input move_beginning_of_line");
|
||||
BIND(/* home */ "meta2-7~", "/input move_beginning_of_line");
|
||||
BIND(/* home */ "meta-OH", "/input move_beginning_of_line");
|
||||
BIND(/* ^A */ "ctrl-A", "/input move_beginning_of_line");
|
||||
BIND(/* end */ "meta2-4~", "/input move_end_of_line");
|
||||
BIND(/* end */ "meta2-F", "/input move_end_of_line");
|
||||
BIND(/* end */ "meta2-8~", "/input move_end_of_line");
|
||||
BIND(/* end */ "meta-OF", "/input move_end_of_line");
|
||||
BIND(/* ^E */ "ctrl-E", "/input move_end_of_line");
|
||||
BIND(/* left */ "meta2-D", "/input move_previous_char");
|
||||
BIND(/* ^B */ "ctrl-B", "/input move_previous_char");
|
||||
BIND(/* right */ "meta2-C", "/input move_next_char");
|
||||
BIND(/* ^F */ "ctrl-F", "/input move_next_char");
|
||||
BIND(/* m-b */ "meta-b", "/input move_previous_word");
|
||||
BIND(/* ^left */ "meta-Od", "/input move_previous_word");
|
||||
BIND(/* ^left */ "meta-OD", "/input move_previous_word");
|
||||
BIND(/* m-f */ "meta-f", "/input move_next_word");
|
||||
BIND(/* ^right */ "meta-Oc", "/input move_next_word");
|
||||
BIND(/* ^right */ "meta-OC", "/input move_next_word");
|
||||
BIND(/* up */ "meta2-A", "/input history_previous");
|
||||
BIND(/* down */ "meta2-B", "/input history_next");
|
||||
BIND(/* ^up */ "meta-Oa", "/input history_global_previous");
|
||||
BIND(/* ^up */ "meta-OA", "/input history_global_previous");
|
||||
BIND(/* ^up */ "meta2-1;5A", "/input history_global_previous");
|
||||
BIND(/* ^down */ "meta-Ob", "/input history_global_next");
|
||||
BIND(/* ^down */ "meta-OB", "/input history_global_next");
|
||||
BIND(/* ^down */ "meta2-1;5B", "/input history_global_next");
|
||||
BIND(/* m-a */ "meta-a", "/input jump_smart");
|
||||
BIND(/* m-j,m-l */ "meta-jmeta-l", "/input jump_last_buffer");
|
||||
BIND(/* m-j,m-r */ "meta-jmeta-r", "/server raw");
|
||||
BIND(/* m-j,m-s */ "meta-jmeta-s", "/server jump");
|
||||
BIND(/* m-h */ "meta-h", "/input hotlist_clear");
|
||||
BIND(/* m-k */ "meta-k", "/input grab_key_command");
|
||||
BIND(/* m-u */ "meta-u", "/input scroll_unread");
|
||||
BIND(/* ^S^U */ "ctrl-Sctrl-U", "/input set_unread");
|
||||
BIND(/* ^Cb */ "ctrl-Cb", "/input insert \\x02");
|
||||
BIND(/* ^Cc */ "ctrl-Cc", "/input insert \\x03");
|
||||
BIND(/* ^Ci */ "ctrl-Ci", "/input insert \\x1D");
|
||||
BIND(/* ^Co */ "ctrl-Co", "/input insert \\x0F");
|
||||
BIND(/* ^Cr */ "ctrl-Cr", "/input insert \\x12");
|
||||
BIND(/* ^Cu */ "ctrl-Cu", "/input insert \\x15");
|
||||
BIND(/* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
BIND(/* m-right */ "meta2-1;3C", "/buffer +1");
|
||||
BIND(/* m-down */ "meta-meta2-B", "/buffer +1");
|
||||
BIND(/* m-down */ "meta2-1;3B", "/buffer +1");
|
||||
BIND(/* F6 */ "meta2-17~", "/buffer +1");
|
||||
BIND(/* ^N */ "ctrl-N", "/buffer +1");
|
||||
BIND(/* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
BIND(/* m-left */ "meta2-1;3D", "/buffer -1");
|
||||
BIND(/* m-up */ "meta-meta2-A", "/buffer -1");
|
||||
BIND(/* m-up */ "meta2-1;3A", "/buffer -1");
|
||||
BIND(/* F5 */ "meta2-15~", "/buffer -1");
|
||||
BIND(/* ^P */ "ctrl-P", "/buffer -1");
|
||||
BIND(/* pgup */ "meta2-5~", "/window page_up");
|
||||
BIND(/* pgup */ "meta2-I", "/window page_up");
|
||||
BIND(/* pgdn */ "meta2-6~", "/window page_down");
|
||||
BIND(/* pgdn */ "meta2-G", "/window page_down");
|
||||
BIND(/* m-pgup */ "meta-meta2-5~", "/window scroll_up");
|
||||
BIND(/* m-pgup */ "meta2-5;3~", "/window scroll_up");
|
||||
BIND(/* m-pgdn */ "meta-meta2-6~", "/window scroll_down");
|
||||
BIND(/* m-pgdn */ "meta2-6;3~", "/window scroll_down");
|
||||
BIND(/* m-home */ "meta-meta2-1~", "/window scroll_top");
|
||||
BIND(/* m-home */ "meta-meta2-7~", "/window scroll_top");
|
||||
BIND(/* m-end */ "meta-meta2-4~", "/window scroll_bottom");
|
||||
BIND(/* m-end */ "meta-meta2-8~", "/window scroll_bottom");
|
||||
BIND(/* m-n */ "meta-n", "/window scroll_next_highlight");
|
||||
BIND(/* m-p */ "meta-p", "/window scroll_previous_highlight");
|
||||
BIND(/* F9 */ "meta2-20~", "/bar scroll title * -30%");
|
||||
BIND(/* F10 */ "meta2-21~", "/bar scroll title * +30%");
|
||||
BIND(/* F11 */ "meta2-23~", "/bar scroll nicklist * -100%");
|
||||
BIND(/* F12 */ "meta2-24~", "/bar scroll nicklist * +100%");
|
||||
BIND(/* m-F11 */ "meta-meta2-23~", "/bar scroll nicklist * b");
|
||||
BIND(/* m-F12 */ "meta-meta2-24~", "/bar scroll nicklist * e");
|
||||
BIND(/* ^L */ "ctrl-L", "/window refresh");
|
||||
BIND(/* F7 */ "meta2-18~", "/window -1");
|
||||
BIND(/* F8 */ "meta2-19~", "/window +1");
|
||||
BIND(/* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
|
||||
BIND(/* m-w,m-up */ "meta-wmeta2-1;3A", "/window up");
|
||||
BIND(/* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
|
||||
BIND(/* m-w,m-down */ "meta-wmeta2-1;3B", "/window down");
|
||||
BIND(/* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
|
||||
BIND(/* m-w,m-right */ "meta-wmeta2-1;3C", "/window right");
|
||||
BIND(/* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
|
||||
BIND(/* m-w,m-left */ "meta-wmeta2-1;3D", "/window left");
|
||||
BIND(/* m-w,m-b */ "meta-wmeta-b", "/window balance");
|
||||
BIND(/* m-w,m-s */ "meta-wmeta-s", "/window swap");
|
||||
BIND(/* m-z */ "meta-z", "/window zoom");
|
||||
BIND(/* m-= */ "meta-=", "/filter toggle");
|
||||
BIND(/* m-0 */ "meta-0", "/buffer *10");
|
||||
BIND(/* m-1 */ "meta-1", "/buffer *1");
|
||||
BIND(/* m-2 */ "meta-2", "/buffer *2");
|
||||
BIND(/* m-3 */ "meta-3", "/buffer *3");
|
||||
BIND(/* m-4 */ "meta-4", "/buffer *4");
|
||||
BIND(/* m-5 */ "meta-5", "/buffer *5");
|
||||
BIND(/* m-6 */ "meta-6", "/buffer *6");
|
||||
BIND(/* m-7 */ "meta-7", "/buffer *7");
|
||||
BIND(/* m-8 */ "meta-8", "/buffer *8");
|
||||
BIND(/* m-9 */ "meta-9", "/buffer *9");
|
||||
BIND(/* m-< */ "meta-<", "/input jump_previously_visited_buffer");
|
||||
BIND(/* m-> */ "meta->", "/input jump_next_visited_buffer");
|
||||
BIND(/* mouse */ "meta2-M", "/mouse grab");
|
||||
BIND(/* m-m */ "meta-m", "/mouse toggle");
|
||||
|
||||
/* bind meta-j + {01..99} to switch to buffers # > 10 */
|
||||
for (i = 1; i < 100; i++)
|
||||
{
|
||||
sprintf (key_str, "meta-j%02d", i);
|
||||
sprintf (command, "/buffer %d", i);
|
||||
BIND(key_str, command);
|
||||
}
|
||||
}
|
||||
else if (context == GUI_KEY_CONTEXT_SEARCH)
|
||||
{
|
||||
BIND(/* Enter */ "ctrl-M", "/input search_stop");
|
||||
BIND(/* Enter */ "ctrl-J", "/input search_stop");
|
||||
BIND(/* ^R */ "ctrl-R", "/input search_switch_case");
|
||||
BIND(/* up */ "meta2-A", "/input search_previous");
|
||||
BIND(/* down */ "meta2-B", "/input search_next");
|
||||
}
|
||||
else if (context == GUI_KEY_CONTEXT_CURSOR)
|
||||
{
|
||||
BIND(/* Enter */ "ctrl-M", "/cursor stop");
|
||||
BIND(/* Enter */ "ctrl-J", "/cursor stop");
|
||||
BIND(/* up */ "meta2-A", "/cursor move up");
|
||||
BIND(/* down */ "meta2-B", "/cursor move down");
|
||||
BIND(/* left */ "meta2-D", "/cursor move left");
|
||||
BIND(/* right */ "meta2-C", "/cursor move right");
|
||||
BIND(/* m-up */ "meta-meta2-A", "/cursor move area_up");
|
||||
BIND(/* m-up */ "meta2-1;3A", "/cursor move area_up");
|
||||
BIND(/* m-down */ "meta-meta2-B", "/cursor move area_down");
|
||||
BIND(/* m-down */ "meta2-1;3B", "/cursor move area_down");
|
||||
BIND(/* m-left */ "meta-meta2-D", "/cursor move area_left");
|
||||
BIND(/* m-left */ "meta2-1;3D", "/cursor move area_left");
|
||||
BIND(/* m-right */ "meta-meta2-C", "/cursor move area_right");
|
||||
BIND(/* m-right */ "meta2-1;3C", "/cursor move area_right");
|
||||
BIND(/* b */ "@item(buffer_nicklist):b", "/ban ${nick}");
|
||||
BIND(/* k */ "@item(buffer_nicklist):k", "/kick ${nick}");
|
||||
BIND(/* K */ "@item(buffer_nicklist):K", "/kickban ${nick}");
|
||||
BIND(/* q */ "@item(buffer_nicklist):q", "/query ${nick};/cursor stop");
|
||||
BIND(/* w */ "@item(buffer_nicklist):w", "/whois ${nick}");
|
||||
}
|
||||
else if (context == GUI_KEY_CONTEXT_MOUSE)
|
||||
{
|
||||
/* mouse events on chat area */
|
||||
BIND("@chat:button1-gesture-left", "/buffer -1");
|
||||
BIND("@chat:button1-gesture-right", "/buffer +1");
|
||||
BIND("@chat:button1-gesture-left-long", "/buffer 1");
|
||||
BIND("@chat:button1-gesture-right-long", "/input jump_last_buffer");
|
||||
BIND("@chat:wheelup", "/window scroll_up");
|
||||
BIND("@chat:wheeldown", "/window scroll_down");
|
||||
/* mouse events on nicklist */
|
||||
BIND("@bar(nicklist):button1-gesture-up", "/bar scroll nicklist * -100%");
|
||||
BIND("@bar(nicklist):button1-gesture-down", "/bar scroll nicklist * +100%");
|
||||
BIND("@bar(nicklist):button1-gesture-up-long", "/bar scroll nicklist * b");
|
||||
BIND("@bar(nicklist):button1-gesture-down-long", "/bar scroll nicklist * e");
|
||||
BIND("@item(buffer_nicklist):button1", "/query ${nick}");
|
||||
BIND("@item(buffer_nicklist):button2", "/whois ${nick}");
|
||||
BIND("@item(buffer_nicklist):button1-gesture-left", "/kick ${nick}");
|
||||
BIND("@item(buffer_nicklist):button1-gesture-left-long", "/kickban ${nick}");
|
||||
BIND("@item(buffer_nicklist):button2-gesture-left", "/ban ${nick}");
|
||||
/* mouse wheel on any bar */
|
||||
BIND("@bar(*):wheelup", "/bar scroll ${_bar_name} * -10%");
|
||||
BIND("@bar(*):wheeldown", "/bar scroll ${_bar_name} * +10%");
|
||||
/* middle click to enable cursor mode at position */
|
||||
BIND("@*:button3", "/cursor go ${_x},${_y}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,16 +296,22 @@ gui_key_flush ()
|
||||
|
||||
insert_ok = 1;
|
||||
|
||||
if (key < 32)
|
||||
if (gui_mouse_grab)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
else if (key < 32)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '\x01';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else if (key == 127)
|
||||
{
|
||||
key_str[0] = '^';
|
||||
key_str[0] = '\x01';
|
||||
key_str[1] = '?';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
@@ -339,12 +395,6 @@ gui_key_flush ()
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp (key_str, "^") == 0)
|
||||
{
|
||||
key_str[1] = '^';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
|
||||
hook_signal_send ("key_pressed",
|
||||
WEECHAT_HOOK_SIGNAL_STRING, key_str);
|
||||
|
||||
@@ -354,11 +404,9 @@ gui_key_flush ()
|
||||
else
|
||||
input_old = NULL;
|
||||
|
||||
if ((gui_key_pressed (key_str) != 0) && (insert_ok))
|
||||
if ((gui_key_pressed (key_str) != 0) && (insert_ok)
|
||||
&& (!gui_cursor_mode))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
gui_buffer_undo_snap (gui_current_window->buffer);
|
||||
gui_input_insert_string (gui_current_window->buffer,
|
||||
key_str, -1);
|
||||
@@ -405,9 +453,6 @@ gui_key_flush ()
|
||||
free (input_old);
|
||||
}
|
||||
|
||||
if (gui_key_grab && (gui_key_grab_count > 0))
|
||||
gui_key_grab_end ();
|
||||
|
||||
gui_key_buffer_reset ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,10 +48,12 @@
|
||||
#include "../gui-buffer.h"
|
||||
#include "../gui-chat.h"
|
||||
#include "../gui-color.h"
|
||||
#include "../gui-cursor.h"
|
||||
#include "../gui-filter.h"
|
||||
#include "../gui-input.h"
|
||||
#include "../gui-layout.h"
|
||||
#include "../gui-history.h"
|
||||
#include "../gui-mouse.h"
|
||||
#include "../gui-nicklist.h"
|
||||
#include "../gui-window.h"
|
||||
#include "gui-curses.h"
|
||||
@@ -149,7 +151,7 @@ gui_main_init ()
|
||||
|
||||
/*
|
||||
* create bar windows for root bars (they were read from config,
|
||||
* but no window was created (GUI was not initialized)
|
||||
* but no window was created, GUI was not initialized)
|
||||
*/
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
@@ -166,6 +168,11 @@ gui_main_init ()
|
||||
gui_bar_window_create_win (ptr_bar_win);
|
||||
}
|
||||
}
|
||||
|
||||
if (CONFIG_BOOLEAN(config_look_mouse))
|
||||
gui_mouse_enable ();
|
||||
else
|
||||
gui_mouse_disable ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -277,7 +284,6 @@ gui_main_refreshs ()
|
||||
}
|
||||
|
||||
/* refresh bars if needed */
|
||||
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
if (ptr_bar->bar_refresh_needed)
|
||||
@@ -285,6 +291,10 @@ gui_main_refreshs ()
|
||||
gui_bar_draw (ptr_bar);
|
||||
}
|
||||
}
|
||||
|
||||
/* move cursor (for cursor mode) */
|
||||
if (gui_cursor_mode)
|
||||
gui_window_move_cursor ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -387,6 +397,9 @@ gui_main_end (int clean_exit)
|
||||
gui_main_refreshs ();
|
||||
}
|
||||
|
||||
/* disable mouse */
|
||||
gui_mouse_disable ();
|
||||
|
||||
/* remove bar items and bars */
|
||||
gui_bar_item_end ();
|
||||
gui_bar_free_all ();
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* gui-curses-mouse.c: mouse functions for Curses GUI
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../../core/weechat.h"
|
||||
#include "../../core/wee-config.h"
|
||||
#include "../gui-chat.h"
|
||||
#include "../gui-mouse.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_mouse_enable: enable mouse
|
||||
*/
|
||||
|
||||
void
|
||||
gui_mouse_enable ()
|
||||
{
|
||||
gui_mouse_enabled = 1;
|
||||
fprintf (stderr, "\033[?1005h\033[?1000h\033[?1002h");
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_mouse_disable: disable mouse
|
||||
*/
|
||||
|
||||
void
|
||||
gui_mouse_disable ()
|
||||
{
|
||||
gui_mouse_enabled = 0;
|
||||
fprintf (stderr, "\033[?1002l\033[?1000l\033[?1005l");
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_mouse_display_state: display state of mouse
|
||||
*/
|
||||
|
||||
void
|
||||
gui_mouse_display_state ()
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
(CONFIG_BOOLEAN(config_look_mouse)) ?
|
||||
_("Mouse is enabled") : _("Mouse is disabled"));
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_mouse_grab_init: init "grab mouse" mode
|
||||
*/
|
||||
|
||||
void
|
||||
gui_mouse_grab_init ()
|
||||
{
|
||||
gui_mouse_grab = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_mouse_grab_code2key: get key name with a mouse code
|
||||
*/
|
||||
|
||||
const char *
|
||||
gui_mouse_grab_code2key (const char *code)
|
||||
{
|
||||
int x, y;
|
||||
double diff_x, diff_y, distance, angle, pi4;
|
||||
static char key[128];
|
||||
char button[2];
|
||||
|
||||
/* mouse code must have at least 3 chars */
|
||||
if (strlen (code) < 3)
|
||||
return NULL;
|
||||
|
||||
key[0] = '\0';
|
||||
|
||||
/* ignore code '#' (button released) if it's received as first event */
|
||||
if ((gui_mouse_event_index == 0) && (code[0] == '#'))
|
||||
return key;
|
||||
|
||||
/* get coordinates and button */
|
||||
x = ((unsigned char)code[1]) - 33;
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
y = ((unsigned char)code[2]) - 33;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
gui_mouse_event_x[gui_mouse_event_index] = x;
|
||||
gui_mouse_event_y[gui_mouse_event_index] = y;
|
||||
if (gui_mouse_event_index == 0)
|
||||
gui_mouse_event_button = code[0];
|
||||
|
||||
if (gui_mouse_event_index == 0)
|
||||
gui_mouse_event_index = 1;
|
||||
|
||||
if (code[0] == '`')
|
||||
{
|
||||
strcat (key, "wheelup");
|
||||
return key;
|
||||
}
|
||||
|
||||
if (code[0] == 'a')
|
||||
{
|
||||
strcat (key, "wheeldown");
|
||||
return key;
|
||||
}
|
||||
|
||||
if (code[0] != '#')
|
||||
return key;
|
||||
|
||||
/* add button/wheel */
|
||||
switch (gui_mouse_event_button)
|
||||
{
|
||||
case ' ': /* left button pressed */
|
||||
strcat (key, "button1");
|
||||
break;
|
||||
case '"': /* right button pressed */
|
||||
strcat (key, "button2");
|
||||
break;
|
||||
case '!': /* middle button pressed */
|
||||
strcat (key, "button3");
|
||||
break;
|
||||
default: /* extra buttons: button4..button9 */
|
||||
if ((gui_mouse_event_button >= 'b')
|
||||
&& (gui_mouse_event_button <= 'g'))
|
||||
{
|
||||
button[0] = gui_mouse_event_button - ('b' - '4');
|
||||
button[1] = '\0';
|
||||
strcat (key, "button");
|
||||
strcat (key, button);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mouse gesture: if (x,y) on release is different from (x,y) on click,
|
||||
* compute distance and angle between 2 points.
|
||||
*
|
||||
* Distance: sqrt((x2-x1)²+(y2-y1)²)
|
||||
* Angle : atan2(x1-x1, y2-y1)
|
||||
*
|
||||
* Angle:
|
||||
*
|
||||
* 3.14 pi
|
||||
* /\
|
||||
* -2.35 || 2.35 3/4 * pi
|
||||
* ||
|
||||
* -1.57 /----++----\ 1.57 1/2 * pi
|
||||
* \----++----/
|
||||
* ||
|
||||
* -0.78 || 0.78 1/4 * pi
|
||||
* \/
|
||||
* 0.00 0
|
||||
*
|
||||
* Possible returned gestures are:
|
||||
*
|
||||
* key name | dist. | angle
|
||||
* ---------------------------+-------+--------------------------
|
||||
* buttonX-gesture-up | 3..19 | -2.35..-3.14 + 2.35..3.14
|
||||
* buttonX-gesture-up-long | >= 20 |
|
||||
* buttonX-gesture-down | 3..19 | -0.78..0.78
|
||||
* buttonX-gesture-down-long | >= 20 |
|
||||
* buttonX-gesture-left | 3..39 | -0.78..-2.35
|
||||
* buttonX-gesture-left-long | >= 40 |
|
||||
* buttonX-gesture-right | 3..39 | 0.78..2.35
|
||||
* buttonX-gesture-right-long | >= 40 |
|
||||
*/
|
||||
|
||||
distance = 0;
|
||||
if (key[0]
|
||||
&& ((gui_mouse_event_x[0] != gui_mouse_event_x[1])
|
||||
|| (gui_mouse_event_y[0] != gui_mouse_event_y[1])))
|
||||
{
|
||||
diff_x = gui_mouse_event_x[1] - gui_mouse_event_x[0];
|
||||
diff_y = gui_mouse_event_y[1] - gui_mouse_event_y[0];
|
||||
distance = sqrt ((diff_x * diff_x) + (diff_y * diff_y));
|
||||
if (distance >= 3)
|
||||
{
|
||||
angle = atan2 ((double)(gui_mouse_event_x[1] - gui_mouse_event_x[0]),
|
||||
(double)(gui_mouse_event_y[1] - gui_mouse_event_y[0]));
|
||||
pi4 = 3.14159265358979 / 4;
|
||||
if ((angle <= pi4 * (-3)) || (angle >= pi4 * 3))
|
||||
{
|
||||
strcat (key, "-gesture-up");
|
||||
if (distance >= 20)
|
||||
strcat (key, "-long");
|
||||
}
|
||||
else if ((angle >= pi4 * (-1)) && (angle <= pi4))
|
||||
{
|
||||
strcat (key, "-gesture-down");
|
||||
if (distance >= 20)
|
||||
strcat (key, "-long");
|
||||
}
|
||||
else if ((angle >= pi4 * (-3)) && (angle <= pi4 * (-1)))
|
||||
{
|
||||
strcat (key, "-gesture-left");
|
||||
if (distance >= 40)
|
||||
strcat (key, "-long");
|
||||
}
|
||||
else if ((angle >= pi4) && (angle <= pi4 * 3))
|
||||
{
|
||||
strcat (key, "-gesture-right");
|
||||
if (distance >= 40)
|
||||
strcat (key, "-long");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_mouse_grab_end: end "grab mouse" mode
|
||||
*/
|
||||
|
||||
void
|
||||
gui_mouse_grab_end ()
|
||||
{
|
||||
gui_mouse_grab = 0;
|
||||
}
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "../gui-buffer.h"
|
||||
#include "../gui-chat.h"
|
||||
#include "../gui-color.h"
|
||||
#include "../gui-cursor.h"
|
||||
#include "../gui-hotlist.h"
|
||||
#include "../gui-input.h"
|
||||
#include "../gui-key.h"
|
||||
@@ -1514,7 +1515,8 @@ gui_window_refresh_windows ()
|
||||
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
|
||||
if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
|
||||
&& !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
|
||||
{
|
||||
gui_bar_window_calculate_pos_size (ptr_bar->bar_window, NULL);
|
||||
gui_bar_window_create_win (ptr_bar->bar_window);
|
||||
@@ -2196,6 +2198,20 @@ gui_window_set_title (const char *title)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_move_cursor: move cursor on screen (for cursor mode)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_move_cursor ()
|
||||
{
|
||||
if (gui_cursor_mode)
|
||||
{
|
||||
move (gui_cursor_y, gui_cursor_x);
|
||||
refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_term_display_infos: display some infos about terminal and colors
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user