… | |
… | |
57 | typedef int render_repeat_mode; |
57 | typedef int render_repeat_mode; |
58 | |
58 | |
59 | #if HAVE_PIXBUF |
59 | #if HAVE_PIXBUF |
60 | typedef GdkPixbuf * urxvt__pixbuf; |
60 | typedef GdkPixbuf * urxvt__pixbuf; |
61 | #endif |
61 | #endif |
|
|
62 | #if HAVE_IMG |
62 | typedef rxvt_img * urxvt__img; |
63 | typedef rxvt_img * urxvt__img; |
63 | typedef rxvt_img::nv rxvt_img__nv; |
64 | typedef rxvt_img::nv rxvt_img__nv; |
64 | |
65 | |
65 | ///////////////////////////////////////////////////////////////////////////// |
66 | ///////////////////////////////////////////////////////////////////////////// |
66 | |
67 | |
… | |
… | |
105 | |
106 | |
106 | return c; |
107 | return c; |
107 | } |
108 | } |
108 | |
109 | |
109 | ///////////////////////////////////////////////////////////////////////////// |
110 | ///////////////////////////////////////////////////////////////////////////// |
|
|
111 | #endif |
110 | |
112 | |
111 | static wchar_t * |
113 | static wchar_t * |
112 | sv2wcs (SV *sv) |
114 | sv2wcs (SV *sv) |
113 | { |
115 | { |
114 | STRLEN len; |
116 | STRLEN len; |
… | |
… | |
791 | static const struct { |
793 | static const struct { |
792 | const char *name; |
794 | const char *name; |
793 | IV iv; |
795 | IV iv; |
794 | } *civ, const_iv[] = { |
796 | } *civ, const_iv[] = { |
795 | # define const_iv(name) { # name, (IV)name } |
797 | # define const_iv(name) { # name, (IV)name } |
|
|
798 | const_iv (HOOK_INIT), |
|
|
799 | const_iv (HOOK_DESTROY), |
|
|
800 | const_iv (HOOK_KEYBOARD_DISPATCH), |
|
|
801 | |
796 | const_iv (NUM_RESOURCES), |
802 | const_iv (NUM_RESOURCES), |
797 | const_iv (DEFAULT_RSTYLE), |
803 | const_iv (DEFAULT_RSTYLE), |
798 | const_iv (OVERLAY_RSTYLE), |
804 | const_iv (OVERLAY_RSTYLE), |
799 | const_iv (Color_Bits), |
805 | const_iv (Color_Bits), |
800 | const_iv (RS_bgShift), const_iv (RS_bgMask), |
806 | const_iv (RS_bgShift), const_iv (RS_bgMask), |
… | |
… | |
810 | const_iv (RS_Bold), |
816 | const_iv (RS_Bold), |
811 | const_iv (RS_Italic), |
817 | const_iv (RS_Italic), |
812 | const_iv (RS_Blink), |
818 | const_iv (RS_Blink), |
813 | const_iv (RS_RVid), |
819 | const_iv (RS_RVid), |
814 | const_iv (RS_Uline), |
820 | const_iv (RS_Uline), |
|
|
821 | |
|
|
822 | // TODO: should support all colour constants, create colorinc.h &c |
|
|
823 | const_iv (Color_fg), |
|
|
824 | const_iv (Color_bg), |
|
|
825 | #if OFF_FOCUS_FADING |
|
|
826 | const_iv (Color_fade), |
|
|
827 | #endif |
|
|
828 | const_iv (Color_pointer_fg), |
|
|
829 | const_iv (Color_pointer_bg), |
|
|
830 | const_iv (Color_border), |
|
|
831 | const_iv (NRS_COLORS), |
|
|
832 | const_iv (TOTAL_COLORS), |
815 | |
833 | |
816 | const_iv (CurrentTime), |
834 | const_iv (CurrentTime), |
817 | const_iv (ShiftMask), |
835 | const_iv (ShiftMask), |
818 | const_iv (LockMask), |
836 | const_iv (LockMask), |
819 | const_iv (ControlMask), |
837 | const_iv (ControlMask), |
… | |
… | |
1813 | } |
1831 | } |
1814 | OUTPUT: |
1832 | OUTPUT: |
1815 | RETVAL |
1833 | RETVAL |
1816 | |
1834 | |
1817 | bool |
1835 | bool |
1818 | rxvt_term::parse_keysym (char *keysym, char *str) |
1836 | rxvt_term::bind_action (char *keysym, char *str) |
|
|
1837 | ALIAS: |
|
|
1838 | parse_keysym = 1 |
1819 | CODE: |
1839 | CODE: |
1820 | RETVAL = 0 < THIS->parse_keysym (keysym, str); |
1840 | RETVAL = 0 < THIS->bind_action (keysym, str); |
1821 | THIS->keyboard->register_done (); |
1841 | THIS->keyboard->register_done (); |
1822 | OUTPUT: |
1842 | OUTPUT: |
1823 | RETVAL |
1843 | RETVAL |
1824 | |
1844 | |
1825 | void |
1845 | void |
… | |
… | |
1877 | |
1897 | |
1878 | if (ix) |
1898 | if (ix) |
1879 | { |
1899 | { |
1880 | THIS->selection.screen = THIS->current_screen; |
1900 | THIS->selection.screen = THIS->current_screen; |
1881 | |
1901 | |
1882 | THIS->want_refresh = 1; |
1902 | THIS->selection_changed (); |
1883 | THIS->refresh_check (); |
1903 | THIS->refresh_check (); |
1884 | } |
1904 | } |
1885 | } |
1905 | } |
1886 | } |
1906 | } |
1887 | |
1907 | |
… | |
… | |
1891 | RETVAL = THIS->selection.screen; |
1911 | RETVAL = THIS->selection.screen; |
1892 | if (screen >= 0) |
1912 | if (screen >= 0) |
1893 | THIS->selection.screen = screen; |
1913 | THIS->selection.screen = screen; |
1894 | OUTPUT: |
1914 | OUTPUT: |
1895 | RETVAL |
1915 | RETVAL |
|
|
1916 | |
|
|
1917 | void |
|
|
1918 | rxvt_term::selection_request (Time tm, int selnum) |
1896 | |
1919 | |
1897 | void |
1920 | void |
1898 | rxvt_term::selection_clear (bool clipboard = false) |
1921 | rxvt_term::selection_clear (bool clipboard = false) |
1899 | |
1922 | |
1900 | void |
1923 | void |
… | |
… | |
2201 | OUTPUT: |
2224 | OUTPUT: |
2202 | RETVAL |
2225 | RETVAL |
2203 | |
2226 | |
2204 | #endif |
2227 | #endif |
2205 | |
2228 | |
2206 | #if HAVE_BG_PIXMAP |
|
|
2207 | |
|
|
2208 | void |
2229 | void |
2209 | rxvt_term::set_background (rxvt_img *img, bool border = false) |
2230 | rxvt_term::set_background (rxvt_img *img, bool border = false) |
2210 | CODE: |
2231 | CODE: |
2211 | THIS->bg_destroy (); |
2232 | delete THIS->bg_img; |
2212 | THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT); |
2233 | THIS->bg_img = 0; |
|
|
2234 | THIS->bg_flags = 0; |
2213 | |
2235 | |
2214 | if (img) // TODO: cannot be false |
2236 | if (img) // TODO: cannot be false |
2215 | { |
2237 | { |
2216 | img = img->clone (); // own the img |
2238 | img = img->clone (); // own the img |
2217 | |
2239 | |
2218 | if (img->repeat != RepeatNormal) // X11 only supports RepeatNormal as bg pixmap |
2240 | if (img->repeat != RepeatNormal) // X11 only supports RepeatNormal as bg pixmap |
2219 | img->sub_rect (0, 0, |
2241 | img->sub_rect (0, 0, |
2220 | border ? THIS->vt_width : THIS->szHint.width, |
2242 | border ? THIS->vt_width : THIS->szHint.width, |
2221 | border ? THIS->vt_height : THIS->szHint.height) |
2243 | border ? THIS->vt_height : THIS->szHint.height) |
2222 | ->replace (img); |
2244 | ->replace (img); |
2223 | |
2245 | |
2224 | // just in case, should usually be a nop |
2246 | // just in case, should usually be a nop |
2225 | img->reify () |
2247 | img->reify () |
2226 | ->replace (img); |
2248 | ->replace (img); |
2227 | |
2249 | |
… | |
… | |
2232 | THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER; |
2254 | THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER; |
2233 | |
2255 | |
2234 | if (!border) |
2256 | if (!border) |
2235 | THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; |
2257 | THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; |
2236 | } |
2258 | } |
2237 | |
|
|
2238 | #endif |
|
|
2239 | |
2259 | |
2240 | #endif |
2260 | #endif |
2241 | |
2261 | |
2242 | ############################################################################# |
2262 | ############################################################################# |
2243 | # urxvt::overlay |
2263 | # urxvt::overlay |
… | |
… | |
2313 | RETVAL = THIS->pm; |
2333 | RETVAL = THIS->pm; |
2314 | OUTPUT: |
2334 | OUTPUT: |
2315 | RETVAL |
2335 | RETVAL |
2316 | |
2336 | |
2317 | void |
2337 | void |
2318 | rxvt_img::fill (SV *c) |
2338 | rxvt_img::fill (SV *c, int x = 0, int y = 0, int w = THIS->w, int h = THIS->h) |
|
|
2339 | PROTOTYPE: $;$$$$ |
2319 | INIT: |
2340 | INIT: |
2320 | rgba cc = parse_rgba (c, THIS->s); |
2341 | rgba cc = parse_rgba (c, THIS->s); |
2321 | C_ARGS: cc |
2342 | C_ARGS: cc, x, y, w, h |
2322 | |
2343 | |
2323 | void |
2344 | void |
2324 | rxvt_img::DESTROY () |
2345 | rxvt_img::DESTROY () |
2325 | CODE: |
2346 | CODE: |
2326 | delete THIS; |
2347 | delete THIS; |
… | |
… | |
2360 | rxvt_img * |
2381 | rxvt_img * |
2361 | rxvt_img::sub_rect (int x, int y, int width, int height) |
2382 | rxvt_img::sub_rect (int x, int y, int width, int height) |
2362 | |
2383 | |
2363 | rxvt_img * |
2384 | rxvt_img * |
2364 | rxvt_img::blur (int rh, int rv) |
2385 | rxvt_img::blur (int rh, int rv) |
|
|
2386 | |
|
|
2387 | rxvt_img * |
|
|
2388 | rxvt_img::muladd (rxvt_img::nv mul, rxvt_img::nv add) |
2365 | |
2389 | |
2366 | rxvt_img * |
2390 | rxvt_img * |
2367 | rxvt_img::transform (rxvt_img::nv p11, rxvt_img::nv p12, rxvt_img::nv p13, rxvt_img::nv p21, rxvt_img::nv p22, rxvt_img::nv p23, rxvt_img::nv p31, rxvt_img::nv p32, rxvt_img::nv p33) |
2391 | rxvt_img::transform (rxvt_img::nv p11, rxvt_img::nv p12, rxvt_img::nv p13, rxvt_img::nv p21, rxvt_img::nv p22, rxvt_img::nv p23, rxvt_img::nv p31, rxvt_img::nv p32, rxvt_img::nv p33) |
2368 | INIT: |
2392 | INIT: |
2369 | rxvt_img::nv matrix[3][3] = { |
2393 | rxvt_img::nv matrix[3][3] = { |
… | |
… | |
2377 | rxvt_img::scale (int new_width, int new_height) |
2401 | rxvt_img::scale (int new_width, int new_height) |
2378 | |
2402 | |
2379 | rxvt_img * |
2403 | rxvt_img * |
2380 | rxvt_img::rotate (int x, int y, rxvt_img::nv phi) |
2404 | rxvt_img::rotate (int x, int y, rxvt_img::nv phi) |
2381 | |
2405 | |
2382 | void |
2406 | rxvt_img * |
2383 | rxvt_img::tint (SV *c) |
2407 | rxvt_img::tint (SV *c) |
2384 | INIT: |
2408 | INIT: |
2385 | rgba cc = parse_rgba (c, THIS->s); |
2409 | rgba cc = parse_rgba (c, THIS->s); |
2386 | C_ARGS: cc |
2410 | C_ARGS: cc |
2387 | |
2411 | |
2388 | rxvt_img * |
2412 | rxvt_img * |
|
|
2413 | rxvt_img::shade (rxvt_img::nv factor) |
|
|
2414 | |
|
|
2415 | rxvt_img * |
2389 | rxvt_img::filter (octet_string name, SV *params = &PL_sv_undef) |
2416 | rxvt_img::filter (octet_string name, SV *params = &PL_sv_undef) |
2390 | CODE: |
2417 | CODE: |
2391 | rxvt_img::nv *vparams = 0; |
2418 | rxvt_img::nv *vparams = 0; |
2392 | int nparams = 0; |
2419 | int nparams = 0; |
2393 | |
2420 | |
2394 | if (SvOK (params)) |
2421 | if (SvOK (params)) |
2395 | { |
2422 | { |
2396 | // we overlay rxvt_temp_buf, what a hack |
|
|
2397 | assert (sizeof (rxvt_img::nv) >= sizeof (int)); |
|
|
2398 | |
|
|
2399 | if (!SvROK (params) || SvTYPE (SvRV (params)) != SVt_PVAV) |
2423 | if (!SvROK (params) || SvTYPE (SvRV (params)) != SVt_PVAV) |
2400 | croak ("rxvt_img::filter: params must be an array reference with parameter values"); |
2424 | croak ("rxvt_img::filter: params must be an array reference with parameter values"); |
2401 | |
2425 | |
2402 | nparams = av_len ((AV *)SvRV (params)) + 1; |
2426 | nparams = av_len ((AV *)SvRV (params)) + 1; |
2403 | vparams = rxvt_temp_buf<rxvt_img::nv> (nparams); |
2427 | vparams = (rxvt_img::nv *)malloc (nparams * sizeof (rxvt_img::nv)); |
2404 | |
2428 | |
2405 | for (int i = 0; i < nparams; ++i) |
2429 | for (int i = 0; i < nparams; ++i) |
2406 | vparams [i] = SvNV (*av_fetch ((AV *)SvRV (params), i, 1)); |
2430 | vparams [i] = SvNV (*av_fetch ((AV *)SvRV (params), i, 1)); |
2407 | } |
2431 | } |
2408 | |
2432 | |
2409 | RETVAL = THIS->filter (name, nparams, vparams); |
2433 | RETVAL = THIS->filter (name, nparams, vparams); |
|
|
2434 | free (vparams); |
2410 | OUTPUT: |
2435 | OUTPUT: |
2411 | RETVAL |
2436 | RETVAL |
2412 | |
2437 | |
2413 | #endif |
2438 | #endif |
2414 | |
2439 | |