ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvttoolkit.C
(Generate patch)

Comparing rxvt-unicode/src/rxvttoolkit.C (file contents):
Revision 1.116 by sf-exg, Fri Feb 11 11:26:30 2011 UTC vs.
Revision 1.119 by root, Mon Feb 21 07:12:03 2011 UTC

892 lerp (c.a, to.a, percent) 892 lerp (c.a, to.a, percent)
893 ) 893 )
894 ); 894 );
895} 895}
896 896
897rxvt_selection::rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, sel_cb cb, void *ptr) 897rxvt_selection::rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term, void *cb_sv)
898: display (disp), request_time (tm), request_win (win), request_prop (prop), request_cb (cb), user_data (ptr) 898: display (disp), request_time (tm), request_win (win), request_prop (prop), term (term), cb_sv (cb_sv)
899{ 899{
900 assert (selnum >= Sel_Primary && selnum <= Sel_Clipboard); 900 assert (selnum >= Sel_Primary && selnum <= Sel_Clipboard);
901 901
902 timer_ev.set<rxvt_selection, &rxvt_selection::timer_cb> (this); 902 timer_ev.set<rxvt_selection, &rxvt_selection::timer_cb> (this);
903 timer_ev.repeat = 10.; 903 timer_ev.repeat = 10.;
904 x_ev.set<rxvt_selection, &rxvt_selection::x_cb> (this); 904 x_ev.set<rxvt_selection, &rxvt_selection::x_cb> (this);
905 905
906 incr_buf = 0; 906 incr_buf = 0;
907 incr_buf_size = incr_buf_fill = 0; 907 incr_buf_size = incr_buf_fill = 0;
908 selection_wait = Sel_normal; 908 selection_wait = Sel_normal;
909 selection_type = selnum;
910}
911
912void
913rxvt_selection::run ()
914{
915 int selnum = selection_type;
909 916
910#if X_HAVE_UTF8_STRING 917#if X_HAVE_UTF8_STRING
911 selection_type = Sel_UTF8String; 918 selection_type = Sel_UTF8String;
912 if (request (display->xa[XA_UTF8_STRING], selnum)) 919 if (request (display->xa[XA_UTF8_STRING], selnum))
913 return; 920 return;
925{ 932{
926 stop (); 933 stop ();
927} 934}
928 935
929void 936void
937rxvt_selection::finish (char *data, unsigned int len)
938{
939 if (term)
940 {
941 if (data)
942 term->paste (data, len);
943
944 term->selection_req = 0;
945 delete this;
946 }
947#if ENABLE_PERL
948 else
949 {
950 stop ();
951 abort (); //TODO
952 }
953#endif
954}
955
956void
930rxvt_selection::stop () 957rxvt_selection::stop ()
931{ 958{
932 free (incr_buf); 959 free (incr_buf);
933 incr_buf = 0; 960 incr_buf = 0;
934 timer_ev.stop (); 961 timer_ev.stop ();
1105bailout: 1132bailout:
1106 XFree (ct.value); 1133 XFree (ct.value);
1107 1134
1108 if (selection_wait == Sel_normal) 1135 if (selection_wait == Sel_normal)
1109 { 1136 {
1110 stop (); 1137 finish (data, data_len);
1111 request_cb (data, data_len, this, user_data);
1112 free (data); 1138 free (data);
1113 } 1139 }
1114} 1140}
1115 1141
1116void 1142void
1117rxvt_selection::timer_cb (ev::timer &w, int revents) 1143rxvt_selection::timer_cb (ev::timer &w, int revents)
1118{ 1144{
1119 if (selection_wait == Sel_incr) 1145 if (selection_wait == Sel_incr)
1120 rxvt_warn ("data loss: timeout on INCR selection paste, ignoring.\n"); 1146 rxvt_warn ("data loss: timeout on INCR selection paste, ignoring.\n");
1121 1147
1122 stop (); 1148 finish ();
1123 request_cb (NULL, 0, this, user_data);
1124} 1149}
1125 1150
1126void 1151void
1127rxvt_selection::x_cb (XEvent &xev) 1152rxvt_selection::x_cb (XEvent &xev)
1128{ 1153{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines