summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-main.c2
-rw-r--r--src/gui/gtk/gui-gtk-main.c2
-rw-r--r--src/gui/gui-buffer.c15
-rw-r--r--src/gui/gui-buffer.h11
4 files changed, 18 insertions, 12 deletions
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index db3aa0a39..22fa34ce1 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -101,7 +101,7 @@ gui_main_init ()
if (gui_window_new (NULL, 0, 0, COLS, LINES, 100, 100))
{
gui_current_window = gui_windows;
- ptr_buffer = gui_buffer_new (NULL, "weechat", "weechat", NULL);
+ ptr_buffer = gui_buffer_new (NULL, "weechat", "weechat", NULL, NULL);
if (ptr_buffer)
{
gui_init_ok = 1;
diff --git a/src/gui/gtk/gui-gtk-main.c b/src/gui/gtk/gui-gtk-main.c
index aff016917..19add6ddc 100644
--- a/src/gui/gtk/gui-gtk-main.c
+++ b/src/gui/gtk/gui-gtk-main.c
@@ -170,7 +170,7 @@ gui_main_init ()
if (gui_window_new (NULL, 0, 0, 0, 0, 100, 100))
{
gui_current_window = gui_windows;
- ptr_buffer = gui_buffer_new (NULL, "weechat", "weechat", NULL);
+ ptr_buffer = gui_buffer_new (NULL, "weechat", "weechat", NULL, NULL);
if (ptr_buffer)
{
gui_init_ok = 1;
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 444bf3f46..30d15e772 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -66,15 +66,14 @@ struct t_gui_buffer *gui_buffer_before_raw_data = NULL; /* buf. before raw */
struct t_gui_buffer *
gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
- void (*callback_input_data)(struct t_gui_buffer *buffer, char *data))
+ int (*input_callback)(void *data,
+ struct t_gui_buffer *buffer,
+ char *input_data),
+ void *input_callback_data)
{
struct t_gui_buffer *new_buffer;
struct t_gui_completion *new_completion;
-#ifdef DEBUG
- log_printf ("Creating new buffer");
-#endif
-
if (!category || !name)
return NULL;
@@ -124,7 +123,8 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
/* input */
new_buffer->input = 1;
- new_buffer->input_data_cb = callback_input_data;
+ new_buffer->input_callback = input_callback;
+ new_buffer->input_callback_data = input_callback_data;
new_buffer->input_nick = NULL;
new_buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE;
new_buffer->input_buffer = (char *)malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
@@ -1032,7 +1032,8 @@ gui_buffer_print_log ()
log_printf (" nicklist_visible_count.: %d", ptr_buffer->nicklist_visible_count);
log_printf (" nicklist_refresh_needed: %d", ptr_buffer->nicklist_refresh_needed);
log_printf (" input. . . . . . . . . : %d", ptr_buffer->input);
- log_printf (" input_data_cb. . . . . : 0x%x", ptr_buffer->input_data_cb);
+ log_printf (" input_callback . . . . : 0x%x", ptr_buffer->input_callback);
+ log_printf (" input_callback_data. . : 0x%x", ptr_buffer->input_callback_data);
log_printf (" input_nick . . . . . . : '%s'", ptr_buffer->input_nick);
log_printf (" input_buffer . . . . . : '%s'", ptr_buffer->input_buffer);
log_printf (" input_buffer_color_mask: '%s'", ptr_buffer->input_buffer_color_mask);
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 6b9583660..1e664f27f 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -87,8 +87,11 @@ struct t_gui_buffer
/* inupt */
int input; /* = 1 if input is enabled */
- void (*input_data_cb)(struct t_gui_buffer *buffer, char *data);
+ int (*input_callback)(void *data,
+ struct t_gui_buffer *buffer,
+ char *input_data);
/* called when user send data */
+ void *input_callback_data; /* data for callback */
/* to this buffer */
char *input_nick; /* self nick */
char *input_buffer; /* input buffer */
@@ -133,8 +136,10 @@ extern struct t_gui_buffer *gui_buffer_before_raw_data;
extern struct t_gui_buffer *gui_buffer_new (struct t_weechat_plugin *plugin,
char *category, char *name,
- void (*input_data_cb)(struct t_gui_buffer *buffer,
- char *data));
+ int (*input_callback)(void *data,
+ struct t_gui_buffer *buffer,
+ char *input_data),
+ void *input_callback_data);
extern int gui_buffer_valid (struct t_gui_buffer *buffer);
extern void *gui_buffer_get (struct t_gui_buffer *buffer, char *property);
extern void gui_buffer_set_category (struct t_gui_buffer *buffer,