summaryrefslogtreecommitdiff
path: root/doc/en/weechat_plugin_api.en.txt
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-07-26 18:50:29 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-07-26 18:50:29 +0200
commite0781f0390291e264e6dd9c17beae1342e87f9a2 (patch)
treeaac2f19ab7e527180952db15867d8daaa23c4a91 /doc/en/weechat_plugin_api.en.txt
parent2fec84314433c2b7152c6c47b1172a621257fe6f (diff)
downloadweechat-e0781f0390291e264e6dd9c17beae1342e87f9a2.zip
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)
Diffstat (limited to 'doc/en/weechat_plugin_api.en.txt')
-rw-r--r--doc/en/weechat_plugin_api.en.txt82
1 files changed, 81 insertions, 1 deletions
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index c6e77ce8c..b38b1f70f 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -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
^^^^^^^^^^^^^^