From patchwork Fri Jan 15 01:10:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 567874 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 455C7140B0F for ; Fri, 15 Jan 2016 12:12:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=GTYQuJWy; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 48C64A77FE; Fri, 15 Jan 2016 02:12:02 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2JMepNy51PJ6; Fri, 15 Jan 2016 02:12:02 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AB20AA77F0; Fri, 15 Jan 2016 02:11:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2B056A77C0 for ; Fri, 15 Jan 2016 02:11:14 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y1uuuVLU79j6 for ; Fri, 15 Jan 2016 02:11:14 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) by theia.denx.de (Postfix) with ESMTPS id 1CB43A77D2 for ; Fri, 15 Jan 2016 02:11:08 +0100 (CET) Received: by mail-ob0-f173.google.com with SMTP id is5so98574384obc.0 for ; Thu, 14 Jan 2016 17:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=kQoiQydjvQumdtbA786Qvv22bfcNkXaim9cgUUlLqUQ=; b=GTYQuJWyoPpDOk4ffBT/AXGvM8SW9OT9w84ntTKZooXYSz/qO8eQmJX+QFxy8ewkYi wFMExBjEq8b4t1hgf1xRlso/tcII3MogPX/RIF/yqNEgE8dl30qnhwRX5PF8XgzPc1f7 j8gT72GzAuerMQBPlbDx9wwtZYVOygGvl2684LIXs/lNYWTpA0GjGF+ZDO3LyiBMI8XW 6gMtGbykLHbkd4Qj19m59p1PzPRmOTWlopM5jtvHh8g4uJy5V/45GoNhn80lVhEjQ3CW 9J4P/KhxkSAu04pY4n4PhOZYWHuKq3Zxsy8MOvOOSvyBBjGcuW6rLljO0cNISy+ZLNcI 2eWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=kQoiQydjvQumdtbA786Qvv22bfcNkXaim9cgUUlLqUQ=; b=P/d1WQmE7B1Ts1LH1sgdu60zTOQ1wyMip+2ijrLXhLx5WAWTIE++3bZC7Pm1YefiOz 5/j3VYeowT/wwOaqoeZMEPqhVotwHakKxNNibCBdO1nhJ0r9uRvr6s9z9oT0qmbVcXo6 gHOdTe1Qq1kwJuB6ZCs9NTUaVb+e/aqB/avldDWKpsgFysNYrao94YdS0t4Au/lfljcF ZqAVITJQflVOYkRLVheRqCOS1YnKeOgdNmvygggR3LPUJlYxCkYA7J+sXbFD0EOEcacK sjL3Q6haP+FAh4qgCXNP2vHBuwusxI3rPi4w9fmV3pFmYA5FnnSGoWE1g0vHLwREaFj3 GCdg== X-Gm-Message-State: ALoCoQnk7jrzyQFt4peBA2PrSD9pogS+/XgWYEbyqyRLA2b3yammAyP5fDmOQxnnLXBT9Ur7ECVy8OcTONXae8oVWpsEJeqOJQ== X-Received: by 10.60.159.7 with SMTP id wy7mr6275319oeb.71.1452820267741; Thu, 14 Jan 2016 17:11:07 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id a128sm5097609oig.3.2016.01.14.17.11.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jan 2016 17:11:06 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 1CAAE220FDA; Thu, 14 Jan 2016 18:11:03 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 14 Jan 2016 18:10:41 -0700 Message-Id: <1452820252-2126-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1452820252-2126-1-git-send-email-sjg@chromium.org> References: <1452820252-2126-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH 08/19] video: Provide a backspace method X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With proportional fonts the vidconsole uclass cannot itself erase the previous character. Provide an optional method so that the driver can handle this operation. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 12 +++++++++++- include/video_console.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 182aaed..832e90a 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -57,9 +57,17 @@ static int vidconsole_entry_start(struct udevice *dev) } /* Move backwards one space */ -static void vidconsole_back(struct udevice *dev) +static int vidconsole_back(struct udevice *dev) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ops *ops = vidconsole_get_ops(dev); + int ret; + + if (ops->backspace) { + ret = ops->backspace(dev); + if (ret != -ENOSYS) + return ret; + } priv->xcur_frac -= VID_TO_POS(priv->x_charsize); if (priv->xcur_frac < priv->xstart_frac) { @@ -69,6 +77,8 @@ static void vidconsole_back(struct udevice *dev) if (priv->ycur < 0) priv->ycur = 0; } + + return 0; } /* Move to a newline, scrolling the display if necessary */ diff --git a/include/video_console.h b/include/video_console.h index 80bc948..1345748 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -101,6 +101,20 @@ struct vidconsole_ops { * positions. */ int (*entry_start)(struct udevice *dev); + + /** + * backspace() - Handle erasing the last character + * + * With proportional fonts the vidconsole uclass cannot itself erase + * the previous character. This optional method will be called when + * a backspace is needed. The driver should erase the previous + * character and update the cursor position (xcur_frac, ycur) to the + * start of the previous character. + * + * If not implement, default behaviour will work for fixed-width + * characters. + */ + int (*backspace)(struct udevice *dev); }; /* Get a pointer to the driver operations for a video console device */