All of lore.kernel.org
 help / color / mirror / Atom feed
* [Powertop] [PATCH 1/2] Use symbolic instead of numeric constants for keys
@ 2013-05-19 16:00 Hans-Peter Deifel
  0 siblings, 0 replies; 3+ messages in thread
From: Hans-Peter Deifel @ 2013-05-19 16:00 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

This improves the readability of the key handling code.

Since there is no symbolic constant for Escape, a comment with an
explanation is added.

Signed-off-by: Hans-Peter Deifel <hpdeifel(a)gmx.de>
---
 src/main.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 0883424..46466b0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -136,10 +136,10 @@ static void do_sleep(int seconds)
 
 		c = getch();
 		switch (c) {
-		case 353: 
+		case KEY_BTAB:
 			show_prev_tab();
 			break;
-		case 9:
+		case '\t':
 			show_next_tab(); 
 			break;
 		case KEY_RIGHT:
@@ -156,8 +156,8 @@ static void do_sleep(int seconds)
 		case KEY_UP:
 			cursor_up();
 			break;
-		case 32:
-		case 10:
+		case ' ':
+		case '\n':
 			cursor_enter();
 			break;
 		case 's':
@@ -169,7 +169,7 @@ static void do_sleep(int seconds)
 			return;
 		case KEY_EXIT:
 		case 'q':
-		case 27:
+		case 27:	// Escape
 			leave_powertop = 1;
 			return;
 		}
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Powertop] [PATCH 1/2] Use symbolic instead of numeric constants for keys
@ 2013-05-20 10:43 Paul Menzel
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2013-05-20 10:43 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

Am Sonntag, den 19.05.2013, 18:00 +0200 schrieb Hans-Peter Deifel:
> This improves the readability of the key handling code.
> 
> Since there is no symbolic constant for Escape, a comment with an
> explanation is added.
> 
> Signed-off-by: Hans-Peter Deifel <hpdeifel(a)gmx.de>
> ---
>  src/main.cpp | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

[…]

Acked-by: Paul Menzel <paulepanter(a)users.sourceforge.net>


Thanks,

Paul

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Powertop] [PATCH 1/2] Use symbolic instead of numeric constants for keys
@ 2013-05-20 13:25 Sergey Senozhatsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2013-05-20 13:25 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1388 bytes --]

On (05/19/13 18:00), Hans-Peter Deifel wrote:
> This improves the readability of the key handling code.
> 
> Since there is no symbolic constant for Escape, a comment with an
> explanation is added.
> 
> Signed-off-by: Hans-Peter Deifel <hpdeifel(a)gmx.de>
> ---

looks good, thanks.

	-ss

>  src/main.cpp | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/main.cpp b/src/main.cpp
> index 0883424..46466b0 100644
> --- a/src/main.cpp
> +++ b/src/main.cpp
> @@ -136,10 +136,10 @@ static void do_sleep(int seconds)
>  
>  		c = getch();
>  		switch (c) {
> -		case 353: 
> +		case KEY_BTAB:
>  			show_prev_tab();
>  			break;
> -		case 9:
> +		case '\t':
>  			show_next_tab(); 
>  			break;
>  		case KEY_RIGHT:
> @@ -156,8 +156,8 @@ static void do_sleep(int seconds)
>  		case KEY_UP:
>  			cursor_up();
>  			break;
> -		case 32:
> -		case 10:
> +		case ' ':
> +		case '\n':
>  			cursor_enter();
>  			break;
>  		case 's':
> @@ -169,7 +169,7 @@ static void do_sleep(int seconds)
>  			return;
>  		case KEY_EXIT:
>  		case 'q':
> -		case 27:
> +		case 27:	// Escape
>  			leave_powertop = 1;
>  			return;
>  		}
> -- 
> 1.8.1.5
> 
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-20 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 13:25 [Powertop] [PATCH 1/2] Use symbolic instead of numeric constants for keys Sergey Senozhatsky
  -- strict thread matches above, loose matches on Subject: below --
2013-05-20 10:43 Paul Menzel
2013-05-19 16:00 Hans-Peter Deifel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.