--- rxvt-unicode/src/rxvtperl.xs 2006/07/05 23:34:14 1.101 +++ rxvt-unicode/src/rxvtperl.xs 2006/12/10 15:14:05 1.108 @@ -270,6 +270,9 @@ overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0) { + if (w < 0) w = 0; + if (h < 0) h = 0; + if (border == 2) { w += 2; @@ -790,6 +793,10 @@ const_iv (Button5Mask), const_iv (AnyModifier), + const_iv (NoSymbol), + const_iv (GrabModeSync), + const_iv (GrabModeAsync), + const_iv (EVENT_NONE), const_iv (EVENT_READ), const_iv (EVENT_WRITE), @@ -936,7 +943,7 @@ int GET_CUSTOM (int rend) CODE: - RETVAL = (rend && RS_customMask) >> RS_customShift; + RETVAL = (rend & RS_customMask) >> RS_customShift; OUTPUT: RETVAL @@ -1014,31 +1021,35 @@ CODE: THIS->perl.should_invoke [htype] += inc; -void +int rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) CODE: - XGrabButton (THIS->dpy, button, modifiers, window, 1, - ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeSync, GrabModeSync, None, GRAB_CURSOR); + RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, + ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, + GrabModeSync, GrabModeSync, None, GRAB_CURSOR); + OUTPUT: RETVAL -void +int rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt) CODE: - XUngrabButton (THIS->dpy, button, modifiers, window); - -#if 0 + RETVAL = XUngrabButton (THIS->dpy, button, modifiers, window); + OUTPUT: RETVAL void -XGrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) - C_ARGS: - THIS->dpy, keycode, modifiers, window, 1, - GrabModeSync, GrabModeSync +rxvt_term::XGrabKey (int keycode, U32 modifiers, Window window = THIS->vt, \ + int owner_events = 1, int pointer_mode = GrabModeAsync, int keyboard_mode = GrabModeAsync) + CODE: + XGrabKey (THIS->dpy, keycode, modifiers, window, owner_events, pointer_mode, keyboard_mode); void -XUngrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt) - C_ARGS: THIS->dpy, keycode, modifiers, window +rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt) + CODE: + XUngrabKey (THIS->dpy, keycode, modifiers, window); -#endif +void +rxvt_term::XUngrabKeyboard (Time eventtime) + CODE: + XUngrabKeyboard (THIS->dpy, eventtime); bool rxvt_term::grab (Time eventtime, int sync = 0) @@ -1083,13 +1094,44 @@ ungrab (THIS); int +rxvt_term::XStringToKeysym (char *string) + CODE: + RETVAL = XStringToKeysym (string); + OUTPUT: RETVAL + +char * +rxvt_term::XKeysymToString (int sym) + CODE: + RETVAL = XKeysymToString (sym); + OUTPUT: RETVAL + +int +rxvt_term::XKeysymToKeycode (int sym) + CODE: + RETVAL = XKeysymToKeycode (THIS->dpy, sym); + OUTPUT: RETVAL + +int +rxvt_term::XKeycodeToKeysym (int code, int index) + CODE: + RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); + OUTPUT: RETVAL + +int rxvt_term::strwidth (SV *str) CODE: { wchar_t *wstr = sv2wcs (str); rxvt_push_locale (THIS->locale); - RETVAL = wcswidth (wstr, wcslen (wstr)); + RETVAL = 0; + for (wchar_t *wc = wstr; *wc; wc++) + { + int w = WCWIDTH (*wc); + + if (w) + RETVAL += max (w, 1); + } rxvt_pop_locale (); free (wstr); @@ -1132,6 +1174,13 @@ OUTPUT: RETVAL +char * +rxvt_term::locale () + CODE: + RETVAL = THIS->locale; + OUTPUT: + RETVAL + #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) #define TERM_OFFSET_width TERM_OFFSET(width)