From patchwork Wed Feb 18 02:18:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 5842491 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DC159F37F for ; Wed, 18 Feb 2015 02:21:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC47C20155 for ; Wed, 18 Feb 2015 02:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E762F20149 for ; Wed, 18 Feb 2015 02:21:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751925AbbBRCVT (ORCPT ); Tue, 17 Feb 2015 21:21:19 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34000 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752507AbbBRCTc (ORCPT ); Tue, 17 Feb 2015 21:19:32 -0500 Received: by pabrd3 with SMTP id rd3so10881236pab.1; Tue, 17 Feb 2015 18:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hDufRPl13SX0YQnBAO4veUwgAM124h7Q//0YmdAuNHI=; b=dNxj+WO13ACrPyODdxo4ADCXZd2/RK7Qra156w9E/CEuCZqpbd8zSzSAFXSCkfcAIv G+xQ3a67exym1YvwGVV82EFM4PG6cje2u8fAswVBnFD/vkbPikR/f2PPjm3VIlxusOkI CWDWtlCO+WKdIXC3idKvXVJwPhiu3s2gU19+YmPF5TvUtwJRK9f3LPSm8Eq3etIKQpw9 8N7ehktpv3pqnRxdhwgrGhg1vpay46y+3qt5Da2CepqHLna9FHWEyLhe0QJIiq4LvL1a DNyaDtBc9OzzCqAPwJxMlPu1ZGVL7Ei7PWUS7S4tIe15qT49o6PISjJ+pW255z9m51yL 7uhQ== X-Received: by 10.67.7.10 with SMTP id cy10mr30509144pad.151.1424225971590; Tue, 17 Feb 2015 18:19:31 -0800 (PST) Received: from ld-irv-0074.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id ff10sm19169159pad.1.2015.02.17.18.19.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Feb 2015 18:19:30 -0800 (PST) From: Brian Norris To: Zhang Rui , Cc: Neil Horman , Brian Norris , Javi Merino , Florian Fainelli , , Subject: [PATCH 3/8] tools/thermal: tmon: tui: don't hard-code dialog window size assumptions Date: Tue, 17 Feb 2015 18:18:31 -0800 Message-Id: <1424225916-13488-4-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424225916-13488-1-git-send-email-computersforpeace@gmail.com> References: <1424225916-13488-1-git-send-email-computersforpeace@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can use the ncurses API to get the number of rows. Signed-off-by: Brian Norris --- tools/thermal/tmon/tui.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/thermal/tmon/tui.c b/tools/thermal/tmon/tui.c index 43c5aecf71da..2779573a53cb 100644 --- a/tools/thermal/tmon/tui.c +++ b/tools/thermal/tmon/tui.c @@ -274,11 +274,14 @@ const char DIAG_TITLE[] = "[ TUNABLES ]"; void show_dialogue(void) { int j, x = 0, y = 0; + int rows, cols; WINDOW *w = dialogue_window; if (tui_disabled || !w) return; + getmaxyx(w, rows, cols); + werase(w); box(w, 0, 0); mvwprintw(w, 0, maxx/4, DIAG_TITLE); @@ -297,10 +300,8 @@ void show_dialogue(void) wattron(w, A_BOLD); mvwprintw(w, DIAG_DEV_ROWS+1, 1, "Enter Choice [A-Z]?"); wattroff(w, A_BOLD); - /* y size of dialogue win is nr cdev + 5, so print legend - * at the bottom line - */ - mvwprintw(w, ptdata.nr_cooling_dev+3, 1, + /* print legend at the bottom line */ + mvwprintw(w, rows - 2, 1, "Legend: A=Active, P=Passive, C=Critical"); wrefresh(dialogue_window);