From owner-svn-src-head@freebsd.org Mon Jun 11 01:32:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ABEA100AD8E; Mon, 11 Jun 2018 01:32:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C6C883A7F; Mon, 11 Jun 2018 01:32:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EB6B14CFC; Mon, 11 Jun 2018 01:32:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5B1WIXr094547; Mon, 11 Jun 2018 01:32:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5B1WI5d094546; Mon, 11 Jun 2018 01:32:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201806110132.w5B1WI5d094546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 11 Jun 2018 01:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334939 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 334939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 01:32:19 -0000 Author: kevans Date: Mon Jun 11 01:32:18 2018 New Revision: 334939 URL: https://svnweb.freebsd.org/changeset/base/334939 Log: lualoader: Allow brand-*.lua for adding new brands dteske@, I believe, had originally pointed out that lualoader failed to allow logo-*.lua for new logos to be added. When correcting this mistake, I failed to do the same for brands. Correct the sub-mistake: creating new brands is almost identical to creating new logos, except one must use `drawer.addBrand` and 'graphic' is the only valid key for a branddef at the moment. While here, I've added `drawer.default_brand` to be set to name of brand to be used (e.g. 'fbsd', project default). Eventually this whole goolash will be documented. Reported by: kmoore, iXsystems Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Jun 11 01:22:01 2018 (r334938) +++ head/stand/lua/drawer.lua Mon Jun 11 01:32:18 2018 (r334939) @@ -51,6 +51,22 @@ local function menuEntryName(drawing_menu, entry) return entry.name end +local function getBranddef(brand) + if brand == nil then + return nil + end + -- Look it up + local branddef = drawer.branddefs[brand] + + -- Try to pull it in + if branddef == nil then + try_include('brand-' .. brand) + branddef = drawer.branddefs[brand] + end + + return branddef +end + local function getLogodef(logo) if logo == nil then return nil @@ -79,6 +95,8 @@ fbsd_brand = { none = {""} -- Module exports +drawer.default_brand = 'fbsd' + drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being -- drawn as parameters, and return the name of the item. @@ -315,8 +333,13 @@ function drawer.drawbrand() local y = tonumber(loader.getenv("loader_brand_y")) or drawer.brand_position.y - local graphic = drawer.branddefs[loader.getenv("loader_brand")] or - fbsd_brand + local branddef = getBranddef(loader.getenv("loader_brand")) + + if branddef == nil then + branddef = getBranddef(drawer.default_brand) + end + + local graphic = branddef.graphic x = x + drawer.shift.x y = y + drawer.shift.y