1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtperl.xs |
2 | * File: rxvtperl.xs |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2005-2008 Marc Lehmann <pcg@goof.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
31 | #include <cstddef> |
31 | #include <cstddef> |
32 | #include <cstdarg> |
32 | #include <cstdarg> |
33 | |
33 | |
34 | #include "unistd.h" |
34 | #include "unistd.h" |
35 | |
35 | |
36 | #include "iom.h" |
36 | #include "ev_cpp.h" |
37 | #include "rxvt.h" |
37 | #include "rxvt.h" |
38 | #include "keyboard.h" |
38 | #include "keyboard.h" |
39 | #include "rxvtutil.h" |
39 | #include "rxvtutil.h" |
40 | #include "rxvtperl.h" |
40 | #include "rxvtperl.h" |
41 | |
41 | |
42 | #include "perlxsi.c" |
42 | #include "perlxsi.c" |
43 | |
43 | |
44 | #ifdef HAVE_SCROLLBARS |
|
|
45 | # define GRAB_CURSOR THIS->leftptr_cursor |
44 | #define GRAB_CURSOR THIS->scrollBar.leftptr_cursor |
46 | #else |
|
|
47 | # define GRAB_CURSOR None |
|
|
48 | #endif |
|
|
49 | |
45 | |
50 | #undef LINENO |
46 | #undef LINENO |
51 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
47 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
52 | #undef ROW |
48 | #undef ROW |
53 | #define ROW(n) THIS->row_buf [LINENO (n)] |
49 | #define ROW(n) THIS->row_buf [LINENO (n)] |
54 | |
50 | |
55 | typedef int CHAINED UNUSED; |
|
|
56 | |
|
|
57 | ///////////////////////////////////////////////////////////////////////////// |
51 | ///////////////////////////////////////////////////////////////////////////// |
58 | |
52 | |
59 | static wchar_t * |
53 | static wchar_t * |
60 | sv2wcs (SV *sv) |
54 | sv2wcs (SV *sv) |
61 | { |
55 | { |
… | |
… | |
75 | |
69 | |
76 | return sv; |
70 | return sv; |
77 | } |
71 | } |
78 | |
72 | |
79 | static SV * |
73 | static SV * |
80 | new_ref (HV *hv, const char *klass) |
|
|
81 | { |
|
|
82 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
|
|
83 | } |
|
|
84 | |
|
|
85 | //TODO: use magic |
|
|
86 | static SV * |
|
|
87 | newSVptr (void *ptr, const char *klass) |
74 | newSVptr (void *ptr, const char *klass) |
88 | { |
75 | { |
89 | HV *hv = newHV (); |
76 | HV *hv = newHV (); |
90 | sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
77 | sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
91 | return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
78 | return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
… | |
… | |
113 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
100 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
114 | |
101 | |
115 | return (long)mg->mg_ptr; |
102 | return (long)mg->mg_ptr; |
116 | } |
103 | } |
117 | |
104 | |
118 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) |
105 | #define newSVterm(term) SvREFCNT_inc ((SV *)(term)->perl.self) |
119 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
106 | #define SvTERM(sv) (rxvt_term *)SvPTR ((sv), "urxvt::term") |
120 | |
107 | |
121 | ///////////////////////////////////////////////////////////////////////////// |
108 | ///////////////////////////////////////////////////////////////////////////// |
122 | |
109 | |
123 | #define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, "urxvt::watcher") |
110 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
124 | |
111 | |
125 | struct perl_watcher |
112 | class overlay : overlay_base |
126 | { |
113 | { |
127 | SV *cbsv; |
114 | rxvt_term *THIS; |
|
|
115 | AV *overlay_av; |
|
|
116 | int border; |
|
|
117 | |
|
|
118 | public: |
128 | HV *self; |
119 | HV *self; |
129 | |
|
|
130 | perl_watcher () |
|
|
131 | : cbsv (0) |
|
|
132 | { |
|
|
133 | } |
|
|
134 | |
|
|
135 | ~perl_watcher () |
|
|
136 | { |
|
|
137 | SvREFCNT_dec (cbsv); |
|
|
138 | } |
|
|
139 | |
|
|
140 | void cb (SV *cb) |
|
|
141 | { |
|
|
142 | SvREFCNT_dec (cbsv); |
|
|
143 | cbsv = newSVsv (cb); |
|
|
144 | } |
|
|
145 | |
|
|
146 | void invoke (const char *type, SV *self, int arg = -1); |
|
|
147 | }; |
|
|
148 | |
|
|
149 | void |
|
|
150 | perl_watcher::invoke (const char *type, SV *self, int arg) |
|
|
151 | { |
|
|
152 | dSP; |
|
|
153 | |
|
|
154 | ENTER; |
|
|
155 | SAVETMPS; |
|
|
156 | |
|
|
157 | PUSHMARK (SP); |
|
|
158 | |
|
|
159 | XPUSHs (sv_2mortal (self)); |
|
|
160 | |
|
|
161 | if (arg >= 0) |
|
|
162 | XPUSHs (sv_2mortal (newSViv (arg))); |
|
|
163 | |
|
|
164 | PUTBACK; |
|
|
165 | call_sv (cbsv, G_VOID | G_EVAL | G_DISCARD); |
|
|
166 | SPAGAIN; |
|
|
167 | |
|
|
168 | PUTBACK; |
|
|
169 | FREETMPS; |
|
|
170 | LEAVE; |
|
|
171 | |
|
|
172 | if (SvTRUE (ERRSV)) |
|
|
173 | rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
|
|
174 | } |
|
|
175 | |
|
|
176 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
|
|
177 | #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR (sv, "urxvt::timer") |
|
|
178 | |
|
|
179 | struct timer : perl_watcher, time_watcher |
|
|
180 | { |
|
|
181 | tstamp interval; |
|
|
182 | |
|
|
183 | timer () |
|
|
184 | : time_watcher (this, &timer::execute) |
|
|
185 | { |
|
|
186 | } |
|
|
187 | |
|
|
188 | void execute (time_watcher &w) |
|
|
189 | { |
|
|
190 | if (interval) |
|
|
191 | start (at + interval); |
|
|
192 | |
|
|
193 | invoke ("urxvt::timer", newSVtimer (this)); |
|
|
194 | } |
|
|
195 | }; |
|
|
196 | |
|
|
197 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
|
|
198 | #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR (sv, "urxvt::iow") |
|
|
199 | |
|
|
200 | struct iow : perl_watcher, io_watcher |
|
|
201 | { |
|
|
202 | iow () |
|
|
203 | : io_watcher (this, &iow::execute) |
|
|
204 | { |
|
|
205 | } |
|
|
206 | |
|
|
207 | void execute (io_watcher &w, short revents) |
|
|
208 | { |
|
|
209 | invoke ("urxvt::iow", newSViow (this), revents); |
|
|
210 | } |
|
|
211 | }; |
|
|
212 | |
|
|
213 | #define newSViw(iw) new_ref (iw->self, "urxvt::iw") |
|
|
214 | #define SvIW(sv) (iw *)(perl_watcher *)SvPTR (sv, "urxvt::iw") |
|
|
215 | |
|
|
216 | struct iw : perl_watcher, idle_watcher |
|
|
217 | { |
|
|
218 | iw () |
|
|
219 | : idle_watcher (this, &iw::execute) |
|
|
220 | { |
|
|
221 | } |
|
|
222 | |
|
|
223 | void execute (idle_watcher &w) |
|
|
224 | { |
|
|
225 | invoke ("urxvt::iw", newSViw (this)); |
|
|
226 | } |
|
|
227 | }; |
|
|
228 | |
|
|
229 | #define newSVpw(pw) new_ref (pw->self, "urxvt::pw") |
|
|
230 | #define SvPW(sv) (pw *)(perl_watcher *)SvPTR (sv, "urxvt::pw") |
|
|
231 | |
|
|
232 | struct pw : perl_watcher, child_watcher |
|
|
233 | { |
|
|
234 | pw () |
|
|
235 | : child_watcher (this, &pw::execute) |
|
|
236 | { |
|
|
237 | } |
|
|
238 | |
|
|
239 | void execute (child_watcher &w, int status) |
|
|
240 | { |
|
|
241 | invoke ("urxvt::pw", newSVpw (this), status); |
|
|
242 | } |
|
|
243 | }; |
|
|
244 | |
|
|
245 | ///////////////////////////////////////////////////////////////////////////// |
|
|
246 | |
|
|
247 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
|
|
248 | |
|
|
249 | struct overlay { |
|
|
250 | HV *self; |
|
|
251 | bool visible; |
|
|
252 | rxvt_term *THIS; |
|
|
253 | int x, y, w, h; |
|
|
254 | int border; |
|
|
255 | text_t **text; |
|
|
256 | rend_t **rend; |
|
|
257 | |
120 | |
258 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
121 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
259 | ~overlay (); |
122 | ~overlay (); |
260 | |
123 | |
261 | void show (); |
124 | void show (); |
… | |
… | |
265 | |
128 | |
266 | void set (int x, int y, SV *str, SV *rend); |
129 | void set (int x, int y, SV *str, SV *rend); |
267 | }; |
130 | }; |
268 | |
131 | |
269 | overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) |
132 | overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) |
270 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), visible(false) |
133 | : THIS(THIS), border(border == 2), overlay_av (0) |
271 | { |
134 | { |
|
|
135 | x = x_; |
|
|
136 | y = y_; |
|
|
137 | w = w_; |
|
|
138 | h = h_; |
|
|
139 | |
|
|
140 | if (w < 0) w = 0; |
|
|
141 | if (h < 0) h = 0; |
|
|
142 | |
272 | if (border == 2) |
143 | if (border == 2) |
273 | { |
144 | { |
274 | w += 2; |
145 | w += 2; |
275 | h += 2; |
146 | h += 2; |
276 | } |
147 | } |
… | |
… | |
314 | *rp++ = r; |
185 | *rp++ = r; |
315 | } |
186 | } |
316 | } |
187 | } |
317 | |
188 | |
318 | show (); |
189 | show (); |
319 | THIS->want_refresh = 1; |
|
|
320 | } |
190 | } |
321 | |
191 | |
322 | overlay::~overlay () |
192 | overlay::~overlay () |
323 | { |
193 | { |
324 | hide (); |
194 | hide (); |
… | |
… | |
329 | delete [] rend[y]; |
199 | delete [] rend[y]; |
330 | } |
200 | } |
331 | |
201 | |
332 | delete [] text; |
202 | delete [] text; |
333 | delete [] rend; |
203 | delete [] rend; |
|
|
204 | } |
|
|
205 | |
|
|
206 | void |
|
|
207 | overlay::show () |
|
|
208 | { |
|
|
209 | if (overlay_av) |
|
|
210 | return; |
|
|
211 | |
|
|
212 | overlay_av = (AV *)SvREFCNT_inc (SvRV ( |
|
|
213 | *hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0) |
|
|
214 | )); |
|
|
215 | av_push (overlay_av, newSViv ((long)this)); |
334 | |
216 | |
335 | THIS->want_refresh = 1; |
217 | THIS->want_refresh = 1; |
|
|
218 | THIS->refresh_check (); |
336 | } |
219 | } |
337 | |
220 | |
338 | void |
221 | void |
339 | overlay::show () |
222 | overlay::hide () |
340 | { |
223 | { |
341 | if (visible) |
224 | if (!overlay_av) |
342 | return; |
225 | return; |
343 | |
226 | |
344 | visible = true; |
|
|
345 | |
|
|
346 | AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)); |
|
|
347 | av_push (av, newSViv ((long)this)); |
|
|
348 | } |
|
|
349 | |
|
|
350 | void |
|
|
351 | overlay::hide () |
|
|
352 | { |
|
|
353 | if (!visible) |
|
|
354 | return; |
|
|
355 | |
|
|
356 | visible = false; |
|
|
357 | |
|
|
358 | AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)); |
|
|
359 | |
|
|
360 | int i; |
227 | int i; |
361 | |
228 | |
362 | for (i = AvFILL (av); i >= 0; i--) |
229 | for (i = AvFILL (overlay_av); i >= 0; i--) |
363 | if (SvIV (*av_fetch (av, i, 1)) == (long)this) |
230 | if (SvIV (*av_fetch (overlay_av, i, 1)) == (long)this) |
364 | { |
|
|
365 | av_delete (av, i, G_DISCARD); |
|
|
366 | break; |
231 | break; |
367 | } |
|
|
368 | |
232 | |
369 | for (; i < AvFILL (av); i++) |
233 | for (; i < AvFILL (overlay_av); i++) |
370 | av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0))); |
234 | av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0))); |
371 | |
235 | |
372 | av_pop (av); |
236 | av_pop (overlay_av); |
|
|
237 | |
|
|
238 | SvREFCNT_dec (overlay_av); |
|
|
239 | overlay_av = 0; |
|
|
240 | |
|
|
241 | THIS->want_refresh = 1; |
|
|
242 | THIS->refresh_check (); |
373 | } |
243 | } |
374 | |
244 | |
375 | void overlay::swap () |
245 | void overlay::swap () |
376 | { |
246 | { |
377 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
247 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
378 | int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h)); |
248 | int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h)); |
379 | |
249 | |
380 | int ov_w = min (w, THIS->ncol - ov_x); |
250 | int ov_w = min (w, THIS->ncol - ov_x); |
381 | int ov_h = min (h, THIS->nrow - ov_y); |
251 | int ov_h = min (h, THIS->nrow - ov_y); |
|
|
252 | |
|
|
253 | // hide cursor if it is within the overlay area |
|
|
254 | if (IN_RANGE_EXC (THIS->screen.cur.col - ov_x, 0, ov_w) |
|
|
255 | && IN_RANGE_EXC (THIS->screen.cur.row - ov_y, 0, ov_h)) |
|
|
256 | THIS->screen.flags &= ~Screen_VisibleCursor; |
382 | |
257 | |
383 | for (int y = ov_h; y--; ) |
258 | for (int y = ov_h; y--; ) |
384 | { |
259 | { |
385 | text_t *t1 = text [y]; |
260 | text_t *t1 = text [y]; |
386 | rend_t *r1 = rend [y]; |
261 | rend_t *r1 = rend [y]; |
… | |
… | |
422 | for (int col = min (AvFILL (av) + 1, w - x - border); col--; ) |
297 | for (int col = min (AvFILL (av) + 1, w - x - border); col--; ) |
423 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
298 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
424 | } |
299 | } |
425 | |
300 | |
426 | THIS->want_refresh = 1; |
301 | THIS->want_refresh = 1; |
|
|
302 | THIS->refresh_check (); |
427 | } |
303 | } |
428 | |
304 | |
|
|
305 | ///////////////////////////////////////////////////////////////////////////// |
|
|
306 | |
|
|
307 | #define IOM_CLASS "urxvt" |
|
|
308 | #define IOM_WARN rxvt_warn |
|
|
309 | #include "iom_perl.h" |
429 | |
310 | |
430 | ///////////////////////////////////////////////////////////////////////////// |
311 | ///////////////////////////////////////////////////////////////////////////// |
431 | |
312 | |
432 | struct rxvt_perl_interp rxvt_perl; |
313 | struct rxvt_perl_interp rxvt_perl; |
433 | |
314 | |
… | |
… | |
437 | { |
318 | { |
438 | if (perl) |
319 | if (perl) |
439 | { |
320 | { |
440 | perl_destruct (perl); |
321 | perl_destruct (perl); |
441 | perl_free (perl); |
322 | perl_free (perl); |
|
|
323 | PERL_SYS_TERM (); |
442 | } |
324 | } |
443 | } |
325 | } |
444 | |
326 | |
445 | void |
327 | void |
446 | rxvt_perl_interp::init (rxvt_term *term) |
328 | rxvt_perl_interp::init (rxvt_term *term) |
… | |
… | |
450 | rxvt_push_locale (""); // perl init destroys current locale |
332 | rxvt_push_locale (""); // perl init destroys current locale |
451 | |
333 | |
452 | perl_environ = rxvt_environ; |
334 | perl_environ = rxvt_environ; |
453 | swap (perl_environ, environ); |
335 | swap (perl_environ, environ); |
454 | |
336 | |
455 | char *argv[] = { |
337 | char *args[] = { |
456 | "", |
338 | "", |
457 | "-e" |
339 | "-e" |
458 | "BEGIN {" |
340 | "BEGIN {" |
459 | " urxvt->bootstrap;" |
341 | " urxvt->bootstrap;" |
460 | " unshift @INC, '" LIBDIR "';" |
342 | " unshift @INC, '" LIBDIR "';" |
461 | "}" |
343 | "}" |
462 | "" |
344 | "" |
463 | "use urxvt;" |
345 | "use urxvt;" |
464 | }; |
346 | }; |
|
|
347 | int argc = sizeof (args) / sizeof (args[0]); |
|
|
348 | char **argv = args; |
465 | |
349 | |
|
|
350 | PERL_SYS_INIT3 (&argc, &argv, &environ); |
466 | perl = perl_alloc (); |
351 | perl = perl_alloc (); |
467 | perl_construct (perl); |
352 | perl_construct (perl); |
468 | |
353 | |
469 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
354 | if (perl_parse (perl, xs_init, argc, argv, (char **)NULL) |
470 | || perl_run (perl)) |
355 | || perl_run (perl)) |
471 | { |
356 | { |
472 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
357 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
473 | |
358 | |
474 | perl_destruct (perl); |
359 | perl_destruct (perl); |
… | |
… | |
492 | static void |
377 | static void |
493 | ungrab (rxvt_term *THIS) |
378 | ungrab (rxvt_term *THIS) |
494 | { |
379 | { |
495 | if (THIS->perl.grabtime) |
380 | if (THIS->perl.grabtime) |
496 | { |
381 | { |
497 | XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); |
382 | XUngrabKeyboard (THIS->dpy, THIS->perl.grabtime); |
498 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
383 | XUngrabPointer (THIS->dpy, THIS->perl.grabtime); |
499 | THIS->perl.grabtime = 0; |
384 | THIS->perl.grabtime = 0; |
500 | } |
385 | } |
501 | } |
386 | } |
502 | |
387 | |
503 | bool |
388 | bool |
… | |
… | |
508 | |
393 | |
509 | // pre-handling of some events |
394 | // pre-handling of some events |
510 | if (htype == HOOK_REFRESH_END) |
395 | if (htype == HOOK_REFRESH_END) |
511 | { |
396 | { |
512 | AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
397 | AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
513 | |
398 | |
514 | for (int i = 0; i <= AvFILL (av); i++) |
399 | for (int i = 0; i <= AvFILL (av); i++) |
515 | ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); |
400 | ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); |
516 | } |
401 | } |
517 | |
402 | |
518 | swap (perl_environ, environ); |
403 | swap (perl_environ, environ); |
… | |
… | |
554 | break; |
439 | break; |
555 | |
440 | |
556 | case DT_STR_LEN: |
441 | case DT_STR_LEN: |
557 | { |
442 | { |
558 | char *str = va_arg (ap, char *); |
443 | char *str = va_arg (ap, char *); |
559 | int len = va_arg (ap, int); |
444 | int len = va_arg (ap, int); |
560 | |
445 | |
561 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
446 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
562 | } |
447 | } |
563 | break; |
448 | break; |
564 | |
449 | |
565 | case DT_WCS_LEN: |
450 | case DT_WCS_LEN: |
566 | { |
451 | { |
567 | wchar_t *wstr = va_arg (ap, wchar_t *); |
452 | wchar_t *wstr = va_arg (ap, wchar_t *); |
568 | int wlen = va_arg (ap, int); |
453 | int wlen = va_arg (ap, int); |
569 | |
454 | |
570 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
455 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
|
|
456 | } |
|
|
457 | break; |
|
|
458 | |
|
|
459 | case DT_LCS_LEN: |
|
|
460 | { |
|
|
461 | long *lstr = va_arg (ap, long *); |
|
|
462 | int llen = va_arg (ap, int); |
|
|
463 | |
|
|
464 | XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long)))); |
571 | } |
465 | } |
572 | break; |
466 | break; |
573 | |
467 | |
574 | case DT_XEVENT: |
468 | case DT_XEVENT: |
575 | { |
469 | { |
576 | XEvent *xe = va_arg (ap, XEvent *); |
470 | XEvent *xe = va_arg (ap, XEvent *); |
577 | HV *hv = newHV (); |
471 | HV *hv = newHV (); |
578 | |
472 | |
579 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
473 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
580 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
474 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
581 | # define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) |
475 | # define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) |
582 | # undef set |
476 | # undef set |
583 | |
477 | |
584 | setiv (type, xe->type); |
478 | setiv (type, xe->type); |
585 | setiv (send_event, xe->xany.send_event); |
479 | setiv (send_event, xe->xany.send_event); |
586 | setiv (serial, xe->xany.serial); |
480 | setiv (serial, xe->xany.serial); |
587 | |
481 | |
… | |
… | |
596 | setuv (root, xe->xmotion.root); |
490 | setuv (root, xe->xmotion.root); |
597 | setuv (subwindow, xe->xmotion.subwindow); |
491 | setuv (subwindow, xe->xmotion.subwindow); |
598 | setuv (time, xe->xmotion.time); |
492 | setuv (time, xe->xmotion.time); |
599 | setiv (x, xe->xmotion.x); |
493 | setiv (x, xe->xmotion.x); |
600 | setiv (y, xe->xmotion.y); |
494 | setiv (y, xe->xmotion.y); |
601 | setiv (row, xe->xmotion.y / term->fheight); |
495 | setiv (row, xe->xmotion.y / term->fheight + term->view_start); |
602 | setiv (col, xe->xmotion.x / term->fwidth); |
496 | setiv (col, xe->xmotion.x / term->fwidth); |
603 | setiv (x_root, xe->xmotion.x_root); |
497 | setiv (x_root, xe->xmotion.x_root); |
604 | setiv (y_root, xe->xmotion.y_root); |
498 | setiv (y_root, xe->xmotion.y_root); |
605 | setuv (state, xe->xmotion.state); |
499 | setuv (state, xe->xmotion.state); |
606 | |
500 | |
… | |
… | |
640 | break; |
534 | break; |
641 | } |
535 | } |
642 | |
536 | |
643 | break; |
537 | break; |
644 | |
538 | |
|
|
539 | case PropertyNotify: |
|
|
540 | setuv (window, xe->xproperty.window); |
|
|
541 | setuv (atom, xe->xproperty.atom); |
|
|
542 | setuv (time, xe->xproperty.time); |
|
|
543 | setiv (state, xe->xproperty.state); |
|
|
544 | break; |
|
|
545 | |
645 | case ClientMessage: |
546 | case ClientMessage: |
646 | setuv (window, xe->xclient.window); |
547 | setuv (window, xe->xclient.window); |
647 | setuv (message_type, xe->xclient.message_type); |
548 | setuv (message_type, xe->xclient.message_type); |
648 | setuv (format, xe->xclient.format); |
549 | setuv (format, xe->xclient.format); |
649 | setuv (l0, xe->xclient.data.l[0]); |
550 | setuv (l0, xe->xclient.data.l[0]); |
650 | setuv (l1, xe->xclient.data.l[1]); |
551 | setuv (l1, xe->xclient.data.l[1]); |
651 | setuv (l2, xe->xclient.data.l[2]); |
552 | setuv (l2, xe->xclient.data.l[2]); |
652 | setuv (l3, xe->xclient.data.l[3]); |
553 | setuv (l3, xe->xclient.data.l[3]); |
653 | setuv (l4, xe->xclient.data.l[4]); |
554 | setuv (l4, xe->xclient.data.l[4]); |
|
|
555 | break; |
654 | } |
556 | } |
655 | |
557 | |
656 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
558 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
657 | } |
559 | } |
658 | break; |
560 | break; |
… | |
… | |
700 | |
602 | |
701 | // post-handling of some events |
603 | // post-handling of some events |
702 | if (htype == HOOK_REFRESH_BEGIN) |
604 | if (htype == HOOK_REFRESH_BEGIN) |
703 | { |
605 | { |
704 | AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
606 | AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
705 | |
607 | |
706 | for (int i = AvFILL (av); i >= 0; i--) |
608 | for (int i = AvFILL (av); i >= 0; i--) |
707 | ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); |
609 | ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); |
708 | } |
610 | } |
709 | else if (htype == HOOK_DESTROY) |
611 | else if (htype == HOOK_DESTROY) |
710 | { |
612 | { |
711 | clearSVptr ((SV *)term->perl.self); |
613 | clearSVptr ((SV *)term->perl.self); |
712 | SvREFCNT_dec ((SV *)term->perl.self); |
614 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
615 | |
|
|
616 | // don't allow further calls |
|
|
617 | term->perl.self = 0; |
713 | } |
618 | } |
714 | |
619 | |
715 | swap (perl_environ, environ); |
620 | swap (perl_environ, environ); |
716 | |
621 | |
717 | return event_consumed; |
622 | return event_consumed; |
… | |
… | |
741 | # include "optinc.h" |
646 | # include "optinc.h" |
742 | # undef nodef |
647 | # undef nodef |
743 | # undef def |
648 | # undef def |
744 | |
649 | |
745 | HV *stash = gv_stashpv ("urxvt", 1); |
650 | HV *stash = gv_stashpv ("urxvt", 1); |
746 | struct { |
651 | static const struct { |
747 | const char *name; |
652 | const char *name; |
748 | IV iv; |
653 | IV iv; |
749 | } *civ, const_iv[] = { |
654 | } *civ, const_iv[] = { |
750 | # define const_iv(name) { # name, (IV)name } |
655 | # define const_iv(name) { # name, (IV)name } |
|
|
656 | const_iv (NUM_RESOURCES), |
751 | const_iv (DEFAULT_RSTYLE), |
657 | const_iv (DEFAULT_RSTYLE), |
752 | const_iv (OVERLAY_RSTYLE), |
658 | const_iv (OVERLAY_RSTYLE), |
|
|
659 | const_iv (Color_Bits), |
|
|
660 | const_iv (RS_bgShift), const_iv (RS_bgMask), |
|
|
661 | const_iv (RS_fgShift), const_iv (RS_fgMask), |
|
|
662 | const_iv (RS_Careful), |
|
|
663 | const_iv (RS_fontCount), |
|
|
664 | const_iv (RS_fontShift), |
|
|
665 | const_iv (RS_fontMask), |
|
|
666 | const_iv (RS_baseattrMask), |
|
|
667 | const_iv (RS_attrMask), |
|
|
668 | const_iv (RS_redraw), |
|
|
669 | const_iv (RS_Sel), |
753 | const_iv (RS_Bold), |
670 | const_iv (RS_Bold), |
754 | const_iv (RS_Italic), |
671 | const_iv (RS_Italic), |
755 | const_iv (RS_Blink), |
672 | const_iv (RS_Blink), |
756 | const_iv (RS_RVid), |
673 | const_iv (RS_RVid), |
757 | const_iv (RS_Uline), |
674 | const_iv (RS_Uline), |
… | |
… | |
770 | const_iv (Button3Mask), |
687 | const_iv (Button3Mask), |
771 | const_iv (Button4Mask), |
688 | const_iv (Button4Mask), |
772 | const_iv (Button5Mask), |
689 | const_iv (Button5Mask), |
773 | const_iv (AnyModifier), |
690 | const_iv (AnyModifier), |
774 | |
691 | |
775 | const_iv (EVENT_NONE), |
692 | const_iv (NoSymbol), |
776 | const_iv (EVENT_READ), |
693 | const_iv (GrabModeSync), |
777 | const_iv (EVENT_WRITE), |
694 | const_iv (GrabModeAsync), |
778 | |
695 | |
779 | const_iv (NoEventMask), |
696 | const_iv (NoEventMask), |
780 | const_iv (KeyPressMask), |
697 | const_iv (KeyPressMask), |
781 | const_iv (KeyReleaseMask), |
698 | const_iv (KeyReleaseMask), |
782 | const_iv (ButtonPressMask), |
699 | const_iv (ButtonPressMask), |
… | |
… | |
834 | const_iv (SelectionRequest), |
751 | const_iv (SelectionRequest), |
835 | const_iv (SelectionNotify), |
752 | const_iv (SelectionNotify), |
836 | const_iv (ColormapNotify), |
753 | const_iv (ColormapNotify), |
837 | const_iv (ClientMessage), |
754 | const_iv (ClientMessage), |
838 | const_iv (MappingNotify), |
755 | const_iv (MappingNotify), |
|
|
756 | # if ENABLE_XIM_ONTHESPOT |
|
|
757 | const_iv (XIMReverse), |
|
|
758 | const_iv (XIMUnderline), |
|
|
759 | const_iv (XIMHighlight), |
|
|
760 | const_iv (XIMPrimary), |
|
|
761 | const_iv (XIMSecondary), |
|
|
762 | const_iv (XIMTertiary), |
|
|
763 | const_iv (XIMVisibleToForward), |
|
|
764 | const_iv (XIMVisibleToBackword), |
|
|
765 | const_iv (XIMVisibleToCenter), |
|
|
766 | # if 0 |
|
|
767 | const_iv (XIMForwardChar), |
|
|
768 | const_iv (XIMBackwardChar), |
|
|
769 | const_iv (XIMForwardWord), |
|
|
770 | const_iv (XIMBackwardWord), |
|
|
771 | const_iv (XIMCaretUp), |
|
|
772 | const_iv (XIMCaretDown), |
|
|
773 | const_iv (XIMNextLine), |
|
|
774 | const_iv (XIMPreviousLine), |
|
|
775 | const_iv (XIMLineStart), |
|
|
776 | const_iv (XIMLineEnd), |
|
|
777 | const_iv (XIMAbsolutePosition), |
|
|
778 | const_iv (XIMDontChange), |
|
|
779 | # endif |
|
|
780 | # endif |
839 | }; |
781 | }; |
840 | |
782 | |
841 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
783 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
842 | civ-- > const_iv; ) |
|
|
843 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
784 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
844 | } |
785 | } |
845 | |
786 | |
846 | void |
787 | void |
847 | warn (const char *msg) |
788 | warn (const char *msg) |
… | |
… | |
857 | _exit (int status) |
798 | _exit (int status) |
858 | |
799 | |
859 | NV |
800 | NV |
860 | NOW () |
801 | NOW () |
861 | CODE: |
802 | CODE: |
862 | RETVAL = NOW; |
803 | RETVAL = ev::now (); |
863 | OUTPUT: |
804 | OUTPUT: |
864 | RETVAL |
805 | RETVAL |
865 | |
806 | |
866 | int |
807 | int |
867 | GET_BASEFG (int rend) |
808 | GET_BASEFG (int rend) |
… | |
… | |
878 | RETVAL |
819 | RETVAL |
879 | |
820 | |
880 | int |
821 | int |
881 | SET_FGCOLOR (int rend, int new_color) |
822 | SET_FGCOLOR (int rend, int new_color) |
882 | CODE: |
823 | CODE: |
883 | RETVAL = SET_FGCOLOR (rend, new_color); |
824 | RETVAL = SET_FGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
884 | OUTPUT: |
825 | OUTPUT: |
885 | RETVAL |
826 | RETVAL |
886 | |
827 | |
887 | int |
828 | int |
888 | SET_BGCOLOR (int rend, int new_color) |
829 | SET_BGCOLOR (int rend, int new_color) |
889 | CODE: |
830 | CODE: |
890 | RETVAL = SET_BGCOLOR (rend, new_color); |
831 | RETVAL = SET_BGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
891 | OUTPUT: |
832 | OUTPUT: |
892 | RETVAL |
833 | RETVAL |
893 | |
834 | |
894 | int |
835 | int |
895 | GET_CUSTOM (int rend) |
836 | GET_CUSTOM (int rend) |
896 | CODE: |
837 | CODE: |
897 | RETVAL = (rend && RS_customMask) >> RS_customShift; |
838 | RETVAL = (rend & RS_customMask) >> RS_customShift; |
898 | OUTPUT: |
839 | OUTPUT: |
899 | RETVAL |
840 | RETVAL |
900 | |
841 | |
901 | int |
842 | int |
902 | SET_CUSTOM (int rend, int new_value) |
843 | SET_CUSTOM (int rend, int new_value) |
… | |
… | |
909 | | ((new_value << RS_customShift) & RS_customMask); |
850 | | ((new_value << RS_customShift) & RS_customMask); |
910 | } |
851 | } |
911 | OUTPUT: |
852 | OUTPUT: |
912 | RETVAL |
853 | RETVAL |
913 | |
854 | |
|
|
855 | void |
|
|
856 | termlist () |
|
|
857 | PPCODE: |
|
|
858 | { |
|
|
859 | EXTEND (SP, rxvt_term::termlist.size ()); |
|
|
860 | |
|
|
861 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
|
|
862 | if ((*t)->perl.self) |
|
|
863 | PUSHs (sv_2mortal (newSVterm (*t))); |
|
|
864 | } |
|
|
865 | |
914 | MODULE = urxvt PACKAGE = urxvt::term |
866 | MODULE = urxvt PACKAGE = urxvt::term |
915 | |
867 | |
916 | SV * |
868 | SV * |
917 | _new (...) |
869 | _new (AV *env, AV *arg) |
918 | CODE: |
870 | CODE: |
919 | { |
871 | { |
920 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
|
|
921 | croak ("first argument to urxvt::term->_new must be arrayref"); |
|
|
922 | |
|
|
923 | rxvt_term *term = new rxvt_term; |
872 | rxvt_term *term = new rxvt_term; |
924 | |
873 | |
925 | term->argv = new stringvec; |
874 | stringvec *argv = new stringvec; |
926 | term->envv = new stringvec; |
875 | stringvec *envv = new stringvec; |
927 | |
876 | |
928 | for (int i = 1; i < items; i++) |
877 | for (int i = 0; i <= AvFILL (arg); i++) |
929 | term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
878 | argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1)))); |
930 | |
879 | |
931 | AV *envv = (AV *)SvRV (ST (0)); |
|
|
932 | for (int i = AvFILL (envv) + 1; i--; ) |
880 | for (int i = AvFILL (env) + 1; i--; ) |
933 | term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); |
881 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
934 | |
882 | |
935 | term->envv->push_back (0); |
883 | envv->push_back (0); |
936 | |
|
|
937 | bool success; |
|
|
938 | |
884 | |
939 | try |
885 | try |
940 | { |
886 | { |
941 | success = term->init (term->argv->size (), term->argv->begin ()); |
887 | term->init (argv, envv); |
942 | } |
888 | } |
943 | catch (const class rxvt_failure_exception &e) |
889 | catch (const class rxvt_failure_exception &e) |
944 | { |
|
|
945 | success = false; |
|
|
946 | } |
|
|
947 | |
|
|
948 | if (!success) |
|
|
949 | { |
890 | { |
950 | term->destroy (); |
891 | term->destroy (); |
951 | croak ("error while initializing new terminal instance"); |
892 | croak ("error while initializing new terminal instance"); |
952 | } |
893 | } |
953 | |
894 | |
… | |
… | |
963 | void |
904 | void |
964 | rxvt_term::set_should_invoke (int htype, int inc) |
905 | rxvt_term::set_should_invoke (int htype, int inc) |
965 | CODE: |
906 | CODE: |
966 | THIS->perl.should_invoke [htype] += inc; |
907 | THIS->perl.should_invoke [htype] += inc; |
967 | |
908 | |
968 | void |
909 | int |
969 | rxvt_term::grab_button (int button, U32 modifiers) |
910 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
970 | CODE: |
911 | CODE: |
971 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
912 | RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, |
972 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
913 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
973 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
914 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
|
|
915 | OUTPUT: RETVAL |
|
|
916 | |
|
|
917 | int |
|
|
918 | rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt) |
|
|
919 | CODE: |
|
|
920 | RETVAL = XUngrabButton (THIS->dpy, button, modifiers, window); |
|
|
921 | OUTPUT: RETVAL |
|
|
922 | |
|
|
923 | void |
|
|
924 | rxvt_term::XGrabKey (int keycode, U32 modifiers, Window window = THIS->vt, \ |
|
|
925 | int owner_events = 1, int pointer_mode = GrabModeAsync, int keyboard_mode = GrabModeAsync) |
|
|
926 | CODE: |
|
|
927 | XGrabKey (THIS->dpy, keycode, modifiers, window, owner_events, pointer_mode, keyboard_mode); |
|
|
928 | |
|
|
929 | void |
|
|
930 | rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt) |
|
|
931 | CODE: |
|
|
932 | XUngrabKey (THIS->dpy, keycode, modifiers, window); |
|
|
933 | |
|
|
934 | void |
|
|
935 | rxvt_term::XUngrabKeyboard (Time eventtime) |
|
|
936 | CODE: |
|
|
937 | XUngrabKeyboard (THIS->dpy, eventtime); |
974 | |
938 | |
975 | bool |
939 | bool |
976 | rxvt_term::grab (Time eventtime, int sync = 0) |
940 | rxvt_term::grab (Time eventtime, int sync = 0) |
977 | CODE: |
941 | CODE: |
978 | { |
942 | { |
979 | int mode = sync ? GrabModeSync : GrabModeAsync; |
943 | int mode = sync ? GrabModeSync : GrabModeAsync; |
980 | |
944 | |
981 | THIS->perl.grabtime = 0; |
945 | THIS->perl.grabtime = 0; |
982 | |
946 | |
983 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
947 | if (!XGrabPointer (THIS->dpy, THIS->vt, 0, |
984 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
948 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
985 | mode, mode, None, GRAB_CURSOR, eventtime)) |
949 | mode, mode, None, GRAB_CURSOR, eventtime)) |
986 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
950 | if (!XGrabKeyboard (THIS->dpy, THIS->vt, 0, mode, mode, eventtime)) |
987 | THIS->perl.grabtime = eventtime; |
951 | THIS->perl.grabtime = eventtime; |
988 | else |
952 | else |
989 | XUngrabPointer (THIS->display->display, eventtime); |
953 | XUngrabPointer (THIS->dpy, eventtime); |
990 | |
954 | |
991 | RETVAL = !!THIS->perl.grabtime; |
955 | RETVAL = !!THIS->perl.grabtime; |
992 | } |
956 | } |
993 | OUTPUT: |
957 | OUTPUT: |
994 | RETVAL |
958 | RETVAL |
995 | |
959 | |
996 | void |
960 | void |
997 | rxvt_term::allow_events_async () |
961 | rxvt_term::allow_events_async () |
998 | CODE: |
962 | CODE: |
999 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
963 | XAllowEvents (THIS->dpy, AsyncBoth, THIS->perl.grabtime); |
1000 | |
964 | |
1001 | void |
965 | void |
1002 | rxvt_term::allow_events_sync () |
966 | rxvt_term::allow_events_sync () |
1003 | CODE: |
967 | CODE: |
1004 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
968 | XAllowEvents (THIS->dpy, SyncBoth, THIS->perl.grabtime); |
1005 | |
969 | |
1006 | void |
970 | void |
1007 | rxvt_term::allow_events_replay () |
971 | rxvt_term::allow_events_replay () |
1008 | CODE: |
972 | CODE: |
1009 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
973 | XAllowEvents (THIS->dpy, ReplayPointer, THIS->perl.grabtime); |
1010 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
974 | XAllowEvents (THIS->dpy, ReplayKeyboard, THIS->perl.grabtime); |
1011 | |
975 | |
1012 | void |
976 | void |
1013 | rxvt_term::ungrab () |
977 | rxvt_term::ungrab () |
1014 | CODE: |
978 | CODE: |
1015 | ungrab (THIS); |
979 | ungrab (THIS); |
|
|
980 | |
|
|
981 | int |
|
|
982 | rxvt_term::XStringToKeysym (char *string) |
|
|
983 | CODE: |
|
|
984 | RETVAL = XStringToKeysym (string); |
|
|
985 | OUTPUT: RETVAL |
|
|
986 | |
|
|
987 | char * |
|
|
988 | rxvt_term::XKeysymToString (int sym) |
|
|
989 | CODE: |
|
|
990 | RETVAL = XKeysymToString (sym); |
|
|
991 | OUTPUT: RETVAL |
|
|
992 | |
|
|
993 | int |
|
|
994 | rxvt_term::XKeysymToKeycode (int sym) |
|
|
995 | CODE: |
|
|
996 | RETVAL = XKeysymToKeycode (THIS->dpy, sym); |
|
|
997 | OUTPUT: RETVAL |
|
|
998 | |
|
|
999 | int |
|
|
1000 | rxvt_term::XKeycodeToKeysym (int code, int index) |
|
|
1001 | CODE: |
|
|
1002 | RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); |
|
|
1003 | OUTPUT: RETVAL |
1016 | |
1004 | |
1017 | int |
1005 | int |
1018 | rxvt_term::strwidth (SV *str) |
1006 | rxvt_term::strwidth (SV *str) |
1019 | CODE: |
1007 | CODE: |
1020 | { |
1008 | { |
1021 | wchar_t *wstr = sv2wcs (str); |
1009 | wchar_t *wstr = sv2wcs (str); |
1022 | |
1010 | |
1023 | rxvt_push_locale (THIS->locale); |
1011 | rxvt_push_locale (THIS->locale); |
1024 | RETVAL = wcswidth (wstr, wcslen (wstr)); |
1012 | RETVAL = 0; |
|
|
1013 | for (wchar_t *wc = wstr; *wc; wc++) |
|
|
1014 | { |
|
|
1015 | int w = WCWIDTH (*wc); |
|
|
1016 | |
|
|
1017 | if (w) |
|
|
1018 | RETVAL += max (w, 1); |
|
|
1019 | } |
1025 | rxvt_pop_locale (); |
1020 | rxvt_pop_locale (); |
1026 | |
1021 | |
1027 | free (wstr); |
1022 | free (wstr); |
1028 | } |
1023 | } |
1029 | OUTPUT: |
1024 | OUTPUT: |
… | |
… | |
1062 | free (wstr); |
1057 | free (wstr); |
1063 | } |
1058 | } |
1064 | OUTPUT: |
1059 | OUTPUT: |
1065 | RETVAL |
1060 | RETVAL |
1066 | |
1061 | |
|
|
1062 | char * |
|
|
1063 | rxvt_term::locale () |
|
|
1064 | CODE: |
|
|
1065 | RETVAL = THIS->locale; |
|
|
1066 | OUTPUT: |
|
|
1067 | RETVAL |
|
|
1068 | |
1067 | #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) |
1069 | #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) |
1068 | |
1070 | |
1069 | #define TERM_OFFSET_width TERM_OFFSET(width) |
1071 | #define TERM_OFFSET_width TERM_OFFSET(width) |
1070 | #define TERM_OFFSET_height TERM_OFFSET(height) |
1072 | #define TERM_OFFSET_height TERM_OFFSET(height) |
1071 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
1073 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
1072 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
1074 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
1073 | #define TERM_OFFSET_fbase TERM_OFFSET(fbase) |
1075 | #define TERM_OFFSET_fbase TERM_OFFSET(fbase) |
1074 | #define TERM_OFFSET_nrow TERM_OFFSET(nrow) |
1076 | #define TERM_OFFSET_nrow TERM_OFFSET(nrow) |
1075 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
1077 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
1076 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
1078 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
1077 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
1079 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
1078 | #define TERM_OFFSET_int_bwidth TERM_OFFSET(int_bwidth) |
1080 | #define TERM_OFFSET_int_bwidth TERM_OFFSET(int_bwidth) |
1079 | #define TERM_OFFSET_ext_bwidth TERM_OFFSET(ext_bwidth) |
1081 | #define TERM_OFFSET_ext_bwidth TERM_OFFSET(ext_bwidth) |
1080 | #define TERM_OFFSET_lineSpace TERM_OFFSET(lineSpace) |
1082 | #define TERM_OFFSET_lineSpace TERM_OFFSET(lineSpace) |
|
|
1083 | #define TERM_OFFSET_letterSpace TERM_OFFSET(letterSpace) |
1081 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
1084 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
1082 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
1085 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
1083 | #define TERM_OFFSET_top_row TERM_OFFSET(top_row) |
1086 | #define TERM_OFFSET_top_row TERM_OFFSET(top_row) |
1084 | |
1087 | |
1085 | int |
1088 | int |
1086 | rxvt_term::width () |
1089 | rxvt_term::width () |
1087 | ALIAS: |
1090 | ALIAS: |
1088 | width = TERM_OFFSET_width |
1091 | width = TERM_OFFSET_width |
1089 | height = TERM_OFFSET_height |
1092 | height = TERM_OFFSET_height |
1090 | fwidth = TERM_OFFSET_fwidth |
1093 | fwidth = TERM_OFFSET_fwidth |
1091 | fheight = TERM_OFFSET_fheight |
1094 | fheight = TERM_OFFSET_fheight |
1092 | fbase = TERM_OFFSET_fbase |
1095 | fbase = TERM_OFFSET_fbase |
1093 | nrow = TERM_OFFSET_nrow |
1096 | nrow = TERM_OFFSET_nrow |
1094 | ncol = TERM_OFFSET_ncol |
1097 | ncol = TERM_OFFSET_ncol |
1095 | focus = TERM_OFFSET_focus |
1098 | focus = TERM_OFFSET_focus |
1096 | mapped = TERM_OFFSET_mapped |
1099 | mapped = TERM_OFFSET_mapped |
1097 | int_bwidth = TERM_OFFSET_int_bwidth |
1100 | int_bwidth = TERM_OFFSET_int_bwidth |
1098 | ext_bwidth = TERM_OFFSET_ext_bwidth |
1101 | ext_bwidth = TERM_OFFSET_ext_bwidth |
1099 | lineSpace = TERM_OFFSET_lineSpace |
1102 | lineSpace = TERM_OFFSET_lineSpace |
|
|
1103 | letterSpace = TERM_OFFSET_letterSpace |
1100 | saveLines = TERM_OFFSET_saveLines |
1104 | saveLines = TERM_OFFSET_saveLines |
1101 | total_rows = TERM_OFFSET_total_rows |
1105 | total_rows = TERM_OFFSET_total_rows |
1102 | top_row = TERM_OFFSET_top_row |
1106 | top_row = TERM_OFFSET_top_row |
1103 | CODE: |
1107 | CODE: |
1104 | RETVAL = *(int *)((char *)THIS + ix); |
1108 | RETVAL = *(int *)((char *)THIS + ix); |
1105 | OUTPUT: |
1109 | OUTPUT: |
1106 | RETVAL |
1110 | RETVAL |
1107 | |
1111 | |
… | |
… | |
1109 | rxvt_term::ModLevel3Mask () |
1113 | rxvt_term::ModLevel3Mask () |
1110 | ALIAS: |
1114 | ALIAS: |
1111 | ModLevel3Mask = 0 |
1115 | ModLevel3Mask = 0 |
1112 | ModMetaMask = 1 |
1116 | ModMetaMask = 1 |
1113 | ModNumLockMask = 2 |
1117 | ModNumLockMask = 2 |
|
|
1118 | current_screen = 3 |
|
|
1119 | hidden_cursor = 4 |
1114 | CODE: |
1120 | CODE: |
1115 | switch (ix) |
1121 | switch (ix) |
1116 | { |
1122 | { |
1117 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1123 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1118 | case 1: RETVAL = THIS->ModMetaMask; break; |
1124 | case 1: RETVAL = THIS->ModMetaMask; break; |
1119 | case 2: RETVAL = THIS->ModNumLockMask; break; |
1125 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
1126 | case 3: RETVAL = THIS->current_screen; break; |
|
|
1127 | #ifdef CURSOR_BLINK |
|
|
1128 | case 4: RETVAL = THIS->hidden_cursor; break; |
|
|
1129 | #endif |
1120 | } |
1130 | } |
1121 | OUTPUT: |
1131 | OUTPUT: |
1122 | RETVAL |
1132 | RETVAL |
1123 | |
1133 | |
1124 | char * |
1134 | char * |
… | |
… | |
1134 | } |
1144 | } |
1135 | OUTPUT: |
1145 | OUTPUT: |
1136 | RETVAL |
1146 | RETVAL |
1137 | |
1147 | |
1138 | SV * |
1148 | SV * |
1139 | rxvt_term::_env () |
1149 | rxvt_term::envv () |
|
|
1150 | ALIAS: |
|
|
1151 | argv = 1 |
1140 | CODE: |
1152 | PPCODE: |
1141 | { |
1153 | { |
1142 | if (THIS->envv) |
1154 | stringvec *vec = ix ? THIS->argv : THIS->envv; |
1143 | { |
|
|
1144 | AV *av = newAV (); |
|
|
1145 | |
1155 | |
|
|
1156 | EXTEND (SP, vec->size ()); |
|
|
1157 | |
1146 | for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i) |
1158 | for (char **i = vec->begin (); i != vec->end (); ++i) |
1147 | if (*i) |
1159 | if (*i) |
1148 | av_push (av, newSVpv (*i, 0)); |
1160 | PUSHs (sv_2mortal (newSVpv (*i, 0))); |
1149 | |
|
|
1150 | RETVAL = newRV_noinc ((SV *)av); |
|
|
1151 | } |
|
|
1152 | else |
|
|
1153 | RETVAL = &PL_sv_undef; |
|
|
1154 | } |
1161 | } |
1155 | OUTPUT: |
|
|
1156 | RETVAL |
|
|
1157 | |
1162 | |
1158 | int |
1163 | int |
1159 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1164 | rxvt_term::pty_ev_events (int events = ev::UNDEF) |
1160 | CODE: |
1165 | CODE: |
1161 | RETVAL = THIS->pty_ev.events; |
1166 | RETVAL = THIS->pty_ev.events; |
1162 | if (events != EVENT_UNDEF) |
1167 | if (events != ev::UNDEF) |
1163 | THIS->pty_ev.set (events); |
1168 | THIS->pty_ev.set (events); |
|
|
1169 | OUTPUT: |
|
|
1170 | RETVAL |
|
|
1171 | |
|
|
1172 | int |
|
|
1173 | rxvt_term::pty_fd () |
|
|
1174 | CODE: |
|
|
1175 | RETVAL = THIS->pty->pty; |
1164 | OUTPUT: |
1176 | OUTPUT: |
1165 | RETVAL |
1177 | RETVAL |
1166 | |
1178 | |
1167 | Window |
1179 | Window |
1168 | rxvt_term::parent () |
1180 | rxvt_term::parent () |
… | |
… | |
1204 | } |
1216 | } |
1205 | OUTPUT: |
1217 | OUTPUT: |
1206 | RETVAL |
1218 | RETVAL |
1207 | |
1219 | |
1208 | void |
1220 | void |
|
|
1221 | rxvt_term::focus_in () |
|
|
1222 | |
|
|
1223 | void |
|
|
1224 | rxvt_term::focus_out () |
|
|
1225 | |
|
|
1226 | void |
|
|
1227 | rxvt_term::key_press (unsigned int state, unsigned int keycode, Time time = CurrentTime) |
|
|
1228 | ALIAS: |
|
|
1229 | key_release = 1 |
|
|
1230 | CODE: |
|
|
1231 | { |
|
|
1232 | XKeyEvent xkey; |
|
|
1233 | |
|
|
1234 | memset (&xkey, 0, sizeof (xkey)); |
|
|
1235 | |
|
|
1236 | xkey.time = time; |
|
|
1237 | xkey.state = state; |
|
|
1238 | xkey.keycode = keycode; |
|
|
1239 | |
|
|
1240 | xkey.type = ix ? KeyRelease : KeyPress; |
|
|
1241 | xkey.display = THIS->dpy; |
|
|
1242 | xkey.window = THIS->vt; |
|
|
1243 | xkey.root = THIS->display->root; |
|
|
1244 | xkey.subwindow = THIS->vt; |
|
|
1245 | |
|
|
1246 | if (ix) |
|
|
1247 | THIS->key_release (xkey); |
|
|
1248 | else |
|
|
1249 | THIS->key_press (xkey); |
|
|
1250 | } |
|
|
1251 | |
|
|
1252 | void |
1209 | rxvt_term::want_refresh () |
1253 | rxvt_term::want_refresh () |
1210 | CODE: |
1254 | CODE: |
1211 | THIS->want_refresh = 1; |
1255 | THIS->want_refresh = 1; |
|
|
1256 | THIS->refresh_check (); |
1212 | |
1257 | |
1213 | void |
1258 | void |
1214 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1259 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1215 | PPCODE: |
1260 | PPCODE: |
1216 | { |
1261 | { |
… | |
… | |
1219 | |
1264 | |
1220 | line_t &l = ROW(row_number); |
1265 | line_t &l = ROW(row_number); |
1221 | |
1266 | |
1222 | if (GIMME_V != G_VOID) |
1267 | if (GIMME_V != G_VOID) |
1223 | { |
1268 | { |
1224 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1269 | wchar_t *wstr = rxvt_temp_buf<wchar_t> (THIS->ncol); |
1225 | |
1270 | |
1226 | for (int col = 0; col < THIS->ncol; col++) |
1271 | for (int col = 0; col < THIS->ncol; col++) |
1227 | wstr [col] = l.t [col]; |
1272 | wstr [col] = l.t [col]; |
1228 | |
1273 | |
1229 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1274 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1230 | |
|
|
1231 | delete [] wstr; |
|
|
1232 | } |
1275 | } |
1233 | |
1276 | |
1234 | if (new_text) |
1277 | if (new_text) |
1235 | { |
1278 | { |
1236 | wchar_t *wstr = sv2wcs (new_text); |
1279 | wchar_t *wstr = sv2wcs (new_text); |
1237 | |
1280 | |
1238 | int len = min (wcslen (wstr) - start_ofs, max_len); |
1281 | int len = min (wcslen (wstr) - start_ofs, max_len); |
1239 | |
1282 | |
1240 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
1283 | if (start_col < 0 || start_col + len > THIS->ncol) |
1241 | { |
1284 | { |
1242 | free (wstr); |
1285 | free (wstr); |
1243 | croak ("new_text extends beyond horizontal margins"); |
1286 | croak ("new_text extends beyond horizontal margins"); |
1244 | } |
1287 | } |
1245 | |
1288 | |
… | |
… | |
1279 | croak ("new_rend must be arrayref"); |
1322 | croak ("new_rend must be arrayref"); |
1280 | |
1323 | |
1281 | AV *av = (AV *)SvRV (new_rend); |
1324 | AV *av = (AV *)SvRV (new_rend); |
1282 | int len = min (AvFILL (av) + 1 - start_ofs, max_len); |
1325 | int len = min (AvFILL (av) + 1 - start_ofs, max_len); |
1283 | |
1326 | |
1284 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
1327 | if (start_col < 0 || start_col + len > THIS->ncol) |
1285 | croak ("new_rend array extends beyond horizontal margins"); |
1328 | croak ("new_rend array extends beyond horizontal margins"); |
1286 | |
1329 | |
1287 | for (int col = start_col; col < start_col + len; col++) |
1330 | for (int col = start_col; col < start_col + len; col++) |
1288 | { |
1331 | { |
1289 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
1332 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
… | |
… | |
1329 | rxvt_term::special_encode (SV *string) |
1372 | rxvt_term::special_encode (SV *string) |
1330 | CODE: |
1373 | CODE: |
1331 | { |
1374 | { |
1332 | wchar_t *wstr = sv2wcs (string); |
1375 | wchar_t *wstr = sv2wcs (string); |
1333 | int wlen = wcslen (wstr); |
1376 | int wlen = wcslen (wstr); |
1334 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
1377 | wchar_t *rstr = rxvt_temp_buf<wchar_t> (wlen * 2); // cannot become longer |
1335 | |
1378 | |
1336 | rxvt_push_locale (THIS->locale); |
1379 | rxvt_push_locale (THIS->locale); |
1337 | |
1380 | |
1338 | wchar_t *r = rstr; |
1381 | wchar_t *r = rstr; |
1339 | for (wchar_t *s = wstr; *s; s++) |
1382 | for (wchar_t *s = wstr; *s; s++) |
|
|
1383 | { |
|
|
1384 | int w = WCWIDTH (*s); |
|
|
1385 | |
1340 | if (wcwidth (*s) == 0) |
1386 | if (w == 0) |
1341 | { |
1387 | { |
1342 | if (r == rstr) |
1388 | if (r == rstr) |
1343 | croak ("leading combining character unencodable"); |
1389 | croak ("leading combining character unencodable"); |
1344 | |
1390 | |
1345 | unicode_t n = rxvt_compose (r[-1], *s); |
1391 | unicode_t n = rxvt_compose (r[-1], *s); |
1346 | if (n == NOCHAR) |
1392 | if (n == NOCHAR) |
1347 | n = rxvt_composite.compose (r[-1], *s); |
1393 | n = rxvt_composite.compose (r[-1], *s); |
1348 | |
1394 | |
1349 | r[-1] = n; |
1395 | r[-1] = n; |
1350 | } |
1396 | } |
1351 | #if !UNICODE_3 |
1397 | #if !UNICODE_3 |
1352 | else if (*s >= 0x10000) |
1398 | else if (*s >= 0x10000) |
1353 | *r++ = rxvt_composite.compose (*s); |
1399 | *r++ = rxvt_composite.compose (*s); |
1354 | #endif |
1400 | #endif |
1355 | else |
1401 | else |
1356 | *r++ = *s; |
1402 | *r++ = *s; |
|
|
1403 | |
|
|
1404 | // the *2 above only allows wcwidth <= 2 |
|
|
1405 | if (w > 1) |
|
|
1406 | *r++ = NOCHAR; |
|
|
1407 | } |
1357 | |
1408 | |
1358 | rxvt_pop_locale (); |
1409 | rxvt_pop_locale (); |
1359 | |
1410 | |
1360 | RETVAL = wcs2sv (rstr, r - rstr); |
1411 | RETVAL = wcs2sv (rstr, r - rstr); |
1361 | |
|
|
1362 | delete [] rstr; |
|
|
1363 | } |
1412 | } |
1364 | OUTPUT: |
1413 | OUTPUT: |
1365 | RETVAL |
1414 | RETVAL |
1366 | |
1415 | |
1367 | SV * |
1416 | SV * |
1368 | rxvt_term::special_decode (SV *text) |
1417 | rxvt_term::special_decode (SV *text) |
1369 | CODE: |
1418 | CODE: |
1370 | { |
1419 | { |
1371 | wchar_t *wstr = sv2wcs (text); |
1420 | wchar_t *wstr = sv2wcs (text); |
1372 | int wlen = wcslen (wstr); |
|
|
1373 | int dlen = 0; |
1421 | int dlen = 0; |
1374 | |
1422 | |
1375 | // find length |
1423 | // find length |
1376 | for (wchar_t *s = wstr; *s; s++) |
1424 | for (wchar_t *s = wstr; *s; s++) |
1377 | if (*s == NOCHAR) |
1425 | if (*s == NOCHAR) |
… | |
… | |
1379 | else if (IS_COMPOSE (*s)) |
1427 | else if (IS_COMPOSE (*s)) |
1380 | dlen += rxvt_composite.expand (*s, 0); |
1428 | dlen += rxvt_composite.expand (*s, 0); |
1381 | else |
1429 | else |
1382 | dlen++; |
1430 | dlen++; |
1383 | |
1431 | |
1384 | wchar_t *rstr = new wchar_t [dlen]; |
1432 | wchar_t *rstr = rxvt_temp_buf<wchar_t> (dlen); |
1385 | |
1433 | |
1386 | // decode |
1434 | // decode |
1387 | wchar_t *r = rstr; |
1435 | wchar_t *r = rstr; |
1388 | for (wchar_t *s = wstr; *s; s++) |
1436 | for (wchar_t *s = wstr; *s; s++) |
1389 | if (*s == NOCHAR) |
1437 | if (*s == NOCHAR) |
… | |
… | |
1392 | r += rxvt_composite.expand (*s, r); |
1440 | r += rxvt_composite.expand (*s, r); |
1393 | else |
1441 | else |
1394 | *r++ = *s; |
1442 | *r++ = *s; |
1395 | |
1443 | |
1396 | RETVAL = wcs2sv (rstr, r - rstr); |
1444 | RETVAL = wcs2sv (rstr, r - rstr); |
1397 | |
|
|
1398 | delete [] rstr; |
|
|
1399 | } |
1445 | } |
1400 | OUTPUT: |
1446 | OUTPUT: |
1401 | RETVAL |
1447 | RETVAL |
1402 | |
1448 | |
1403 | void |
1449 | void |
1404 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1450 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1405 | PPCODE: |
1451 | PPCODE: |
1406 | { |
1452 | { |
1407 | struct resval { const char *name; int value; } rslist [] = { |
1453 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1408 | # define def(name) { # name, Rs_ ## name }, |
1454 | # define def(name) { # name, Rs_ ## name }, |
1409 | # define reserve(name,count) |
1455 | # define reserve(name,count) |
1410 | # include "rsinc.h" |
1456 | # include "rsinc.h" |
1411 | # undef def |
1457 | # undef def |
1412 | # undef reserve |
1458 | # undef reserve |
1413 | }; |
1459 | }; |
1414 | |
1460 | |
1415 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1461 | rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1416 | |
1462 | |
|
|
1463 | if (*name) |
1417 | do { |
1464 | { |
|
|
1465 | do { |
1418 | if (rs-- == rslist) |
1466 | if (rs-- == rslist) |
1419 | croak ("no such resource '%s', requested", name); |
1467 | croak ("no such resource '%s', requested", name); |
1420 | } while (strcmp (name, rs->name)); |
1468 | } while (strcmp (name, rs->name)); |
1421 | |
1469 | |
1422 | index += rs->value; |
1470 | index += rs->value; |
|
|
1471 | } |
|
|
1472 | else |
|
|
1473 | { |
|
|
1474 | --rs; |
|
|
1475 | name = ""; |
|
|
1476 | } |
1423 | |
1477 | |
1424 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1478 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1425 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1479 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1426 | |
1480 | |
1427 | if (GIMME_V != G_VOID) |
1481 | if (GIMME_V != G_VOID) |
… | |
… | |
1442 | |
1496 | |
1443 | const char * |
1497 | const char * |
1444 | rxvt_term::x_resource (const char *name) |
1498 | rxvt_term::x_resource (const char *name) |
1445 | |
1499 | |
1446 | bool |
1500 | bool |
1447 | rxvt_term::option (U32 optval, int set = -1) |
1501 | rxvt_term::option (U8 optval, int set = -1) |
1448 | CODE: |
1502 | CODE: |
1449 | { |
1503 | { |
1450 | RETVAL = THIS->options & optval; |
1504 | RETVAL = THIS->option (optval); |
1451 | |
1505 | |
1452 | if (set >= 0) |
1506 | if (set >= 0) |
1453 | { |
1507 | { |
1454 | if (set) |
|
|
1455 | THIS->options |= optval; |
1508 | THIS->set_option (optval, set); |
1456 | else |
|
|
1457 | THIS->options &= ~optval; |
|
|
1458 | |
1509 | |
1459 | if (THIS->check_ev.is_active ()) // avoid doing this before START |
1510 | if (THIS->env_colorfgbg [0]) // avoid doing this before START |
1460 | switch (optval) |
1511 | switch (optval) |
1461 | { |
1512 | { |
1462 | case Opt_skipBuiltinGlyphs: |
1513 | case Opt_skipBuiltinGlyphs: |
1463 | THIS->set_fonts (); |
1514 | THIS->set_fonts (); |
1464 | THIS->scr_remap_chars (); |
1515 | THIS->scr_remap_chars (); |
1465 | THIS->scr_touch (true); |
1516 | THIS->scr_touch (true); |
1466 | THIS->want_refresh = 1; |
1517 | THIS->want_refresh = 1; |
|
|
1518 | THIS->refresh_check (); |
1467 | break; |
1519 | break; |
1468 | |
1520 | |
1469 | case Opt_cursorUnderline: |
1521 | case Opt_cursorUnderline: |
1470 | THIS->want_refresh = 1; |
1522 | THIS->want_refresh = 1; |
|
|
1523 | THIS->refresh_check (); |
1471 | break; |
1524 | break; |
1472 | |
1525 | |
1473 | # case Opt_scrollBar_floating: |
1526 | # case Opt_scrollBar_floating: |
1474 | # case Opt_scrollBar_right: |
1527 | # case Opt_scrollBar_right: |
1475 | # THIS->resize_all_windows (THIS->width, THIS->height, 1); |
1528 | # THIS->resize_all_windows (THIS->width, THIS->height, 1); |
… | |
… | |
1508 | EXTEND (SP, 2); |
1561 | EXTEND (SP, 2); |
1509 | PUSHs (sv_2mortal (newSViv (rc.row))); |
1562 | PUSHs (sv_2mortal (newSViv (rc.row))); |
1510 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1563 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1511 | } |
1564 | } |
1512 | |
1565 | |
1513 | if (items == 3) |
1566 | if (items >= 3) |
1514 | { |
1567 | { |
1515 | rc.row = SvIV (ST (1)); |
1568 | rc.row = SvIV (ST (1)); |
1516 | rc.col = SvIV (ST (2)); |
1569 | rc.col = SvIV (ST (2)); |
1517 | |
1570 | |
1518 | if (ix == 2 && rc.col == 0) |
1571 | if (ix == 2) |
1519 | { |
1572 | { |
|
|
1573 | if (rc.col == 0) |
|
|
1574 | { |
|
|
1575 | // col == 0 means end of previous line |
1520 | rc.row--; |
1576 | rc.row--; |
1521 | rc.col = THIS->ncol; |
1577 | rc.col = THIS->ncol; |
|
|
1578 | } |
|
|
1579 | else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow) |
|
|
1580 | && rc.col > ROW(rc.row).l) |
|
|
1581 | { |
|
|
1582 | // col >= length means while line and add newline |
|
|
1583 | rc.col = THIS->ncol; |
|
|
1584 | } |
1522 | } |
1585 | } |
1523 | |
1586 | |
1524 | clamp_it (rc.col, 0, THIS->ncol); |
1587 | clamp_it (rc.col, 0, THIS->ncol); |
1525 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1588 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1526 | |
1589 | |
1527 | if (ix) |
1590 | if (ix) |
|
|
1591 | { |
|
|
1592 | THIS->selection.screen = THIS->current_screen; |
|
|
1593 | |
1528 | THIS->want_refresh = 1; |
1594 | THIS->want_refresh = 1; |
|
|
1595 | THIS->refresh_check (); |
1529 | } |
1596 | } |
|
|
1597 | } |
1530 | } |
1598 | } |
1531 | |
1599 | |
1532 | char |
1600 | int |
1533 | rxvt_term::cur_charset () |
1601 | rxvt_term::selection_screen (int screen = -1) |
1534 | CODE: |
1602 | CODE: |
1535 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1603 | RETVAL = THIS->selection.screen; |
1536 | OUTPUT: |
1604 | if (screen >= 0) |
|
|
1605 | THIS->selection.screen = screen; |
|
|
1606 | OUTPUT: |
1537 | RETVAL |
1607 | RETVAL |
1538 | |
1608 | |
1539 | #void |
1609 | void |
1540 | #rxvt_term::selection_clear () |
1610 | rxvt_term::selection_clear (bool clipboard = false) |
1541 | |
1611 | |
1542 | void |
1612 | void |
1543 | rxvt_term::selection_make (Time eventtime, bool rect = false) |
1613 | rxvt_term::selection_make (Time eventtime, bool rect = false) |
1544 | CODE: |
1614 | CODE: |
1545 | THIS->selection.op = SELECTION_CONT; |
1615 | THIS->selection.op = SELECTION_CONT; |
1546 | THIS->selection.rect = rect; |
1616 | THIS->selection.rect = rect; |
1547 | THIS->selection_make (eventtime); |
1617 | THIS->selection_make (eventtime); |
1548 | |
1618 | |
1549 | int |
1619 | int |
1550 | rxvt_term::selection_grab (Time eventtime) |
1620 | rxvt_term::selection_grab (Time eventtime, bool clipboard = false) |
1551 | |
1621 | |
1552 | void |
1622 | void |
1553 | rxvt_term::selection (SV *newtext = 0) |
1623 | rxvt_term::selection (SV *newtext = 0, bool clipboard = false) |
1554 | PPCODE: |
1624 | PPCODE: |
1555 | { |
1625 | { |
|
|
1626 | wchar_t * &text = clipboard ? THIS->selection.clip_text : THIS->selection.text; |
|
|
1627 | unsigned int &len = clipboard ? THIS->selection.clip_len : THIS->selection.len; |
|
|
1628 | |
1556 | if (GIMME_V != G_VOID) |
1629 | if (GIMME_V != G_VOID) |
1557 | XPUSHs (THIS->selection.text |
1630 | XPUSHs (text |
1558 | ? sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)) |
1631 | ? sv_2mortal (wcs2sv (text, len)) |
1559 | : &PL_sv_undef); |
1632 | : &PL_sv_undef); |
1560 | |
1633 | |
1561 | if (newtext) |
1634 | if (newtext) |
1562 | { |
1635 | { |
1563 | free (THIS->selection.text); |
1636 | free (text); |
1564 | |
1637 | |
1565 | THIS->selection.text = sv2wcs (newtext); |
1638 | text = sv2wcs (newtext); |
1566 | THIS->selection.len = wcslen (THIS->selection.text); |
1639 | len = wcslen (text); |
1567 | } |
1640 | } |
1568 | } |
1641 | } |
|
|
1642 | |
|
|
1643 | char |
|
|
1644 | rxvt_term::cur_charset () |
|
|
1645 | CODE: |
|
|
1646 | RETVAL = THIS->charsets [THIS->screen.charset]; |
|
|
1647 | OUTPUT: |
|
|
1648 | RETVAL |
1569 | |
1649 | |
1570 | void |
1650 | void |
1571 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline) |
1651 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline) |
1572 | |
1652 | |
1573 | void |
1653 | void |
1574 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
1654 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
1575 | |
1655 | |
1576 | void |
1656 | void |
1577 | rxvt_term::scr_bell () |
1657 | rxvt_term::scr_bell () |
|
|
1658 | |
|
|
1659 | void |
|
|
1660 | rxvt_term::scr_change_screen (int screen) |
1578 | |
1661 | |
1579 | void |
1662 | void |
1580 | rxvt_term::scr_add_lines (SV *string) |
1663 | rxvt_term::scr_add_lines (SV *string) |
1581 | CODE: |
1664 | CODE: |
1582 | { |
1665 | { |
… | |
… | |
1592 | char *str = SvPVbyte (octets, len); |
1675 | char *str = SvPVbyte (octets, len); |
1593 | C_ARGS: |
1676 | C_ARGS: |
1594 | str, len |
1677 | str, len |
1595 | |
1678 | |
1596 | void |
1679 | void |
|
|
1680 | rxvt_term::tt_paste (SV *octets) |
|
|
1681 | INIT: |
|
|
1682 | STRLEN len; |
|
|
1683 | char *str = SvPVbyte (octets, len); |
|
|
1684 | C_ARGS: |
|
|
1685 | str, len |
|
|
1686 | |
|
|
1687 | void |
1597 | rxvt_term::cmd_parse (SV *octets) |
1688 | rxvt_term::cmd_parse (SV *octets) |
1598 | CODE: |
1689 | CODE: |
1599 | { |
1690 | { |
1600 | STRLEN len; |
1691 | STRLEN len; |
1601 | char *str = SvPVbyte (octets, len); |
1692 | char *str = SvPVbyte (octets, len); |
… | |
… | |
1632 | void |
1723 | void |
1633 | rxvt_term::XListProperties (Window window) |
1724 | rxvt_term::XListProperties (Window window) |
1634 | PPCODE: |
1725 | PPCODE: |
1635 | { |
1726 | { |
1636 | int count; |
1727 | int count; |
1637 | Atom *props = XListProperties (THIS->display->display, window, &count); |
1728 | Atom *props = XListProperties (THIS->dpy, window, &count); |
1638 | |
1729 | |
1639 | EXTEND (SP, count); |
1730 | EXTEND (SP, count); |
1640 | while (count--) |
1731 | while (count--) |
1641 | PUSHs (newSVuv ((U32)props [count])); |
1732 | PUSHs (newSVuv ((U32)props [count])); |
1642 | |
1733 | |
1643 | XFree (props); |
1734 | XFree (props); |
1644 | } |
1735 | } |
1645 | |
1736 | |
1646 | void |
1737 | void |
1647 | rxvt_term::XGetWindowProperty (Window window, Atom property) |
1738 | rxvt_term::XGetWindowProperty (Window window, Atom property) |
… | |
… | |
1650 | Atom type; |
1741 | Atom type; |
1651 | int format; |
1742 | int format; |
1652 | unsigned long nitems; |
1743 | unsigned long nitems; |
1653 | unsigned long bytes_after; |
1744 | unsigned long bytes_after; |
1654 | unsigned char *prop; |
1745 | unsigned char *prop; |
|
|
1746 | |
1655 | XGetWindowProperty (THIS->display->display, window, property, |
1747 | XGetWindowProperty (THIS->dpy, window, property, |
1656 | 0, 1<<30, 0, AnyPropertyType, |
1748 | 0, 1<<24, 0, AnyPropertyType, |
1657 | &type, &format, &nitems, &bytes_after, &prop); |
1749 | &type, &format, &nitems, &bytes_after, &prop); |
|
|
1750 | |
1658 | if (type != None) |
1751 | if (type != None) |
1659 | { |
1752 | { |
|
|
1753 | int elemsize = format == 16 ? sizeof (short) |
|
|
1754 | : format == 32 ? sizeof (long) |
|
|
1755 | : 1; |
|
|
1756 | |
1660 | EXTEND (SP, 3); |
1757 | EXTEND (SP, 3); |
1661 | PUSHs (newSVuv ((U32)type)); |
1758 | PUSHs (newSVuv ((U32)type)); |
1662 | PUSHs (newSViv (format)); |
1759 | PUSHs (newSViv (format)); |
1663 | PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); |
1760 | PUSHs (newSVpvn ((char *)prop, nitems * elemsize)); |
1664 | XFree (prop); |
1761 | XFree (prop); |
1665 | } |
1762 | } |
1666 | } |
1763 | } |
1667 | |
1764 | |
1668 | void |
1765 | void |
1669 | rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data) |
1766 | rxvt_term::XChangeProperty (Window window, Atom property, Atom type, int format, SV *data) |
1670 | CODE: |
1767 | CODE: |
1671 | { |
1768 | { |
1672 | STRLEN len; |
1769 | STRLEN len; |
1673 | char *data_ = SvPVbyte (data, len); |
1770 | char *data_ = SvPVbyte (data, len); |
1674 | |
1771 | |
|
|
1772 | int elemsize = format == 16 ? sizeof (short) |
|
|
1773 | : format == 32 ? sizeof (long) |
|
|
1774 | : 1; |
|
|
1775 | |
1675 | XChangeProperty (THIS->display->display, window, property, |
1776 | XChangeProperty (THIS->dpy, window, property, |
1676 | type, format, PropModeReplace, |
1777 | type, format, PropModeReplace, |
1677 | (unsigned char *)data, len * 8 / format); |
1778 | (unsigned char *)data_, len / elemsize); |
1678 | } |
1779 | } |
|
|
1780 | |
|
|
1781 | Atom |
|
|
1782 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
|
|
1783 | C_ARGS: term->dpy, atom_name, only_if_exists |
|
|
1784 | |
|
|
1785 | char * |
|
|
1786 | XGetAtomName (rxvt_term *term, Atom atom) |
|
|
1787 | C_ARGS: term->dpy, atom |
|
|
1788 | CLEANUP: |
|
|
1789 | XFree (RETVAL); |
1679 | |
1790 | |
1680 | void |
1791 | void |
1681 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1792 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1682 | C_ARGS: term->display->display, window, property |
1793 | C_ARGS: term->dpy, window, property |
1683 | |
1794 | |
1684 | Window |
1795 | Window |
1685 | rxvt_term::DefaultRootWindow () |
1796 | rxvt_term::DefaultRootWindow () |
1686 | CODE: |
1797 | CODE: |
1687 | RETVAL = THIS->display->root; |
1798 | RETVAL = THIS->display->root; |
1688 | OUTPUT: |
1799 | OUTPUT: |
1689 | RETVAL |
1800 | RETVAL |
1690 | |
1801 | |
|
|
1802 | #if 0 |
|
|
1803 | |
1691 | Window |
1804 | Window |
1692 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1805 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1693 | C_ARGS: term->display->display, (Window)parent, |
1806 | C_ARGS: term->dpy, (Window)parent, |
1694 | x, y, width, height, 0, |
1807 | x, y, width, height, 0, |
1695 | term->pix_colors_focused[Color_border], |
1808 | term->pix_colors_focused[Color_border], |
1696 | term->pix_colors_focused[Color_border] |
1809 | term->pix_colors_focused[Color_border] |
1697 | |
1810 | |
|
|
1811 | #endif |
|
|
1812 | |
1698 | void |
1813 | void |
1699 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1814 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1700 | C_ARGS: term->display->display, window, parent, x, y |
1815 | C_ARGS: term->dpy, window, parent, x, y |
1701 | |
1816 | |
1702 | void |
1817 | void |
1703 | XMapWindow (rxvt_term *term, Window window) |
1818 | XMapWindow (rxvt_term *term, Window window) |
1704 | C_ARGS: term->display->display, window |
1819 | C_ARGS: term->dpy, window |
1705 | |
1820 | |
1706 | void |
1821 | void |
1707 | XUnmapWindow (rxvt_term *term, Window window) |
1822 | XUnmapWindow (rxvt_term *term, Window window) |
1708 | C_ARGS: term->display->display, window |
1823 | C_ARGS: term->dpy, window |
1709 | |
1824 | |
1710 | void |
1825 | void |
1711 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1826 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1712 | C_ARGS: term->display->display, (Window)window, x, y, width, height |
1827 | C_ARGS: term->dpy, window, x, y, width, height |
|
|
1828 | |
|
|
1829 | void |
|
|
1830 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
|
|
1831 | CODE: |
|
|
1832 | { |
|
|
1833 | XWindowAttributes attr; |
|
|
1834 | XGetWindowAttributes (THIS->dpy, window, &attr); |
|
|
1835 | XSelectInput (THIS->dpy, window, attr.your_event_mask | add_events & ~del_events); |
|
|
1836 | } |
|
|
1837 | |
|
|
1838 | void |
|
|
1839 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
|
|
1840 | PPCODE: |
|
|
1841 | { |
|
|
1842 | int dx, dy; |
|
|
1843 | Window child; |
|
|
1844 | |
|
|
1845 | if (XTranslateCoordinates (THIS->dpy, src, dst, x, y, &dx, &dy, &child)) |
|
|
1846 | { |
|
|
1847 | EXTEND (SP, 3); |
|
|
1848 | PUSHs (newSViv (dx)); |
|
|
1849 | PUSHs (newSViv (dy)); |
|
|
1850 | PUSHs (newSVuv (child)); |
|
|
1851 | } |
|
|
1852 | } |
1713 | |
1853 | |
1714 | ############################################################################# |
1854 | ############################################################################# |
1715 | # urxvt::overlay |
1855 | # urxvt::overlay |
1716 | ############################################################################# |
1856 | ############################################################################# |
1717 | |
1857 | |
… | |
… | |
1727 | overlay::hide () |
1867 | overlay::hide () |
1728 | |
1868 | |
1729 | void |
1869 | void |
1730 | overlay::DESTROY () |
1870 | overlay::DESTROY () |
1731 | |
1871 | |
1732 | ############################################################################# |
1872 | INCLUDE: $PERL <iom_perl.xs -pe s/IOM_MODULE/urxvt/g,s/IOM_CLASS/urxvt/g | |
1733 | # urxvt::watcher |
|
|
1734 | ############################################################################# |
|
|
1735 | |
1873 | |
1736 | MODULE = urxvt PACKAGE = urxvt::watcher |
|
|
1737 | |
|
|
1738 | CHAINED |
|
|
1739 | perl_watcher::cb (SV *cb) |
|
|
1740 | CODE: |
|
|
1741 | THIS->cb (cb); |
|
|
1742 | OUTPUT: |
|
|
1743 | RETVAL |
|
|
1744 | |
|
|
1745 | ############################################################################# |
|
|
1746 | # urxvt::timer |
|
|
1747 | ############################################################################# |
|
|
1748 | |
|
|
1749 | MODULE = urxvt PACKAGE = urxvt::timer |
|
|
1750 | |
|
|
1751 | SV * |
|
|
1752 | timer::new () |
|
|
1753 | CODE: |
|
|
1754 | timer *w = new timer; |
|
|
1755 | w->start (NOW); |
|
|
1756 | RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::timer"); |
|
|
1757 | w->self = (HV *)SvRV (RETVAL); |
|
|
1758 | OUTPUT: |
|
|
1759 | RETVAL |
|
|
1760 | |
|
|
1761 | NV |
|
|
1762 | timer::at () |
|
|
1763 | CODE: |
|
|
1764 | RETVAL = THIS->at; |
|
|
1765 | OUTPUT: |
|
|
1766 | RETVAL |
|
|
1767 | |
|
|
1768 | CHAINED |
|
|
1769 | timer::interval (NV interval) |
|
|
1770 | CODE: |
|
|
1771 | THIS->interval = interval; |
|
|
1772 | OUTPUT: |
|
|
1773 | RETVAL |
|
|
1774 | |
|
|
1775 | CHAINED |
|
|
1776 | timer::set (NV tstamp) |
|
|
1777 | CODE: |
|
|
1778 | THIS->set (tstamp); |
|
|
1779 | OUTPUT: |
|
|
1780 | RETVAL |
|
|
1781 | |
|
|
1782 | CHAINED |
|
|
1783 | timer::start (NV tstamp = THIS->at) |
|
|
1784 | CODE: |
|
|
1785 | THIS->start (tstamp); |
|
|
1786 | OUTPUT: |
|
|
1787 | RETVAL |
|
|
1788 | |
|
|
1789 | CHAINED |
|
|
1790 | timer::after (NV delay) |
|
|
1791 | CODE: |
|
|
1792 | THIS->start (NOW + delay); |
|
|
1793 | OUTPUT: |
|
|
1794 | RETVAL |
|
|
1795 | |
|
|
1796 | CHAINED |
|
|
1797 | timer::stop () |
|
|
1798 | CODE: |
|
|
1799 | THIS->stop (); |
|
|
1800 | OUTPUT: |
|
|
1801 | RETVAL |
|
|
1802 | |
|
|
1803 | void |
|
|
1804 | timer::DESTROY () |
|
|
1805 | |
|
|
1806 | ############################################################################# |
|
|
1807 | # urxvt::iow |
|
|
1808 | ############################################################################# |
|
|
1809 | |
|
|
1810 | MODULE = urxvt PACKAGE = urxvt::iow |
|
|
1811 | |
|
|
1812 | SV * |
|
|
1813 | iow::new () |
|
|
1814 | CODE: |
|
|
1815 | iow *w = new iow; |
|
|
1816 | RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iow"); |
|
|
1817 | w->self = (HV *)SvRV (RETVAL); |
|
|
1818 | OUTPUT: |
|
|
1819 | RETVAL |
|
|
1820 | |
|
|
1821 | CHAINED |
|
|
1822 | iow::fd (int fd) |
|
|
1823 | CODE: |
|
|
1824 | THIS->fd = fd; |
|
|
1825 | OUTPUT: |
|
|
1826 | RETVAL |
|
|
1827 | |
|
|
1828 | CHAINED |
|
|
1829 | iow::events (short events) |
|
|
1830 | CODE: |
|
|
1831 | THIS->events = events; |
|
|
1832 | OUTPUT: |
|
|
1833 | RETVAL |
|
|
1834 | |
|
|
1835 | CHAINED |
|
|
1836 | iow::start () |
|
|
1837 | CODE: |
|
|
1838 | THIS->start (); |
|
|
1839 | OUTPUT: |
|
|
1840 | RETVAL |
|
|
1841 | |
|
|
1842 | CHAINED |
|
|
1843 | iow::stop () |
|
|
1844 | CODE: |
|
|
1845 | THIS->stop (); |
|
|
1846 | OUTPUT: |
|
|
1847 | RETVAL |
|
|
1848 | |
|
|
1849 | void |
|
|
1850 | iow::DESTROY () |
|
|
1851 | |
|
|
1852 | ############################################################################# |
|
|
1853 | # urxvt::iw |
|
|
1854 | ############################################################################# |
|
|
1855 | |
|
|
1856 | MODULE = urxvt PACKAGE = urxvt::iw |
|
|
1857 | |
|
|
1858 | SV * |
|
|
1859 | iw::new () |
|
|
1860 | CODE: |
|
|
1861 | iw *w = new iw; |
|
|
1862 | RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iw"); |
|
|
1863 | w->self = (HV *)SvRV (RETVAL); |
|
|
1864 | OUTPUT: |
|
|
1865 | RETVAL |
|
|
1866 | |
|
|
1867 | CHAINED |
|
|
1868 | iw::start () |
|
|
1869 | CODE: |
|
|
1870 | THIS->start (); |
|
|
1871 | OUTPUT: |
|
|
1872 | RETVAL |
|
|
1873 | |
|
|
1874 | CHAINED |
|
|
1875 | iw::stop () |
|
|
1876 | CODE: |
|
|
1877 | THIS->stop (); |
|
|
1878 | OUTPUT: |
|
|
1879 | RETVAL |
|
|
1880 | |
|
|
1881 | void |
|
|
1882 | iw::DESTROY () |
|
|
1883 | |
|
|
1884 | ############################################################################# |
|
|
1885 | # urxvt::pw |
|
|
1886 | ############################################################################# |
|
|
1887 | |
|
|
1888 | MODULE = urxvt PACKAGE = urxvt::pw |
|
|
1889 | |
|
|
1890 | SV * |
|
|
1891 | pw::new () |
|
|
1892 | CODE: |
|
|
1893 | pw *w = new pw; |
|
|
1894 | RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::pw"); |
|
|
1895 | w->self = (HV *)SvRV (RETVAL); |
|
|
1896 | OUTPUT: |
|
|
1897 | RETVAL |
|
|
1898 | |
|
|
1899 | CHAINED |
|
|
1900 | pw::start (int pid) |
|
|
1901 | CODE: |
|
|
1902 | THIS->start (pid); |
|
|
1903 | OUTPUT: |
|
|
1904 | RETVAL |
|
|
1905 | |
|
|
1906 | CHAINED |
|
|
1907 | pw::stop () |
|
|
1908 | CODE: |
|
|
1909 | THIS->stop (); |
|
|
1910 | OUTPUT: |
|
|
1911 | RETVAL |
|
|
1912 | |
|
|
1913 | void |
|
|
1914 | pw::DESTROY () |
|
|
1915 | |
|
|
1916 | |
|
|