mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 10:43:13 +02:00
Gtk GUI changes, now compile is ok
This commit is contained in:
+6
-5
@@ -97,7 +97,7 @@ AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no Gtk+)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=no Gtk)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl script plugin (default=no Perl plugin)],enable_perl=$enableval,enable_perl=no)
|
||||
@@ -169,9 +169,10 @@ fi
|
||||
#fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
|
||||
#fi
|
||||
AM_PATH_GTK_2_0(2.4.0, LIBGTK_FOUND=1, LIBGTK_FOUND=0)
|
||||
if test "$LIBGTK_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([Gtk library not found! Install Gtk library (2.4 or higher) or run ./configure without --enable-gtk parameter.])
|
||||
fi
|
||||
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
|
||||
GTK_LIBS=`pkg-config --libs gtk+-2.0`
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
@@ -528,7 +529,7 @@ if test "x$enable_wxwidgets" = "xyes"; then
|
||||
listgui="$listgui WxWidgets"
|
||||
fi
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
listgui="$listgui Gtk+"
|
||||
listgui="$listgui Gtk"
|
||||
fi
|
||||
if test "x$enable_qt" = "xyes" ; then
|
||||
listgui="$listgui Qt"
|
||||
|
||||
@@ -843,12 +843,12 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_new_line: display a new line
|
||||
* gui_curses_display_new_line: display a new line
|
||||
*/
|
||||
|
||||
void
|
||||
gui_display_new_line (t_gui_window *window, int num_lines, int count,
|
||||
int *lines_displayed, int simulate)
|
||||
gui_curses_display_new_line (t_gui_window *window, int num_lines, int count,
|
||||
int *lines_displayed, int simulate)
|
||||
{
|
||||
if ((count == 0) || (*lines_displayed >= num_lines - count))
|
||||
{
|
||||
@@ -1147,8 +1147,8 @@ gui_display_word (t_gui_window *window,
|
||||
(((simulate) ||
|
||||
(window->win_chat_cursor_y <= window->win_chat_height - 1)) &&
|
||||
(window->win_chat_cursor_x > (window->win_chat_width - 1))))
|
||||
gui_display_new_line (window, num_lines, count,
|
||||
lines_displayed, simulate);
|
||||
gui_curses_display_new_line (window, num_lines, count,
|
||||
lines_displayed, simulate);
|
||||
|
||||
if ((data >= end_line) ||
|
||||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
|
||||
@@ -1220,16 +1220,19 @@ gui_get_word_info (t_gui_window *window,
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_line: display a line in the chat window
|
||||
* if count == 0, display whole line
|
||||
* if count > 0, display 'count' lines (beginning from the end)
|
||||
* if simulate == 1, nothing is displayed (for counting how
|
||||
* many lines would have been lines displayed)
|
||||
* returns: number of lines displayed (or simulated)
|
||||
* gui_curses_display_line: display a line in the chat window
|
||||
* if count == 0, display whole line
|
||||
* if count > 0, display 'count' lines
|
||||
* (beginning from the end)
|
||||
* if simulate == 1, nothing is displayed
|
||||
* (for counting how many lines would have been
|
||||
* lines displayed)
|
||||
* returns: number of lines displayed (or simulated)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulate)
|
||||
gui_curses_display_line (t_gui_window *window, t_gui_line *line, int count,
|
||||
int simulate)
|
||||
{
|
||||
int num_lines, x, y, lines_displayed;
|
||||
int read_marker_x, read_marker_y;
|
||||
@@ -1252,7 +1255,7 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
|
||||
return 0;
|
||||
x = window->win_chat_cursor_x;
|
||||
y = window->win_chat_cursor_y;
|
||||
num_lines = gui_display_line (window, line, 0, 1);
|
||||
num_lines = gui_curses_display_line (window, line, 0, 1);
|
||||
window->win_chat_cursor_x = x;
|
||||
window->win_chat_cursor_y = y;
|
||||
}
|
||||
@@ -1290,8 +1293,8 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
|
||||
if ((window->win_chat_cursor_x + word_length_with_spaces > window->win_chat_width)
|
||||
&& (word_length <= window->win_chat_width - line->length_align))
|
||||
{
|
||||
gui_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
gui_curses_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
/* apply styles before jumping to start of word */
|
||||
if (!simulate && (word_start_offset > 0))
|
||||
{
|
||||
@@ -1341,8 +1344,8 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
gui_curses_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
ptr_data = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1392,7 +1395,7 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
*line = window->buffer->last_line;
|
||||
if (!(*line))
|
||||
return;
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
if (current_size == 0)
|
||||
current_size = 1;
|
||||
*line_pos = current_size - 1;
|
||||
@@ -1404,11 +1407,11 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
if (!(*line))
|
||||
return;
|
||||
*line_pos = 0;
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
|
||||
while ((*line) && (difference != 0))
|
||||
{
|
||||
@@ -1422,7 +1425,7 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
*line = (*line)->prev_line;
|
||||
if (*line)
|
||||
{
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
if (current_size == 0)
|
||||
current_size = 1;
|
||||
*line_pos = current_size - 1;
|
||||
@@ -1440,7 +1443,7 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
*line = (*line)->next_line;
|
||||
if (*line)
|
||||
{
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
if (current_size == 0)
|
||||
current_size = 1;
|
||||
*line_pos = 0;
|
||||
@@ -1648,9 +1651,11 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
if (line_pos > 0)
|
||||
{
|
||||
/* display end of first line at top of screen */
|
||||
gui_display_line (ptr_win, ptr_line,
|
||||
gui_display_line (ptr_win, ptr_line, 0, 1) -
|
||||
line_pos, 0);
|
||||
gui_curses_display_line (ptr_win, ptr_line,
|
||||
gui_curses_display_line (ptr_win,
|
||||
ptr_line,
|
||||
0, 1) -
|
||||
line_pos, 0);
|
||||
ptr_line = ptr_line->next_line;
|
||||
ptr_win->first_line_displayed = 0;
|
||||
}
|
||||
@@ -1662,7 +1667,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
count = 0;
|
||||
while (ptr_line && (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1))
|
||||
{
|
||||
count = gui_display_line (ptr_win, ptr_line, 0, 0);
|
||||
count = gui_curses_display_line (ptr_win, ptr_line, 0, 0);
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
|
||||
@@ -1672,7 +1677,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
/* if so, disable scroll indicator */
|
||||
if (!ptr_line && ptr_win->scroll)
|
||||
{
|
||||
if (count == gui_display_line (ptr_win, ptr_win->buffer->last_line, 0, 1))
|
||||
if (count == gui_curses_display_line (ptr_win, ptr_win->buffer->last_line, 0, 1))
|
||||
{
|
||||
ptr_win->scroll = 0;
|
||||
ptr_win->start_line = NULL;
|
||||
@@ -1699,6 +1704,19 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_buffer_chat_line: add a line to chat window for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_buffer_chat_line (t_gui_buffer *buffer, t_gui_line *line)
|
||||
{
|
||||
/* This function does nothing in Curses GUI,
|
||||
line will be displayed by gui_buffer_draw_chat() */
|
||||
(void) buffer;
|
||||
(void) line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_buffer_nick: draw nick window for a buffer
|
||||
*/
|
||||
@@ -2632,27 +2650,6 @@ gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
|
||||
hotlist_remove_buffer (buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_dcc_buffer: get pointer to DCC buffer (DCC buffer created if not existing)
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_get_dcc_buffer (t_gui_window *window)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* check if dcc buffer exists */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->dcc)
|
||||
break;
|
||||
}
|
||||
if (ptr_buffer)
|
||||
return ptr_buffer;
|
||||
else
|
||||
return gui_buffer_new (window, NULL, NULL, 1, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_page_up: display previous page on buffer
|
||||
*/
|
||||
|
||||
+16
-3
@@ -19,11 +19,24 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = weechat-gtk
|
||||
|
||||
weechat_gtk_LDADD = ../lib_weechat_gui_common.a \
|
||||
if PLUGINS
|
||||
weechat_gtk_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
../../plugins/lib_weechat_plugins.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
$(GNUTLS_LFLAGS)
|
||||
else
|
||||
weechat_gtk_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GNUTLS_LFLAGS)
|
||||
endif
|
||||
|
||||
weechat_gtk_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
gui-input.c
|
||||
|
||||
+1961
-464
File diff suppressed because it is too large
Load Diff
+133
-5
@@ -37,26 +37,154 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/fifo.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_read_keyb: read keyboard line
|
||||
* gui_input_default_key_bindings: create default key bindings
|
||||
*/
|
||||
|
||||
void
|
||||
gui_read_keyb ()
|
||||
gui_input_default_key_bindings ()
|
||||
{
|
||||
/* TODO: read keyboard for Gtk GUI */
|
||||
int i;
|
||||
char key_str[32], command[32];
|
||||
|
||||
/* keys binded with internal functions */
|
||||
gui_key_bind ( /* RC */ "ctrl-M", "return");
|
||||
gui_key_bind ( /* RC */ "ctrl-J", "return");
|
||||
gui_key_bind ( /* tab */ "ctrl-I", "tab");
|
||||
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
|
||||
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
|
||||
gui_key_bind ( /* del */ "meta2-3~", "delete");
|
||||
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
|
||||
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
|
||||
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
|
||||
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
|
||||
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
|
||||
gui_key_bind ( /* home */ "meta2-1~", "home");
|
||||
gui_key_bind ( /* home */ "meta2-H", "home");
|
||||
gui_key_bind ( /* home */ "meta2-7~", "home");
|
||||
gui_key_bind ( /* ^A */ "ctrl-A", "home");
|
||||
gui_key_bind ( /* end */ "meta2-4~", "end");
|
||||
gui_key_bind ( /* end */ "meta2-F", "end");
|
||||
gui_key_bind ( /* end */ "meta2-8~", "end");
|
||||
gui_key_bind ( /* ^E */ "ctrl-E", "end");
|
||||
gui_key_bind ( /* left */ "meta2-D", "left");
|
||||
gui_key_bind ( /* right */ "meta2-C", "right");
|
||||
gui_key_bind ( /* up */ "meta2-A", "up");
|
||||
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
|
||||
gui_key_bind ( /* down */ "meta2-B", "down");
|
||||
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_key_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
|
||||
gui_key_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
|
||||
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
|
||||
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
|
||||
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
|
||||
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
|
||||
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
|
||||
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
|
||||
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
|
||||
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
|
||||
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
|
||||
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
|
||||
gui_key_bind ( /* m-f */ "meta-f", "next_word");
|
||||
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
|
||||
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
|
||||
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
|
||||
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
|
||||
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
|
||||
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
|
||||
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
|
||||
gui_key_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
|
||||
gui_key_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
|
||||
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
|
||||
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
gui_key_bind ( /* m-u */ "meta-u", "scroll_unread");
|
||||
|
||||
/* keys binded with commands */
|
||||
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
|
||||
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
|
||||
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
|
||||
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
|
||||
gui_key_bind ( /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
|
||||
gui_key_bind ( /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
|
||||
gui_key_bind ( /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
|
||||
gui_key_bind ( /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
|
||||
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
|
||||
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
|
||||
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
|
||||
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
|
||||
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
|
||||
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
|
||||
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
|
||||
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
|
||||
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
|
||||
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
|
||||
|
||||
/* 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);
|
||||
gui_key_bind (key_str, command);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with Gtk GUI
|
||||
* gui_input_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_key_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (expanded_key);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_read: read keyboard chars
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_read ()
|
||||
{
|
||||
/* TODO: write this function for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with ncurses GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_loop ()
|
||||
{
|
||||
/* TODO: main loop function for Gtk GUI */
|
||||
/* TODO: write this function for Gtk */
|
||||
gtk_main ();
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +365,27 @@ gui_buffer_servers_search ()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_dcc_buffer: get pointer to DCC buffer (DCC buffer created if not existing)
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_get_dcc_buffer (t_gui_window *window)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* check if dcc buffer exists */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->dcc)
|
||||
break;
|
||||
}
|
||||
if (ptr_buffer)
|
||||
return ptr_buffer;
|
||||
else
|
||||
return gui_buffer_new (window, NULL, NULL, 1, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_new: create a new buffer in current window
|
||||
*/
|
||||
@@ -848,7 +869,10 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
|
||||
{
|
||||
pos[0] = '\n';
|
||||
if (buffer->num_displayed > 0)
|
||||
{
|
||||
gui_draw_buffer_chat_line (buffer, buffer->last_line);
|
||||
gui_draw_buffer_chat (buffer, 0);
|
||||
}
|
||||
if (gui_add_hotlist && (buffer->num_displayed == 0))
|
||||
{
|
||||
if (3 - buffer->last_line->line_with_message -
|
||||
|
||||
+2
-1
@@ -404,6 +404,7 @@ extern void gui_window_tree_free (t_gui_window_tree **);
|
||||
extern t_gui_window *gui_window_new (t_gui_window *, int, int, int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_search (char *, char *);
|
||||
extern t_gui_window *gui_buffer_find_window (t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
@@ -505,6 +506,7 @@ extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern char *gui_word_get_next_char (t_gui_window *, unsigned char *, int);
|
||||
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_chat_line (t_gui_buffer *, t_gui_line *);
|
||||
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_status (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_infobar_time (t_gui_buffer *);
|
||||
@@ -512,7 +514,6 @@ extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_input (t_gui_buffer *, int);
|
||||
extern void gui_redraw_buffer (t_gui_buffer *);
|
||||
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
|
||||
extern void gui_window_page_up (t_gui_window *);
|
||||
extern void gui_window_page_down (t_gui_window *);
|
||||
extern void gui_window_scroll_up (t_gui_window *);
|
||||
|
||||
@@ -97,7 +97,7 @@ AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no Gtk+)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=no Gtk)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl script plugin (default=no Perl plugin)],enable_perl=$enableval,enable_perl=no)
|
||||
@@ -169,9 +169,10 @@ fi
|
||||
#fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
|
||||
#fi
|
||||
AM_PATH_GTK_2_0(2.4.0, LIBGTK_FOUND=1, LIBGTK_FOUND=0)
|
||||
if test "$LIBGTK_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([Gtk library not found! Install Gtk library (2.4 or higher) or run ./configure without --enable-gtk parameter.])
|
||||
fi
|
||||
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
|
||||
GTK_LIBS=`pkg-config --libs gtk+-2.0`
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
@@ -528,7 +529,7 @@ if test "x$enable_wxwidgets" = "xyes"; then
|
||||
listgui="$listgui WxWidgets"
|
||||
fi
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
listgui="$listgui Gtk+"
|
||||
listgui="$listgui Gtk"
|
||||
fi
|
||||
if test "x$enable_qt" = "xyes" ; then
|
||||
listgui="$listgui Qt"
|
||||
|
||||
@@ -843,12 +843,12 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_new_line: display a new line
|
||||
* gui_curses_display_new_line: display a new line
|
||||
*/
|
||||
|
||||
void
|
||||
gui_display_new_line (t_gui_window *window, int num_lines, int count,
|
||||
int *lines_displayed, int simulate)
|
||||
gui_curses_display_new_line (t_gui_window *window, int num_lines, int count,
|
||||
int *lines_displayed, int simulate)
|
||||
{
|
||||
if ((count == 0) || (*lines_displayed >= num_lines - count))
|
||||
{
|
||||
@@ -1147,8 +1147,8 @@ gui_display_word (t_gui_window *window,
|
||||
(((simulate) ||
|
||||
(window->win_chat_cursor_y <= window->win_chat_height - 1)) &&
|
||||
(window->win_chat_cursor_x > (window->win_chat_width - 1))))
|
||||
gui_display_new_line (window, num_lines, count,
|
||||
lines_displayed, simulate);
|
||||
gui_curses_display_new_line (window, num_lines, count,
|
||||
lines_displayed, simulate);
|
||||
|
||||
if ((data >= end_line) ||
|
||||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
|
||||
@@ -1220,16 +1220,19 @@ gui_get_word_info (t_gui_window *window,
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_line: display a line in the chat window
|
||||
* if count == 0, display whole line
|
||||
* if count > 0, display 'count' lines (beginning from the end)
|
||||
* if simulate == 1, nothing is displayed (for counting how
|
||||
* many lines would have been lines displayed)
|
||||
* returns: number of lines displayed (or simulated)
|
||||
* gui_curses_display_line: display a line in the chat window
|
||||
* if count == 0, display whole line
|
||||
* if count > 0, display 'count' lines
|
||||
* (beginning from the end)
|
||||
* if simulate == 1, nothing is displayed
|
||||
* (for counting how many lines would have been
|
||||
* lines displayed)
|
||||
* returns: number of lines displayed (or simulated)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulate)
|
||||
gui_curses_display_line (t_gui_window *window, t_gui_line *line, int count,
|
||||
int simulate)
|
||||
{
|
||||
int num_lines, x, y, lines_displayed;
|
||||
int read_marker_x, read_marker_y;
|
||||
@@ -1252,7 +1255,7 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
|
||||
return 0;
|
||||
x = window->win_chat_cursor_x;
|
||||
y = window->win_chat_cursor_y;
|
||||
num_lines = gui_display_line (window, line, 0, 1);
|
||||
num_lines = gui_curses_display_line (window, line, 0, 1);
|
||||
window->win_chat_cursor_x = x;
|
||||
window->win_chat_cursor_y = y;
|
||||
}
|
||||
@@ -1290,8 +1293,8 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
|
||||
if ((window->win_chat_cursor_x + word_length_with_spaces > window->win_chat_width)
|
||||
&& (word_length <= window->win_chat_width - line->length_align))
|
||||
{
|
||||
gui_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
gui_curses_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
/* apply styles before jumping to start of word */
|
||||
if (!simulate && (word_start_offset > 0))
|
||||
{
|
||||
@@ -1341,8 +1344,8 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
gui_curses_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
ptr_data = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1392,7 +1395,7 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
*line = window->buffer->last_line;
|
||||
if (!(*line))
|
||||
return;
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
if (current_size == 0)
|
||||
current_size = 1;
|
||||
*line_pos = current_size - 1;
|
||||
@@ -1404,11 +1407,11 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
if (!(*line))
|
||||
return;
|
||||
*line_pos = 0;
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
|
||||
while ((*line) && (difference != 0))
|
||||
{
|
||||
@@ -1422,7 +1425,7 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
*line = (*line)->prev_line;
|
||||
if (*line)
|
||||
{
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
if (current_size == 0)
|
||||
current_size = 1;
|
||||
*line_pos = current_size - 1;
|
||||
@@ -1440,7 +1443,7 @@ gui_calculate_line_diff (t_gui_window *window, t_gui_line **line, int *line_pos,
|
||||
*line = (*line)->next_line;
|
||||
if (*line)
|
||||
{
|
||||
current_size = gui_display_line (window, *line, 0, 1);
|
||||
current_size = gui_curses_display_line (window, *line, 0, 1);
|
||||
if (current_size == 0)
|
||||
current_size = 1;
|
||||
*line_pos = 0;
|
||||
@@ -1648,9 +1651,11 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
if (line_pos > 0)
|
||||
{
|
||||
/* display end of first line at top of screen */
|
||||
gui_display_line (ptr_win, ptr_line,
|
||||
gui_display_line (ptr_win, ptr_line, 0, 1) -
|
||||
line_pos, 0);
|
||||
gui_curses_display_line (ptr_win, ptr_line,
|
||||
gui_curses_display_line (ptr_win,
|
||||
ptr_line,
|
||||
0, 1) -
|
||||
line_pos, 0);
|
||||
ptr_line = ptr_line->next_line;
|
||||
ptr_win->first_line_displayed = 0;
|
||||
}
|
||||
@@ -1662,7 +1667,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
count = 0;
|
||||
while (ptr_line && (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1))
|
||||
{
|
||||
count = gui_display_line (ptr_win, ptr_line, 0, 0);
|
||||
count = gui_curses_display_line (ptr_win, ptr_line, 0, 0);
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
|
||||
@@ -1672,7 +1677,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
/* if so, disable scroll indicator */
|
||||
if (!ptr_line && ptr_win->scroll)
|
||||
{
|
||||
if (count == gui_display_line (ptr_win, ptr_win->buffer->last_line, 0, 1))
|
||||
if (count == gui_curses_display_line (ptr_win, ptr_win->buffer->last_line, 0, 1))
|
||||
{
|
||||
ptr_win->scroll = 0;
|
||||
ptr_win->start_line = NULL;
|
||||
@@ -1699,6 +1704,19 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_buffer_chat_line: add a line to chat window for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_buffer_chat_line (t_gui_buffer *buffer, t_gui_line *line)
|
||||
{
|
||||
/* This function does nothing in Curses GUI,
|
||||
line will be displayed by gui_buffer_draw_chat() */
|
||||
(void) buffer;
|
||||
(void) line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_buffer_nick: draw nick window for a buffer
|
||||
*/
|
||||
@@ -2632,27 +2650,6 @@ gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
|
||||
hotlist_remove_buffer (buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_dcc_buffer: get pointer to DCC buffer (DCC buffer created if not existing)
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_get_dcc_buffer (t_gui_window *window)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* check if dcc buffer exists */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->dcc)
|
||||
break;
|
||||
}
|
||||
if (ptr_buffer)
|
||||
return ptr_buffer;
|
||||
else
|
||||
return gui_buffer_new (window, NULL, NULL, 1, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_page_up: display previous page on buffer
|
||||
*/
|
||||
|
||||
@@ -19,11 +19,24 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = weechat-gtk
|
||||
|
||||
weechat_gtk_LDADD = ../lib_weechat_gui_common.a \
|
||||
if PLUGINS
|
||||
weechat_gtk_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
../../plugins/lib_weechat_plugins.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
$(GNUTLS_LFLAGS)
|
||||
else
|
||||
weechat_gtk_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GNUTLS_LFLAGS)
|
||||
endif
|
||||
|
||||
weechat_gtk_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
gui-input.c
|
||||
|
||||
+1961
-464
File diff suppressed because it is too large
Load Diff
@@ -37,26 +37,154 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/fifo.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_read_keyb: read keyboard line
|
||||
* gui_input_default_key_bindings: create default key bindings
|
||||
*/
|
||||
|
||||
void
|
||||
gui_read_keyb ()
|
||||
gui_input_default_key_bindings ()
|
||||
{
|
||||
/* TODO: read keyboard for Gtk GUI */
|
||||
int i;
|
||||
char key_str[32], command[32];
|
||||
|
||||
/* keys binded with internal functions */
|
||||
gui_key_bind ( /* RC */ "ctrl-M", "return");
|
||||
gui_key_bind ( /* RC */ "ctrl-J", "return");
|
||||
gui_key_bind ( /* tab */ "ctrl-I", "tab");
|
||||
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
|
||||
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
|
||||
gui_key_bind ( /* del */ "meta2-3~", "delete");
|
||||
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
|
||||
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
|
||||
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
|
||||
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
|
||||
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
|
||||
gui_key_bind ( /* home */ "meta2-1~", "home");
|
||||
gui_key_bind ( /* home */ "meta2-H", "home");
|
||||
gui_key_bind ( /* home */ "meta2-7~", "home");
|
||||
gui_key_bind ( /* ^A */ "ctrl-A", "home");
|
||||
gui_key_bind ( /* end */ "meta2-4~", "end");
|
||||
gui_key_bind ( /* end */ "meta2-F", "end");
|
||||
gui_key_bind ( /* end */ "meta2-8~", "end");
|
||||
gui_key_bind ( /* ^E */ "ctrl-E", "end");
|
||||
gui_key_bind ( /* left */ "meta2-D", "left");
|
||||
gui_key_bind ( /* right */ "meta2-C", "right");
|
||||
gui_key_bind ( /* up */ "meta2-A", "up");
|
||||
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
|
||||
gui_key_bind ( /* down */ "meta2-B", "down");
|
||||
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_key_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
|
||||
gui_key_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
|
||||
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
|
||||
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
|
||||
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
|
||||
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
|
||||
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
|
||||
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
|
||||
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
|
||||
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
|
||||
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
|
||||
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
|
||||
gui_key_bind ( /* m-f */ "meta-f", "next_word");
|
||||
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
|
||||
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
|
||||
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
|
||||
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
|
||||
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
|
||||
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
|
||||
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
|
||||
gui_key_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
|
||||
gui_key_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
|
||||
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
|
||||
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
gui_key_bind ( /* m-u */ "meta-u", "scroll_unread");
|
||||
|
||||
/* keys binded with commands */
|
||||
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
|
||||
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
|
||||
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
|
||||
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
|
||||
gui_key_bind ( /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
|
||||
gui_key_bind ( /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
|
||||
gui_key_bind ( /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
|
||||
gui_key_bind ( /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
|
||||
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
|
||||
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
|
||||
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
|
||||
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
|
||||
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
|
||||
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
|
||||
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
|
||||
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
|
||||
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
|
||||
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
|
||||
|
||||
/* 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);
|
||||
gui_key_bind (key_str, command);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with Gtk GUI
|
||||
* gui_input_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_key_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (expanded_key);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_read: read keyboard chars
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_read ()
|
||||
{
|
||||
/* TODO: write this function for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with ncurses GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_loop ()
|
||||
{
|
||||
/* TODO: main loop function for Gtk GUI */
|
||||
/* TODO: write this function for Gtk */
|
||||
gtk_main ();
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +365,27 @@ gui_buffer_servers_search ()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_dcc_buffer: get pointer to DCC buffer (DCC buffer created if not existing)
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_get_dcc_buffer (t_gui_window *window)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* check if dcc buffer exists */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->dcc)
|
||||
break;
|
||||
}
|
||||
if (ptr_buffer)
|
||||
return ptr_buffer;
|
||||
else
|
||||
return gui_buffer_new (window, NULL, NULL, 1, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_new: create a new buffer in current window
|
||||
*/
|
||||
@@ -848,7 +869,10 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
|
||||
{
|
||||
pos[0] = '\n';
|
||||
if (buffer->num_displayed > 0)
|
||||
{
|
||||
gui_draw_buffer_chat_line (buffer, buffer->last_line);
|
||||
gui_draw_buffer_chat (buffer, 0);
|
||||
}
|
||||
if (gui_add_hotlist && (buffer->num_displayed == 0))
|
||||
{
|
||||
if (3 - buffer->last_line->line_with_message -
|
||||
|
||||
@@ -404,6 +404,7 @@ extern void gui_window_tree_free (t_gui_window_tree **);
|
||||
extern t_gui_window *gui_window_new (t_gui_window *, int, int, int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_search (char *, char *);
|
||||
extern t_gui_window *gui_buffer_find_window (t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
@@ -505,6 +506,7 @@ extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern char *gui_word_get_next_char (t_gui_window *, unsigned char *, int);
|
||||
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_chat_line (t_gui_buffer *, t_gui_line *);
|
||||
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_status (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_infobar_time (t_gui_buffer *);
|
||||
@@ -512,7 +514,6 @@ extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_input (t_gui_buffer *, int);
|
||||
extern void gui_redraw_buffer (t_gui_buffer *);
|
||||
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
|
||||
extern void gui_window_page_up (t_gui_window *);
|
||||
extern void gui_window_page_down (t_gui_window *);
|
||||
extern void gui_window_scroll_up (t_gui_window *);
|
||||
|
||||
Reference in New Issue
Block a user