diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-07-26 18:50:29 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-07-26 18:50:29 +0200 |
commit | e0781f0390291e264e6dd9c17beae1342e87f9a2 (patch) | |
tree | aac2f19ab7e527180952db15867d8daaa23c4a91 /src/plugins/scripts/perl | |
parent | 2fec84314433c2b7152c6c47b1172a621257fe6f (diff) | |
download | weechat-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 'src/plugins/scripts/perl')
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 9fb575b99..45429dbbc 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -4267,6 +4267,72 @@ XS (XS_weechat_api_hook_infolist) } /* + * 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"); |