Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LrbAR-0001Pp-DZ for mharc-grub-devel@gnu.org; Wed, 08 Apr 2009 13:02:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrbAP-0001PF-Ra for grub-devel@gnu.org; Wed, 08 Apr 2009 13:02:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrbAL-0001NT-5m for grub-devel@gnu.org; Wed, 08 Apr 2009 13:02:25 -0400 Received: from [199.232.76.173] (port=45720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrbAK-0001NN-VA for grub-devel@gnu.org; Wed, 08 Apr 2009 13:02:20 -0400 Received: from ti-out-0910.google.com ([209.85.142.185]:27656) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LrbAK-0004Fk-1q for grub-devel@gnu.org; Wed, 08 Apr 2009 13:02:20 -0400 Received: by ti-out-0910.google.com with SMTP id y8so153584tia.10 for ; Wed, 08 Apr 2009 10:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=oStPimrs2pgTsax9NO6eaWZD4H8JhT5c9aQgy2Ah/G0=; b=otQP51cppdBZeAcyUI/pjDTxbwJVvTOv4Fk87NPVJQByGf0XylEC+IJvzZih960Q+j JmnMj8Xh2wlbB0meUdIzio1j3lpZEqUvxC2HIARi2B+g5hYQCcgKjkGOqymKPjY75k6C 7ZrGK15zkzIZYFVE4btRm2+u/OLYkg7SJpJsk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=u+8TUPMCI6OAg3iydkDVQTVrggpvx3kjXblAvpz/WNEEDNvOeyndWXOMYmDhkno84o FZHBHD4lJIRPvZE1yi/fQ2WdR1xvSYb+whNi3Mw5b7tvMwmjhS81Y0uXrZ67I/8fTiZC N8qOxO1Jq+Uj9LefZaAD8uVK5n332T7BCqCxA= MIME-Version: 1.0 Received: by 10.110.28.15 with SMTP id b15mr2019984tib.4.1239210137681; Wed, 08 Apr 2009 10:02:17 -0700 (PDT) In-Reply-To: <200904080740.19732.colin@gibibit.com> References: <49DB7C30.8080209@nic.fi> <200904080740.19732.colin@gibibit.com> Date: Thu, 9 Apr 2009 01:02:17 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] LUA script engine for grub2 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2009 17:02:26 -0000 On Wed, Apr 8, 2009 at 10:40 PM, Colin D Bennett wrote: > Bean wrote: >> 2009/4/8 Vesa J=E4=E4skel=E4inen : >> > Bean wrote: >> >> Hi, >> >> >> >> This patch integrate the LUA script engine to grub2 > > Cool! > >> I add a grub library to lua, now it only contain grub.run, but it >> would be easy to add more function. I think it would be useful to add >> function to interface with the video subsystem directly, so that lua >> can be used to control the dynamic drawing of ui components. > > I actually did some preliminary work to make this possible. =A0I made a d= emo > where text is painted by a Lua script and it animates =93flying by=94 on = the > screen. =A0 (http://grub.gibibit.com/files/gfxmenu-lua-1.iso.gz for a dem= o ISO.) > > Besides making the GRUB video API accessible (partially, so far) to Lua, = I > also made Lua able to implement GUI components in the graphical menu > interface. =A0This is limited at this point and only paint() and destroy(= ) > methods can be implemented in Lua. =A0However, I think being able to impl= ement > new GUI components in Lua would be really great. > > If my code would be any help to you, I can send it to you. Hi, Oh, that looks great, just hope the new graphic interface can be merged soo= n. For gui components, here is some of my thoughts. Perhaps we can add api to register ui components, something like this: grub_ui_register (&grub_menu_ui); The structure may look like this: struct grub_ui { next name create destroy invoke } Then, we use an xml document to specify the screen layout and actions:
In create function, we pass the attributes so that ui knows how to draw its= elf. The ui can also implement extra named method, for example, image can have move method. To call them, we can use the invoke function, for example: invoke ("move", argc, argv); A similar interface can be implemented for lua ui components. --=20 Bean