… | |
… | |
80 | new_ref (HV *hv, const char *klass) |
80 | new_ref (HV *hv, const char *klass) |
81 | { |
81 | { |
82 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
82 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
83 | } |
83 | } |
84 | |
84 | |
85 | //TODO: use magic |
|
|
86 | static SV * |
85 | static SV * |
87 | newSVptr (void *ptr, const char *klass) |
86 | newSVptr (void *ptr, const char *klass) |
88 | { |
87 | { |
89 | HV *hv = newHV (); |
88 | HV *hv = newHV (); |
90 | sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
89 | sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
… | |
… | |
113 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
112 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
114 | |
113 | |
115 | return (long)mg->mg_ptr; |
114 | return (long)mg->mg_ptr; |
116 | } |
115 | } |
117 | |
116 | |
118 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) |
117 | #define newSVterm(term) SvREFCNT_inc ((SV *)(term)->perl.self) |
119 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
118 | #define SvTERM(sv) (rxvt_term *)SvPTR ((sv), "urxvt::term") |
120 | |
119 | |
121 | ///////////////////////////////////////////////////////////////////////////// |
120 | ///////////////////////////////////////////////////////////////////////////// |
122 | |
121 | |
123 | #define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, "urxvt::watcher") |
122 | #define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, "urxvt::watcher") |
124 | |
123 | |
… | |
… | |
171 | |
170 | |
172 | if (SvTRUE (ERRSV)) |
171 | if (SvTRUE (ERRSV)) |
173 | rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
172 | rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
174 | } |
173 | } |
175 | |
174 | |
176 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
175 | #define newSVtimer(timer) new_ref ((timer)->self, "urxvt::timer") |
177 | #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR (sv, "urxvt::timer") |
176 | #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR ((sv), "urxvt::timer") |
178 | |
177 | |
179 | struct timer : perl_watcher, time_watcher |
178 | struct timer : perl_watcher, time_watcher |
180 | { |
179 | { |
181 | tstamp interval; |
180 | tstamp interval; |
182 | |
181 | |
… | |
… | |
192 | |
191 | |
193 | invoke ("urxvt::timer", newSVtimer (this)); |
192 | invoke ("urxvt::timer", newSVtimer (this)); |
194 | } |
193 | } |
195 | }; |
194 | }; |
196 | |
195 | |
197 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
196 | #define newSViow(iow) new_ref ((iow)->self, "urxvt::iow") |
198 | #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR (sv, "urxvt::iow") |
197 | #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR ((sv), "urxvt::iow") |
199 | |
198 | |
200 | struct iow : perl_watcher, io_watcher |
199 | struct iow : perl_watcher, io_watcher |
201 | { |
200 | { |
202 | iow () |
201 | iow () |
203 | : io_watcher (this, &iow::execute) |
202 | : io_watcher (this, &iow::execute) |
… | |
… | |
208 | { |
207 | { |
209 | invoke ("urxvt::iow", newSViow (this), revents); |
208 | invoke ("urxvt::iow", newSViow (this), revents); |
210 | } |
209 | } |
211 | }; |
210 | }; |
212 | |
211 | |
213 | #define newSViw(iw) new_ref (iw->self, "urxvt::iw") |
212 | #define newSViw(iw) new_ref ((iw)->self, "urxvt::iw") |
214 | #define SvIW(sv) (iw *)(perl_watcher *)SvPTR (sv, "urxvt::iw") |
213 | #define SvIW(sv) (iw *)(perl_watcher *)SvPTR ((sv), "urxvt::iw") |
215 | |
214 | |
216 | struct iw : perl_watcher, idle_watcher |
215 | struct iw : perl_watcher, idle_watcher |
217 | { |
216 | { |
218 | iw () |
217 | iw () |
219 | : idle_watcher (this, &iw::execute) |
218 | : idle_watcher (this, &iw::execute) |
… | |
… | |
224 | { |
223 | { |
225 | invoke ("urxvt::iw", newSViw (this)); |
224 | invoke ("urxvt::iw", newSViw (this)); |
226 | } |
225 | } |
227 | }; |
226 | }; |
228 | |
227 | |
229 | #define newSVpw(pw) new_ref (pw->self, "urxvt::pw") |
228 | #define newSVpw(pw) new_ref ((pw)->self, "urxvt::pw") |
230 | #define SvPW(sv) (pw *)(perl_watcher *)SvPTR (sv, "urxvt::pw") |
229 | #define SvPW(sv) (pw *)(perl_watcher *)SvPTR ((sv), "urxvt::pw") |
231 | |
230 | |
232 | struct pw : perl_watcher, child_watcher |
231 | struct pw : perl_watcher, child_watcher |
233 | { |
232 | { |
234 | pw () |
233 | pw () |
235 | : child_watcher (this, &pw::execute) |
234 | : child_watcher (this, &pw::execute) |
… | |
… | |
244 | |
243 | |
245 | ///////////////////////////////////////////////////////////////////////////// |
244 | ///////////////////////////////////////////////////////////////////////////// |
246 | |
245 | |
247 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
246 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
248 | |
247 | |
249 | struct overlay { |
248 | class overlay { |
250 | HV *self; |
|
|
251 | bool visible; |
|
|
252 | rxvt_term *THIS; |
249 | rxvt_term *THIS; |
|
|
250 | AV *overlay_av; |
253 | int x, y, w, h; |
251 | int x, y, w, h; |
254 | int border; |
252 | int border; |
255 | text_t **text; |
253 | text_t **text; |
256 | rend_t **rend; |
254 | rend_t **rend; |
257 | |
255 | |
|
|
256 | public: |
|
|
257 | HV *self; |
|
|
258 | |
258 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
259 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
259 | ~overlay (); |
260 | ~overlay (); |
260 | |
261 | |
261 | void show (); |
262 | void show (); |
262 | void hide (); |
263 | void hide (); |
… | |
… | |
265 | |
266 | |
266 | void set (int x, int y, SV *str, SV *rend); |
267 | void set (int x, int y, SV *str, SV *rend); |
267 | }; |
268 | }; |
268 | |
269 | |
269 | overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) |
270 | 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) |
271 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0) |
271 | { |
272 | { |
272 | if (border == 2) |
273 | if (border == 2) |
273 | { |
274 | { |
274 | w += 2; |
275 | w += 2; |
275 | h += 2; |
276 | h += 2; |
… | |
… | |
314 | *rp++ = r; |
315 | *rp++ = r; |
315 | } |
316 | } |
316 | } |
317 | } |
317 | |
318 | |
318 | show (); |
319 | show (); |
319 | THIS->want_refresh = 1; |
|
|
320 | } |
320 | } |
321 | |
321 | |
322 | overlay::~overlay () |
322 | overlay::~overlay () |
323 | { |
323 | { |
324 | hide (); |
324 | hide (); |
… | |
… | |
329 | delete [] rend[y]; |
329 | delete [] rend[y]; |
330 | } |
330 | } |
331 | |
331 | |
332 | delete [] text; |
332 | delete [] text; |
333 | delete [] rend; |
333 | delete [] rend; |
|
|
334 | } |
|
|
335 | |
|
|
336 | void |
|
|
337 | overlay::show () |
|
|
338 | { |
|
|
339 | if (overlay_av) |
|
|
340 | return; |
|
|
341 | |
|
|
342 | overlay_av = (AV *)SvREFCNT_inc (SvRV ( |
|
|
343 | *hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0) |
|
|
344 | )); |
|
|
345 | av_push (overlay_av, newSViv ((long)this)); |
334 | |
346 | |
335 | THIS->want_refresh = 1; |
347 | THIS->want_refresh = 1; |
336 | } |
348 | } |
337 | |
349 | |
338 | void |
350 | void |
339 | overlay::show () |
351 | overlay::hide () |
340 | { |
352 | { |
341 | if (visible) |
353 | if (!overlay_av) |
342 | return; |
354 | return; |
343 | |
355 | |
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; |
356 | int i; |
361 | |
357 | |
362 | for (i = AvFILL (av); i >= 0; i--) |
358 | for (i = AvFILL (overlay_av); i >= 0; i--) |
363 | if (SvIV (*av_fetch (av, i, 1)) == (long)this) |
359 | if (SvIV (*av_fetch (overlay_av, i, 1)) == (long)this) |
364 | { |
360 | { |
365 | av_delete (av, i, G_DISCARD); |
361 | av_delete (overlay_av, i, G_DISCARD); |
366 | break; |
362 | break; |
367 | } |
363 | } |
368 | |
364 | |
369 | for (; i < AvFILL (av); i++) |
365 | for (; i < AvFILL (overlay_av); i++) |
370 | av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0))); |
366 | av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0))); |
371 | |
367 | |
372 | av_pop (av); |
368 | av_pop (overlay_av); |
|
|
369 | |
|
|
370 | SvREFCNT_dec (overlay_av); |
|
|
371 | overlay_av = 0; |
|
|
372 | |
|
|
373 | THIS->want_refresh = 1; |
373 | } |
374 | } |
374 | |
375 | |
375 | void overlay::swap () |
376 | void overlay::swap () |
376 | { |
377 | { |
377 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
378 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
… | |
… | |
492 | static void |
493 | static void |
493 | ungrab (rxvt_term *THIS) |
494 | ungrab (rxvt_term *THIS) |
494 | { |
495 | { |
495 | if (THIS->perl.grabtime) |
496 | if (THIS->perl.grabtime) |
496 | { |
497 | { |
497 | XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); |
498 | XUngrabKeyboard (THIS->dpy, THIS->perl.grabtime); |
498 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
499 | XUngrabPointer (THIS->dpy, THIS->perl.grabtime); |
499 | THIS->perl.grabtime = 0; |
500 | THIS->perl.grabtime = 0; |
500 | } |
501 | } |
501 | } |
502 | } |
502 | |
503 | |
503 | bool |
504 | bool |
… | |
… | |
556 | case DT_STR_LEN: |
557 | case DT_STR_LEN: |
557 | { |
558 | { |
558 | char *str = va_arg (ap, char *); |
559 | char *str = va_arg (ap, char *); |
559 | int len = va_arg (ap, int); |
560 | int len = va_arg (ap, int); |
560 | |
561 | |
561 | printf ("pushing str %p:%d\n", str,len);//D |
|
|
562 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
562 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
563 | } |
563 | } |
564 | break; |
564 | break; |
565 | |
565 | |
566 | case DT_WCS_LEN: |
566 | case DT_WCS_LEN: |
… | |
… | |
762 | # include "optinc.h" |
762 | # include "optinc.h" |
763 | # undef nodef |
763 | # undef nodef |
764 | # undef def |
764 | # undef def |
765 | |
765 | |
766 | HV *stash = gv_stashpv ("urxvt", 1); |
766 | HV *stash = gv_stashpv ("urxvt", 1); |
767 | struct { |
767 | static const struct { |
768 | const char *name; |
768 | const char *name; |
769 | IV iv; |
769 | IV iv; |
770 | } *civ, const_iv[] = { |
770 | } *civ, const_iv[] = { |
771 | # define const_iv(name) { # name, (IV)name } |
771 | # define const_iv(name) { # name, (IV)name } |
772 | const_iv (DEFAULT_RSTYLE), |
772 | const_iv (DEFAULT_RSTYLE), |
… | |
… | |
882 | const_iv (XIMDontChange), |
882 | const_iv (XIMDontChange), |
883 | # endif |
883 | # endif |
884 | # endif |
884 | # endif |
885 | }; |
885 | }; |
886 | |
886 | |
887 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
887 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
888 | civ-- > const_iv; ) |
|
|
889 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
888 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
890 | } |
889 | } |
891 | |
890 | |
892 | void |
891 | void |
893 | warn (const char *msg) |
892 | warn (const char *msg) |
… | |
… | |
924 | RETVAL |
923 | RETVAL |
925 | |
924 | |
926 | int |
925 | int |
927 | SET_FGCOLOR (int rend, int new_color) |
926 | SET_FGCOLOR (int rend, int new_color) |
928 | CODE: |
927 | CODE: |
929 | RETVAL = SET_FGCOLOR (rend, new_color); |
928 | RETVAL = SET_FGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
930 | OUTPUT: |
929 | OUTPUT: |
931 | RETVAL |
930 | RETVAL |
932 | |
931 | |
933 | int |
932 | int |
934 | SET_BGCOLOR (int rend, int new_color) |
933 | SET_BGCOLOR (int rend, int new_color) |
935 | CODE: |
934 | CODE: |
936 | RETVAL = SET_BGCOLOR (rend, new_color); |
935 | RETVAL = SET_BGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
937 | OUTPUT: |
936 | OUTPUT: |
938 | RETVAL |
937 | RETVAL |
939 | |
938 | |
940 | int |
939 | int |
941 | GET_CUSTOM (int rend) |
940 | GET_CUSTOM (int rend) |
… | |
… | |
955 | | ((new_value << RS_customShift) & RS_customMask); |
954 | | ((new_value << RS_customShift) & RS_customMask); |
956 | } |
955 | } |
957 | OUTPUT: |
956 | OUTPUT: |
958 | RETVAL |
957 | RETVAL |
959 | |
958 | |
|
|
959 | void |
|
|
960 | termlist () |
|
|
961 | PPCODE: |
|
|
962 | { |
|
|
963 | EXTEND (SP, rxvt_term::termlist.size ()); |
|
|
964 | |
|
|
965 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
|
|
966 | if ((*t)->perl.self) |
|
|
967 | PUSHs (sv_2mortal (newSVterm (*t))); |
|
|
968 | } |
|
|
969 | |
960 | MODULE = urxvt PACKAGE = urxvt::term |
970 | MODULE = urxvt PACKAGE = urxvt::term |
961 | |
971 | |
962 | SV * |
972 | SV * |
963 | _new (...) |
973 | _new (AV *env, AV *arg) |
964 | CODE: |
974 | CODE: |
965 | { |
975 | { |
966 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
|
|
967 | croak ("first argument to urxvt::term->_new must be arrayref"); |
|
|
968 | |
|
|
969 | rxvt_term *term = new rxvt_term; |
976 | rxvt_term *term = new rxvt_term; |
970 | |
977 | |
971 | stringvec *argv = new stringvec; |
978 | stringvec *argv = new stringvec; |
972 | stringvec *envv = new stringvec; |
979 | stringvec *envv = new stringvec; |
973 | |
980 | |
974 | for (int i = 1; i < items; i++) |
981 | for (int i = 0; i <= AvFILL (arg); i++) |
975 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
982 | argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1)))); |
976 | |
983 | |
977 | AV *env = (AV *)SvRV (ST (0)); |
|
|
978 | for (int i = AvFILL (env) + 1; i--; ) |
984 | for (int i = AvFILL (env) + 1; i--; ) |
979 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
985 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
980 | |
986 | |
981 | envv->push_back (0); |
987 | envv->push_back (0); |
982 | |
988 | |
… | |
… | |
1010 | rxvt_term::set_should_invoke (int htype, int inc) |
1016 | rxvt_term::set_should_invoke (int htype, int inc) |
1011 | CODE: |
1017 | CODE: |
1012 | THIS->perl.should_invoke [htype] += inc; |
1018 | THIS->perl.should_invoke [htype] += inc; |
1013 | |
1019 | |
1014 | void |
1020 | void |
1015 | rxvt_term::grab_button (int button, U32 modifiers) |
1021 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
1016 | CODE: |
1022 | CODE: |
1017 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
1023 | XGrabButton (THIS->dpy, button, modifiers, window, 1, |
1018 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1024 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1019 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
1025 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
1020 | |
1026 | |
|
|
1027 | void |
|
|
1028 | rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt) |
|
|
1029 | CODE: |
|
|
1030 | XUngrabButton (THIS->dpy, button, modifiers, window); |
|
|
1031 | |
|
|
1032 | #if 0 |
|
|
1033 | |
|
|
1034 | void |
|
|
1035 | XGrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) |
|
|
1036 | C_ARGS: |
|
|
1037 | THIS->dpy, keycode, modifiers, window, 1, |
|
|
1038 | GrabModeSync, GrabModeSync |
|
|
1039 | |
|
|
1040 | void |
|
|
1041 | XUngrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) |
|
|
1042 | C_ARGS: THIS->dpy, keycode, modifiers, window |
|
|
1043 | |
|
|
1044 | #endif |
|
|
1045 | |
1021 | bool |
1046 | bool |
1022 | rxvt_term::grab (Time eventtime, int sync = 0) |
1047 | rxvt_term::grab (Time eventtime, int sync = 0) |
1023 | CODE: |
1048 | CODE: |
1024 | { |
1049 | { |
1025 | int mode = sync ? GrabModeSync : GrabModeAsync; |
1050 | int mode = sync ? GrabModeSync : GrabModeAsync; |
1026 | |
1051 | |
1027 | THIS->perl.grabtime = 0; |
1052 | THIS->perl.grabtime = 0; |
1028 | |
1053 | |
1029 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
1054 | if (!XGrabPointer (THIS->dpy, THIS->vt, 0, |
1030 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1055 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1031 | mode, mode, None, GRAB_CURSOR, eventtime)) |
1056 | mode, mode, None, GRAB_CURSOR, eventtime)) |
1032 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
1057 | if (!XGrabKeyboard (THIS->dpy, THIS->vt, 0, mode, mode, eventtime)) |
1033 | THIS->perl.grabtime = eventtime; |
1058 | THIS->perl.grabtime = eventtime; |
1034 | else |
1059 | else |
1035 | XUngrabPointer (THIS->display->display, eventtime); |
1060 | XUngrabPointer (THIS->dpy, eventtime); |
1036 | |
1061 | |
1037 | RETVAL = !!THIS->perl.grabtime; |
1062 | RETVAL = !!THIS->perl.grabtime; |
1038 | } |
1063 | } |
1039 | OUTPUT: |
1064 | OUTPUT: |
1040 | RETVAL |
1065 | RETVAL |
1041 | |
1066 | |
1042 | void |
1067 | void |
1043 | rxvt_term::allow_events_async () |
1068 | rxvt_term::allow_events_async () |
1044 | CODE: |
1069 | CODE: |
1045 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
1070 | XAllowEvents (THIS->dpy, AsyncBoth, THIS->perl.grabtime); |
1046 | |
1071 | |
1047 | void |
1072 | void |
1048 | rxvt_term::allow_events_sync () |
1073 | rxvt_term::allow_events_sync () |
1049 | CODE: |
1074 | CODE: |
1050 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
1075 | XAllowEvents (THIS->dpy, SyncBoth, THIS->perl.grabtime); |
1051 | |
1076 | |
1052 | void |
1077 | void |
1053 | rxvt_term::allow_events_replay () |
1078 | rxvt_term::allow_events_replay () |
1054 | CODE: |
1079 | CODE: |
1055 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
1080 | XAllowEvents (THIS->dpy, ReplayPointer, THIS->perl.grabtime); |
1056 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
1081 | XAllowEvents (THIS->dpy, ReplayKeyboard, THIS->perl.grabtime); |
1057 | |
1082 | |
1058 | void |
1083 | void |
1059 | rxvt_term::ungrab () |
1084 | rxvt_term::ungrab () |
1060 | CODE: |
1085 | CODE: |
1061 | ungrab (THIS); |
1086 | ungrab (THIS); |
… | |
… | |
1184 | } |
1209 | } |
1185 | OUTPUT: |
1210 | OUTPUT: |
1186 | RETVAL |
1211 | RETVAL |
1187 | |
1212 | |
1188 | SV * |
1213 | SV * |
1189 | rxvt_term::_env () |
1214 | rxvt_term::envv () |
|
|
1215 | ALIAS: |
|
|
1216 | argv = 1 |
1190 | CODE: |
1217 | PPCODE: |
1191 | { |
1218 | { |
1192 | if (THIS->envv) |
1219 | stringvec *vec = ix ? THIS->argv : THIS->envv; |
1193 | { |
|
|
1194 | AV *av = newAV (); |
|
|
1195 | |
1220 | |
|
|
1221 | EXTEND (SP, vec->size ()); |
|
|
1222 | |
1196 | for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i) |
1223 | for (char **i = vec->begin (); i != vec->end (); ++i) |
1197 | if (*i) |
1224 | if (*i) |
1198 | av_push (av, newSVpv (*i, 0)); |
1225 | PUSHs (sv_2mortal (newSVpv (*i, 0))); |
1199 | |
|
|
1200 | RETVAL = newRV_noinc ((SV *)av); |
|
|
1201 | } |
|
|
1202 | else |
|
|
1203 | RETVAL = &PL_sv_undef; |
|
|
1204 | } |
1226 | } |
1205 | OUTPUT: |
|
|
1206 | RETVAL |
|
|
1207 | |
1227 | |
1208 | int |
1228 | int |
1209 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1229 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1210 | CODE: |
1230 | CODE: |
1211 | RETVAL = THIS->pty_ev.events; |
1231 | RETVAL = THIS->pty_ev.events; |
… | |
… | |
1265 | void |
1285 | void |
1266 | rxvt_term::focus_in () |
1286 | rxvt_term::focus_in () |
1267 | |
1287 | |
1268 | void |
1288 | void |
1269 | rxvt_term::focus_out () |
1289 | rxvt_term::focus_out () |
|
|
1290 | |
|
|
1291 | void |
|
|
1292 | rxvt_term::key_press (unsigned int state, unsigned int keycode, Time time = CurrentTime) |
|
|
1293 | ALIAS: |
|
|
1294 | key_release = 1 |
|
|
1295 | CODE: |
|
|
1296 | { |
|
|
1297 | XKeyEvent xkey; |
|
|
1298 | |
|
|
1299 | memset (&xkey, 0, sizeof (xkey)); |
|
|
1300 | |
|
|
1301 | xkey.time = time; |
|
|
1302 | xkey.state = state; |
|
|
1303 | xkey.keycode = keycode; |
|
|
1304 | |
|
|
1305 | xkey.type = ix ? KeyRelease : KeyPress; |
|
|
1306 | xkey.display = THIS->dpy; |
|
|
1307 | xkey.window = THIS->vt; |
|
|
1308 | xkey.root = THIS->display->root; |
|
|
1309 | xkey.subwindow = THIS->vt; |
|
|
1310 | |
|
|
1311 | if (ix) |
|
|
1312 | THIS->key_release (xkey); |
|
|
1313 | else |
|
|
1314 | THIS->key_press (xkey); |
|
|
1315 | } |
1270 | |
1316 | |
1271 | void |
1317 | void |
1272 | rxvt_term::want_refresh () |
1318 | rxvt_term::want_refresh () |
1273 | CODE: |
1319 | CODE: |
1274 | THIS->want_refresh = 1; |
1320 | THIS->want_refresh = 1; |
… | |
… | |
1467 | |
1513 | |
1468 | void |
1514 | void |
1469 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1515 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1470 | PPCODE: |
1516 | PPCODE: |
1471 | { |
1517 | { |
1472 | struct resval { const char *name; int value; } rslist [] = { |
1518 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1473 | # define def(name) { # name, Rs_ ## name }, |
1519 | # define def(name) { # name, Rs_ ## name }, |
1474 | # define reserve(name,count) |
1520 | # define reserve(name,count) |
1475 | # include "rsinc.h" |
1521 | # include "rsinc.h" |
1476 | # undef def |
1522 | # undef def |
1477 | # undef reserve |
1523 | # undef reserve |
1478 | }; |
1524 | }; |
1479 | |
1525 | |
1480 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1526 | rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1481 | |
1527 | |
1482 | do { |
1528 | do { |
1483 | if (rs-- == rslist) |
1529 | if (rs-- == rslist) |
1484 | croak ("no such resource '%s', requested", name); |
1530 | croak ("no such resource '%s', requested", name); |
1485 | } while (strcmp (name, rs->name)); |
1531 | } while (strcmp (name, rs->name)); |
… | |
… | |
1609 | CODE: |
1655 | CODE: |
1610 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1656 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1611 | OUTPUT: |
1657 | OUTPUT: |
1612 | RETVAL |
1658 | RETVAL |
1613 | |
1659 | |
1614 | #void |
1660 | void |
1615 | #rxvt_term::selection_clear () |
1661 | rxvt_term::selection_clear () |
1616 | |
1662 | |
1617 | void |
1663 | void |
1618 | rxvt_term::selection_make (Time eventtime, bool rect = false) |
1664 | rxvt_term::selection_make (Time eventtime, bool rect = false) |
1619 | CODE: |
1665 | CODE: |
1620 | THIS->selection.op = SELECTION_CONT; |
1666 | THIS->selection.op = SELECTION_CONT; |
… | |
… | |
1710 | void |
1756 | void |
1711 | rxvt_term::XListProperties (Window window) |
1757 | rxvt_term::XListProperties (Window window) |
1712 | PPCODE: |
1758 | PPCODE: |
1713 | { |
1759 | { |
1714 | int count; |
1760 | int count; |
1715 | Atom *props = XListProperties (THIS->display->display, window, &count); |
1761 | Atom *props = XListProperties (THIS->dpy, window, &count); |
1716 | |
1762 | |
1717 | EXTEND (SP, count); |
1763 | EXTEND (SP, count); |
1718 | while (count--) |
1764 | while (count--) |
1719 | PUSHs (newSVuv ((U32)props [count])); |
1765 | PUSHs (newSVuv ((U32)props [count])); |
1720 | |
1766 | |
… | |
… | |
1729 | int format; |
1775 | int format; |
1730 | unsigned long nitems; |
1776 | unsigned long nitems; |
1731 | unsigned long bytes_after; |
1777 | unsigned long bytes_after; |
1732 | unsigned char *prop; |
1778 | unsigned char *prop; |
1733 | |
1779 | |
1734 | XGetWindowProperty (THIS->display->display, window, property, |
1780 | XGetWindowProperty (THIS->dpy, window, property, |
1735 | 0, 1<<24, 0, AnyPropertyType, |
1781 | 0, 1<<24, 0, AnyPropertyType, |
1736 | &type, &format, &nitems, &bytes_after, &prop); |
1782 | &type, &format, &nitems, &bytes_after, &prop); |
1737 | |
1783 | |
1738 | if (type != None) |
1784 | if (type != None) |
1739 | { |
1785 | { |
… | |
… | |
1758 | |
1804 | |
1759 | int elemsize = format == 16 ? sizeof (short) |
1805 | int elemsize = format == 16 ? sizeof (short) |
1760 | : format == 32 ? sizeof (long) |
1806 | : format == 32 ? sizeof (long) |
1761 | : 1; |
1807 | : 1; |
1762 | |
1808 | |
1763 | XChangeProperty (THIS->display->display, window, property, |
1809 | XChangeProperty (THIS->dpy, window, property, |
1764 | type, format, PropModeReplace, |
1810 | type, format, PropModeReplace, |
1765 | (unsigned char *)data_, len / elemsize); |
1811 | (unsigned char *)data_, len / elemsize); |
1766 | XSync (THIS->display->display, 0); |
|
|
1767 | } |
1812 | } |
1768 | |
1813 | |
1769 | Atom |
1814 | Atom |
1770 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
1815 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
1771 | C_ARGS: term->display->display, atom_name, only_if_exists |
1816 | C_ARGS: term->dpy, atom_name, only_if_exists |
1772 | |
1817 | |
1773 | char * |
1818 | char * |
1774 | XGetAtomName (rxvt_term *term, Atom atom) |
1819 | XGetAtomName (rxvt_term *term, Atom atom) |
1775 | C_ARGS: term->display->display, atom |
1820 | C_ARGS: term->dpy, atom |
1776 | CLEANUP: |
1821 | CLEANUP: |
1777 | XFree (RETVAL); |
1822 | XFree (RETVAL); |
1778 | |
1823 | |
1779 | void |
1824 | void |
1780 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1825 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1781 | C_ARGS: term->display->display, window, property |
1826 | C_ARGS: term->dpy, window, property |
1782 | |
1827 | |
1783 | Window |
1828 | Window |
1784 | rxvt_term::DefaultRootWindow () |
1829 | rxvt_term::DefaultRootWindow () |
1785 | CODE: |
1830 | CODE: |
1786 | RETVAL = THIS->display->root; |
1831 | RETVAL = THIS->display->root; |
… | |
… | |
1789 | |
1834 | |
1790 | #if 0 |
1835 | #if 0 |
1791 | |
1836 | |
1792 | Window |
1837 | Window |
1793 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1838 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1794 | C_ARGS: term->display->display, (Window)parent, |
1839 | C_ARGS: term->dpy, (Window)parent, |
1795 | x, y, width, height, 0, |
1840 | x, y, width, height, 0, |
1796 | term->pix_colors_focused[Color_border], |
1841 | term->pix_colors_focused[Color_border], |
1797 | term->pix_colors_focused[Color_border] |
1842 | term->pix_colors_focused[Color_border] |
1798 | |
1843 | |
1799 | #endif |
1844 | #endif |
1800 | |
1845 | |
1801 | void |
1846 | void |
1802 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1847 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1803 | C_ARGS: term->display->display, window, parent, x, y |
1848 | C_ARGS: term->dpy, window, parent, x, y |
1804 | |
1849 | |
1805 | void |
1850 | void |
1806 | XMapWindow (rxvt_term *term, Window window) |
1851 | XMapWindow (rxvt_term *term, Window window) |
1807 | C_ARGS: term->display->display, window |
1852 | C_ARGS: term->dpy, window |
1808 | |
1853 | |
1809 | void |
1854 | void |
1810 | XUnmapWindow (rxvt_term *term, Window window) |
1855 | XUnmapWindow (rxvt_term *term, Window window) |
1811 | C_ARGS: term->display->display, window |
1856 | C_ARGS: term->dpy, window |
1812 | |
1857 | |
1813 | void |
1858 | void |
1814 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1859 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1815 | C_ARGS: term->display->display, window, x, y, width, height |
1860 | C_ARGS: term->dpy, window, x, y, width, height |
1816 | |
1861 | |
1817 | void |
1862 | void |
1818 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
1863 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
1819 | CODE: |
1864 | CODE: |
1820 | { |
1865 | { |
1821 | XWindowAttributes attr; |
1866 | XWindowAttributes attr; |
1822 | XGetWindowAttributes (THIS->display->display, window, &attr); |
1867 | XGetWindowAttributes (THIS->dpy, window, &attr); |
1823 | XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events); |
1868 | XSelectInput (THIS->dpy, window, attr.your_event_mask | add_events & ~del_events); |
1824 | } |
1869 | } |
1825 | |
1870 | |
1826 | void |
1871 | void |
1827 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
1872 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
1828 | PPCODE: |
1873 | PPCODE: |
1829 | { |
1874 | { |
1830 | int dx, dy; |
1875 | int dx, dy; |
1831 | Window child; |
1876 | Window child; |
1832 | |
1877 | |
1833 | if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child)) |
1878 | if (XTranslateCoordinates (THIS->dpy, src, dst, x, y, &dx, &dy, &child)) |
1834 | { |
1879 | { |
1835 | EXTEND (SP, 3); |
1880 | EXTEND (SP, 3); |
1836 | PUSHs (newSViv (dx)); |
1881 | PUSHs (newSViv (dx)); |
1837 | PUSHs (newSViv (dy)); |
1882 | PUSHs (newSViv (dy)); |
1838 | PUSHs (newSVuv (child)); |
1883 | PUSHs (newSVuv (child)); |