Keyboard settings Blank screen issue fixed
[framework/uifw/ise-default.git] / mcf / mcferroradjustment.cpp
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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 "mcferroradjustment.h"
22 #include "mcfdebug.h"
23 #include "mcfresourcecache.h"
24 #include "mcfutils.h"
25
26 #define OFFSET_MAX                      10
27 #define TWO                             2
28
29 using namespace mcf;
30 CMCFErrorAdjustment* CMCFErrorAdjustment::sInstance; /* For singleton */
31
32 CMCFErrorAdjustment* CMCFErrorAdjustment::get_instance()
33 {
34     if (!sInstance) {
35         sInstance = new CMCFErrorAdjustment();
36     }
37     return (CMCFErrorAdjustment*)sInstance;
38 }
39
40 CMCFErrorAdjustment::CMCFErrorAdjustment()
41 {
42     MCF_DEBUG();
43 }
44
45 CMCFErrorAdjustment::~CMCFErrorAdjustment()
46 {
47     MCF_DEBUG();
48 }
49
50 mcfboolean
51 CMCFErrorAdjustment::apply_touch_offset(MCFTouchOffsetLevel level, mcfint *x, mcfint *y)
52 {
53     MCF_DEBUG();
54     CMCFEvents* events = CMCFEvents::get_instance();
55     CMCFUtils *utils = CMCFUtils::get_instance();
56     McfPoint *pos;
57     pos = events->get_touch_event_offset();
58     if(level == TOUCH_OFFSET_LEVEL_1 ){
59         *x = *x + utils->get_scale_x(pos->x);
60     } else if(level == TOUCH_OFFSET_LEVEL_2) {
61         *x = *x + utils->get_scale_x(pos->x);
62     }   
63     *y = *y + utils->get_scale_y(pos->y);
64     return TRUE;
65 }
66
67