8513b6ed86c21ddfbb369a990b20df06d827dfe4
[openembedded.git] /
1 # HG changeset patch
2 # User pfalcon@localhost
3 # Date 1176077194 0
4 # Node ID b010d54a6c5020a68855e60e5a423ee3c18ed700
5 # Parent  ff9cf1fd8177dded04b9fc81ba630203848fc3ca
6 Changes to improve layout rendering, especially after adding support for
7 multiple layouts:
8 1. Add --hfactor option which presets keyboard to the specified percentage
9 of screen height. This is required for multiple layouts, as otherwise
10 height is calculated on specific layout, but in such a way that it is
11 affected by previous layout, which leads to rendering artifacts.
12 2. Also st default font height to 6, after all.
13
14 diff -r ff9cf1fd8177 -r b010d54a6c50 src/matchbox-keyboard-ui.c
15 --- a/src/matchbox-keyboard-ui.c        Sun Apr 08 23:56:09 2007 +0000
16 +++ b/src/matchbox-keyboard-ui.c        Mon Apr 09 00:06:34 2007 +0000
17 @@ -744,9 +744,15 @@ mb_kbd_ui_resources_create(MBKeyboardUI 
18                */
19               if (desk_width > ui->xwin_width)
20                 {
21 +                 int win_height;
22 +                 if (ui->kbd->hfactor != 0)
23 +                   win_height = desk_height * ui->kbd->hfactor / 100;
24 +                 else
25 +                   win_height = ( desk_width * ui->xwin_height ) / ui->xwin_width;
26 +
27                   mb_kbd_ui_resize(ui, 
28                                    desk_width, 
29 -                                  ( desk_width * ui->xwin_height ) / ui->xwin_width);
30 +                                  win_height);
31                 }
32               
33               wm_struct_vals[2]  = desk_y + desk_height - ui->xwin_height;
34 @@ -818,8 +824,11 @@ mb_kbd_ui_resize(MBKeyboardUI *ui, int w
35    width_diff  = width  - ui->base_alloc_width; 
36    height_diff = height - ui->base_alloc_height; 
37  
38 +/* It's better to have some "clipped" keys, than busted layout. */
39 +#if 0
40    if (width_diff < 0 || height_diff < 0)
41      return;  /* dont go smaller than our int request - get clipped */
42 +#endif
43  
44    layout   = mb_kbd_get_selected_layout(ui->kbd);
45    row_item = mb_kbd_layout_rows(layout);
46 diff -r ff9cf1fd8177 -r b010d54a6c50 src/matchbox-keyboard.c
47 --- a/src/matchbox-keyboard.c   Sun Apr 08 23:56:09 2007 +0000
48 +++ b/src/matchbox-keyboard.c   Mon Apr 09 00:06:34 2007 +0000
49 @@ -23,8 +23,9 @@ mb_kbd_usage (char *progname)
50  mb_kbd_usage (char *progname)
51  {
52    fprintf(stderr, "Usage:\n   %s [Options ] [ Layout Variant ]\n", progname);
53 -  fprintf(stderr, "\nOptions are;\n"
54 -         "   -xid,--xid            Print window ID to stdout ( for embedding )\n");
55 +  fprintf(stderr, "\nOptions are:\n"
56 +         "   -xid,--xid            Print window ID to stdout ( for embedding )\n"
57 +         "   --hfactor <percent>   Fix keyboard window size in percentage of desktop height\n");
58    fprintf(stderr, "\nmatchbox-keyboard %s \nCopyright (C) 2005 Matthew Allum, OpenedHand Ltd.\n", VERSION);
59  
60    exit(-1);
61 @@ -58,6 +59,13 @@ mb_kbd_new (int argc, char **argv)
62           want_embedding = True;
63           continue;
64         }
65 +      if (streq ("-hfactor", argv[i]) || streq ("--hfactor", argv[i])) 
66 +       {
67 +         if (i + 1 < argc) {
68 +           kb->hfactor = atoi(argv[i + 1]);
69 +         }
70 +         continue;
71 +       }
72  
73        if (i == (argc-1) && argv[i][0] != '-')
74         variant = argv[i];
75 @@ -77,7 +85,7 @@ mb_kbd_new (int argc, char **argv)
76        kb->key_pad      = 0;
77        kb->col_spacing  = 0;
78        kb->row_spacing  = 0;
79 -      kb->font_pt_size = 5;
80 +      kb->font_pt_size = 6;
81      }
82  
83    if (!mb_kbd_config_load(kb, variant))
84 diff -r ff9cf1fd8177 -r b010d54a6c50 src/matchbox-keyboard.h
85 --- a/src/matchbox-keyboard.h   Sun Apr 08 23:56:09 2007 +0000
86 +++ b/src/matchbox-keyboard.h   Mon Apr 09 00:06:34 2007 +0000
87 @@ -143,6 +143,7 @@ struct MBKeyboard
88    char                  *font_family;
89    int                    font_pt_size;
90    char                  *font_variant;
91 +  int                    hfactor;
92  
93    char                  *config_file;
94