… | |
… | |
183 | |
183 | |
184 | XIMCallback ximcallback; |
184 | XIMCallback ximcallback; |
185 | ximcallback.client_data = (XPointer)this; |
185 | ximcallback.client_data = (XPointer)this; |
186 | ximcallback.callback = im_destroy_cb; |
186 | ximcallback.callback = im_destroy_cb; |
187 | |
187 | |
188 | XSetIMValues (xim, XNDestroyCallback, &ximcallback, 0); |
188 | XSetIMValues (xim, XNDestroyCallback, &ximcallback, (char *)0); |
189 | |
189 | |
190 | return true; |
190 | return true; |
191 | } |
191 | } |
192 | |
192 | |
193 | rxvt_xim::~rxvt_xim () |
193 | rxvt_xim::~rxvt_xim () |
… | |
… | |
462 | #endif |
462 | #endif |
463 | |
463 | |
464 | int fd = XConnectionNumber (dpy); |
464 | int fd = XConnectionNumber (dpy); |
465 | |
465 | |
466 | // try to detect wether we have a local connection. |
466 | // try to detect wether we have a local connection. |
467 | // assume unix domains socket == local, everything else not |
467 | // assume unix domain socket == local, everything else not |
468 | // TODO: might want to check for inet/127.0.0.1 |
468 | // TODO: might want to check for inet/127.0.0.1 |
469 | is_local = 0; |
469 | is_local = 0; |
470 | sockaddr_un sa; |
470 | sockaddr_un sa; |
471 | socklen_t sl = sizeof (sa); |
471 | socklen_t sl = sizeof (sa); |
472 | |
472 | |
473 | if (!getsockname (fd, (sockaddr *)&sa, &sl)) |
473 | if (!getsockname (fd, (sockaddr *)&sa, &sl)) |
474 | is_local = sa.sun_family == AF_UNIX; |
474 | is_local = sa.sun_family == AF_UNIX; |
475 | |
475 | |
476 | x_ev.start (fd, EVENT_READ); |
476 | x_ev.start (fd, ev::READ); |
477 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
477 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
478 | |
478 | |
479 | XSelectInput (dpy, root, PropertyChangeMask); |
479 | XSelectInput (dpy, root, PropertyChangeMask); |
480 | |
480 | |
481 | flush (); |
481 | flush (); |
… | |
… | |
538 | |
538 | |
539 | XFree (atoms); |
539 | XFree (atoms); |
540 | } |
540 | } |
541 | #endif |
541 | #endif |
542 | |
542 | |
543 | void rxvt_display::x_cb (io_watcher &w, short revents) |
543 | void rxvt_display::x_cb (ev::io &w, int revents) |
544 | { |
544 | { |
545 | do |
545 | do |
546 | { |
546 | { |
547 | XEvent xev; |
547 | XEvent xev; |
548 | XNextEvent (dpy, &xev); |
548 | XNextEvent (dpy, &xev); |
… | |
… | |
575 | } |
575 | } |
576 | |
576 | |
577 | void rxvt_display::flush () |
577 | void rxvt_display::flush () |
578 | { |
578 | { |
579 | if (XEventsQueued (dpy, QueuedAlready)) |
579 | if (XEventsQueued (dpy, QueuedAlready)) |
580 | x_cb (x_ev, EVENT_READ); |
580 | x_cb (x_ev, ev::READ); |
581 | |
581 | |
582 | XFlush (dpy); |
582 | XFlush (dpy); |
583 | } |
583 | } |
584 | |
584 | |
585 | void rxvt_display::reg (xevent_watcher *w) |
585 | void rxvt_display::reg (xevent_watcher *w) |
… | |
… | |
886 | lerp (c.a, to.a, percent) |
886 | lerp (c.a, to.a, percent) |
887 | ) |
887 | ) |
888 | ); |
888 | ); |
889 | } |
889 | } |
890 | |
890 | |
|
|
891 | #if TRACE_PIXMAPS |
|
|
892 | # undef XCreatePixmap |
|
|
893 | # undef XFreePixmap |
|
|
894 | Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d) |
|
|
895 | { |
|
|
896 | Pixmap res = XCreatePixmap (dpy, r, w, h, d); |
|
|
897 | fprintf (stderr, "%s:%d: XCreatePixmap (%p,%lX,%u,%u,%u) returned %lX\n", file, line, dpy, r, w, h, d, res); |
|
|
898 | return res; |
|
|
899 | } |
|
|
900 | |
|
|
901 | void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p) |
|
|
902 | { |
|
|
903 | fprintf (stderr, "%s:%d: XFreePixmap (%p,%lX)\n", file, line, dpy, p); |
|
|
904 | XFreePixmap (dpy,p); |
|
|
905 | } |
|
|
906 | #endif |