--- rxvt-unicode/src/rxvtperl.xs 2012/12/30 11:37:07 1.210 +++ rxvt-unicode/src/rxvtperl.xs 2015/01/16 20:13:01 1.234 @@ -3,11 +3,11 @@ *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2005-2008,2011 Marc Lehmann + * Copyright (c) 2005-2014,2011 Marc Lehmann * * This program 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 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -495,6 +495,25 @@ } static void +_keysym_resource_push (rxvt_term *term, const char *k, const char *v) +{ + unsigned int state; + + if (term->parse_keysym (k, state) == -1) + return; + + dSP; + XPUSHs (sv_2mortal (newSVpv (v, 0))); + PUTBACK; +} + +static void +_keysym_resources (rxvt_term *term) +{ + term->enumerate_keysym_resources (_keysym_resource_push); +} + +static void ungrab (rxvt_term *THIS) { if (THIS->perl.grabtime) @@ -795,6 +814,10 @@ IV iv; } *civ, const_iv[] = { # define const_iv(name) { # name, (IV)name } + const_iv (HOOK_INIT), + const_iv (HOOK_DESTROY), + const_iv (HOOK_ACTION), + const_iv (NUM_RESOURCES), const_iv (DEFAULT_RSTYLE), const_iv (OVERLAY_RSTYLE), @@ -815,6 +838,18 @@ const_iv (RS_RVid), const_iv (RS_Uline), + // TODO: should support all colour constants, create colorinc.h &c + const_iv (Color_fg), + const_iv (Color_bg), +#if OFF_FOCUS_FADING + const_iv (Color_fade), +#endif + const_iv (Color_pointer_fg), + const_iv (Color_pointer_bg), + const_iv (Color_border), + const_iv (NRS_COLORS), + const_iv (TOTAL_COLORS), + const_iv (CurrentTime), const_iv (ShiftMask), const_iv (LockMask), @@ -994,17 +1029,17 @@ } void -log (const char *msg) +log (utf8_string msg) CODE: rxvt_log ("%s", msg); void -warn (const char *msg) +warn (utf8_string msg) CODE: rxvt_warn ("%s", msg); void -fatal (const char *msg) +fatal (utf8_string msg) CODE: rxvt_fatal ("%s", msg); @@ -1179,6 +1214,13 @@ CODE: XrmPutStringResource (&THIS->option_db, specifier, value); +void +rxvt_term::_keysym_resources () + PPCODE: + PUTBACK; + _keysym_resources (THIS); + SPAGAIN; + int rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) CODE: @@ -1247,7 +1289,7 @@ ungrab (THIS); int -rxvt_term::XStringToKeysym (char *string) +rxvt_term::XStringToKeysym (octet_string string) CODE: RETVAL = XStringToKeysym (string); OUTPUT: RETVAL @@ -1267,7 +1309,7 @@ int rxvt_term::XKeycodeToKeysym (int code, int index) CODE: - RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); + RETVAL = rxvt_XKeycodeToKeysym (THIS->dpy, code, index); OUTPUT: RETVAL int @@ -1534,6 +1576,9 @@ THIS->refresh_check (); void +rxvt_term::refresh_check () + +void rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) PPCODE: { @@ -1686,6 +1731,7 @@ rxvt_pop_locale (); + free (wstr); RETVAL = wcs2sv (rstr, r - rstr); } OUTPUT: @@ -1719,13 +1765,14 @@ else *r++ = *s; + free (wstr); RETVAL = wcs2sv (rstr, r - rstr); } OUTPUT: RETVAL void -rxvt_term::_resource (char *name, int index, SV *newval = 0) +rxvt_term::_resource (octet_string name, int index, SV *newval = 0) PPCODE: { static const struct resval { const char *name; int value; } *rs, rslist [] = { @@ -1773,7 +1820,7 @@ } const char * -rxvt_term::x_resource (const char *name) +rxvt_term::x_resource (octet_string name) bool rxvt_term::option (U8 optval, int set = -1) @@ -1802,6 +1849,7 @@ #endif case Opt_cursorUnderline: + THIS->cursor_type = set ? 1 : 0; THIS->want_refresh = 1; THIS->refresh_check (); break; @@ -1817,9 +1865,11 @@ RETVAL bool -rxvt_term::parse_keysym (char *keysym, char *str) +rxvt_term::bind_action (octet_string keysym, octet_string action) + ALIAS: + parse_keysym = 1 CODE: - RETVAL = 0 < THIS->parse_keysym (keysym, str); + RETVAL = 0 < THIS->bind_action (keysym, action); THIS->keyboard->register_done (); OUTPUT: RETVAL @@ -1828,7 +1878,7 @@ rxvt_term::register_command (int keysym, unsigned int state, SV *str) CODE: wchar_t *wstr = sv2wcs (str); - THIS->keyboard->register_user_translation (keysym, state, wstr); + THIS->keyboard->register_action (keysym, state, wstr); free (wstr); void @@ -1881,7 +1931,7 @@ { THIS->selection.screen = THIS->current_screen; - THIS->want_refresh = 1; + THIS->selection_changed (); THIS->refresh_check (); } } @@ -1897,6 +1947,9 @@ RETVAL void +rxvt_term::selection_request (Time tm, int selnum) + +void rxvt_term::selection_clear (bool clipboard = false) void @@ -1947,7 +2000,7 @@ rxvt_term::scr_bell () void -rxvt_term::scr_recolour (bool refresh = true); +rxvt_term::scr_recolor (bool refresh = true); void rxvt_term::scr_change_screen (int screen) @@ -1962,6 +2015,14 @@ } void +rxvt_term::tt_write_user_input (SV *octets) + INIT: + STRLEN len; + char *str = SvPVbyte (octets, len); + C_ARGS: + str, len + +void rxvt_term::tt_write (SV *octets) INIT: STRLEN len; @@ -2210,7 +2271,7 @@ CODE: delete THIS->bg_img; THIS->bg_img = 0; - THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT); + THIS->bg_flags = 0; if (img) // TODO: cannot be false { @@ -2389,6 +2450,9 @@ C_ARGS: cc rxvt_img * +rxvt_img::shade (rxvt_img::nv factor) + +rxvt_img * rxvt_img::filter (octet_string name, SV *params = &PL_sv_undef) CODE: rxvt_img::nv *vparams = 0; @@ -2396,20 +2460,18 @@ if (SvOK (params)) { - // we overlay rxvt_temp_buf, what a hack - assert (sizeof (rxvt_img::nv) >= sizeof (int)); - if (!SvROK (params) || SvTYPE (SvRV (params)) != SVt_PVAV) croak ("rxvt_img::filter: params must be an array reference with parameter values"); nparams = av_len ((AV *)SvRV (params)) + 1; - vparams = rxvt_temp_buf (nparams); + vparams = (rxvt_img::nv *)malloc (nparams * sizeof (rxvt_img::nv)); for (int i = 0; i < nparams; ++i) vparams [i] = SvNV (*av_fetch ((AV *)SvRV (params), i, 1)); } RETVAL = THIS->filter (name, nparams, vparams); + free (vparams); OUTPUT: RETVAL