--- rxvt-unicode/src/rxvtperl.xs 2012/07/02 03:57:53 1.205 +++ rxvt-unicode/src/rxvtperl.xs 2014/10/13 17:05:32 1.229 @@ -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, @@ -59,6 +59,7 @@ #if HAVE_PIXBUF typedef GdkPixbuf * urxvt__pixbuf; #endif +#if HAVE_IMG typedef rxvt_img * urxvt__img; typedef rxvt_img::nv rxvt_img__nv; @@ -107,6 +108,7 @@ } ///////////////////////////////////////////////////////////////////////////// +#endif static wchar_t * sv2wcs (SV *sv) @@ -493,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) @@ -793,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), @@ -813,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), @@ -1177,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: @@ -1265,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 @@ -1800,6 +1844,7 @@ #endif case Opt_cursorUnderline: + THIS->cursor_type = set ? 1 : 0; THIS->want_refresh = 1; THIS->refresh_check (); break; @@ -1815,9 +1860,11 @@ RETVAL bool -rxvt_term::parse_keysym (char *keysym, char *str) +rxvt_term::bind_action (char *keysym, char *str) + ALIAS: + parse_keysym = 1 CODE: - RETVAL = 0 < THIS->parse_keysym (keysym, str); + RETVAL = 0 < THIS->bind_action (keysym, str); THIS->keyboard->register_done (); OUTPUT: RETVAL @@ -1826,7 +1873,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 @@ -1879,7 +1926,7 @@ { THIS->selection.screen = THIS->current_screen; - THIS->want_refresh = 1; + THIS->selection_changed (); THIS->refresh_check (); } } @@ -1895,6 +1942,9 @@ RETVAL void +rxvt_term::selection_request (Time tm, int selnum) + +void rxvt_term::selection_clear (bool clipboard = false) void @@ -1960,6 +2010,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; @@ -2203,23 +2261,22 @@ #endif -#if HAVE_BG_PIXMAP - void rxvt_term::set_background (rxvt_img *img, bool border = false) CODE: - THIS->bg_destroy (); - THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT); + delete THIS->bg_img; + THIS->bg_img = 0; + THIS->bg_flags = 0; if (img) // TODO: cannot be false { img = img->clone (); // own the img if (img->repeat != RepeatNormal) // X11 only supports RepeatNormal as bg pixmap - img->sub_rect (0, 0, - border ? THIS->vt_width : THIS->szHint.width, - border ? THIS->vt_height : THIS->szHint.height) - ->replace (img); + img->sub_rect (0, 0, + border ? THIS->vt_width : THIS->szHint.width, + border ? THIS->vt_height : THIS->szHint.height) + ->replace (img); // just in case, should usually be a nop img->reify () @@ -2237,8 +2294,6 @@ #endif -#endif - ############################################################################# # urxvt::overlay ############################################################################# @@ -2390,6 +2445,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; @@ -2397,20 +2455,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