4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <appfw/app.h>
32 #include <runtime_info.h>
42 static int external_angle = 0;
43 static int internal_angle = 0;
45 // ===================================================================
46 // orientation related functions
47 // ===================================================================
49 static int convert_angle(int angle)
59 os = _OS_LANDSCAPE_REVERSE;
62 os = _OS_PORTRAIT_REVERSE;
74 void on_orientation_changed(int angle, bool capi)
76 DECLARE_COMMON_VARIABLE;
77 bool autoRotation = true;
81 internal_angle = angle;
82 runtime_info_get_value_bool(
83 RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED, &autoRotation);
85 if(autoRotation) // rotation is not locked
87 external_angle = internal_angle;
89 if(isOptionEnabled(OPT_EVENT))
91 setProbePoint(&probeInfo);
93 APPEND_LOG_BASIC_NAME(LC_UIEVENT, "OrientationChanged");
94 APPEND_LOG_COMMON_NONE(0);
95 log.length += sprintf(log.data + log.length, "`,%d`,`,`,`,%d`,",
96 _EVENT_ORIENTATION, convert_angle(external_angle));
97 printLog(&log, MSG_LOG);
103 // SCREENSHOT_DONE();
106 else { } // do nothing
113 return external_angle;
116 // ====================================================================
117 // initialize and finalize event
118 // ====================================================================
120 int initialize_event()
122 external_angle = internal_angle = app_get_device_orientation();