aboutsummaryrefslogtreecommitdiffstats
path: root/packages/matchbox-keyboard/files/3-Changes-to-improve-layout-rendering--especially-after-adding-support-for.patch
blob: 0a319e759e6c53d048eae89e0dfd92a3ab8b2e3c (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# HG changeset patch
# User pfalcon@localhost
# Date 1176077194 0
# Node ID b010d54a6c5020a68855e60e5a423ee3c18ed700
# Parent  ff9cf1fd8177dded04b9fc81ba630203848fc3ca
Changes to improve layout rendering, especially after adding support for
multiple layouts:
1. Add --hfactor option which presets keyboard to the specified percentage
of screen height. This is required for multiple layouts, as otherwise
height is calculated on specific layout, but in such a way that it is
affected by previous layout, which leads to rendering artifacts.
2. Also st default font height to 6, after all.

diff -r ff9cf1fd8177 -r b010d54a6c50 src/matchbox-keyboard-ui.c
--- a/src/matchbox-keyboard-ui.c	Sun Apr 08 23:56:09 2007 +0000
+++ b/src/matchbox-keyboard-ui.c	Mon Apr 09 00:06:34 2007 +0000
@@ -744,9 +744,15 @@ mb_kbd_ui_resources_create(MBKeyboardUI 
 	       */
 	      if (desk_width > ui->xwin_width)
 		{
+		  int win_height;
+		  if (ui->kbd->hfactor != 0)
+		    win_height = desk_height * ui->kbd->hfactor / 100;
+		  else
+		    win_height = ( desk_width * ui->xwin_height ) / ui->xwin_width;
+
 		  mb_kbd_ui_resize(ui, 
 				   desk_width, 
-				   ( desk_width * ui->xwin_height ) / ui->xwin_width);
+				   win_height);
 		}
 	      
 	      wm_struct_vals[2]  = desk_y + desk_height - ui->xwin_height;
@@ -818,8 +824,11 @@ mb_kbd_ui_resize(MBKeyboardUI *ui, int w
   width_diff  = width  - ui->base_alloc_width; 
   height_diff = height - ui->base_alloc_height; 
 
+/* It's better to have some "clipped" keys, than busted layout. */
+#if 0
   if (width_diff < 0 || height_diff < 0)
     return;  /* dont go smaller than our int request - get clipped */
+#endif
 
   layout   = mb_kbd_get_selected_layout(ui->kbd);
   row_item = mb_kbd_layout_rows(layout);
--- a/src/matchbox-keyboard.c     2007-08-17 17:09:05.240878162 +0300
+++ b/src/matchbox-keyboard.c     2007-08-17 17:11:36.749512174 +0300
@@ -27,7 +27,9 @@
 	  "   -xid,--xid            Print window ID to stdout ( for embedding )\n"
 	  "   -d,--daemon           Run in 'daemon' mode (for remote control)\n"
 	  "   -o,--orientation <portrait|landscape>\n"
-          "                         Use to limit visibility with screen orientation \n");
+	  "                         Use to limit visibility with screen orientation \n"
+	  "   -h,--hfactor <percent>\n"
+	  "                         Fix keyboard window size in percentage of desktop height\n");
   fprintf(stderr, "\nmatchbox-keyboard %s \nCopyright (C) 2007 OpenedHand Ltd.\n", VERSION);
 
   exit(-1);
@@ -52,7 +53,7 @@
   kb->row_spacing = 5;
 
   kb->font_family  = strdup("sans");
-  kb->font_pt_size = 5;
+  kb->font_pt_size = 6;
   kb->font_variant = strdup("bold");
 
   for (i = 1; i < argc; i++) 
@@ -63,6 +64,14 @@
          continue;
        }
 
+      if (streq ("-h", argv[i]) || streq ("--hfactor", argv[i])) 
+       {
+         if (i + 1 < argc) {
+           kb->hfactor = atoi(argv[i + 1]);
+         }
+         continue;
+       }
+
       if (streq ("-d", argv[i]) || streq ("--daemon", argv[i])) 
        {
          want_daemon = True;
diff -r ff9cf1fd8177 -r b010d54a6c50 src/matchbox-keyboard.h
--- a/src/matchbox-keyboard.h	Sun Apr 08 23:56:09 2007 +0000
+++ b/src/matchbox-keyboard.h	Mon Apr 09 00:06:34 2007 +0000
@@ -150,6 +150,7 @@
   char                  *font_family;
   int                    font_pt_size;
   char                  *font_variant;
+  int                    hfactor;
   char                  *config_file;
   List                  *layouts;
   MBKeyboardLayout      *selected_layout;