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.106 by sf-exg, Mon Feb 22 09:47:41 2010 UTC vs.
Revision 1.113 by sf-exg, Fri Jan 14 11:09:54 2011 UTC

33 33
34#if XFT 34#if XFT
35# include <X11/extensions/Xrender.h> 35# include <X11/extensions/Xrender.h>
36#endif 36#endif
37 37
38const char *const xa_names[] = 38static const char *const xa_names[] =
39{ 39{
40 "TEXT", 40 "TEXT",
41 "COMPOUND_TEXT", 41 "COMPOUND_TEXT",
42 "UTF8_STRING", 42 "UTF8_STRING",
43 "MULTIPLE", 43 "MULTIPLE",
227{ 227{
228} 228}
229 229
230rxvt_drawable &rxvt_screen::scratch_drawable (int w, int h) 230rxvt_drawable &rxvt_screen::scratch_drawable (int w, int h)
231{ 231{
232 // it's actually faster to re-allocate every time. don't ask me
233 // why, but its likely no big deal there are no roundtrips
234 // (I think/hope).
235 if (!scratch_area || w > scratch_w || h > scratch_h || 1/*D*/) 232 if (!scratch_area || w > scratch_w || h > scratch_h)
236 { 233 {
237 if (scratch_area) 234 if (scratch_area)
238 { 235 {
239 XFreePixmap (dpy, scratch_area->drawable); 236 XFreePixmap (dpy, scratch_area->drawable);
240 delete scratch_area; 237 delete scratch_area;
362 XA_STRING, &actual_type, &actual_format, 359 XA_STRING, &actual_type, &actual_format,
363 &nitems, &nremaining, 360 &nitems, &nremaining,
364 (unsigned char **)&val) == Success 361 (unsigned char **)&val) == Success
365 && actual_type == XA_STRING 362 && actual_type == XA_STRING
366 && actual_format == 8) 363 && actual_format == 8)
367 displayResource = val; 364 displayResource = val;
368 else 365 else
369 { 366 {
370 displayResource = 0; 367 displayResource = 0;
371 368
372 if (val) 369 if (val)
373 XFree(val); 370 XFree (val);
374 } 371 }
375 372
376#if XLIB_ILLEGAL_ACCESS 373#if XLIB_ILLEGAL_ACCESS
377 dpy->xdefaults = displayResource; 374 dpy->xdefaults = displayResource;
378#endif 375#endif
379 } 376 }
446 return false; 443 return false;
447 444
448 screen = DefaultScreen (dpy); 445 screen = DefaultScreen (dpy);
449 root = DefaultRootWindow (dpy); 446 root = DefaultRootWindow (dpy);
450 447
451 assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); 448 assert (ARRAY_LENGTH(xa_names) == NUM_XA);
452 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); 449 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa);
453 450
454 XrmSetDatabase (dpy, get_resources (false)); 451 XrmSetDatabase (dpy, get_resources (false));
455 452
456#ifdef POINTER_BLANK 453#ifdef POINTER_BLANK
464 XUnloadFont (dpy, f); 461 XUnloadFont (dpy, f);
465#endif 462#endif
466 463
467 int fd = XConnectionNumber (dpy); 464 int fd = XConnectionNumber (dpy);
468 465
469 // try to detect wether we have a local connection. 466 // try to detect whether we have a local connection.
470 // assume unix domain socket == local, everything else not 467 // assume unix domain socket == local, everything else not
471 // TODO: might want to check for inet/127.0.0.1 468 // TODO: might want to check for inet/127.0.0.1
472 is_local = 0; 469 is_local = 0;
473 sockaddr_un sa; 470 sockaddr_un sa;
474 socklen_t sl = sizeof (sa); 471 socklen_t sl = sizeof (sa);
488} 485}
489 486
490void 487void
491rxvt_display::ref_next () 488rxvt_display::ref_next ()
492{ 489{
493 // TODO: somehow check wether the database files/resources changed 490 // TODO: somehow check whether the database files/resources changed
494 // before affording re-loading/parsing 491 // before affording re-loading/parsing
495 XrmDestroyDatabase (XrmGetDatabase (dpy)); 492 XrmDestroyDatabase (XrmGetDatabase (dpy));
496 XrmSetDatabase (dpy, get_resources (true)); 493 XrmSetDatabase (dpy, get_resources (true));
497} 494}
498 495
507 x_ev.stop (); 504 x_ev.stop ();
508 flush_ev.stop (); 505 flush_ev.stop ();
509#ifdef USE_XIM 506#ifdef USE_XIM
510 xims.clear (); 507 xims.clear ();
511#endif 508#endif
509 XrmDestroyDatabase (XrmGetDatabase (dpy));
512 XCloseDisplay (dpy); 510 XCloseDisplay (dpy);
513} 511}
514 512
515#ifdef USE_XIM 513#ifdef USE_XIM
516void rxvt_display::im_change_cb () 514void rxvt_display::im_change_cb ()
528 unsigned long nitems, bytes_after; 526 unsigned long nitems, bytes_after;
529 527
530 if (XGetWindowProperty (dpy, root, xa[XA_XIM_SERVERS], 0L, 1000000L, 528 if (XGetWindowProperty (dpy, root, xa[XA_XIM_SERVERS], 0L, 1000000L,
531 False, XA_ATOM, &actual_type, &actual_format, 529 False, XA_ATOM, &actual_type, &actual_format,
532 &nitems, &bytes_after, (unsigned char **)&atoms) 530 &nitems, &bytes_after, (unsigned char **)&atoms)
533 != Success ) 531 != Success)
534 return; 532 return;
535 533
536 if (actual_type == XA_ATOM && actual_format == 32) 534 if (actual_type == XA_ATOM && actual_format == 32)
537 for (int i = 0; i < nitems; i++) 535 for (int i = 0; i < nitems; i++)
538 if (XGetSelectionOwner (dpy, atoms[i])) 536 if (XGetSelectionOwner (dpy, atoms[i]))
539 { 537 {
540 im_change_cb (); 538 im_change_cb ();
541 break; 539 break;
884 lerp (c.a, to.a, percent) 882 lerp (c.a, to.a, percent)
885 ) 883 )
886 ); 884 );
887} 885}
888 886
889#if TRACE_PIXMAPS
890# undef XCreatePixmap
891# undef XFreePixmap
892Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d)
893{
894 Pixmap res = XCreatePixmap (dpy, r, w, h, d);
895 fprintf (stderr, "%s:%d: XCreatePixmap (%p,%lX,%u,%u,%u) returned %lX\n", file, line, dpy, r, w, h, d, res);
896 return res;
897}
898
899void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p)
900{
901 fprintf (stderr, "%s:%d: XFreePixmap (%p,%lX)\n", file, line, dpy, p);
902 XFreePixmap (dpy,p);
903}
904#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines