summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp')
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp73
1 files changed, 39 insertions, 34 deletions
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index 3af481b991..79ff74b113 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -1,31 +1,37 @@
/***************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -379,7 +385,7 @@ static int32_t ic_perform_editor_action(input_session_t *ic, int32_t editor_acti
Q_UNUSED(ic);
Q_UNUSED(editor_action);
- qCritical() << "ic_perform_editor_action not implemented";
+ qCritical("ic_perform_editor_action not implemented");
return 0;
}
@@ -389,7 +395,7 @@ static int32_t ic_report_fullscreen_mode(input_session_t *ic, int32_t enabled)
Q_UNUSED(ic);
Q_UNUSED(enabled);
- qCritical() << "ic_report_fullscreen_mode not implemented";
+ qCritical("ic_report_fullscreen_mode not implemented");
return 0;
}
@@ -400,7 +406,7 @@ static extracted_text_t *ic_get_extracted_text(input_session_t *ic, extracted_te
Q_UNUSED(request);
Q_UNUSED(flags);
- qCritical() << "ic_get_extracted_text not implemented";
+ qCritical("ic_get_extracted_text not implemented");
return 0;
}
@@ -410,7 +416,7 @@ static spannable_string_t *ic_get_selected_text(input_session_t *ic, int32_t fla
Q_UNUSED(ic);
Q_UNUSED(flags);
- qCritical() << "ic_get_selected_text not implemented";
+ qCritical("ic_get_selected_text not implemented");
return 0;
}
@@ -420,7 +426,7 @@ static int32_t ic_get_cursor_caps_mode(input_session_t *ic, int32_t req_modes)
Q_UNUSED(ic);
Q_UNUSED(req_modes);
- qCritical() << "ic_get_cursor_caps_mode not implemented";
+ qCritical("ic_get_cursor_caps_mode not implemented");
return 0;
}
@@ -430,7 +436,7 @@ static int32_t ic_clear_meta_key_states(input_session_t *ic, int32_t states)
Q_UNUSED(ic);
Q_UNUSED(states);
- qCritical() << "ic_clear_meta_key_states not implemented";
+ qCritical("ic_clear_meta_key_states not implemented");
return 0;
}
@@ -441,7 +447,7 @@ static int32_t ic_set_selection(input_session_t *ic, int32_t start, int32_t end)
Q_UNUSED(start);
Q_UNUSED(end);
- qCritical() << "ic_set_selection not implemented";
+ qCritical("ic_set_selection not implemented");
return 0;
}
@@ -530,29 +536,28 @@ static bool imfAvailable()
if ( p_imf_client_init == 0 ) {
void *handle = dlopen("libinput_client.so.1", 0);
- if ( handle ) {
- p_imf_client_init = (int32_t (*)()) dlsym(handle, "imf_client_init");
- p_imf_client_disconnect = (void (*)()) dlsym(handle, "imf_client_disconnect");
- p_ictrl_open_session = (const input_session_t *(*)(connection_interface_t *))dlsym(handle, "ictrl_open_session");
- p_ictrl_close_session = (void (*)(input_session_t *))dlsym(handle, "ictrl_close_session");
- p_ictrl_dispatch_event = (int32_t (*)(event_t *))dlsym(handle, "ictrl_dispatch_event");
- p_vkb_init_selection_service = (int32_t (*)())dlsym(handle, "vkb_init_selection_service");
- p_ictrl_get_num_active_sessions = (int32_t (*)())dlsym(handle, "ictrl_get_num_active_sessions");
- } else {
+ if (Q_UNLIKELY(!handle)) {
qCritical("libinput_client.so.1 is not present - IMF services are disabled.");
s_imfDisabled = true;
return false;
}
-
- if ( p_imf_client_init && p_ictrl_open_session && p_ictrl_dispatch_event ) {
- s_imfReady = true;
- } else {
+ p_imf_client_init = (int32_t (*)()) dlsym(handle, "imf_client_init");
+ p_imf_client_disconnect = (void (*)()) dlsym(handle, "imf_client_disconnect");
+ p_ictrl_open_session = (const input_session_t *(*)(connection_interface_t *))dlsym(handle, "ictrl_open_session");
+ p_ictrl_close_session = (void (*)(input_session_t *))dlsym(handle, "ictrl_close_session");
+ p_ictrl_dispatch_event = (int32_t (*)(event_t *))dlsym(handle, "ictrl_dispatch_event");
+ p_vkb_init_selection_service = (int32_t (*)())dlsym(handle, "vkb_init_selection_service");
+ p_ictrl_get_num_active_sessions = (int32_t (*)())dlsym(handle, "ictrl_get_num_active_sessions");
+
+ if (Q_UNLIKELY(!p_imf_client_init || !p_ictrl_open_session || !p_ictrl_dispatch_event)) {
p_ictrl_open_session = 0;
p_ictrl_dispatch_event = 0;
s_imfDisabled = true;
qCritical("libinput_client.so.1 did not contain the correct symbols, library mismatch? IMF services are disabled.");
return false;
}
+
+ s_imfReady = true;
}
return s_imfReady;
@@ -581,7 +586,7 @@ QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVir
Q_ASSERT(sInputContextInstance == 0);
sInputContextInstance = this;
- if (p_imf_client_init() != 0) {
+ if (Q_UNLIKELY(p_imf_client_init() != 0)) {
s_imfInitFailed = true;
qCritical("imf_client_init failed - IMF services will be unavailable");
}