mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 05:16:38 +02:00
Added infolist "window", scroll in buffers with free content, fixed config hooks (use of string_match)
This commit is contained in:
+1
-2
@@ -990,8 +990,7 @@ hook_config_exec (char *option, char *value)
|
||||
if (!ptr_hook->deleted
|
||||
&& !ptr_hook->running
|
||||
&& (!HOOK_CONFIG(ptr_hook, option)
|
||||
|| (string_strcasecmp (HOOK_CONFIG(ptr_hook, option),
|
||||
option) == 0)))
|
||||
|| (string_match (option, HOOK_CONFIG(ptr_hook, option), 0))))
|
||||
{
|
||||
ptr_hook->running = 1;
|
||||
(void) (HOOK_CONFIG(ptr_hook, callback))
|
||||
|
||||
@@ -1259,6 +1259,8 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
wnoutrefresh (GUI_CURSES(ptr_win)->win_chat);
|
||||
}
|
||||
|
||||
+212
-104
@@ -553,6 +553,8 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
|
||||
if (window->buffer != buffer)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
window->buffer->last_read_line = window->buffer->last_line;
|
||||
if (buffer->last_read_line == buffer->last_line)
|
||||
buffer->last_read_line = NULL;
|
||||
@@ -622,9 +624,6 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
window->win_status_y,
|
||||
window->win_status_x);
|
||||
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
|
||||
buffer->num_displayed++;
|
||||
|
||||
gui_hotlist_remove_buffer (buffer);
|
||||
@@ -647,23 +646,42 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
void
|
||||
gui_window_page_up (struct t_gui_window *window)
|
||||
{
|
||||
char scroll[32];
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
if (!window->first_line_displayed)
|
||||
switch (window->buffer->type)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
(window->start_line) ?
|
||||
(-1) * (window->win_chat_height - 1) :
|
||||
(-1) * ((window->win_chat_height - 1) * 2));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
if (!window->first_line_displayed)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
(window->start_line) ?
|
||||
(-1) * (window->win_chat_height - 1) :
|
||||
(-1) * ((window->win_chat_height - 1) * 2));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
if (window->start_line)
|
||||
{
|
||||
snprintf (scroll, sizeof (scroll), "-%d",
|
||||
window->win_chat_height);
|
||||
gui_window_scroll (window, scroll);
|
||||
hook_signal_send ("window_scrolled",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, window);
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,36 +694,51 @@ gui_window_page_down (struct t_gui_window *window)
|
||||
{
|
||||
struct t_gui_line *ptr_line;
|
||||
int line_pos;
|
||||
char scroll[32];
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
if (window->start_line)
|
||||
switch (window->buffer->type)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
window->win_chat_height - 1);
|
||||
|
||||
/* check if we can display all */
|
||||
ptr_line = window->start_line;
|
||||
line_pos = window->start_line_pos;
|
||||
gui_chat_calculate_line_diff (window, &ptr_line,
|
||||
&line_pos,
|
||||
window->win_chat_height - 1);
|
||||
if (!ptr_line)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
if (window->start_line)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
window->win_chat_height - 1);
|
||||
|
||||
/* check if we can display all */
|
||||
ptr_line = window->start_line;
|
||||
line_pos = window->start_line_pos;
|
||||
gui_chat_calculate_line_diff (window, &ptr_line,
|
||||
&line_pos,
|
||||
window->win_chat_height - 1);
|
||||
if (!ptr_line)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
snprintf (scroll, sizeof (scroll), "+%d",
|
||||
window->win_chat_height);
|
||||
gui_window_scroll (window, scroll);
|
||||
hook_signal_send ("window_scrolled",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, window);
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,25 +749,44 @@ gui_window_page_down (struct t_gui_window *window)
|
||||
void
|
||||
gui_window_scroll_up (struct t_gui_window *window)
|
||||
{
|
||||
char scroll[32];
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
if (!window->first_line_displayed)
|
||||
|
||||
switch (window->buffer->type)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
(window->start_line) ?
|
||||
(-1) * CONFIG_INTEGER(config_look_scroll_amount) :
|
||||
(-1) * ( (window->win_chat_height - 1) +
|
||||
CONFIG_INTEGER(config_look_scroll_amount)));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
if (!window->first_line_displayed)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
(window->start_line) ?
|
||||
(-1) * CONFIG_INTEGER(config_look_scroll_amount) :
|
||||
(-1) * ( (window->win_chat_height - 1) +
|
||||
CONFIG_INTEGER(config_look_scroll_amount)));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
if (window->start_line)
|
||||
{
|
||||
snprintf (scroll, sizeof (scroll), "-%d",
|
||||
CONFIG_INTEGER(config_look_scroll_amount));
|
||||
gui_window_scroll (window, scroll);
|
||||
hook_signal_send ("window_scrolled",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, window);
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -746,37 +798,52 @@ gui_window_scroll_down (struct t_gui_window *window)
|
||||
{
|
||||
struct t_gui_line *ptr_line;
|
||||
int line_pos;
|
||||
char scroll[32];
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
if (window->start_line)
|
||||
switch (window->buffer->type)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
CONFIG_INTEGER(config_look_scroll_amount));
|
||||
|
||||
/* check if we can display all */
|
||||
ptr_line = window->start_line;
|
||||
line_pos = window->start_line_pos;
|
||||
gui_chat_calculate_line_diff (window, &ptr_line,
|
||||
&line_pos,
|
||||
window->win_chat_height - 1);
|
||||
|
||||
if (!ptr_line)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
if (window->start_line)
|
||||
{
|
||||
gui_chat_calculate_line_diff (window, &window->start_line,
|
||||
&window->start_line_pos,
|
||||
CONFIG_INTEGER(config_look_scroll_amount));
|
||||
|
||||
/* check if we can display all */
|
||||
ptr_line = window->start_line;
|
||||
line_pos = window->start_line_pos;
|
||||
gui_chat_calculate_line_diff (window, &ptr_line,
|
||||
&line_pos,
|
||||
window->win_chat_height - 1);
|
||||
|
||||
if (!ptr_line)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
snprintf (scroll, sizeof (scroll), "+%d",
|
||||
CONFIG_INTEGER(config_look_scroll_amount));
|
||||
gui_window_scroll (window, scroll);
|
||||
hook_signal_send ("window_scrolled",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, window);
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,17 +857,33 @@ gui_window_scroll_top (struct t_gui_window *window)
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
if (!window->first_line_displayed)
|
||||
switch (window->buffer->type)
|
||||
{
|
||||
window->start_line = gui_chat_get_first_line_displayed (window->buffer);
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
if (!window->first_line_displayed)
|
||||
{
|
||||
window->start_line = gui_chat_get_first_line_displayed (window->buffer);
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
if (window->start_line)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
gui_buffer_ask_chat_refresh (window->buffer, 2);
|
||||
hook_signal_send ("window_scrolled",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, window);
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,21 +894,46 @@ gui_window_scroll_top (struct t_gui_window *window)
|
||||
void
|
||||
gui_window_scroll_bottom (struct t_gui_window *window)
|
||||
{
|
||||
char scroll[32];
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
if (window->start_line)
|
||||
|
||||
switch (window->buffer->type)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
if (window->start_line)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
if (window->buffer->lines_count > window->win_chat_height)
|
||||
{
|
||||
snprintf (scroll, sizeof (scroll), "-%d",
|
||||
window->win_chat_height - 1);
|
||||
gui_window_scroll (window, scroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_buffer_ask_chat_refresh (window->buffer, 2);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
hook_signal_send ("window_scrolled",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, window);
|
||||
break;
|
||||
case GUI_BUFFER_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -360,13 +360,6 @@ gui_buffer_set_type (struct t_gui_buffer *buffer, enum t_gui_buffer_type type)
|
||||
|
||||
gui_chat_line_free_all (buffer);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_FORMATED:
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_FREE:
|
||||
break;
|
||||
}
|
||||
buffer->type = type;
|
||||
gui_buffer_ask_chat_refresh (buffer, 2);
|
||||
}
|
||||
@@ -520,6 +513,12 @@ gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
|
||||
else
|
||||
gui_keyboard_unbind (buffer, property + 11);
|
||||
}
|
||||
else if (string_strcasecmp (property, "input") == 0)
|
||||
{
|
||||
gui_input_delete_line (buffer);
|
||||
gui_input_insert_string (buffer, value, 0);
|
||||
gui_buffer_ask_input_refresh (buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,6 +24,8 @@ enum t_gui_buffer_type
|
||||
{
|
||||
GUI_BUFFER_TYPE_FORMATED = 0,
|
||||
GUI_BUFFER_TYPE_FREE,
|
||||
/* number of buffer types */
|
||||
GUI_BUFFER_NUM_TYPES,
|
||||
};
|
||||
|
||||
#define GUI_BUFFER_NOTIFY_LEVEL_MIN 0
|
||||
|
||||
+31
-1
@@ -34,8 +34,10 @@
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-log.h"
|
||||
#include "../core/wee-utf8.h"
|
||||
#include "../plugins/plugin.h"
|
||||
#include "gui-window.h"
|
||||
#include "gui-bar.h"
|
||||
#include "gui-buffer.h"
|
||||
@@ -283,6 +285,31 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height
|
||||
return new_window;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_valid: check if a buffer pointer exists
|
||||
* return 1 if buffer exists
|
||||
* 0 if buffer is not found
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_valid (struct t_gui_window *window)
|
||||
{
|
||||
struct t_gui_window *ptr_window;
|
||||
|
||||
if (!window)
|
||||
return 0;
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window;
|
||||
ptr_window = ptr_window->next_window)
|
||||
{
|
||||
if (ptr_window == window)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* window not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
*/
|
||||
@@ -646,7 +673,10 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
|
||||
if (direction < 0)
|
||||
gui_window_scroll_top (window);
|
||||
else
|
||||
gui_window_scroll_bottom (window);
|
||||
{
|
||||
if (window->buffer->type == GUI_BUFFER_TYPE_FORMATED)
|
||||
gui_window_scroll_bottom (window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ extern void gui_window_tree_free (struct t_gui_window_tree **tree);
|
||||
extern struct t_gui_window *gui_window_new (struct t_gui_window *parent,
|
||||
int x, int y, int width, int height,
|
||||
int width_pct, int height_pct);
|
||||
extern int gui_window_valid (struct t_gui_window *window);
|
||||
extern void gui_window_free (struct t_gui_window *window);
|
||||
extern struct t_gui_window *gui_window_search_by_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_window_switch_server (struct t_gui_window *window);
|
||||
|
||||
@@ -510,6 +510,101 @@ plugin_api_infolist_get_add_buffer_line (struct t_plugin_infolist *infolist,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_infolist_get_add_window: add a window in a list
|
||||
* return 1 if ok, 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_infolist_get_add_window (struct t_plugin_infolist *infolist,
|
||||
struct t_gui_window *window)
|
||||
{
|
||||
struct t_plugin_infolist_item *ptr_item;
|
||||
|
||||
if (!infolist || !window)
|
||||
return 0;
|
||||
|
||||
ptr_item = plugin_infolist_new_item (infolist);
|
||||
if (!ptr_item)
|
||||
return 0;
|
||||
|
||||
if (!plugin_infolist_new_var_pointer (ptr_item, "pointer", window))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "x", window->win_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "y", window->win_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "width", window->win_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "height", window->win_height))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "width_pct", window->win_width_pct))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "height_pct", window->win_height_pct))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "chat_x", window->win_chat_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "chat_y", window->win_chat_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "chat_width", window->win_chat_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "chat_height", window->win_chat_height))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "nick_x", window->win_nick_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "nick_y", window->win_nick_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "nick_width", window->win_nick_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "nick_height", window->win_nick_height))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "nick_start", window->win_nick_start))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "title_x", window->win_title_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "title_y", window->win_title_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "title_width", window->win_title_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "title_start", window->win_title_start))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "status_x", window->win_status_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "status_y", window->win_status_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "status_width", window->win_status_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "status_height", window->win_status_height))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "infobar_x", window->win_infobar_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "infobar_y", window->win_infobar_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "infobar_width", window->win_infobar_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "infobar_height", window->win_infobar_height))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "input_x", window->win_input_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "input_y", window->win_input_y))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "input_width", window->win_input_width))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "input_height", window->win_input_height))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "input_cursor_x", window->win_input_cursor_x))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_pointer (ptr_item, "buffer", window->buffer))
|
||||
return 0;
|
||||
if (!plugin_infolist_new_var_integer (ptr_item, "start_line_y",
|
||||
((window->buffer->type == GUI_BUFFER_TYPE_FREE)
|
||||
&& (window->start_line)) ?
|
||||
window->start_line->y : 0))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_infolist_get_add_options: add config options in a list
|
||||
* return 1 if ok, 0 if error
|
||||
@@ -722,6 +817,7 @@ plugin_api_infolist_get (char *name, void *pointer, char *arguments)
|
||||
struct t_plugin_infolist *ptr_infolist;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
struct t_gui_line *ptr_line;
|
||||
struct t_gui_window *ptr_window;
|
||||
|
||||
if (!name || !name[0])
|
||||
return NULL;
|
||||
@@ -789,6 +885,42 @@ plugin_api_infolist_get (char *name, void *pointer, char *arguments)
|
||||
return ptr_infolist;
|
||||
}
|
||||
}
|
||||
if (string_strcasecmp (name, "window") == 0)
|
||||
{
|
||||
/* invalid window pointer ? */
|
||||
if (pointer && (!gui_window_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = plugin_infolist_new ();
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
{
|
||||
/* build list with only one window */
|
||||
if (!plugin_api_infolist_get_add_window (ptr_infolist, pointer))
|
||||
{
|
||||
plugin_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
return ptr_infolist;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all windows */
|
||||
for (ptr_window = gui_windows; ptr_window;
|
||||
ptr_window = ptr_window->next_window)
|
||||
{
|
||||
if (!plugin_api_infolist_get_add_window (ptr_infolist,
|
||||
ptr_window))
|
||||
{
|
||||
plugin_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (string_strcasecmp (name, "options") == 0)
|
||||
{
|
||||
ptr_infolist = plugin_infolist_new ();
|
||||
|
||||
Reference in New Issue
Block a user