~ubuntu-branches/ubuntu/quantal/ibus-chewing/quantal-updates

« back to all changes in this revision

Viewing changes to src/IBusChewingEngine-keys.c

  • Committer: Bazaar Package Importer
  • Author(s): LI Daobing
  • Date: 2009-09-17 19:06:19 UTC
  • mfrom: (1.1.5 upstream) (0.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090917190619-glkpocbc4ityzr8b
Tags: 1.2.0.20090917-1
new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    guint state= modifiers & (IBUS_SHIFT_MASK | IBUS_CONTROL_MASK | IBUS_MOD1_MASK);
24
24
    self->_priv->key_last=keysym;
25
25
    if (state==0){
26
 
        switch (keysym){
27
 
            case IBUS_KP_0:
28
 
            case IBUS_KP_1:
29
 
            case IBUS_KP_2:
30
 
            case IBUS_KP_3:
31
 
            case IBUS_KP_4:
32
 
            case IBUS_KP_5:
33
 
            case IBUS_KP_6:
34
 
            case IBUS_KP_7:
35
 
            case IBUS_KP_8:
36
 
            case IBUS_KP_9:
37
 
                if (self->numpadAlwaysNumber && chewing_get_ChiEngMode(self->context)){
38
 
                    chewing_set_ChiEngMode(self->context, 0);
39
 
                    self_handle_Default(self,keysym_KP_to_normal(keysym),FALSE);
40
 
                    chewing_set_ChiEngMode(self->context,CHINESE_MODE);
41
 
                }else{
42
 
                    /* Convert kp numbers to normal */
43
 
                    self_handle_Default(self,keysym_KP_to_normal(keysym),FALSE);
44
 
                }
45
 
                break;
46
 
            case IBUS_Return:
47
 
            case IBUS_KP_Enter:
48
 
                chewing_handle_Enter(self->context);
49
 
                break;
50
 
            case IBUS_Escape:
51
 
                chewing_handle_Esc(self->context);
52
 
                break;
53
 
            case IBUS_BackSpace:
54
 
                chewing_handle_Backspace(self->context);
55
 
                break;
56
 
            case IBUS_Delete:
57
 
            case IBUS_KP_Delete:
58
 
                chewing_handle_Del(self->context);
59
 
                break;
60
 
            case IBUS_space:
61
 
            case IBUS_KP_Space:
62
 
                chewing_handle_Space(self->context);
63
 
                break;
64
 
            case IBUS_Page_Up:
65
 
            case IBUS_KP_Page_Up:
66
 
                IBUS_ENGINE_GET_CLASS(engine)->page_up(engine);
67
 
                break;
68
 
            case IBUS_Page_Down:
69
 
            case IBUS_KP_Page_Down:
70
 
                IBUS_ENGINE_GET_CLASS(engine)->page_down(engine);
71
 
                break;
72
 
            case IBUS_Up:
73
 
            case IBUS_KP_Up:
74
 
                IBUS_ENGINE_GET_CLASS(engine)->cursor_up(engine);
75
 
                break;
76
 
            case IBUS_Down:
77
 
            case IBUS_KP_Down:
78
 
                IBUS_ENGINE_GET_CLASS(engine)->cursor_down(engine);
79
 
                break;
80
 
            case IBUS_Left:
81
 
            case IBUS_KP_Left:
82
 
                chewing_handle_Left(self->context);
83
 
                break;
84
 
            case IBUS_Right:
85
 
            case IBUS_KP_Right:
86
 
                chewing_handle_Right(self->context);
87
 
                break;
88
 
            case IBUS_Home:
89
 
            case IBUS_KP_Home:
90
 
                chewing_handle_Home(self->context);
91
 
                break;
92
 
            case IBUS_End:
93
 
            case IBUS_KP_End:
94
 
                chewing_handle_End(self->context);
95
 
                break;
96
 
            case IBUS_Tab:
97
 
                chewing_handle_Tab(self->context);
98
 
                break;
99
 
            case IBUS_Caps_Lock:
100
 
                chewing_handle_Capslock(self->context);
101
 
                self_refresh_property(self,"chewing_chieng_prop");
102
 
                break;
103
 
            default:
104
 
                self_handle_Default(self,keysym,FALSE);
105
 
                break;
 
26
        guint keysym_tmp=keysym_KP_to_normal(keysym);
 
27
        if (keysym_tmp){
 
28
            /* Is keypad key */
 
29
            if (self->numpadAlwaysNumber && chewing_get_ChiEngMode(self->context)){
 
30
                chewing_set_ChiEngMode(self->context, 0);
 
31
                self_handle_Default(self,keysym_tmp,FALSE);
 
32
                chewing_set_ChiEngMode(self->context,CHINESE_MODE);
 
33
            }else{
 
34
                /* Convert kp numbers to normal */
 
35
                self_handle_Default(self,keysym_tmp,FALSE);
 
36
            }
 
37
        }else{
 
38
            switch (keysym){
 
39
                case IBUS_Return:
 
40
                case IBUS_KP_Enter:
 
41
                    chewing_handle_Enter(self->context);
 
42
                    break;
 
43
                case IBUS_Escape:
 
44
                    chewing_handle_Esc(self->context);
 
45
                    break;
 
46
                case IBUS_BackSpace:
 
47
                    chewing_handle_Backspace(self->context);
 
48
                    break;
 
49
                case IBUS_Delete:
 
50
                case IBUS_KP_Delete:
 
51
                    chewing_handle_Del(self->context);
 
52
                    break;
 
53
                case IBUS_space:
 
54
                case IBUS_KP_Space:
 
55
                    chewing_handle_Space(self->context);
 
56
                    break;
 
57
                case IBUS_Page_Up:
 
58
                case IBUS_KP_Page_Up:
 
59
                    IBUS_ENGINE_GET_CLASS(engine)->page_up(engine);
 
60
                    break;
 
61
                case IBUS_Page_Down:
 
62
                case IBUS_KP_Page_Down:
 
63
                    IBUS_ENGINE_GET_CLASS(engine)->page_down(engine);
 
64
                    break;
 
65
                case IBUS_Up:
 
66
                case IBUS_KP_Up:
 
67
                    IBUS_ENGINE_GET_CLASS(engine)->cursor_up(engine);
 
68
                    break;
 
69
                case IBUS_Down:
 
70
                case IBUS_KP_Down:
 
71
                    IBUS_ENGINE_GET_CLASS(engine)->cursor_down(engine);
 
72
                    break;
 
73
                case IBUS_Left:
 
74
                case IBUS_KP_Left:
 
75
                    chewing_handle_Left(self->context);
 
76
                    break;
 
77
                case IBUS_Right:
 
78
                case IBUS_KP_Right:
 
79
                    chewing_handle_Right(self->context);
 
80
                    break;
 
81
                case IBUS_Home:
 
82
                case IBUS_KP_Home:
 
83
                    chewing_handle_Home(self->context);
 
84
                    break;
 
85
                case IBUS_End:
 
86
                case IBUS_KP_End:
 
87
                    chewing_handle_End(self->context);
 
88
                    break;
 
89
                case IBUS_Tab:
 
90
                    chewing_handle_Tab(self->context);
 
91
                    break;
 
92
                case IBUS_Caps_Lock:
 
93
                    chewing_handle_Capslock(self->context);
 
94
                    self_refresh_property(self,"chewing_chieng_prop");
 
95
                    break;
 
96
                default:
 
97
                    self_handle_Default(self,keysym,FALSE);
 
98
                    break;
 
99
            }
106
100
        }
107
101
    }else if (state==IBUS_SHIFT_MASK){
108
102
        switch(keysym){