File: 02-Remove-redundent-key-label-information.patch

package info (click to toggle)
libgnomekbd 3.28.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,708 kB
  • sloc: ansic: 5,919; makefile: 172; sh: 58; python: 14; javascript: 5
file content (58 lines) | stat: -rw-r--r-- 1,998 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From: James M Leddy <jm.leddy@gmail.com>
Date: Thu, 14 Feb 2013 17:54:34 -0500
Subject: Remove redundent key label information

There are a few keys that display 4 of the same thing. Most notable
are the function keys and the math operators on the numpad. This
is redundant without adding any new information. This patch seeks
to address this by not printing anything that matches the keycode
in the top left corner of the key.

There is more info in https://bugzilla.gnome.org/show_bug.cgi?id=693847
---
 libgnomekbd/gkbd-keyboard-drawing.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index 932644a..043b61b 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -994,6 +994,7 @@ draw_key_label (GkbdKeyboardDrawingRenderContext * context,
 	gint x, y, width, height;
 	gint padding;
 	gint g, l, glp;
+	KeySym left_sym = 0;
 
 	if (!drawing->xkb || !drawing->groupLevels || keycode == INVALID_KEYCODE)
 		return;
@@ -1036,11 +1037,15 @@ draw_key_label (GkbdKeyboardDrawingRenderContext * context,
 						 XkbBuildCoreState
 						 (drawing->mods, g),
 						 &mods_rtrn, &keysym)) {
+				if (keysym == left_sym)
+					continue;
 				draw_key_label_helper (context, drawing,
 						       keysym, angle, glp,
 						       x, y, width, height,
 						       padding,
 						       is_pressed);
+				if (glp == GKBD_KEYBOARD_DRAWING_POS_TOPLEFT)
+					left_sym = keysym;
 				/* reverse y order */
 			}
 		} else {
@@ -1049,10 +1054,14 @@ draw_key_label (GkbdKeyboardDrawingRenderContext * context,
 			keysym =
 			    XkbKeySymEntry (drawing->xkb, keycode, l, g);
 
+			if (keysym == left_sym)
+				continue;
 			draw_key_label_helper (context, drawing, keysym,
 					       angle, glp, x, y, width,
 					       height, padding,
 					       is_pressed);
+			if (glp == GKBD_KEYBOARD_DRAWING_POS_TOPLEFT)
+				left_sym = keysym;
 			/* reverse y order */
 		}
 	}