emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading D-Bus messages


From: Ken Brown
Subject: Re: Reading D-Bus messages
Date: Sat, 25 Sep 2010 20:51:31 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

On 9/25/2010 5:46 PM, Ken Brown wrote:
On 9/25/2010 12:52 PM, Michael Albinus wrote:
Jan Djärv<address@hidden>   writes:

We should have a general way to add file descriptors and get a
callback for them.  In the mean time, do something like this in
process.c:

static SELECT_TYPE dbus_mask;

void
add_dbus_fd (int fd)
{
    FD_SET (fd,&dbus_mask);
    add_keyboard_wait_descriptor (fd);
}

void
remove_dbus_fd (int fd)
{
    FD_CLR (fd,&dbus_mask);
    remove_keyboard_wait_descriptor (fd);
}

After this wait_reading_process_output

        /* Check for data from a process.  */
        if (no_avail || nfds == 0)
        continue;

add
        for (channel = 0; channel<= max_keyboard_desc; ++channel)
         if (FD_ISSET (channel,&dbus_mask)&&   FD_ISSET (channel,&Available))
              {
                   xd_read_queued_messages ();
                   break; /* All dbus channels has been read, exit loop */
              }

and in init_process:

        FD_ZERO (&dbus_mask);

Use remove_dbus_fd and add_dbus_fd in dbusbind.c.
But maybe I'll add that general input mechanism instead, well see.

I have added this, and it works fine in an X11 environment. I guess,
redisplay() does the job.

If I test it in a non-X11 terminal, arriving D-Bus messages are
recognised only after pressing a character on the keyboard. So at least
an additional trigger is missing to handle this event in time.

Where can I find your changes?  I'd like to test it in Cygwin.  I tried
to make the changes Jan suggested myself, but I found that emacs was
blocked after I loaded dbus.el, just as before.  I probably did
something wrong.

OK, I've got it working now. (I had to remove the call to xd_pending_messages in keyboard.c; I'm not sure if that's the right thing to do or not.) And I now observe the same thing as you: Everything I tried worked under X11, but messages were delayed when running in a non-X11 terminal.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]