mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 03:25:41 +02:00
buflist: add mouse support
New options: - buflist.look.mouse_jump_visited_buffer - buflist.look.mouse_move_buffer - buflist.look.mouse_wheel New keys added by buflist plugin: - @item(buflist):button1* => hsignal:buflist_mouse - @item(buflist):button2* => hsignal:buflist_mouse - @bar(buflist):ctrl-wheelup => hsignal:buflist_mouse - @bar(buflist):ctrl-wheeldown => hsignal:buflist_mouse
This commit is contained in:
@@ -21,7 +21,8 @@ add_library(buflist MODULE
|
||||
buflist.c buflist.h
|
||||
buflist-bar-item.c buflist-bar-item.h
|
||||
buflist-command.c buflist-command.h
|
||||
buflist-config.c buflist-config.h)
|
||||
buflist-config.c buflist-config.h
|
||||
buflist-mouse.c buflist-mouse.h)
|
||||
set_target_properties(buflist PROPERTIES PREFIX "")
|
||||
|
||||
target_link_libraries(buflist)
|
||||
|
||||
@@ -30,7 +30,9 @@ buflist_la_SOURCES = buflist.c \
|
||||
buflist-command.c \
|
||||
buflist-command.h \
|
||||
buflist-config.c \
|
||||
buflist-config.h
|
||||
buflist-config.h \
|
||||
buflist-mouse.c \
|
||||
buflist-mouse.h
|
||||
|
||||
buflist_la_LDFLAGS = -module -no-undefined
|
||||
buflist_la_LIBADD = $(BUFLIST_LFLAGS)
|
||||
|
||||
@@ -34,6 +34,7 @@ struct t_hashtable *buflist_hashtable_pointers = NULL;
|
||||
struct t_hashtable *buflist_hashtable_extra_vars = NULL;
|
||||
struct t_hashtable *buflist_hashtable_options = NULL;
|
||||
struct t_hashtable *buflist_hashtable_options_conditions = NULL;
|
||||
struct t_arraylist *buflist_list_buffers = NULL;
|
||||
|
||||
|
||||
/*
|
||||
@@ -92,6 +93,11 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
snprintf (str_format_number_empty, sizeof (str_format_number_empty),
|
||||
"%%-%ds", length_max_number);
|
||||
|
||||
if (buflist_list_buffers)
|
||||
weechat_arraylist_free (buflist_list_buffers);
|
||||
buflist_list_buffers = weechat_arraylist_new (16, 0, 1,
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
buffers = buflist_sort_buffers ();
|
||||
|
||||
for (i = 0; i < weechat_arraylist_size (buffers); i++)
|
||||
@@ -114,6 +120,8 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
if (!rc)
|
||||
continue;
|
||||
|
||||
weechat_arraylist_add (buflist_list_buffers, ptr_buffer);
|
||||
|
||||
current_buffer = (ptr_buffer == ptr_current_buffer);
|
||||
|
||||
ptr_hotlist = weechat_hdata_pointer (buflist_hdata_buffer,
|
||||
@@ -373,4 +381,10 @@ buflist_bar_item_end ()
|
||||
|
||||
weechat_hashtable_free (buflist_hashtable_options_conditions);
|
||||
buflist_hashtable_options_conditions = NULL;
|
||||
|
||||
if (buflist_list_buffers)
|
||||
{
|
||||
weechat_arraylist_free (buflist_list_buffers);
|
||||
buflist_list_buffers = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#define BUFLIST_BAR_ITEM_NAME "buflist"
|
||||
|
||||
extern struct t_arraylist *buflist_list_buffers;
|
||||
|
||||
extern int buflist_bar_item_init ();
|
||||
extern void buflist_bar_item_end ();
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ struct t_config_file *buflist_config_file = NULL;
|
||||
/* buflist config, look section */
|
||||
|
||||
struct t_config_option *buflist_config_look_display_conditions;
|
||||
struct t_config_option *buflist_config_look_mouse_jump_visited_buffer;
|
||||
struct t_config_option *buflist_config_look_mouse_move_buffer;
|
||||
struct t_config_option *buflist_config_look_mouse_wheel;
|
||||
struct t_config_option *buflist_config_look_signals_refresh;
|
||||
struct t_config_option *buflist_config_look_sort;
|
||||
|
||||
@@ -218,6 +221,32 @@ buflist_config_init ()
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_signals_refresh, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
buflist_config_look_mouse_jump_visited_buffer = weechat_config_new_option (
|
||||
buflist_config_file, ptr_section,
|
||||
"mouse_jump_visited_buffer", "boolean",
|
||||
N_("if enabled, clicks with left/right buttons on the line with "
|
||||
"current buffer jump to previous/next visited buffer"),
|
||||
NULL, 0, 0, "off", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
buflist_config_look_mouse_move_buffer = weechat_config_new_option (
|
||||
buflist_config_file, ptr_section,
|
||||
"mouse_move_buffer", "boolean",
|
||||
N_("if enabled, mouse gestures (drag & drop) move buffers in list"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
buflist_config_look_mouse_wheel = weechat_config_new_option (
|
||||
buflist_config_file, ptr_section,
|
||||
"mouse_wheel", "boolean",
|
||||
N_("if enabled, mouse wheel up/down actions jump to previous/next "
|
||||
"buffer in list"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
buflist_config_look_signals_refresh = weechat_config_new_option (
|
||||
buflist_config_file, ptr_section,
|
||||
"signals_refresh", "string",
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
extern struct t_config_file *buflist_config_file;
|
||||
|
||||
extern struct t_config_option *buflist_config_look_display_conditions;
|
||||
extern struct t_config_option *buflist_config_look_mouse_jump_visited_buffer;
|
||||
extern struct t_config_option *buflist_config_look_mouse_move_buffer;
|
||||
extern struct t_config_option *buflist_config_look_mouse_wheel;
|
||||
extern struct t_config_option *buflist_config_look_signals_refresh;
|
||||
extern struct t_config_option *buflist_config_look_sort;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2017 Sébastien 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/>.
|
||||
*/
|
||||
|
||||
#ifndef WEECHAT_BUFLIST_MOUSE_H
|
||||
#define WEECHAT_BUFLIST_MOUSE_H 1
|
||||
|
||||
#define BUFLIST_MOUSE_HSIGNAL "buflist_mouse"
|
||||
|
||||
extern int buflist_mouse_init ();
|
||||
extern void buflist_mouse_end ();
|
||||
|
||||
#endif /* WEECHAT_BUFLIST_MOUSE_H */
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "buflist-bar-item.h"
|
||||
#include "buflist-command.h"
|
||||
#include "buflist-config.h"
|
||||
#include "buflist-mouse.h"
|
||||
|
||||
|
||||
WEECHAT_PLUGIN_NAME(BUFLIST_PLUGIN_NAME);
|
||||
@@ -253,6 +254,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
|
||||
|
||||
buflist_mouse_init ();
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -266,6 +269,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
buflist_mouse_end ();
|
||||
|
||||
buflist_bar_item_end ();
|
||||
|
||||
buflist_config_write ();
|
||||
|
||||
Reference in New Issue
Block a user