Mercurial > MadButterfly
comparison src/X_supp.c @ 545:49f8f57f184a Android_Skia
Preparing for nodejs plugin
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 05 Jun 2010 22:23:57 +0800 |
parents | 0160cdabaa51 |
children | 127499ab2412 |
comparison
equal
deleted
inserted
replaced
544:16f4f8305c8f | 545:49f8f57f184a |
---|---|
45 int w, h; | 45 int w, h; |
46 | 46 |
47 X_kb_info_t kbinfo; | 47 X_kb_info_t kbinfo; |
48 monitor_t monitors[MAX_MONITORS]; | 48 monitor_t monitors[MAX_MONITORS]; |
49 int n_monitor; | 49 int n_monitor; |
50 | |
51 void *nodejs_data; | |
50 | 52 |
51 #ifndef ONLY_MOUSE_MOVE_RAW | 53 #ifndef ONLY_MOUSE_MOVE_RAW |
52 /* States */ | 54 /* States */ |
53 shape_t *last; | 55 shape_t *last; |
54 #endif | 56 #endif |
593 img_ldr = xmb_rt->img_ldr; | 595 img_ldr = xmb_rt->img_ldr; |
594 | 596 |
595 return img_ldr; | 597 return img_ldr; |
596 } | 598 } |
597 | 599 |
598 void X_add_event(void *rt, int type, int fd, mb_eventcb_t f,void *arg) | 600 void X_MB_add_event(void *rt, int type, int fd, mb_eventcb_t f,void *arg) |
599 { | 601 { |
600 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 602 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
601 int i; | 603 int i; |
602 | 604 |
603 for(i=0;i<xmb_rt->n_monitor;i++) { | 605 for(i=0;i<xmb_rt->n_monitor;i++) { |
623 xmb_rt->monitors[i].arg = arg; | 625 xmb_rt->monitors[i].arg = arg; |
624 i++; | 626 i++; |
625 xmb_rt->n_monitor=i; | 627 xmb_rt->n_monitor=i; |
626 } | 628 } |
627 | 629 |
628 void X_remove_event(void *rt, int type, int fd) | 630 void X_MB_remove_event(void *rt, int type, int fd) |
629 { | 631 { |
630 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 632 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
631 int i; | 633 int i; |
632 for(i=0;i<xmb_rt->n_monitor;i++) { | 634 for(i=0;i<xmb_rt->n_monitor;i++) { |
633 if (xmb_rt->monitors[i].type == type && xmb_rt->monitors[i].fd == fd) { | 635 if (xmb_rt->monitors[i].type == type && xmb_rt->monitors[i].fd == fd) { |
636 } | 638 } |
637 } | 639 } |
638 } | 640 } |
639 mb_backend_t backend = { X_MB_new, | 641 mb_backend_t backend = { X_MB_new, |
640 X_MB_free, | 642 X_MB_free, |
641 X_add_event, | 643 X_MB_add_event, |
642 X_remove_event, | 644 X_MB_remove_event, |
643 X_MB_handle_connection, | 645 X_MB_handle_connection, |
644 X_MB_kbevents, | 646 X_MB_kbevents, |
645 X_MB_rdman, | 647 X_MB_rdman, |
646 X_MB_tman, | 648 X_MB_tman, |
647 X_MB_ob_factory, | 649 X_MB_ob_factory, |
648 X_MB_img_ldr | 650 X_MB_img_ldr |
649 }; | 651 }; |
650 | 652 /*! \defgroup x_supp_nodejs_sup Export functions for supporting nodejs plugin. |
653 * | |
654 * These functions are for internal using. | |
655 * @{ | |
656 */ | |
657 /*! \brief Exported for nodejs plugin to call handle_x_event. | |
658 */ | |
659 void _X_MB_handle_x_event_for_nodejs(X_MB_runtime_t *rt) { | |
660 handle_x_event(rt); | |
661 } | |
662 | |
663 /*! \brief Get X connect for nodejs plugin. | |
664 */ | |
665 int _X_MB_get_x_conn_for_nodejs(X_MB_runtime_t *rt) { | |
666 return XConnectionNumber(rt->display); | |
667 } | |
668 | |
669 /*! \brief Flush buffer for the X connection of a runtime object. | |
670 */ | |
671 int _X_MB_flush_x_conn_nodejs(X_MB_runtime_t *rt) { | |
672 return XFlush(rt->display); | |
673 } | |
674 | |
675 /*! \brief Keep data for nodejs plugin. | |
676 */ | |
677 void _X_MB_set_data_nodejs(X_MB_runtime_t *rt, void *data) { | |
678 rt->nodejs_data = data; | |
679 } | |
680 | |
681 /*! \brief Get data for nodejs plugin. | |
682 */ | |
683 void *_X_MB_get_data_nodejs(X_MB_runtime_t *rt) { | |
684 return rt->nodejs_data; | |
685 } | |
686 | |
687 /* @} */ |