From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkfJh-0003ny-TA for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:53 -0500 Received: from [199.232.76.173] (port=38086 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkfJh-0003nj-H9 for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:53 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkfJg-0008TL-Af for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:53 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:34596) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkfJg-0008TD-0g for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:52 -0500 Received: by gyh4 with SMTP id 4so1167713gyh.4 for ; Thu, 25 Feb 2010 07:07:51 -0800 (PST) Message-ID: <4B869244.70204@codemonkey.ws> Date: Thu, 25 Feb 2010 09:07:48 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] kbd leds: infrastructure References: <1267087161-15204-1-git-send-email-kraxel@redhat.com> <1267087161-15204-2-git-send-email-kraxel@redhat.com> <4B8685EC.20000@codemonkey.ws> <4B868AFC.3060904@redhat.com> In-Reply-To: <4B868AFC.3060904@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On 02/25/2010 08:36 AM, Gerd Hoffmann wrote: > On 02/25/10 15:15, Anthony Liguori wrote: >> But I wonder if it really makes sense to treat all of these things >> differently since we end up duplicating a lot of code. Would it make >> more sense to just introduce: > >> typedef struct QEMUInputHandler { >> void (*put_kbd_event)(QEMUInputHandler *obj, int keycode); >> void (*put_led_event)(QEMUInputHandler *obj, int ledstate); >> void (*put_mouse_event)(QEMUInputHandler *obj, int dx, int dy, int dz, >> int buttons_state); >> QLIST_ENTRY(QEMUInputHandler) node; >> } QEMUInputHandler; > >> void qemu_add_input_handler(QEMUInputHandler *handler); >> void qemu_remove_input_handler(QEMUInputHandler *handler); > > I don't think so. Devil is in the details. Note that kbd_event and > mouse_event go to the kbd/mouse drivers, whereas led_event comes from > the kbd driver, so they are different albeit related beasts. Right, I hadn't thought it through enough. Should led events be part of DisplayChangeListener? I think you could make the argument that it's part of the display state. Regards, Anthony Liguori > Also the mouse register/unregister does some extra care to update the > pointer to the current mouse device, so we can't easily unify the list > management. > > Juan's suggestion to use QLISTs makes alot of sense though, will do that. > > cheers, > Gerd >