… | |
… | |
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 | { |
|
|
365 | av_delete (av, i, G_DISCARD); |
|
|
366 | break; |
360 | break; |
367 | } |
|
|
368 | |
361 | |
369 | for (; i < AvFILL (av); i++) |
362 | for (; i < AvFILL (overlay_av); i++) |
370 | av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0))); |
363 | av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0))); |
371 | |
364 | |
372 | av_pop (av); |
365 | av_pop (overlay_av); |
|
|
366 | |
|
|
367 | SvREFCNT_dec (overlay_av); |
|
|
368 | overlay_av = 0; |
|
|
369 | |
|
|
370 | THIS->want_refresh = 1; |
373 | } |
371 | } |
374 | |
372 | |
375 | void overlay::swap () |
373 | void overlay::swap () |
376 | { |
374 | { |
377 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
375 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
… | |
… | |
492 | static void |
490 | static void |
493 | ungrab (rxvt_term *THIS) |
491 | ungrab (rxvt_term *THIS) |
494 | { |
492 | { |
495 | if (THIS->perl.grabtime) |
493 | if (THIS->perl.grabtime) |
496 | { |
494 | { |
497 | XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); |
495 | XUngrabKeyboard (THIS->dpy, THIS->perl.grabtime); |
498 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
496 | XUngrabPointer (THIS->dpy, THIS->perl.grabtime); |
499 | THIS->perl.grabtime = 0; |
497 | THIS->perl.grabtime = 0; |
500 | } |
498 | } |
501 | } |
499 | } |
502 | |
500 | |
503 | bool |
501 | bool |
… | |
… | |
554 | break; |
552 | break; |
555 | |
553 | |
556 | case DT_STR_LEN: |
554 | case DT_STR_LEN: |
557 | { |
555 | { |
558 | char *str = va_arg (ap, char *); |
556 | char *str = va_arg (ap, char *); |
559 | int len = va_arg (ap, int); |
557 | int len = va_arg (ap, int); |
560 | |
558 | |
561 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
559 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
562 | } |
560 | } |
563 | break; |
561 | break; |
564 | |
562 | |
565 | case DT_WCS_LEN: |
563 | case DT_WCS_LEN: |
566 | { |
564 | { |
567 | wchar_t *wstr = va_arg (ap, wchar_t *); |
565 | wchar_t *wstr = va_arg (ap, wchar_t *); |
568 | int wlen = va_arg (ap, int); |
566 | int wlen = va_arg (ap, int); |
569 | |
567 | |
570 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
568 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
|
|
569 | } |
|
|
570 | break; |
|
|
571 | |
|
|
572 | case DT_LCS_LEN: |
|
|
573 | { |
|
|
574 | long *lstr = va_arg (ap, long *); |
|
|
575 | int llen = va_arg (ap, int); |
|
|
576 | |
|
|
577 | XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long)))); |
571 | } |
578 | } |
572 | break; |
579 | break; |
573 | |
580 | |
574 | case DT_XEVENT: |
581 | case DT_XEVENT: |
575 | { |
582 | { |
576 | XEvent *xe = va_arg (ap, XEvent *); |
583 | XEvent *xe = va_arg (ap, XEvent *); |
577 | HV *hv = newHV (); |
584 | HV *hv = newHV (); |
578 | |
585 | |
579 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
586 | # 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) |
587 | # 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) |
588 | # define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) |
582 | # undef set |
589 | # undef set |
583 | |
590 | |
584 | setiv (type, xe->type); |
591 | setiv (type, xe->type); |
585 | setiv (send_event, xe->xany.send_event); |
592 | setiv (send_event, xe->xany.send_event); |
586 | setiv (serial, xe->xany.serial); |
593 | setiv (serial, xe->xany.serial); |
587 | |
594 | |
… | |
… | |
716 | } |
723 | } |
717 | else if (htype == HOOK_DESTROY) |
724 | else if (htype == HOOK_DESTROY) |
718 | { |
725 | { |
719 | clearSVptr ((SV *)term->perl.self); |
726 | clearSVptr ((SV *)term->perl.self); |
720 | SvREFCNT_dec ((SV *)term->perl.self); |
727 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
728 | |
|
|
729 | // don't allow further calls |
|
|
730 | term->perl.self = 0; |
721 | } |
731 | } |
722 | |
732 | |
723 | swap (perl_environ, environ); |
733 | swap (perl_environ, environ); |
724 | |
734 | |
725 | return event_consumed; |
735 | return event_consumed; |
… | |
… | |
749 | # include "optinc.h" |
759 | # include "optinc.h" |
750 | # undef nodef |
760 | # undef nodef |
751 | # undef def |
761 | # undef def |
752 | |
762 | |
753 | HV *stash = gv_stashpv ("urxvt", 1); |
763 | HV *stash = gv_stashpv ("urxvt", 1); |
754 | struct { |
764 | static const struct { |
755 | const char *name; |
765 | const char *name; |
756 | IV iv; |
766 | IV iv; |
757 | } *civ, const_iv[] = { |
767 | } *civ, const_iv[] = { |
758 | # define const_iv(name) { # name, (IV)name } |
768 | # define const_iv(name) { # name, (IV)name } |
759 | const_iv (DEFAULT_RSTYLE), |
769 | const_iv (DEFAULT_RSTYLE), |
… | |
… | |
842 | const_iv (SelectionRequest), |
852 | const_iv (SelectionRequest), |
843 | const_iv (SelectionNotify), |
853 | const_iv (SelectionNotify), |
844 | const_iv (ColormapNotify), |
854 | const_iv (ColormapNotify), |
845 | const_iv (ClientMessage), |
855 | const_iv (ClientMessage), |
846 | const_iv (MappingNotify), |
856 | const_iv (MappingNotify), |
|
|
857 | # if ENABLE_XIM_ONTHESPOT |
|
|
858 | const_iv (XIMReverse), |
|
|
859 | const_iv (XIMUnderline), |
|
|
860 | const_iv (XIMHighlight), |
|
|
861 | const_iv (XIMPrimary), |
|
|
862 | const_iv (XIMSecondary), |
|
|
863 | const_iv (XIMTertiary), |
|
|
864 | const_iv (XIMVisibleToForward), |
|
|
865 | const_iv (XIMVisibleToBackword), |
|
|
866 | const_iv (XIMVisibleToCenter), |
|
|
867 | # if 0 |
|
|
868 | const_iv (XIMForwardChar), |
|
|
869 | const_iv (XIMBackwardChar), |
|
|
870 | const_iv (XIMForwardWord), |
|
|
871 | const_iv (XIMBackwardWord), |
|
|
872 | const_iv (XIMCaretUp), |
|
|
873 | const_iv (XIMCaretDown), |
|
|
874 | const_iv (XIMNextLine), |
|
|
875 | const_iv (XIMPreviousLine), |
|
|
876 | const_iv (XIMLineStart), |
|
|
877 | const_iv (XIMLineEnd), |
|
|
878 | const_iv (XIMAbsolutePosition), |
|
|
879 | const_iv (XIMDontChange), |
|
|
880 | # endif |
|
|
881 | # endif |
847 | }; |
882 | }; |
848 | |
883 | |
849 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
884 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
850 | civ-- > const_iv; ) |
|
|
851 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
885 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
852 | } |
886 | } |
853 | |
887 | |
854 | void |
888 | void |
855 | warn (const char *msg) |
889 | warn (const char *msg) |
… | |
… | |
886 | RETVAL |
920 | RETVAL |
887 | |
921 | |
888 | int |
922 | int |
889 | SET_FGCOLOR (int rend, int new_color) |
923 | SET_FGCOLOR (int rend, int new_color) |
890 | CODE: |
924 | CODE: |
891 | RETVAL = SET_FGCOLOR (rend, new_color); |
925 | RETVAL = SET_FGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
892 | OUTPUT: |
926 | OUTPUT: |
893 | RETVAL |
927 | RETVAL |
894 | |
928 | |
895 | int |
929 | int |
896 | SET_BGCOLOR (int rend, int new_color) |
930 | SET_BGCOLOR (int rend, int new_color) |
897 | CODE: |
931 | CODE: |
898 | RETVAL = SET_BGCOLOR (rend, new_color); |
932 | RETVAL = SET_BGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
899 | OUTPUT: |
933 | OUTPUT: |
900 | RETVAL |
934 | RETVAL |
901 | |
935 | |
902 | int |
936 | int |
903 | GET_CUSTOM (int rend) |
937 | GET_CUSTOM (int rend) |
… | |
… | |
917 | | ((new_value << RS_customShift) & RS_customMask); |
951 | | ((new_value << RS_customShift) & RS_customMask); |
918 | } |
952 | } |
919 | OUTPUT: |
953 | OUTPUT: |
920 | RETVAL |
954 | RETVAL |
921 | |
955 | |
|
|
956 | void |
|
|
957 | termlist () |
|
|
958 | PPCODE: |
|
|
959 | { |
|
|
960 | EXTEND (SP, rxvt_term::termlist.size ()); |
|
|
961 | |
|
|
962 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
|
|
963 | if ((*t)->perl.self) |
|
|
964 | PUSHs (sv_2mortal (newSVterm (*t))); |
|
|
965 | } |
|
|
966 | |
922 | MODULE = urxvt PACKAGE = urxvt::term |
967 | MODULE = urxvt PACKAGE = urxvt::term |
923 | |
968 | |
924 | SV * |
969 | SV * |
925 | _new (...) |
970 | _new (AV *env, AV *arg) |
926 | CODE: |
971 | CODE: |
927 | { |
972 | { |
928 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
|
|
929 | croak ("first argument to urxvt::term->_new must be arrayref"); |
|
|
930 | |
|
|
931 | rxvt_term *term = new rxvt_term; |
973 | rxvt_term *term = new rxvt_term; |
932 | |
974 | |
933 | term->argv = new stringvec; |
975 | stringvec *argv = new stringvec; |
934 | term->envv = new stringvec; |
976 | stringvec *envv = new stringvec; |
935 | |
977 | |
936 | for (int i = 1; i < items; i++) |
978 | for (int i = 0; i <= AvFILL (arg); i++) |
937 | term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
979 | argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1)))); |
938 | |
980 | |
939 | AV *envv = (AV *)SvRV (ST (0)); |
|
|
940 | for (int i = AvFILL (envv) + 1; i--; ) |
981 | for (int i = AvFILL (env) + 1; i--; ) |
941 | term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); |
982 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
942 | |
983 | |
943 | term->envv->push_back (0); |
984 | envv->push_back (0); |
944 | |
985 | |
945 | bool success; |
986 | bool success; |
946 | |
987 | |
947 | try |
988 | try |
948 | { |
989 | { |
949 | success = term->init (term->argv->size (), term->argv->begin ()); |
990 | success = term->init (argv, envv); |
950 | } |
991 | } |
951 | catch (const class rxvt_failure_exception &e) |
992 | catch (const class rxvt_failure_exception &e) |
952 | { |
993 | { |
953 | success = false; |
994 | success = false; |
954 | } |
995 | } |
… | |
… | |
972 | rxvt_term::set_should_invoke (int htype, int inc) |
1013 | rxvt_term::set_should_invoke (int htype, int inc) |
973 | CODE: |
1014 | CODE: |
974 | THIS->perl.should_invoke [htype] += inc; |
1015 | THIS->perl.should_invoke [htype] += inc; |
975 | |
1016 | |
976 | void |
1017 | void |
977 | rxvt_term::grab_button (int button, U32 modifiers) |
1018 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
978 | CODE: |
1019 | CODE: |
979 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
1020 | XGrabButton (THIS->dpy, button, modifiers, window, 1, |
980 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1021 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
981 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
1022 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
982 | |
1023 | |
|
|
1024 | void |
|
|
1025 | rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt) |
|
|
1026 | CODE: |
|
|
1027 | XUngrabButton (THIS->dpy, button, modifiers, window); |
|
|
1028 | |
|
|
1029 | #if 0 |
|
|
1030 | |
|
|
1031 | void |
|
|
1032 | XGrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) |
|
|
1033 | C_ARGS: |
|
|
1034 | THIS->dpy, keycode, modifiers, window, 1, |
|
|
1035 | GrabModeSync, GrabModeSync |
|
|
1036 | |
|
|
1037 | void |
|
|
1038 | XUngrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) |
|
|
1039 | C_ARGS: THIS->dpy, keycode, modifiers, window |
|
|
1040 | |
|
|
1041 | #endif |
|
|
1042 | |
983 | bool |
1043 | bool |
984 | rxvt_term::grab (Time eventtime, int sync = 0) |
1044 | rxvt_term::grab (Time eventtime, int sync = 0) |
985 | CODE: |
1045 | CODE: |
986 | { |
1046 | { |
987 | int mode = sync ? GrabModeSync : GrabModeAsync; |
1047 | int mode = sync ? GrabModeSync : GrabModeAsync; |
988 | |
1048 | |
989 | THIS->perl.grabtime = 0; |
1049 | THIS->perl.grabtime = 0; |
990 | |
1050 | |
991 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
1051 | if (!XGrabPointer (THIS->dpy, THIS->vt, 0, |
992 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1052 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
993 | mode, mode, None, GRAB_CURSOR, eventtime)) |
1053 | mode, mode, None, GRAB_CURSOR, eventtime)) |
994 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
1054 | if (!XGrabKeyboard (THIS->dpy, THIS->vt, 0, mode, mode, eventtime)) |
995 | THIS->perl.grabtime = eventtime; |
1055 | THIS->perl.grabtime = eventtime; |
996 | else |
1056 | else |
997 | XUngrabPointer (THIS->display->display, eventtime); |
1057 | XUngrabPointer (THIS->dpy, eventtime); |
998 | |
1058 | |
999 | RETVAL = !!THIS->perl.grabtime; |
1059 | RETVAL = !!THIS->perl.grabtime; |
1000 | } |
1060 | } |
1001 | OUTPUT: |
1061 | OUTPUT: |
1002 | RETVAL |
1062 | RETVAL |
1003 | |
1063 | |
1004 | void |
1064 | void |
1005 | rxvt_term::allow_events_async () |
1065 | rxvt_term::allow_events_async () |
1006 | CODE: |
1066 | CODE: |
1007 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
1067 | XAllowEvents (THIS->dpy, AsyncBoth, THIS->perl.grabtime); |
1008 | |
1068 | |
1009 | void |
1069 | void |
1010 | rxvt_term::allow_events_sync () |
1070 | rxvt_term::allow_events_sync () |
1011 | CODE: |
1071 | CODE: |
1012 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
1072 | XAllowEvents (THIS->dpy, SyncBoth, THIS->perl.grabtime); |
1013 | |
1073 | |
1014 | void |
1074 | void |
1015 | rxvt_term::allow_events_replay () |
1075 | rxvt_term::allow_events_replay () |
1016 | CODE: |
1076 | CODE: |
1017 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
1077 | XAllowEvents (THIS->dpy, ReplayPointer, THIS->perl.grabtime); |
1018 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
1078 | XAllowEvents (THIS->dpy, ReplayKeyboard, THIS->perl.grabtime); |
1019 | |
1079 | |
1020 | void |
1080 | void |
1021 | rxvt_term::ungrab () |
1081 | rxvt_term::ungrab () |
1022 | CODE: |
1082 | CODE: |
1023 | ungrab (THIS); |
1083 | ungrab (THIS); |
… | |
… | |
1118 | ALIAS: |
1178 | ALIAS: |
1119 | ModLevel3Mask = 0 |
1179 | ModLevel3Mask = 0 |
1120 | ModMetaMask = 1 |
1180 | ModMetaMask = 1 |
1121 | ModNumLockMask = 2 |
1181 | ModNumLockMask = 2 |
1122 | current_screen = 3 |
1182 | current_screen = 3 |
|
|
1183 | hidden_cursor = 4 |
1123 | CODE: |
1184 | CODE: |
1124 | switch (ix) |
1185 | switch (ix) |
1125 | { |
1186 | { |
1126 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1187 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1127 | case 1: RETVAL = THIS->ModMetaMask; break; |
1188 | case 1: RETVAL = THIS->ModMetaMask; break; |
1128 | case 2: RETVAL = THIS->ModNumLockMask; break; |
1189 | case 2: RETVAL = THIS->ModNumLockMask; break; |
1129 | case 3: RETVAL = THIS->current_screen; break; |
1190 | case 3: RETVAL = THIS->current_screen; break; |
|
|
1191 | case 4: RETVAL = THIS->hidden_cursor; break; |
1130 | } |
1192 | } |
1131 | OUTPUT: |
1193 | OUTPUT: |
1132 | RETVAL |
1194 | RETVAL |
1133 | |
1195 | |
1134 | char * |
1196 | char * |
… | |
… | |
1144 | } |
1206 | } |
1145 | OUTPUT: |
1207 | OUTPUT: |
1146 | RETVAL |
1208 | RETVAL |
1147 | |
1209 | |
1148 | SV * |
1210 | SV * |
1149 | rxvt_term::_env () |
1211 | rxvt_term::envv () |
|
|
1212 | ALIAS: |
|
|
1213 | argv = 1 |
1150 | CODE: |
1214 | PPCODE: |
1151 | { |
1215 | { |
1152 | if (THIS->envv) |
1216 | stringvec *vec = ix ? THIS->argv : THIS->envv; |
1153 | { |
|
|
1154 | AV *av = newAV (); |
|
|
1155 | |
1217 | |
|
|
1218 | EXTEND (SP, vec->size ()); |
|
|
1219 | |
1156 | for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i) |
1220 | for (char **i = vec->begin (); i != vec->end (); ++i) |
1157 | if (*i) |
1221 | if (*i) |
1158 | av_push (av, newSVpv (*i, 0)); |
1222 | PUSHs (sv_2mortal (newSVpv (*i, 0))); |
1159 | |
|
|
1160 | RETVAL = newRV_noinc ((SV *)av); |
|
|
1161 | } |
|
|
1162 | else |
|
|
1163 | RETVAL = &PL_sv_undef; |
|
|
1164 | } |
1223 | } |
1165 | OUTPUT: |
|
|
1166 | RETVAL |
|
|
1167 | |
1224 | |
1168 | int |
1225 | int |
1169 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1226 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1170 | CODE: |
1227 | CODE: |
1171 | RETVAL = THIS->pty_ev.events; |
1228 | RETVAL = THIS->pty_ev.events; |
1172 | if (events != EVENT_UNDEF) |
1229 | if (events != EVENT_UNDEF) |
1173 | THIS->pty_ev.set (events); |
1230 | THIS->pty_ev.set (events); |
1174 | OUTPUT: |
1231 | OUTPUT: |
1175 | RETVAL |
1232 | RETVAL |
1176 | |
1233 | |
|
|
1234 | int |
|
|
1235 | rxvt_term::pty_fd () |
|
|
1236 | CODE: |
|
|
1237 | RETVAL = THIS->pty->pty; |
|
|
1238 | OUTPUT: |
|
|
1239 | RETVAL |
|
|
1240 | |
1177 | Window |
1241 | Window |
1178 | rxvt_term::parent () |
1242 | rxvt_term::parent () |
1179 | CODE: |
1243 | CODE: |
1180 | RETVAL = THIS->parent [0]; |
1244 | RETVAL = THIS->parent [0]; |
1181 | OUTPUT: |
1245 | OUTPUT: |
… | |
… | |
1220 | |
1284 | |
1221 | void |
1285 | void |
1222 | rxvt_term::focus_out () |
1286 | rxvt_term::focus_out () |
1223 | |
1287 | |
1224 | void |
1288 | void |
|
|
1289 | rxvt_term::key_press (unsigned int state, unsigned int keycode, Time time = CurrentTime) |
|
|
1290 | ALIAS: |
|
|
1291 | key_release = 1 |
|
|
1292 | CODE: |
|
|
1293 | { |
|
|
1294 | XKeyEvent xkey; |
|
|
1295 | |
|
|
1296 | memset (&xkey, 0, sizeof (xkey)); |
|
|
1297 | |
|
|
1298 | xkey.time = time; |
|
|
1299 | xkey.state = state; |
|
|
1300 | xkey.keycode = keycode; |
|
|
1301 | |
|
|
1302 | xkey.type = ix ? KeyRelease : KeyPress; |
|
|
1303 | xkey.display = THIS->dpy; |
|
|
1304 | xkey.window = THIS->vt; |
|
|
1305 | xkey.root = THIS->display->root; |
|
|
1306 | xkey.subwindow = THIS->vt; |
|
|
1307 | |
|
|
1308 | if (ix) |
|
|
1309 | THIS->key_release (xkey); |
|
|
1310 | else |
|
|
1311 | THIS->key_press (xkey); |
|
|
1312 | } |
|
|
1313 | |
|
|
1314 | void |
1225 | rxvt_term::want_refresh () |
1315 | rxvt_term::want_refresh () |
1226 | CODE: |
1316 | CODE: |
1227 | THIS->want_refresh = 1; |
1317 | THIS->want_refresh = 1; |
1228 | |
1318 | |
1229 | void |
1319 | void |
… | |
… | |
1235 | |
1325 | |
1236 | line_t &l = ROW(row_number); |
1326 | line_t &l = ROW(row_number); |
1237 | |
1327 | |
1238 | if (GIMME_V != G_VOID) |
1328 | if (GIMME_V != G_VOID) |
1239 | { |
1329 | { |
1240 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1330 | wchar_t *wstr = rxvt_temp_buf<wchar_t> (THIS->ncol); |
1241 | |
1331 | |
1242 | for (int col = 0; col < THIS->ncol; col++) |
1332 | for (int col = 0; col < THIS->ncol; col++) |
1243 | wstr [col] = l.t [col]; |
1333 | wstr [col] = l.t [col]; |
1244 | |
1334 | |
1245 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1335 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1246 | |
|
|
1247 | delete [] wstr; |
|
|
1248 | } |
1336 | } |
1249 | |
1337 | |
1250 | if (new_text) |
1338 | if (new_text) |
1251 | { |
1339 | { |
1252 | wchar_t *wstr = sv2wcs (new_text); |
1340 | wchar_t *wstr = sv2wcs (new_text); |
… | |
… | |
1345 | rxvt_term::special_encode (SV *string) |
1433 | rxvt_term::special_encode (SV *string) |
1346 | CODE: |
1434 | CODE: |
1347 | { |
1435 | { |
1348 | wchar_t *wstr = sv2wcs (string); |
1436 | wchar_t *wstr = sv2wcs (string); |
1349 | int wlen = wcslen (wstr); |
1437 | int wlen = wcslen (wstr); |
1350 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
1438 | wchar_t *rstr = rxvt_temp_buf<wchar_t> (wlen * 2); // cannot become longer |
1351 | |
1439 | |
1352 | rxvt_push_locale (THIS->locale); |
1440 | rxvt_push_locale (THIS->locale); |
1353 | |
1441 | |
1354 | wchar_t *r = rstr; |
1442 | wchar_t *r = rstr; |
1355 | for (wchar_t *s = wstr; *s; s++) |
1443 | for (wchar_t *s = wstr; *s; s++) |
|
|
1444 | { |
|
|
1445 | int w = WCWIDTH (*s); |
|
|
1446 | |
1356 | if (wcwidth (*s) == 0) |
1447 | if (w == 0) |
1357 | { |
1448 | { |
1358 | if (r == rstr) |
1449 | if (r == rstr) |
1359 | croak ("leading combining character unencodable"); |
1450 | croak ("leading combining character unencodable"); |
1360 | |
1451 | |
1361 | unicode_t n = rxvt_compose (r[-1], *s); |
1452 | unicode_t n = rxvt_compose (r[-1], *s); |
1362 | if (n == NOCHAR) |
1453 | if (n == NOCHAR) |
1363 | n = rxvt_composite.compose (r[-1], *s); |
1454 | n = rxvt_composite.compose (r[-1], *s); |
1364 | |
1455 | |
1365 | r[-1] = n; |
1456 | r[-1] = n; |
1366 | } |
1457 | } |
1367 | #if !UNICODE_3 |
1458 | #if !UNICODE_3 |
1368 | else if (*s >= 0x10000) |
1459 | else if (*s >= 0x10000) |
1369 | *r++ = rxvt_composite.compose (*s); |
1460 | *r++ = rxvt_composite.compose (*s); |
1370 | #endif |
1461 | #endif |
1371 | else |
1462 | else |
1372 | *r++ = *s; |
1463 | *r++ = *s; |
|
|
1464 | |
|
|
1465 | // the *2 above only allows wcwidth <= 2 |
|
|
1466 | if (w > 1) |
|
|
1467 | *r++ = NOCHAR; |
|
|
1468 | } |
1373 | |
1469 | |
1374 | rxvt_pop_locale (); |
1470 | rxvt_pop_locale (); |
1375 | |
1471 | |
1376 | RETVAL = wcs2sv (rstr, r - rstr); |
1472 | RETVAL = wcs2sv (rstr, r - rstr); |
1377 | |
|
|
1378 | delete [] rstr; |
|
|
1379 | } |
1473 | } |
1380 | OUTPUT: |
1474 | OUTPUT: |
1381 | RETVAL |
1475 | RETVAL |
1382 | |
1476 | |
1383 | SV * |
1477 | SV * |
… | |
… | |
1395 | else if (IS_COMPOSE (*s)) |
1489 | else if (IS_COMPOSE (*s)) |
1396 | dlen += rxvt_composite.expand (*s, 0); |
1490 | dlen += rxvt_composite.expand (*s, 0); |
1397 | else |
1491 | else |
1398 | dlen++; |
1492 | dlen++; |
1399 | |
1493 | |
1400 | wchar_t *rstr = new wchar_t [dlen]; |
1494 | wchar_t *rstr = rxvt_temp_buf<wchar_t> (dlen); |
1401 | |
1495 | |
1402 | // decode |
1496 | // decode |
1403 | wchar_t *r = rstr; |
1497 | wchar_t *r = rstr; |
1404 | for (wchar_t *s = wstr; *s; s++) |
1498 | for (wchar_t *s = wstr; *s; s++) |
1405 | if (*s == NOCHAR) |
1499 | if (*s == NOCHAR) |
… | |
… | |
1408 | r += rxvt_composite.expand (*s, r); |
1502 | r += rxvt_composite.expand (*s, r); |
1409 | else |
1503 | else |
1410 | *r++ = *s; |
1504 | *r++ = *s; |
1411 | |
1505 | |
1412 | RETVAL = wcs2sv (rstr, r - rstr); |
1506 | RETVAL = wcs2sv (rstr, r - rstr); |
1413 | |
|
|
1414 | delete [] rstr; |
|
|
1415 | } |
1507 | } |
1416 | OUTPUT: |
1508 | OUTPUT: |
1417 | RETVAL |
1509 | RETVAL |
1418 | |
1510 | |
1419 | void |
1511 | void |
1420 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1512 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1421 | PPCODE: |
1513 | PPCODE: |
1422 | { |
1514 | { |
1423 | struct resval { const char *name; int value; } rslist [] = { |
1515 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1424 | # define def(name) { # name, Rs_ ## name }, |
1516 | # define def(name) { # name, Rs_ ## name }, |
1425 | # define reserve(name,count) |
1517 | # define reserve(name,count) |
1426 | # include "rsinc.h" |
1518 | # include "rsinc.h" |
1427 | # undef def |
1519 | # undef def |
1428 | # undef reserve |
1520 | # undef reserve |
1429 | }; |
1521 | }; |
1430 | |
1522 | |
1431 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1523 | rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1432 | |
1524 | |
1433 | do { |
1525 | do { |
1434 | if (rs-- == rslist) |
1526 | if (rs-- == rslist) |
1435 | croak ("no such resource '%s', requested", name); |
1527 | croak ("no such resource '%s', requested", name); |
1436 | } while (strcmp (name, rs->name)); |
1528 | } while (strcmp (name, rs->name)); |
… | |
… | |
1529 | if (items == 3) |
1621 | if (items == 3) |
1530 | { |
1622 | { |
1531 | rc.row = SvIV (ST (1)); |
1623 | rc.row = SvIV (ST (1)); |
1532 | rc.col = SvIV (ST (2)); |
1624 | rc.col = SvIV (ST (2)); |
1533 | |
1625 | |
1534 | if (ix == 2 && rc.col == 0) |
1626 | if (ix == 2) |
1535 | { |
1627 | { |
|
|
1628 | if (rc.col == 0) |
|
|
1629 | { |
|
|
1630 | // col == 0 means end of previous line |
1536 | rc.row--; |
1631 | rc.row--; |
1537 | rc.col = THIS->ncol; |
1632 | rc.col = THIS->ncol; |
|
|
1633 | } |
|
|
1634 | else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow) |
|
|
1635 | && rc.col > ROW(rc.row).l) |
|
|
1636 | { |
|
|
1637 | // col >= length means while line and add newline |
|
|
1638 | rc.col = THIS->ncol; |
|
|
1639 | } |
1538 | } |
1640 | } |
1539 | |
1641 | |
1540 | clamp_it (rc.col, 0, THIS->ncol); |
1642 | clamp_it (rc.col, 0, THIS->ncol); |
1541 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1643 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1542 | |
1644 | |
… | |
… | |
1550 | CODE: |
1652 | CODE: |
1551 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1653 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1552 | OUTPUT: |
1654 | OUTPUT: |
1553 | RETVAL |
1655 | RETVAL |
1554 | |
1656 | |
1555 | #void |
1657 | void |
1556 | #rxvt_term::selection_clear () |
1658 | rxvt_term::selection_clear () |
1557 | |
1659 | |
1558 | void |
1660 | void |
1559 | rxvt_term::selection_make (Time eventtime, bool rect = false) |
1661 | rxvt_term::selection_make (Time eventtime, bool rect = false) |
1560 | CODE: |
1662 | CODE: |
1561 | THIS->selection.op = SELECTION_CONT; |
1663 | THIS->selection.op = SELECTION_CONT; |
… | |
… | |
1651 | void |
1753 | void |
1652 | rxvt_term::XListProperties (Window window) |
1754 | rxvt_term::XListProperties (Window window) |
1653 | PPCODE: |
1755 | PPCODE: |
1654 | { |
1756 | { |
1655 | int count; |
1757 | int count; |
1656 | Atom *props = XListProperties (THIS->display->display, window, &count); |
1758 | Atom *props = XListProperties (THIS->dpy, window, &count); |
1657 | |
1759 | |
1658 | EXTEND (SP, count); |
1760 | EXTEND (SP, count); |
1659 | while (count--) |
1761 | while (count--) |
1660 | PUSHs (newSVuv ((U32)props [count])); |
1762 | PUSHs (newSVuv ((U32)props [count])); |
1661 | |
1763 | |
… | |
… | |
1670 | int format; |
1772 | int format; |
1671 | unsigned long nitems; |
1773 | unsigned long nitems; |
1672 | unsigned long bytes_after; |
1774 | unsigned long bytes_after; |
1673 | unsigned char *prop; |
1775 | unsigned char *prop; |
1674 | |
1776 | |
1675 | XGetWindowProperty (THIS->display->display, window, property, |
1777 | XGetWindowProperty (THIS->dpy, window, property, |
1676 | 0, 1<<24, 0, AnyPropertyType, |
1778 | 0, 1<<24, 0, AnyPropertyType, |
1677 | &type, &format, &nitems, &bytes_after, &prop); |
1779 | &type, &format, &nitems, &bytes_after, &prop); |
1678 | |
1780 | |
1679 | if (type != None) |
1781 | if (type != None) |
1680 | { |
1782 | { |
… | |
… | |
1699 | |
1801 | |
1700 | int elemsize = format == 16 ? sizeof (short) |
1802 | int elemsize = format == 16 ? sizeof (short) |
1701 | : format == 32 ? sizeof (long) |
1803 | : format == 32 ? sizeof (long) |
1702 | : 1; |
1804 | : 1; |
1703 | |
1805 | |
1704 | XChangeProperty (THIS->display->display, window, property, |
1806 | XChangeProperty (THIS->dpy, window, property, |
1705 | type, format, PropModeReplace, |
1807 | type, format, PropModeReplace, |
1706 | (unsigned char *)data_, len / elemsize); |
1808 | (unsigned char *)data_, len / elemsize); |
1707 | XSync (THIS->display->display, 0); |
|
|
1708 | } |
1809 | } |
1709 | |
1810 | |
1710 | Atom |
1811 | Atom |
1711 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
1812 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
1712 | C_ARGS: term->display->display, atom_name, only_if_exists |
1813 | C_ARGS: term->dpy, atom_name, only_if_exists |
1713 | |
1814 | |
1714 | char * |
1815 | char * |
1715 | XGetAtomName (rxvt_term *term, Atom atom) |
1816 | XGetAtomName (rxvt_term *term, Atom atom) |
1716 | C_ARGS: term->display->display, atom |
1817 | C_ARGS: term->dpy, atom |
1717 | CLEANUP: |
1818 | CLEANUP: |
1718 | XFree (RETVAL); |
1819 | XFree (RETVAL); |
1719 | |
1820 | |
1720 | void |
1821 | void |
1721 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1822 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1722 | C_ARGS: term->display->display, window, property |
1823 | C_ARGS: term->dpy, window, property |
1723 | |
1824 | |
1724 | Window |
1825 | Window |
1725 | rxvt_term::DefaultRootWindow () |
1826 | rxvt_term::DefaultRootWindow () |
1726 | CODE: |
1827 | CODE: |
1727 | RETVAL = THIS->display->root; |
1828 | RETVAL = THIS->display->root; |
… | |
… | |
1730 | |
1831 | |
1731 | #if 0 |
1832 | #if 0 |
1732 | |
1833 | |
1733 | Window |
1834 | Window |
1734 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1835 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1735 | C_ARGS: term->display->display, (Window)parent, |
1836 | C_ARGS: term->dpy, (Window)parent, |
1736 | x, y, width, height, 0, |
1837 | x, y, width, height, 0, |
1737 | term->pix_colors_focused[Color_border], |
1838 | term->pix_colors_focused[Color_border], |
1738 | term->pix_colors_focused[Color_border] |
1839 | term->pix_colors_focused[Color_border] |
1739 | |
1840 | |
1740 | #endif |
1841 | #endif |
1741 | |
1842 | |
1742 | void |
1843 | void |
1743 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1844 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1744 | C_ARGS: term->display->display, window, parent, x, y |
1845 | C_ARGS: term->dpy, window, parent, x, y |
1745 | |
1846 | |
1746 | void |
1847 | void |
1747 | XMapWindow (rxvt_term *term, Window window) |
1848 | XMapWindow (rxvt_term *term, Window window) |
1748 | C_ARGS: term->display->display, window |
1849 | C_ARGS: term->dpy, window |
1749 | |
1850 | |
1750 | void |
1851 | void |
1751 | XUnmapWindow (rxvt_term *term, Window window) |
1852 | XUnmapWindow (rxvt_term *term, Window window) |
1752 | C_ARGS: term->display->display, window |
1853 | C_ARGS: term->dpy, window |
1753 | |
1854 | |
1754 | void |
1855 | void |
1755 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1856 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1756 | C_ARGS: term->display->display, window, x, y, width, height |
1857 | C_ARGS: term->dpy, window, x, y, width, height |
1757 | |
1858 | |
1758 | void |
1859 | void |
1759 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
1860 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
1760 | CODE: |
1861 | CODE: |
1761 | { |
1862 | { |
1762 | XWindowAttributes attr; |
1863 | XWindowAttributes attr; |
1763 | XGetWindowAttributes (THIS->display->display, window, &attr); |
1864 | XGetWindowAttributes (THIS->dpy, window, &attr); |
1764 | XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events); |
1865 | XSelectInput (THIS->dpy, window, attr.your_event_mask | add_events & ~del_events); |
1765 | } |
1866 | } |
1766 | |
1867 | |
1767 | void |
1868 | void |
1768 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
1869 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
1769 | PPCODE: |
1870 | PPCODE: |
1770 | { |
1871 | { |
1771 | int dx, dy; |
1872 | int dx, dy; |
1772 | Window child; |
1873 | Window child; |
1773 | |
1874 | |
1774 | if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child)) |
1875 | if (XTranslateCoordinates (THIS->dpy, src, dst, x, y, &dx, &dy, &child)) |
1775 | { |
1876 | { |
1776 | EXTEND (SP, 3); |
1877 | EXTEND (SP, 3); |
1777 | PUSHs (newSViv (dx)); |
1878 | PUSHs (newSViv (dx)); |
1778 | PUSHs (newSViv (dy)); |
1879 | PUSHs (newSViv (dy)); |
1779 | PUSHs (newSVuv (child)); |
1880 | PUSHs (newSVuv (child)); |