--- rxvt-unicode/src/rxvtperl.xs 2006/01/20 12:16:28 1.80 +++ rxvt-unicode/src/rxvtperl.xs 2006/01/22 11:57:06 1.89 @@ -598,7 +598,7 @@ setuv (time, xe->xmotion.time); setiv (x, xe->xmotion.x); setiv (y, xe->xmotion.y); - setiv (row, xe->xmotion.y / term->fheight); + setiv (row, xe->xmotion.y / term->fheight + term->view_start); setiv (col, xe->xmotion.x / term->fwidth); setiv (x_root, xe->xmotion.x_root); setiv (y_root, xe->xmotion.y_root); @@ -642,6 +642,13 @@ break; + case PropertyNotify: + setuv (window, xe->xproperty.window); + setuv (atom, xe->xproperty.atom); + setuv (time, xe->xproperty.time); + setiv (state, xe->xproperty.state); + break; + case ClientMessage: setuv (window, xe->xclient.window); setuv (message_type, xe->xclient.message_type); @@ -651,6 +658,7 @@ setuv (l2, xe->xclient.data.l[2]); setuv (l3, xe->xclient.data.l[3]); setuv (l4, xe->xclient.data.l[4]); + break; } XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); @@ -922,23 +930,23 @@ rxvt_term *term = new rxvt_term; - term->argv = new stringvec; - term->envv = new stringvec; + stringvec *argv = new stringvec; + stringvec *envv = new stringvec; for (int i = 1; i < items; i++) - term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); + argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); - AV *envv = (AV *)SvRV (ST (0)); - for (int i = AvFILL (envv) + 1; i--; ) - term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); + AV *env = (AV *)SvRV (ST (0)); + for (int i = AvFILL (env) + 1; i--; ) + envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); - term->envv->push_back (0); + envv->push_back (0); bool success; try { - success = term->init (term->argv->size (), term->argv->begin ()); + success = term->init (argv, envv); } catch (const class rxvt_failure_exception &e) { @@ -1111,12 +1119,16 @@ ModLevel3Mask = 0 ModMetaMask = 1 ModNumLockMask = 2 + current_screen = 3 + hidden_cursor = 4 CODE: switch (ix) { - case 0: RETVAL = THIS->ModLevel3Mask; break; - case 1: RETVAL = THIS->ModMetaMask; break; - case 2: RETVAL = THIS->ModNumLockMask; break; + case 0: RETVAL = THIS->ModLevel3Mask; break; + case 1: RETVAL = THIS->ModMetaMask; break; + case 2: RETVAL = THIS->ModNumLockMask; break; + case 3: RETVAL = THIS->current_screen; break; + case 4: RETVAL = THIS->hidden_cursor; break; } OUTPUT: RETVAL @@ -1206,6 +1218,12 @@ RETVAL void +rxvt_term::focus_in () + +void +rxvt_term::focus_out () + +void rxvt_term::want_refresh () CODE: THIS->want_refresh = 1; @@ -1237,7 +1255,7 @@ int len = min (wcslen (wstr) - start_ofs, max_len); - if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) + if (start_col < 0 || start_col + len > THIS->ncol) { free (wstr); croak ("new_text extends beyond horizontal margins"); @@ -1281,7 +1299,7 @@ AV *av = (AV *)SvRV (new_rend); int len = min (AvFILL (av) + 1 - start_ofs, max_len); - if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) + if (start_col < 0 || start_col + len > THIS->ncol) croak ("new_rend array extends beyond horizontal margins"); for (int col = start_col; col < start_col + len; col++) @@ -1515,10 +1533,20 @@ rc.row = SvIV (ST (1)); rc.col = SvIV (ST (2)); - if (ix == 2 && rc.col == 0) + if (ix == 2) { - rc.row--; - rc.col = THIS->ncol; + if (rc.col == 0) + { + // col == 0 means end of previous line + rc.row--; + rc.col = THIS->ncol; + } + else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow) + && rc.col > ROW(rc.row).l) + { + // col >= length means while line and add newline + rc.col = THIS->ncol; + } } clamp_it (rc.col, 0, THIS->ncol); @@ -1577,6 +1605,9 @@ rxvt_term::scr_bell () void +rxvt_term::scr_change_screen (int screen) + +void rxvt_term::scr_add_lines (SV *string) CODE: { @@ -1652,15 +1683,21 @@ unsigned long nitems; unsigned long bytes_after; unsigned char *prop; + XGetWindowProperty (THIS->display->display, window, property, - 0, 1<<30, 0, AnyPropertyType, + 0, 1<<24, 0, AnyPropertyType, &type, &format, &nitems, &bytes_after, &prop); + if (type != None) { + int elemsize = format == 16 ? sizeof (short) + : format == 32 ? sizeof (long) + : 1; + EXTEND (SP, 3); PUSHs (newSVuv ((U32)type)); PUSHs (newSViv (format)); - PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); + PUSHs (newSVpvn ((char *)prop, nitems * elemsize)); XFree (prop); } } @@ -1672,11 +1709,26 @@ STRLEN len; char *data_ = SvPVbyte (data, len); + int elemsize = format == 16 ? sizeof (short) + : format == 32 ? sizeof (long) + : 1; + XChangeProperty (THIS->display->display, window, property, type, format, PropModeReplace, - (unsigned char *)data, len * 8 / format); + (unsigned char *)data_, len / elemsize); + XSync (THIS->display->display, 0); } +Atom +XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) + C_ARGS: term->display->display, atom_name, only_if_exists + +char * +XGetAtomName (rxvt_term *term, Atom atom) + C_ARGS: term->display->display, atom + CLEANUP: + XFree (RETVAL); + void XDeleteProperty (rxvt_term *term, Window window, Atom property) C_ARGS: term->display->display, window, property @@ -1688,6 +1740,8 @@ OUTPUT: RETVAL +#if 0 + Window XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) C_ARGS: term->display->display, (Window)parent, @@ -1695,6 +1749,8 @@ term->pix_colors_focused[Color_border], term->pix_colors_focused[Color_border] +#endif + void XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) C_ARGS: term->display->display, window, parent, x, y @@ -1709,7 +1765,32 @@ void XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) - C_ARGS: term->display->display, (Window)window, x, y, width, height + C_ARGS: term->display->display, window, x, y, width, height + +void +rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) + CODE: +{ + XWindowAttributes attr; + XGetWindowAttributes (THIS->display->display, window, &attr); + XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events); +} + +void +rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) + PPCODE: +{ + int dx, dy; + Window child; + + if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child)) + { + EXTEND (SP, 3); + PUSHs (newSViv (dx)); + PUSHs (newSViv (dy)); + PUSHs (newSVuv (child)); + } +} ############################################################################# # urxvt::overlay