vt_core.c (271769) | vt_core.c (271952) |
---|---|
1/*- 2 * Copyright (c) 2009, 2013 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Ed Schouten under sponsorship from the 6 * FreeBSD Foundation. 7 * 8 * Portions of this software were developed by Oleksandr Rybalko --- 17 unchanged lines hidden (view full) --- 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009, 2013 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Ed Schouten under sponsorship from the 6 * FreeBSD Foundation. 7 * 8 * Portions of this software were developed by Oleksandr Rybalko --- 17 unchanged lines hidden (view full) --- 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: stable/10/sys/dev/vt/vt_core.c 271769 2014-09-18 14:38:18Z dumbbell $"); | 34__FBSDID("$FreeBSD: stable/10/sys/dev/vt/vt_core.c 271952 2014-09-22 10:21:08Z ray $"); |
35 36#include "opt_compat.h" 37 38#include <sys/param.h> 39#include <sys/consio.h> 40#include <sys/eventhandler.h> 41#include <sys/fbio.h> 42#include <sys/kbio.h> 43#include <sys/kdb.h> 44#include <sys/kernel.h> 45#include <sys/lock.h> 46#include <sys/malloc.h> 47#include <sys/mutex.h> | 35 36#include "opt_compat.h" 37 38#include <sys/param.h> 39#include <sys/consio.h> 40#include <sys/eventhandler.h> 41#include <sys/fbio.h> 42#include <sys/kbio.h> 43#include <sys/kdb.h> 44#include <sys/kernel.h> 45#include <sys/lock.h> 46#include <sys/malloc.h> 47#include <sys/mutex.h> |
48#include <sys/power.h> |
|
48#include <sys/priv.h> 49#include <sys/proc.h> 50#include <sys/reboot.h> 51#include <sys/systm.h> 52#include <sys/terminal.h> 53 54#include <dev/kbd/kbdreg.h> 55#include <dev/vt/vt.h> --- 62 unchanged lines hidden (view full) --- 118 (vw)->vw_number) 119 120static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, "vt(9) parameters"); 121VT_SYSCTL_INT(enable_altgr, 1, "Enable AltGr key (Do not assume R.Alt as Alt)"); 122VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); 123VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); 124VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); 125 | 49#include <sys/priv.h> 50#include <sys/proc.h> 51#include <sys/reboot.h> 52#include <sys/systm.h> 53#include <sys/terminal.h> 54 55#include <dev/kbd/kbdreg.h> 56#include <dev/vt/vt.h> --- 62 unchanged lines hidden (view full) --- 119 (vw)->vw_number) 120 121static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, "vt(9) parameters"); 122VT_SYSCTL_INT(enable_altgr, 1, "Enable AltGr key (Do not assume R.Alt as Alt)"); 123VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); 124VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); 125VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); 126 |
127/* Allow to disable some keyboard combinations. */ 128VT_SYSCTL_INT(kbd_halt, 1, "Enable halt keyboard combination. " 129 "See kbdmap(5) to configure."); 130VT_SYSCTL_INT(kbd_poweroff, 1, "Enable Power Off keyboard combination. " 131 "See kbdmap(5) to configure."); 132VT_SYSCTL_INT(kbd_reboot, 1, "Enable reboot keyboard combination. " 133 "See kbdmap(5) to configure (typically Ctrl-Alt-Delete)."); 134VT_SYSCTL_INT(kbd_debug, 1, "Enable key combination to enter debugger. " 135 "See kbdmap(5) to configure (typically Ctrl-Alt-Esc)."); 136VT_SYSCTL_INT(kbd_panic, 0, "Enable request to panic. " 137 "See kbdmap(5) to configure."); 138 |
|
126static struct vt_device vt_consdev; 127static unsigned int vt_unit = 0; 128static MALLOC_DEFINE(M_VT, "vt", "vt device"); 129struct vt_device *main_vd = &vt_consdev; 130 131/* Boot logo. */ 132extern unsigned int vt_logo_width; 133extern unsigned int vt_logo_height; --- 10 unchanged lines hidden (view full) --- 144static int signal_vt_acq(struct vt_window *); 145static int finish_vt_rel(struct vt_window *, int, int *); 146static int finish_vt_acq(struct vt_window *); 147static int vt_window_switch(struct vt_window *); 148static int vt_late_window_switch(struct vt_window *); 149static int vt_proc_alive(struct vt_window *); 150static void vt_resize(struct vt_device *); 151static void vt_update_static(void *); | 139static struct vt_device vt_consdev; 140static unsigned int vt_unit = 0; 141static MALLOC_DEFINE(M_VT, "vt", "vt device"); 142struct vt_device *main_vd = &vt_consdev; 143 144/* Boot logo. */ 145extern unsigned int vt_logo_width; 146extern unsigned int vt_logo_height; --- 10 unchanged lines hidden (view full) --- 157static int signal_vt_acq(struct vt_window *); 158static int finish_vt_rel(struct vt_window *, int, int *); 159static int finish_vt_acq(struct vt_window *); 160static int vt_window_switch(struct vt_window *); 161static int vt_late_window_switch(struct vt_window *); 162static int vt_proc_alive(struct vt_window *); 163static void vt_resize(struct vt_device *); 164static void vt_update_static(void *); |
165#ifndef SC_NO_CUTPASTE 166static void vt_mouse_paste(void); 167#endif |
|
152 153SET_DECLARE(vt_drv_set, struct vt_driver); 154 155#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)) 156#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)) 157 158static struct terminal vt_consterm; 159static struct vt_window vt_conswindow; 160static struct vt_device vt_consdev = { 161 .vd_driver = NULL, 162 .vd_softc = NULL, 163 .vd_flags = VDF_INVALID, 164 .vd_windows = { [VT_CONSWINDOW] = &vt_conswindow, }, 165 .vd_curwindow = &vt_conswindow, | 168 169SET_DECLARE(vt_drv_set, struct vt_driver); 170 171#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)) 172#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)) 173 174static struct terminal vt_consterm; 175static struct vt_window vt_conswindow; 176static struct vt_device vt_consdev = { 177 .vd_driver = NULL, 178 .vd_softc = NULL, 179 .vd_flags = VDF_INVALID, 180 .vd_windows = { [VT_CONSWINDOW] = &vt_conswindow, }, 181 .vd_curwindow = &vt_conswindow, |
166 .vd_markedwin = NULL, | |
167 .vd_kbstate = 0, 168 169#ifndef SC_NO_CUTPASTE | 182 .vd_kbstate = 0, 183 184#ifndef SC_NO_CUTPASTE |
185 .vd_pastebuf = { 186 .vpb_buf = NULL, 187 .vpb_bufsz = 0, 188 .vpb_len = 0 189 }, |
|
170 .vd_mcursor = &vt_default_mouse_pointer, 171 .vd_mcursor_fg = TC_WHITE, 172 .vd_mcursor_bg = TC_BLACK, 173#endif 174}; 175static term_char_t vt_constextbuf[(_VTDEFW) * (VBF_DEFAULT_HISTORY_SIZE)]; 176static term_char_t *vt_constextbufrows[VBF_DEFAULT_HISTORY_SIZE]; 177static struct vt_window vt_conswindow = { --- 151 unchanged lines hidden (view full) --- 329 int ret; 330 331 vd = vw->vw_device; 332 curvw = vd->vd_curwindow; 333 334 if (curvw->vw_flags & VWF_VTYLOCK) 335 return (EBUSY); 336 | 190 .vd_mcursor = &vt_default_mouse_pointer, 191 .vd_mcursor_fg = TC_WHITE, 192 .vd_mcursor_bg = TC_BLACK, 193#endif 194}; 195static term_char_t vt_constextbuf[(_VTDEFW) * (VBF_DEFAULT_HISTORY_SIZE)]; 196static term_char_t *vt_constextbufrows[VBF_DEFAULT_HISTORY_SIZE]; 197static struct vt_window vt_conswindow = { --- 151 unchanged lines hidden (view full) --- 349 int ret; 350 351 vd = vw->vw_device; 352 curvw = vd->vd_curwindow; 353 354 if (curvw->vw_flags & VWF_VTYLOCK) 355 return (EBUSY); 356 |
337 /* Ask current process permitions to switch away. */ | 357 /* Ask current process permission to switch away. */ |
338 if (curvw->vw_smode.mode == VT_PROCESS) { 339 DPRINTF(30, "%s: VT_PROCESS ", __func__); 340 if (vt_proc_alive(curvw) == FALSE) { 341 DPRINTF(30, "Dead. Cleaning."); 342 /* Dead */ 343 } else { 344 DPRINTF(30, "%s: Signaling process.\n", __func__); 345 /* Alive, try to ask him. */ --- 133 unchanged lines hidden (view full) --- 479 vt_resume_flush_timer(vw->vw_device, 0); 480} 481 482static int 483vt_machine_kbdevent(int c) 484{ 485 486 switch (c) { | 358 if (curvw->vw_smode.mode == VT_PROCESS) { 359 DPRINTF(30, "%s: VT_PROCESS ", __func__); 360 if (vt_proc_alive(curvw) == FALSE) { 361 DPRINTF(30, "Dead. Cleaning."); 362 /* Dead */ 363 } else { 364 DPRINTF(30, "%s: Signaling process.\n", __func__); 365 /* Alive, try to ask him. */ --- 133 unchanged lines hidden (view full) --- 499 vt_resume_flush_timer(vw->vw_device, 0); 500} 501 502static int 503vt_machine_kbdevent(int c) 504{ 505 506 switch (c) { |
487 case SPCLKEY | DBG: 488 kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); | 507 case SPCLKEY | DBG: /* kbdmap(5) keyword `debug`. */ 508 if (vt_kbd_debug) 509 kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); |
489 return (1); | 510 return (1); |
490 case SPCLKEY | RBT: 491 /* XXX: Make this configurable! */ 492 shutdown_nice(0); | 511 case SPCLKEY | HALT: /* kbdmap(5) keyword `halt`. */ 512 if (vt_kbd_halt) 513 shutdown_nice(RB_HALT); |
493 return (1); | 514 return (1); |
494 case SPCLKEY | HALT: 495 shutdown_nice(RB_HALT); | 515 case SPCLKEY | PASTE: /* kbdmap(5) keyword `paste`. */ 516#ifndef SC_NO_CUTPASTE 517 /* Insert text from cut-paste buffer. */ 518 vt_mouse_paste(); 519#endif 520 break; 521 case SPCLKEY | PDWN: /* kbdmap(5) keyword `pdwn`. */ 522 if (vt_kbd_poweroff) 523 shutdown_nice(RB_HALT|RB_POWEROFF); |
496 return (1); | 524 return (1); |
497 case SPCLKEY | PDWN: 498 shutdown_nice(RB_HALT|RB_POWEROFF); | 525 case SPCLKEY | PNC: /* kbdmap(5) keyword `panic`. */ 526 /* 527 * Request to immediate panic if sysctl 528 * kern.vt.enable_panic_key allow it. 529 */ 530 if (vt_kbd_panic) 531 panic("Forced by the panic key"); |
499 return (1); | 532 return (1); |
533 case SPCLKEY | RBT: /* kbdmap(5) keyword `boot`. */ 534 if (vt_kbd_reboot) 535 shutdown_nice(RB_AUTOBOOT); 536 return (1); 537 case SPCLKEY | SPSC: /* kbdmap(5) keyword `spsc`. */ 538 /* Force activatation/deactivation of the screen saver. */ 539 /* TODO */ 540 return (1); 541 case SPCLKEY | STBY: /* XXX Not present in kbdcontrol parser. */ 542 /* Put machine into Stand-By mode. */ 543 power_pm_suspend(POWER_SLEEP_STATE_STANDBY); 544 return (1); 545 case SPCLKEY | SUSP: /* kbdmap(5) keyword `susp`. */ 546 /* Suspend machine. */ 547 power_pm_suspend(POWER_SLEEP_STATE_SUSPEND); 548 return (1); |
|
500 }; 501 502 return (0); 503} 504 505static void 506vt_scrollmode_kbdevent(struct vt_window *vw, int c, int console) 507{ --- 98 unchanged lines hidden (view full) --- 606 if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { 607 vw = vd->vd_windows[c - F_SCR]; 608 if (vw != NULL) 609 vt_proc_window_switch(vw); 610 return (0); 611 } 612 613 switch (c) { | 549 }; 550 551 return (0); 552} 553 554static void 555vt_scrollmode_kbdevent(struct vt_window *vw, int c, int console) 556{ --- 98 unchanged lines hidden (view full) --- 655 if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { 656 vw = vd->vd_windows[c - F_SCR]; 657 if (vw != NULL) 658 vt_proc_window_switch(vw); 659 return (0); 660 } 661 662 switch (c) { |
663 case NEXT: 664 /* Switch to next VT. */ 665 c = (vw->vw_number + 1) % VT_MAXWINDOWS; 666 vw = vd->vd_windows[c]; 667 if (vw != NULL) 668 vt_proc_window_switch(vw); 669 return (0); 670 case PREV: 671 /* Switch to previous VT. */ 672 c = (vw->vw_number - 1) % VT_MAXWINDOWS; 673 vw = vd->vd_windows[c]; 674 if (vw != NULL) 675 vt_proc_window_switch(vw); 676 return (0); |
|
614 case SLK: { 615 616 kbdd_ioctl(kbd, KDGKBSTATE, (caddr_t)&state); 617 VT_LOCK(vd); 618 if (state & SLKED) { 619 /* Turn scrolling on. */ 620 vw->vw_flags |= VWF_SCROLL; 621 VTBUF_SLCK_ENABLE(&vw->vw_buf); --- 893 unchanged lines hidden (view full) --- 1515 /* Avoid overflow. */ 1516 x = MIN(x, 255 - '!'); 1517 y = MIN(y, 255 - '!'); 1518 1519 mouseb[3] = ' ' + button; 1520 mouseb[4] = '!' + x; 1521 mouseb[5] = '!' + y; 1522 | 677 case SLK: { 678 679 kbdd_ioctl(kbd, KDGKBSTATE, (caddr_t)&state); 680 VT_LOCK(vd); 681 if (state & SLKED) { 682 /* Turn scrolling on. */ 683 vw->vw_flags |= VWF_SCROLL; 684 VTBUF_SLCK_ENABLE(&vw->vw_buf); --- 893 unchanged lines hidden (view full) --- 1578 /* Avoid overflow. */ 1579 x = MIN(x, 255 - '!'); 1580 y = MIN(y, 255 - '!'); 1581 1582 mouseb[3] = ' ' + button; 1583 mouseb[4] = '!' + x; 1584 mouseb[5] = '!' + y; 1585 |
1523 for (i = 0; i < sizeof(mouseb); i++ ) | 1586 for (i = 0; i < sizeof(mouseb); i++) |
1524 terminal_input_char(vw->vw_terminal, mouseb[i]); 1525} 1526 1527static void 1528vt_mouse_terminput(struct vt_device *vd, int type, int x, int y, int event, 1529 int cnt) 1530{ 1531 --- 21 unchanged lines hidden (view full) --- 1553 /* Scroll down. */ 1554 sc_mouse_input_button(vd, 65); 1555 } 1556 break; 1557#endif 1558 } 1559} 1560 | 1587 terminal_input_char(vw->vw_terminal, mouseb[i]); 1588} 1589 1590static void 1591vt_mouse_terminput(struct vt_device *vd, int type, int x, int y, int event, 1592 int cnt) 1593{ 1594 --- 21 unchanged lines hidden (view full) --- 1616 /* Scroll down. */ 1617 sc_mouse_input_button(vd, 65); 1618 } 1619 break; 1620#endif 1621 } 1622} 1623 |
1624static void 1625vt_mouse_paste() 1626{ 1627 term_char_t *buf; 1628 int i, len; 1629 1630 len = VD_PASTEBUFLEN(main_vd); 1631 buf = VD_PASTEBUF(main_vd); 1632 len /= sizeof(term_char_t); 1633 for (i = 0; i < len; i++) { 1634 if (buf[i] == '\0') 1635 continue; 1636 terminal_input_char(main_vd->vd_curwindow->vw_terminal, 1637 buf[i]); 1638 } 1639} 1640 |
|
1561void 1562vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel) 1563{ 1564 struct vt_device *vd; 1565 struct vt_window *vw; 1566 struct vt_font *vf; 1567 term_pos_t size; | 1641void 1642vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel) 1643{ 1644 struct vt_device *vd; 1645 struct vt_window *vw; 1646 struct vt_font *vf; 1647 term_pos_t size; |
1568 term_char_t *buf; 1569 int i, len, mark; | 1648 int len, mark; |
1570 1571 vd = main_vd; 1572 vw = vd->vd_curwindow; 1573 vf = vw->vw_font; 1574 mark = 0; 1575 1576 if (vw->vw_flags & (VWF_MOUSE_HIDE | VWF_GRAPHICS)) 1577 /* --- 26 unchanged lines hidden (view full) --- 1604 /* Apply limits. */ 1605 x = MAX(x, 0); 1606 y = MAX(y, 0); 1607 x = MIN(x, (size.tp_col * vf->vf_width) - 1); 1608 y = MIN(y, (size.tp_row * vf->vf_height) - 1); 1609 1610 vd->vd_mx = x; 1611 vd->vd_my = y; | 1649 1650 vd = main_vd; 1651 vw = vd->vd_curwindow; 1652 vf = vw->vw_font; 1653 mark = 0; 1654 1655 if (vw->vw_flags & (VWF_MOUSE_HIDE | VWF_GRAPHICS)) 1656 /* --- 26 unchanged lines hidden (view full) --- 1683 /* Apply limits. */ 1684 x = MAX(x, 0); 1685 y = MAX(y, 0); 1686 x = MIN(x, (size.tp_col * vf->vf_width) - 1); 1687 y = MIN(y, (size.tp_row * vf->vf_height) - 1); 1688 1689 vd->vd_mx = x; 1690 vd->vd_my = y; |
1612 if ((vd->vd_mstate & MOUSE_BUTTON1DOWN) && 1613 (vtbuf_set_mark(&vw->vw_buf, VTB_MARK_MOVE, 1614 vd->vd_mx / vf->vf_width, 1615 vd->vd_my / vf->vf_height) == 1)) { | 1691 if (vd->vd_mstate & MOUSE_BUTTON1DOWN) 1692 vtbuf_set_mark(&vw->vw_buf, VTB_MARK_MOVE, 1693 vd->vd_mx / vf->vf_width, 1694 vd->vd_my / vf->vf_height); |
1616 | 1695 |
1617 /* 1618 * We have something marked to copy, so update pointer 1619 * to window with selection. 1620 */ 1621 vd->vd_markedwin = vw; 1622 } 1623 | |
1624 vt_resume_flush_timer(vw->vw_device, 0); 1625 return; /* Done */ 1626 case MOUSE_BUTTON_EVENT: 1627 /* Buttons */ 1628 break; 1629 default: 1630 return; /* Done */ 1631 } --- 15 unchanged lines hidden (view full) --- 1647 break; 1648 } 1649 break; 1650 case VT_MOUSE_PASTEBUTTON: 1651 switch (cnt) { 1652 case 0: /* up */ 1653 break; 1654 default: | 1696 vt_resume_flush_timer(vw->vw_device, 0); 1697 return; /* Done */ 1698 case MOUSE_BUTTON_EVENT: 1699 /* Buttons */ 1700 break; 1701 default: 1702 return; /* Done */ 1703 } --- 15 unchanged lines hidden (view full) --- 1719 break; 1720 } 1721 break; 1722 case VT_MOUSE_PASTEBUTTON: 1723 switch (cnt) { 1724 case 0: /* up */ 1725 break; 1726 default: |
1655 if (vd->vd_markedwin == NULL) 1656 return; 1657 /* Get current selecton size in bytes. */ 1658 len = vtbuf_get_marked_len(&vd->vd_markedwin->vw_buf); 1659 if (len <= 0) 1660 return; 1661 1662 buf = malloc(len, M_VT, M_WAITOK | M_ZERO); 1663 /* Request cupy/paste buffer data, no more than `len' */ 1664 vtbuf_extract_marked(&vd->vd_markedwin->vw_buf, buf, 1665 len); 1666 1667 len /= sizeof(term_char_t); 1668 for (i = 0; i < len; i++ ) { 1669 if (buf[i] == '\0') 1670 continue; 1671 terminal_input_char(vw->vw_terminal, buf[i]); 1672 } 1673 1674 /* Done, so cleanup. */ 1675 free(buf, M_VT); | 1727 vt_mouse_paste(); |
1676 break; 1677 } 1678 return; /* Done */ 1679 case VT_MOUSE_EXTENDBUTTON: 1680 switch (cnt) { 1681 case 0: /* up */ 1682 if (!(vd->vd_mstate & MOUSE_BUTTON1DOWN)) 1683 mark = VTB_MARK_EXTEND; --- 16 unchanged lines hidden (view full) --- 1700 vd->vd_mstate &= ~event; 1701 1702 if (vtbuf_set_mark(&vw->vw_buf, mark, vd->vd_mx / vf->vf_width, 1703 vd->vd_my / vf->vf_height) == 1) { 1704 /* 1705 * We have something marked to copy, so update pointer to 1706 * window with selection. 1707 */ | 1728 break; 1729 } 1730 return; /* Done */ 1731 case VT_MOUSE_EXTENDBUTTON: 1732 switch (cnt) { 1733 case 0: /* up */ 1734 if (!(vd->vd_mstate & MOUSE_BUTTON1DOWN)) 1735 mark = VTB_MARK_EXTEND; --- 16 unchanged lines hidden (view full) --- 1752 vd->vd_mstate &= ~event; 1753 1754 if (vtbuf_set_mark(&vw->vw_buf, mark, vd->vd_mx / vf->vf_width, 1755 vd->vd_my / vf->vf_height) == 1) { 1756 /* 1757 * We have something marked to copy, so update pointer to 1758 * window with selection. 1759 */ |
1708 vd->vd_markedwin = vw; | |
1709 vt_resume_flush_timer(vw->vw_device, 0); | 1760 vt_resume_flush_timer(vw->vw_device, 0); |
1761 1762 switch (mark) { 1763 case VTB_MARK_END: 1764 case VTB_MARK_WORD: 1765 case VTB_MARK_ROW: 1766 case VTB_MARK_EXTEND: 1767 break; 1768 default: 1769 /* Other types of mark do not require to copy data. */ 1770 return; 1771 } 1772 1773 /* Get current selection size in bytes. */ 1774 len = vtbuf_get_marked_len(&vw->vw_buf); 1775 if (len <= 0) 1776 return; 1777 1778 /* Reallocate buffer only if old one is too small. */ 1779 if (len > VD_PASTEBUFSZ(vd)) { 1780 VD_PASTEBUF(vd) = realloc(VD_PASTEBUF(vd), len, M_VT, 1781 M_WAITOK | M_ZERO); 1782 /* Update buffer size. */ 1783 VD_PASTEBUFSZ(vd) = len; 1784 } 1785 /* Request copy/paste buffer data, no more than `len' */ 1786 vtbuf_extract_marked(&vw->vw_buf, VD_PASTEBUF(vd), 1787 VD_PASTEBUFSZ(vd)); 1788 1789 VD_PASTEBUFLEN(vd) = len; 1790 1791 /* XXX VD_PASTEBUF(vd) have to be freed on shutdown/unload. */ |
|
1710 } 1711} 1712 1713void 1714vt_mouse_state(int show) 1715{ 1716 struct vt_device *vd; 1717 struct vt_window *vw; --- 676 unchanged lines hidden --- | 1792 } 1793} 1794 1795void 1796vt_mouse_state(int show) 1797{ 1798 struct vt_device *vd; 1799 struct vt_window *vw; --- 676 unchanged lines hidden --- |