… | |
… | |
268 | }; |
268 | }; |
269 | |
269 | |
270 | 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) |
271 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0) |
271 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0) |
272 | { |
272 | { |
|
|
273 | if (w < 0) w = 0; |
|
|
274 | if (h < 0) h = 0; |
|
|
275 | |
273 | if (border == 2) |
276 | if (border == 2) |
274 | { |
277 | { |
275 | w += 2; |
278 | w += 2; |
276 | h += 2; |
279 | h += 2; |
277 | } |
280 | } |
… | |
… | |
355 | |
358 | |
356 | int i; |
359 | int i; |
357 | |
360 | |
358 | for (i = AvFILL (overlay_av); i >= 0; i--) |
361 | for (i = AvFILL (overlay_av); i >= 0; i--) |
359 | if (SvIV (*av_fetch (overlay_av, i, 1)) == (long)this) |
362 | if (SvIV (*av_fetch (overlay_av, i, 1)) == (long)this) |
360 | { |
|
|
361 | av_delete (overlay_av, i, G_DISCARD); |
|
|
362 | break; |
363 | break; |
363 | } |
|
|
364 | |
364 | |
365 | for (; i < AvFILL (overlay_av); i++) |
365 | for (; i < AvFILL (overlay_av); i++) |
366 | av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0))); |
366 | av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0))); |
367 | |
367 | |
368 | av_pop (overlay_av); |
368 | av_pop (overlay_av); |
… | |
… | |
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), |
… | |
… | |
790 | const_iv (Button2Mask), |
790 | const_iv (Button2Mask), |
791 | const_iv (Button3Mask), |
791 | const_iv (Button3Mask), |
792 | const_iv (Button4Mask), |
792 | const_iv (Button4Mask), |
793 | const_iv (Button5Mask), |
793 | const_iv (Button5Mask), |
794 | const_iv (AnyModifier), |
794 | const_iv (AnyModifier), |
|
|
795 | |
|
|
796 | const_iv (NoSymbol), |
|
|
797 | const_iv (GrabModeSync), |
|
|
798 | const_iv (GrabModeAsync), |
795 | |
799 | |
796 | const_iv (EVENT_NONE), |
800 | const_iv (EVENT_NONE), |
797 | const_iv (EVENT_READ), |
801 | const_iv (EVENT_READ), |
798 | const_iv (EVENT_WRITE), |
802 | const_iv (EVENT_WRITE), |
799 | |
803 | |
… | |
… | |
923 | RETVAL |
927 | RETVAL |
924 | |
928 | |
925 | int |
929 | int |
926 | SET_FGCOLOR (int rend, int new_color) |
930 | SET_FGCOLOR (int rend, int new_color) |
927 | CODE: |
931 | CODE: |
928 | RETVAL = SET_FGCOLOR (rend, new_color); |
932 | RETVAL = SET_FGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
929 | OUTPUT: |
933 | OUTPUT: |
930 | RETVAL |
934 | RETVAL |
931 | |
935 | |
932 | int |
936 | int |
933 | SET_BGCOLOR (int rend, int new_color) |
937 | SET_BGCOLOR (int rend, int new_color) |
934 | CODE: |
938 | CODE: |
935 | RETVAL = SET_BGCOLOR (rend, new_color); |
939 | RETVAL = SET_BGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1)); |
936 | OUTPUT: |
940 | OUTPUT: |
937 | RETVAL |
941 | RETVAL |
938 | |
942 | |
939 | int |
943 | int |
940 | GET_CUSTOM (int rend) |
944 | GET_CUSTOM (int rend) |
… | |
… | |
1015 | void |
1019 | void |
1016 | rxvt_term::set_should_invoke (int htype, int inc) |
1020 | rxvt_term::set_should_invoke (int htype, int inc) |
1017 | CODE: |
1021 | CODE: |
1018 | THIS->perl.should_invoke [htype] += inc; |
1022 | THIS->perl.should_invoke [htype] += inc; |
1019 | |
1023 | |
1020 | void |
1024 | int |
1021 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
1025 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
1022 | CODE: |
1026 | CODE: |
1023 | XGrabButton (THIS->dpy, button, modifiers, window, 1, |
1027 | RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, |
1024 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1028 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1025 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
1029 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
|
|
1030 | OUTPUT: RETVAL |
1026 | |
1031 | |
1027 | void |
1032 | int |
1028 | rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt) |
1033 | rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt) |
1029 | CODE: |
1034 | CODE: |
1030 | XUngrabButton (THIS->dpy, button, modifiers, window); |
1035 | RETVAL = XUngrabButton (THIS->dpy, button, modifiers, window); |
|
|
1036 | OUTPUT: RETVAL |
1031 | |
1037 | |
1032 | #if 0 |
|
|
1033 | |
|
|
1034 | void |
1038 | void |
1035 | XGrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) |
1039 | rxvt_term::XGrabKey (int keycode, U32 modifiers, Window window = THIS->vt, \ |
1036 | C_ARGS: |
1040 | int owner_events = 1, int pointer_mode = GrabModeAsync, int keyboard_mode = GrabModeAsync) |
1037 | THIS->dpy, keycode, modifiers, window, 1, |
1041 | CODE: |
1038 | GrabModeSync, GrabModeSync |
1042 | XGrabKey (THIS->dpy, keycode, modifiers, window, owner_events, pointer_mode, keyboard_mode); |
1039 | |
1043 | |
1040 | void |
1044 | void |
1041 | XUngrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) |
1045 | rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt) |
|
|
1046 | CODE: |
1042 | C_ARGS: THIS->dpy, keycode, modifiers, window |
1047 | XUngrabKey (THIS->dpy, keycode, modifiers, window); |
1043 | |
1048 | |
1044 | #endif |
1049 | void |
|
|
1050 | rxvt_term::XUngrabKeyboard (Time eventtime) |
|
|
1051 | CODE: |
|
|
1052 | XUngrabKeyboard (THIS->dpy, eventtime); |
1045 | |
1053 | |
1046 | bool |
1054 | bool |
1047 | rxvt_term::grab (Time eventtime, int sync = 0) |
1055 | rxvt_term::grab (Time eventtime, int sync = 0) |
1048 | CODE: |
1056 | CODE: |
1049 | { |
1057 | { |
… | |
… | |
1082 | |
1090 | |
1083 | void |
1091 | void |
1084 | rxvt_term::ungrab () |
1092 | rxvt_term::ungrab () |
1085 | CODE: |
1093 | CODE: |
1086 | ungrab (THIS); |
1094 | ungrab (THIS); |
|
|
1095 | |
|
|
1096 | int |
|
|
1097 | rxvt_term::XStringToKeysym (char *string) |
|
|
1098 | CODE: |
|
|
1099 | RETVAL = XStringToKeysym (string); |
|
|
1100 | OUTPUT: RETVAL |
|
|
1101 | |
|
|
1102 | char * |
|
|
1103 | rxvt_term::XKeysymToString (int sym) |
|
|
1104 | CODE: |
|
|
1105 | RETVAL = XKeysymToString (sym); |
|
|
1106 | OUTPUT: RETVAL |
|
|
1107 | |
|
|
1108 | int |
|
|
1109 | rxvt_term::XKeysymToKeycode (int sym) |
|
|
1110 | CODE: |
|
|
1111 | RETVAL = XKeysymToKeycode (THIS->dpy, sym); |
|
|
1112 | OUTPUT: RETVAL |
|
|
1113 | |
|
|
1114 | int |
|
|
1115 | rxvt_term::XKeycodeToKeysym (int code, int index) |
|
|
1116 | CODE: |
|
|
1117 | RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); |
|
|
1118 | OUTPUT: RETVAL |
1087 | |
1119 | |
1088 | int |
1120 | int |
1089 | rxvt_term::strwidth (SV *str) |
1121 | rxvt_term::strwidth (SV *str) |
1090 | CODE: |
1122 | CODE: |
1091 | { |
1123 | { |
… | |
… | |
1209 | } |
1241 | } |
1210 | OUTPUT: |
1242 | OUTPUT: |
1211 | RETVAL |
1243 | RETVAL |
1212 | |
1244 | |
1213 | SV * |
1245 | SV * |
1214 | rxvt_term::_env () |
1246 | rxvt_term::envv () |
|
|
1247 | ALIAS: |
|
|
1248 | argv = 1 |
1215 | CODE: |
1249 | PPCODE: |
1216 | { |
1250 | { |
1217 | if (THIS->envv) |
1251 | stringvec *vec = ix ? THIS->argv : THIS->envv; |
1218 | { |
|
|
1219 | AV *av = newAV (); |
|
|
1220 | |
1252 | |
|
|
1253 | EXTEND (SP, vec->size ()); |
|
|
1254 | |
1221 | for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i) |
1255 | for (char **i = vec->begin (); i != vec->end (); ++i) |
1222 | if (*i) |
1256 | if (*i) |
1223 | av_push (av, newSVpv (*i, 0)); |
1257 | PUSHs (sv_2mortal (newSVpv (*i, 0))); |
1224 | |
|
|
1225 | RETVAL = newRV_noinc ((SV *)av); |
|
|
1226 | } |
|
|
1227 | else |
|
|
1228 | RETVAL = &PL_sv_undef; |
|
|
1229 | } |
1258 | } |
1230 | OUTPUT: |
|
|
1231 | RETVAL |
|
|
1232 | |
1259 | |
1233 | int |
1260 | int |
1234 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1261 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
1235 | CODE: |
1262 | CODE: |
1236 | RETVAL = THIS->pty_ev.events; |
1263 | RETVAL = THIS->pty_ev.events; |
… | |
… | |
1290 | void |
1317 | void |
1291 | rxvt_term::focus_in () |
1318 | rxvt_term::focus_in () |
1292 | |
1319 | |
1293 | void |
1320 | void |
1294 | rxvt_term::focus_out () |
1321 | rxvt_term::focus_out () |
|
|
1322 | |
|
|
1323 | void |
|
|
1324 | rxvt_term::key_press (unsigned int state, unsigned int keycode, Time time = CurrentTime) |
|
|
1325 | ALIAS: |
|
|
1326 | key_release = 1 |
|
|
1327 | CODE: |
|
|
1328 | { |
|
|
1329 | XKeyEvent xkey; |
|
|
1330 | |
|
|
1331 | memset (&xkey, 0, sizeof (xkey)); |
|
|
1332 | |
|
|
1333 | xkey.time = time; |
|
|
1334 | xkey.state = state; |
|
|
1335 | xkey.keycode = keycode; |
|
|
1336 | |
|
|
1337 | xkey.type = ix ? KeyRelease : KeyPress; |
|
|
1338 | xkey.display = THIS->dpy; |
|
|
1339 | xkey.window = THIS->vt; |
|
|
1340 | xkey.root = THIS->display->root; |
|
|
1341 | xkey.subwindow = THIS->vt; |
|
|
1342 | |
|
|
1343 | if (ix) |
|
|
1344 | THIS->key_release (xkey); |
|
|
1345 | else |
|
|
1346 | THIS->key_press (xkey); |
|
|
1347 | } |
1295 | |
1348 | |
1296 | void |
1349 | void |
1297 | rxvt_term::want_refresh () |
1350 | rxvt_term::want_refresh () |
1298 | CODE: |
1351 | CODE: |
1299 | THIS->want_refresh = 1; |
1352 | THIS->want_refresh = 1; |
… | |
… | |
1492 | |
1545 | |
1493 | void |
1546 | void |
1494 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1547 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1495 | PPCODE: |
1548 | PPCODE: |
1496 | { |
1549 | { |
1497 | struct resval { const char *name; int value; } rslist [] = { |
1550 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1498 | # define def(name) { # name, Rs_ ## name }, |
1551 | # define def(name) { # name, Rs_ ## name }, |
1499 | # define reserve(name,count) |
1552 | # define reserve(name,count) |
1500 | # include "rsinc.h" |
1553 | # include "rsinc.h" |
1501 | # undef def |
1554 | # undef def |
1502 | # undef reserve |
1555 | # undef reserve |
1503 | }; |
1556 | }; |
1504 | |
1557 | |
1505 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1558 | rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1506 | |
1559 | |
1507 | do { |
1560 | do { |
1508 | if (rs-- == rslist) |
1561 | if (rs-- == rslist) |
1509 | croak ("no such resource '%s', requested", name); |
1562 | croak ("no such resource '%s', requested", name); |
1510 | } while (strcmp (name, rs->name)); |
1563 | } while (strcmp (name, rs->name)); |
… | |
… | |
1786 | : 1; |
1839 | : 1; |
1787 | |
1840 | |
1788 | XChangeProperty (THIS->dpy, window, property, |
1841 | XChangeProperty (THIS->dpy, window, property, |
1789 | type, format, PropModeReplace, |
1842 | type, format, PropModeReplace, |
1790 | (unsigned char *)data_, len / elemsize); |
1843 | (unsigned char *)data_, len / elemsize); |
1791 | XSync (THIS->dpy, 0); |
|
|
1792 | } |
1844 | } |
1793 | |
1845 | |
1794 | Atom |
1846 | Atom |
1795 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
1847 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
1796 | C_ARGS: term->dpy, atom_name, only_if_exists |
1848 | C_ARGS: term->dpy, atom_name, only_if_exists |