Changeset 1158


Ignore:
Timestamp:
02/28/07 09:20:02 (6 years ago)
Author:
caowai_song
Message:
  1. Add background picture to the keyboard
  2. Display normal picture or pushed picture for each keys
Location:
trunk/src/target/OM-2007/applications/openmoko-keyboard
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml

    r542 r1158  
    1 <?xml version="1.0" encoding="UTF-8"?> 
     1<?xml version="1.0" encoding="UTF-8"?> 
    22<keyboard> 
    33 
     
    77 
    88<layout id="defualt keyboard"> 
    9  
    10 <!-- 
    11   <row> 
    12      <key> 
    13           <default display="ヂ" />                 
    14     </key> 
    15     <key> 
    16           <default display="Óª" />                 
    17     </key> 
    18     <key width="1500"> 
    19           <default display="Ω" />                 
    20     </key> 
    21     <space width="1500" /> 
    22     <key fill="true"> 
    23           <default display="â ¿" />                 
    24     </key> 
    25   </row> 
    26 --> 
     9  <background image="bg_keypad.png" /> 
    2710 
    2811  <row> 
    2912 
    30     <space width="500" extended="true"/> 
    31  
    32     <key fill="true"> 
    33           <default display="Esc" action="escape" /> 
    34           <background image="testkey.png"/> 
    35     </key> 
    36 <!-- 
    3713    <key> 
    38       <default display="image:/usr/share/pixmaps/sync_icon.png" action="a"/> 
    39     </key>   
    40 --> 
    41     <key> 
    42           <default display="`" /> 
    43           <background image="testkey.png"/> 
     14      <default display="Q" /> 
     15      <normalimage image="key_cap_Q.png"/> 
     16      <pushimage image="key_cap_Q_p.png"/> 
    4417    </key> 
    4518    <key> 
    46           <default display="1" />                 
    47           <shifted display="!" /> 
    48           <background image="testkey.png"/> 
     19      <default display="W" /> 
     20      <normalimage image="key_cap_W.png"/> 
     21      <pushimage image="key_cap_W_p.png"/> 
    4922    </key> 
    5023    <key> 
    51           <default display="2" />                 
    52           <shifted display='"' /> 
    53           <mod1    display="œ" /> 
    54           <background image="testkey.png"/> 
     24      <default display="E" /> 
     25      <normalimage image="key_cap_E.png"/> 
     26      <pushimage image="key_cap_E_p.png"/> 
    5527    </key> 
    5628    <key> 
    57           <default display="3" /> 
    58           <shifted display="£" /> 
    59           <mod1    display="Ÿ" />                
    60           <background image="testkey.png"/> 
     29      <default display="R" /> 
     30      <normalimage image="key_cap_R.png"/> 
     31      <pushimage image="key_cap_R_p.png"/> 
    6132    </key> 
    6233    <key> 
    63           <default display="4" /> 
    64           <shifted display="$" />                 
    65           <background image="testkey.png"/> 
     34      <default display="T" /> 
     35      <normalimage image="key_cap_T.png"/> 
     36      <pushimage image="key_cap_T_p.png"/> 
    6637    </key> 
    6738    <key> 
    68           <default display="5" /> 
    69           <shifted display="%" />                 
    70           <background image="testkey.png"/> 
     39      <default display="Y" /> 
     40      <normalimage image="key_cap_Y.png"/> 
     41      <pushimage image="key_cap_Y_p.png"/> 
    7142    </key> 
    7243    <key> 
    73           <default display="6" /> 
    74           <shifted display="^" />                 
    75           <background image="testkey.png"/> 
     44      <default display="U" /> 
     45      <normalimage image="key_cap_U.png"/> 
     46      <pushimage image="key_cap_U_p.png"/> 
    7647    </key> 
    7748    <key> 
    78           <default display="7" /> 
    79           <shifted display="&amp;" />                 
    80           <background image="testkey.png"/> 
     49      <default display="I" /> 
     50      <normalimage image="key_cap_I.png"/> 
     51      <pushimage image="key_cap_I_p.png"/> 
    8152    </key> 
    8253    <key> 
    83           <default display="8" /> 
    84           <shifted display="*" />                 
    85           <background image="testkey.png"/> 
     54      <default display="O" /> 
     55      <normalimage image="key_cap_O.png"/> 
     56      <pushimage image="key_cap_O_p.png"/> 
    8657    </key> 
    8758    <key> 
    88           <default display="9" /> 
    89           <shifted display="(" />                 
    90           <background image="testkey.png"/> 
    91     </key> 
    92     <key> 
    93           <default display="0" /> 
    94           <shifted display=")" />                 
    95           <background image="testkey.png"/> 
    96     </key> 
    97     <key> 
    98           <default display="-" /> 
    99           <shifted display="_" />                 
    100           <background image="testkey.png"/> 
    101     </key> 
    102     <key> 
    103           <default display="=" /> 
    104           <shifted display="+" />                 
    105           <background image="testkey.png"/> 
    106     </key> 
    107  
    108     <key fill="true"> 
    109           <default display="Bksp" action="backspace"/> 
     59      <default display="P" /> 
     60      <normalimage image="key_cap_P.png"/> 
     61      <pushimage image="key_cap_P_p.png"/> 
    11062    </key> 
    11163 
     
    11466  <row> 
    11567 
    116     <space width="500" extended="true"/> 
    117  
    118     <key fill="true"> 
    119           <default display="Tab" action="tab"/>                 
    120     </key> 
    121     <key obey-caps='true'> 
    122           <default display="q" />                 
    123           <shifted display="Q" /> 
    124           <background image="testkey.png"/> 
    125     </key> 
    126     <key obey-caps='true'> 
    127           <default display="w" />                 
    128           <shifted display="W" /> 
    129           <background image="testkey.png"/> 
    130     </key> 
    131     <key obey-caps='true'> 
    132           <mod1 display="ë" /> 
    133           <default    display="e" />                 
    134           <shifted display="E" /> 
    135           <background image="testkey.png"/> 
    136     </key> 
    137     <key obey-caps='true'> 
    138           <default display="r" />                 
    139           <shifted display="R" /> 
    140           <background image="testkey.png"/> 
    141     </key> 
    142     <key obey-caps='true'> 
    143           <default display="t" />                 
    144           <shifted display="T" /> 
    145           <background image="testkey.png"/> 
    146     </key> 
    147     <key obey-caps='true'> 
    148           <default display="y" />                 
    149           <shifted display="Y" /> 
    150           <background image="testkey.png"/> 
    151     </key> 
    152     <key obey-caps='true'> 
    153           <default display="u" />                 
    154           <shifted display="U" /> 
    155           <background image="testkey.png"/> 
    156     </key> 
    157     <key obey-caps='true'> 
    158           <default display="i" />                 
    159           <shifted display="I" /> 
    160           <background image="testkey.png"/> 
    161     </key> 
    162     <key obey-caps='true'> 
    163           <default display="o" />                 
    164           <shifted display="O" /> 
    165           <background image="testkey.png"/> 
    166     </key> 
    167     <key obey-caps='true'> 
    168           <default display="p" />                 
    169           <shifted display="P" /> 
    170           <background image="testkey.png"/> 
     68    <key> 
     69      <default display="A" /> 
     70      <normalimage image="key_cap_A.png"/> 
     71      <pushimage image="key_cap_A_p.png"/> 
    17172    </key> 
    17273    <key> 
    173           <default display="{" />                 
    174           <shifted display="[" /> 
    175           <background image="testkey.png"/> 
     74      <default display="S" /> 
     75      <normalimage image="key_cap_S.png"/> 
     76      <pushimage image="key_cap_S_p.png"/> 
    17677    </key> 
    17778    <key> 
    178           <default display="}" />                 
    179           <shifted display="]" /> 
    180           <background image="testkey.png"/> 
     79      <default display="D" /> 
     80      <normalimage image="key_cap_D.png"/> 
     81      <pushimage image="key_cap_D_p.png"/> 
    18182    </key> 
    182     <key fill="true"> 
    183           <default display="\" />                 
    184           <shifted display="|" /> 
    185           <background image="testkey.png"/> 
     83    <key> 
     84      <default display="F" /> 
     85      <normalimage image="key_cap_F.png"/> 
     86      <pushimage image="key_cap_F_p.png"/> 
     87    </key> 
     88    <key> 
     89      <default display="G" /> 
     90      <normalimage image="key_cap_G.png"/> 
     91      <pushimage image="key_cap_G_p.png"/> 
     92    </key> 
     93    <key> 
     94      <default display="H" /> 
     95      <normalimage image="key_cap_H.png"/> 
     96      <pushimage image="key_cap_H_p.png"/> 
     97    </key> 
     98    <key> 
     99      <default display="J" /> 
     100      <normalimage image="key_cap_J.png"/> 
     101      <pushimage image="key_cap_J_p.png"/> 
     102    </key> 
     103    <key> 
     104      <default display="K" /> 
     105      <normalimage image="key_cap_K.png"/> 
     106      <pushimage image="key_cap_K_p.png"/> 
     107    </key> 
     108    <key> 
     109      <default display="L" /> 
     110      <normalimage image="key_cap_L.png"/> 
     111      <pushimage image="key_cap_L_p.png"/> 
    186112    </key> 
    187113 
     
    189115  <row> 
    190116 
    191     <space width="500" extended="true"/> 
    192  
    193     <key fill="true"> 
    194           <default display="Caps" action="modifier:caps"/>                 
    195     </key> 
    196     <key obey-caps='true'> 
    197           <default display="a" />                 
    198           <shifted display="A" /> 
    199           <background image="testkey.png"/> 
    200     </key> 
    201     <key obey-caps='true'> 
    202           <default display="s" />                 
    203           <shifted display="S" /> 
    204           <background image="testkey.png"/> 
    205     </key> 
    206     <key obey-caps='true'> 
    207           <default display="d" />                 
    208           <shifted display="D" /> 
    209           <background image="testkey.png"/> 
    210     </key> 
    211     <key obey-caps='true'> 
    212           <default display="f" />                 
    213           <shifted display="F" /> 
    214           <background image="testkey.png"/> 
    215     </key> 
    216     <key obey-caps='true'> 
    217           <default display="g" />                 
    218           <shifted display="G" /> 
    219           <background image="testkey.png"/> 
    220     </key> 
    221     <key obey-caps='true'> 
    222           <default display="h" />                 
    223           <shifted display="H" /> 
    224           <background image="testkey.png"/> 
    225     </key> 
    226     <key obey-caps='true'> 
    227           <default display="j" />                 
    228           <shifted display="J" /> 
    229           <background image="testkey.png"/> 
    230     </key> 
    231     <key obey-caps='true'> 
    232           <default display="k" />                 
    233           <shifted display="K" /> 
    234           <background image="testkey.png"/> 
    235     </key> 
    236     <key obey-caps='true'> 
    237           <default display="l" />                 
    238           <shifted display="L" /> 
    239           <background image="testkey.png"/> 
     117    <key> 
     118      <default display="Z" /> 
     119      <normalimage image="key_cap_Z.png"/> 
     120      <pushimage image="key_cap_Z_p.png"/> 
    240121    </key> 
    241122    <key> 
    242           <default display=";" />                 
    243           <shifted display=":" /> 
    244           <background image="testkey.png"/> 
     123      <default display="X" /> 
     124      <normalimage image="key_cap_X.png"/> 
     125      <pushimage image="key_cap_X_p.png"/> 
    245126    </key> 
    246127    <key> 
    247           <default display="#" />                 
    248           <shifted display="~" /> 
    249           <background image="testkey.png"/> 
     128      <default display="C" /> 
     129      <normalimage image="key_cap_C.png"/> 
     130      <pushimage image="key_cap_C_p.png"/> 
    250131    </key> 
    251     <key fill="true"> 
    252           <default display="Ret" action="return"/> 
     132    <key> 
     133      <default display="V" /> 
     134      <normalimage image="key_cap_V.png"/> 
     135      <pushimage image="key_cap_V_p.png"/> 
     136    </key> 
     137    <key> 
     138      <default display="B" /> 
     139      <normalimage image="key_cap_B.png"/> 
     140      <pushimage image="key_cap_B_p.png"/> 
     141    </key> 
     142    <key> 
     143      <default display="N" /> 
     144      <normalimage image="key_cap_N.png"/> 
     145      <pushimage image="key_cap_N_p.png"/> 
     146    </key> 
     147    <key> 
     148      <default display="M" /> 
     149      <normalimage image="key_cap_M.png"/> 
     150      <pushimage image="key_cap_M_p.png"/> 
    253151    </key> 
    254152 
    255153  </row> 
     154 
    256155  <row> 
    257  
    258     <space width="500" extended="true"/> 
    259  
    260     <key fill="true"> 
    261           <default display="Shift" action="modifier:shift"/>                 
    262     </key> 
    263  
    264     <key obey-caps='true'> 
    265           <default display="z" />                 
    266           <shifted display="Z" /> 
    267           <background image="testkey.png"/> 
    268     </key> 
    269  
    270     <key obey-caps='true'> 
    271           <default display="x" />                 
    272           <shifted display="X" /> 
    273           <background image="testkey.png"/> 
    274     </key> 
    275  
    276     <key obey-caps='true'> 
    277           <default display="c" />                 
    278           <shifted display="C" /> 
    279           <background image="testkey.png"/> 
    280     </key> 
    281  
    282     <key obey-caps='true'> 
    283           <default display="v" />                 
    284           <shifted display="V" /> 
    285           <background image="testkey.png"/> 
    286     </key> 
    287  
    288     <key obey-caps='true'> 
    289           <default display="b" />                 
    290           <shifted display="B" /> 
    291           <background image="testkey.png"/> 
    292     </key> 
    293  
    294     <key obey-caps='true'> 
    295           <default display="n" />                 
    296           <shifted display="N" /> 
    297           <background image="testkey.png"/> 
    298     </key> 
    299  
    300     <key obey-caps='true'> 
    301           <default display="m" />                 
    302           <shifted display="M" /> 
    303           <background image="testkey.png"/> 
    304     </key> 
    305  
    306     <key> 
    307           <default display="," />                 
    308           <shifted display="&lt;" /> 
    309           <background image="testkey.png"/> 
    310     </key> 
    311     <key> 
    312           <default display="." />                 
    313           <shifted display="&gt;" /> 
    314           <background image="testkey.png"/> 
    315     </key> 
    316     <key> 
    317           <default display="/" />                 
    318           <shifted display="?" /> 
    319           <background image="testkey.png"/> 
    320     </key> 
    321  
    322  
    323     <key fill="true"> 
    324           <default display="Shift" action="modifier:shift"/>                 
    325     </key> 
    326  
    327  </row> 
    328   <row> 
    329  
    330     <space width="500" extended="true"/> 
    331  
    332     <key> 
    333           <default display="Àëö" action="modifier:mod1"/>                 
    334     </key> 
    335  
    336     <key fill="true"> 
    337           <default display="Ctrl" action="modifier:ctrl"/>                 
    338     </key> 
    339  
    340     <key> 
    341           <default display="Alt" action="modifier:alt"/>                 
    342     </key> 
    343156 
    344157 
    345158    <key> 
    346           <default display=" " action="space" />                 
    347           <background image="spacekey.png"/> 
    348     </key> 
    349  
    350     <key> 
    351           <default display="@" />                 
    352           <shifted display="'" /> 
    353     </key> 
    354  
    355     <key> 
    356           <default display="^" action="up" />                 
     159      <default display=" " action="space" /> 
     160      <normalimage image="key_comm_space.png"/> 
     161      <pushimage image="key_comm_space_p.png"/> 
    357162    </key> 
    358163    <key> 
    359           <default display="V" action="down" />                 
     164      <default display=" " action="backspace" /> 
     165      <normalimage image="key_comm_backspace.png"/> 
     166      <pushimage image="key_comm_backspace_p.png"/> 
    360167    </key> 
    361168    <key> 
    362           <default display="&lt;" action="left" />                 
     169      <default display=" " action="return" /> 
     170      <normalimage image="key_comm_enter.png"/> 
     171      <pushimage image="key_comm_enter_p.png"/> 
    363172    </key> 
    364     <key> 
    365           <default display="&gt;" action="right" />                 
    366     </key> 
    367  
    368 </row> 
     173  </row> 
    369174 
    370175</layout> 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c

    r530 r1158  
    316316  const char *val; 
    317317  char  buf[512]; 
     318  Bool  pushimage; 
     319 
     320  if (streq(tag, "normalimage")) 
     321    { 
     322      pushimage = False; 
     323    } 
     324  else if (streq(tag, "pushimage")) 
     325    { 
     326      pushimage = True; 
     327    } 
     328  else 
     329    { 
     330      set_error(state, "Unknown background image"); 
     331      return; 
     332    } 
    318333 
    319334  if ((val = attr_get_val("image", attr)) == NULL) 
    320335    { 
    321       fprintf(stderr, "image=%s\n", val); 
    322336      set_error(state, "Attribute 'image' is required"); 
    323337      return; 
     
    340354    fprintf(stderr, "load img fail\n"); 
    341355 
    342   mb_kbd_key_set_back_image(state->current_key, img); 
     356  if (pushimage) 
     357    mb_kbd_key_set_normal_image(state->current_key, img); 
     358  else 
     359    mb_kbd_key_set_push_image(state->current_key, img); 
    343360} 
    344361 
     
    557574    } 
    558575 
    559   /*FIXME: It is only temporary code */ 
    560   //img = mb_kbd_image_new(state->keyboard, "/root/.matchbox/match.png"); 
    561   //if(!img) 
    562     //fprintf(stderr, "can not find /root/.matchbox/match.png\n"); 
    563   //mb_kbd_key_set_back_image(state->current_key, img); 
    564  
    565576  mb_kbd_row_append_key(state->current_row, state->current_key); 
     577} 
     578 
     579static void 
     580config_handle_layout_background(MBKeyboardConfigState *state, 
     581                                const char **attr) 
     582{ 
     583  MBKeyboardImage *img; 
     584  const char *val; 
     585  char  buf[512]; 
     586 
     587  if ((val = attr_get_val("image", attr)) == NULL) 
     588    { 
     589      set_error(state, "Backgroud Attribute 'image' is required"); 
     590      return; 
     591    } 
     592 
     593  if (val[0] != '/') 
     594    { 
     595      snprintf(buf, 512, "%s/%s", PKGDATADIR, val); 
     596 
     597      if (!util_file_readable(buf)) 
     598        snprintf(buf, 512, "%s/.matchbox/%s", getenv("HOME"), val); 
     599 
     600      img = mb_kbd_image_new (state->keyboard, buf); 
     601    } 
     602  else 
     603    { 
     604      img = mb_kbd_image_new (state->keyboard, val); 
     605    } 
     606 
     607  if (img == NULL) 
     608    fprintf(stderr, "load img fail\n"); 
     609 
     610  mb_kbd_layout_set_background(state->current_layout, img); 
     611 
    566612} 
    567613 
     
    588634      mb_kbd_key_set_blank(state->current_key, True); 
    589635    } 
    590   else  if (streq(tag, "background")) 
     636  else  if (streq(tag, "normalimage") 
     637           || streq(tag, "pushimage")) 
    591638    { 
    592639      config_handle_key_background_tag(state, tag, attr); 
     
    600647    { 
    601648      config_handle_key_subtag(state, tag, attr); 
     649    } 
     650  else if (streq(tag, "background")) 
     651    { 
     652      config_handle_layout_background(state, attr); 
    602653    } 
    603654 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c

    r530 r1158  
    7373  boolean                extended;   /* only show in landscape */ 
    7474 
    75   MBKeyboardImage        *back_image;   /* The background image */ 
     75  MBKeyboardImage        *normal_image;   /* The normal image */ 
     76  MBKeyboardImage        *push_image;   /* The push down image */ 
    7677 
    7778  MBKeyboardStateType    sets_kbdstate; /* needed */ 
     
    101102 
    102103void 
    103 mb_kbd_key_set_back_image(MBKeyboardKey *key, MBKeyboardImage *image) 
    104 { 
    105   key->back_image = image; 
     104mb_kbd_key_set_normal_image(MBKeyboardKey *key, MBKeyboardImage *image) 
     105{ 
     106  key->normal_image = image; 
    106107} 
    107108 
    108109MBKeyboardImage * 
    109 mb_kbd_key_get_back_image(MBKeyboardKey *key) 
    110 { 
    111   return key->back_image; 
     110mb_kbd_key_get_normal_image(MBKeyboardKey *key) 
     111{ 
     112  return key->normal_image; 
     113} 
     114 
     115void 
     116mb_kbd_key_set_push_image(MBKeyboardKey *key, MBKeyboardImage *image) 
     117{ 
     118  key->push_image = image; 
     119} 
     120 
     121MBKeyboardImage * 
     122mb_kbd_key_get_push_image(MBKeyboardKey *key) 
     123{ 
     124  return key->push_image; 
    112125} 
    113126 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c

    r511 r1158  
    2424  MBKeyboard       *kbd;   
    2525  char             *id; 
     26  MBKeyboardImage  *background; 
    2627  List             *rows; 
    2728}; 
     
    4243 
    4344void 
     45mb_kbd_layout_set_background(MBKeyboardLayout *layout, 
     46                             MBKeyboardImage  *background) 
     47{ 
     48  layout->background = background; 
     49} 
     50 
     51MBKeyboardImage * 
     52mb_kbd_layout_get_background(MBKeyboardLayout *layout) 
     53{ 
     54  return layout->background; 
     55} 
     56 
     57void 
    4458mb_kbd_layout_append_row(MBKeyboardLayout *layout, 
    4559                         MBKeyboardRow    *row) 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c

    r542 r1158  
    148148    rect.height  = mb_kbd_ui_x_win_height(ui) - rect.y - 1; 
    149149 
    150   /* clear it */ 
    151  
    152   XSetForeground(xdpy, xft_backend->xgc, WhitePixel(xdpy, xscreen)); 
    153  
    154   XFillRectangles(xdpy, backbuffer, xft_backend->xgc, &rect, 1); 
    155  
    156   image = mb_kbd_key_get_back_image(key); 
     150  if (mb_kbd_key_is_held(kbd, key)) 
     151    image = mb_kbd_key_get_push_image(key); 
     152  else 
     153    image = mb_kbd_key_get_normal_image(key); 
    157154  if(image) 
    158155    { 
     
    170167  else                    
    171168    { 
     169      /* clear it */ 
     170 
     171      XSetForeground(xdpy, xft_backend->xgc, WhitePixel(xdpy, xscreen)); 
     172 
     173      XFillRectangles(xdpy, backbuffer, xft_backend->xgc, &rect, 1); 
     174 
    172175      /* draw 'main border' */ 
    173176       
     
    246249    } 
    247250 
     251/* 
    248252  if (mb_kbd_key_get_face_type(key, state) == MBKeyboardKeyFaceGlyph) 
    249253    { 
     
    294298                       0, 0, 0, 0, x, y, w, h); 
    295299    } 
     300*/ 
    296301} 
    297302 
     
    300305{ 
    301306  MBKeyboardUIBackendXft *xft_backend = NULL; 
    302  
    303   xft_backend = (MBKeyboardUIBackendXft*)mb_kbd_ui_backend(ui); 
     307  MBKeyboardImage        *image; 
     308 
     309  xft_backend = (MBKeyboardUIBackendXft*)mb_kbd_ui_backend(ui); 
     310 
     311  image = mb_kbd_layout_get_background(mb_kbd_get_selected_layout(mb_kbd_ui_kbd(ui))); 
    304312 
    305313  /* Background */ 
    306   XSetForeground(mb_kbd_ui_x_display(ui),  
    307                  xft_backend->xgc, xft_backend->xcol_f4f4f4.pixel); 
    308  
    309   XFillRectangle(mb_kbd_ui_x_display(ui),  
    310                  mb_kbd_ui_backbuffer(ui),  
    311                  xft_backend->xgc, 
    312                  0, 0,  
    313                  mb_kbd_ui_x_win_width(ui), 
    314                  mb_kbd_ui_x_win_height(ui)); 
    315  
    316   XSetForeground(mb_kbd_ui_x_display(ui),  
    317                  xft_backend->xgc,  
    318                  BlackPixel(mb_kbd_ui_x_display(ui),  
    319                             mb_kbd_ui_x_screen(ui))); 
    320  
     314  if (image == NULL) 
     315    { 
     316      XSetForeground(mb_kbd_ui_x_display(ui),  
     317                     xft_backend->xgc, xft_backend->xcol_f4f4f4.pixel); 
     318 
     319      XFillRectangle(mb_kbd_ui_x_display(ui),  
     320                     mb_kbd_ui_backbuffer(ui),  
     321                     xft_backend->xgc, 
     322                     0, 0,  
     323                     mb_kbd_ui_x_win_width(ui), 
     324                     mb_kbd_ui_x_win_height(ui)); 
     325 
     326      XSetForeground(mb_kbd_ui_x_display(ui),  
     327                     xft_backend->xgc,  
     328                     BlackPixel(mb_kbd_ui_x_display(ui),  
     329                                mb_kbd_ui_x_screen(ui))); 
     330    } 
     331  else 
     332    { 
     333      int w, h; 
     334 
     335      w = mb_kbd_image_width (image); 
     336      h = mb_kbd_image_height (image); 
     337 
     338      XRenderComposite(mb_kbd_ui_x_display(ui), 
     339                       PictOpOver, 
     340                       mb_kbd_image_render_picture(image), 
     341                       None, 
     342                       XftDrawPicture(xft_backend->xft_backbuffer), 
     343                       0, 0, 0, 0, 0, 0, w, h); 
     344    } 
    321345 
    322346} 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c

    r542 r1158  
    135135  if (width)  *width  = geometry[2]; 
    136136  if (height) *height = geometry[3]; 
    137   fprintf(stderr, "x=%d,y=%d,w=%d,h=%d\n",geometry[0],geometry[1],geometry[2],geometry[3]); 
    138137   
    139138  XFree(geometry); 
     
    342341        } 
    343342    } 
    344   if (mb_kbd_key_get_back_image(key)) 
    345     { 
    346       MBKeyboardImage *img = mb_kbd_key_get_back_image(key); 
     343  if (mb_kbd_key_get_normal_image(key)) 
     344    { 
     345      MBKeyboardImage *img = mb_kbd_key_get_normal_image(key); 
    347346 
    348347      if (mb_kbd_image_width (img) > max_w) 
     
    438437 
    439438      row_item = util_list_next(row_item); 
    440       fprintf(stderr, "the key_x=%d,key_y=%d\n", key_x, key_y); 
    441     } 
    442   fprintf(stderr, "max_row_key_height=%d,max_row_width=%d\n", max_row_key_height, max_row_width); 
     439    } 
    443440 
    444441  *height = row_y;  
     
    469466 
    470467      free_space = max_row_width - mb_kbd_row_width(row); 
    471       fprintf(stderr, "free_space=%d, max_row_width=%d, mb_kbd_row_width(row)=%d\n", free_space, max_row_width, mb_kbd_row_width(row)); 
    472468 
    473469      mb_kbd_row_for_each_key(row, key_item) 
     
    525521   
    526522  *width = max_row_width; 
     523 
     524  if (mb_kbd_layout_get_background(layout) != NULL) 
     525    { 
     526      MBKeyboardImage *img; 
     527      int             img_wid; 
     528      int             img_hei; 
     529 
     530      img = mb_kbd_layout_get_background(layout); 
     531      img_wid = mb_kbd_image_width(img); 
     532      img_hei = mb_kbd_image_height(img); 
     533 
     534      if (img_wid > *width) 
     535        *width = img_wid; 
     536 
     537      if (img_hei > *height) 
     538        *height = img_hei; 
     539    } 
    527540} 
    528541 
     
    668681    } 
    669682 
    670   win_attr.override_redirect = True; /* Set to true for extreme case */ 
    671   /*win_attr.override_redirect = False;*/ /* Set to true for extreme case */ 
     683  /*win_attr.override_redirect = True;*/ /* Set to true for extreme case */ 
     684  win_attr.override_redirect = False; /* Set to true for extreme case */ 
    672685  win_attr.event_mask  
    673686    = ButtonPressMask|ButtonReleaseMask|Button1MotionMask|StructureNotifyMask; 
     
    681694                           CWOverrideRedirect|CWEventMask, 
    682695                           &win_attr); 
    683   fprintf(stderr, "ui->xwin_width=%d,ui->xwin_height=%d\n", ui->xwin_width, ui->xwin_height); 
    684696 
    685697 
     
    10391051  new_state = want_extended(ui); 
    10401052    
    1041   fprintf(stderr, "########################################################\n"); 
    10421053  if (new_state == old_state)   /* Not a rotation */ 
    10431054    { 
     
    12501261  mb_kbd_ui_allocate_ui_layout(ui,  
    12511262                               &ui->base_alloc_width, &ui->base_alloc_height); 
    1252   fprintf(stderr, "ui->base_alloc_width=%d, ui->base_alloc_height=%d\n",ui->base_alloc_width, ui->base_alloc_height); 
    12531263 
    12541264  ui->xwin_width  = ui->base_alloc_width; 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c

    r542 r1158  
    9090  if (want_small) 
    9191    { 
    92       kb->key_border   = 1; 
     92      kb->key_border   = 0; 
    9393      kb->key_pad      = 0; 
    9494      kb->col_spacing  = 0; 
    9595      kb->row_spacing  = 0; 
    96       kb->font_pt_size = 10; 
     96      kb->font_pt_size = 12; 
    9797    } 
    9898 
  • trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h

    r530 r1158  
    342342 
    343343void 
     344mb_kbd_layout_set_background(MBKeyboardLayout *layout, 
     345                             MBKeyboardImage  *background); 
     346 
     347MBKeyboardImage * 
     348mb_kbd_layout_get_background(MBKeyboardLayout *layout); 
     349 
     350void 
    344351mb_kbd_layout_append_row(MBKeyboardLayout *layout, 
    345352                         MBKeyboardRow    *row); 
     
    393400 
    394401void 
    395 mb_kbd_key_set_back_image(MBKeyboardKey *key, MBKeyboardImage *image); 
     402mb_kbd_key_set_normal_image(MBKeyboardKey *key, MBKeyboardImage *image); 
    396403 
    397404MBKeyboardImage * 
    398 mb_kbd_key_get_back_image(MBKeyboardKey *key); 
     405mb_kbd_key_get_normal_image(MBKeyboardKey *key); 
     406 
     407void 
     408mb_kbd_key_set_push_image(MBKeyboardKey *key, MBKeyboardImage *image); 
     409 
     410MBKeyboardImage * 
     411mb_kbd_key_get_push_image(MBKeyboardKey *key); 
    399412 
    400413void 
Note: See TracChangeset for help on using the changeset viewer.