0a319e759e6c53d048eae89e0dfd92a3ab8b2e3c
[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 --- a/src/matchbox-keyboard.c     2007-08-17 17:09:05.240878162 +0300
47 +++ b/src/matchbox-keyboard.c     2007-08-17 17:11:36.749512174 +0300
48 @@ -27,7 +27,9 @@
49           "   -xid,--xid            Print window ID to stdout ( for embedding )\n"
50           "   -d,--daemon           Run in 'daemon' mode (for remote control)\n"
51           "   -o,--orientation <portrait|landscape>\n"
52 -          "                         Use to limit visibility with screen orientation \n");
53 +         "                         Use to limit visibility with screen orientation \n"
54 +         "   -h,--hfactor <percent>\n"
55 +         "                         Fix keyboard window size in percentage of desktop height\n");
56    fprintf(stderr, "\nmatchbox-keyboard %s \nCopyright (C) 2007 OpenedHand Ltd.\n", VERSION);
57  
58    exit(-1);
59 @@ -52,7 +53,7 @@
60    kb->row_spacing = 5;
61  
62    kb->font_family  = strdup("sans");
63 -  kb->font_pt_size = 5;
64 +  kb->font_pt_size = 6;
65    kb->font_variant = strdup("bold");
66  
67    for (i = 1; i < argc; i++) 
68 @@ -63,6 +64,14 @@
69           continue;
70         }
71  
72 +      if (streq ("-h", argv[i]) || streq ("--hfactor", argv[i])) 
73 +       {
74 +         if (i + 1 < argc) {
75 +           kb->hfactor = atoi(argv[i + 1]);
76 +         }
77 +         continue;
78 +       }
79 +
80        if (streq ("-d", argv[i]) || streq ("--daemon", argv[i])) 
81         {
82           want_daemon = True;
83 diff -r ff9cf1fd8177 -r b010d54a6c50 src/matchbox-keyboard.h
84 --- a/src/matchbox-keyboard.h   Sun Apr 08 23:56:09 2007 +0000
85 +++ b/src/matchbox-keyboard.h   Mon Apr 09 00:06:34 2007 +0000
86 @@ -150,6 +150,7 @@
87    char                  *font_family;
88    int                    font_pt_size;
89    char                  *font_variant;
90 +  int                    hfactor;
91    char                  *config_file;
92    List                  *layouts;
93    MBKeyboardLayout      *selected_layout;