… | |
… | |
28 | #include "rxvt.h" /* NECESSARY */ |
28 | #include "rxvt.h" /* NECESSARY */ |
29 | |
29 | |
30 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
30 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
31 | |
31 | |
32 | #include <inttypes.h> |
32 | #include <inttypes.h> |
33 | #include <wchar.h> |
|
|
34 | |
33 | |
35 | #include "salloc.C" // HACK, should be a seperate compile! |
34 | #include "salloc.C" // HACK, should be a seperate compile! |
36 | |
35 | |
37 | inline void fill_text (text_t *start, text_t value, int len) |
36 | inline void fill_text (text_t *start, text_t value, int len) |
38 | { |
37 | { |
… | |
… | |
334 | scr_scroll_text (0, (int)nrow - 1, -k, 1); |
333 | scr_scroll_text (0, (int)nrow - 1, -k, 1); |
335 | screen.cur.row += k; |
334 | screen.cur.row += k; |
336 | screen.s_cur.row += k; |
335 | screen.s_cur.row += k; |
337 | TermWin.nscrolled -= k; |
336 | TermWin.nscrolled -= k; |
338 | } |
337 | } |
|
|
338 | |
339 | #ifdef DEBUG_STRICT |
339 | #ifdef DEBUG_STRICT |
340 | assert (screen.cur.row < TermWin.nrow); |
340 | assert (screen.cur.row < TermWin.nrow); |
341 | #else /* drive with your eyes closed */ |
341 | #else /* drive with your eyes closed */ |
342 | |
|
|
343 | MIN_IT (screen.cur.row, nrow - 1); |
342 | MIN_IT (screen.cur.row, nrow - 1); |
344 | #endif |
343 | #endif |
345 | TermWin.ncol = ncol; // save b/c scr_blank_screen_mem uses this |
344 | TermWin.ncol = ncol; // save b/c scr_blank_screen_mem uses this |
346 | } |
345 | } |
347 | |
346 | |
… | |
… | |
3409 | selection_delimit_word (DN, &selection.end, &selection.end); |
3408 | selection_delimit_word (DN, &selection.end, &selection.end); |
3410 | } |
3409 | } |
3411 | else if (selection.clicks == 3) |
3410 | else if (selection.clicks == 3) |
3412 | { |
3411 | { |
3413 | #if ENABLE_FRILLS |
3412 | #if ENABLE_FRILLS |
3414 | if ((options & Opt_tripleclickwords)) |
3413 | if (options & Opt_tripleclickwords) |
3415 | { |
3414 | { |
3416 | int end_row; |
3415 | int end_row; |
3417 | |
3416 | |
3418 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3417 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3419 | end_row = screen.tlen[selection.mark.row + TermWin.saveLines]; |
3418 | end_row = screen.tlen[selection.mark.row + TermWin.saveLines]; |
… | |
… | |
3437 | if (ROWCOL_IS_AFTER (selection.mark, selection.beg)) |
3436 | if (ROWCOL_IS_AFTER (selection.mark, selection.beg)) |
3438 | selection.mark.col++; |
3437 | selection.mark.col++; |
3439 | |
3438 | |
3440 | selection.beg.col = 0; |
3439 | selection.beg.col = 0; |
3441 | selection.end.col = ncol; |
3440 | selection.end.col = ncol; |
|
|
3441 | |
|
|
3442 | // select a complete logical line |
|
|
3443 | while (selection.beg.row > -TermWin.saveLines |
|
|
3444 | && screen.tlen[selection.beg.row - 1 + TermWin.saveLines] == -1) |
|
|
3445 | selection.beg.row--; |
|
|
3446 | |
|
|
3447 | while (selection.end.row < TermWin.nrow |
|
|
3448 | && screen.tlen[selection.end.row + TermWin.saveLines] == -1) |
|
|
3449 | selection.end.row++; |
3442 | } |
3450 | } |
3443 | } |
3451 | } |
3444 | |
3452 | |
3445 | if (button3 && buttonpress) |
3453 | if (button3 && buttonpress) |
3446 | { /* mark may need to be changed */ |
3454 | { /* mark may need to be changed */ |
… | |
… | |
3526 | */ |
3534 | */ |
3527 | void |
3535 | void |
3528 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) |
3536 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) |
3529 | { |
3537 | { |
3530 | XSelectionEvent ev; |
3538 | XSelectionEvent ev; |
|
|
3539 | dDisp; |
3531 | |
3540 | |
3532 | ev.type = SelectionNotify; |
3541 | ev.type = SelectionNotify; |
3533 | ev.property = None; |
3542 | ev.property = None; |
3534 | ev.display = rq.display; |
3543 | ev.display = rq.display; |
3535 | ev.requestor = rq.requestor; |
3544 | ev.requestor = rq.requestor; |
… | |
… | |
3549 | *target++ = xa[XA_COMPOUND_TEXT]; |
3558 | *target++ = xa[XA_COMPOUND_TEXT]; |
3550 | #if X_HAVE_UTF8_STRING |
3559 | #if X_HAVE_UTF8_STRING |
3551 | *target++ = xa[XA_UTF8_STRING]; |
3560 | *target++ = xa[XA_UTF8_STRING]; |
3552 | #endif |
3561 | #endif |
3553 | |
3562 | |
3554 | XChangeProperty (display->display, rq.requestor, rq.property, XA_ATOM, |
3563 | XChangeProperty (disp, rq.requestor, rq.property, XA_ATOM, |
3555 | 32, PropModeReplace, |
3564 | 32, PropModeReplace, |
3556 | (unsigned char *)target_list, target - target_list); |
3565 | (unsigned char *)target_list, target - target_list); |
3557 | ev.property = rq.property; |
3566 | ev.property = rq.property; |
3558 | } |
3567 | } |
3559 | #if TODO // TODO |
3568 | #if TODO // TODO |
… | |
… | |
3562 | /* TODO: Handle MULTIPLE */ |
3571 | /* TODO: Handle MULTIPLE */ |
3563 | } |
3572 | } |
3564 | #endif |
3573 | #endif |
3565 | else if (rq.target == xa[XA_TIMESTAMP] && selection.text) |
3574 | else if (rq.target == xa[XA_TIMESTAMP] && selection.text) |
3566 | { |
3575 | { |
3567 | XChangeProperty (display->display, rq.requestor, rq.property, rq.target, |
3576 | XChangeProperty (disp, rq.requestor, rq.property, rq.target, |
3568 | 32, PropModeReplace, (unsigned char *)&selection_time, 1); |
3577 | 32, PropModeReplace, (unsigned char *)&selection_time, 1); |
3569 | ev.property = rq.property; |
3578 | ev.property = rq.property; |
3570 | } |
3579 | } |
3571 | else if (rq.target == XA_STRING |
3580 | else if (rq.target == XA_STRING |
3572 | || rq.target == xa[XA_TEXT] |
3581 | || rq.target == xa[XA_TEXT] |
… | |
… | |
3630 | ct.value = (unsigned char *)rxvt_wcstoutf8 (cl, selectlen); |
3639 | ct.value = (unsigned char *)rxvt_wcstoutf8 (cl, selectlen); |
3631 | ct.nitems = strlen ((char *)ct.value); |
3640 | ct.nitems = strlen ((char *)ct.value); |
3632 | } |
3641 | } |
3633 | else |
3642 | else |
3634 | #endif |
3643 | #endif |
3635 | if (XwcTextListToTextProperty (display->display, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) |
3644 | if (XwcTextListToTextProperty (disp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) |
3636 | freect = 1; |
3645 | freect = 1; |
3637 | else |
3646 | else |
3638 | { |
3647 | { |
3639 | /* if we failed to convert then send it raw */ |
3648 | /* if we failed to convert then send it raw */ |
3640 | ct.value = (unsigned char *)cl; |
3649 | ct.value = (unsigned char *)cl; |
3641 | ct.nitems = selectlen; |
3650 | ct.nitems = selectlen; |
3642 | ct.encoding = target; |
3651 | ct.encoding = target; |
3643 | } |
3652 | } |
3644 | |
3653 | |
3645 | XChangeProperty (display->display, rq.requestor, rq.property, |
3654 | XChangeProperty (disp, rq.requestor, rq.property, |
3646 | ct.encoding, 8, PropModeReplace, |
3655 | ct.encoding, 8, PropModeReplace, |
3647 | ct.value, (int)ct.nitems); |
3656 | ct.value, (int)ct.nitems); |
3648 | ev.property = rq.property; |
3657 | ev.property = rq.property; |
3649 | |
3658 | |
3650 | if (freect) |
3659 | if (freect) |
3651 | XFree (ct.value); |
3660 | XFree (ct.value); |
3652 | } |
3661 | } |
3653 | |
3662 | |
3654 | XSendEvent (display->display, rq.requestor, False, 0L, (XEvent *)&ev); |
3663 | XSendEvent (disp, rq.requestor, False, 0L, (XEvent *)&ev); |
3655 | } |
3664 | } |
3656 | |
3665 | |
3657 | /* ------------------------------------------------------------------------- * |
3666 | /* ------------------------------------------------------------------------- * |
3658 | * MOUSE ROUTINES * |
3667 | * MOUSE ROUTINES * |
3659 | * ------------------------------------------------------------------------- */ |
3668 | * ------------------------------------------------------------------------- */ |