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.389 by root, Sun Feb 17 00:52:04 2013 UTC vs.
Revision 1.402 by sf-exg, Thu May 13 19:40:19 2021 UTC

11 * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA> 11 * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA>
12 * - extensive modifications 12 * - extensive modifications
13 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> 13 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de>
14 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 14 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
15 * - extensive modifications 15 * - extensive modifications
16 * Copyright (c) 2003-2010 Marc Lehmann <schmorp@schmorp.de> 16 * Copyright (c) 2003-2014 Marc Lehmann <schmorp@schmorp.de>
17 * Copyright (c) 2015 Emanuele Giaquinta <e.giaquinta@glauco.it>
17 * 18 *
18 * This program is free software; you can redistribute it and/or modify 19 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by 20 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or 21 * the Free Software Foundation; either version 3 of the License, or
21 * (at your option) any later version. 22 * (at your option) any later version.
22 * 23 *
23 * This program is distributed in the hope that it will be useful, 24 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58rxvt_t rxvt_current_term; 59rxvt_t rxvt_current_term;
59 60
60static char curlocale[128], savelocale[128]; 61static char curlocale[128], savelocale[128];
61 62
62bool 63bool
63rxvt_set_locale (const char *locale) NOTHROW 64rxvt_set_locale (const char *locale) noexcept
64{ 65{
65 int size = strlen (locale) + 1; 66 int size = strlen (locale) + 1;
66 67
67 if (size > sizeof (curlocale)) 68 if (size > sizeof (curlocale))
68 rxvt_fatal ("locale string too long, aborting.\n"); 69 rxvt_fatal ("locale string too long, aborting.\n");
74 setlocale (LC_CTYPE, curlocale); 75 setlocale (LC_CTYPE, curlocale);
75 return true; 76 return true;
76} 77}
77 78
78void 79void
79rxvt_push_locale (const char *locale) NOTHROW 80rxvt_push_locale (const char *locale) noexcept
80{ 81{
81 strcpy (savelocale, curlocale); 82 strcpy (savelocale, curlocale);
82 rxvt_set_locale (locale); 83 rxvt_set_locale (locale);
83} 84}
84 85
85void 86void
86rxvt_pop_locale () NOTHROW 87rxvt_pop_locale () noexcept
87{ 88{
88 rxvt_set_locale (savelocale); 89 rxvt_set_locale (savelocale);
89} 90}
90 91
91#if ENABLE_COMBINING 92#if ENABLE_COMBINING
150} 151}
151#endif 152#endif
152 153
153rxvt_term::rxvt_term () 154rxvt_term::rxvt_term ()
154{ 155{
155#if HAVE_BG_PIXMAP
156 update_background_ev.set<rxvt_term, &rxvt_term::update_background_cb> (this);
157#endif
158#ifdef CURSOR_BLINK 156#ifdef CURSOR_BLINK
159 cursor_blink_ev.set <rxvt_term, &rxvt_term::cursor_blink_cb> (this); cursor_blink_ev.set (0., CURSOR_BLINK_INTERVAL); 157 cursor_blink_ev.set <rxvt_term, &rxvt_term::cursor_blink_cb> (this); cursor_blink_ev.set (0., CURSOR_BLINK_INTERVAL);
160#endif 158#endif
161#ifdef TEXT_BLINK 159#ifdef TEXT_BLINK
162 text_blink_ev.set <rxvt_term, &rxvt_term::text_blink_cb> (this); text_blink_ev.set (0., TEXT_BLINK_INTERVAL); 160 text_blink_ev.set <rxvt_term, &rxvt_term::text_blink_cb> (this); text_blink_ev.set (0., TEXT_BLINK_INTERVAL);
168 sel_scroll_ev.set <rxvt_term, &rxvt_term::sel_scroll_cb> (this); 166 sel_scroll_ev.set <rxvt_term, &rxvt_term::sel_scroll_cb> (this);
169#endif 167#endif
170#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 168#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
171 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); 169 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this);
172#endif 170#endif
173#if BG_IMAGE_FROM_ROOT || ENABLE_PERL 171#if ENABLE_PERL
174 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this), 172 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this),
175#endif 173#endif
176 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), 174 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this),
177#if USE_XIM 175#if USE_XIM
178 im_ev.set <rxvt_term, &rxvt_term::im_cb> (this), 176 im_ev.set <rxvt_term, &rxvt_term::im_cb> (this),
222 if (fontset[i] != fontset[0]) 220 if (fontset[i] != fontset[0])
223 delete fontset[i]; 221 delete fontset[i];
224#endif 222#endif
225 delete fontset[0]; 223 delete fontset[0];
226 224
227#ifdef HAVE_BG_PIXMAP
228 bg_destroy ();
229#endif
230
231#if HAVE_IMG 225#if HAVE_IMG
232 delete bg_img; 226 delete bg_img;
233#endif 227#endif
234 228
235 if (display) 229 if (display)
254 for (int i = 0; i < TOTAL_COLORS; i++) 248 for (int i = 0; i < TOTAL_COLORS; i++)
255 if (ISSET_PIXCOLOR (i)) 249 if (ISSET_PIXCOLOR (i))
256 { 250 {
257 pix_colors_focused [i].free (this); 251 pix_colors_focused [i].free (this);
258#if OFF_FOCUS_FADING 252#if OFF_FOCUS_FADING
253 if (rs[Rs_fade])
259 pix_colors_unfocused [i].free (this); 254 pix_colors_unfocused [i].free (this);
260#endif 255#endif
261 } 256 }
262 257
263 clear (); 258 clear ();
264 259
277 free (locale); 272 free (locale);
278 free (v_buffer); 273 free (v_buffer);
279 274
280 delete selection_req; 275 delete selection_req;
281 276
277 if (env && memcmp (env, envv->begin (), envv->size () * sizeof (char *)))
278 rxvt_warn ("env has been modified, probably as a result of a lib calling setenv.\n");
279
280 delete [] env;
281
282 delete envv; 282 delete envv;
283 delete argv; 283 delete argv;
284 284
285#ifdef KEYSYM_RESOURCE 285#ifdef KEYSYM_RESOURCE
286 delete keyboard; 286 delete keyboard;
287#endif 287#endif
288#ifndef NO_RESOURCES 288#ifndef NO_RESOURCES
289 XrmDestroyDatabase (option_db); 289 XrmDestroyDatabase (option_db);
290#endif 290#endif
291
292 SET_R ((rxvt_term *)0);
291} 293}
292 294
293// child has exited, usually destroys 295// child has exited, usually destroys
294void 296void
295rxvt_term::child_cb (ev::child &w, int status) 297rxvt_term::child_cb (ev::child &w, int status)
318 { 320 {
319#if USE_XIM 321#if USE_XIM
320 im_ev.stop (display); 322 im_ev.stop (display);
321#endif 323#endif
322 scrollbar_ev.stop (display); 324 scrollbar_ev.stop (display);
323#if BG_IMAGE_FROM_ROOT || ENABLE_PERL 325#if ENABLE_PERL
324 rootwin_ev.stop (display); 326 rootwin_ev.stop (display);
325#endif 327#endif
326 termwin_ev.stop (display); 328 termwin_ev.stop (display);
327 vt_ev.stop (display); 329 vt_ev.stop (display);
328 } 330 }
355 357
356 delete this; 358 delete this;
357} 359}
358 360
359void 361void
360rxvt_term::set_option (uint8_t opt, bool set) NOTHROW 362rxvt_term::set_option (uint8_t opt, bool set) noexcept
361{ 363{
362 if (!opt) 364 if (!opt)
363 return; 365 return;
364 366
365 uint8_t mask = 1 << (opt & 7); 367 uint8_t mask = 1 << (opt & 7);
383 385
384#if !ENABLE_MINIMAL 386#if !ENABLE_MINIMAL
385static void ecb_cold 387static void ecb_cold
386print_x_error (Display *dpy, XErrorEvent *event) 388print_x_error (Display *dpy, XErrorEvent *event)
387{ 389{
388 char buffer[BUFSIZ]; 390 char buffer[BUFSIZ];
389 char mesg[BUFSIZ]; 391 char mesg[BUFSIZ];
390 char number[32]; 392 char number[32];
391 393
392 rxvt_warn ("An X Error occurred, trying to continue after report.\n"); 394 rxvt_warn ("An X Error occurred, trying to continue after report.\n");
393 395
394 XGetErrorDatabaseText (dpy, "XlibMessage", "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ); 396 XGetErrorDatabaseText (dpy, "XlibMessage", "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ);
395 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->serial); 397 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->serial);
396 398
397 XGetErrorText (dpy, event->error_code, buffer, BUFSIZ); 399 XGetErrorText (dpy, event->error_code, buffer, BUFSIZ);
398 XGetErrorDatabaseText (dpy, "XlibMessage", "XError", "X Error", mesg, BUFSIZ); 400 XGetErrorDatabaseText (dpy, "XlibMessage", "XError", "X Error", mesg, BUFSIZ);
399 rxvt_warn ("+ %s: %s\n", mesg, buffer); 401 rxvt_warn ("+ %s: %s\n", mesg, buffer);
400 402
401 XGetErrorDatabaseText (dpy, "XlibMessage", "MajorCode", "Request Major code %d", mesg, BUFSIZ); 403 XGetErrorDatabaseText (dpy, "XlibMessage", "MajorCode", "Request Major code %d", mesg, BUFSIZ);
402 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->request_code); 404 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->request_code);
403 405
404 if (event->request_code >= 128) 406 if (event->request_code >= 128)
405 { 407 {
406#if 0 408#if 0
407 /* XListExtensions and probably query extensions hangs when there are multiple queues errors */ 409 /* XListExtensions and probably query extensions hangs when there are multiple queues errors */
408 int nexts; 410 int nexts;
409 char **exts = XListExtensions (dpy, &nexts); 411 char **exts = XListExtensions (dpy, &nexts);
410 412
411 while (nexts) 413 while (nexts)
412 { 414 {
413 char *extname = exts [nexts - 1]; 415 char *extname = exts [nexts - 1];
414 int major, first_event, first_error; 416 int major, first_event, first_error;
415 417
416 if (XQueryExtension (dpy, extname, &major, &first_event, &first_error) && major == event->request_code) 418 if (XQueryExtension (dpy, extname, &major, &first_event, &first_error) && major == event->request_code)
417 { 419 {
418 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ); 420 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ);
419 rxvt_warn ("+ (which is extension %s minor code %d)\n", extname, event->minor_code); 421 rxvt_warn ("+ (which is extension %s minor code %d)\n", extname, event->minor_code);
420 422
421 snprintf (buffer, BUFSIZ, "%s.%d", extname, event->minor_code); 423 snprintf (buffer, BUFSIZ, "%s.%d", extname, event->minor_code);
422 XGetErrorDatabaseText (dpy, "XRequest", buffer, "an unregistered minor code", buffer, BUFSIZ); 424 XGetErrorDatabaseText (dpy, "XRequest", buffer, "an unregistered minor code", buffer, BUFSIZ);
423 rxvt_warn ("+ (which is %s)\n", buffer); 425 rxvt_warn ("+ (which is %s)\n", buffer);
424 426
425 break; 427 break;
426 } 428 }
427 429
428 printf ("nextss %d %s\n", nexts, extname);//D 430 printf ("nextss %d %s\n", nexts, extname);//D
429 --nexts; 431 --nexts;
430 ++exts; 432 ++exts;
431 } 433 }
432#else 434#else
433 int nexts = 0; 435 int nexts = 0;
434 char **exts = 0; 436 char **exts = 0;
435#endif 437#endif
436 438
437 if (!nexts) 439 if (!nexts)
438 { 440 {
439 rxvt_warn ("+ (which is an unknown extension)\n", buffer); 441 rxvt_warn ("+ (which is an unknown extension)\n", buffer);
440 442
441 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ); 443 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ);
442 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->minor_code); 444 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->minor_code);
443 445
444#if 0 446#if 0
445 sprintf (number, "RENDER.%d", event->minor_code); 447 sprintf (number, "RENDER.%d", event->minor_code);
446 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ); 448 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ);
447 rxvt_warn ("+ (which is %s)\n", buffer); 449 rxvt_warn ("+ (which is %s)\n", buffer);
448#endif 450#endif
449 } 451 }
450 452
451 XFreeExtensionList (exts); 453 XFreeExtensionList (exts);
452 } 454 }
453 else 455 else
454 { 456 {
455 sprintf (number, "%d", event->request_code); 457 sprintf (number, "%d", event->request_code);
456 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ); 458 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ);
457 rxvt_warn ("+ (which is %s)\n", buffer); 459 rxvt_warn ("+ (which is %s)\n", buffer);
458 } 460 }
459 461
460 if (event->error_code == BadWindow 462 if (event->error_code == BadWindow
461 || event->error_code == BadPixmap 463 || event->error_code == BadPixmap
462 || event->error_code == BadCursor 464 || event->error_code == BadCursor
463 || event->error_code == BadFont 465 || event->error_code == BadFont
464 || event->error_code == BadDrawable 466 || event->error_code == BadDrawable
465 || event->error_code == BadColor 467 || event->error_code == BadColor
466 || event->error_code == BadGC 468 || event->error_code == BadGC
467 || event->error_code == BadIDChoice 469 || event->error_code == BadIDChoice
468 || event->error_code == BadValue 470 || event->error_code == BadValue
469 || event->error_code == BadAtom) 471 || event->error_code == BadAtom)
470 { 472 {
471 if (event->error_code == BadValue) 473 if (event->error_code == BadValue)
472 XGetErrorDatabaseText (dpy, "XlibMessage", "Value", "Value 0x%x", mesg, BUFSIZ); 474 XGetErrorDatabaseText (dpy, "XlibMessage", "Value", "Value 0x%x", mesg, BUFSIZ);
473 else if (event->error_code == BadAtom) 475 else if (event->error_code == BadAtom)
474 XGetErrorDatabaseText (dpy, "XlibMessage", "AtomID", "AtomID 0x%x", mesg, BUFSIZ); 476 XGetErrorDatabaseText (dpy, "XlibMessage", "AtomID", "AtomID 0x%x", mesg, BUFSIZ);
475 else 477 else
476 XGetErrorDatabaseText (dpy, "XlibMessage", "ResourceID", "ResourceID 0x%x", mesg, BUFSIZ); 478 XGetErrorDatabaseText (dpy, "XlibMessage", "ResourceID", "ResourceID 0x%x", mesg, BUFSIZ);
477 479
478 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->resourceid); 480 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->resourceid);
479 } 481 }
480} 482}
481#endif 483#endif
482 484
483int ecb_cold 485int ecb_cold
484rxvt_xerror_handler (Display *display, XErrorEvent *event) 486rxvt_xerror_handler (Display *display, XErrorEvent *event)
485{ 487{
486 if (GET_R->allowedxerror == -1) 488 if (GET_R && GET_R->allowedxerror == -1)
487 GET_R->allowedxerror = event->error_code; 489 GET_R->allowedxerror = event->error_code;
488 else 490 else
489 { 491 {
490 // GET_R is most likely not the terminal which caused the error, 492 // GET_R is most likely not the terminal which caused the error,
491 // so just output the error and continue 493 // so just output the error and continue
934 936
935void 937void
936rxvt_term::set_window_color (int idx, const char *color) 938rxvt_term::set_window_color (int idx, const char *color)
937{ 939{
938#ifdef XTERM_COLOR_CHANGE 940#ifdef XTERM_COLOR_CHANGE
939 rxvt_color xcol;
940
941 if (color == NULL || *color == '\0') 941 if (color == NULL || *color == '\0')
942 return; 942 return;
943 943
944 color = strdup (color); 944 color = strdup (color);
945 allocated.push_back ((void *)color); 945 allocated.push_back ((void *)color);
951 int i = atoi (color); 951 int i = atoi (color);
952 952
953 if (i >= 8 && i <= 15) 953 if (i >= 8 && i <= 15)
954 { 954 {
955 /* bright colors */ 955 /* bright colors */
956 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; 956 alias_color (idx, minBrightCOLOR + i - 8);
957 goto done; 957 goto done;
958 } 958 }
959 959
960 if (i >= 0 && i <= 7) 960 if (i >= 0 && i <= 7)
961 { 961 {
962 /* normal colors */ 962 /* normal colors */
963 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; 963 alias_color (idx, minCOLOR + i);
964 goto done; 964 goto done;
965 } 965 }
966 } 966 }
967 967
968 set_color (xcol, color); 968 pix_colors_focused[idx].free (this);
969 969 set_color (pix_colors_focused[idx], color);
970 /*
971 * FIXME: should free colors here, but no idea how to do it so instead,
972 * so just keep gobbling up the colormap
973 */
974
975 pix_colors_focused[idx] = xcol;
976 970
977done: 971done:
978 /*TODO: handle Color_BD, scrollbar background, etc. */ 972 /*TODO: handle Color_BD, scrollbar background, etc. */
979 973
980 update_fade_color (idx); 974 update_fade_color (idx);
981 recolour_cursor (); 975 recolor_cursor ();
982 scr_recolour (); 976 scr_recolor ();
983#endif /* XTERM_COLOR_CHANGE */ 977#endif /* XTERM_COLOR_CHANGE */
984} 978}
985 979
986void 980void
987rxvt_term::recolour_cursor () 981rxvt_term::recolor_cursor ()
988{ 982{
989 XColor fg, bg; 983 XColor fg, bg;
990 984
991 (ISSET_PIXCOLOR (Color_pointer_fg) 985 (ISSET_PIXCOLOR (Color_pointer_fg)
992 ? pix_colors_focused[Color_pointer_fg] 986 ? pix_colors_focused[Color_pointer_fg]
1021 1015
1022 for (i = Color_Black; i <= Color_White; i++) 1016 for (i = Color_Black; i <= Color_White; i++)
1023 if (pix_colors[Color_bg] == pix_colors[i]) 1017 if (pix_colors[Color_bg] == pix_colors[i])
1024 { 1018 {
1025 sprintf (bstr, "%d", i - Color_Black); 1019 sprintf (bstr, "%d", i - Color_Black);
1026#if BG_IMAGE_FROM_FILE 1020#if HAVE_IMG
1027 xpmb = "default;"; 1021 xpmb = "default;";
1028#endif 1022#endif
1029 break; 1023 break;
1030 } 1024 }
1031 1025
1047} 1041}
1048 1042
1049void 1043void
1050rxvt_term::alias_color (int dst, int src) 1044rxvt_term::alias_color (int dst, int src)
1051{ 1045{
1046 pix_colors[dst].free (this);
1052 pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]); 1047 pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]);
1053} 1048}
1049
1050#ifdef SMART_RESIZE
1051static unsigned int
1052get_parent_bw (Display *dpy, Window w)
1053{
1054 int idummy;
1055 unsigned int udummy;
1056 Window wdummy, parent;
1057 Window *children;
1058 unsigned int nchildren, border_width;
1059
1060 XQueryTree (dpy, w, &wdummy, &parent, &children, &nchildren);
1061 XFree (children);
1062 XGetGeometry (dpy, parent, &wdummy, &idummy, &idummy,
1063 &udummy, &udummy, &border_width, &udummy);
1064
1065 return border_width;
1066}
1067#endif
1054 1068
1055/* -------------------------------------------------------------------- * 1069/* -------------------------------------------------------------------- *
1056 * - WINDOW RESIZING - * 1070 * - WINDOW RESIZING - *
1057 * -------------------------------------------------------------------- */ 1071 * -------------------------------------------------------------------- */
1058void 1072void
1094 * if display->root isn't the parent window, a WM will probably have offset 1108 * if display->root isn't the parent window, a WM will probably have offset
1095 * our position for handles and decorations. Counter it 1109 * our position for handles and decorations. Counter it
1096 */ 1110 */
1097 if (x1 != x || y1 != y) 1111 if (x1 != x || y1 != y)
1098 { 1112 {
1099 x -= x1; 1113 unsigned int border_width = get_parent_bw (dpy, parent);
1100 y -= y1; 1114
1115 x -= x1 + border_width;
1116 y -= y1 + border_width;
1101 } 1117 }
1102 1118
1103 x1 = (DisplayWidth (dpy, display->screen) - old_width ) / 2; 1119 x1 = (DisplayWidth (dpy, display->screen) - old_width ) / 2;
1104 y1 = (DisplayHeight (dpy, display->screen) - old_height) / 2; 1120 y1 = (DisplayHeight (dpy, display->screen) - old_height) / 2;
1105 dx = old_width - szHint.width; 1121 dx = old_width - szHint.width;
1135 XMoveResizeWindow (dpy, vt, 1151 XMoveResizeWindow (dpy, vt,
1136 window_vt_x, window_vt_y, 1152 window_vt_x, window_vt_y,
1137 vt_width, vt_height); 1153 vt_width, vt_height);
1138 1154
1139 HOOK_INVOKE ((this, HOOK_SIZE_CHANGE, DT_INT, newwidth, DT_INT, newheight, DT_END)); 1155 HOOK_INVOKE ((this, HOOK_SIZE_CHANGE, DT_INT, newwidth, DT_INT, newheight, DT_END));
1140
1141#ifdef HAVE_BG_PIXMAP
1142 if (bg_window_size_sensitive ())
1143 update_background ();
1144#endif
1145 } 1156 }
1146 1157
1147 if (fix_screen || old_height == 0) 1158 if (fix_screen || old_height == 0)
1148 scr_reset (); 1159 scr_reset ();
1149 1160
1370 unsigned long fg, bg; 1381 unsigned long fg, bg;
1371 const char *p; 1382 const char *p;
1372 char **s; 1383 char **s;
1373 XIMStyles *xim_styles; 1384 XIMStyles *xim_styles;
1374 1385
1375 set_environ (envv); 1386 set_environ (env);
1376 1387
1377 if (!((p = XSetLocaleModifiers (modifiers)) && *p)) 1388 if (!((p = XSetLocaleModifiers (modifiers)) && *p))
1378 return false; 1389 return false;
1379 1390
1380 input_method = display->get_xim (locale, modifiers); 1391 input_method = display->get_xim (locale, modifiers);
1682{ 1693{
1683 Window cr; 1694 Window cr;
1684 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr); 1695 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr);
1685} 1696}
1686 1697
1687#ifdef HAVE_BG_PIXMAP
1688
1689void
1690rxvt_term::update_background ()
1691{
1692 if (update_background_ev.is_active ())
1693 return;
1694
1695 ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since);
1696
1697 if (to_wait <= 0.)
1698 bg_render ();
1699 else
1700 update_background_ev.start (to_wait);
1701}
1702
1703void
1704rxvt_term::update_background_cb (ev::timer &w, int revents)
1705{
1706 make_current ();
1707
1708 update_background_ev.stop ();
1709 bg_render ();
1710 refresh_check ();
1711}
1712
1713#endif /* HAVE_BG_PIXMAP */
1714
1715/*----------------------- end-of-file (C source) -----------------------*/ 1698/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines