r1247 - in trunk/src/target/OM-2007/applications/openmoko-keyboard: layouts src
caowai_song at sita.openmoko.org
caowai_song at sita.openmoko.org
Mon Mar 5 11:05:33 CET 2007
Author: caowai_song
Date: 2007-03-05 11:05:09 +0100 (Mon, 05 Mar 2007)
New Revision: 1247
Modified:
trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am
trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c
trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h
Log:
Add realsize mode. At this mode, the sizes and locations of each keys
are geting from the config file.
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/Makefile.am 2007-03-05 10:05:09 UTC (rev 1247)
@@ -1,217 +1,217 @@
keyboardsdir = $(datadir)/matchbox-keyboard
-keyboards_DATA = keyboard.xml \
- keyboard-low.xml \
- keyboard-number.xml \
- keyboard-symbol.xml \
- bg_input_switch.png \
- bg_keypad.png \
- key_blank.png \
- key_blank_p.png \
- key_cap_A.png \
- key_cap_A_p.png \
- key_cap_B.png \
- key_cap_B_p.png \
- key_cap_C.png \
- key_cap_C_p.png \
- key_cap_D.png \
- key_cap_D_p.png \
- key_cap_E.png \
- key_cap_E_p.png \
- key_cap_F.png \
- key_cap_F_p.png \
- key_cap_G.png \
- key_cap_G_p.png \
- key_cap_H.png \
- key_cap_H_p.png \
- key_cap_I.png \
- key_cap_I_p.png \
- key_cap_J.png \
- key_cap_J_p.png \
- key_cap_K.png \
- key_cap_K_p.png \
- key_cap_L.png \
- key_cap_L_p.png \
- key_cap_M.png \
- key_cap_M_p.png \
- key_cap_N.png \
- key_cap_N_p.png \
- key_cap_O.png \
- key_cap_O_p.png \
- key_cap_P.png \
- key_cap_P_p.png \
- key_cap_Q.png \
- key_cap_Q_p.png \
- key_cap_R.png \
- key_cap_R_p.png \
- key_cap_S.png \
- key_cap_S_p.png \
- key_cap_T.png \
- key_cap_T_p.png \
- key_cap_U.png \
- key_cap_U_p.png \
- key_cap_V.png \
- key_cap_V_p.png \
- key_cap_W.png \
- key_cap_W_p.png \
- key_cap_X.png \
- key_cap_X_p.png \
- key_cap_Y.png \
- key_cap_Y_p.png \
- key_cap_Z.png \
- key_cap_Z_p.png \
- key_comm_backspace.png \
- key_comm_backspace_p.png \
- key_comm_enter.png \
- key_comm_enter_p.png \
- key_comm_space.png \
- key_comm_space_p.png \
- key_low_a.png \
- key_low_a_p.png \
- key_low_b.png \
- key_low_b_p.png \
- key_low_c.png \
- key_low_c_p.png \
- key_low_d.png \
- key_low_d_p.png \
- key_low_e.png \
- key_low_e_p.png \
- key_low_f.png \
- key_low_f_p.png \
- key_low_g.png \
- key_low_g_p.png \
- key_low_h.png \
- key_low_h_p.png \
- key_low_i.png \
- key_low_i_p.png \
- key_low_j.png \
- key_low_j_p.png \
- key_low_k.png \
- key_low_k_p.png \
- key_low_l.png \
- key_low_l_p.png \
- key_low_m.png \
- key_low_m_p.png \
- key_low_n.png \
- key_low_n_p.png \
- key_low_o.png \
- key_low_o_p.png \
- key_low_p.png \
- key_low_p_p.png \
- key_low_q.png \
- key_low_q_p.png \
- key_low_r.png \
- key_low_r_p.png \
- key_low_s.png \
- key_low_s_p.png \
- key_low_t.png \
- key_low_t_p.png \
- key_low_u.png \
- key_low_u_p.png \
- key_low_v.png \
- key_low_v_p.png \
- key_low_w.png \
- key_low_w_p.png \
- key_low_x.png \
- key_low_x_p.png \
- key_low_y.png \
- key_low_y_p.png \
- key_low_z.png \
- key_low_z_p.png \
- key_num_0.png \
- key_num_0_p.png \
- key_num_1.png \
- key_num_1_p.png \
- key_num_2.png \
- key_num_2_p.png \
- key_num_3.png \
- key_num_3_p.png \
- key_num_4.png \
- key_num_4_p.png \
- key_num_5.png \
- key_num_5_p.png \
- key_num_6.png \
- key_num_6_p.png \
- key_num_7.png \
- key_num_7_p.png \
- key_num_8.png \
- key_num_8_p.png \
- key_num_9.png \
- key_num_9_p.png \
- key_sym_colon.png \
- key_sym_colon_p.png \
- key_sym_greater.png \
- key_sym_greater_p.png \
- key_sym_line.png \
- key_sym_line_p.png \
- key_sym_grave_accent.png \
- key_sym_caret.png \
- key_sym_tilde.png \
- key_sym_equal.png \
- key_sym_underscore.png \
- key_sym_minus.png \
- key_sym_comma.png \
- key_sym_semicolon.png \
- key_sym_exclamation.png \
- key_sym_period.png \
- key_sym_open_paren.png \
- key_sym_close_paren.png \
- key_sym_open_bracket.png \
- key_sym_close_bracket.png \
- key_sym_open_curly.png \
- key_sym_close_curly.png \
- key_sym_at.png \
- key_sym_dollar.png \
- key_sym_ampersand.png \
- key_sym_sharp.png \
- key_sym_percent.png \
- key_sym_plus.png \
- key_sym_grave_accent_p.png \
- key_sym_caret_p.png \
- key_sym_tilde_p.png \
- key_sym_equal_p.png \
- key_sym_underscore_p.png \
- key_sym_minus_p.png \
- key_sym_comma_p.png \
- key_sym_semicolon_p.png \
- key_sym_exclamation_p.png \
- key_sym_period_p.png \
- key_sym_open_paren_p.png \
- key_sym_close_paren_p.png \
- key_sym_open_bracket_p.png \
- key_sym_close_bracket_p.png \
- key_sym_open_curly_p.png \
- key_sym_close_curly_p.png \
- key_sym_at_p.png \
- key_sym_dollar_p.png \
- key_sym_ampersand_p.png \
- key_sym_sharp_p.png \
- key_sym_percent_p.png \
- key_sym_plus_p.png \
- key_sym_question.png \
- key_sym_question_p.png \
- key_sym_quote.png \
- key_sym_quote_p.png \
- key_sym_quotes.png \
- key_sym_quotes_p.png \
- key_sym_slash2.png \
- key_sym_slash2_p.png \
- key_sym_slash.png \
- key_sym_slash_p.png \
- key_sym_smaller.png \
- key_sym_smaller_p.png \
- key_sym_star.png \
- key_sym_star_p.png \
- switch_input_ch.png \
- switch_input_ch_p.png \
- switch_input_eng_cap.png \
- switch_input_eng_cap_p.png \
- switch_input_eng_low.png \
- switch_input_eng_low_p.png \
- switch_input_num.png \
- switch_input_num_p.png \
- switch_input.png \
- switch_input_p.png \
- switch_input_sym.png \
+keyboards_DATA = keyboard.xml \
+ keyboard-low.xml \
+ keyboard-number.xml \
+ keyboard-symbol.xml \
+ bg_input_switch.png \
+ bg_keypad.png \
+ key_blank.png \
+ key_blank_p.png \
+ key_cap_A.png \
+ key_cap_A_p.png \
+ key_cap_B.png \
+ key_cap_B_p.png \
+ key_cap_C.png \
+ key_cap_C_p.png \
+ key_cap_D.png \
+ key_cap_D_p.png \
+ key_cap_E.png \
+ key_cap_E_p.png \
+ key_cap_F.png \
+ key_cap_F_p.png \
+ key_cap_G.png \
+ key_cap_G_p.png \
+ key_cap_H.png \
+ key_cap_H_p.png \
+ key_cap_I.png \
+ key_cap_I_p.png \
+ key_cap_J.png \
+ key_cap_J_p.png \
+ key_cap_K.png \
+ key_cap_K_p.png \
+ key_cap_L.png \
+ key_cap_L_p.png \
+ key_cap_M.png \
+ key_cap_M_p.png \
+ key_cap_N.png \
+ key_cap_N_p.png \
+ key_cap_O.png \
+ key_cap_O_p.png \
+ key_cap_P.png \
+ key_cap_P_p.png \
+ key_cap_Q.png \
+ key_cap_Q_p.png \
+ key_cap_R.png \
+ key_cap_R_p.png \
+ key_cap_S.png \
+ key_cap_S_p.png \
+ key_cap_T.png \
+ key_cap_T_p.png \
+ key_cap_U.png \
+ key_cap_U_p.png \
+ key_cap_V.png \
+ key_cap_V_p.png \
+ key_cap_W.png \
+ key_cap_W_p.png \
+ key_cap_X.png \
+ key_cap_X_p.png \
+ key_cap_Y.png \
+ key_cap_Y_p.png \
+ key_cap_Z.png \
+ key_cap_Z_p.png \
+ key_comm_backspace.png \
+ key_comm_backspace_p.png \
+ key_comm_enter.png \
+ key_comm_enter_p.png \
+ key_comm_space.png \
+ key_comm_space_p.png \
+ key_low_a.png \
+ key_low_a_p.png \
+ key_low_b.png \
+ key_low_b_p.png \
+ key_low_c.png \
+ key_low_c_p.png \
+ key_low_d.png \
+ key_low_d_p.png \
+ key_low_e.png \
+ key_low_e_p.png \
+ key_low_f.png \
+ key_low_f_p.png \
+ key_low_g.png \
+ key_low_g_p.png \
+ key_low_h.png \
+ key_low_h_p.png \
+ key_low_i.png \
+ key_low_i_p.png \
+ key_low_j.png \
+ key_low_j_p.png \
+ key_low_k.png \
+ key_low_k_p.png \
+ key_low_l.png \
+ key_low_l_p.png \
+ key_low_m.png \
+ key_low_m_p.png \
+ key_low_n.png \
+ key_low_n_p.png \
+ key_low_o.png \
+ key_low_o_p.png \
+ key_low_p.png \
+ key_low_p_p.png \
+ key_low_q.png \
+ key_low_q_p.png \
+ key_low_r.png \
+ key_low_r_p.png \
+ key_low_s.png \
+ key_low_s_p.png \
+ key_low_t.png \
+ key_low_t_p.png \
+ key_low_u.png \
+ key_low_u_p.png \
+ key_low_v.png \
+ key_low_v_p.png \
+ key_low_w.png \
+ key_low_w_p.png \
+ key_low_x.png \
+ key_low_x_p.png \
+ key_low_y.png \
+ key_low_y_p.png \
+ key_low_z.png \
+ key_low_z_p.png \
+ key_num_0.png \
+ key_num_0_p.png \
+ key_num_1.png \
+ key_num_1_p.png \
+ key_num_2.png \
+ key_num_2_p.png \
+ key_num_3.png \
+ key_num_3_p.png \
+ key_num_4.png \
+ key_num_4_p.png \
+ key_num_5.png \
+ key_num_5_p.png \
+ key_num_6.png \
+ key_num_6_p.png \
+ key_num_7.png \
+ key_num_7_p.png \
+ key_num_8.png \
+ key_num_8_p.png \
+ key_num_9.png \
+ key_num_9_p.png \
+ key_sym_colon.png \
+ key_sym_colon_p.png \
+ key_sym_greater.png \
+ key_sym_greater_p.png \
+ key_sym_line.png \
+ key_sym_line_p.png \
+ key_sym_grave_accent.png \
+ key_sym_caret.png \
+ key_sym_tilde.png \
+ key_sym_equal.png \
+ key_sym_underscore.png \
+ key_sym_minus.png \
+ key_sym_comma.png \
+ key_sym_semicolon.png \
+ key_sym_exclamation.png \
+ key_sym_period.png \
+ key_sym_open_paren.png \
+ key_sym_close_paren.png \
+ key_sym_open_bracket.png \
+ key_sym_close_bracket.png \
+ key_sym_open_curly.png \
+ key_sym_close_curly.png \
+ key_sym_at.png \
+ key_sym_dollar.png \
+ key_sym_ampersand.png \
+ key_sym_sharp.png \
+ key_sym_percent.png \
+ key_sym_plus.png \
+ key_sym_grave_accent_p.png \
+ key_sym_caret_p.png \
+ key_sym_tilde_p.png \
+ key_sym_equal_p.png \
+ key_sym_underscore_p.png \
+ key_sym_minus_p.png \
+ key_sym_comma_p.png \
+ key_sym_semicolon_p.png \
+ key_sym_exclamation_p.png \
+ key_sym_period_p.png \
+ key_sym_open_paren_p.png \
+ key_sym_close_paren_p.png \
+ key_sym_open_bracket_p.png \
+ key_sym_close_bracket_p.png \
+ key_sym_open_curly_p.png \
+ key_sym_close_curly_p.png \
+ key_sym_at_p.png \
+ key_sym_dollar_p.png \
+ key_sym_ampersand_p.png \
+ key_sym_sharp_p.png \
+ key_sym_percent_p.png \
+ key_sym_plus_p.png \
+ key_sym_question.png \
+ key_sym_question_p.png \
+ key_sym_quote.png \
+ key_sym_quote_p.png \
+ key_sym_quotes.png \
+ key_sym_quotes_p.png \
+ key_sym_slash2.png \
+ key_sym_slash2_p.png \
+ key_sym_slash.png \
+ key_sym_slash_p.png \
+ key_sym_smaller.png \
+ key_sym_smaller_p.png \
+ key_sym_star.png \
+ key_sym_star_p.png \
+ switch_input_ch.png \
+ switch_input_ch_p.png \
+ switch_input_eng_cap.png \
+ switch_input_eng_cap_p.png \
+ switch_input_eng_low.png \
+ switch_input_eng_low_p.png \
+ switch_input_num.png \
+ switch_input_num_p.png \
+ switch_input.png \
+ switch_input_p.png \
+ switch_input_sym.png \
switch_input_sym_p.png
EXTRA_DIST = $(keyboards_DATA)
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/layouts/keyboard.xml 2007-03-05 10:05:09 UTC (rev 1247)
@@ -1,178 +1,347 @@
<?xml version="1.0" encoding="UTF-8"?>
-<keyboard>
+<!-- edited with XMLSpy v2006 sp2 U (http://www.altova.com) by scw (FIC) -->
+<keyboard maltilayout="true">
+ <options>
+ <!-- not yet implemented -->
+ </options>
+ <layout id="cap" realsize="true" type="caps">
+ <background image="bg_keypad.png" width="480" height="167"/>
+ <row>
+ <key real_x="14" real_y="8" real_w="35" real_h="35">
+ <default display="Q"/>
+ <normalimage image="key_cap_Q.png"/>
+ <pushimage image="key_cap_Q_p.png"/>
+ </key>
+ <key real_x="53" real_y="8" real_w="35" real_h="35">
+ <default display="W"/>
+ <normalimage image="key_cap_W.png"/>
+ <pushimage image="key_cap_W_p.png"/>
+ </key>
+ <key real_x="92" real_y="8" real_w="35" real_h="35">
+ <default display="E"/>
+ <normalimage image="key_cap_E.png"/>
+ <pushimage image="key_cap_E_p.png"/>
+ </key>
+ <key real_x="131" real_y="8" real_w="35" real_h="35">
+ <default display="R"/>
+ <normalimage image="key_cap_R.png"/>
+ <pushimage image="key_cap_R_p.png"/>
+ </key>
+ <key real_x="170" real_y="8" real_w="35" real_h="35">
+ <default display="T"/>
+ <normalimage image="key_cap_T.png"/>
+ <pushimage image="key_cap_T_p.png"/>
+ </key>
+ <key real_x="209" real_y="8" real_w="35" real_h="35">
+ <default display="Y"/>
+ <normalimage image="key_cap_Y.png"/>
+ <pushimage image="key_cap_Y_p.png"/>
+ </key>
+ <key real_x="248" real_y="8" real_w="35" real_h="35">
+ <default display="U"/>
+ <normalimage image="key_cap_U.png"/>
+ <pushimage image="key_cap_U_p.png"/>
+ </key>
+ <key real_x="287" real_y="8" real_w="35" real_h="35">
+ <default display="I"/>
+ <normalimage image="key_cap_I.png"/>
+ <pushimage image="key_cap_I_p.png"/>
+ </key>
+ <key real_x="326" real_y="8" real_w="35" real_h="35">
+ <default display="O"/>
+ <normalimage image="key_cap_O.png"/>
+ <pushimage image="key_cap_O_p.png"/>
+ </key>
+ <key real_x="365" real_y="8" real_w="35" real_h="35">
+ <default display="P"/>
+ <normalimage image="key_cap_P.png"/>
+ <pushimage image="key_cap_P_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="33" real_y="48" real_w="35" real_h="35">
+ <default display="A"/>
+ <normalimage image="key_cap_A.png"/>
+ <pushimage image="key_cap_A_p.png"/>
+ </key>
+ <key real_x="72" real_y="48" real_w="35" real_h="35">
+ <default display="S"/>
+ <normalimage image="key_cap_S.png"/>
+ <pushimage image="key_cap_S_p.png"/>
+ </key>
+ <key real_x="111" real_y="48" real_w="35" real_h="35">
+ <default display="D"/>
+ <normalimage image="key_cap_D.png"/>
+ <pushimage image="key_cap_D_p.png"/>
+ </key>
+ <key real_x="150" real_y="48" real_w="35" real_h="35">
+ <default display="F"/>
+ <normalimage image="key_cap_F.png"/>
+ <pushimage image="key_cap_F_p.png"/>
+ </key>
+ <key real_x="189" real_y="48" real_w="35" real_h="35">
+ <default display="G"/>
+ <normalimage image="key_cap_G.png"/>
+ <pushimage image="key_cap_G_p.png"/>
+ </key>
+ <key real_x="228" real_y="48" real_w="35" real_h="35">
+ <default display="H"/>
+ <normalimage image="key_cap_H.png"/>
+ <pushimage image="key_cap_H_p.png"/>
+ </key>
+ <key real_x="267" real_y="48" real_w="35" real_h="35">
+ <default display="J"/>
+ <normalimage image="key_cap_J.png"/>
+ <pushimage image="key_cap_J_p.png"/>
+ </key>
+ <key real_x="306" real_y="48" real_w="35" real_h="35">
+ <default display="K"/>
+ <normalimage image="key_cap_K.png"/>
+ <pushimage image="key_cap_K_p.png"/>
+ </key>
+ <key real_x="345" real_y="48" real_w="35" real_h="35">
+ <default display="L"/>
+ <normalimage image="key_cap_L.png"/>
+ <pushimage image="key_cap_L_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="72" real_y="88" real_w="35" real_h="35">
+ <default display="Z"/>
+ <normalimage image="key_cap_Z.png"/>
+ <pushimage image="key_cap_Z_p.png"/>
+ </key>
+ <key real_x="111" real_y="88" real_w="35" real_h="35">
+ <default display="X"/>
+ <normalimage image="key_cap_X.png"/>
+ <pushimage image="key_cap_X_p.png"/>
+ </key>
+ <key real_x="150" real_y="88" real_w="35" real_h="35">
+ <default display="C"/>
+ <normalimage image="key_cap_C.png"/>
+ <pushimage image="key_cap_C_p.png"/>
+ </key>
+ <key real_x="189" real_y="88" real_w="35" real_h="35">
+ <default display="V"/>
+ <normalimage image="key_cap_V.png"/>
+ <pushimage image="key_cap_V_p.png"/>
+ </key>
+ <key real_x="228" real_y="88" real_w="35" real_h="35">
+ <default display="B"/>
+ <normalimage image="key_cap_B.png"/>
+ <pushimage image="key_cap_B_p.png"/>
+ </key>
+ <key real_x="267" real_y="88" real_w="35" real_h="35">
+ <default display="N"/>
+ <normalimage image="key_cap_N.png"/>
+ <pushimage image="key_cap_N_p.png"/>
+ </key>
+ <key real_x="306" real_y="88" real_w="35" real_h="35">
+ <default display="M"/>
+ <normalimage image="key_cap_M.png"/>
+ <pushimage image="key_cap_M_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="72" real_y="128" real_w="140" real_h="36">
+ <default display=" " action="space"/>
+ <normalimage image="key_comm_space.png"/>
+ <pushimage image="key_comm_space_p.png"/>
+ </key>
+ <key real_x="216" real_y="128" real_w="65" real_h="36">
+ <default display=" " action="backspace"/>
+ <normalimage image="key_comm_backspace.png"/>
+ <pushimage image="key_comm_backspace_p.png"/>
+ </key>
+ <key real_x="285" real_y="128" real_w="65" real_h="36">
+ <default display=" " action="return"/>
+ <normalimage image="key_comm_enter.png"/>
+ <pushimage image="key_comm_enter_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="426" real_y="22" real_w="47" real_h="22">
+ <default display=" " action="changer:caps" />
+ <normalimage image="switch_input_eng_cap.png"/>
+ <pushimage image="switch_input_eng_cap_p.png"/>
+ </key>
+ <key real_x="426" real_y="48" real_w="47" real_h="22">
+ <default display=" " action="changer:lows" />
+ <normalimage image="switch_input_eng_low.png"/>
+ <pushimage image="switch_input_eng_low_p.png"/>
+ </key>
+ <key real_x="426" real_y="74" real_w="47" real_h="22">
+ <default display=" " action="changer:numbers" />
+ <normalimage image="switch_input_num.png"/>
+ <pushimage image="switch_input_num_p.png"/>
+ </key>
+ <key real_x="426" real_y="100" real_w="47" real_h="22">
+ <default display=" " action="changer:symbols" />
+ <normalimage image="switch_input_sym.png"/>
+ <pushimage image="switch_input_sym_p.png"/>
+ </key>
+ <key real_x="426" real_y="126" real_w="47" real_h="22">
+ <default display=" " action="changer:Chinese" />
+ <normalimage image="switch_input_ch.png"/>
+ <pushimage image="switch_input_ch_p.png"/>
+ </key>
+ </row>
-<options>
-<!-- not yet implemented -->
-</options>
-
-<layout id="defualt keyboard">
- <background image="bg_keypad.png" />
-
- <row>
-
- <key>
- <default display="Q" />
- <normalimage image="key_cap_Q.png"/>
- <pushimage image="key_cap_Q_p.png"/>
- </key>
- <key>
- <default display="W" />
- <normalimage image="key_cap_W.png"/>
- <pushimage image="key_cap_W_p.png"/>
- </key>
- <key>
- <default display="E" />
- <normalimage image="key_cap_E.png"/>
- <pushimage image="key_cap_E_p.png"/>
- </key>
- <key>
- <default display="R" />
- <normalimage image="key_cap_R.png"/>
- <pushimage image="key_cap_R_p.png"/>
- </key>
- <key>
- <default display="T" />
- <normalimage image="key_cap_T.png"/>
- <pushimage image="key_cap_T_p.png"/>
- </key>
- <key>
- <default display="Y" />
- <normalimage image="key_cap_Y.png"/>
- <pushimage image="key_cap_Y_p.png"/>
- </key>
- <key>
- <default display="U" />
- <normalimage image="key_cap_U.png"/>
- <pushimage image="key_cap_U_p.png"/>
- </key>
- <key>
- <default display="I" />
- <normalimage image="key_cap_I.png"/>
- <pushimage image="key_cap_I_p.png"/>
- </key>
- <key>
- <default display="O" />
- <normalimage image="key_cap_O.png"/>
- <pushimage image="key_cap_O_p.png"/>
- </key>
- <key>
- <default display="P" />
- <normalimage image="key_cap_P.png"/>
- <pushimage image="key_cap_P_p.png"/>
- </key>
-
- </row>
-
- <row>
-
- <key>
- <default display="A" />
- <normalimage image="key_cap_A.png"/>
- <pushimage image="key_cap_A_p.png"/>
- </key>
- <key>
- <default display="S" />
- <normalimage image="key_cap_S.png"/>
- <pushimage image="key_cap_S_p.png"/>
- </key>
- <key>
- <default display="D" />
- <normalimage image="key_cap_D.png"/>
- <pushimage image="key_cap_D_p.png"/>
- </key>
- <key>
- <default display="F" />
- <normalimage image="key_cap_F.png"/>
- <pushimage image="key_cap_F_p.png"/>
- </key>
- <key>
- <default display="G" />
- <normalimage image="key_cap_G.png"/>
- <pushimage image="key_cap_G_p.png"/>
- </key>
- <key>
- <default display="H" />
- <normalimage image="key_cap_H.png"/>
- <pushimage image="key_cap_H_p.png"/>
- </key>
- <key>
- <default display="J" />
- <normalimage image="key_cap_J.png"/>
- <pushimage image="key_cap_J_p.png"/>
- </key>
- <key>
- <default display="K" />
- <normalimage image="key_cap_K.png"/>
- <pushimage image="key_cap_K_p.png"/>
- </key>
- <key>
- <default display="L" />
- <normalimage image="key_cap_L.png"/>
- <pushimage image="key_cap_L_p.png"/>
- </key>
-
- </row>
- <row>
-
- <key>
- <default display="Z" />
- <normalimage image="key_cap_Z.png"/>
- <pushimage image="key_cap_Z_p.png"/>
- </key>
- <key>
- <default display="X" />
- <normalimage image="key_cap_X.png"/>
- <pushimage image="key_cap_X_p.png"/>
- </key>
- <key>
- <default display="C" />
- <normalimage image="key_cap_C.png"/>
- <pushimage image="key_cap_C_p.png"/>
- </key>
- <key>
- <default display="V" />
- <normalimage image="key_cap_V.png"/>
- <pushimage image="key_cap_V_p.png"/>
- </key>
- <key>
- <default display="B" />
- <normalimage image="key_cap_B.png"/>
- <pushimage image="key_cap_B_p.png"/>
- </key>
- <key>
- <default display="N" />
- <normalimage image="key_cap_N.png"/>
- <pushimage image="key_cap_N_p.png"/>
- </key>
- <key>
- <default display="M" />
- <normalimage image="key_cap_M.png"/>
- <pushimage image="key_cap_M_p.png"/>
- </key>
-
- </row>
-
- <row>
-
-
- <key>
- <default display=" " action="space" />
- <normalimage image="key_comm_space.png"/>
- <pushimage image="key_comm_space_p.png"/>
- </key>
- <key>
- <default display=" " action="backspace" />
- <normalimage image="key_comm_backspace.png"/>
- <pushimage image="key_comm_backspace_p.png"/>
- </key>
- <key>
- <default display=" " action="return" />
- <normalimage image="key_comm_enter.png"/>
- <pushimage image="key_comm_enter_p.png"/>
- </key>
- </row>
-
-</layout>
-
-
+ </layout>
+ <layout id="low" realsize="true" type="lows">
+ <background image="bg_keypad.png" width="480" height="167"/>
+ <row>
+ <key real_x="14" real_y="8" real_w="35" real_h="35">
+ <default display="q"/>
+ <normalimage image="key_low_q.png"/>
+ <pushimage image="key_low_q_p.png"/>
+ </key>
+ <key real_x="53" real_y="8" real_w="35" real_h="35">
+ <default display="w"/>
+ <normalimage image="key_low_w.png"/>
+ <pushimage image="key_low_w_p.png"/>
+ </key>
+ <key real_x="92" real_y="8" real_w="35" real_h="35">
+ <default display="e"/>
+ <normalimage image="key_low_e.png"/>
+ <pushimage image="key_low_e_p.png"/>
+ </key>
+ <key real_x="131" real_y="8" real_w="35" real_h="35">
+ <default display="r"/>
+ <normalimage image="key_low_r.png"/>
+ <pushimage image="key_low_r_p.png"/>
+ </key>
+ <key real_x="170" real_y="8" real_w="35" real_h="35">
+ <default display="t"/>
+ <normalimage image="key_low_t.png"/>
+ <pushimage image="key_low_t_p.png"/>
+ </key>
+ <key real_x="209" real_y="8" real_w="35" real_h="35">
+ <default display="y"/>
+ <normalimage image="key_low_y.png"/>
+ <pushimage image="key_low_y_p.png"/>
+ </key>
+ <key real_x="248" real_y="8" real_w="35" real_h="35">
+ <default display="u"/>
+ <normalimage image="key_low_u.png"/>
+ <pushimage image="key_low_u_p.png"/>
+ </key>
+ <key real_x="287" real_y="8" real_w="35" real_h="35">
+ <default display="i"/>
+ <normalimage image="key_low_i.png"/>
+ <pushimage image="key_low_i_p.png"/>
+ </key>
+ <key real_x="326" real_y="8" real_w="35" real_h="35">
+ <default display="o"/>
+ <normalimage image="key_low_o.png"/>
+ <pushimage image="key_low_o_p.png"/>
+ </key>
+ <key real_x="365" real_y="8" real_w="35" real_h="35">
+ <default display="p"/>
+ <normalimage image="key_low_p.png"/>
+ <pushimage image="key_low_p_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="33" real_y="48" real_w="35" real_h="35">
+ <default display="a"/>
+ <normalimage image="key_low_a.png"/>
+ <pushimage image="key_low_a_p.png"/>
+ </key>
+ <key real_x="72" real_y="48" real_w="35" real_h="35">
+ <default display="s"/>
+ <normalimage image="key_low_s.png"/>
+ <pushimage image="key_low_s_p.png"/>
+ </key>
+ <key real_x="111" real_y="48" real_w="35" real_h="35">
+ <default display="d"/>
+ <normalimage image="key_low_d.png"/>
+ <pushimage image="key_low_d_p.png"/>
+ </key>
+ <key real_x="150" real_y="48" real_w="35" real_h="35">
+ <default display="f"/>
+ <normalimage image="key_low_f.png"/>
+ <pushimage image="key_low_f_p.png"/>
+ </key>
+ <key real_x="189" real_y="48" real_w="35" real_h="35">
+ <default display="g"/>
+ <normalimage image="key_low_g.png"/>
+ <pushimage image="key_low_g_p.png"/>
+ </key>
+ <key real_x="228" real_y="48" real_w="35" real_h="35">
+ <default display="h"/>
+ <normalimage image="key_low_h.png"/>
+ <pushimage image="key_low_h_p.png"/>
+ </key>
+ <key real_x="267" real_y="48" real_w="35" real_h="35">
+ <default display="j"/>
+ <normalimage image="key_low_j.png"/>
+ <pushimage image="key_low_j_p.png"/>
+ </key>
+ <key real_x="306" real_y="48" real_w="35" real_h="35">
+ <default display="k"/>
+ <normalimage image="key_low_k.png"/>
+ <pushimage image="key_low_k_p.png"/>
+ </key>
+ <key real_x="345" real_y="48" real_w="35" real_h="35">
+ <default display="l"/>
+ <normalimage image="key_low_l.png"/>
+ <pushimage image="key_low_l_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="72" real_y="88" real_w="35" real_h="35">
+ <default display="z"/>
+ <normalimage image="key_low_z.png"/>
+ <pushimage image="key_low_z_p.png"/>
+ </key>
+ <key real_x="111" real_y="88" real_w="35" real_h="35">
+ <default display="x"/>
+ <normalimage image="key_low_x.png"/>
+ <pushimage image="key_low_x_p.png"/>
+ </key>
+ <key real_x="150" real_y="88" real_w="35" real_h="35">
+ <default display="c"/>
+ <normalimage image="key_low_c.png"/>
+ <pushimage image="key_low_c_p.png"/>
+ </key>
+ <key real_x="189" real_y="88" real_w="35" real_h="35">
+ <default display="v"/>
+ <normalimage image="key_low_v.png"/>
+ <pushimage image="key_low_v_p.png"/>
+ </key>
+ <key real_x="228" real_y="88" real_w="35" real_h="35">
+ <default display="b"/>
+ <normalimage image="key_low_b.png"/>
+ <pushimage image="key_low_b_p.png"/>
+ </key>
+ <key real_x="267" real_y="88" real_w="35" real_h="35">
+ <default display="n"/>
+ <normalimage image="key_low_n.png"/>
+ <pushimage image="key_low_n_p.png"/>
+ </key>
+ <key real_x="306" real_y="88" real_w="35" real_h="35">
+ <default display="m"/>
+ <normalimage image="key_low_m.png"/>
+ <pushimage image="key_low_m_p.png"/>
+ </key>
+ </row>
+ <row>
+ <key real_x="72" real_y="128" real_w="140" real_h="36">
+ <default display=" " action="space"/>
+ <normalimage image="key_comm_space.png"/>
+ <pushimage image="key_comm_space_p.png"/>
+ </key>
+ <key real_x="216" real_y="128" real_w="65" real_h="36">
+ <default display=" " action="backspace"/>
+ <normalimage image="key_comm_backspace.png"/>
+ <pushimage image="key_comm_backspace_p.png"/>
+ </key>
+ <key real_x="285" real_y="128" real_w="65" real_h="36">
+ <default display=" " action="return"/>
+ <normalimage image="key_comm_enter.png"/>
+ <pushimage image="key_comm_enter_p.png"/>
+ </key>
+ </row>
+ </layout>
</keyboard>
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/config-parser.c 2007-03-05 10:05:09 UTC (rev 1247)
@@ -116,6 +116,20 @@
{ "caps", MBKeyboardKeyModCaps }
};
+struct _layoutlookup
+{
+ MBKeyboardLayoutType type;
+ char *name;
+}
+LayoutLookup[] =
+{
+ {MBKeyboardLows, "lows" },
+ {MBKeyboardCaps, "caps" },
+ {MBKeyboardNumbers, "numbers" },
+ {MBKeyboardSymbols, "symbols" },
+ {MBKeyboardChinese, "Chinese" }
+};
+
typedef struct MBKeyboardConfigState
{
MBKeyboard *keyboard;
@@ -168,7 +182,22 @@
return 0;
}
+MBKeyboardLayoutType
+config_str_to_layouttype(const char* str)
+{
+ int i;
+ for (i=0; i<sizeof(LayoutLookup)/sizeof(struct _modlookup); i++)
+ {
+ DBG("checking '%s' vs '%s'", str, LayoutLookup[i].name);
+ if (streq(str, LayoutLookup[i].name))
+ return LayoutLookup[i].type;
+ }
+
+ return 0;
+}
+
+
static char*
config_load_file(MBKeyboard *kbd, char *variant_in)
{
@@ -361,8 +390,8 @@
static void
config_handle_key_subtag(MBKeyboardConfigState *state,
- const char *tag,
- const char **attr)
+ const char *tag,
+ const char **attr)
{
MBKeyboardKeyStateType keystate;
const char *val;
@@ -408,100 +437,119 @@
if (val[6] != '/')
- {
- /* Relative, rather than absolute path, try pkddatadir and home */
- char buf[512];
- snprintf(buf, 512, "%s/%s", PKGDATADIR, &val[6]);
+ {
+ /* Relative, rather than absolute path, try pkddatadir and home */
+ char buf[512];
+ snprintf(buf, 512, "%s/%s", PKGDATADIR, &val[6]);
- if (!util_file_readable(buf))
- snprintf(buf, 512, "%s/.matchbox/%s", getenv("HOME"), &val[6]);
+ if (!util_file_readable(buf))
+ snprintf(buf, 512, "%s/.matchbox/%s", getenv("HOME"), &val[6]);
- img = mb_kbd_image_new (state->keyboard, buf);
- }
+ img = mb_kbd_image_new (state->keyboard, buf);
+ }
else
- img = mb_kbd_image_new (state->keyboard, &val[6]);
+ img = mb_kbd_image_new (state->keyboard, &val[6]);
if (!img)
- {
- fprintf(stderr, "matchbox-keyboard: Failed to load '%s'\n", &val[6]);
- state->error = True;
- return;
- }
+ {
+ fprintf(stderr, "matchbox-keyboard: Failed to load '%s'\n", &val[6]);
+ state->error = True;
+ return;
+ }
mb_kbd_key_set_image_face(state->current_key, keystate, img);
}
else
{
mb_kbd_key_set_glyph_face(state->current_key, keystate,
- attr_get_val("display", attr));
+ attr_get_val("display", attr));
}
if ((val = attr_get_val("action", attr)) != NULL)
{
/*
- action="utf8char" // optional, action defulats to this
- action="modifier:Shift|Alt|ctrl|mod1|mod2|mod3|caps"
- action="xkeysym:XK_BLAH"
- action="control:"> // return etc - not needed use lookup
+ action="utf8char" // optional, action defulats to this
+ action="modifier:Shift|Alt|ctrl|mod1|mod2|mod3|caps"
+ action="changer:lows|caps|numbers|symbols|Chinese"
+ action="xkeysym:XK_BLAH"
+ action="control:"> // return etc - not needed use lookup
*/
- if (!strncmp(val, "modifier:", 9))
- {
- MBKeyboardKeyModType found_type;
+ if (!strncmp(val, "changer:", 8))
+ {
+ MBKeyboardLayoutType found_type;
- DBG("checking '%s'", &val[9]);
+ found_type = config_str_to_layouttype(&val[8]);
- found_type = config_str_to_modtype(&val[9]);
+ if (found_type)
+ {
+ mb_kbd_key_set_changer_action(state->current_key,
+ keystate,
+ found_type);
+ }
+ else
+ {
+ set_error(state, "Unknown changer");
+ return;
+ }
+ }
+ else if (!strncmp(val, "modifier:", 9))
+ {
+ MBKeyboardKeyModType found_type;
- if (found_type)
- {
- mb_kbd_key_set_modifer_action(state->current_key,
- keystate,
- found_type);
- }
- else
- {
+ DBG("checking '%s'", &val[9]);
+
+ found_type = config_str_to_modtype(&val[9]);
+
+ if (found_type)
+ {
+ mb_kbd_key_set_modifer_action(state->current_key,
+ keystate,
+ found_type);
+ }
+ else
+ {
set_error(state, "Unknown modifier");
- return;
- }
-
- }
+ return;
+ }
+
+ }
else if (!strncmp(val, "xkeysym:", 8))
- {
- DBG("Checking %s\n", &val[8]);
+ {
+ DBG("Checking %s\n", &val[8]);
- found_keysym = XStringToKeysym(&val[8]);
+ found_keysym = XStringToKeysym(&val[8]);
- if (found_keysym)
- {
- mb_kbd_key_set_keysym_action(state->current_key,
- keystate,
- found_keysym);
- }
- else
- {
- /* Should this error really be terminal */
+ if (found_keysym)
+ {
+ mb_kbd_key_set_keysym_action(state->current_key,
+ keystate,
+ found_keysym);
+ }
+ else
+ {
+ /* Should this error really be terminal */
set_error(state, "Unknown keysym");
- return;
- }
- }
+ return;
+ }
+ }
else
- {
- /* Its just 'regular' key */
+ {
+ /* Its just 'regular' key */
- if (strlen(val) > 1 /* match backspace, return etc */
- && ((found_keysym = config_str_to_keysym(val)) != 0))
- {
- mb_kbd_key_set_keysym_action(state->current_key,
- keystate,
- found_keysym);
- }
- else
- {
- /* XXX We should actually check its a single UTF8 Char here */
- mb_kbd_key_set_char_action(state->current_key,
- keystate, val);
- }
- }
+ if (strlen(val) > 1 /* match backspace, return etc */
+ && ((found_keysym = config_str_to_keysym(val)) != 0))
+ {
+ mb_kbd_key_set_keysym_action(state->current_key,
+ keystate,
+ found_keysym);
+ }
+ else
+ {
+ /* XXX We should actually check its a single UTF8 Char here */
+ mb_kbd_key_set_char_action(state->current_key,
+ keystate, val);
+ }
+ }
}
else /* fallback to reusing whats displayed */
{
@@ -511,8 +559,8 @@
*/
mb_kbd_key_set_char_action(state->current_key,
- keystate,
- attr_get_val("display", attr));
+ keystate,
+ attr_get_val("display", attr));
}
}
@@ -521,7 +569,14 @@
config_handle_layout_tag(MBKeyboardConfigState *state, const char **attr)
{
const char *val;
+ Bool realsize = False;
+ if ((val = attr_get_val("realsize", attr)) != NULL)
+ {
+ if (strcaseeq("true", val))
+ realsize = True;
+ }
+
if ((val = attr_get_val("id", attr)) == NULL)
{
set_error(state, "Attribute 'id' is required");
@@ -529,6 +584,7 @@
}
state->current_layout = mb_kbd_layout_new(state->keyboard, val);
+ mb_kbd_layout_set_realsize(state->current_layout, realsize);
mb_kbd_add_layout(state->keyboard, state->current_layout);
}
@@ -544,7 +600,7 @@
config_handle_key_tag(MBKeyboardConfigState *state, const char **attr)
{
const char *val;
- //MBKeyboardImage *img;
+
DBG("got key");
state->current_key = mb_kbd_key_new(state->keyboard);
@@ -567,10 +623,44 @@
mb_kbd_key_set_req_uwidth(state->current_key, atoi(val));
}
- if ((val = attr_get_val("fill", attr)) != NULL)
+ if (mb_kbd_layout_realsize(state->current_layout))
{
- if (strcaseeq(val, "true"))
- mb_kbd_key_set_fill(state->current_key, True);
+ int x = 0;
+ int y = 0;
+ int w = 0;
+ int h = 0;
+
+ if ((val = attr_get_val("fill", attr)) != NULL)
+ {
+ if (strcaseeq(val, "true"))
+ mb_kbd_key_set_fill(state->current_key, True);
+ }
+
+ if ((val = attr_get_val("real_x", attr)) != NULL)
+ {
+ if (atoi(val) > 0)
+ x = atoi(val);
+ }
+
+ if ((val = attr_get_val("real_y", attr)) != NULL)
+ {
+ if (atoi(val) > 0)
+ y = atoi(val);
+ }
+
+ if ((val = attr_get_val("real_w", attr)) != NULL)
+ {
+ if (atoi(val) > 0)
+ w = atoi(val);
+ }
+
+ if ((val = attr_get_val("real_h", attr)) != NULL)
+ {
+ if (atoi(val) > 0)
+ h = atoi(val);
+ }
+
+ mb_kbd_key_set_geometry (state->current_key, x, y, w, h);
}
mb_kbd_row_append_key(state->current_row, state->current_key);
@@ -609,6 +699,19 @@
mb_kbd_layout_set_background(state->current_layout, img);
+ if (mb_kbd_layout_realsize(state->current_layout))
+ {
+ if ((val = attr_get_val("width", attr)) != NULL)
+ {
+ if (atoi(val) > 0)
+ mb_kbd_layout_set_width(state->current_layout, atoi(val));
+ }
+ if ((val = attr_get_val("height", attr)) != NULL)
+ {
+ if (atoi(val) > 0)
+ mb_kbd_layout_set_height(state->current_layout, atoi(val));
+ }
+ }
}
static void
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-key.c 2007-03-05 10:05:09 UTC (rev 1247)
@@ -41,6 +41,7 @@
char *glyph;
KeySym keysym;
MBKeyboardKeyModType type;
+ MBKeyboardLayoutType layout_type;
} u;
}
MBKeyboardKeyAction;
@@ -405,7 +406,30 @@
return 0;
}
+/* Changer action */
+void
+mb_kbd_key_set_changer_action(MBKeyboardKey *key,
+ MBKeyboardKeyStateType state,
+ MBKeyboardLayoutType type)
+{
+ if (key->states[state] == NULL)
+ _mb_kbd_key_init_state(key, state);
+ key->states[state]->action.type = MBKeyboardKeyActionLayoutChanger;
+ key->states[state]->action.u.layout_type = type;
+}
+
+MBKeyboardLayoutType
+mb_kbd_get_changer_action(MBKeyboardKey *key,
+ MBKeyboardKeyStateType state)
+{
+ if (key->states[state]
+ && key->states[state]->action.type == MBKeyboardKeyActionLayoutChanger)
+ return key->states[state]->action.u.layout_type;
+
+ return 0;
+}
+
MBKeyboardKeyFaceType
mb_kbd_key_get_face_type(MBKeyboardKey *key,
MBKeyboardKeyStateType state)
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-layout.c 2007-03-05 10:05:09 UTC (rev 1247)
@@ -25,6 +25,11 @@
char *id;
MBKeyboardImage *background;
List *rows;
+
+ /* real size */
+ Bool realsize;
+ int width;
+ int height;
};
@@ -67,3 +72,39 @@
return util_list_get_first(layout->rows);
}
+/* real size */
+void
+mb_kbd_layout_set_realsize(MBKeyboardLayout *layout, int realsize)
+{
+ layout->realsize = realsize;
+}
+
+int
+mb_kbd_layout_realsize(MBKeyboardLayout *layout)
+{
+ return layout->realsize;
+}
+
+void
+mb_kbd_layout_set_width(MBKeyboardLayout *layout, int width)
+{
+ layout->width = width;
+}
+
+int
+mb_kbd_layout_get_width(MBKeyboardLayout *layout)
+{
+ return layout->width;
+}
+
+void
+mb_kbd_layout_set_height(MBKeyboardLayout *layout, int height)
+{
+ layout->height = height;
+}
+
+int
+mb_kbd_layout_get_height(MBKeyboardLayout *layout)
+{
+ return layout->height;
+}
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui-xft-backend.c 2007-03-05 10:05:09 UTC (rev 1247)
@@ -132,37 +132,42 @@
kbd = mb_kbd_ui_kbd(ui);
- rect.x = mb_kbd_key_abs_x(key);
- rect.y = mb_kbd_key_abs_y(key);
- rect.width = mb_kbd_key_width(key);
- rect.height = mb_kbd_key_height(key);
- //fprintf(stderr, "key->alloc_x=%d\n", mb_kbd_key_x(key));
- //fprintf(stderr, "rect.x=%d,rect.y=%d,rect.width=%d,rect.height=%d\n",rect.x,rect.y,rect.width,rect.height);
+ if (mb_kbd_layout_realsize(kbd->selected_layout))
+ {
+ rect.x = mb_kbd_key_x(key);
+ rect.y = mb_kbd_key_y(key);
+ rect.width = mb_kbd_key_width(key);
+ rect.height = mb_kbd_key_height(key);
+ }
+ else
+ {
+ rect.x = mb_kbd_key_abs_x(key);
+ rect.y = mb_kbd_key_abs_y(key);
+ rect.width = mb_kbd_key_width(key);
+ rect.height = mb_kbd_key_height(key);
- /* Hacky clip to work around issues with off by ones in layout code :( */
+ /* Hacky clip to work around issues with off by ones in layout code :( */
- if (rect.x + rect.width >= mb_kbd_ui_x_win_width(ui))
- rect.width = mb_kbd_ui_x_win_width(ui) - rect.x - 1;
+ if (rect.x + rect.width >= mb_kbd_ui_x_win_width(ui))
+ rect.width = mb_kbd_ui_x_win_width(ui) - rect.x - 1;
- if (rect.y + rect.height >= mb_kbd_ui_x_win_height(ui))
- rect.height = mb_kbd_ui_x_win_height(ui) - rect.y - 1;
+ if (rect.y + rect.height >= mb_kbd_ui_x_win_height(ui))
+ rect.height = mb_kbd_ui_x_win_height(ui) - rect.y - 1;
+ }
if (mb_kbd_key_is_held(kbd, key))
image = mb_kbd_key_get_push_image(key);
else
image = mb_kbd_key_get_normal_image(key);
+
if(image)
{
- int w, h;
- w = mb_kbd_image_width (image);
- h = mb_kbd_image_height (image);
-
XRenderComposite(xdpy,
PictOpOver,
mb_kbd_image_render_picture (image),
None,
XftDrawPicture (xft_backend->xft_backbuffer),
- 0, 0, 0, 0, rect.x, rect.y, w, h);
+ 0, 0, 0, 0, rect.x, rect.y, rect.width, rect.height);
}
else
{
@@ -230,74 +235,72 @@
rect.y + side_pad,
rect.width - (side_pad * 2) + 1,
rect.height - (side_pad * 2) + 1);
- }
- /* real code is here */
+ /* real code is here */
- state = mb_kbd_keys_current_state(kbd);
+ state = mb_kbd_keys_current_state(kbd);
+
+ if (mb_kbd_has_state(kbd, MBKeyboardStateCaps)
+ && mb_kbd_key_get_obey_caps(key))
+ state = MBKeyboardKeyStateShifted;
- if (mb_kbd_has_state(kbd, MBKeyboardStateCaps)
- && mb_kbd_key_get_obey_caps(key))
- state = MBKeyboardKeyStateShifted;
+ if (!mb_kdb_key_has_state(key, state))
+ {
+ if (state == MBKeyboardKeyStateNormal)
+ return; /* keys should at least have a normal state */
+ else
+ state = MBKeyboardKeyStateNormal;
+ }
- if (!mb_kdb_key_has_state(key, state))
- {
- if (state == MBKeyboardKeyStateNormal)
- return; /* keys should at least have a normal state */
- else
- state = MBKeyboardKeyStateNormal;
- }
+ if (mb_kbd_key_get_face_type(key, state) == MBKeyboardKeyFaceGlyph)
+ {
+ const char *face_str = mb_kbd_key_get_glyph_face(key, state);
+ int face_str_w, face_str_h;
+
+ if (face_str)
+ {
+ int x, y;
+
+ mb_kbd_ui_xft_text_extents(ui, face_str, &face_str_w, &face_str_h);
+
+ x = mb_kbd_key_abs_x(key) + ((mb_kbd_key_width(key) - face_str_w)/2);
+
+ y = mb_kbd_key_abs_y(key) +
+ ( (mb_kbd_key_height(key)
+ - (xft_backend->font->ascent + xft_backend->font->descent))
+ / 2 );
-/*
- if (mb_kbd_key_get_face_type(key, state) == MBKeyboardKeyFaceGlyph)
- {
- const char *face_str = mb_kbd_key_get_glyph_face(key, state);
- int face_str_w, face_str_h;
-
- if (face_str)
- {
- int x, y;
-
- mb_kbd_ui_xft_text_extents(ui, face_str, &face_str_w, &face_str_h);
-
- x = mb_kbd_key_abs_x(key) + ((mb_kbd_key_width(key) - face_str_w)/2);
-
- y = mb_kbd_key_abs_y(key) +
- ( (mb_kbd_key_height(key)
- - (xft_backend->font->ascent + xft_backend->font->descent))
- / 2 );
-
- XftDrawStringUtf8(xft_backend->xft_backbuffer,
- &xft_backend->font_col,
- xft_backend->font,
- x,
- y + xft_backend->font->ascent,
- (unsigned char*)face_str,
- strlen(face_str));
- }
- }
- else if (mb_kbd_key_get_face_type(key, state) == MBKeyboardKeyFaceImage)
- {
- int x, y, w, h;
- MBKeyboardImage *img;
-
- img = mb_kbd_key_get_image_face(key, state);
-
- w = mb_kbd_image_width (img);
- h = mb_kbd_image_height (img);
-
- x = mb_kbd_key_abs_x(key) + ((mb_kbd_key_width(key) - w) / 2);
- y = mb_kbd_key_abs_y(key) + ((mb_kbd_key_height(key) - h ) / 2);
-
-
- XRenderComposite(xdpy,
- PictOpOver,
- mb_kbd_image_render_picture (img),
- None,
- XftDrawPicture (xft_backend->xft_backbuffer),
- 0, 0, 0, 0, x, y, w, h);
- }
-*/
+ XftDrawStringUtf8(xft_backend->xft_backbuffer,
+ &xft_backend->font_col,
+ xft_backend->font,
+ x,
+ y + xft_backend->font->ascent,
+ (unsigned char*)face_str,
+ strlen(face_str));
+ }
+ }
+ else if (mb_kbd_key_get_face_type(key, state) == MBKeyboardKeyFaceImage)
+ {
+ int x, y, w, h;
+ MBKeyboardImage *img;
+
+ img = mb_kbd_key_get_image_face(key, state);
+
+ w = mb_kbd_image_width (img);
+ h = mb_kbd_image_height (img);
+
+ x = mb_kbd_key_abs_x(key) + ((mb_kbd_key_width(key) - w) / 2);
+ y = mb_kbd_key_abs_y(key) + ((mb_kbd_key_height(key) - h ) / 2);
+
+
+ XRenderComposite(xdpy,
+ PictOpOver,
+ mb_kbd_image_render_picture (img),
+ None,
+ XftDrawPicture (xft_backend->xft_backbuffer),
+ 0, 0, 0, 0, x, y, w, h);
+ }
+ } /* End if(image) else */
}
void
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard-ui.c 2007-03-05 10:05:09 UTC (rev 1247)
@@ -369,6 +369,16 @@
layout = mb_kbd_get_selected_layout(ui->kbd);
+ /* The keyboard is a realsize keyboard, the size and location of
+ the keyboard and each keys are fixed */
+ if (mb_kbd_layout_realsize(layout))
+ {
+ *width = mb_kbd_layout_get_width(layout);
+ *height = mb_kbd_layout_get_height(layout);
+
+ return;
+ }
+
/* Do an initial run to figure out a 'base' size for single glyph keys */
mb_kdb_ui_unit_key_size(ui, &ui->key_uwidth, &ui->key_uheight);
@@ -390,46 +400,46 @@
max_row_key_height = 0;
mb_kbd_row_for_each_key(row, key_item)
- {
- int key_w = 0, key_h = 0;
- MBKeyboardKey *key = key_item->data;
+ {
+ int key_w = 0, key_h = 0;
+ MBKeyboardKey *key = key_item->data;
- mb_kbd_key_set_extra_height_pad(key, 0);
- mb_kbd_key_set_extra_width_pad(key, 0);
- mb_kbd_key_set_geometry(key, 0, 0, 0, 0);
+ mb_kbd_key_set_extra_height_pad(key, 0);
+ mb_kbd_key_set_extra_width_pad(key, 0);
+ mb_kbd_key_set_geometry(key, 0, 0, 0, 0);
- if (!mb_kbd_is_extended(ui->kbd) && mb_kbd_key_get_extended(key))
- continue;
+ if (!mb_kbd_is_extended(ui->kbd) && mb_kbd_key_get_extended(key))
+ continue;
- mb_kbd_ui_min_key_size(ui, key, &key_w, &key_h);
+ mb_kbd_ui_min_key_size(ui, key, &key_w, &key_h);
- if (!mb_kbd_key_get_req_uwidth(key)
- && key_w < ui->key_uwidth)
- key_w = ui->key_uwidth;
+ if (!mb_kbd_key_get_req_uwidth(key)
+ && key_w < ui->key_uwidth)
+ key_w = ui->key_uwidth;
- if (key_h < ui->key_uheight)
- key_h = ui->key_uheight;
+ if (key_h < ui->key_uheight)
+ key_h = ui->key_uheight;
- key_y = 0;
+ key_y = 0;
- key_w += 2 * ( mb_kbd_keys_border(ui->kbd)
- + mb_kbd_keys_margin(ui->kbd)
- + mb_kbd_keys_pad(ui->kbd) );
+ key_w += 2 * ( mb_kbd_keys_border(ui->kbd)
+ + mb_kbd_keys_margin(ui->kbd)
+ + mb_kbd_keys_pad(ui->kbd) );
- key_h += 2 * ( mb_kbd_keys_border(ui->kbd)
- + mb_kbd_keys_margin(ui->kbd)
- + mb_kbd_keys_pad(ui->kbd) );
-
- if (key_h > max_row_key_height)
- max_row_key_height = key_h;
+ key_h += 2 * ( mb_kbd_keys_border(ui->kbd)
+ + mb_kbd_keys_margin(ui->kbd)
+ + mb_kbd_keys_pad(ui->kbd) );
+
+ if (key_h > max_row_key_height)
+ max_row_key_height = key_h;
- mb_kbd_key_set_geometry(key, key_x, key_y, key_w, key_h);
-
- key_x += (mb_kbd_col_spacing(ui->kbd) + key_w);
- }
+ mb_kbd_key_set_geometry(key, key_x, key_y, key_w, key_h);
+
+ key_x += (mb_kbd_col_spacing(ui->kbd) + key_w);
+ }
if (key_x > max_row_width) /* key_x now represents row width */
- max_row_width = key_x;
+ max_row_width = key_x;
mb_kbd_row_set_y(row, row_y);
@@ -450,57 +460,57 @@
int n_fillers = 0, free_space = 0, new_w = 0;
mb_kbd_row_for_each_key(row,key_item)
- {
- if (!mb_kbd_is_extended(ui->kbd)
- && mb_kbd_key_get_extended(key_item->data))
- continue;
+ {
+ if (!mb_kbd_is_extended(ui->kbd)
+ && mb_kbd_key_get_extended(key_item->data))
+ continue;
- if (mb_kbd_key_get_fill(key_item->data)
- || mb_kbd_ui_display_height(ui) <= 320
- || mb_kbd_ui_display_width(ui) <= 320 )
- n_fillers++;
- }
+ if (mb_kbd_key_get_fill(key_item->data)
+ || mb_kbd_ui_display_height(ui) <= 320
+ || mb_kbd_ui_display_width(ui) <= 320 )
+ n_fillers++;
+ }
if (!n_fillers)
- goto next_row;
+ goto next_row;
free_space = max_row_width - mb_kbd_row_width(row);
mb_kbd_row_for_each_key(row, key_item)
- {
- if (!mb_kbd_is_extended(ui->kbd)
- && mb_kbd_key_get_extended(key_item->data))
- continue;
+ {
+ if (!mb_kbd_is_extended(ui->kbd)
+ && mb_kbd_key_get_extended(key_item->data))
+ continue;
- if (mb_kbd_key_get_fill(key_item->data)
- || mb_kbd_ui_display_height(ui) <= 320
- || mb_kbd_ui_display_width(ui) <= 320 )
- {
- int old_w;
- List *nudge_key_item = util_list_next(key_item);
+ if (mb_kbd_key_get_fill(key_item->data)
+ || mb_kbd_ui_display_height(ui) <= 320
+ || mb_kbd_ui_display_width(ui) <= 320 )
+ {
+ int old_w;
+ List *nudge_key_item = util_list_next(key_item);
- old_w = mb_kbd_key_width(key_item->data);
- new_w = old_w + (free_space/n_fillers);
+ old_w = mb_kbd_key_width(key_item->data);
+ new_w = old_w + (free_space/n_fillers);
- mb_kbd_key_set_geometry(key_item->data, -1, -1, new_w, -1);
+ mb_kbd_key_set_geometry(key_item->data, -1, -1, new_w, -1);
- /* nudge next keys forward */
+ /* nudge next keys forward */
- for (;
- nudge_key_item != NULL;
- nudge_key_item = util_list_next(nudge_key_item))
- {
- if (!mb_kbd_is_extended(ui->kbd)
- && mb_kbd_key_get_extended(nudge_key_item->data))
- continue;
+ for (;
+ nudge_key_item != NULL;
+ nudge_key_item = util_list_next(nudge_key_item))
+ {
+ if (!mb_kbd_is_extended(ui->kbd)
+ && mb_kbd_key_get_extended(nudge_key_item->data))
+ continue;
- mb_kbd_key_set_geometry(nudge_key_item->data,
- mb_kbd_key_x(nudge_key_item->data) + (new_w - old_w ), -1, -1, -1);
-
- }
- }
+ mb_kbd_key_set_geometry(nudge_key_item->data,
+ mb_kbd_key_x(nudge_key_item->data) + (new_w - old_w ), -1, -1, -1);
+
+ }
+ }
- }
+ }
next_row:
row_item = util_list_next(row_item);
}
@@ -766,7 +776,8 @@
* to avoid the case of mapping and then the wm resizing
* us, causing an ugly repaint.
*/
- /*if (desk_width > ui->xwin_width)
+ /*if ((desk_width > ui->xwin_width)
+ && !mb_kbd_layout_realsize(ui->kbd->selected_layout))
{
mb_kbd_ui_resize(ui,
desk_width,
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.c 2007-03-05 10:05:09 UTC (rev 1247)
@@ -219,29 +219,45 @@
{
MBKeyboardRow *row = row_item->data;
- if (x >= mb_kbd_row_x(row)
- && x <= mb_kbd_row_x(row) + mb_kbd_row_width(row)
- && y >= mb_kbd_row_y(row)
- && y <= mb_kbd_row_y(row) + mb_kbd_row_height(row) )
- {
- mb_kbd_row_for_each_key(row, key_item)
- {
- MBKeyboardKey *key = key_item->data;
+ if (mb_kbd_layout_realsize(layout))
+ {
+ mb_kbd_row_for_each_key(row, key_item)
+ {
+ MBKeyboardKey *key = key_item->data;
- if (!mb_kbd_is_extended(kb)
- && mb_kbd_key_get_extended(key))
- continue;
+ if (x >= mb_kbd_key_x(key)
+ && x <= mb_kbd_key_x(key) + mb_kbd_key_width(key)
+ && y >= mb_kbd_key_y(key)
+ && y <= mb_kbd_key_y(key) + mb_kbd_key_height(key))
+ return key;
+ }
+ }
+ else
+ {
+ if (x >= mb_kbd_row_x(row)
+ && x <= mb_kbd_row_x(row) + mb_kbd_row_width(row)
+ && y >= mb_kbd_row_y(row)
+ && y <= mb_kbd_row_y(row) + mb_kbd_row_height(row) )
+ {
+ mb_kbd_row_for_each_key(row, key_item)
+ {
+ MBKeyboardKey *key = key_item->data;
+
+ if (!mb_kbd_is_extended(kb)
+ && mb_kbd_key_get_extended(key))
+ continue;
+
+ if (!mb_kbd_key_is_blank(key)
+ && x >= mb_kbd_key_abs_x(key)
+ && x <= mb_kbd_key_abs_x(key) + mb_kbd_key_width(key))
+ return key;
+
+ }
+
+ return NULL;
+ }
+ }
- if (!mb_kbd_key_is_blank(key)
- && x >= mb_kbd_key_abs_x(key)
- && x <= mb_kbd_key_abs_x(key) + mb_kbd_key_width(key))
- return key;
-
- }
-
- return NULL;
- }
-
row_item = util_list_next(row_item);
}
return NULL;
Modified: trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h 2007-03-05 08:40:00 UTC (rev 1246)
+++ trunk/src/target/OM-2007/applications/openmoko-keyboard/src/matchbox-keyboard.h 2007-03-05 10:05:09 UTC (rev 1247)
@@ -86,6 +86,7 @@
MBKeyboardKeyActionGlyph,
MBKeyboardKeyActionXKeySym, /* 'specials' be converted into this */
MBKeyboardKeyActionModifier,
+ MBKeyboardKeyActionLayoutChanger, /* Change the keyboard to special layout */
} MBKeyboardKeyActionType;
@@ -103,6 +104,16 @@
} MBKeyboardKeyModType;
+typedef enum
+{
+ MBKeyboardUnknown = 0,
+ MBKeyboardLows,
+ MBKeyboardCaps,
+ MBKeyboardNumbers,
+ MBKeyboardSymbols,
+ MBKeyboardChinese
+} MBKeyboardLayoutType;
+
typedef enum
{
MBKeyboardKeyFaceNone = 0,
@@ -354,7 +365,24 @@
List*
mb_kbd_layout_rows(MBKeyboardLayout *layout);
+void
+mb_kbd_layout_set_realsize(MBKeyboardLayout *layout, int realsize);
+int
+mb_kbd_layout_realsize(MBKeyboardLayout *layout);
+
+void
+mb_kbd_layout_set_width(MBKeyboardLayout *layout, int width);
+
+int
+mb_kbd_layout_get_width(MBKeyboardLayout *layout);
+
+void
+mb_kbd_layout_set_height(MBKeyboardLayout *layout, int height);
+
+int
+mb_kbd_layout_get_height(MBKeyboardLayout *layout);
+
/**** Rows ******/
MBKeyboardRow*
@@ -529,6 +557,15 @@
mb_kbd_key_get_modifer_action(MBKeyboardKey *key,
MBKeyboardKeyStateType state);
+void
+mb_kbd_key_set_changer_action(MBKeyboardKey *key,
+ MBKeyboardKeyStateType state,
+ MBKeyboardLayoutType type);
+
+MBKeyboardLayoutType
+mb_kbd_get_changer_action(MBKeyboardKey *key,
+ MBKeyboardKeyStateType state);
+
boolean
mb_kbd_key_is_held(MBKeyboard *kbd, MBKeyboardKey *key);
More information about the commitlog
mailing list