noinst_HEADERS = isf_panel_utility.h \
remote_input.h \
remote_input_keycode.h \
- websocketserver.h
+ websocketserver.h \
+ isf_cpu_boosting.h
if ISF_BUILD_PANEL_EFL
CONFIG_SCIM_PANEL_EFL = isf
isf_SOURCES = isf_panel_efl.cpp \
isf_panel_utility.cpp \
- ../../src/tizen_profile.cpp
+ ../../src/tizen_profile.cpp \
+ isf_cpu_boosting.cpp
if ISF_BUILD_REMOTE_INPUT
isf_SOURCES += remote_input.cpp
--- /dev/null
+/*
+ * ISF(Input Service Framework)
+ *
+ * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Contact: Jihoon Kim <jihoon48.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#define Uses_SCIM_CONFIG_PATH
+
+#include <isf_cpu_boosting.h>
+#include <unistd.h>
+#include <dlog.h>
+#include <cpu-boosting.h>
+
+#include "scim.h"
+#include "isf_debug.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_CPU_BOOSTING"
+
+using namespace scim;
+
+CpuBooster* CpuBooster::m_instance = NULL;
+static resource_pid_t resource_st = {0,};
+static String destination = String ("");
+
+CpuBooster::CpuBooster()
+{
+ m_instance = this;
+ resource_st.pid = getpid();
+ destination = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_PANEL_PROGRAM), String (""));
+
+ int ret = resource_register_cpu_inheritance_destination(destination.c_str(), resource_st);
+ if (ret != 0)
+ LOGE("Failed to register cpu inheritance. ret : %d", ret);
+}
+
+CpuBooster::~CpuBooster()
+{
+ if (m_instance == this) {
+ m_instance = NULL;
+ }
+
+ int ret = resource_unregister_cpu_inheritance_destination(destination.c_str());
+ if (ret != 0)
+ LOGE("Failed to unregister cpu inheritance. ret : %d", ret);
+}
+
+CpuBooster*
+CpuBooster::get_instance()
+{
+ return m_instance;
+}
+
+void
+CpuBooster::set_cpu_boosting()
+{
+ int ret = resource_set_cpu_boosting(resource_st, CPU_BOOSTING_LEVEL_STRONG, CPU_BOOSTING_RESET_ON_FORK, -1);
+ if (ret != 0)
+ LOGE("Failed to set cpu boosting");
+}
+
+void
+CpuBooster::clear_cpu_boosting()
+{
+ int ret = resource_clear_cpu_boosting(resource_st);
+ if (ret != 0)
+ LOGE("Failed to clear cpu boosting");
+}
--- /dev/null
+/*
+ * ISF(Input Service Framework)
+ *
+ * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Contact: Jihoon Kim <jihoon48.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __ISF_CPU_BOOSTING_H__
+#define __ISF_CPU_BOOSTING_H__
+
+class CpuBooster
+{
+private:
+ static CpuBooster* m_instance;
+
+public:
+ CpuBooster();
+ ~CpuBooster();
+
+ static CpuBooster* get_instance();
+
+ void set_cpu_boosting();
+ void clear_cpu_boosting();
+};
+
+#endif /* __ISF_CPU_BOOSTING_H__ */
#include <glib.h>
#include <tzplatform_config.h>
#include <system_info.h>
-#include <cpu-boosting.h>
#include "scim_private.h"
#include "scim.h"
#include "privilege_checker.h"
#include "remote_input.h"
#include "tizen_profile.h"
+#include "isf_cpu_boosting.h"
using namespace scim;
static void set_language_and_locale (const char *lang_str);
static bool app_control_launch (const char *app_id);
static void terminate_active_ise (const String uuid);
-static void set_cpu_boosting (void);
-static void clear_cpu_boosting (void);
/////////////////////////////////////////////////////////////////////////////
// Declaration of internal variables.
}
}
-static void set_cpu_boosting ()
-{
- resource_pid_t resource_st = {0,};
- resource_st.pid = getpid();
- int ret = resource_set_cpu_boosting(resource_st, CPU_BOOSTING_LEVEL_STRONG, CPU_BOOSTING_RESET_ON_FORK, -1);
- if (ret != 0)
- LOGE("Failed to set cpu boosting");
-}
-
-static void clear_cpu_boosting ()
-{
- resource_pid_t resource_st = {0,};
- resource_st.pid = getpid();
- int ret = resource_clear_cpu_boosting(resource_st);
- if (ret != 0)
- LOGE("Failed to clear cpu boosting");
-}
-
static void slot_run_helper (const String &uuid, const String &config, const String &display)
{
ISF_SAVE_LOG ("time:%ld pid:%d %s %s uuid(%s)",
bool user_data_path_exists = false;
bool user_data_path_is_dir = false;
+ CpuBooster *booster = NULL;
+
#ifdef HAVE_ECOREX
Ecore_Event_Handler *xclient_message_handler = NULL;
Ecore_Event_Handler *xwindow_property_handler = NULL;
ConfigBase::set (_config);
check_time ("create config instance");
- set_cpu_boosting();
+ booster = new CpuBooster();
+ if (booster)
+ booster->set_cpu_boosting();
try {
if (!initialize_panel_agent (_config, display_name, should_resident)) {
if (!isf_cynara_initialize())
LOGW ("Failed to initialize cynara");
- clear_cpu_boosting();
+ if (booster)
+ booster->clear_cpu_boosting();
#if ISF_BUILD_CANDIDATE_UI
elm_run ();
#endif
delete_ise_check_pid_alive_timer();
+ if (booster)
+ delete booster;
+
if (_info_manager) {
try {
_info_manager->stop ();
@DLOG_CFLAGS@ \
@VCONF_CFLAGS@ \
@APP_COMMON_CFLAGS@ \
- @APP_PREFERENCE_CFLAGS@
+ @APP_PREFERENCE_CFLAGS@ \
+ @SYSTEM_RESOURCE_CFLAGS@
module_la_LDFLAGS = -rpath $(moduledir) \
-avoid-version \
@VCONF_LIBS@ \
@APP_COMMON_LIBS@ \
@APP_PREFERENCE_LIBS@ \
+ @SYSTEM_RESOURCE_LIBS@ \
$(top_builddir)/ism/src/libprofile.la
#include <xkbcommon/xkbcommon.h>
#include <ctype.h>
#include <app_preference.h>
+#include <cpu-boosting.h>
#include "isf_debug.h"
#include "wayland_imcontext.h"
#define PREFERENCE_APP_GRAB_BACK_KEY "app/grab/back_key"
#define SOCK_PATH "/run/.isf/scim-panel-socket"
+#define DEFAULT_PANEL_NAME "isf"
typedef enum {
INPUT_LANG_URDU,
return EINA_TRUE;
}
+static void
+_set_cpu_inheritance()
+{
+ int ret = resource_set_cpu_inheritance(gettid(), DEFAULT_PANEL_NAME, -1);
+ if (ret != 0)
+ LOGE("Failed to set cpu inheritance. ret : %d", ret);
+}
+
+static void
+_clear_cpu_inheritance()
+{
+ int ret = resource_clear_cpu_inheritance(gettid(), DEFAULT_PANEL_NAME);
+ if (ret != 0)
+ LOGE("Failed to clear cpu inheritance. ret : %d", ret);
+}
+
void
wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
{
+ _set_cpu_inheritance();
+
LOGD ("ctx : %p. enable : %d, on demand : %d", ctx,
ecore_imf_context_input_panel_enabled_get(ctx),
ecore_imf_context_input_panel_show_on_demand_get (ctx));
}
}
LOGW("ctx : %p. Fail to set focus!", ctx);
+ _clear_cpu_inheritance();
return;
}
}
set_focus_out(ctx);
+ _clear_cpu_inheritance();
}
void