1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 12:45:42 +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:
Sebastien Helleu
2011-07-26 18:50:29 +02:00
parent 2fec843144
commit e0781f0390
97 changed files with 6338 additions and 1376 deletions
+19 -6
View File
@@ -1,12 +1,24 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.6-dev, 2011-07-18
v0.3.6-dev, 2011-07-26
Version 0.3.6 (under dev!)
--------------------------
* core: add support of mouse: new command /mouse, new option weechat.look.mouse
and new key context "mouse" (task #5435)
* core: add command /cursor (free movement of cursor on screen), with key
context "search"
* core: automatic scroll direction in /bar scroll (x/y is now optional)
* core: add optional delay for key grab (commands /input grab_key and
/input grab_key_command, default is 500 milliseconds)
* core: fix bugs with key "^" (bug #32072, bug #21381)
* core: allow plugin name in command /buffer name
* core: fix bugs with bar windows: do not create bar windows for hidden bars
* core: fix completion bug when two words for completion are equal but with
different case
* core: fix completion for command arguments when same command exists in many
plugins (bug #33753)
* core: add context "search" for keys (to define keys used during search in
@@ -22,11 +34,12 @@ Version 0.3.6 (under dev!)
* core: add options "infolists", "hdata" and "tags" for command /debug
* core: add horizontal scrolling for buffers with free content (command
/window scroll_horiz) (task #11112)
* api: add new functions hdata_new, hdata_new_var, hdata_new_list, hdata_get,
hdata_get_var_offset, hdata_get_var_type, hdata_get_var_type_string,
hdata_get_var_hdata, hdata_get_var, hdata_get_var_at_offset, hdata_get_list,
hdata_move, hdata_integer, hdata_string, hdata_pointer, hdata_time,
hdata_get_string
* api: add info "cursor_mode"
* api: add new functions hook_focus, hdata_new, hdata_new_var, hdata_new_list,
hdata_get, hdata_get_var_offset, hdata_get_var_type,
hdata_get_var_type_string, hdata_get_var_hdata, hdata_get_var,
hdata_get_var_at_offset, hdata_get_list, hdata_move, hdata_integer,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
* api: fix bug with function config_set_desc_plugin (use immediately
description for option when function is called)
* irc: fix crash when malformed IRC message 352 (WHO) is received (bug #33790)
+3 -1
View File
@@ -78,6 +78,8 @@
| weechat | config_options | Konfigurationsoptionen
| weechat | cursor_areas | areas ("chat" or bar name) for free cursor movement
| weechat | filename | Dateinamen
| weechat | filters_names | Liste der Filter
@@ -90,7 +92,7 @@
| weechat | keys_codes_for_reset | Tastenbelegungen die zurückgesetzt werden können (hinzugefügte/verändert/gelöschte Tastenbelegungen)
| weechat | keys_contexts | key contexts
| weechat | keys_contexts | Tastaturkontext
| weechat | nicks | Nicks in Nickliste des aktuellen Buffers
+44 -5
View File
@@ -175,7 +175,10 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +
'bar_window' (pointer, hdata: 'bar_window') +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer, hdata: 'bar') +
'next_bar' (pointer, hdata: 'bar') |
@@ -192,6 +195,30 @@
'gui_bar_items' +
'last_gui_bar_item'
| weechat | bar_window | bar window |
'bar' (pointer, hdata: 'bar') +
'x' (integer) +
'y' (integer) +
'width' (integer) +
'height' (integer) +
'scroll_x' (integer) +
'scroll_y' (integer) +
'cursor_x' (integer) +
'cursor_y' (integer) +
'current_size' (integer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_content' (pointer) +
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
'prev_bar_window' (pointer, hdata: 'bar_window') +
'next_bar_window' (pointer, hdata: 'bar_window') |
-
| weechat | buffer | Buffer |
'plugin' (pointer, hdata: 'plugin') +
'plugin_name_for_upgrade' (string) +
@@ -383,9 +410,21 @@
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |
'gui_default_keys' +
'gui_default_keys_cursor' +
'gui_default_keys_mouse' +
'gui_default_keys_search' +
'gui_keys' +
'gui_keys_cursor' +
'gui_keys_mouse' +
'gui_keys_search' +
'last_gui_default_key' +
'last_gui_key'
'last_gui_default_key_cursor' +
'last_gui_default_key_mouse' +
'last_gui_default_key_search' +
'last_gui_key' +
'last_gui_key_cursor' +
'last_gui_key_mouse' +
'last_gui_key_search'
| weechat | line | Struktur mit einer Zeile |
'data' (pointer, hdata: 'line_data') +
@@ -445,7 +484,7 @@
'next_group' (pointer, hdata: 'nick_group') |
-
| weechat | plugin | plugin |
| weechat | plugin | Erweiterung |
'filename' (string) +
'handle' (pointer) +
'name' (string) +
@@ -473,8 +512,8 @@
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'bar_windows' (pointer, hdata: 'bar_window') +
'last_bar_window' (pointer, hdata: 'bar_window') +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer, hdata: 'buffer') +
+1 -1
View File
@@ -48,7 +48,7 @@
| weechat | hotlist | Liste der Buffer in Hotlist | - | -
| weechat | key | Auflistung der Tastenzuweisungen | - | context ("default" or "search") (optional)
| weechat | key | Auflistung der Tastenzuweisungen | - | Kontext ("default" oder "search") (optional)
| weechat | nicklist | Nicks in Nickliste für einen Buffer | Buffer Pointer | nick_xxx oder group_xxx um nur den Nick/Group xxx abzufragen (optional)
+2
View File
@@ -28,6 +28,8 @@
| weechat | charset_terminal | Terminal Zeichensatz | -
| weechat | cursor_mode | 1 if cursor mode is enabled | -
| weechat | date | Datum der WeeChat Kompilierung | -
| weechat | dir_separator | Verzeichnis-Trennzeichen | -
+2 -2
View File
@@ -194,12 +194,12 @@
** Werte: current, server (Standardwert: `current`)
* *irc.look.new_channel_position*
** Beschreibung: `Ein öffentlicher Channel wird auf eine Position gezwungen (none = standardmäßige Position (sollte die letzte Position sein), next = aktueller Buffer + 1, near_server = nach letztem Channel/privaten Buffer des Servers)`
** Beschreibung: `Ein neu geöffneter Channel wird auf eine Position gezwungen (none = standardmäßige Position (sollte der letzte Buffer in der Liste sein), next = aktueller Buffer + 1, near_server = nach dem letztem Channel/privaten Buffer des jeweiligen Servers)`
** Typ: integer
** Werte: none, next, near_server (Standardwert: `none`)
* *irc.look.new_pv_position*
** Beschreibung: `Ein privater Buffer wird auf eine Position gezwungen (none = standardmäßige Position (sollte die letzte Position sein), next = aktueller Buffer + 1, near_server = nach letztem Channel/privaten Buffer des Servers)`
** Beschreibung: `Ein neuer privater Buffer wird auf eine Position gezwungen (none = standardmäßige Position (sollte der letzte Buffer in der Liste sein), next = aktueller Buffer + 1, near_server = nach dem letztem Channel/privaten Buffer des jeweiligen Servers)`
** Typ: integer
** Werte: none, next, near_server (Standardwert: `none`)
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -364,7 +364,7 @@
** Werte: beliebige Zeichenkette (Standardwert: `"%a, %d %b %Y"`)
* *weechat.look.eat_newline_glitch*
** Beschreibung: `wird diese Option aktiviert, dann wird /"eat_newline_glitch/" auf 0 gesetzt; dies wird genutzt um keinen Zeilenumbruch am Ende einer Zeile `
** Beschreibung: `aktiviert man diese Option, dann wird "eat_newline_glitch" auf 0 gesetzt; dies bedeutet, dass am Ende einer Zeile kein Zeilenumbruch angehangen wird und somit der Text beim kopieren aus WeeChat und beim einfügen in einer anderen Applikation nicht umgebrochen wird (diese Option ist standardmäßig deaktiviert, da es zu schwerwiegenden Grafikfehlern kommen kann)`
** Typ: boolesch
** Werte: on, off (Standardwert: `off`)
@@ -473,6 +473,11 @@
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
* *weechat.look.mouse*
** Beschreibung: `enable mouse support at startup (to enable it now, see /help mouse)`
** Typ: boolesch
** Werte: on, off (Standardwert: `off`)
* *weechat.look.nickmode*
** Beschreibung: `Nickmode ((half)op/voice [@%+]) vor dem Nicknamen anzeigen`
** Typ: boolesch
@@ -599,7 +604,7 @@
** Werte: beliebige Zeichenkette (Standardwert: `"-"`)
* *weechat.look.separator_vertical*
** Beschreibung: `char used to draw vertical separators around bars (empty value will draw a real line with ncurses), wide chars are NOT allowed here`
** Beschreibung: `Das angegebene Zeichen wird genutzt um damit die vertikale Linien zu zeichnen. Wird kein Zeichen angegeben zeichnet ncurses eine durchgezogene Linie. Wide Chars sind für diese Option NICHT erlaubt.`
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `""`)
File diff suppressed because it is too large Load Diff
@@ -78,6 +78,8 @@
| weechat | config_options | configuration options
| weechat | cursor_areas | areas ("chat" or bar name) for free cursor movement
| weechat | filename | filename
| weechat | filters_names | names of filters
+43 -4
View File
@@ -175,7 +175,10 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +
'bar_window' (pointer, hdata: 'bar_window') +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer, hdata: 'bar') +
'next_bar' (pointer, hdata: 'bar') |
@@ -192,6 +195,30 @@
'gui_bar_items' +
'last_gui_bar_item'
| weechat | bar_window | bar window |
'bar' (pointer, hdata: 'bar') +
'x' (integer) +
'y' (integer) +
'width' (integer) +
'height' (integer) +
'scroll_x' (integer) +
'scroll_y' (integer) +
'cursor_x' (integer) +
'cursor_y' (integer) +
'current_size' (integer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_content' (pointer) +
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
'prev_bar_window' (pointer, hdata: 'bar_window') +
'next_bar_window' (pointer, hdata: 'bar_window') |
-
| weechat | buffer | buffer |
'plugin' (pointer, hdata: 'plugin') +
'plugin_name_for_upgrade' (string) +
@@ -383,9 +410,21 @@
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |
'gui_default_keys' +
'gui_default_keys_cursor' +
'gui_default_keys_mouse' +
'gui_default_keys_search' +
'gui_keys' +
'gui_keys_cursor' +
'gui_keys_mouse' +
'gui_keys_search' +
'last_gui_default_key' +
'last_gui_key'
'last_gui_default_key_cursor' +
'last_gui_default_key_mouse' +
'last_gui_default_key_search' +
'last_gui_key' +
'last_gui_key_cursor' +
'last_gui_key_mouse' +
'last_gui_key_search'
| weechat | line | structure with one line |
'data' (pointer, hdata: 'line_data') +
@@ -473,8 +512,8 @@
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'bar_windows' (pointer, hdata: 'bar_window') +
'last_bar_window' (pointer, hdata: 'bar_window') +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer, hdata: 'buffer') +
+2
View File
@@ -28,6 +28,8 @@
| weechat | charset_terminal | terminal charset | -
| weechat | cursor_mode | 1 if cursor mode is enabled | -
| weechat | date | WeeChat compilation date | -
| weechat | dir_separator | directory separator | -
File diff suppressed because it is too large Load Diff
+5
View File
@@ -473,6 +473,11 @@
** type: boolean
** values: on, off (default value: `on`)
* *weechat.look.mouse*
** description: `enable mouse support at startup (to enable it now, see /help mouse)`
** type: boolean
** values: on, off (default value: `off`)
* *weechat.look.nickmode*
** description: `display nick mode ((half)op/voice) before each nick`
** type: boolean
+81 -1
View File
@@ -6042,7 +6042,7 @@ weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
----------------------------------------
Following hook types allow priority: command, command_run, signal, hsignal,
config, completion, modifier, info, info_hashtable, infolist, hdata.
config, completion, modifier, info, info_hashtable, infolist, hdata, focus.
weechat_hook_command
^^^^^^^^^^^^^^^^^^^^
@@ -8229,6 +8229,86 @@ struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
[NOTE]
This function is not available in scripting API.
weechat_hook_focus
^^^^^^^^^^^^^^^^^^
Hook a focus: mouse event or key pressed in cursor mode (free movement of
cursor).
Prototype:
[source,C]
----------------------------------------
struct t_hook *weechat_hook_focus (const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *info),
void *callback_data);
----------------------------------------
Arguments:
* 'area': "chat" for chat area, or name of bar item
(priority allowed, see note about <<hook_priority,priority>>)
* 'callback': function called when focus is made, arguments and return
value:
** 'void *data': pointer
** 'struct t_hashtable *info': hashtable with info on focus and strings returned
by other calls to focus callbacks (with higher priority); keys and values
are of type "string"; info on focus (filled by WeeChat) are:
*** '_x': column of focus on screen (first column on the left is "0")
*** '_y': line of focus on screen (first line on top is "0")
*** '_window': pointer of window with focus ("0x0" for a bar of type "root"
or for unknown area)
*** '_bar_name': name of bar with focus (NULL for chat area or for unknown
area)
*** '_bar_item_name': name of bar item with focus (NULL if focus is not in a
bar or if focus is after the end of last bar item)
*** '_item_line': line with focus in bar item (first line of bar item is "0")
*** '_item_col': column with focus in bar item (first column of bar item is "0")
** return value: either "info" pointer (hashtable completed), or pointer to a
new hashtable (created by callback, with keys and values of type "string"),
this new hashtable content will be added to 'info' for other calls to focus
callbacks
* 'callback_data': pointer given to callback when it is called by WeeChat
Return value:
* pointer to new hook, NULL if error occured
C example:
[source,C]
----------------------------------------
struct t_hashtable *
my_focus_nicklist_cb (void *data, struct t_hashtable *info)
{
/* add strings in hashtable */
/* ... */
return info;
}
/* add focus on nicklist */
struct t_hook *my_focus = weechat_hook_focus ("buffer_nicklist",
&my_focus_nicklist_cb, NULL);
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
hook = weechat.hook_focus(area, callback, callback_data)
# example
def my_focus_nicklist_cb(data, info):
# build dict
# ...
return my_dict
hook = weechat.hook_focus("buffer_nicklist", "my_focus_nicklist_cb", "")
----------------------------------------
weechat_unhook
^^^^^^^^^^^^^^
File diff suppressed because it is too large Load Diff
@@ -78,6 +78,8 @@
| weechat | config_options | options de configuration
| weechat | cursor_areas | zones ("chat" ou un nom de barre) pour le mouvement libre du curseur
| weechat | filename | nom de fichier
| weechat | filters_names | noms des filtres
+43 -4
View File
@@ -175,7 +175,10 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +
'bar_window' (pointer, hdata: 'bar_window') +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer, hdata: 'bar') +
'next_bar' (pointer, hdata: 'bar') |
@@ -192,6 +195,30 @@
'gui_bar_items' +
'last_gui_bar_item'
| weechat | bar_window | fenêtre de barre |
'bar' (pointer, hdata: 'bar') +
'x' (integer) +
'y' (integer) +
'width' (integer) +
'height' (integer) +
'scroll_x' (integer) +
'scroll_y' (integer) +
'cursor_x' (integer) +
'cursor_y' (integer) +
'current_size' (integer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_content' (pointer) +
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
'prev_bar_window' (pointer, hdata: 'bar_window') +
'next_bar_window' (pointer, hdata: 'bar_window') |
-
| weechat | buffer | tampon |
'plugin' (pointer, hdata: 'plugin') +
'plugin_name_for_upgrade' (string) +
@@ -383,9 +410,21 @@
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |
'gui_default_keys' +
'gui_default_keys_cursor' +
'gui_default_keys_mouse' +
'gui_default_keys_search' +
'gui_keys' +
'gui_keys_cursor' +
'gui_keys_mouse' +
'gui_keys_search' +
'last_gui_default_key' +
'last_gui_key'
'last_gui_default_key_cursor' +
'last_gui_default_key_mouse' +
'last_gui_default_key_search' +
'last_gui_key' +
'last_gui_key_cursor' +
'last_gui_key_mouse' +
'last_gui_key_search'
| weechat | line | structure avec une ligne |
'data' (pointer, hdata: 'line_data') +
@@ -473,8 +512,8 @@
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'bar_windows' (pointer, hdata: 'bar_window') +
'last_bar_window' (pointer, hdata: 'bar_window') +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer, hdata: 'buffer') +
+2
View File
@@ -28,6 +28,8 @@
| weechat | charset_terminal | charset du terminal | -
| weechat | cursor_mode | 1 si le mode curseur est activé | -
| weechat | date | date de compilation de WeeChat | -
| weechat | dir_separator | séparateur de répertoire | -
File diff suppressed because it is too large Load Diff
+5
View File
@@ -473,6 +473,11 @@
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
* *weechat.look.mouse*
** description: `activer le support de la souris au démarrage (pour l'activer maintenant, voir /help mouse)`
** type: booléen
** valeurs: on, off (valeur par défaut: `off`)
* *weechat.look.nickmode*
** description: `afficher le mode du pseudo ((half)op/voice) devant chaque utilisateur`
** type: booléen
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -78,6 +78,8 @@
| weechat | config_options | opzioni di configurazione
| weechat | cursor_areas | areas ("chat" or bar name) for free cursor movement
| weechat | filename | nome file
| weechat | filters_names | nomi dei filtri
@@ -86,7 +88,7 @@
| weechat | infos | nomi degli hook sulle info
| weechat | keys_codes | codici tasti
| weechat | keys_codes | codici tasto
| weechat | keys_codes_for_reset | codici tasti che possono essere ripristinati (tasti aggiunti, ridefiniti o rimossi)
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -48,7 +48,7 @@
| weechat | hotlist | elenco dei buffer nella hotlist | - | -
| weechat | key | elenco di tasti associati | - | context ("default" or "search") (optional)
| weechat | key | elenco di tasti associati | - | contesto ("default" oppure "search") (opzionale)
| weechat | nicklist | nick nella lista nick per un buffer | puntatore al buffer | nick_xxx o group_xxx per ottenere solo xxx di nick/group (opzionale)
+2
View File
@@ -28,6 +28,8 @@
| weechat | charset_terminal | set caratteri terminale | -
| weechat | cursor_mode | 1 if cursor mode is enabled | -
| weechat | date | data di compilazione di WeeChat | -
| weechat | dir_separator | separatore cartella | -
+15 -15
View File
@@ -141,22 +141,22 @@ server: nome del server da cui disconnettersi
add [re:]<nick> [<server> [<canale>]]
del <numero>|-all
list: list all ignores
add: add an ignore
nick: nick or hostname (can be regular expression if "re:" is given or a mask using "*" to replace one or more chars)
del: delete an ignore
number: number of ignore to delete (look at list to find it)
-all: delete all ignores
server: internal server name where ignore is working
channel: channel name where ignore is working
list: elenca tutti gli ignore
add: aggiungi un ignore
nick: nick oppure hostname (può essere un'espressione regolare se forinito il parametro "-re:")
del: elimina un ignore
numero: numero di ignore da eliminare (nella lista)
-all: elimina tutti gli ignore
server: nome interno del server dove l'ignore è attivo
canale: nome del canale dove l'ignore è attivo
Examples:
ignore nick "toto" everywhere:
/ignore add toto
ignore host "toto@domain.com" on freenode server:
/ignore add toto@domain.com freenode
ignore host "toto*@*.domain.com" on freenode/#weechat:
/ignore add toto*@*.domain.com freenode #weechat
Esempi:
ignora nick "tizio" su tutti gli host/canali:
/ignore add tizio
ignora l'host "tizio@dominio.com" sul server freenode:
/ignore add tizio@dominio.com freenode
ignora l'host "tizio*@*.dominio.com" su freenode/#weechat:
/ignore add tizio*@*.dominio.com freenode #weechat
........................................
[command]*`info`* ottieni informazioni sul server::
+1 -1
View File
@@ -4,7 +4,7 @@
** valori: on, off (valore predefinito: `on`)
* *logger.file.flush_delay*
** descrizione: `number of seconds between flush of log files (0 = write in log files immediately for each line printed)`
** descrizione: `numero di secondi tra il flush (scrittura) dei file di log (0 = scrive sui file di log immediatamente per ogni riga stampata)`
** tipo: intero
** valori: 0 .. 3600 (valore predefinito: `120`)
File diff suppressed because it is too large Load Diff
+8 -3
View File
@@ -119,7 +119,7 @@
** valori: un nome colore di WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), un numero colore del terminale o un alias; attributi consentiti prima del colore (solo per il colore del testo, non lo sfondo): "*" per il grassetto, "!" per l'inverso, "_" per la sottolineatura (valore predefinito: `brown`)
* *weechat.color.chat_tags*
** descrizione: `text color for tags after messages (displayed with command /debug tags)`
** descrizione: `colore del testo per i tago dopo i messaggi (mostrati con il comando /debug tags)`
** tipo: colore
** valori: un nome colore di WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), un numero colore del terminale o un alias; attributi consentiti prima del colore (solo per il colore del testo, non lo sfondo): "*" per il grassetto, "!" per l'inverso, "_" per la sottolineatura (valore predefinito: `red`)
@@ -364,7 +364,7 @@
** valori: qualsiasi stringa (valore predefinito: `"%a, %d %b %Y"`)
* *weechat.look.eat_newline_glitch*
** descrizione: `if set, the eat_newline_glitch will be set to 0; this is used to not add new line char at end of each line, and then not break text when you copy/paste text from WeeChat to another application (this option is disabled by default because it can cause serious display bugs)`
** descrizione: `se attivo, eat_newline_glitch verrà impostato a 0; viene usato per non aggiungere il carattere a capo alla fine di ogni riga, al fine di non danneggiare il testo quando viene copiato/incollato da WeeChat in un'altra applicazione (l'opzione è disabilitata per default, dato che può causare seri errori di visualizzazione)`
** tipo: bool
** valori: on, off (valore predefinito: `off`)
@@ -473,6 +473,11 @@
** tipo: bool
** valori: on, off (valore predefinito: `on`)
* *weechat.look.mouse*
** descrizione: `enable mouse support at startup (to enable it now, see /help mouse)`
** tipo: bool
** valori: on, off (valore predefinito: `off`)
* *weechat.look.nickmode*
** descrizione: `mostra modalità nick ((half)op/voice) prima di ogni nick`
** tipo: bool
@@ -599,7 +604,7 @@
** valori: qualsiasi stringa (valore predefinito: `"-"`)
* *weechat.look.separator_vertical*
** descrizione: `char used to draw vertical separators around bars (empty value will draw a real line with ncurses), wide chars are NOT allowed here`
** descrizione: `carattere usato per disegnare i separatori verticali intorno alle barre (un valore vuoto disegnerà una riga reale con ncurses), i caratteri wide NON sono consentiti`
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `""`)
+82 -1
View File
@@ -6051,7 +6051,7 @@ weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
I tipi di hook che seguono consentono la priorità: command, command_run,
signal, hsignal, config, completion, modifier, info, info_hashtable, infolist,
hdata.
hdata, focus.
weechat_hook_command
^^^^^^^^^^^^^^^^^^^^
@@ -8283,6 +8283,87 @@ struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
[NOTE]
Questa funzione non è disponibile nelle API per lo scripting.
// TRANSLATION MISSING
weechat_hook_focus
^^^^^^^^^^^^^^^^^^
Hook a focus: mouse event or key pressed in cursor mode (free movement of
cursor).
Prototipo:
[source,C]
----------------------------------------
struct t_hook *weechat_hook_focus (const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *info),
void *callback_data);
----------------------------------------
Argomenti:
* 'area': "chat" for chat area, or name of bar item
(priority allowed, see note about <<hook_priority,priority>>)
* 'callback': function called when focus is made, arguments and return
value:
** 'void *data': pointer
** 'struct t_hashtable *info': hashtable with info on focus and strings returned
by other calls to focus callbacks (with higher priority); keys and values
are of type "string"; info on focus (filled by WeeChat) are:
*** '_x': column of focus on screen (first column on the left is "0")
*** '_y': line of focus on screen (first line on top is "0")
*** '_window': pointer of window with focus ("0x0" for a bar of type "root"
or for unknown area)
*** '_bar_name': name of bar with focus (NULL for chat area or for unknown
area)
*** '_bar_item_name': name of bar item with focus (NULL if focus is not in a
bar or if focus is after the end of last bar item)
*** '_item_line': line with focus in bar item (first line of bar item is "0")
*** '_item_col': column with focus in bar item (first column of bar item is "0")
** return value: either "info" pointer (hashtable completed), or pointer to a
new hashtable (created by callback, with keys and values of type "string"),
this new hashtable content will be added to 'info' for other calls to focus
callbacks
* 'callback_data': pointer given to callback when it is called by WeeChat
Valore restituito:
* pointer to new hook, NULL if error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hashtable *
my_focus_nicklist_cb (void *data, struct t_hashtable *info)
{
/* add strings in hashtable */
/* ... */
return info;
}
/* add focus on nicklist */
struct t_hook *my_focus = weechat_hook_focus ("buffer_nicklist",
&my_focus_nicklist_cb, NULL);
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
hook = weechat.hook_focus(area, callback, callback_data)
# example
def my_focus_nicklist_cb(data, info):
# build dict
# ...
return my_dict
hook = weechat.hook_focus("buffer_nicklist", "my_focus_nicklist_cb", "")
----------------------------------------
weechat_unhook
^^^^^^^^^^^^^^
File diff suppressed because it is too large Load Diff
+6
View File
@@ -42,6 +42,7 @@
./src/gui/curses/gui-curses.h
./src/gui/curses/gui-curses-key.c
./src/gui/curses/gui-curses-main.c
./src/gui/curses/gui-curses-mouse.c
./src/gui/curses/gui-curses-window.c
./src/gui/gtk/gui-gtk-bar-window.c
./src/gui/gtk/gui-gtk-chat.c
@@ -49,6 +50,7 @@
./src/gui/gtk/gui-gtk.h
./src/gui/gtk/gui-gtk-key.c
./src/gui/gtk/gui-gtk-main.c
./src/gui/gtk/gui-gtk-mouse.c
./src/gui/gtk/gui-gtk-window.c
./src/gui/gui-bar.c
./src/gui/gui-bar.h
@@ -62,6 +64,10 @@
./src/gui/gui-chat.h
./src/gui/gui-color.c
./src/gui/gui-color.h
./src/gui/gui-cursor.c
./src/gui/gui-cursor.h
./src/gui/gui-mouse.c
./src/gui/gui-mouse.h
./src/gui/gui-completion.c
./src/gui/gui-completion.h
./src/gui/gui-filter.c
+136 -17
View File
File diff suppressed because it is too large Load Diff
+206 -70
View File
File diff suppressed because it is too large Load Diff
+136 -17
View File
File diff suppressed because it is too large Load Diff
+181 -28
View File
File diff suppressed because it is too large Load Diff
+127 -14
View File
File diff suppressed because it is too large Load Diff
+286 -139
View File
File diff suppressed because it is too large Load Diff
+136 -17
View File
File diff suppressed because it is too large Load Diff
+134 -18
View File
File diff suppressed because it is too large Load Diff
+127 -14
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -43,6 +43,7 @@ SET(WEECHAT_SOURCES
./src/gui/curses/gui-curses.h
./src/gui/curses/gui-curses-key.c
./src/gui/curses/gui-curses-main.c
./src/gui/curses/gui-curses-mouse.c
./src/gui/curses/gui-curses-window.c
./src/gui/gtk/gui-gtk-bar-window.c
./src/gui/gtk/gui-gtk-chat.c
@@ -50,6 +51,7 @@ SET(WEECHAT_SOURCES
./src/gui/gtk/gui-gtk.h
./src/gui/gtk/gui-gtk-key.c
./src/gui/gtk/gui-gtk-main.c
./src/gui/gtk/gui-gtk-mouse.c
./src/gui/gtk/gui-gtk-window.c
./src/gui/gui-bar.c
./src/gui/gui-bar.h
@@ -63,6 +65,8 @@ SET(WEECHAT_SOURCES
./src/gui/gui-chat.h
./src/gui/gui-color.c
./src/gui/gui-color.h
./src/gui/gui-cursor.c
./src/gui/gui-cursor.h
./src/gui/gui-completion.c
./src/gui/gui-completion.h
./src/gui/gui-filter.c
@@ -80,6 +84,8 @@ SET(WEECHAT_SOURCES
./src/gui/gui-line.c
./src/gui/gui-line.h
./src/gui/gui-main.h
./src/gui/gui-mouse.c
./src/gui/gui-mouse.h
./src/gui/gui-nicklist.c
./src/gui/gui-nicklist.h
./src/gui/gui-window.c
+115 -14
View File
File diff suppressed because it is too large Load Diff
+282 -34
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -45,11 +45,13 @@
#include "../plugins/plugin.h"
#include "../gui/gui-completion.h"
#include "../gui/gui-bar.h"
#include "../gui/gui-bar-window.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-key.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
/*
@@ -1225,6 +1227,47 @@ completion_list_add_keys_codes_for_reset_cb (void *data,
return WEECHAT_RC_OK;
}
/*
* completion_list_add_cursor_areas_cb: add areas for free cursor movement
* ("chat" and bar names)
*/
int
completion_list_add_cursor_areas_cb (void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_gui_bar_window *ptr_bar_win;
struct t_gui_bar *ptr_bar;
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
/* add "chat" for chat area */
gui_completion_list_add (completion, "chat", 0, WEECHAT_LIST_POS_SORT);
/* add bar windows (of current window) */
for (ptr_bar_win = gui_current_window->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
{
gui_completion_list_add (completion, ptr_bar_win->bar->name,
0, WEECHAT_LIST_POS_SORT);
}
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (ptr_bar->bar_window)
{
gui_completion_list_add (completion, ptr_bar->name,
0, WEECHAT_LIST_POS_SORT);
}
}
return WEECHAT_RC_OK;
}
/*
* completion_init: add hooks for completions done by WeeChat core
*/
@@ -1311,4 +1354,7 @@ completion_init ()
N_("key codes that can be reset (keys added, redefined "
"or removed)"),
&completion_list_add_keys_codes_for_reset_cb, NULL);
hook_completion (NULL, "cursor_areas",
N_("areas (\"chat\" or bar name) for free cursor movement"),
&completion_list_add_cursor_areas_cb, NULL);
}
+7
View File
@@ -56,6 +56,7 @@
#include "../gui/gui-layout.h"
#include "../gui/gui-line.h"
#include "../gui/gui-main.h"
#include "../gui/gui-mouse.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
#include "../plugins/plugin.h"
@@ -108,6 +109,7 @@ struct t_config_option *config_look_input_undo_max;
struct t_config_option *config_look_item_time_format;
struct t_config_option *config_look_jump_current_to_previous_buffer;
struct t_config_option *config_look_jump_previous_buffer_when_closing;
struct t_config_option *config_look_mouse;
struct t_config_option *config_look_nickmode;
struct t_config_option *config_look_nickmode_empty;
struct t_config_option *config_look_paste_max_lines;
@@ -1794,6 +1796,11 @@ config_weechat_init_options ()
N_("jump to previously visited buffer when closing a buffer (if "
"disabled, then jump to buffer number - 1)"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_mouse = config_file_new_option (
weechat_config_file, ptr_section,
"mouse", "boolean",
N_("enable mouse support at startup (to enable it now, see /help mouse)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_nickmode = config_file_new_option (
weechat_config_file, ptr_section,
"nickmode", "boolean",
+1
View File
@@ -133,6 +133,7 @@ extern struct t_config_option *config_look_input_undo_max;
extern struct t_config_option *config_look_item_time_format;
extern struct t_config_option *config_look_jump_current_to_previous_buffer;
extern struct t_config_option *config_look_jump_previous_buffer_when_closing;
extern struct t_config_option *config_look_mouse;
extern struct t_config_option *config_look_nickmode;
extern struct t_config_option *config_look_nickmode_empty;
extern struct t_config_option *config_look_paste_max_lines;
+169
View File
File diff suppressed because it is too large Load Diff
+21 -34
View File
@@ -24,9 +24,12 @@
#include <gnutls/gnutls.h>
#endif
struct t_gui_bar;
struct t_gui_buffer;
struct t_gui_line;
struct t_gui_completion;
struct t_gui_cursor_info;
struct t_gui_window;
struct t_weelist;
struct t_hashtable;
struct t_infolist;
@@ -51,6 +54,7 @@ enum t_hook_type
HOOK_TYPE_INFO_HASHTABLE, /* get some info as hashtable */
HOOK_TYPE_INFOLIST, /* get some info as infolist */
HOOK_TYPE_HDATA, /* get hdata pointer */
HOOK_TYPE_FOCUS, /* focus event (mouse/key) */
/* number of hook types */
HOOK_NUM_TYPES,
};
@@ -91,6 +95,7 @@ enum t_hook_type
#define HOOK_INFO_HASHTABLE(hook, var) (((struct t_hook_info_hashtable *)hook->hook_data)->var)
#define HOOK_INFOLIST(hook, var) (((struct t_hook_infolist *)hook->hook_data)->var)
#define HOOK_HDATA(hook, var) (((struct t_hook_hdata *)hook->hook_data)->var)
#define HOOK_FOCUS(hook, var) (((struct t_hook_focus *)hook->hook_data)->var)
struct t_hook
{
@@ -374,6 +379,17 @@ struct t_hook_hdata
char *description; /* description */
};
/* hook focus */
typedef struct t_hashtable *(t_hook_callback_focus)(void *data,
struct t_hashtable *info);
struct t_hook_focus
{
t_hook_callback_focus *callback; /* focus callback */
char *area; /* "chat" or bar item name */
};
/* hook variables */
extern struct t_hook *weechat_hooks[];
@@ -521,43 +537,14 @@ extern struct t_hook *hook_hdata (struct t_weechat_plugin *plugin,
void *callback_data);
extern struct t_hdata *hook_hdata_get (struct t_weechat_plugin *plugin,
const char *hdata_name);
extern struct t_hook *hook_focus (struct t_weechat_plugin *plugin,
const char *area,
t_hook_callback_focus *callback,
void *callback_data);
extern struct t_hashtable *hook_focus_get_data (struct t_gui_cursor_info *cursor_info);
extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
extern void unhook_all ();
extern struct t_hdata *hook_hdata_hook_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_command_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_command_run_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_timer_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_fd_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_process_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_connect_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_print_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_signal_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_hsignal_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_config_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_completion_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_modifier_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_info_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_info_hashtable_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_infolist_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_hdata_cb (void *data,
const char *hdata_name);
extern int hook_add_to_infolist (struct t_infolist *infolist,
const char *arguments);
extern void hook_print_log ();
+87
View File
@@ -54,6 +54,7 @@
#include "weechat.h"
#include "wee-string.h"
#include "wee-config.h"
#include "wee-hashtable.h"
#include "wee-utf8.h"
#include "../gui/gui-color.h"
@@ -1602,3 +1603,89 @@ string_input_for_buffer (const char *string)
/* string is a command */
return NULL;
}
/*
* string_replace_with_hashtable: replace ${codes} with value from hashtable
* "errors" is set with number of keys not found
* in hashtable
*/
char *
string_replace_with_hashtable (const char *string,
struct t_hashtable *hashtable,
int *errors)
{
int length, length_value, index_string, index_result;
char *result, *key;
const char *pos_end_name, *ptr_value;
*errors = 0;
if (!string)
return NULL;
if (!hashtable)
return strdup (string);
length = strlen (string) + 1;
result = malloc (length);
if (result)
{
index_string = 0;
index_result = 0;
while (string[index_string])
{
if ((string[index_string] == '\\')
&& (string[index_string + 1] == '$'))
{
index_string++;
result[index_result++] = string[index_string++];
}
else if ((string[index_string] == '$')
&& (string[index_string + 1] == '{'))
{
pos_end_name = strchr (string + index_string + 2, '}');
if (pos_end_name)
{
key = string_strndup (string + index_string + 2,
pos_end_name - (string + index_string + 2));
if (key)
{
ptr_value = (const char *)hashtable_get (hashtable, key);
if (ptr_value)
{
length_value = strlen (ptr_value);
length += length_value;
result = realloc (result, length);
if (!result)
{
free (key);
return NULL;
}
strcpy (result + index_result, ptr_value);
index_result += length_value;
index_string += pos_end_name - string -
index_string + 1;
}
else
{
result[index_result++] = string[index_string++];
(*errors)++;
}
free (key);
}
else
result[index_result++] = string[index_string++];
}
else
result[index_result++] = string[index_string++];
}
else
result[index_result++] = string[index_string++];
}
result[index_result] = '\0';
}
return result;
}
+5
View File
@@ -22,6 +22,8 @@
#include <regex.h>
struct t_hashtable;
extern char *string_strndup (const char *string, int length);
extern void string_tolower (char *string);
extern void string_toupper (char *string);
@@ -66,5 +68,8 @@ extern void string_encode_base64 (const char *from, int length, char *to);
extern int string_decode_base64 (const char *from, char *to);
extern int string_is_command_char (const char *string);
extern const char *string_input_for_buffer (const char *string);
extern char *string_replace_with_hashtable (const char *string,
struct t_hashtable *hashtable,
int *errors);
#endif /* __WEECHAT_STRING_H */
+2
View File
@@ -24,6 +24,7 @@ gui-bar-window.c gui-bar-window.h
gui-buffer.c gui-buffer.h
gui-chat.c gui-chat.h
gui-color.c gui-color.h
gui-cursor.c gui-cursor.h
gui-filter.c gui-filter.h
gui-completion.c gui-completion.h
gui-history.c gui-history.h
@@ -33,6 +34,7 @@ gui-key.c gui-key.h
gui-layout.c gui-layout.h
gui-line.c gui-line.h
gui-main.h
gui-mouse.c gui-mouse.h
gui-nicklist.c gui-nicklist.h
gui-window.c gui-window.h)
+4
View File
@@ -33,6 +33,8 @@ lib_weechat_gui_common_a_SOURCES = gui-bar.c \
gui-chat.h \
gui-color.c \
gui-color.h \
gui-cursor.c \
gui-cursor.h \
gui-completion.c \
gui-completion.h \
gui-filter.c \
@@ -50,6 +52,8 @@ lib_weechat_gui_common_a_SOURCES = gui-bar.c \
gui-line.c \
gui-line.h \
gui-main.h \
gui-mouse.c \
gui-mouse.h \
gui-nicklist.c \
gui-nicklist.h \
gui-window.c \
+3
View File
@@ -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)
+3 -1
View File
@@ -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
File diff suppressed because it is too large Load Diff
+2
View File
@@ -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;
}
File diff suppressed because it is too large Load Diff
+15 -2
View File
@@ -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 ();
File diff suppressed because it is too large Load Diff
+17 -1
View File
@@ -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
*/
+1
View File
@@ -25,6 +25,7 @@ gui-gtk-chat.c
gui-gtk-color.c
gui-gtk-key.c
gui-gtk-main.c
gui-gtk-mouse.c
gui-gtk-term.c
gui-gtk-window.c)
+1
View File
@@ -37,6 +37,7 @@ weechat_gtk_SOURCES = gui-gtk-bar-window.c \
gui-gtk-color.c \
gui-gtk-key.c \
gui-gtk-main.c \
gui-gtk-mouse.c \
gui-gtk-term.c \
gui-gtk-window.c \
gui-gtk.h
+94
View File
@@ -0,0 +1,94 @@
/*
* 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-gtk-mouse.c: mouse functions for Gtk GUI
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "../../core/weechat.h"
#include "../gui-mouse.h"
/*
* gui_mouse_enable: enable mouse
*/
void
gui_mouse_enable ()
{
/* This function does nothing in Gtk GUI */
}
/*
* gui_mouse_disable: disable mouse
*/
void
gui_mouse_disable ()
{
/* This function does nothing in Gtk GUI */
}
/*
* gui_mouse_display_state: display state of mouse
*/
void
gui_mouse_display_state ()
{
/* This function does nothing in Gtk GUI */
}
/*
* gui_mouse_grab_init: init "grab mouse" mode
*/
void
gui_mouse_grab_init ()
{
/* This function does nothing in Gtk GUI */
}
/*
* gui_mouse_grab_code2key: get key name with a mouse code
*/
const char *
gui_mouse_grab_code2key (const char *code)
{
(void) code;
/* This function does nothing in Gtk GUI */
return NULL;
}
/*
* gui_mouse_grab_end: end "grab mouse" mode
*/
void
gui_mouse_grab_end ()
{
/* This function does nothing in Gtk GUI */
}
+10
View File
@@ -848,6 +848,16 @@ gui_window_set_title (const char *title)
/* TODO: write this function for Gtk */
}
/*
* gui_window_move_cursor: move cursor on screen (for cursor mode)
*/
void
gui_window_move_cursor ()
{
/* TODO: write this function for Gtk */
}
/*
* gui_window_term_display_infos: display some infos about terminal and colors
*/
+195 -151
View File
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -74,13 +74,15 @@ extern char *gui_bar_items_default_for_bars[][2];
extern int gui_bar_item_valid (struct t_gui_bar_item *bar_item);
extern struct t_gui_bar_item *gui_bar_item_search (const char *name);
extern int gui_bar_item_string_is_item (const char *string,
const char *item_name);
extern int gui_bar_item_used_in_a_bar (const char *item_name,
int partial_name);
extern char *gui_bar_item_get_value (const char *name,
struct t_gui_bar *bar,
struct t_gui_window *window);
extern void gui_bar_item_set_prefix_name_suffix (const char *item_name,
char **prefix, char **name,
char **suffix);
extern char *gui_bar_item_get_value (struct t_gui_bar *bar,
struct t_gui_window *window,
int item, int subitem);
extern int gui_bar_item_count_lines (char *string);
extern struct t_gui_bar_item *gui_bar_item_new (struct t_weechat_plugin *plugin,
const char *name,
char *(*build_callback)(void *data,
+429 -80
View File
File diff suppressed because it is too large Load Diff
+34 -3
View File
@@ -20,9 +20,19 @@
#ifndef __WEECHAT_GUI_BAR_WINDOW_H
#define __WEECHAT_GUI_BAR_WINDOW_H 1
struct t_infolist;
struct t_gui_window;
enum t_gui_bar_position;
struct t_gui_bar_window_coords
{
int item; /* index of item */
int subitem; /* index of sub item */
int line; /* line */
int x; /* X on screen */
int y; /* Y on screen */
};
struct t_gui_bar_window
{
struct t_gui_bar *bar; /* pointer to bar */
@@ -34,8 +44,14 @@ struct t_gui_bar_window
int current_size; /* current size (width or height) */
int items_count; /* number of bar items */
int *items_subcount; /* number of sub items */
char ***items_content; /* content for each item/sub item of bar*/
char ***items_content; /* content for each (sub)item of bar */
int **items_num_lines; /* number of lines for each (sub)item */
int **items_refresh_needed; /* refresh needed for (sub)item? */
int screen_col_size; /* size of columns on screen */
/* (for filling with columns) */
int coords_count; /* number of coords saved */
struct t_gui_bar_window_coords **coords; /* coords for filling horiz. */
/* (size is 5 * coords_count) */
void *gui_objects; /* pointer to a GUI specific struct */
struct t_gui_bar_window *prev_bar_window; /* link to previous bar win */
/* (only for non-root bars) */
@@ -46,6 +62,12 @@ struct t_gui_bar_window
/* functions */
extern int gui_bar_window_valid (struct t_gui_bar_window *bar_window);
extern void gui_bar_window_search_by_xy (struct t_gui_window *window,
int x, int y,
struct t_gui_bar_window **bar_window,
char **bar_item,
int *item_line,
int *item_col);
extern void gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window,
struct t_gui_window *window);
extern void gui_bar_window_content_build (struct t_gui_bar_window *bar_window,
@@ -61,8 +83,15 @@ extern void gui_bar_window_set_current_size (struct t_gui_bar_window *bar_window
extern int gui_bar_window_get_size (struct t_gui_bar *bar,
struct t_gui_window *window,
enum t_gui_bar_position position);
extern int gui_bar_window_new (struct t_gui_bar *bar,
struct t_gui_window *window);
extern void gui_bar_window_coords_add (struct t_gui_bar_window *bar_window,
int index_item, int index_subitem,
int index_line,
int x, int y);
extern void gui_bar_window_coords_free (struct t_gui_bar_window *bar_window);
extern void gui_bar_window_insert (struct t_gui_bar_window *bar_window,
struct t_gui_window *window);
extern void gui_bar_window_new (struct t_gui_bar *bar,
struct t_gui_window *window);
extern void gui_bar_window_free (struct t_gui_bar_window *bar_window,
struct t_gui_window *window);
extern int gui_bar_window_remove_unused_bars (struct t_gui_window *window);
@@ -72,6 +101,8 @@ extern void gui_bar_window_scroll (struct t_gui_bar_window *bar_window,
int add_x, int scroll_beginning,
int scroll_end, int add, int percent,
int value);
extern struct t_hdata *gui_bar_window_hdata_bar_window_cb (void *data,
const char *hdata_name);
extern int gui_bar_window_add_to_infolist (struct t_infolist *infolist,
struct t_gui_bar_window *bar_window);
extern void gui_bar_window_print_log (struct t_gui_bar_window *bar_window);
+152 -46
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -20,6 +20,7 @@
#ifndef __WEECHAT_GUI_BAR_H
#define __WEECHAT_GUI_BAR_H 1
struct t_infolist;
struct t_weechat_plugin;
struct t_gui_window;
struct t_gui_buffer;
@@ -89,6 +90,9 @@ struct t_gui_bar
int items_count; /* number of bar items */
int *items_subcount; /* number of sub items */
char ***items_array; /* bar items (after split) */
char ***items_prefix; /* prefix for each (sub)item */
char ***items_name; /* name for each (sub)item */
char ***items_suffix; /* suffix for each (sub)item */
struct t_gui_bar_window *bar_window; /* pointer to bar window */
/* (for type root only) */
int bar_refresh_needed; /* refresh for bar is needed? */
+2
View File
@@ -515,6 +515,8 @@ gui_color_decode (const char *string, const char *replacement)
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:
ptr_string++;
break;
}
+2
View File
@@ -104,6 +104,8 @@ enum t_gui_color_enum
#define GUI_COLOR_BAR_START_INPUT_CHAR '_'
#define GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR '-'
#define GUI_COLOR_BAR_MOVE_CURSOR_CHAR '#'
#define GUI_COLOR_BAR_START_ITEM 'i'
#define GUI_COLOR_BAR_START_LINE_ITEM 'l'
#define GUI_COLOR_EXTENDED_FLAG 0x0100000
#define GUI_COLOR_EXTENDED_BOLD_FLAG 0x0200000
+1 -1
View File
@@ -1027,7 +1027,7 @@ gui_completion_complete (struct t_gui_completion *completion)
other_completion++;
}
if (completion->word_found &&
(string_strcasecmp (ptr_item->data, completion->word_found) == 0))
(strcmp (ptr_item->data, completion->word_found) == 0))
word_found_seen = 1;
if (completion->direction < 0)
File diff suppressed because it is too large Load Diff
+54
View File
@@ -0,0 +1,54 @@
/*
* 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/>.
*/
#ifndef __WEECHAT_GUI_CURSOR_H
#define __WEECHAT_GUI_CURSOR_H 1
/* cursor structures */
struct t_gui_cursor_info
{
int x, y; /* (x,y) on screen */
struct t_gui_window *window; /* window found */
int chat; /* 1 for chat area, otherwise 0 */
struct t_gui_bar_window *bar_window; /* bar window found */
char *bar_item; /* bar item found */
int item_line; /* line in bar item */
int item_col; /* column in bar item */
};
/* cursor variables */
extern int gui_cursor_mode;
extern int gui_cursor_debug;
extern int gui_cursor_x;
extern int gui_cursor_y;
/* cursor functions */
extern void gui_cursor_mode_toggle ();
extern void gui_cursor_debug_toggle ();
extern void gui_cursor_get_info (int x, int y,
struct t_gui_cursor_info *cursor_info);
extern void gui_cursor_move_xy (int x, int y);
extern void gui_cursor_move_add_xy (int add_x, int add_y);
extern void gui_cursor_move_area_add_xy (int add_x, int add_y);
extern void gui_cursor_move_area (const char *area);
#endif /* __WEECHAT_GUI_CURSOR_H */
+25 -21
View File
@@ -38,6 +38,7 @@
#include "gui-input.h"
#include "gui-buffer.h"
#include "gui-completion.h"
#include "gui-cursor.h"
#include "gui-history.h"
#include "gui-hotlist.h"
#include "gui-key.h"
@@ -117,26 +118,29 @@ gui_input_text_changed_modifier_and_signal (struct t_gui_buffer *buffer,
{
char str_buffer[128], *new_input;
if (save_undo)
gui_buffer_undo_add (buffer);
/* send modifier, and change input if needed */
snprintf (str_buffer, sizeof (str_buffer),
"0x%lx", (long unsigned int)buffer);
new_input = hook_modifier_exec (NULL,
"input_text_content",
str_buffer,
(buffer->input_buffer) ?
buffer->input_buffer : "");
if (new_input)
if (!gui_cursor_mode)
{
if (!buffer->input_buffer
|| strcmp (new_input, buffer->input_buffer) != 0)
if (save_undo)
gui_buffer_undo_add (buffer);
/* send modifier, and change input if needed */
snprintf (str_buffer, sizeof (str_buffer),
"0x%lx", (long unsigned int)buffer);
new_input = hook_modifier_exec (NULL,
"input_text_content",
str_buffer,
(buffer->input_buffer) ?
buffer->input_buffer : "");
if (new_input)
{
/* input has been changed by modifier, use it */
gui_input_replace_input (buffer, new_input);
if (!buffer->input_buffer
|| strcmp (new_input, buffer->input_buffer) != 0)
{
/* input has been changed by modifier, use it */
gui_input_replace_input (buffer, new_input);
}
free (new_input);
}
free (new_input);
}
/* send signal */
@@ -1339,10 +1343,10 @@ gui_input_hotlist_clear (struct t_gui_buffer *buffer)
*/
void
gui_input_grab_key (struct t_gui_buffer *buffer)
gui_input_grab_key (struct t_gui_buffer *buffer, const char *delay)
{
if (buffer->input)
gui_key_grab_init (0);
gui_key_grab_init (0, delay);
}
/*
@@ -1351,10 +1355,10 @@ gui_input_grab_key (struct t_gui_buffer *buffer)
*/
void
gui_input_grab_key_command (struct t_gui_buffer *buffer)
gui_input_grab_key_command (struct t_gui_buffer *buffer, const char *delay)
{
if (buffer->input)
gui_key_grab_init (1);
gui_key_grab_init (1, delay);
}
/*
+4 -2
View File
@@ -70,8 +70,10 @@ extern void gui_input_jump_last_buffer (struct t_gui_buffer *buffer);
extern void gui_input_jump_previously_visited_buffer (struct t_gui_buffer *buffer);
extern void gui_input_jump_next_visited_buffer (struct t_gui_buffer *buffer);
extern void gui_input_hotlist_clear (struct t_gui_buffer *buffer);
extern void gui_input_grab_key (struct t_gui_buffer *buffer);
extern void gui_input_grab_key_command (struct t_gui_buffer *buffer);
extern void gui_input_grab_key (struct t_gui_buffer *buffer,
const char *delay);
extern void gui_input_grab_key_command (struct t_gui_buffer *buffer,
const char *delay);
extern void gui_input_scroll_unread (struct t_gui_buffer *buffer);
extern void gui_input_set_unread ();
extern void gui_input_set_unread_current (struct t_gui_buffer *buffer);
+303 -37
View File
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -22,10 +22,14 @@
#define GUI_KEY_BUFFER_BLOCK_SIZE 256
#define GUI_KEY_GRAB_DELAY_DEFAULT 500
enum t_gui_key_context
{
GUI_KEY_CONTEXT_DEFAULT = 0,
GUI_KEY_CONTEXT_SEARCH,
GUI_KEY_CONTEXT_CURSOR,
GUI_KEY_CONTEXT_MOUSE,
/* number of key contexts */
GUI_KEY_NUM_CONTEXTS,
};
@@ -62,8 +66,7 @@ extern time_t gui_key_last_activity_time;
extern void gui_key_init ();
extern int gui_key_search_context (const char *context);
extern void gui_key_grab_init (int grab_command);
extern void gui_key_grab_end ();
extern void gui_key_grab_init (int grab_command, const char *delay);
extern char *gui_key_get_internal_code (const char *key);
extern char *gui_key_get_expanded_name (const char *key);
extern struct t_gui_key *gui_key_new (struct t_gui_buffer *buffer,
+74
View File
@@ -0,0 +1,74 @@
/*
* 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-mouse.c: functions for mouse (used by all GUI)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "../core/weechat.h"
#include "gui-chat.h"
int gui_mouse_enabled = 0; /* 1 if mouse support is enabled */
int gui_mouse_debug = 0; /* debug mode for mouse */
int gui_mouse_grab = 0; /* 1 if grab mouse code enabled */
int gui_mouse_event_index = 0; /* index for x/y in array (0 or 1) */
int gui_mouse_event_x[2] = { 0, 0 }; /* position of latest mouse event: */
/* (on click, on release) */
int gui_mouse_event_y[2] = { 0, 0 }; /* position of latest mouse event */
/* (on click, on release) */
char gui_mouse_event_button = '#'; /* button pressed (or wheel) */
/*
* gui_mouse_debug_toggle: toggle debug for mouse events
*/
void
gui_mouse_debug_toggle ()
{
gui_mouse_debug ^= 1;
if (gui_mouse_debug)
gui_chat_printf (NULL, _("Debug enabled for mouse"));
else
gui_chat_printf (NULL, _("Debug disabled for mouse"));
}
/*
* gui_mouse_reset_event: reset event values
*/
void
gui_mouse_reset_event ()
{
gui_mouse_event_index = 0;
gui_mouse_event_x[0] = 0;
gui_mouse_event_y[0] = 0;
gui_mouse_event_x[1] = 0;
gui_mouse_event_y[1] = 0;
gui_mouse_event_button = '#';
}
+47
View File
@@ -0,0 +1,47 @@
/*
* 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/>.
*/
#ifndef __WEECHAT_GUI_MOUSE_H
#define __WEECHAT_GUI_MOUSE_H 1
/* mouse variables */
extern int gui_mouse_enabled;
extern int gui_mouse_debug;
extern int gui_mouse_grab;
extern int gui_mouse_event_index;
extern int gui_mouse_event_x[2];
extern int gui_mouse_event_y[2];
extern char gui_mouse_event_button;
/* mouse functions */
extern void gui_mouse_debug_toggle ();
extern void gui_mouse_reset_event ();
/* mouse functions (GUI dependent) */
extern void gui_mouse_enable ();
extern void gui_mouse_disable ();
extern void gui_mouse_display_state ();
extern void gui_mouse_grab_init ();
extern const char *gui_mouse_grab_code2key (const char *code);
extern void gui_mouse_grab_end ();
#endif /* __WEECHAT_GUI_MOUSE_H */
+29 -2
View File
@@ -70,8 +70,35 @@ struct t_gui_layout_window *gui_window_layout_before_zoom = NULL;
/* layout before zooming on a window */
int gui_window_layout_id_current_window = -1;
/* current window id before zoom */
int gui_window_cursor_x = 0; /* cursor pos on screen */
int gui_window_cursor_y = 0; /* cursor pos on screen */
/*
* gui_window_search_by_xy: get pointer of window displayed at (x,y)
* return NULL if no window is found
*/
struct t_gui_window *
gui_window_search_by_xy (int x, int y)
{
struct t_gui_window *ptr_window;
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if ((x >= ptr_window->win_x) && (y >= ptr_window->win_y)
&& (x <= ptr_window->win_x + ptr_window->win_width - 1)
&& (y <= ptr_window->win_y + ptr_window->win_height - 1))
{
return ptr_window;
}
}
/* no window at this location */
return NULL;
}
/*
* gui_window_ask_refresh: set "gui_window_refresh_needed" flag
*/
@@ -1293,8 +1320,8 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, bar_windows, POINTER, NULL);
HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, NULL);
HDATA_VAR(struct t_gui_window, bar_windows, POINTER, "bar_window");
HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, "bar_window");
HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, gui_objects, POINTER, NULL);
HDATA_VAR(struct t_gui_window, buffer, POINTER, "buffer");
+5
View File
@@ -27,10 +27,12 @@
#define GUI_WINDOW_CHAT_MIN_HEIGHT 2
struct t_infolist;
struct t_gui_bar_window;
extern int gui_init_ok;
extern int gui_ok;
extern int gui_window_refresh_needed;
extern int gui_window_cursor_x, gui_window_cursor_y;
/* window structures */
@@ -116,6 +118,8 @@ extern struct t_gui_window *gui_current_window;
extern struct t_gui_window_tree *gui_windows_tree;
/* window functions */
extern struct t_gui_window *gui_window_search_by_xy (int x, int y);
extern void gui_window_ask_refresh (int refresh);
extern int gui_window_tree_init (struct t_gui_window *window);
extern void gui_window_tree_node_to_leaf (struct t_gui_window_tree *node,
@@ -200,6 +204,7 @@ extern int gui_window_balance (struct t_gui_window_tree *tree);
extern void gui_window_swap (struct t_gui_window *window, int direction);
extern void gui_window_refresh_screen (int full_refresh);
extern void gui_window_set_title (const char *title);
extern void gui_window_move_cursor ();
extern void gui_window_term_display_infos ();
extern void gui_window_objects_print_log (struct t_gui_window *window);
+45
View File
@@ -492,6 +492,49 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
return NULL;
}
/*
* irc_bar_item_focus_buffer_nicklist: focus on nicklist
*/
struct t_hashtable *
irc_bar_item_focus_buffer_nicklist (void *data,
struct t_hashtable *info)
{
long unsigned int value;
int rc;
struct t_gui_buffer *buffer;
struct t_irc_nick *ptr_nick;
const char *str_buffer, *nick;
str_buffer = weechat_hashtable_get (info, "_buffer");
rc = sscanf (str_buffer, "%lx", &value);
if ((rc == EOF) || (rc == 0))
return NULL;
buffer = (struct t_gui_buffer *)value;
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
(void) data;
if (ptr_channel)
{
nick = weechat_hashtable_get (info, "nick");
if (nick)
{
ptr_nick = irc_nick_search (ptr_channel, nick);
if (ptr_nick && ptr_nick->host)
{
weechat_hashtable_set (info, "host", ptr_nick->host);
return info;
}
}
}
return NULL;
}
/*
* irc_bar_item_init: initialize IRC bar items
*/
@@ -506,4 +549,6 @@ irc_bar_item_init ()
weechat_bar_item_new ("irc_channel", &irc_bar_item_channel, NULL);
weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL);
weechat_bar_item_new ("input_prompt", &irc_bar_item_input_prompt, NULL);
weechat_hook_focus ("500|buffer_nicklist",
&irc_bar_item_focus_buffer_nicklist, NULL);
}
+10
View File
@@ -50,6 +50,7 @@
#include "../gui/gui-chat.h"
#include "../gui/gui-completion.h"
#include "../gui/gui-color.h"
#include "../gui/gui-cursor.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-history.h"
#include "../gui/gui-hotlist.h"
@@ -365,6 +366,11 @@ plugin_api_info_get_internal (void *data, const char *info_name,
snprintf (value, sizeof (value), "%d", gui_filters_enabled);
return value;
}
else if (string_strcasecmp (info_name, "cursor_mode") == 0)
{
snprintf (value, sizeof (value), "%d", gui_cursor_mode);
return value;
}
/* info not found */
return NULL;
@@ -997,6 +1003,8 @@ plugin_api_init ()
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "filters_enabled", N_("1 if filters are enabled"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "cursor_mode", N_("1 if cursor mode is enabled"), NULL,
&plugin_api_info_get_internal, NULL);
/* WeeChat core infolist hooks */
hook_infolist (NULL, "bar", N_("list of bars"),
@@ -1064,6 +1072,8 @@ plugin_api_init ()
&gui_bar_hdata_bar_cb, NULL);
hook_hdata (NULL, "bar_item", N_("bar item"),
&gui_bar_item_hdata_bar_item_cb, NULL);
hook_hdata (NULL, "bar_window", N_("bar window"),
&gui_bar_window_hdata_bar_window_cb, NULL);
hook_hdata (NULL, "buffer", N_("buffer"),
&gui_buffer_hdata_buffer_cb, NULL);
hook_hdata (NULL, "completion", N_("structure with completion"),
+1
View File
@@ -607,6 +607,7 @@ plugin_load (const char *filename)
new_plugin->hook_info_hashtable = &hook_info_hashtable;
new_plugin->hook_infolist = &hook_infolist;
new_plugin->hook_hdata = &hook_hdata;
new_plugin->hook_focus = &hook_focus;
new_plugin->unhook = &unhook;
new_plugin->unhook_all = &unhook_all_plugin;
+71
View File
@@ -4692,6 +4692,76 @@ weechat_lua_api_hook_infolist (lua_State *L)
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hook_focus_cb: callback for focus hooked
*/
struct t_hashtable *
weechat_lua_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
void *lua_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
lua_argv[1] = info;
return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", lua_argv);
}
return NULL;
}
/*
* weechat_lua_api_hook_focus: hook a focus
*/
static int
weechat_lua_api_hook_focus (lua_State *L)
{
const char *area, *function, *data;
char *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_focus");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_focus");
LUA_RETURN_EMPTY;
}
area = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_hook_focus (weechat_lua_plugin,
lua_current_script,
area,
&weechat_lua_api_hook_focus_cb,
function,
data));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_unhook: unhook something
*/
@@ -8322,6 +8392,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "hook_info", &weechat_lua_api_hook_info },
{ "hook_info_hashtable", &weechat_lua_api_hook_info_hashtable },
{ "hook_infolist", &weechat_lua_api_hook_infolist },
{ "hook_focus", &weechat_lua_api_hook_focus },
{ "unhook", &weechat_lua_api_unhook },
{ "unhook_all", &weechat_lua_api_unhook_all },
{ "buffer_new", &weechat_lua_api_buffer_new },
@@ -4266,6 +4266,72 @@ XS (XS_weechat_api_hook_infolist)
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat_perl_api_hook_focus_cb: callback for focus hooked
*/
struct t_hashtable *
weechat_perl_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
void *perl_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
perl_argv[1] = info;
return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", perl_argv);
}
return NULL;
}
/*
* weechat::hook_focus: hook a focus
*/
XS (XS_weechat_api_hook_focus)
{
char *result, *area, *function, *data;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_focus");
PERL_RETURN_EMPTY;
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_focus");
PERL_RETURN_EMPTY;
}
area = SvPV (ST (0), PL_na);
function = SvPV (ST (1), PL_na);
data = SvPV (ST (2), PL_na);
result = script_ptr2str (script_api_hook_focus (weechat_perl_plugin,
perl_current_script,
area,
&weechat_perl_api_hook_focus_cb,
function,
data));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::unhook: unhook something
*/
@@ -7213,6 +7279,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::hook_info", XS_weechat_api_hook_info, "weechat");
newXS ("weechat::hook_info_hashtable", XS_weechat_api_hook_info_hashtable, "weechat");
newXS ("weechat::hook_infolist", XS_weechat_api_hook_infolist, "weechat");
newXS ("weechat::hook_focus", XS_weechat_api_hook_focus, "weechat");
newXS ("weechat::unhook", XS_weechat_api_unhook, "weechat");
newXS ("weechat::unhook_all", XS_weechat_api_unhook_all, "weechat");
newXS ("weechat::buffer_new", XS_weechat_api_buffer_new, "weechat");
File diff suppressed because it is too large Load Diff
@@ -4873,6 +4873,78 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hook_focus_cb: callback for focus hooked
*/
struct t_hashtable *
weechat_ruby_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
void *ruby_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
ruby_argv[1] = info;
return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", ruby_argv);
}
return NULL;
}
/*
* weechat_ruby_api_hook_focus: hook a focus
*/
static VALUE
weechat_ruby_api_hook_focus (VALUE class, VALUE area, VALUE function,
VALUE data)
{
char *c_area, *c_function, *c_data, *result;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_focus");
RUBY_RETURN_EMPTY;
}
if (NIL_P (area) || NIL_P (function) || NIL_P (data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_focus");
RUBY_RETURN_EMPTY;
}
Check_Type (area, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
c_area = StringValuePtr (area);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
result = script_ptr2str (script_api_hook_focus (weechat_ruby_plugin,
ruby_current_script,
c_area,
&weechat_ruby_api_hook_focus_cb,
c_function,
c_data));
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_unhook: unhook something
*/
@@ -8279,6 +8351,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 5);
rb_define_module_function (ruby_mWeechat, "hook_info_hashtable", &weechat_ruby_api_hook_info_hashtable, 6);
rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 6);
rb_define_module_function (ruby_mWeechat, "hook_focus", &weechat_ruby_api_hook_focus, 3);
rb_define_module_function (ruby_mWeechat, "unhook", &weechat_ruby_api_unhook, 1);
rb_define_module_function (ruby_mWeechat, "unhook_all", &weechat_ruby_api_unhook_all, 0);
rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 5);
+37
View File
@@ -1328,6 +1328,43 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
return new_hook;
}
/*
* script_api_hook_focus: hook a focus
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *info),
const char *function,
const char *data)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_focus (area, callback, new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
free (new_script_callback);
return NULL;
}
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
script_callback_add (script, new_script_callback);
return new_hook;
}
/*
* script_api_unhook: unhook something
*/
+7
View File
@@ -276,6 +276,13 @@ extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat
const char *arguments),
const char *function,
const char *data);
extern struct t_hook *script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *info),
const char *function,
const char *data);
extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook);
+71
View File
@@ -4791,6 +4791,75 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hook_focus_cb: callback for focus hooked
*/
struct t_hashtable *
weechat_tcl_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
void *tcl_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
tcl_argv[1] = info;
return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", tcl_argv);
}
return NULL;
}
/*
* weechat_tcl_api_hook_focus: hook a focus
*/
static int
weechat_tcl_api_hook_focus (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *result, *area, *function, *data;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_focus");
TCL_RETURN_EMPTY;
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_focus");
TCL_RETURN_EMPTY;
}
area = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
result = script_ptr2str (script_api_hook_focus (weechat_tcl_plugin,
tcl_current_script,
area,
&weechat_tcl_api_hook_focus_cb,
function,
data));
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_unhook: unhook something
*/
@@ -8205,6 +8274,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_hook_info_hashtable, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hook_infolist",
weechat_tcl_api_hook_infolist, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hook_focus",
weechat_tcl_api_hook_focus, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::unhook",
weechat_tcl_api_unhook, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::unhook_all",
+9 -1
View File
@@ -46,7 +46,7 @@ struct timeval;
*/
/* API version (used to check that plugin has same API and can be loaded) */
#define WEECHAT_PLUGIN_API_VERSION "20110613-01"
#define WEECHAT_PLUGIN_API_VERSION "20110726-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -584,6 +584,11 @@ struct t_weechat_plugin
struct t_hdata *(*callback)(void *data,
const char *hdata_name),
void *callback_data);
struct t_hook *(*hook_focus) (struct t_weechat_plugin *plugin,
const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *info),
void *callback_data);
void (*unhook) (struct t_hook *hook);
void (*unhook_all) (struct t_weechat_plugin *plugin);
@@ -1281,6 +1286,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__data) \
weechat_plugin->hook_hdata(weechat_plugin, __hdata_name, \
__description, __callback, __data)
#define weechat_hook_focus(__area, __callback, __data) \
weechat_plugin->hook_focus(weechat_plugin, __area, __callback, \
__data)
#define weechat_unhook(__hook) \
weechat_plugin->unhook( __hook)
#define weechat_unhook_all() \