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

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.400 by sf-exg, Tue Jun 28 21:56:17 2016 UTC vs.
Revision 1.403 by root, Thu Jun 17 00:49:20 2021 UTC

59rxvt_t rxvt_current_term; 59rxvt_t rxvt_current_term;
60 60
61static char curlocale[128], savelocale[128]; 61static char curlocale[128], savelocale[128];
62 62
63bool 63bool
64rxvt_set_locale (const char *locale) NOTHROW 64rxvt_set_locale (const char *locale) noexcept
65{ 65{
66 int size = strlen (locale) + 1; 66 int size = strlen (locale) + 1;
67 67
68 if (size > sizeof (curlocale)) 68 if (size > sizeof (curlocale))
69 rxvt_fatal ("locale string too long, aborting.\n"); 69 rxvt_fatal ("locale string too long, aborting.\n");
75 setlocale (LC_CTYPE, curlocale); 75 setlocale (LC_CTYPE, curlocale);
76 return true; 76 return true;
77} 77}
78 78
79void 79void
80rxvt_push_locale (const char *locale) NOTHROW 80rxvt_push_locale (const char *locale) noexcept
81{ 81{
82 strcpy (savelocale, curlocale); 82 strcpy (savelocale, curlocale);
83 rxvt_set_locale (locale); 83 rxvt_set_locale (locale);
84} 84}
85 85
86void 86void
87rxvt_pop_locale () NOTHROW 87rxvt_pop_locale () noexcept
88{ 88{
89 rxvt_set_locale (savelocale); 89 rxvt_set_locale (savelocale);
90} 90}
91 91
92#if ENABLE_COMBINING 92#if ENABLE_COMBINING
124 v.push_back (compose_char (c1, c2)); 124 v.push_back (compose_char (c1, c2));
125 125
126 return v.size () - 1 + COMPOSE_LO; 126 return v.size () - 1 + COMPOSE_LO;
127} 127}
128 128
129template<typename T>
129int rxvt_composite_vec::expand (unicode_t c, wchar_t *r) 130int rxvt_composite_vec::expand (unicode_t c, T *r)
130{ 131{
131 compose_char *cc = (*this)[c]; 132 compose_char *cc = (*this)[c];
132 133
133 if (!cc) 134 if (!cc)
134 { 135 {
145 len++; 146 len++;
146 if (r) *r++ = cc->c2; 147 if (r) *r++ = cc->c2;
147 } 148 }
148 149
149 return len; 150 return len;
150
151} 151}
152
153template int rxvt_composite_vec::expand<text_t> (unicode_t c, text_t *);
154template int rxvt_composite_vec::expand<wchar_t> (unicode_t c, wchar_t *);
152#endif 155#endif
153 156
154rxvt_term::rxvt_term () 157rxvt_term::rxvt_term ()
155{ 158{
156#if HAVE_BG_PIXMAP
157 update_background_ev.set<rxvt_term, &rxvt_term::update_background_cb> (this);
158#endif
159#ifdef CURSOR_BLINK 159#ifdef CURSOR_BLINK
160 cursor_blink_ev.set <rxvt_term, &rxvt_term::cursor_blink_cb> (this); cursor_blink_ev.set (0., CURSOR_BLINK_INTERVAL); 160 cursor_blink_ev.set <rxvt_term, &rxvt_term::cursor_blink_cb> (this); cursor_blink_ev.set (0., CURSOR_BLINK_INTERVAL);
161#endif 161#endif
162#ifdef TEXT_BLINK 162#ifdef TEXT_BLINK
163 text_blink_ev.set <rxvt_term, &rxvt_term::text_blink_cb> (this); text_blink_ev.set (0., TEXT_BLINK_INTERVAL); 163 text_blink_ev.set <rxvt_term, &rxvt_term::text_blink_cb> (this); text_blink_ev.set (0., TEXT_BLINK_INTERVAL);
169 sel_scroll_ev.set <rxvt_term, &rxvt_term::sel_scroll_cb> (this); 169 sel_scroll_ev.set <rxvt_term, &rxvt_term::sel_scroll_cb> (this);
170#endif 170#endif
171#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 171#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
172 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); 172 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this);
173#endif 173#endif
174#if BG_IMAGE_FROM_ROOT || ENABLE_PERL 174#if ENABLE_PERL
175 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this), 175 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this),
176#endif 176#endif
177 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), 177 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this),
178#if USE_XIM 178#if USE_XIM
179 im_ev.set <rxvt_term, &rxvt_term::im_cb> (this), 179 im_ev.set <rxvt_term, &rxvt_term::im_cb> (this),
222 for (int i = RS_styleCount; --i; ) 222 for (int i = RS_styleCount; --i; )
223 if (fontset[i] != fontset[0]) 223 if (fontset[i] != fontset[0])
224 delete fontset[i]; 224 delete fontset[i];
225#endif 225#endif
226 delete fontset[0]; 226 delete fontset[0];
227
228#ifdef HAVE_BG_PIXMAP
229 bg_destroy ();
230#endif
231 227
232#if HAVE_IMG 228#if HAVE_IMG
233 delete bg_img; 229 delete bg_img;
234#endif 230#endif
235 231
327 { 323 {
328#if USE_XIM 324#if USE_XIM
329 im_ev.stop (display); 325 im_ev.stop (display);
330#endif 326#endif
331 scrollbar_ev.stop (display); 327 scrollbar_ev.stop (display);
332#if BG_IMAGE_FROM_ROOT || ENABLE_PERL 328#if ENABLE_PERL
333 rootwin_ev.stop (display); 329 rootwin_ev.stop (display);
334#endif 330#endif
335 termwin_ev.stop (display); 331 termwin_ev.stop (display);
336 vt_ev.stop (display); 332 vt_ev.stop (display);
337 } 333 }
364 360
365 delete this; 361 delete this;
366} 362}
367 363
368void 364void
369rxvt_term::set_option (uint8_t opt, bool set) NOTHROW 365rxvt_term::set_option (uint8_t opt, bool set) noexcept
370{ 366{
371 if (!opt) 367 if (!opt)
372 return; 368 return;
373 369
374 uint8_t mask = 1 << (opt & 7); 370 uint8_t mask = 1 << (opt & 7);
1022 1018
1023 for (i = Color_Black; i <= Color_White; i++) 1019 for (i = Color_Black; i <= Color_White; i++)
1024 if (pix_colors[Color_bg] == pix_colors[i]) 1020 if (pix_colors[Color_bg] == pix_colors[i])
1025 { 1021 {
1026 sprintf (bstr, "%d", i - Color_Black); 1022 sprintf (bstr, "%d", i - Color_Black);
1027#if BG_IMAGE_FROM_FILE 1023#if HAVE_IMG
1028 xpmb = "default;"; 1024 xpmb = "default;";
1029#endif 1025#endif
1030 break; 1026 break;
1031 } 1027 }
1032 1028
1158 XMoveResizeWindow (dpy, vt, 1154 XMoveResizeWindow (dpy, vt,
1159 window_vt_x, window_vt_y, 1155 window_vt_x, window_vt_y,
1160 vt_width, vt_height); 1156 vt_width, vt_height);
1161 1157
1162 HOOK_INVOKE ((this, HOOK_SIZE_CHANGE, DT_INT, newwidth, DT_INT, newheight, DT_END)); 1158 HOOK_INVOKE ((this, HOOK_SIZE_CHANGE, DT_INT, newwidth, DT_INT, newheight, DT_END));
1163
1164#ifdef HAVE_BG_PIXMAP
1165 if (bg_window_size_sensitive ())
1166 update_background ();
1167#endif
1168 } 1159 }
1169 1160
1170 if (fix_screen || old_height == 0) 1161 if (fix_screen || old_height == 0)
1171 scr_reset (); 1162 scr_reset ();
1172 1163
1705{ 1696{
1706 Window cr; 1697 Window cr;
1707 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr); 1698 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr);
1708} 1699}
1709 1700
1710#ifdef HAVE_BG_PIXMAP
1711
1712void
1713rxvt_term::update_background ()
1714{
1715 if (update_background_ev.is_active ())
1716 return;
1717
1718 ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since);
1719
1720 if (to_wait <= 0.)
1721 bg_render ();
1722 else
1723 update_background_ev.start (to_wait);
1724}
1725
1726void
1727rxvt_term::update_background_cb (ev::timer &w, int revents)
1728{
1729 make_current ();
1730
1731 update_background_ev.stop ();
1732 bg_render ();
1733 refresh_check ();
1734}
1735
1736#endif /* HAVE_BG_PIXMAP */
1737
1738/*----------------------- end-of-file (C source) -----------------------*/ 1701/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines