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.387 by sf-exg, Sun Dec 30 15:38:04 2012 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)
239 233
240#if USE_XIM 234#if USE_XIM
241 im_destroy (); 235 im_destroy ();
242#endif 236#endif
243 scrollBar.destroy (); 237 scrollBar.destroy ();
238
239 if (gc)
244 if (gc) XFreeGC (dpy, gc); 240 XFreeGC (dpy, gc);
245 241
246 delete drawable; 242 delete drawable;
243
247 // destroy all windows 244 // destroy all windows
248 if (parent) 245 if (parent)
249 XDestroyWindow (dpy, parent); 246 XDestroyWindow (dpy, parent);
250 247
251 for (int i = 0; i < TOTAL_COLORS; i++) 248 for (int i = 0; i < TOTAL_COLORS; i++)
252 if (ISSET_PIXCOLOR (i)) 249 if (ISSET_PIXCOLOR (i))
253 { 250 {
254 pix_colors_focused [i].free (this); 251 pix_colors_focused [i].free (this);
255#if OFF_FOCUS_FADING 252#if OFF_FOCUS_FADING
253 if (rs[Rs_fade])
256 pix_colors_unfocused [i].free (this); 254 pix_colors_unfocused [i].free (this);
257#endif 255#endif
258 } 256 }
259 257
260 clear (); 258 clear ();
261 259
274 free (locale); 272 free (locale);
275 free (v_buffer); 273 free (v_buffer);
276 274
277 delete selection_req; 275 delete selection_req;
278 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
279 delete envv; 282 delete envv;
280 delete argv; 283 delete argv;
281 284
282#ifdef KEYSYM_RESOURCE 285#ifdef KEYSYM_RESOURCE
283 delete keyboard; 286 delete keyboard;
284#endif 287#endif
285#ifndef NO_RESOURCES 288#ifndef NO_RESOURCES
286 XrmDestroyDatabase (option_db); 289 XrmDestroyDatabase (option_db);
287#endif 290#endif
291
292 SET_R ((rxvt_term *)0);
288} 293}
289 294
290// child has exited, usually destroys 295// child has exited, usually destroys
291void 296void
292rxvt_term::child_cb (ev::child &w, int status) 297rxvt_term::child_cb (ev::child &w, int status)
315 { 320 {
316#if USE_XIM 321#if USE_XIM
317 im_ev.stop (display); 322 im_ev.stop (display);
318#endif 323#endif
319 scrollbar_ev.stop (display); 324 scrollbar_ev.stop (display);
320#if BG_IMAGE_FROM_ROOT || ENABLE_PERL 325#if ENABLE_PERL
321 rootwin_ev.stop (display); 326 rootwin_ev.stop (display);
322#endif 327#endif
323 termwin_ev.stop (display); 328 termwin_ev.stop (display);
324 vt_ev.stop (display); 329 vt_ev.stop (display);
325 } 330 }
352 357
353 delete this; 358 delete this;
354} 359}
355 360
356void 361void
357rxvt_term::set_option (uint8_t opt, bool set) NOTHROW 362rxvt_term::set_option (uint8_t opt, bool set) noexcept
358{ 363{
359 if (!opt) 364 if (!opt)
360 return; 365 return;
361 366
362 uint8_t mask = 1 << (opt & 7); 367 uint8_t mask = 1 << (opt & 7);
380 385
381#if !ENABLE_MINIMAL 386#if !ENABLE_MINIMAL
382static void ecb_cold 387static void ecb_cold
383print_x_error (Display *dpy, XErrorEvent *event) 388print_x_error (Display *dpy, XErrorEvent *event)
384{ 389{
385 char buffer[BUFSIZ]; 390 char buffer[BUFSIZ];
386 char mesg[BUFSIZ]; 391 char mesg[BUFSIZ];
387 char number[32]; 392 char number[32];
388 393
389 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");
390 395
391 XGetErrorDatabaseText (dpy, "XlibMessage", "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ); 396 XGetErrorDatabaseText (dpy, "XlibMessage", "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ);
392 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->serial); 397 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->serial);
393 398
394 XGetErrorText (dpy, event->error_code, buffer, BUFSIZ); 399 XGetErrorText (dpy, event->error_code, buffer, BUFSIZ);
395 XGetErrorDatabaseText (dpy, "XlibMessage", "XError", "X Error", mesg, BUFSIZ); 400 XGetErrorDatabaseText (dpy, "XlibMessage", "XError", "X Error", mesg, BUFSIZ);
396 rxvt_warn ("+ %s: %s\n", mesg, buffer); 401 rxvt_warn ("+ %s: %s\n", mesg, buffer);
397 402
398 XGetErrorDatabaseText (dpy, "XlibMessage", "MajorCode", "Request Major code %d", mesg, BUFSIZ); 403 XGetErrorDatabaseText (dpy, "XlibMessage", "MajorCode", "Request Major code %d", mesg, BUFSIZ);
399 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);
400 405
401 if (event->request_code >= 128) 406 if (event->request_code >= 128)
402 { 407 {
403#if 0 408#if 0
404 /* 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 */
405 int nexts; 410 int nexts;
406 char **exts = XListExtensions (dpy, &nexts); 411 char **exts = XListExtensions (dpy, &nexts);
407 412
408 while (nexts) 413 while (nexts)
409 { 414 {
410 char *extname = exts [nexts - 1]; 415 char *extname = exts [nexts - 1];
411 int major, first_event, first_error; 416 int major, first_event, first_error;
412 417
413 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)
414 { 419 {
415 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ); 420 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ);
416 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);
417 422
418 snprintf (buffer, BUFSIZ, "%s.%d", extname, event->minor_code); 423 snprintf (buffer, BUFSIZ, "%s.%d", extname, event->minor_code);
419 XGetErrorDatabaseText (dpy, "XRequest", buffer, "an unregistered minor code", buffer, BUFSIZ); 424 XGetErrorDatabaseText (dpy, "XRequest", buffer, "an unregistered minor code", buffer, BUFSIZ);
420 rxvt_warn ("+ (which is %s)\n", buffer); 425 rxvt_warn ("+ (which is %s)\n", buffer);
421 426
422 break; 427 break;
423 } 428 }
424 429
425 printf ("nextss %d %s\n", nexts, extname);//D 430 printf ("nextss %d %s\n", nexts, extname);//D
426 --nexts; 431 --nexts;
427 ++exts; 432 ++exts;
428 } 433 }
429#else 434#else
430 int nexts = 0; 435 int nexts = 0;
431 char **exts = 0; 436 char **exts = 0;
432#endif 437#endif
433 438
434 if (!nexts) 439 if (!nexts)
435 { 440 {
436 rxvt_warn ("+ (which is an unknown extension)\n", buffer); 441 rxvt_warn ("+ (which is an unknown extension)\n", buffer);
437 442
438 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ); 443 XGetErrorDatabaseText (dpy, "XlibMessage", "MinorCode", "Request Minor code %d", mesg, BUFSIZ);
439 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);
440 445
441#if 0 446#if 0
442 sprintf (number, "RENDER.%d", event->minor_code); 447 sprintf (number, "RENDER.%d", event->minor_code);
443 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ); 448 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ);
444 rxvt_warn ("+ (which is %s)\n", buffer); 449 rxvt_warn ("+ (which is %s)\n", buffer);
445#endif 450#endif
446 } 451 }
447 452
448 XFreeExtensionList (exts); 453 XFreeExtensionList (exts);
449 } 454 }
450 else 455 else
451 { 456 {
452 sprintf (number, "%d", event->request_code); 457 sprintf (number, "%d", event->request_code);
453 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ); 458 XGetErrorDatabaseText (dpy, "XRequest", number, "", buffer, BUFSIZ);
454 rxvt_warn ("+ (which is %s)\n", buffer); 459 rxvt_warn ("+ (which is %s)\n", buffer);
455 } 460 }
456 461
457 if (event->error_code == BadWindow 462 if (event->error_code == BadWindow
458 || event->error_code == BadPixmap 463 || event->error_code == BadPixmap
459 || event->error_code == BadCursor 464 || event->error_code == BadCursor
460 || event->error_code == BadFont 465 || event->error_code == BadFont
461 || event->error_code == BadDrawable 466 || event->error_code == BadDrawable
462 || event->error_code == BadColor 467 || event->error_code == BadColor
463 || event->error_code == BadGC 468 || event->error_code == BadGC
464 || event->error_code == BadIDChoice 469 || event->error_code == BadIDChoice
465 || event->error_code == BadValue 470 || event->error_code == BadValue
466 || event->error_code == BadAtom) 471 || event->error_code == BadAtom)
467 { 472 {
468 if (event->error_code == BadValue) 473 if (event->error_code == BadValue)
469 XGetErrorDatabaseText (dpy, "XlibMessage", "Value", "Value 0x%x", mesg, BUFSIZ); 474 XGetErrorDatabaseText (dpy, "XlibMessage", "Value", "Value 0x%x", mesg, BUFSIZ);
470 else if (event->error_code == BadAtom) 475 else if (event->error_code == BadAtom)
471 XGetErrorDatabaseText (dpy, "XlibMessage", "AtomID", "AtomID 0x%x", mesg, BUFSIZ); 476 XGetErrorDatabaseText (dpy, "XlibMessage", "AtomID", "AtomID 0x%x", mesg, BUFSIZ);
472 else 477 else
473 XGetErrorDatabaseText (dpy, "XlibMessage", "ResourceID", "ResourceID 0x%x", mesg, BUFSIZ); 478 XGetErrorDatabaseText (dpy, "XlibMessage", "ResourceID", "ResourceID 0x%x", mesg, BUFSIZ);
474 479
475 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->resourceid); 480 snprintf (buffer, BUFSIZ, "+ %s\n", mesg); rxvt_warn (buffer, event->resourceid);
476 } 481 }
477} 482}
478#endif 483#endif
479 484
480int ecb_cold 485int ecb_cold
481rxvt_xerror_handler (Display *display, XErrorEvent *event) 486rxvt_xerror_handler (Display *display, XErrorEvent *event)
482{ 487{
483 if (GET_R->allowedxerror == -1) 488 if (GET_R && GET_R->allowedxerror == -1)
484 GET_R->allowedxerror = event->error_code; 489 GET_R->allowedxerror = event->error_code;
485 else 490 else
486 { 491 {
487 // 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,
488 // so just output the error and continue 493 // so just output the error and continue
931 936
932void 937void
933rxvt_term::set_window_color (int idx, const char *color) 938rxvt_term::set_window_color (int idx, const char *color)
934{ 939{
935#ifdef XTERM_COLOR_CHANGE 940#ifdef XTERM_COLOR_CHANGE
936 rxvt_color xcol;
937
938 if (color == NULL || *color == '\0') 941 if (color == NULL || *color == '\0')
939 return; 942 return;
940 943
941 color = strdup (color); 944 color = strdup (color);
942 allocated.push_back ((void *)color); 945 allocated.push_back ((void *)color);
948 int i = atoi (color); 951 int i = atoi (color);
949 952
950 if (i >= 8 && i <= 15) 953 if (i >= 8 && i <= 15)
951 { 954 {
952 /* bright colors */ 955 /* bright colors */
953 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; 956 alias_color (idx, minBrightCOLOR + i - 8);
954 goto done; 957 goto done;
955 } 958 }
956 959
957 if (i >= 0 && i <= 7) 960 if (i >= 0 && i <= 7)
958 { 961 {
959 /* normal colors */ 962 /* normal colors */
960 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; 963 alias_color (idx, minCOLOR + i);
961 goto done; 964 goto done;
962 } 965 }
963 } 966 }
964 967
965 set_color (xcol, color); 968 pix_colors_focused[idx].free (this);
966 969 set_color (pix_colors_focused[idx], color);
967 /*
968 * FIXME: should free colors here, but no idea how to do it so instead,
969 * so just keep gobbling up the colormap
970 */
971
972 pix_colors_focused[idx] = xcol;
973 970
974done: 971done:
975 /*TODO: handle Color_BD, scrollbar background, etc. */ 972 /*TODO: handle Color_BD, scrollbar background, etc. */
976 973
977 update_fade_color (idx); 974 update_fade_color (idx);
978 recolour_cursor (); 975 recolor_cursor ();
979 scr_recolour (); 976 scr_recolor ();
980#endif /* XTERM_COLOR_CHANGE */ 977#endif /* XTERM_COLOR_CHANGE */
981} 978}
982 979
983void 980void
984rxvt_term::recolour_cursor () 981rxvt_term::recolor_cursor ()
985{ 982{
986 XColor fg, bg; 983 XColor fg, bg;
987 984
988 (ISSET_PIXCOLOR (Color_pointer_fg) 985 (ISSET_PIXCOLOR (Color_pointer_fg)
989 ? pix_colors_focused[Color_pointer_fg] 986 ? pix_colors_focused[Color_pointer_fg]
1018 1015
1019 for (i = Color_Black; i <= Color_White; i++) 1016 for (i = Color_Black; i <= Color_White; i++)
1020 if (pix_colors[Color_bg] == pix_colors[i]) 1017 if (pix_colors[Color_bg] == pix_colors[i])
1021 { 1018 {
1022 sprintf (bstr, "%d", i - Color_Black); 1019 sprintf (bstr, "%d", i - Color_Black);
1023#if BG_IMAGE_FROM_FILE 1020#if HAVE_IMG
1024 xpmb = "default;"; 1021 xpmb = "default;";
1025#endif 1022#endif
1026 break; 1023 break;
1027 } 1024 }
1028 1025
1044} 1041}
1045 1042
1046void 1043void
1047rxvt_term::alias_color (int dst, int src) 1044rxvt_term::alias_color (int dst, int src)
1048{ 1045{
1046 pix_colors[dst].free (this);
1049 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]);
1050} 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
1051 1068
1052/* -------------------------------------------------------------------- * 1069/* -------------------------------------------------------------------- *
1053 * - WINDOW RESIZING - * 1070 * - WINDOW RESIZING - *
1054 * -------------------------------------------------------------------- */ 1071 * -------------------------------------------------------------------- */
1055void 1072void
1091 * 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
1092 * our position for handles and decorations. Counter it 1109 * our position for handles and decorations. Counter it
1093 */ 1110 */
1094 if (x1 != x || y1 != y) 1111 if (x1 != x || y1 != y)
1095 { 1112 {
1096 x -= x1; 1113 unsigned int border_width = get_parent_bw (dpy, parent);
1097 y -= y1; 1114
1115 x -= x1 + border_width;
1116 y -= y1 + border_width;
1098 } 1117 }
1099 1118
1100 x1 = (DisplayWidth (dpy, display->screen) - old_width ) / 2; 1119 x1 = (DisplayWidth (dpy, display->screen) - old_width ) / 2;
1101 y1 = (DisplayHeight (dpy, display->screen) - old_height) / 2; 1120 y1 = (DisplayHeight (dpy, display->screen) - old_height) / 2;
1102 dx = old_width - szHint.width; 1121 dx = old_width - szHint.width;
1132 XMoveResizeWindow (dpy, vt, 1151 XMoveResizeWindow (dpy, vt,
1133 window_vt_x, window_vt_y, 1152 window_vt_x, window_vt_y,
1134 vt_width, vt_height); 1153 vt_width, vt_height);
1135 1154
1136 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));
1137
1138#ifdef HAVE_BG_PIXMAP
1139 if (bg_window_size_sensitive ())
1140 update_background ();
1141#endif
1142 } 1156 }
1143 1157
1144 if (fix_screen || old_height == 0) 1158 if (fix_screen || old_height == 0)
1145 scr_reset (); 1159 scr_reset ();
1146 1160
1367 unsigned long fg, bg; 1381 unsigned long fg, bg;
1368 const char *p; 1382 const char *p;
1369 char **s; 1383 char **s;
1370 XIMStyles *xim_styles; 1384 XIMStyles *xim_styles;
1371 1385
1372 set_environ (envv); 1386 set_environ (env);
1373 1387
1374 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1388 if (!((p = XSetLocaleModifiers (modifiers)) && *p))
1375 return false; 1389 return false;
1376 1390
1377 input_method = display->get_xim (locale, modifiers); 1391 input_method = display->get_xim (locale, modifiers);
1378 if (input_method == NULL) 1392 if (input_method == NULL)
1379 return false; 1393 return false;
1679{ 1693{
1680 Window cr; 1694 Window cr;
1681 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr); 1695 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr);
1682} 1696}
1683 1697
1684#ifdef HAVE_BG_PIXMAP
1685
1686void
1687rxvt_term::update_background ()
1688{
1689 if (update_background_ev.is_active ())
1690 return;
1691
1692 ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since);
1693
1694 if (to_wait <= 0.)
1695 bg_render ();
1696 else
1697 update_background_ev.start (to_wait);
1698}
1699
1700void
1701rxvt_term::update_background_cb (ev::timer &w, int revents)
1702{
1703 make_current ();
1704
1705 update_background_ev.stop ();
1706 bg_render ();
1707 refresh_check ();
1708}
1709
1710#endif /* HAVE_BG_PIXMAP */
1711
1712/*----------------------- end-of-file (C source) -----------------------*/ 1698/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines