aaf2345e1136acc6b13f3db7125ed6f97a41b7b9
[platform/core/uifw/libscl-ui-nui.git] / scl / sclcontext.cpp
1 /*
2  * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <stdio.h>
19 #include <stdlib.h>
20
21 #include "sclcontext.h"
22 #include "scldebug.h"
23 #include "sclwindows.h"
24 #include "sclutils.h"
25 #include "sclresourcecache.h"
26 #include "sclres.h"
27 #include <algorithm>
28
29 //#include "sclresource.h"
30
31 using namespace scl;
32
33 CSCLContext::CSCLContext()
34 {
35     SCL_DEBUG();
36
37     reset();
38 }
39
40 CSCLContext::~CSCLContext()
41 {
42     SCL_DEBUG();
43 }
44
45 CSCLContext*
46 CSCLContext::get_instance()
47 {
48     static CSCLContext instance;
49     return &instance;
50 }
51
52 void
53 CSCLContext::reset()
54 {
55     SCL_DEBUG();
56
57     m_display_mode = DISPLAYMODE_PORTRAIT;
58     m_input_mode = 0;
59
60     m_shift_state = SCL_SHIFT_STATE_OFF;
61     m_shift_multi_touch_state = SCL_SHIFT_MULTITOUCH_OFF;
62
63     m_rotation = ROTATION_0;
64     m_prev_display_mode = DISPLAYMODE_PORTRAIT;
65     m_prev_input_mode = NOT_USED;
66
67     m_hidden = false;
68     m_caps_lock_mode = false;
69
70     m_magnifier_enabled = TRUE;
71     m_sound_enabled = TRUE;
72     m_vibration_enabled = TRUE;
73     m_shift_multi_touch_enabled = TRUE;
74     m_highlight_ui_enabled = FALSE;
75     m_highlight_ui_animation_enabled = FALSE;
76
77     m_tts_enabled = FALSE;
78     m_cur_highlighted_key = 0;
79     m_cur_highlighted_window = SCLWINDOW_INVALID;
80
81     m_multi_touch_context.clear();
82     m_last_touch_device_id = SCLTOUCHDEVICE_INVALID;
83
84     m_last_pressed_window = SCLWINDOW_INVALID;
85     m_last_pressed_key = NOT_USED;
86
87     m_last_event_fired_window = SCLWINDOW_INVALID;
88     m_last_event_fired_key = NOT_USED;
89
90     memset(m_cur_sub_layout, 0x00, sizeof(m_cur_sub_layout));
91 }
92
93 sclshort
94 CSCLContext::get_popup_layout(sclwindow window) const
95 {
96     SCL_DEBUG();
97
98     sclshort ret = NOT_USED;
99
100     CSCLWindows *windows = CSCLWindows::get_instance();
101     if (!windows) return ret;
102
103     //SclWindowContext *window_context = windows->get_window_context(window, FALSE);
104     SclWindowContext *window_context = windows->get_window_context(window);
105
106     if (window_context) {
107         ret = window_context->layout;
108     }
109
110     return ret;
111 }
112
113 void
114 CSCLContext::set_popup_layout(sclwindow window, sclshort val)
115 {
116     SCL_DEBUG();
117
118     CSCLWindows *windows = CSCLWindows::get_instance();
119     if (!windows) return;
120
121     //SclWindowContext *window_context = windows->get_window_context(window, FALSE);
122     SclWindowContext *window_context = windows->get_window_context(window);
123
124     if (window_context) {
125         window_context->layout = val;
126     }
127 }
128
129 void
130 CSCLContext::set_base_layout(sclshort val)
131 {
132     SCL_DEBUG();
133
134     CSCLWindows *windows = CSCLWindows::get_instance();
135     if (!windows) return;
136
137     //SclWindowContext *window_context = windows->get_window_context(windows->get_base_window(), FALSE);
138     SclWindowContext *window_context = windows->get_window_context(windows->get_base_window());
139     if (window_context) {
140         window_context->layout = val;
141     }
142 }
143
144 sclshort
145 CSCLContext::get_base_layout() const
146 {
147     SCL_DEBUG();
148
149     sclshort ret = NOT_USED;
150
151     CSCLWindows *windows = CSCLWindows::get_instance();
152     if (!windows) return ret;
153
154     //SclWindowContext *window_context = windows->get_window_context(windows->get_base_window(), FALSE);
155     SclWindowContext *window_context = windows->get_window_context(windows->get_base_window());
156     if (window_context) {
157         ret = window_context->layout;
158     }
159
160     return ret;
161 }
162
163 scl16
164 CSCLContext::get_cur_pressed_event_id(scltouchdevice touch_id)
165 {
166     scl16 ret = NOT_USED;
167     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
168     if (multi_touch_context) {
169         ret = multi_touch_context->event_id;
170     }
171     return ret;
172 }
173
174 void
175 CSCLContext::set_cur_pressed_event_id(scltouchdevice touch_id, scl16 id)
176 {
177     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
178     if (multi_touch_context) {
179         multi_touch_context->event_id = id;
180     }
181 }
182
183 scl8
184 CSCLContext::get_cur_pressed_key(scltouchdevice touch_id)
185 {
186     scl8 ret = NOT_USED;
187     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
188     if (multi_touch_context) {
189         ret = multi_touch_context->cur_pressed_key;
190     }
191     return ret;
192 }
193
194 void
195 CSCLContext::set_cur_pressed_key(scltouchdevice touch_id, scl8 val)
196 {
197     MultiTouchContext *window_context = find_multi_touch_context(touch_id);
198     if (window_context) {
199         window_context->cur_pressed_key = val;
200     }
201 }
202
203 sclwindow
204 CSCLContext::get_cur_pressed_window(scltouchdevice touch_id)
205 {
206     sclwindow ret = SCLWINDOW_INVALID;
207     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
208     if (multi_touch_context) {
209         ret = multi_touch_context->cur_pressed_window;
210     }
211     return ret;
212 }
213
214 void
215 CSCLContext::set_cur_pressed_window(scltouchdevice touch_id, sclwindow val)
216 {
217     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
218     if (multi_touch_context) {
219         multi_touch_context->cur_pressed_window = val;
220     }
221 }
222
223 SclPoint
224 CSCLContext::get_cur_pressed_point(scltouchdevice touch_id)
225 {
226     SclPoint ret = {0, 0};
227     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
228     if (multi_touch_context) {
229         ret = multi_touch_context->cur_pressed_point;
230     }
231     return ret;
232 }
233
234 void
235 CSCLContext::set_cur_pressed_point(scltouchdevice touch_id, sclint x, sclint y)
236 {
237     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
238     if (multi_touch_context) {
239         multi_touch_context->cur_pressed_point.x = x;
240         multi_touch_context->cur_pressed_point.y = y;
241         set_farthest_move_point(touch_id, x, y); // reset farthest move point
242     }
243 }
244
245 SclPoint
246 CSCLContext::get_cur_moving_point(scltouchdevice touch_id)
247 {
248     SclPoint ret = {0, 0};
249     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
250     if (multi_touch_context) {
251         ret = multi_touch_context->cur_moving_point;
252     }
253     return ret;
254 }
255
256 void
257 CSCLContext::set_cur_moving_point(scltouchdevice touch_id, sclint x, sclint y)
258 {
259     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
260     if (multi_touch_context) {
261         multi_touch_context->cur_moving_point.x = x;
262         multi_touch_context->cur_moving_point.y = y;
263     }
264 }
265
266 sclwindow
267 CSCLContext::get_cur_moving_window(scltouchdevice touch_id)
268 {
269     sclwindow ret = SCLWINDOW_INVALID;
270     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
271     if (multi_touch_context) {
272         ret = multi_touch_context->cur_moving_window;
273     }
274     return ret;
275 }
276
277
278 void
279 CSCLContext::set_cur_moving_window(scltouchdevice touch_id, sclwindow window)
280 {
281     MultiTouchContext *window_context = find_multi_touch_context(touch_id);
282     if (window_context) {
283         window_context->cur_moving_window = window;
284     }
285 }
286
287 struct timeval
288 CSCLContext::get_cur_pressed_time(scltouchdevice touch_id)
289 {
290     struct timeval ret = {0, 0};
291     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
292     if (multi_touch_context) {
293         ret = multi_touch_context->cur_pressed_time;
294     }
295     return ret;
296 }
297
298 void
299 CSCLContext::set_cur_pressed_time(scltouchdevice touch_id)
300 {
301     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
302     if (multi_touch_context) {
303         gettimeofday(&(multi_touch_context->cur_pressed_time), NULL);
304     }
305 }
306
307 SclPoint
308 CSCLContext::get_farthest_move_point(scltouchdevice touch_id)
309 {
310     SclPoint ret = {0, 0};
311     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
312     if (multi_touch_context) {
313         ret = multi_touch_context->farthest_move_point;
314     }
315     return ret;
316 }
317
318 void
319 CSCLContext::set_farthest_move_point(scltouchdevice touch_id, sclint x, sclint y)
320 {
321     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
322     if (multi_touch_context) {
323         CSCLUtils *utils = CSCLUtils::get_instance();
324         if (utils) {
325             multi_touch_context->farthest_move_dist =
326                 utils->get_approximate_distance(x, y,
327                 multi_touch_context->cur_pressed_point.x, multi_touch_context->cur_pressed_point.y);
328         }
329
330         multi_touch_context->farthest_move_point.x = x;
331         multi_touch_context->farthest_move_point.y = y;
332     }
333 }
334
335 sclint
336 CSCLContext::get_farthest_move_dist(scltouchdevice touch_id)
337 {
338     sclint ret = 0;
339     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
340     if (multi_touch_context) {
341         ret = multi_touch_context->farthest_move_dist;
342     }
343     return ret;
344 }
345
346 SCLDragState
347 CSCLContext::get_cur_drag_state(scltouchdevice touch_id)
348 {
349     SCLDragState ret = SCL_DRAG_STATE_NONE;
350     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
351     if (multi_touch_context) {
352         ret = multi_touch_context->cur_drag_state;
353     }
354     return ret;
355 }
356
357 void
358 CSCLContext::set_cur_drag_state(scltouchdevice touch_id, SCLDragState state)
359 {
360     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
361     if (multi_touch_context) {
362         multi_touch_context->cur_drag_state = state;
363     }
364 }
365
366 SCLKeyModifier
367 CSCLContext::get_cur_key_modifier(scltouchdevice touch_id)
368 {
369     SCLKeyModifier ret = KEY_MODIFIER_NONE;
370     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
371     if (multi_touch_context) {
372         ret = multi_touch_context->cur_key_modifier;
373     }
374     return ret;
375 }
376
377 void
378 CSCLContext::set_cur_key_modifier(scltouchdevice touch_id, SCLKeyModifier modifier)
379 {
380     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
381     if (multi_touch_context) {
382         multi_touch_context->cur_key_modifier = modifier;
383     }
384 }
385
386 scl8
387 CSCLContext::get_prev_pressed_key(scltouchdevice touch_id)
388 {
389     scl8 ret = NOT_USED;
390     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
391     if (multi_touch_context) {
392         ret = multi_touch_context->prev_pressed_key;
393     }
394     return ret;
395 }
396
397 void
398 CSCLContext::set_prev_pressed_key(scltouchdevice touch_id, scl8 val)
399 {
400     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
401     if (multi_touch_context) {
402         multi_touch_context->prev_pressed_key = val;
403     }
404 }
405
406 sclwindow
407 CSCLContext::get_prev_pressed_window(scltouchdevice touch_id)
408 {
409     sclwindow ret = SCLWINDOW_INVALID;
410     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
411     if (multi_touch_context) {
412         ret = multi_touch_context->prev_pressed_window;
413     }
414     return ret;
415 }
416
417 void
418 CSCLContext::set_prev_pressed_window(scltouchdevice touch_id, sclwindow val)
419 {
420     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
421     if (multi_touch_context) {
422         multi_touch_context->prev_pressed_window = val;
423     }
424 }
425
426 SclPoint
427 CSCLContext::get_prev_moving_point(scltouchdevice touch_id)
428 {
429     SclPoint ret = {0, 0};
430     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
431     if (multi_touch_context) {
432         ret = multi_touch_context->prev_moving_point;
433     }
434     return ret;
435 }
436
437 void
438 CSCLContext::set_prev_moving_point(scltouchdevice touch_id, sclint x, sclint y)
439 {
440     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
441     if (multi_touch_context) {
442         multi_touch_context->prev_moving_point.x = x;
443         multi_touch_context->prev_moving_point.y = y;
444     }
445 }
446
447 SCLDragState
448 CSCLContext::get_prev_drag_state(scltouchdevice touch_id)
449 {
450     SCLDragState ret = SCL_DRAG_STATE_NONE;
451     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
452     if (multi_touch_context) {
453         ret = multi_touch_context->prev_drag_state;
454     }
455     return ret;
456 }
457
458 void
459 CSCLContext::set_prev_drag_state(scltouchdevice touch_id, SCLDragState state)
460 {
461     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
462     if (multi_touch_context) {
463         multi_touch_context->prev_drag_state = state;
464     }
465 }
466
467 void
468 CSCLContext::create_multi_touch_context(scltouchdevice touch_id, sclboolean is_sub_event)
469 {
470     MultiTouchContext new_multi_touch_context;
471     memset(&new_multi_touch_context, 0x00, sizeof(MultiTouchContext));
472     new_multi_touch_context.used = TRUE;
473     new_multi_touch_context.cur_pressed_key = NOT_USED;
474     new_multi_touch_context.cur_pressed_window = SCLWINDOW_INVALID;
475     new_multi_touch_context.event_id = 0;
476     new_multi_touch_context.prev_pressed_key = NOT_USED;
477     new_multi_touch_context.prev_pressed_window = SCLWINDOW_INVALID;
478     new_multi_touch_context.cur_pressed_point.x = new_multi_touch_context.cur_pressed_point.y = 0;
479     new_multi_touch_context.cur_pressed_time.tv_sec = new_multi_touch_context.cur_pressed_time.tv_usec = 0;
480     new_multi_touch_context.cur_drag_state = SCL_DRAG_STATE_NONE;
481     new_multi_touch_context.is_sub_event = is_sub_event;
482     m_multi_touch_context[touch_id] = new_multi_touch_context;
483
484     m_multi_touch_seq.insert(m_multi_touch_seq.end(), touch_id);
485
486     CSCLUtils *utils = CSCLUtils::get_instance();
487     if (utils) {
488         for (std::list<scltouchdevice>::iterator iter = m_multi_touch_seq.begin();iter != m_multi_touch_seq.end();std::advance(iter, 1)) {
489             utils->log("LIST : %d\n", *iter);
490         }
491         utils->log("\n");
492     }
493 }
494
495 void
496 CSCLContext::destroy_multi_touch_context(scltouchdevice touch_id)
497 {
498     MultiTouchContext *multi_touch_context = find_multi_touch_context(touch_id);
499     if (multi_touch_context) {
500         memset(multi_touch_context, 0x00, sizeof(MultiTouchContext));
501         m_multi_touch_context.erase(touch_id);
502     }
503
504     sclboolean bFound = TRUE;
505     std::list<scltouchdevice>::iterator iter;
506     do {
507         iter = std::find(m_multi_touch_seq.begin(), m_multi_touch_seq.end(), touch_id);
508         if (iter != m_multi_touch_seq.end()) {
509             m_multi_touch_seq.erase(iter);
510         } else {
511             bFound = FALSE;
512         }
513     } while (bFound);
514
515     /*
516     CSCLUtils *utils = CSCLUtils::get_instance();
517     if (utils) {
518         for(iter = m_multi_touch_seq.begin();iter != m_multi_touch_seq.end();std::advance(iter, 1)) {
519             utils->log("LIST : %d\n", *iter);
520         }
521         utils->log("\n");
522     }
523     */
524 }
525
526 MultiTouchContext*
527 CSCLContext::find_multi_touch_context(scltouchdevice touch_id)
528 {
529     MultiTouchContext* ret = NULL;
530     std::map<scltouchdevice, MultiTouchContext>::iterator iter = m_multi_touch_context.find(touch_id);
531     if (iter != m_multi_touch_context.end()) {
532         ret = &(iter->second);
533     }
534
535     return ret;
536 }
537
538 sclint
539 CSCLContext::get_multi_touch_context_num()
540 {
541     return m_multi_touch_seq.size();
542 }
543
544 sclboolean
545 CSCLContext::get_multi_touch_event(sclint order, SclUIEventDesc *desc)
546 {
547     sclboolean ret = FALSE;
548     sclint index = 0;
549
550     CSCLResourceCache *cache = CSCLResourceCache::get_instance();
551
552     if (!cache) return ret;
553     for (std::list<scltouchdevice>::iterator list_iter = m_multi_touch_seq.begin();
554         !ret && list_iter != m_multi_touch_seq.end();std::advance(list_iter, 1)) {
555             if (index == order) {
556                 MultiTouchContext *multi_touch_context = find_multi_touch_context(*list_iter);
557                 if (multi_touch_context) {
558                     const SclLayoutKeyCoordinate *coordinate =
559                         cache->get_cur_layout_key_coordinate(multi_touch_context->cur_pressed_window,
560                             multi_touch_context->cur_pressed_key);
561
562                     if (coordinate) {
563                         SCLShiftState shift_index = get_shift_state();
564                         if (shift_index >= SCL_SHIFT_STATE_MAX) shift_index = SCL_SHIFT_STATE_OFF;
565                         desc->key_event = coordinate->key_event[shift_index][0];
566                         desc->key_value = coordinate->key_value[shift_index][0];
567                         desc->key_type = coordinate->key_type;
568                     } else {
569                         desc->key_event = 0;
570                         desc->key_value = NULL;
571                         desc->key_type = KEY_TYPE_NONE;
572                     }
573                     desc->key_modifier = multi_touch_context->cur_key_modifier;
574
575                     desc->touch_id = (*list_iter);
576                     desc->mouse_pressed_point = multi_touch_context->cur_pressed_point;
577                     desc->mouse_current_point = multi_touch_context->cur_moving_point;
578                     desc->mouse_farthest_point = multi_touch_context->farthest_move_point;
579
580                     desc->touch_event_order = index;
581
582                     desc->event_type = EVENT_TYPE_NONE;
583
584                     ret = TRUE;
585                 }
586             }
587             index++;
588     }
589
590     return ret;
591 }
592
593 sclint
594 CSCLContext::get_multi_touch_event_order(scltouchdevice touch_id)
595 {
596     sclint ret = -1;
597     sclint iSeqIndex = 0;
598
599     for (std::list<scltouchdevice>::iterator list_iter = m_multi_touch_seq.begin();
600         (ret == -1) && list_iter != m_multi_touch_seq.end();std::advance(list_iter, 1)) {
601             if (touch_id == (*list_iter)) {
602                 ret = iSeqIndex;
603             } else {
604                 iSeqIndex++;
605             }
606     }
607
608     return ret;
609 }
610
611 sclchar* CSCLContext::get_cur_sublayout()
612 {
613     return m_cur_sub_layout;
614 }
615
616 sclboolean CSCLContext::set_cur_sublayout(const sclchar* sublayout)
617 {
618     sclboolean ret = FALSE;
619     if (sublayout) {
620         strncpy(m_cur_sub_layout, sublayout, MAX_SIZE_OF_SUBLAYOUT_STRING);
621         m_cur_sub_layout[MAX_SIZE_OF_SUBLAYOUT_STRING - 1] = '\0';
622     } else {
623         m_cur_sub_layout[0] = '\0';
624     }
625     return ret;
626 }
627
628 void
629 CSCLContext::set_custom_magnifier_label(scltouchdevice touch_id, sclint index, const sclchar* label)
630 {
631     if (scl_check_arrindex(index, MAX_SIZE_OF_LABEL_FOR_ONE)) {
632         MagnifierCustomLabelIdx label_index;
633         label_index.touch_id = touch_id;
634         label_index.index = index;
635         if (label) {
636             m_custom_magnifier_label[label_index] = std::string(label);
637         } else {
638             MagnifierCustomLabelIdxMap::iterator iter = m_custom_magnifier_label.find(label_index);
639             if (iter != m_custom_magnifier_label.end()) {
640                 m_custom_magnifier_label.erase(iter);
641             }
642         }
643     }
644 }
645
646 const sclchar*
647 CSCLContext::get_custom_magnifier_label(scltouchdevice touch_id, sclint index)
648 {
649     MagnifierCustomLabelIdx label_index;
650     label_index.touch_id = touch_id;
651     label_index.index = index;
652
653     const sclchar* ret = NULL;
654
655     if (scl_check_arrindex(index, MAX_SIZE_OF_LABEL_FOR_ONE)) {
656         MagnifierCustomLabelIdxMap::iterator iter = m_custom_magnifier_label.find(label_index);
657         if (iter != m_custom_magnifier_label.end()) {
658             ret = (iter->second).c_str();
659         }
660     }
661
662     return ret;
663 }
664
665 SCLShiftState CSCLContext::get_shift_state() const
666 {
667     SCLShiftState ret = SCL_SHIFT_STATE_OFF;
668     if (m_shift_state < SCL_SHIFT_STATE_MAX) {
669         ret = m_shift_state;
670     }
671     return ret;
672 }
673
674 void CSCLContext::set_shift_state(SCLShiftState val)
675 {
676     if (val < SCL_SHIFT_STATE_MAX) {
677         m_shift_state = val;
678         if (val == SCL_SHIFT_STATE_OFF) {
679             m_shift_multi_touch_state = SCL_SHIFT_MULTITOUCH_OFF;
680         } else if (val == SCL_SHIFT_STATE_ON) {
681             m_shift_multi_touch_state = SCL_SHIFT_MULTITOUCH_ON_RELEASED;
682         } else if (val == SCL_SHIFT_STATE_LOCK) {
683             m_shift_multi_touch_state = SCL_SHIFT_MULTITOUCH_LOCK;
684         }
685     }
686 }
687
688 sclboolean CSCLContext::get_caps_lock_mode() const
689 {
690     return m_caps_lock_mode;
691 }
692
693 void CSCLContext::set_caps_lock_mode(sclboolean val)
694 {
695     m_caps_lock_mode = val;
696 }
697
698 SCLShiftMultitouchState CSCLContext::get_shift_multi_touch_state() const
699 {
700     SCLShiftMultitouchState ret = SCL_SHIFT_MULTITOUCH_OFF;
701     if (m_shift_multi_touch_state < SCL_SHIFT_MULTITOUCH_MAX) {
702         ret = m_shift_multi_touch_state;
703     }
704     return ret;
705 }
706
707 void CSCLContext::set_shift_multi_touch_state(SCLShiftMultitouchState val)
708 {
709     if (val < SCL_SHIFT_MULTITOUCH_MAX) {
710         m_shift_multi_touch_state = val;
711     }
712 }