… | |
… | |
535 | XEvent *xe = va_arg (ap, XEvent *); |
535 | XEvent *xe = va_arg (ap, XEvent *); |
536 | HV *hv = newHV (); |
536 | HV *hv = newHV (); |
537 | |
537 | |
538 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
538 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
539 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
539 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
|
|
540 | # define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) |
540 | # undef set |
541 | # undef set |
541 | |
542 | |
542 | setiv (type, xe->type); |
543 | setiv (type, xe->type); |
543 | setiv (send_event, xe->xany.send_event); |
544 | setiv (send_event, xe->xany.send_event); |
544 | setiv (serial, xe->xany.serial); |
545 | setiv (serial, xe->xany.serial); |
… | |
… | |
548 | case KeyPress: |
549 | case KeyPress: |
549 | case KeyRelease: |
550 | case KeyRelease: |
550 | case ButtonPress: |
551 | case ButtonPress: |
551 | case ButtonRelease: |
552 | case ButtonRelease: |
552 | case MotionNotify: |
553 | case MotionNotify: |
|
|
554 | setuv (window, xe->xmotion.window); |
|
|
555 | setuv (root, xe->xmotion.root); |
|
|
556 | setuv (subwindow, xe->xmotion.subwindow); |
553 | setiv (time, xe->xmotion.time); |
557 | setuv (time, xe->xmotion.time); |
554 | setiv (x, xe->xmotion.x); |
558 | setiv (x, xe->xmotion.x); |
555 | setiv (y, xe->xmotion.y); |
559 | setiv (y, xe->xmotion.y); |
556 | setiv (row, xe->xmotion.y / term->fheight); |
560 | setiv (row, xe->xmotion.y / term->fheight); |
557 | setiv (col, xe->xmotion.x / term->fwidth); |
561 | setiv (col, xe->xmotion.x / term->fwidth); |
558 | setiv (x_root, xe->xmotion.x_root); |
562 | setiv (x_root, xe->xmotion.x_root); |
559 | setiv (y_root, xe->xmotion.y_root); |
563 | setiv (y_root, xe->xmotion.y_root); |
560 | setiv (state, xe->xmotion.state); |
564 | setuv (state, xe->xmotion.state); |
|
|
565 | |
|
|
566 | switch (xe->type) |
|
|
567 | { |
|
|
568 | case KeyPress: |
|
|
569 | case KeyRelease: |
|
|
570 | setuv (keycode, xe->xkey.keycode); |
|
|
571 | break; |
|
|
572 | |
|
|
573 | case ButtonPress: |
|
|
574 | case ButtonRelease: |
|
|
575 | setuv (button, xe->xbutton.button); |
|
|
576 | break; |
|
|
577 | |
|
|
578 | case MotionNotify: |
|
|
579 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
580 | break; |
|
|
581 | } |
|
|
582 | |
561 | break; |
583 | break; |
562 | } |
|
|
563 | |
584 | |
|
|
585 | case MapNotify: |
|
|
586 | case UnmapNotify: |
|
|
587 | case ConfigureNotify: |
|
|
588 | setuv (event, xe->xconfigure.event); |
|
|
589 | setuv (window, xe->xconfigure.window); |
|
|
590 | |
564 | switch (xe->type) |
591 | switch (xe->type) |
565 | { |
592 | { |
566 | case KeyPress: |
593 | case ConfigureNotify: |
567 | case KeyRelease: |
594 | setiv (x, xe->xconfigure.x); |
568 | setiv (keycode, xe->xkey.keycode); |
595 | setiv (y, xe->xconfigure.y); |
|
|
596 | setiv (width, xe->xconfigure.width); |
|
|
597 | setiv (height, xe->xconfigure.height); |
|
|
598 | setuv (above, xe->xconfigure.above); |
569 | break; |
599 | break; |
570 | |
|
|
571 | case ButtonPress: |
|
|
572 | case ButtonRelease: |
|
|
573 | setiv (button, xe->xbutton.button); |
|
|
574 | break; |
600 | } |
575 | |
601 | |
576 | case MotionNotify: |
|
|
577 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
578 | break; |
602 | break; |
579 | } |
603 | } |
580 | |
604 | |
581 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
605 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
582 | } |
606 | } |
… | |
… | |
1512 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1536 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1513 | } |
1537 | } |
1514 | |
1538 | |
1515 | if (items == 3) |
1539 | if (items == 3) |
1516 | { |
1540 | { |
|
|
1541 | rc.row = SvIV (ST (1)); |
|
|
1542 | rc.col = SvIV (ST (2)); |
|
|
1543 | |
|
|
1544 | if (ix == 2 && rc.col == 0) |
|
|
1545 | { |
|
|
1546 | rc.row--; |
|
|
1547 | rc.col = THIS->ncol; |
|
|
1548 | } |
|
|
1549 | |
|
|
1550 | clamp_it (rc.col, 0, THIS->ncol); |
1517 | rc.row = clamp (SvIV (ST (1)), THIS->top_row, THIS->nrow - 1); |
1551 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1518 | rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
|
|
1519 | |
1552 | |
1520 | if (ix) |
1553 | if (ix) |
1521 | THIS->want_refresh = 1; |
1554 | THIS->want_refresh = 1; |
1522 | } |
1555 | } |
1523 | } |
1556 | } |