|
Packit |
3ff832 |
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
|
Packit |
3ff832 |
/* vim:set et sts=4: */
|
|
Packit |
3ff832 |
/* ibus - The Input Bus
|
|
Packit |
3ff832 |
* Copyright (C) 2008-2014 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit |
3ff832 |
* Copyright (C) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
Packit |
3ff832 |
* Copyright (C) 2008-2016 Red Hat, Inc.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
3ff832 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
3ff832 |
* License as published by the Free Software Foundation; either
|
|
Packit |
3ff832 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
3ff832 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
3ff832 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
3ff832 |
* Lesser General Public License for more details.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
3ff832 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
3ff832 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit |
3ff832 |
* USA
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
#include "inputcontext.h"
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#include <string.h>
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#include "engineproxy.h"
|
|
Packit |
3ff832 |
#include "factoryproxy.h"
|
|
Packit |
3ff832 |
#include "global.h"
|
|
Packit |
3ff832 |
#include "ibusimpl.h"
|
|
Packit |
3ff832 |
#include "marshalers.h"
|
|
Packit |
3ff832 |
#include "types.h"
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
struct _SetEngineByDescData {
|
|
Packit |
3ff832 |
/* context related to the data */
|
|
Packit |
3ff832 |
BusInputContext *context;
|
|
Packit |
3ff832 |
/* set engine by desc result, cancellable */
|
|
Packit |
3ff832 |
GTask *task;
|
|
Packit |
3ff832 |
/* a object to cancel bus_engine_proxy_new call */
|
|
Packit |
3ff832 |
GCancellable *cancellable;
|
|
Packit |
3ff832 |
/* a object being passed to the bus_input_context_set_engine_by_desc function. if origin_cancellable is cancelled by someone,
|
|
Packit |
3ff832 |
* we cancel the cancellable above as well. */
|
|
Packit |
3ff832 |
GCancellable *origin_cancellable;
|
|
Packit |
3ff832 |
gulong cancelled_handler_id;
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
typedef struct _SetEngineByDescData SetEngineByDescData;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
struct _BusInputContext {
|
|
Packit |
3ff832 |
IBusService parent;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* instance members */
|
|
Packit |
3ff832 |
BusConnection *connection;
|
|
Packit |
3ff832 |
BusEngineProxy *engine;
|
|
Packit |
3ff832 |
gchar *client;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
gboolean has_focus;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* client capabilities */
|
|
Packit |
3ff832 |
guint capabilities;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* cursor location */
|
|
Packit |
3ff832 |
gint x;
|
|
Packit |
3ff832 |
gint y;
|
|
Packit |
3ff832 |
gint w;
|
|
Packit |
3ff832 |
gint h;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* prev key event that are used for handling hot-keys */
|
|
Packit |
3ff832 |
guint prev_keyval;
|
|
Packit |
3ff832 |
guint prev_modifiers;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* preedit text */
|
|
Packit |
3ff832 |
IBusText *preedit_text;
|
|
Packit |
3ff832 |
guint preedit_cursor_pos;
|
|
Packit |
3ff832 |
gboolean preedit_visible;
|
|
Packit |
3ff832 |
guint preedit_mode;
|
|
rpm-build |
f2146a |
gboolean client_commit_preedit;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* auxiliary text */
|
|
Packit |
3ff832 |
IBusText *auxiliary_text;
|
|
Packit |
3ff832 |
gboolean auxiliary_visible;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* lookup table */
|
|
Packit |
3ff832 |
IBusLookupTable *lookup_table;
|
|
Packit |
3ff832 |
gboolean lookup_table_visible;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* filter release */
|
|
Packit |
3ff832 |
gboolean filter_release;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* is fake context */
|
|
Packit |
3ff832 |
gboolean fake;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* incompleted set engine by desc request */
|
|
Packit |
3ff832 |
SetEngineByDescData *data;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* content-type (primary purpose and hints) */
|
|
Packit |
3ff832 |
guint purpose;
|
|
Packit |
3ff832 |
guint hints;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
BusPanelProxy *emoji_extension;
|
|
Packit |
3ff832 |
gboolean is_extension_lookup_table;
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
struct _BusInputContextClass {
|
|
Packit |
3ff832 |
IBusServiceClass parent;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* class members */
|
|
Packit |
3ff832 |
IBusEngineDesc *default_engine_desc;
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
enum {
|
|
Packit |
3ff832 |
PROCESS_KEY_EVENT,
|
|
Packit |
3ff832 |
SET_CURSOR_LOCATION,
|
|
Packit |
3ff832 |
SET_CURSOR_LOCATION_RELATIVE,
|
|
Packit |
3ff832 |
FOCUS_IN,
|
|
Packit |
3ff832 |
FOCUS_OUT,
|
|
Packit |
3ff832 |
UPDATE_PREEDIT_TEXT,
|
|
Packit |
3ff832 |
SHOW_PREEDIT_TEXT,
|
|
Packit |
3ff832 |
HIDE_PREEDIT_TEXT,
|
|
Packit |
3ff832 |
UPDATE_AUXILIARY_TEXT,
|
|
Packit |
3ff832 |
SHOW_AUXILIARY_TEXT,
|
|
Packit |
3ff832 |
HIDE_AUXILIARY_TEXT,
|
|
Packit |
3ff832 |
UPDATE_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
SHOW_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
HIDE_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
PAGE_UP_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
PAGE_DOWN_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
CURSOR_UP_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
CURSOR_DOWN_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
REGISTER_PROPERTIES,
|
|
Packit |
3ff832 |
UPDATE_PROPERTY,
|
|
Packit |
3ff832 |
ENGINE_CHANGED,
|
|
Packit |
3ff832 |
REQUEST_ENGINE,
|
|
Packit |
3ff832 |
SET_CONTENT_TYPE,
|
|
Packit |
3ff832 |
PANEL_EXTENSION,
|
|
Packit |
3ff832 |
LAST_SIGNAL,
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
enum {
|
|
Packit |
3ff832 |
PROP_0,
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
typedef struct _BusInputContextPrivate BusInputContextPrivate;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static guint context_signals[LAST_SIGNAL] = { 0 };
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* functions prototype */
|
|
Packit |
3ff832 |
static void bus_input_context_destroy
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_service_method_call
|
|
Packit |
3ff832 |
(IBusService *service,
|
|
Packit |
3ff832 |
GDBusConnection *connection,
|
|
Packit |
3ff832 |
const gchar *sender,
|
|
Packit |
3ff832 |
const gchar *object_path,
|
|
Packit |
3ff832 |
const gchar *interface_name,
|
|
Packit |
3ff832 |
const gchar *method_name,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation);
|
|
Packit |
3ff832 |
static gboolean bus_input_context_service_set_property
|
|
Packit |
3ff832 |
(IBusService *service,
|
|
Packit |
3ff832 |
GDBusConnection *connection,
|
|
Packit |
3ff832 |
const gchar *sender,
|
|
Packit |
3ff832 |
const gchar *object_path,
|
|
Packit |
3ff832 |
const gchar *interface_name,
|
|
Packit |
3ff832 |
const gchar *property_name,
|
|
Packit |
3ff832 |
GVariant *value,
|
|
Packit |
3ff832 |
GError **error);
|
|
Packit |
3ff832 |
static void bus_input_context_unset_engine
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_show_preedit_text
|
|
Packit |
3ff832 |
(BusInputContext *context,
|
|
Packit |
3ff832 |
gboolean is_extension);
|
|
Packit |
3ff832 |
static void bus_input_context_hide_preedit_text
|
|
Packit |
3ff832 |
(BusInputContext *context,
|
|
Packit |
3ff832 |
gboolean is_extension);
|
|
Packit |
3ff832 |
static void bus_input_context_update_auxiliary_text
|
|
Packit |
3ff832 |
(BusInputContext *context,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
gboolean visible);
|
|
Packit |
3ff832 |
static void bus_input_context_show_auxiliary_text
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_hide_auxiliary_text
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_show_lookup_table
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_hide_lookup_table
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_page_up_lookup_table
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_page_down_lookup_table
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_cursor_up_lookup_table
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_cursor_down_lookup_table
|
|
Packit |
3ff832 |
(BusInputContext *context);
|
|
Packit |
3ff832 |
static void bus_input_context_register_properties
|
|
Packit |
3ff832 |
(BusInputContext *context,
|
|
Packit |
3ff832 |
IBusPropList *props);
|
|
Packit |
3ff832 |
static void bus_input_context_update_property
|
|
Packit |
3ff832 |
(BusInputContext *context,
|
|
Packit |
3ff832 |
IBusProperty *prop);
|
|
Packit |
3ff832 |
static void _engine_destroy_cb (BusEngineProxy *factory,
|
|
Packit |
3ff832 |
BusInputContext *context);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static IBusText *text_empty = NULL;
|
|
Packit |
3ff832 |
static IBusLookupTable *lookup_table_empty = NULL;
|
|
Packit |
3ff832 |
static IBusPropList *props_empty = NULL;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* The interfaces available in this class, which consists of a list of
|
|
Packit |
3ff832 |
* methods this class implements and a list of signals this class may
|
|
Packit |
3ff832 |
* emit. Method calls to the interface that are not defined in this
|
|
Packit |
3ff832 |
* XML will be automatically rejected by the GDBus library (see
|
|
Packit |
3ff832 |
* src/ibusservice.c for details.) */
|
|
Packit |
3ff832 |
static const gchar introspection_xml[] =
|
|
Packit |
3ff832 |
"<node>"
|
|
Packit |
3ff832 |
" <interface name='org.freedesktop.IBus.InputContext'>"
|
|
rpm-build |
f2146a |
/* properties */
|
|
rpm-build |
f2146a |
" <property name='ContentType' type='(uu)' access='write' />"
|
|
rpm-build |
f2146a |
" <property name='ClientCommitPreedit' type='(b)' access='write' />\n"
|
|
Packit |
3ff832 |
/* methods */
|
|
Packit |
3ff832 |
" <method name='ProcessKeyEvent'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='keyval' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='keycode' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='state' />"
|
|
Packit |
3ff832 |
" <arg direction='out' type='b' name='handled' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='SetCursorLocation'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='x' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='y' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='w' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='h' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='SetCursorLocationRelative'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='x' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='y' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='w' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='i' name='h' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='ProcessHandWritingEvent'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='ad' name='coordinates' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='CancelHandWriting'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='n_strokes' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='FocusIn' />"
|
|
Packit |
3ff832 |
" <method name='FocusOut' />"
|
|
Packit |
3ff832 |
" <method name='Reset' />"
|
|
Packit |
3ff832 |
" <method name='SetCapabilities'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='caps' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='PropertyActivate'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='s' name='name' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='state' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='SetEngine'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='s' name='name' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='GetEngine'>"
|
|
Packit |
3ff832 |
" <arg direction='out' type='v' name='desc' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
" <method name='SetSurroundingText'>"
|
|
Packit |
3ff832 |
" <arg direction='in' type='v' name='text' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='cursor_pos' />"
|
|
Packit |
3ff832 |
" <arg direction='in' type='u' name='anchor_pos' />"
|
|
Packit |
3ff832 |
" </method>"
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* signals */
|
|
Packit |
3ff832 |
" <signal name='CommitText'>"
|
|
Packit |
3ff832 |
" <arg type='v' name='text' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
Packit |
3ff832 |
" <signal name='ForwardKeyEvent'>"
|
|
Packit |
3ff832 |
" <arg type='u' name='keyval' />"
|
|
Packit |
3ff832 |
" <arg type='u' name='keycode' />"
|
|
Packit |
3ff832 |
" <arg type='u' name='state' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
Packit |
3ff832 |
" <signal name='UpdatePreeditText'>"
|
|
Packit |
3ff832 |
" <arg type='v' name='text' />"
|
|
Packit |
3ff832 |
" <arg type='u' name='cursor_pos' />"
|
|
Packit |
3ff832 |
" <arg type='b' name='visible' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
rpm-build |
f2146a |
" <signal name='UpdatePreeditTextWithMode'>"
|
|
rpm-build |
f2146a |
" <arg type='v' name='text' />"
|
|
rpm-build |
f2146a |
" <arg type='u' name='cursor_pos' />"
|
|
rpm-build |
f2146a |
" <arg type='b' name='visible' />"
|
|
rpm-build |
f2146a |
" <arg type='u' name='mode' />"
|
|
rpm-build |
f2146a |
" </signal>"
|
|
Packit |
3ff832 |
" <signal name='ShowPreeditText'/>"
|
|
Packit |
3ff832 |
" <signal name='HidePreeditText'/>"
|
|
Packit |
3ff832 |
" <signal name='UpdateAuxiliaryText'>"
|
|
Packit |
3ff832 |
" <arg type='v' name='text' />"
|
|
Packit |
3ff832 |
" <arg type='b' name='visible' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
Packit |
3ff832 |
" <signal name='ShowAuxiliaryText'/>"
|
|
Packit |
3ff832 |
" <signal name='HideAuxiliaryText'/>"
|
|
Packit |
3ff832 |
" <signal name='UpdateLookupTable'>"
|
|
Packit |
3ff832 |
" <arg type='v' name='table' />"
|
|
Packit |
3ff832 |
" <arg type='b' name='visible' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
Packit |
3ff832 |
" <signal name='ShowLookupTable'/>"
|
|
Packit |
3ff832 |
" <signal name='HideLookupTable'/>"
|
|
Packit |
3ff832 |
" <signal name='PageUpLookupTable'/>"
|
|
Packit |
3ff832 |
" <signal name='PageDownLookupTable'/>"
|
|
Packit |
3ff832 |
" <signal name='CursorUpLookupTable'/>"
|
|
Packit |
3ff832 |
" <signal name='CursorDownLookupTable'/>"
|
|
Packit |
3ff832 |
" <signal name='RegisterProperties'>"
|
|
Packit |
3ff832 |
" <arg type='v' name='props' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
Packit |
3ff832 |
" <signal name='UpdateProperty'>"
|
|
Packit |
3ff832 |
" <arg type='v' name='prop' />"
|
|
Packit |
3ff832 |
" </signal>"
|
|
Packit |
3ff832 |
" </interface>"
|
|
Packit |
3ff832 |
"</node>";
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
G_DEFINE_TYPE (BusInputContext, bus_input_context, IBUS_TYPE_SERVICE)
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* TRUE if we can send preedit text to client. FALSE if the panel has to handle it. Note that we check IBUS_CAP_FOCUS here since
|
|
Packit |
3ff832 |
* when the capability is not set, the client has to handle a preedit text regardless of the embed_preedit_text config. */
|
|
Packit |
3ff832 |
#define PREEDIT_CONDITION \
|
|
Packit |
3ff832 |
((context->capabilities & IBUS_CAP_PREEDIT_TEXT) && \
|
|
Packit |
3ff832 |
(bus_ibus_impl_is_embed_preedit_text (BUS_DEFAULT_IBUS) || (context->capabilities & IBUS_CAP_FOCUS) == 0))
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_connection_destroy_cb (BusConnection *connection,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_CONNECTION (connection));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
ibus_object_destroy (IBUS_OBJECT (context));
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_class_init (BusInputContextClass *class)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
class->default_engine_desc = ibus_engine_desc_new ("dummy",
|
|
Packit |
3ff832 |
"",
|
|
Packit |
3ff832 |
"",
|
|
Packit |
3ff832 |
"",
|
|
Packit |
3ff832 |
"",
|
|
Packit |
3ff832 |
"",
|
|
Packit |
3ff832 |
"ibus-engine",
|
|
Packit |
3ff832 |
"");
|
|
Packit |
3ff832 |
g_object_ref_sink (class->default_engine_desc);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
ibus_object_class->destroy = (IBusObjectDestroyFunc) bus_input_context_destroy;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* override the parent class's implementation. */
|
|
Packit |
3ff832 |
IBUS_SERVICE_CLASS (class)->service_method_call =
|
|
Packit |
3ff832 |
bus_input_context_service_method_call;
|
|
Packit |
3ff832 |
IBUS_SERVICE_CLASS (class)->service_set_property =
|
|
Packit |
3ff832 |
bus_input_context_service_set_property;
|
|
Packit |
3ff832 |
/* register the xml so that bus_ibus_impl_service_method_call will be called on a method call defined in the xml (e.g. 'FocusIn'.) */
|
|
Packit |
3ff832 |
ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* install glib signals that would be handled by other classes like ibusimpl.c and panelproxy.c. */
|
|
Packit |
3ff832 |
context_signals[PROCESS_KEY_EVENT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("process-key-event"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_BOOLEAN__UINT_UINT_UINT,
|
|
Packit |
3ff832 |
G_TYPE_BOOLEAN,
|
|
Packit |
3ff832 |
3,
|
|
Packit |
3ff832 |
G_TYPE_UINT,
|
|
Packit |
3ff832 |
G_TYPE_UINT,
|
|
Packit |
3ff832 |
G_TYPE_UINT);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[SET_CURSOR_LOCATION] =
|
|
Packit |
3ff832 |
g_signal_new (I_("set-cursor-location"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__INT_INT_INT_INT,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
4,
|
|
Packit |
3ff832 |
G_TYPE_INT,
|
|
Packit |
3ff832 |
G_TYPE_INT,
|
|
Packit |
3ff832 |
G_TYPE_INT,
|
|
Packit |
3ff832 |
G_TYPE_INT);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[SET_CURSOR_LOCATION_RELATIVE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("set-cursor-location-relative"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__INT_INT_INT_INT,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
4,
|
|
Packit |
3ff832 |
G_TYPE_INT,
|
|
Packit |
3ff832 |
G_TYPE_INT,
|
|
Packit |
3ff832 |
G_TYPE_INT,
|
|
Packit |
3ff832 |
G_TYPE_INT);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[FOCUS_IN] =
|
|
Packit |
3ff832 |
g_signal_new (I_("focus-in"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[FOCUS_OUT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("focus-out"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[UPDATE_PREEDIT_TEXT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("update-preedit-text"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__OBJECT_UINT_BOOLEAN,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
3,
|
|
Packit |
3ff832 |
IBUS_TYPE_TEXT,
|
|
Packit |
3ff832 |
G_TYPE_UINT,
|
|
Packit |
3ff832 |
G_TYPE_BOOLEAN);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[SHOW_PREEDIT_TEXT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("show-preedit-text"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[HIDE_PREEDIT_TEXT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("hide-preedit-text"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[UPDATE_AUXILIARY_TEXT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("update-auxiliary-text"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__OBJECT_BOOLEAN,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
2,
|
|
Packit |
3ff832 |
IBUS_TYPE_TEXT,
|
|
Packit |
3ff832 |
G_TYPE_BOOLEAN);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[SHOW_AUXILIARY_TEXT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("show-auxiliary-text"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[HIDE_AUXILIARY_TEXT] =
|
|
Packit |
3ff832 |
g_signal_new (I_("hide-auxiliary-text"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[UPDATE_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("update-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__OBJECT_BOOLEAN,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
2,
|
|
Packit |
3ff832 |
IBUS_TYPE_LOOKUP_TABLE,
|
|
Packit |
3ff832 |
G_TYPE_BOOLEAN);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[SHOW_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("show-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[HIDE_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("hide-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[PAGE_UP_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("page-up-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[PAGE_DOWN_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("page-down-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[CURSOR_UP_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("cursor-up-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[CURSOR_DOWN_LOOKUP_TABLE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("cursor-down-lookup-table"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE, 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[REGISTER_PROPERTIES] =
|
|
Packit |
3ff832 |
g_signal_new (I_("register-properties"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__OBJECT,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
1,
|
|
Packit |
3ff832 |
IBUS_TYPE_PROP_LIST);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[UPDATE_PROPERTY] =
|
|
Packit |
3ff832 |
g_signal_new (I_("update-property"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__OBJECT,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
1,
|
|
Packit |
3ff832 |
IBUS_TYPE_PROPERTY);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[ENGINE_CHANGED] =
|
|
Packit |
3ff832 |
g_signal_new (I_("engine-changed"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__VOID,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* This signal is not for notifying an event on this object, but is for requesting an engine as the name shows.
|
|
Packit |
3ff832 |
* On the signal emission, ibusimpl.c will immediately update the context->engine variable. */
|
|
Packit |
3ff832 |
context_signals[REQUEST_ENGINE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("request-engine"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_OBJECT__STRING,
|
|
Packit |
3ff832 |
IBUS_TYPE_ENGINE_DESC,
|
|
Packit |
3ff832 |
1,
|
|
Packit |
3ff832 |
G_TYPE_STRING);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[SET_CONTENT_TYPE] =
|
|
Packit |
3ff832 |
g_signal_new (I_("set-content-type"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__UINT_UINT,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
2,
|
|
Packit |
3ff832 |
G_TYPE_UINT,
|
|
Packit |
3ff832 |
G_TYPE_UINT);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context_signals[PANEL_EXTENSION] =
|
|
Packit |
3ff832 |
g_signal_new (I_("panel-extension"),
|
|
Packit |
3ff832 |
G_TYPE_FROM_CLASS (class),
|
|
Packit |
3ff832 |
G_SIGNAL_RUN_LAST,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
NULL, NULL,
|
|
Packit |
3ff832 |
bus_marshal_VOID__OBJECT,
|
|
Packit |
3ff832 |
G_TYPE_NONE,
|
|
Packit |
3ff832 |
1,
|
|
Packit |
3ff832 |
IBUS_TYPE_EXTENSION_EVENT);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
text_empty = ibus_text_new_from_string ("");
|
|
Packit |
3ff832 |
g_object_ref_sink (text_empty);
|
|
Packit |
3ff832 |
lookup_table_empty = ibus_lookup_table_new (9 /* page size */, 0, FALSE, FALSE);
|
|
Packit |
3ff832 |
g_object_ref_sink (lookup_table_empty);
|
|
Packit |
3ff832 |
props_empty = ibus_prop_list_new ();
|
|
Packit |
3ff832 |
g_object_ref_sink (props_empty);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_init (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
context->prev_keyval = IBUS_KEY_VoidSymbol;
|
|
Packit |
3ff832 |
g_object_ref_sink (text_empty);
|
|
Packit |
3ff832 |
context->preedit_text = text_empty;
|
|
Packit |
3ff832 |
context->preedit_mode = IBUS_ENGINE_PREEDIT_CLEAR;
|
|
Packit |
3ff832 |
g_object_ref_sink (text_empty);
|
|
Packit |
3ff832 |
context->auxiliary_text = text_empty;
|
|
Packit |
3ff832 |
g_object_ref_sink (lookup_table_empty);
|
|
Packit |
3ff832 |
context->lookup_table = lookup_table_empty;
|
|
Packit |
3ff832 |
/* other member variables will automatically be zero-cleared. */
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_destroy (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->has_focus) {
|
|
Packit |
3ff832 |
bus_input_context_focus_out (context);
|
|
Packit |
3ff832 |
context->has_focus = FALSE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_input_context_unset_engine (context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->preedit_text) {
|
|
Packit |
3ff832 |
g_object_unref (context->preedit_text);
|
|
Packit |
3ff832 |
context->preedit_text = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->auxiliary_text) {
|
|
Packit |
3ff832 |
g_object_unref (context->auxiliary_text);
|
|
Packit |
3ff832 |
context->auxiliary_text = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->lookup_table) {
|
|
Packit |
3ff832 |
g_object_unref (context->lookup_table);
|
|
Packit |
3ff832 |
context->lookup_table = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->connection) {
|
|
Packit |
3ff832 |
g_signal_handlers_disconnect_by_func (context->connection,
|
|
Packit |
3ff832 |
(GCallback) _connection_destroy_cb,
|
|
Packit |
3ff832 |
context);
|
|
Packit |
3ff832 |
g_object_unref (context->connection);
|
|
Packit |
3ff832 |
context->connection = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->client) {
|
|
Packit |
3ff832 |
g_free (context->client);
|
|
Packit |
3ff832 |
context->client = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
IBUS_OBJECT_CLASS (bus_input_context_parent_class)->destroy (IBUS_OBJECT (context));
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static gboolean
|
|
Packit |
3ff832 |
bus_input_context_send_signal (BusInputContext *context,
|
|
Packit |
3ff832 |
const gchar *interface_name,
|
|
Packit |
3ff832 |
const gchar *signal_name,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GError **error)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->connection == NULL) {
|
|
Packit |
3ff832 |
g_variant_unref (parameters);
|
|
Packit |
3ff832 |
return TRUE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
GDBusMessage *message = g_dbus_message_new_signal (ibus_service_get_object_path ((IBusService *)context),
|
|
Packit |
3ff832 |
interface_name,
|
|
Packit |
3ff832 |
signal_name);
|
|
Packit |
3ff832 |
g_dbus_message_set_sender (message, "org.freedesktop.IBus");
|
|
Packit |
3ff832 |
g_dbus_message_set_destination (message, bus_connection_get_unique_name (context->connection));
|
|
Packit |
3ff832 |
if (parameters != NULL)
|
|
Packit |
3ff832 |
g_dbus_message_set_body (message, parameters);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
gboolean retval = g_dbus_connection_send_message (bus_connection_get_dbus_connection (context->connection),
|
|
Packit |
3ff832 |
message,
|
|
Packit |
3ff832 |
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
|
|
Packit |
3ff832 |
NULL, error);
|
|
Packit |
3ff832 |
g_object_unref (message);
|
|
Packit |
3ff832 |
return retval;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_emit_signal:
|
|
Packit |
3ff832 |
* @signal_name: The D-Bus signal name to emit which is in the introspection_xml.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Emit the D-Bus signal.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static gboolean
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (BusInputContext *context,
|
|
Packit |
3ff832 |
const gchar *signal_name,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GError **error)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->connection == NULL) {
|
|
Packit |
3ff832 |
/* fake context has no connections. */
|
|
Packit |
3ff832 |
if (parameters)
|
|
Packit |
3ff832 |
g_variant_unref (parameters);
|
|
Packit |
3ff832 |
return TRUE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
return bus_input_context_send_signal (context,
|
|
Packit |
3ff832 |
"org.freedesktop.IBus.InputContext",
|
|
Packit |
3ff832 |
signal_name,
|
|
Packit |
3ff832 |
parameters,
|
|
Packit |
3ff832 |
error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_property_changed:
|
|
Packit |
3ff832 |
* @context: a #BusInputContext
|
|
Packit |
3ff832 |
* @property_name: The D-Bus property name which has changed
|
|
Packit |
3ff832 |
* @value: The new value of the property
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Emit the D-Bus "PropertiesChanged" signal for a property.
|
|
Packit |
3ff832 |
* Returns: %TRUE on success, %FALSE on failure
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static gboolean
|
|
Packit |
3ff832 |
bus_input_context_property_changed (BusInputContext *context,
|
|
Packit |
3ff832 |
const gchar *property_name,
|
|
Packit |
3ff832 |
GVariant *value,
|
|
Packit |
3ff832 |
GError **error)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->connection == NULL)
|
|
Packit |
3ff832 |
return TRUE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
GVariantBuilder builder;
|
|
Packit |
3ff832 |
g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
|
|
Packit |
3ff832 |
g_variant_builder_add (&builder, "{sv}", property_name, value);
|
|
Packit |
3ff832 |
return bus_input_context_send_signal (context,
|
|
Packit |
3ff832 |
"org.freedesktop.DBus.Properties",
|
|
Packit |
3ff832 |
"PropertiesChanged",
|
|
Packit |
3ff832 |
g_variant_new ("(sa{sv}as)",
|
|
Packit |
3ff832 |
"org.freedesktop.IBus",
|
|
Packit |
3ff832 |
&builder,
|
|
Packit |
3ff832 |
NULL),
|
|
Packit |
3ff832 |
error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _panel_process_key_event_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A GAsyncReadyCallback function to be called when
|
|
Packit |
3ff832 |
* bus_panel_proxy_process_key_event() is finished.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_panel_process_key_event_cb (GObject *source,
|
|
Packit |
3ff832 |
GAsyncResult *res,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GError *error = NULL;
|
|
Packit |
3ff832 |
GVariant *value = g_dbus_proxy_call_finish ((GDBusProxy *)source,
|
|
Packit |
3ff832 |
res,
|
|
Packit |
3ff832 |
&error);
|
|
Packit |
3ff832 |
if (value != NULL) {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, value);
|
|
Packit |
3ff832 |
g_variant_unref (value);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit |
3ff832 |
g_error_free (error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
typedef struct _ProcessKeyEventData ProcessKeyEventData;
|
|
Packit |
3ff832 |
struct _ProcessKeyEventData {
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation;
|
|
Packit |
3ff832 |
BusInputContext *context;
|
|
Packit |
3ff832 |
guint keyval;
|
|
Packit |
3ff832 |
guint keycode;
|
|
Packit |
3ff832 |
guint modifiers;
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_process_key_event_reply_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A GAsyncReadyCallback function to be called when
|
|
Packit |
3ff832 |
* bus_engine_proxy_process_key_event() is finished.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_process_key_event_reply_cb (GObject *source,
|
|
Packit |
3ff832 |
GAsyncResult *res,
|
|
Packit |
3ff832 |
ProcessKeyEventData *data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation = data->invocation;
|
|
Packit |
3ff832 |
BusInputContext *context = data->context;
|
|
Packit |
3ff832 |
guint keyval = data->keyval;
|
|
Packit |
3ff832 |
guint keycode = data->keycode;
|
|
Packit |
3ff832 |
guint modifiers = data->modifiers;
|
|
Packit |
3ff832 |
GError *error = NULL;
|
|
Packit |
3ff832 |
GVariant *value = g_dbus_proxy_call_finish ((GDBusProxy *)source,
|
|
Packit |
3ff832 |
res,
|
|
Packit |
3ff832 |
&error);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (value != NULL) {
|
|
Packit |
3ff832 |
gboolean retval = FALSE;
|
|
Packit |
3ff832 |
g_variant_get (value, "(b)", &retval);
|
|
Packit |
3ff832 |
if (context->emoji_extension && !retval) {
|
|
Packit |
3ff832 |
bus_panel_proxy_process_key_event (context->emoji_extension,
|
|
Packit |
3ff832 |
keyval,
|
|
Packit |
3ff832 |
keycode,
|
|
Packit |
3ff832 |
modifiers,
|
|
Packit |
3ff832 |
(GAsyncReadyCallback)
|
|
Packit |
3ff832 |
_panel_process_key_event_cb,
|
|
Packit |
3ff832 |
invocation);
|
|
Packit |
3ff832 |
} else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, value);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
g_variant_unref (value);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit |
3ff832 |
g_error_free (error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_object_unref (context);
|
|
Packit |
3ff832 |
g_slice_free (ProcessKeyEventData, data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_process_key_event:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "ProcessKeyEvent" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_process_key_event (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
guint keyval = IBUS_KEY_VoidSymbol;
|
|
Packit |
3ff832 |
guint keycode = 0;
|
|
Packit |
3ff832 |
guint modifiers = 0;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(uuu)", &keyval, &keycode, &modifiers);
|
|
Packit |
3ff832 |
if (G_UNLIKELY (!context->has_focus)) {
|
|
Packit |
3ff832 |
/* workaround: set focus if context does not have focus */
|
|
Packit |
3ff832 |
BusInputContext *focused_context = bus_ibus_impl_get_focused_input_context (BUS_DEFAULT_IBUS);
|
|
Packit |
3ff832 |
if (focused_context == NULL ||
|
|
Packit |
3ff832 |
focused_context->fake == TRUE ||
|
|
Packit |
3ff832 |
context->fake == FALSE) {
|
|
Packit |
3ff832 |
/* grab focus, if context is a real IC or current focused IC is fake */
|
|
Packit |
3ff832 |
bus_input_context_focus_in (context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* If I move the focus from the URL entry box of google-chrome
|
|
Packit |
3ff832 |
* to the text buffer of gnome-terminal,
|
|
Packit |
3ff832 |
* focus-in/focus-out of google-chrome is caused after
|
|
Packit |
3ff832 |
* focus-in of gonme-terminal and gnome-terminal loses the focus.
|
|
Packit |
3ff832 |
* The following focus events are received in ibusimcontext:
|
|
Packit |
3ff832 |
* 1) (gnome-terminal:445): IBUS-WARNING **: 15:32:36:717 focus_in
|
|
Packit |
3ff832 |
* 2) (google-chrome:495): IBUS-WARNING **: 15:32:36:866 focus_out
|
|
Packit |
3ff832 |
* 3) (google-chrome:495): IBUS-WARNING **: 15:32:36:875 focus_in
|
|
Packit |
3ff832 |
* 4) (google-chrome:495): IBUS-WARNING **: 15:32:36:890 focus_out
|
|
Packit |
3ff832 |
* In 2), Just return because focused_context is not google-chrome.
|
|
Packit |
3ff832 |
* In 3), focused_context is changed from gnome-terminal to google-chrome
|
|
Packit |
3ff832 |
* In 4), focused_context is changed from google-chrome to faked_context.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* It seems google-chrome has a popup window of the prediction of URL
|
|
Packit |
3ff832 |
* and async focus-in/focus-out.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
if (context->has_focus && context->engine == NULL &&
|
|
Packit |
3ff832 |
context->fake == FALSE) {
|
|
Packit |
3ff832 |
BusInputContext *focused_context =
|
|
Packit |
3ff832 |
bus_ibus_impl_get_focused_input_context (BUS_DEFAULT_IBUS);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (focused_context != NULL && context != focused_context &&
|
|
Packit |
3ff832 |
(context->capabilities & IBUS_CAP_FOCUS) != 0) {
|
|
Packit |
3ff832 |
context->has_focus = FALSE;
|
|
Packit |
3ff832 |
bus_input_context_focus_in (context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* ignore key events, if it is a fake input context */
|
|
Packit |
3ff832 |
if (context->has_focus && context->engine && context->fake == FALSE) {
|
|
Packit |
3ff832 |
ProcessKeyEventData *data = g_slice_new0 (ProcessKeyEventData);
|
|
Packit |
3ff832 |
data->invocation = invocation;
|
|
Packit |
3ff832 |
data->context = g_object_ref (context);
|
|
Packit |
3ff832 |
data->keyval = keyval;
|
|
Packit |
3ff832 |
data->keycode = keycode;
|
|
Packit |
3ff832 |
data->modifiers = modifiers;
|
|
Packit |
3ff832 |
bus_engine_proxy_process_key_event (context->engine,
|
|
Packit |
3ff832 |
keyval,
|
|
Packit |
3ff832 |
keycode,
|
|
Packit |
3ff832 |
modifiers,
|
|
Packit |
3ff832 |
(GAsyncReadyCallback)
|
|
Packit |
3ff832 |
_ic_process_key_event_reply_cb,
|
|
Packit |
3ff832 |
data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", FALSE));
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_set_cursor_location:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "SetCursorLocation" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_cursor_location (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(iiii)",
|
|
Packit |
3ff832 |
&context->x, &context->y, &context->w, &context->h);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->has_focus && context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_set_cursor_location (context->engine,
|
|
Packit |
3ff832 |
context->x, context->y, context->w, context->h);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_FOCUS) {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[SET_CURSOR_LOCATION],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->x,
|
|
Packit |
3ff832 |
context->y,
|
|
Packit |
3ff832 |
context->w,
|
|
Packit |
3ff832 |
context->h);
|
|
Packit |
3ff832 |
if (context->emoji_extension) {
|
|
Packit |
3ff832 |
bus_panel_proxy_set_cursor_location (context->emoji_extension,
|
|
Packit |
3ff832 |
context->x,
|
|
Packit |
3ff832 |
context->y,
|
|
Packit |
3ff832 |
context->w,
|
|
Packit |
3ff832 |
context->h);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_set_cursor_location_relative:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "SetCursorLocationRelative" method call of the
|
|
Packit |
3ff832 |
* org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Unlike _ic_set_cursor_location, this doesn't deliver the location
|
|
Packit |
3ff832 |
* to the engine proxy, since the relative coordinates are not very
|
|
Packit |
3ff832 |
* useful for engines.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_cursor_location_relative (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
gint x, y, w, h;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(iiii)", &x, &y, &w, &h);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_FOCUS) {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[SET_CURSOR_LOCATION_RELATIVE],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
x,
|
|
Packit |
3ff832 |
y,
|
|
Packit |
3ff832 |
w,
|
|
Packit |
3ff832 |
h);
|
|
Packit |
3ff832 |
if (context->emoji_extension) {
|
|
Packit |
3ff832 |
bus_panel_proxy_set_cursor_location_relative (
|
|
Packit |
3ff832 |
context->emoji_extension,
|
|
Packit |
3ff832 |
x,
|
|
Packit |
3ff832 |
y,
|
|
Packit |
3ff832 |
w,
|
|
Packit |
3ff832 |
h);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_process_hand_writing_event (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
/* do nothing if it is a fake input context */
|
|
Packit |
3ff832 |
if (context->has_focus &&
|
|
Packit |
3ff832 |
context->engine && context->fake == FALSE) {
|
|
Packit |
3ff832 |
bus_engine_proxy_process_hand_writing_event (context->engine, parameters);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_cancel_hand_writing (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
guint n_strokes = 0;
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(u)", &n_strokes);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* do nothing if it is a fake input context */
|
|
Packit |
3ff832 |
if (context->has_focus &&
|
|
Packit |
3ff832 |
context->engine && context->fake == FALSE) {
|
|
Packit |
3ff832 |
bus_engine_proxy_cancel_hand_writing (context->engine, n_strokes);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_focus_in:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "FocusIn" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_focus_in (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_FOCUS) {
|
|
Packit |
3ff832 |
bus_input_context_focus_in (context);
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit |
3ff832 |
"The input context does not support focus.");
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_focus_out:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "FocusOut" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_focus_out (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_FOCUS) {
|
|
Packit |
3ff832 |
bus_input_context_focus_out (context);
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit |
3ff832 |
"The input context does not support focus.");
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_reset:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "Reset" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_reset (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
rpm-build |
f2146a |
if (context->preedit_mode == IBUS_ENGINE_PREEDIT_COMMIT) {
|
|
rpm-build |
f2146a |
if (context->client_commit_preedit)
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (context, FALSE);
|
|
rpm-build |
f2146a |
else
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (context, TRUE);
|
|
rpm-build |
f2146a |
}
|
|
Packit |
3ff832 |
bus_engine_proxy_reset (context->engine);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_set_capabilities:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "SetCapabilities" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_capabilities (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
guint caps = 0;
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(u)", &caps);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_set_capabilities (context, caps);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_property_activate:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "PropertyActivate" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_property_activate (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
gchar *prop_name = NULL;
|
|
Packit |
3ff832 |
guint prop_state = 0;
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(&su)", &prop_name, &prop_state);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_property_activate (context->engine, prop_name, prop_state);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#ifdef OS_CHROMEOS
|
|
Packit |
3ff832 |
/* Global engine is always enabled in chromeos,
|
|
Packit |
3ff832 |
* so pass PropertyActivate signal to the focused context.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
else if (context->fake) {
|
|
Packit |
3ff832 |
BusInputContext *focused_context = bus_ibus_impl_get_focused_input_context (BUS_DEFAULT_IBUS);
|
|
Packit |
3ff832 |
if (focused_context && focused_context->engine)
|
|
Packit |
3ff832 |
bus_engine_proxy_property_activate (focused_context->engine, prop_name, prop_state);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
#endif
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_engine_done (BusInputContext *context,
|
|
Packit |
3ff832 |
GAsyncResult *res,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
gboolean retval = FALSE;
|
|
Packit |
3ff832 |
GError *error = NULL;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
retval = bus_input_context_set_engine_by_desc_finish (context,
|
|
Packit |
3ff832 |
res, &error);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!retval) {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit |
3ff832 |
g_error_free (error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_set_engine:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "SetEngine" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_engine (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
gchar *engine_name = NULL;
|
|
Packit |
3ff832 |
g_variant_get (parameters, "(&s)", &engine_name);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!bus_input_context_has_focus (context)) {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_error (invocation,
|
|
Packit |
3ff832 |
G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit |
3ff832 |
"Context which does not has focus can not change engine to %s.",
|
|
Packit |
3ff832 |
engine_name);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
IBusEngineDesc *desc = NULL;
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[REQUEST_ENGINE], 0,
|
|
Packit |
3ff832 |
engine_name,
|
|
Packit |
3ff832 |
&desc);
|
|
Packit |
3ff832 |
if (desc == NULL) {
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_error (invocation,
|
|
Packit |
3ff832 |
G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit |
3ff832 |
"Can not find engine %s.", engine_name);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_set_engine_by_desc (context,
|
|
Packit |
3ff832 |
desc,
|
|
Packit |
3ff832 |
g_gdbus_timeout,
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
(GAsyncReadyCallback)_ic_set_engine_done,
|
|
Packit |
3ff832 |
invocation);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _ic_get_engine:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Implement the "GetEngine" method call of the org.freedesktop.IBus.InputContext interface.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_get_engine (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
IBusEngineDesc *desc = context->engine ?
|
|
Packit |
3ff832 |
bus_engine_proxy_get_desc (context->engine) :
|
|
Packit |
3ff832 |
BUS_INPUT_CONTEXT_GET_CLASS (context)->default_engine_desc;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation,
|
|
Packit |
3ff832 |
g_variant_new ("(v)", ibus_serializable_serialize ((IBusSerializable *)desc)));
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_surrounding_text (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GVariant *variant = NULL;
|
|
Packit |
3ff832 |
IBusText *text;
|
|
Packit |
3ff832 |
guint cursor_pos = 0;
|
|
Packit |
3ff832 |
guint anchor_pos = 0;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_variant_get (parameters,
|
|
Packit |
3ff832 |
"(vuu)",
|
|
Packit |
3ff832 |
&variant,
|
|
Packit |
3ff832 |
&cursor_pos,
|
|
Packit |
3ff832 |
&anchor_pos);
|
|
Packit |
3ff832 |
text = IBUS_TEXT (ibus_serializable_deserialize (variant));
|
|
Packit |
3ff832 |
g_variant_unref (variant);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_SURROUNDING_TEXT) &&
|
|
Packit |
3ff832 |
context->has_focus && context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_set_surrounding_text (context->engine,
|
|
Packit |
3ff832 |
text,
|
|
Packit |
3ff832 |
cursor_pos,
|
|
Packit |
3ff832 |
anchor_pos);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (g_object_is_floating (text))
|
|
Packit |
3ff832 |
g_object_unref (text);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/*
|
|
Packit |
3ff832 |
* Since IBusService is inherited by IBusImpl, this method cannot be
|
|
Packit |
3ff832 |
* applied to IBusServiceClass.method_call() directly but can be in
|
|
Packit |
3ff832 |
* each child class.method_call().
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static gboolean
|
|
Packit |
3ff832 |
bus_input_context_service_authorized_method (IBusService *service,
|
|
Packit |
3ff832 |
GDBusConnection *connection)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (ibus_service_get_connection (service) == connection)
|
|
Packit |
3ff832 |
return TRUE;
|
|
Packit |
3ff832 |
return FALSE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_service_method_call:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Handle a D-Bus method call whose destination and interface name are both "org.freedesktop.IBus.InputContext"
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_service_method_call (IBusService *service,
|
|
Packit |
3ff832 |
GDBusConnection *connection,
|
|
Packit |
3ff832 |
const gchar *sender,
|
|
Packit |
3ff832 |
const gchar *object_path,
|
|
Packit |
3ff832 |
const gchar *interface_name,
|
|
Packit |
3ff832 |
const gchar *method_name,
|
|
Packit |
3ff832 |
GVariant *parameters,
|
|
Packit |
3ff832 |
GDBusMethodInvocation *invocation)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
|
|
Packit |
3ff832 |
IBUS_SERVICE_CLASS (bus_input_context_parent_class)->service_method_call (
|
|
Packit |
3ff832 |
service,
|
|
Packit |
3ff832 |
connection,
|
|
Packit |
3ff832 |
sender,
|
|
Packit |
3ff832 |
object_path,
|
|
Packit |
3ff832 |
interface_name,
|
|
Packit |
3ff832 |
method_name,
|
|
Packit |
3ff832 |
parameters,
|
|
Packit |
3ff832 |
invocation);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static const struct {
|
|
Packit |
3ff832 |
const gchar *method_name;
|
|
Packit |
3ff832 |
void (* method_callback) (BusInputContext *, GVariant *, GDBusMethodInvocation *);
|
|
Packit |
3ff832 |
} methods [] = {
|
|
Packit |
3ff832 |
{ "ProcessKeyEvent", _ic_process_key_event },
|
|
Packit |
3ff832 |
{ "SetCursorLocation", _ic_set_cursor_location },
|
|
Packit |
3ff832 |
{ "SetCursorLocationRelative", _ic_set_cursor_location_relative },
|
|
Packit |
3ff832 |
{ "ProcessHandWritingEvent",
|
|
Packit |
3ff832 |
_ic_process_hand_writing_event },
|
|
Packit |
3ff832 |
{ "CancelHandWriting", _ic_cancel_hand_writing },
|
|
Packit |
3ff832 |
{ "FocusIn", _ic_focus_in },
|
|
Packit |
3ff832 |
{ "FocusOut", _ic_focus_out },
|
|
Packit |
3ff832 |
{ "Reset", _ic_reset },
|
|
Packit |
3ff832 |
{ "SetCapabilities", _ic_set_capabilities },
|
|
Packit |
3ff832 |
{ "PropertyActivate", _ic_property_activate },
|
|
Packit |
3ff832 |
{ "SetEngine", _ic_set_engine },
|
|
Packit |
3ff832 |
{ "GetEngine", _ic_get_engine },
|
|
Packit |
3ff832 |
{ "SetSurroundingText", _ic_set_surrounding_text }
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
gint i;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!bus_input_context_service_authorized_method (service, connection))
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
for (i = 0; i < G_N_ELEMENTS (methods); i++) {
|
|
Packit |
3ff832 |
if (g_strcmp0 (method_name, methods[i].method_name) == 0) {
|
|
Packit |
3ff832 |
methods[i].method_callback ((BusInputContext *)service, parameters, invocation);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_return_if_reached ();
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_ic_set_content_type (BusInputContext *context,
|
|
Packit |
3ff832 |
GVariant *value)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
guint purpose = 0;
|
|
Packit |
3ff832 |
guint hints = 0;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_variant_get (value, "(uu)", &purpose, &hints);
|
|
Packit |
3ff832 |
if (purpose != context->purpose || hints != context->hints) {
|
|
Packit |
3ff832 |
GError *error;
|
|
Packit |
3ff832 |
gboolean retval;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->purpose = purpose;
|
|
Packit |
3ff832 |
context->hints = hints;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->has_focus && context->engine)
|
|
Packit |
3ff832 |
bus_engine_proxy_set_content_type (context->engine,
|
|
Packit |
3ff832 |
purpose,
|
|
Packit |
3ff832 |
hints);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->has_focus) {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[SET_CONTENT_TYPE],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->purpose,
|
|
Packit |
3ff832 |
context->hints);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
error = NULL;
|
|
Packit |
3ff832 |
retval = bus_input_context_property_changed (context,
|
|
Packit |
3ff832 |
"ContentType",
|
|
Packit |
3ff832 |
value,
|
|
Packit |
3ff832 |
&error);
|
|
Packit |
3ff832 |
if (!retval) {
|
|
Packit |
3ff832 |
g_warning ("Failed to emit PropertiesChanged signal: %s",
|
|
Packit |
3ff832 |
error->message);
|
|
Packit |
3ff832 |
g_error_free (error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
static void
|
|
rpm-build |
f2146a |
_ic_set_client_commit_preedit (BusInputContext *context,
|
|
rpm-build |
f2146a |
GVariant *value)
|
|
rpm-build |
f2146a |
{
|
|
rpm-build |
f2146a |
g_variant_get (value, "(b)", &context->client_commit_preedit);
|
|
rpm-build |
f2146a |
}
|
|
rpm-build |
f2146a |
|
|
Packit |
3ff832 |
static gboolean
|
|
Packit |
3ff832 |
bus_input_context_service_set_property (IBusService *service,
|
|
Packit |
3ff832 |
GDBusConnection *connection,
|
|
Packit |
3ff832 |
const gchar *sender,
|
|
Packit |
3ff832 |
const gchar *object_path,
|
|
Packit |
3ff832 |
const gchar *interface_name,
|
|
Packit |
3ff832 |
const gchar *property_name,
|
|
Packit |
3ff832 |
GVariant *value,
|
|
Packit |
3ff832 |
GError **error)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
|
|
Packit |
3ff832 |
return IBUS_SERVICE_CLASS (bus_input_context_parent_class)->
|
|
Packit |
3ff832 |
service_set_property (service,
|
|
Packit |
3ff832 |
connection,
|
|
Packit |
3ff832 |
sender,
|
|
Packit |
3ff832 |
object_path,
|
|
Packit |
3ff832 |
interface_name,
|
|
Packit |
3ff832 |
property_name,
|
|
Packit |
3ff832 |
value,
|
|
Packit |
3ff832 |
error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!bus_input_context_service_authorized_method (service, connection))
|
|
Packit |
3ff832 |
return FALSE;
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
g_return_val_if_fail (BUS_IS_INPUT_CONTEXT (service), FALSE);
|
|
rpm-build |
f2146a |
|
|
Packit |
3ff832 |
if (g_strcmp0 (property_name, "ContentType") == 0) {
|
|
rpm-build |
f2146a |
_ic_set_content_type (BUS_INPUT_CONTEXT (service), value);
|
|
rpm-build |
f2146a |
return TRUE;
|
|
rpm-build |
f2146a |
}
|
|
rpm-build |
f2146a |
if (g_strcmp0 (property_name, "ClientCommitPreedit") == 0) {
|
|
rpm-build |
f2146a |
_ic_set_client_commit_preedit (BUS_INPUT_CONTEXT (service), value);
|
|
Packit |
3ff832 |
return TRUE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_return_val_if_reached (FALSE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
gboolean
|
|
Packit |
3ff832 |
bus_input_context_has_focus (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
return context->has_focus;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_focus_in (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->has_focus)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->has_focus = TRUE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* To make sure that we won't use an old value left before we losing focus
|
|
Packit |
3ff832 |
* last time. */
|
|
Packit |
3ff832 |
context->prev_keyval = IBUS_KEY_VoidSymbol;
|
|
Packit |
3ff832 |
context->prev_modifiers = 0;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_in (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_enable (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_FOCUS) {
|
|
Packit |
3ff832 |
g_signal_emit (context, context_signals[FOCUS_IN], 0);
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
/* if necessary, emit glib signals to the context object to update panel status. see the comment for PREEDIT_CONDITION
|
|
Packit |
3ff832 |
* for details. */
|
|
Packit |
3ff832 |
if (context->preedit_visible && !PREEDIT_CONDITION) {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_PREEDIT_TEXT],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->preedit_text,
|
|
Packit |
3ff832 |
context->preedit_cursor_pos,
|
|
Packit |
3ff832 |
context->preedit_visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_AUXILIARY_TEXT],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->auxiliary_text,
|
|
Packit |
3ff832 |
context->auxiliary_visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
if (context->lookup_table_visible && (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->lookup_table,
|
|
Packit |
3ff832 |
context->lookup_table_visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_clear_preedit_text:
|
|
rpm-build |
f2146a |
* @context: A #BusInputContext
|
|
rpm-build |
f2146a |
* @with_signal: %FALSE if the preedit is already updated in ibus clients
|
|
rpm-build |
f2146a |
* likes ibus-im.so. Otherwise %TRUE.
|
|
Packit |
3ff832 |
*
|
|
rpm-build |
f2146a |
* Clear context->preedit_text. If the preedit mode is
|
|
rpm-build |
f2146a |
* IBUS_ENGINE_PREEDIT_COMMIT, commit it before clearing.
|
|
Packit |
3ff832 |
*/
|
|
rpm-build |
f2146a |
void
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (BusInputContext *context,
|
|
rpm-build |
f2146a |
gboolean with_signal)
|
|
Packit |
3ff832 |
{
|
|
rpm-build |
f2146a |
IBusText *preedit_text;
|
|
rpm-build |
f2146a |
guint preedit_mode;
|
|
rpm-build |
f2146a |
gboolean preedit_visible;
|
|
rpm-build |
f2146a |
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
if (!with_signal) {
|
|
rpm-build |
f2146a |
g_object_unref (context->preedit_text);
|
|
rpm-build |
f2146a |
context->preedit_mode = IBUS_ENGINE_PREEDIT_CLEAR;
|
|
rpm-build |
f2146a |
context->preedit_text = (IBusText *) g_object_ref_sink (text_empty);
|
|
rpm-build |
f2146a |
context->preedit_cursor_pos = 0;
|
|
rpm-build |
f2146a |
context->preedit_visible = FALSE;
|
|
rpm-build |
f2146a |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
/* always clear preedit text to reset the cursor position in the
|
|
rpm-build |
f2146a |
* client application before commit the preeit text. */
|
|
rpm-build |
f2146a |
preedit_text = g_object_ref (context->preedit_text);
|
|
rpm-build |
f2146a |
preedit_mode = context->preedit_mode;
|
|
rpm-build |
f2146a |
preedit_visible = context->preedit_visible;
|
|
Packit |
3ff832 |
bus_input_context_update_preedit_text (context,
|
|
Packit |
3ff832 |
text_empty, 0, FALSE, IBUS_ENGINE_PREEDIT_CLEAR, TRUE);
|
|
rpm-build |
f2146a |
|
|
rpm-build |
f2146a |
if (preedit_visible && preedit_mode == IBUS_ENGINE_PREEDIT_COMMIT) {
|
|
rpm-build |
f2146a |
bus_input_context_commit_text (context, preedit_text);
|
|
rpm-build |
f2146a |
}
|
|
rpm-build |
f2146a |
g_object_unref (preedit_text);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_focus_out (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!context->has_focus)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
if (context->client_commit_preedit)
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (context, FALSE);
|
|
rpm-build |
f2146a |
else
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (context, TRUE);
|
|
Packit |
3ff832 |
bus_input_context_update_auxiliary_text (context, text_empty, FALSE);
|
|
Packit |
3ff832 |
bus_input_context_update_lookup_table (context,
|
|
Packit |
3ff832 |
lookup_table_empty,
|
|
Packit |
3ff832 |
FALSE,
|
|
Packit |
3ff832 |
FALSE);
|
|
Packit |
3ff832 |
bus_input_context_register_properties (context, props_empty);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_out (context->engine);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->has_focus = FALSE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_FOCUS) {
|
|
Packit |
3ff832 |
g_signal_emit (context, context_signals[FOCUS_OUT], 0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#define DEFINE_FUNC(name) \
|
|
Packit |
3ff832 |
void \
|
|
Packit |
3ff832 |
bus_input_context_##name (BusInputContext *context) \
|
|
Packit |
3ff832 |
{ \
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context)); \
|
|
Packit |
3ff832 |
\
|
|
Packit |
3ff832 |
if (context->is_extension_lookup_table && \
|
|
Packit |
3ff832 |
context->emoji_extension) { \
|
|
Packit |
3ff832 |
bus_panel_proxy_##name##_lookup_table (context->emoji_extension); \
|
|
Packit |
3ff832 |
return; \
|
|
Packit |
3ff832 |
} \
|
|
Packit |
3ff832 |
if (context->has_focus && context->engine) { \
|
|
Packit |
3ff832 |
bus_engine_proxy_##name (context->engine); \
|
|
Packit |
3ff832 |
} \
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
DEFINE_FUNC (page_up)
|
|
Packit |
3ff832 |
DEFINE_FUNC (page_down)
|
|
Packit |
3ff832 |
DEFINE_FUNC (cursor_up)
|
|
Packit |
3ff832 |
DEFINE_FUNC (cursor_down)
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#undef DEFINE_FUNC
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_candidate_clicked (BusInputContext *context,
|
|
Packit |
3ff832 |
guint index,
|
|
Packit |
3ff832 |
guint button,
|
|
Packit |
3ff832 |
guint state)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->is_extension_lookup_table && context->emoji_extension) {
|
|
Packit |
3ff832 |
bus_panel_proxy_candidate_clicked_lookup_table (
|
|
Packit |
3ff832 |
context->emoji_extension,
|
|
Packit |
3ff832 |
index,
|
|
Packit |
3ff832 |
button,
|
|
Packit |
3ff832 |
state);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_candidate_clicked (context->engine,
|
|
Packit |
3ff832 |
index,
|
|
Packit |
3ff832 |
button,
|
|
Packit |
3ff832 |
state);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_property_activate (BusInputContext *context,
|
|
Packit |
3ff832 |
const gchar *prop_name,
|
|
Packit |
3ff832 |
gint prop_state)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_property_activate (context->engine, prop_name, prop_state);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_show_preedit_text:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Show a preedit text. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_show_preedit_text (BusInputContext *context,
|
|
Packit |
3ff832 |
gboolean is_extension)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->preedit_visible)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
if (!is_extension && context->emoji_extension)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!is_extension)
|
|
Packit |
3ff832 |
context->preedit_visible = TRUE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->emoji_extension && !is_extension) {
|
|
Packit |
3ff832 |
/* Do not use HIDE_PREEDIT_TEXT signal below but call
|
|
Packit |
3ff832 |
* bus_panel_proxy_hide_preedit_text() directly for the extension only
|
|
Packit |
3ff832 |
* but not for the normal panel.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
bus_panel_proxy_show_preedit_text (context->emoji_extension);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (PREEDIT_CONDITION) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"ShowPreeditText",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[SHOW_PREEDIT_TEXT],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_hide_preedit_text:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Hide a preedit text. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_hide_preedit_text (BusInputContext *context,
|
|
Packit |
3ff832 |
gboolean is_extension)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!is_extension && !context->preedit_visible)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!is_extension)
|
|
Packit |
3ff832 |
context->preedit_visible = FALSE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->emoji_extension && !is_extension) {
|
|
Packit |
3ff832 |
/* Do not use HIDE_PREEDIT_TEXT signal below but call
|
|
Packit |
3ff832 |
* bus_panel_proxy_hide_preedit_text() directly for the extension only
|
|
Packit |
3ff832 |
* but not for the normal panel.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
bus_panel_proxy_hide_preedit_text (context->emoji_extension);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (PREEDIT_CONDITION) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"HidePreeditText",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[HIDE_PREEDIT_TEXT],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_update_auxiliary_text:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Update an aux text. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_update_auxiliary_text (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
gboolean visible)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->auxiliary_text) {
|
|
Packit |
3ff832 |
g_object_unref (context->auxiliary_text);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->auxiliary_text = (IBusText *) g_object_ref_sink (text ? text : text_empty);
|
|
Packit |
3ff832 |
context->auxiliary_visible = visible;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) {
|
|
Packit |
3ff832 |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)text);
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"UpdateAuxiliaryText",
|
|
Packit |
3ff832 |
g_variant_new ("(vb)", variant, visible),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_AUXILIARY_TEXT],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->auxiliary_text,
|
|
Packit |
3ff832 |
context->auxiliary_visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_show_auxiliary_text:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Show an aux text. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_show_auxiliary_text (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->auxiliary_visible) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->auxiliary_visible = TRUE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == IBUS_CAP_AUXILIARY_TEXT) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"ShowAuxiliaryText",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[SHOW_AUXILIARY_TEXT],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_hide_auxiliary_text:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Hide an aux text. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_hide_auxiliary_text (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!context->auxiliary_visible) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->auxiliary_visible = FALSE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == IBUS_CAP_AUXILIARY_TEXT) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"HideAuxiliaryText",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[HIDE_AUXILIARY_TEXT],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_update_lookup_table:
|
|
Packit |
3ff832 |
* @context: #BusInputContext
|
|
Packit |
3ff832 |
* @table: #IBusLookupTable
|
|
Packit |
3ff832 |
* @visible: %TRUE if the lookup table is visible, otherwise %FALSE.
|
|
Packit |
3ff832 |
* @is_extension: %TRUE if the lookup table is called by a panel extension.
|
|
Packit |
3ff832 |
* %FALSE if it's called by an engine.
|
|
Packit |
3ff832 |
* I.e. is_extension_lookup_table means the owner of the lookup table.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_update_lookup_table (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusLookupTable *table,
|
|
Packit |
3ff832 |
gboolean visible,
|
|
Packit |
3ff832 |
gboolean is_extension)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->is_extension_lookup_table = is_extension;
|
|
Packit |
3ff832 |
if (context->lookup_table) {
|
|
Packit |
3ff832 |
g_object_unref (context->lookup_table);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->lookup_table = (IBusLookupTable *) g_object_ref_sink (table ? table : lookup_table_empty);
|
|
Packit |
3ff832 |
context->lookup_table_visible = visible;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)table);
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"UpdateLookupTable",
|
|
Packit |
3ff832 |
g_variant_new ("(vb)", variant, visible),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->lookup_table,
|
|
Packit |
3ff832 |
context->lookup_table_visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_show_lookup_table:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Show the lookup table. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_show_lookup_table (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->lookup_table_visible) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->lookup_table_visible = TRUE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"ShowLookupTable",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[SHOW_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_hide_lookup_table:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Hide the lookup table. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_hide_lookup_table (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!context->lookup_table_visible) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->lookup_table_visible = FALSE;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"HideLookupTable",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[HIDE_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_page_up_lookup_table:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Change cursor position. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_page_up_lookup_table (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!ibus_lookup_table_page_up (context->lookup_table)) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"PageUpLookupTable",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[PAGE_UP_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_page_down_lookup_table:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Change cursor position. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_page_down_lookup_table (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!ibus_lookup_table_page_down (context->lookup_table)) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"PageDownLookupTable",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[PAGE_DOWN_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_cursor_up_lookup_table:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Change cursor position. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_cursor_up_lookup_table (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!ibus_lookup_table_cursor_up (context->lookup_table)) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"CursorUpLookupTable",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[CURSOR_UP_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_cursor_down_lookup_table:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Change cursor position. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_cursor_down_lookup_table (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!ibus_lookup_table_cursor_down (context->lookup_table)) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"CursorDownLookupTable",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[CURSOR_DOWN_LOOKUP_TABLE],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_register_properties:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Register properties. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_register_properties (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusPropList *props)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_PROP_LIST (props));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_PROPERTY) {
|
|
Packit |
3ff832 |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)props);
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"RegisterProperties",
|
|
Packit |
3ff832 |
g_variant_new ("(v)", variant),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[REGISTER_PROPERTIES],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
props);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* bus_input_context_update_property:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Update property. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_update_property (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusProperty *prop)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_PROPERTY (prop));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities & IBUS_CAP_PROPERTY) {
|
|
Packit |
3ff832 |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)prop);
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"UpdateProperty",
|
|
Packit |
3ff832 |
g_variant_new ("(v)", variant),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_PROPERTY],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
prop);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_destroy_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "destroy" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
* Remove the engine from the context.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_destroy_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_set_engine (context, NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_commit_text_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "commit-text" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_commit_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (text != NULL);
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_commit_text (context, text);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_forward_key_event_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "forward-key-event" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_forward_key_event_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
guint keyval,
|
|
Packit |
3ff832 |
guint keycode,
|
|
Packit |
3ff832 |
guint state,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"ForwardKeyEvent",
|
|
Packit |
3ff832 |
g_variant_new ("(uuu)", keyval, keycode, state),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_delete_surrounding_text_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "delete-surrounding-text" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_delete_surrounding_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
gint offset_from_cursor,
|
|
Packit |
3ff832 |
guint nchars,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"DeleteSurroundingText",
|
|
Packit |
3ff832 |
g_variant_new ("(iu)", offset_from_cursor, nchars),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_require_surrounding_text_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "require-surrounding-text" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_require_surrounding_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"RequireSurroundingText",
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_update_preedit_text_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "update-preedit-text" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_update_preedit_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
guint cursor_pos,
|
|
Packit |
3ff832 |
gboolean visible,
|
|
Packit |
3ff832 |
guint mode,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_TEXT (text));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_update_preedit_text (context, text,
|
|
Packit |
3ff832 |
cursor_pos, visible, mode,
|
|
Packit |
3ff832 |
TRUE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_update_auxiliary_text_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "update-auxiliary-text" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_update_auxiliary_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
gboolean visible,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_TEXT (text));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_update_auxiliary_text (context, text, visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_update_lookup_table_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "update-lookup-table" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_update_lookup_table_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusLookupTable *table,
|
|
Packit |
3ff832 |
gboolean visible,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_LOOKUP_TABLE (table));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_update_lookup_table (context, table, visible, FALSE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_register_properties_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "register-properties" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_register_properties_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusPropList *props,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_PROP_LIST (props));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_register_properties (context, props);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_update_property_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "update-property" glib signal is sent to the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_update_property_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusProperty *prop,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_PROPERTY (prop));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_update_property (context, prop);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* _engine_panel_extension_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A function to be called when "panel-extension" glib signal is sent
|
|
Packit |
3ff832 |
* from the engine object.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_panel_extension_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
IBusExtensionEvent *event,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_signal_emit (context, context_signals[PANEL_EXTENSION], 0, event);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_show_preedit_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_show_preedit_text (context, FALSE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
_engine_hide_preedit_text_cb (BusEngineProxy *engine,
|
|
Packit |
3ff832 |
BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine));
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (context->engine == engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_input_context_hide_preedit_text (context, FALSE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#define DEFINE_FUNCTION(name) \
|
|
Packit |
3ff832 |
static void \
|
|
Packit |
3ff832 |
_engine_##name##_cb (BusEngineProxy *engine, \
|
|
Packit |
3ff832 |
BusInputContext *context) \
|
|
Packit |
3ff832 |
{ \
|
|
Packit |
3ff832 |
g_assert (BUS_IS_ENGINE_PROXY (engine)); \
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context)); \
|
|
Packit |
3ff832 |
\
|
|
Packit |
3ff832 |
g_assert (context->engine == engine); \
|
|
Packit |
3ff832 |
\
|
|
Packit |
3ff832 |
bus_input_context_##name (context); \
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (show_auxiliary_text)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (hide_auxiliary_text)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (show_lookup_table)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (hide_lookup_table)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (page_up_lookup_table)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (page_down_lookup_table)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (cursor_up_lookup_table)
|
|
Packit |
3ff832 |
DEFINE_FUNCTION (cursor_down_lookup_table)
|
|
Packit |
3ff832 |
#undef DEFINE_FUNCTION
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
BusInputContext *
|
|
Packit |
3ff832 |
bus_input_context_new (BusConnection *connection,
|
|
Packit |
3ff832 |
const gchar *client)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
static guint id = 0;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (connection == NULL || BUS_IS_CONNECTION (connection));
|
|
Packit |
3ff832 |
g_assert (client != NULL);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
gchar *path = g_strdup_printf (IBUS_PATH_INPUT_CONTEXT, ++id);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
BusInputContext *context = NULL;
|
|
Packit |
3ff832 |
if (connection) {
|
|
Packit |
3ff832 |
context = (BusInputContext *) g_object_new (BUS_TYPE_INPUT_CONTEXT,
|
|
Packit |
3ff832 |
"object-path", path,
|
|
Packit |
3ff832 |
"connection", bus_connection_get_dbus_connection (connection),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
context = (BusInputContext *) g_object_new (BUS_TYPE_INPUT_CONTEXT,
|
|
Packit |
3ff832 |
"object-path", path,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
g_free (path);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->client = g_strdup (client);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* it is a fake input context, just need process hotkey */
|
|
Packit |
3ff832 |
context->fake = (strncmp (client, "fake", 4) == 0);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (connection) {
|
|
Packit |
3ff832 |
g_object_ref_sink (connection);
|
|
Packit |
3ff832 |
context->connection = connection;
|
|
Packit |
3ff832 |
g_signal_connect (context->connection,
|
|
Packit |
3ff832 |
"destroy",
|
|
Packit |
3ff832 |
(GCallback) _connection_destroy_cb,
|
|
Packit |
3ff832 |
context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
return context;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_enable (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!context->has_focus) {
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine == NULL) {
|
|
Packit |
3ff832 |
IBusEngineDesc *desc = NULL;
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[REQUEST_ENGINE], 0,
|
|
Packit |
3ff832 |
NULL,
|
|
Packit |
3ff832 |
&desc);
|
|
Packit |
3ff832 |
if (desc != NULL) {
|
|
Packit |
3ff832 |
bus_input_context_set_engine_by_desc (context,
|
|
Packit |
3ff832 |
desc,
|
|
Packit |
3ff832 |
g_gdbus_timeout, /* timeout in msec. */
|
|
Packit |
3ff832 |
NULL, /* we do not cancel the call. */
|
|
Packit |
3ff832 |
NULL, /* use the default callback function. */
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine == NULL)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_in (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_enable (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_disable (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (context, TRUE);
|
|
Packit |
3ff832 |
bus_input_context_update_auxiliary_text (context, text_empty, FALSE);
|
|
Packit |
3ff832 |
bus_input_context_update_lookup_table (context,
|
|
Packit |
3ff832 |
lookup_table_empty,
|
|
Packit |
3ff832 |
FALSE,
|
|
Packit |
3ff832 |
FALSE);
|
|
Packit |
3ff832 |
bus_input_context_register_properties (context, props_empty);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_out (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_disable (context->engine);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* A list of signals (and their handler functions) that could be emit by the engine proxy object. */
|
|
Packit |
3ff832 |
const static struct {
|
|
Packit |
3ff832 |
const gchar *name;
|
|
Packit |
3ff832 |
GCallback callback;
|
|
Packit |
3ff832 |
} engine_signals [] = {
|
|
Packit |
3ff832 |
{ "commit-text", G_CALLBACK (_engine_commit_text_cb) },
|
|
Packit |
3ff832 |
{ "forward-key-event", G_CALLBACK (_engine_forward_key_event_cb) },
|
|
Packit |
3ff832 |
{ "delete-surrounding-text", G_CALLBACK (_engine_delete_surrounding_text_cb) },
|
|
Packit |
3ff832 |
{ "require-surrounding-text", G_CALLBACK (_engine_require_surrounding_text_cb) },
|
|
Packit |
3ff832 |
{ "update-preedit-text", G_CALLBACK (_engine_update_preedit_text_cb) },
|
|
Packit |
3ff832 |
{ "show-preedit-text", G_CALLBACK (_engine_show_preedit_text_cb) },
|
|
Packit |
3ff832 |
{ "hide-preedit-text", G_CALLBACK (_engine_hide_preedit_text_cb) },
|
|
Packit |
3ff832 |
{ "update-auxiliary-text", G_CALLBACK (_engine_update_auxiliary_text_cb) },
|
|
Packit |
3ff832 |
{ "show-auxiliary-text", G_CALLBACK (_engine_show_auxiliary_text_cb) },
|
|
Packit |
3ff832 |
{ "hide-auxiliary-text", G_CALLBACK (_engine_hide_auxiliary_text_cb) },
|
|
Packit |
3ff832 |
{ "update-lookup-table", G_CALLBACK (_engine_update_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "show-lookup-table", G_CALLBACK (_engine_show_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "hide-lookup-table", G_CALLBACK (_engine_hide_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "page-up-lookup-table", G_CALLBACK (_engine_page_up_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "page-down-lookup-table", G_CALLBACK (_engine_page_down_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "cursor-up-lookup-table", G_CALLBACK (_engine_cursor_up_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "cursor-down-lookup-table", G_CALLBACK (_engine_cursor_down_lookup_table_cb) },
|
|
Packit |
3ff832 |
{ "register-properties", G_CALLBACK (_engine_register_properties_cb) },
|
|
Packit |
3ff832 |
{ "update-property", G_CALLBACK (_engine_update_property_cb) },
|
|
Packit |
3ff832 |
{ "panel-extension", G_CALLBACK (_engine_panel_extension_cb) },
|
|
Packit |
3ff832 |
{ "destroy", G_CALLBACK (_engine_destroy_cb) }
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
bus_input_context_unset_engine (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
rpm-build |
f2146a |
bus_input_context_clear_preedit_text (context, TRUE);
|
|
Packit |
3ff832 |
bus_input_context_update_auxiliary_text (context, text_empty, FALSE);
|
|
Packit |
3ff832 |
bus_input_context_update_lookup_table (context,
|
|
Packit |
3ff832 |
lookup_table_empty,
|
|
Packit |
3ff832 |
FALSE,
|
|
Packit |
3ff832 |
FALSE);
|
|
Packit |
3ff832 |
bus_input_context_register_properties (context, props_empty);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
gint i;
|
|
Packit |
3ff832 |
/* uninstall signal handlers for the engine. */
|
|
Packit |
3ff832 |
for (i = 0; i < G_N_ELEMENTS(engine_signals); i++) {
|
|
Packit |
3ff832 |
g_signal_handlers_disconnect_by_func (context->engine,
|
|
Packit |
3ff832 |
engine_signals[i].callback, context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
/* focus out engine so that the next call of
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_in() will take effect and trigger
|
|
Packit |
3ff832 |
RegisterProperties. */
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_out (context->engine);
|
|
Packit |
3ff832 |
g_object_unref (context->engine);
|
|
Packit |
3ff832 |
context->engine = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_set_engine (BusInputContext *context,
|
|
Packit |
3ff832 |
BusEngineProxy *engine)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine == engine)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine != NULL) {
|
|
Packit |
3ff832 |
bus_input_context_unset_engine (context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (engine == NULL) {
|
|
Packit |
3ff832 |
bus_input_context_disable (context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
gint i;
|
|
Packit |
3ff832 |
context->engine = engine;
|
|
Packit |
3ff832 |
g_object_ref (context->engine);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* handle signals from the engine. */
|
|
Packit |
3ff832 |
for (i = 0; i < G_N_ELEMENTS(engine_signals); i++) {
|
|
Packit |
3ff832 |
g_signal_connect (context->engine,
|
|
Packit |
3ff832 |
engine_signals[i].name,
|
|
Packit |
3ff832 |
engine_signals[i].callback,
|
|
Packit |
3ff832 |
context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
if (context->has_focus) {
|
|
Packit |
3ff832 |
bus_engine_proxy_focus_in (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_enable (context->engine);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
|
|
Packit |
3ff832 |
bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[ENGINE_CHANGED],
|
|
Packit |
3ff832 |
0);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void set_engine_by_desc_data_free (SetEngineByDescData *data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (data->context != NULL) {
|
|
Packit |
3ff832 |
if (data->context->data == data)
|
|
Packit |
3ff832 |
data->context->data = NULL;
|
|
Packit |
3ff832 |
g_object_unref (data->context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (data->task != NULL) {
|
|
Packit |
3ff832 |
g_object_unref (data->task);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (data->cancellable != NULL)
|
|
Packit |
3ff832 |
g_object_unref (data->cancellable);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (data->origin_cancellable != NULL) {
|
|
Packit |
3ff832 |
if (data->cancelled_handler_id != 0)
|
|
Packit |
3ff832 |
g_cancellable_disconnect (data->origin_cancellable,
|
|
Packit |
3ff832 |
data->cancelled_handler_id);
|
|
Packit |
3ff832 |
g_object_unref (data->origin_cancellable);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_slice_free (SetEngineByDescData, data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* new_engine_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A callback function to be called when bus_engine_proxy_new() is finished.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
new_engine_cb (GObject *obj,
|
|
Packit |
3ff832 |
GAsyncResult *res,
|
|
Packit |
3ff832 |
SetEngineByDescData *data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GError *error = NULL;
|
|
Packit |
3ff832 |
BusEngineProxy *engine = bus_engine_proxy_new_finish (res, &error);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (engine == NULL) {
|
|
Packit |
3ff832 |
g_task_return_error (data->task, error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
if (data->context->data != data) {
|
|
Packit |
3ff832 |
/* Request has been overriden or cancelled */
|
|
Packit |
3ff832 |
g_object_unref (engine);
|
|
Packit |
3ff832 |
g_task_return_new_error (data->task,
|
|
Packit |
3ff832 |
G_IO_ERROR,
|
|
Packit |
3ff832 |
G_IO_ERROR_CANCELLED,
|
|
Packit |
3ff832 |
"Opertation was cancelled");
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
else {
|
|
Packit |
3ff832 |
/* Let BusEngineProxy call a Disable signal. */
|
|
Packit |
3ff832 |
bus_input_context_disable (data->context);
|
|
Packit |
3ff832 |
bus_input_context_set_engine (data->context, engine);
|
|
Packit |
3ff832 |
g_object_unref (engine);
|
|
Packit |
3ff832 |
bus_input_context_enable (data->context);
|
|
Packit |
3ff832 |
g_task_return_boolean (data->task, TRUE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
set_engine_by_desc_data_free (data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
cancel_set_engine_by_desc (SetEngineByDescData *data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
if (data->context->data == data)
|
|
Packit |
3ff832 |
data->context->data = NULL;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (data->origin_cancellable != NULL) {
|
|
Packit |
3ff832 |
if (data->cancelled_handler_id != 0) {
|
|
Packit |
3ff832 |
g_cancellable_disconnect (data->origin_cancellable,
|
|
Packit |
3ff832 |
data->cancelled_handler_id);
|
|
Packit |
3ff832 |
data->cancelled_handler_id = 0;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_object_unref (data->origin_cancellable);
|
|
Packit |
3ff832 |
data->origin_cancellable = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (data->cancellable != NULL) {
|
|
Packit |
3ff832 |
g_cancellable_cancel (data->cancellable);
|
|
Packit |
3ff832 |
g_object_unref (data->cancellable);
|
|
Packit |
3ff832 |
data->cancellable = NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static gboolean
|
|
Packit |
3ff832 |
set_engine_by_desc_cancelled_idle_cb (SetEngineByDescData *data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
cancel_set_engine_by_desc (data);
|
|
Packit |
3ff832 |
return FALSE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
set_engine_by_desc_cancelled_cb (GCancellable *cancellable,
|
|
Packit |
3ff832 |
SetEngineByDescData *data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
/* Cancel in idle to avoid deadlock */
|
|
Packit |
3ff832 |
g_idle_add ((GSourceFunc) set_engine_by_desc_cancelled_idle_cb, data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* set_engine_by_desc_ready_cb:
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* A default callback function for bus_input_context_set_engine_by_desc().
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
static void
|
|
Packit |
3ff832 |
set_engine_by_desc_ready_cb (BusInputContext *context,
|
|
Packit |
3ff832 |
GAsyncResult *res,
|
|
Packit |
3ff832 |
gpointer user_data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GError *error = NULL;
|
|
Packit |
3ff832 |
if (!bus_input_context_set_engine_by_desc_finish (context, res, &error)) {
|
|
Packit |
3ff832 |
g_warning ("Set context engine failed: %s", error->message);
|
|
Packit |
3ff832 |
g_error_free (error);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_set_engine_by_desc (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusEngineDesc *desc,
|
|
Packit |
3ff832 |
gint timeout,
|
|
Packit |
3ff832 |
GCancellable *cancellable,
|
|
Packit |
3ff832 |
GAsyncReadyCallback callback,
|
|
Packit |
3ff832 |
gpointer user_data)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GTask *task;
|
|
Packit |
3ff832 |
SetEngineByDescData *data;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
g_assert (IBUS_IS_ENGINE_DESC (desc));
|
|
Packit |
3ff832 |
g_assert (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->data != NULL) {
|
|
Packit |
3ff832 |
/* Cancel previous set_engine_by_desc() request */
|
|
Packit |
3ff832 |
cancel_set_engine_by_desc (context->data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* Previous request must be completed or cancelled */
|
|
Packit |
3ff832 |
g_assert (context->data == NULL);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (callback == NULL)
|
|
Packit |
3ff832 |
callback = (GAsyncReadyCallback) set_engine_by_desc_ready_cb;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
task = g_task_new (context, cancellable, callback, user_data);
|
|
Packit |
3ff832 |
g_task_set_source_tag (task, bus_input_context_set_engine_by_desc);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (g_cancellable_is_cancelled (cancellable)) {
|
|
Packit |
3ff832 |
g_task_return_new_error (task,
|
|
Packit |
3ff832 |
G_IO_ERROR,
|
|
Packit |
3ff832 |
G_IO_ERROR_CANCELLED,
|
|
Packit |
3ff832 |
"Operation was cancelled");
|
|
Packit |
3ff832 |
g_object_unref (task);
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
data = g_slice_new0 (SetEngineByDescData);
|
|
Packit |
3ff832 |
context->data = data;
|
|
Packit |
3ff832 |
data->context = context;
|
|
Packit |
3ff832 |
g_object_ref (context);
|
|
Packit |
3ff832 |
data->task = task;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (cancellable != NULL) {
|
|
Packit |
3ff832 |
data->origin_cancellable = cancellable;
|
|
Packit |
3ff832 |
g_object_ref (cancellable);
|
|
Packit |
3ff832 |
data->cancelled_handler_id =
|
|
Packit |
3ff832 |
g_cancellable_connect (data->origin_cancellable,
|
|
Packit |
3ff832 |
(GCallback) set_engine_by_desc_cancelled_cb,
|
|
Packit |
3ff832 |
data,
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
data->cancellable = g_cancellable_new ();
|
|
Packit |
3ff832 |
/* We can cancel the bus_engine_proxy_new() call by data->cancellable;
|
|
Packit |
3ff832 |
* See cancel_set_engine_by_desc() and set_engine_by_desc_cancelled_cb(). */
|
|
Packit |
3ff832 |
bus_engine_proxy_new (desc,
|
|
Packit |
3ff832 |
timeout,
|
|
Packit |
3ff832 |
data->cancellable,
|
|
Packit |
3ff832 |
(GAsyncReadyCallback) new_engine_cb,
|
|
Packit |
3ff832 |
data);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
gboolean
|
|
Packit |
3ff832 |
bus_input_context_set_engine_by_desc_finish (BusInputContext *context,
|
|
Packit |
3ff832 |
GAsyncResult *res,
|
|
Packit |
3ff832 |
GError **error)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GTask *task;
|
|
Packit |
3ff832 |
gboolean had_error;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
g_assert (g_task_is_valid (res, context));
|
|
Packit |
3ff832 |
task = G_TASK (res);
|
|
Packit |
3ff832 |
g_assert (g_task_get_source_tag (task) ==
|
|
Packit |
3ff832 |
bus_input_context_set_engine_by_desc);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* g_task_propagate_error() is not a public API and
|
|
Packit |
3ff832 |
* g_task_had_error() needs to be called before
|
|
Packit |
3ff832 |
* g_task_propagate_pointer() clears task->error.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
had_error = g_task_had_error (task);
|
|
Packit |
3ff832 |
g_task_propagate_pointer (task, error);
|
|
Packit |
3ff832 |
if (had_error)
|
|
Packit |
3ff832 |
return FALSE;
|
|
Packit |
3ff832 |
return TRUE;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
BusEngineProxy *
|
|
Packit |
3ff832 |
bus_input_context_get_engine (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
return context->engine;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
IBusEngineDesc *
|
|
Packit |
3ff832 |
bus_input_context_get_engine_desc (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
if (context->engine)
|
|
Packit |
3ff832 |
return bus_engine_proxy_get_desc (context->engine);
|
|
Packit |
3ff832 |
return NULL;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
guint
|
|
Packit |
3ff832 |
bus_input_context_get_capabilities (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
return context->capabilities;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_set_capabilities (BusInputContext *context,
|
|
Packit |
3ff832 |
guint capabilities)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* If the context does not support IBUS_CAP_FOCUS, then the client application have to handle all information such as
|
|
Packit |
3ff832 |
* preedit and auxiliary text. */
|
|
Packit |
3ff832 |
if ((capabilities & IBUS_CAP_FOCUS) == 0) {
|
|
Packit |
3ff832 |
capabilities |= (IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_AUXILIARY_TEXT | IBUS_CAP_LOOKUP_TABLE | IBUS_CAP_PROPERTY);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->capabilities != capabilities) {
|
|
Packit |
3ff832 |
context->capabilities = capabilities;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/* If the context does not support IBUS_CAP_FOCUS, then we always assume
|
|
Packit |
3ff832 |
* it has focus. */
|
|
Packit |
3ff832 |
if ((capabilities & IBUS_CAP_FOCUS) == 0) {
|
|
Packit |
3ff832 |
bus_input_context_focus_in (context);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->engine) {
|
|
Packit |
3ff832 |
bus_engine_proxy_set_capabilities (context->engine, capabilities);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->capabilities = capabilities;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
const gchar *
|
|
Packit |
3ff832 |
bus_input_context_get_client (BusInputContext *context)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
return context->client;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_get_content_type (BusInputContext *context,
|
|
Packit |
3ff832 |
guint *purpose,
|
|
Packit |
3ff832 |
guint *hints)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
g_return_if_fail (purpose != NULL && hints != NULL);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
*purpose = context->purpose;
|
|
Packit |
3ff832 |
*hints = context->hints;
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_set_content_type (BusInputContext *context,
|
|
Packit |
3ff832 |
guint purpose,
|
|
Packit |
3ff832 |
guint hints)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
GVariant *value;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
value = g_variant_ref_sink (g_variant_new ("(uu)", purpose, hints));
|
|
Packit |
3ff832 |
_ic_set_content_type (context, value);
|
|
Packit |
3ff832 |
g_variant_unref (value);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_commit_text_use_extension (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
gboolean use_extension)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (text == text_empty || text == NULL)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (use_extension && context->emoji_extension) {
|
|
Packit |
3ff832 |
bus_panel_proxy_commit_text_received (context->emoji_extension, text);
|
|
Packit |
3ff832 |
} else {
|
|
Packit |
3ff832 |
GVariant *variant = ibus_serializable_serialize (
|
|
Packit |
3ff832 |
(IBusSerializable *)text);
|
|
Packit |
3ff832 |
bus_input_context_emit_signal (context,
|
|
Packit |
3ff832 |
"CommitText",
|
|
Packit |
3ff832 |
g_variant_new ("(v)", variant),
|
|
Packit |
3ff832 |
NULL);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_commit_text (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusText *text)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
bus_input_context_commit_text_use_extension (context, text, TRUE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_update_preedit_text (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusText *text,
|
|
Packit |
3ff832 |
guint cursor_pos,
|
|
Packit |
3ff832 |
gboolean visible,
|
|
Packit |
3ff832 |
guint mode,
|
|
Packit |
3ff832 |
gboolean use_extension)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
gboolean extension_visible = FALSE;
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->preedit_text) {
|
|
Packit |
3ff832 |
g_object_unref (context->preedit_text);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
context->preedit_text = (IBusText *) g_object_ref_sink (text ? text :
|
|
Packit |
3ff832 |
text_empty);
|
|
Packit |
3ff832 |
context->preedit_cursor_pos = cursor_pos;
|
|
Packit |
3ff832 |
if (use_extension)
|
|
Packit |
3ff832 |
context->preedit_visible = visible;
|
|
Packit |
3ff832 |
if (use_extension)
|
|
Packit |
3ff832 |
context->preedit_mode = mode;
|
|
Packit |
3ff832 |
extension_visible = context->preedit_visible |
|
|
Packit |
3ff832 |
(context->emoji_extension != NULL);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (use_extension && context->emoji_extension) {
|
|
Packit |
3ff832 |
bus_panel_proxy_update_preedit_text (context->emoji_extension,
|
|
Packit |
3ff832 |
context->preedit_text,
|
|
Packit |
3ff832 |
context->preedit_cursor_pos,
|
|
Packit |
3ff832 |
context->preedit_visible);
|
|
Packit |
3ff832 |
} else if (PREEDIT_CONDITION) {
|
|
Packit |
3ff832 |
GVariant *variant = ibus_serializable_serialize (
|
|
Packit |
3ff832 |
(IBusSerializable *)context->preedit_text);
|
|
rpm-build |
f2146a |
if (context->client_commit_preedit) {
|
|
rpm-build |
f2146a |
bus_input_context_emit_signal (
|
|
rpm-build |
f2146a |
context,
|
|
rpm-build |
f2146a |
"UpdatePreeditTextWithMode",
|
|
rpm-build |
f2146a |
g_variant_new ("(vubu)",
|
|
rpm-build |
f2146a |
variant,
|
|
rpm-build |
f2146a |
context->preedit_cursor_pos,
|
|
rpm-build |
f2146a |
extension_visible,
|
|
rpm-build |
f2146a |
context->preedit_mode),
|
|
rpm-build |
f2146a |
NULL);
|
|
rpm-build |
f2146a |
} else {
|
|
rpm-build |
f2146a |
bus_input_context_emit_signal (
|
|
rpm-build |
f2146a |
context,
|
|
rpm-build |
f2146a |
"UpdatePreeditText",
|
|
rpm-build |
f2146a |
g_variant_new ("(vub)",
|
|
rpm-build |
f2146a |
variant,
|
|
rpm-build |
f2146a |
context->preedit_cursor_pos,
|
|
rpm-build |
f2146a |
extension_visible),
|
|
rpm-build |
f2146a |
NULL);
|
|
rpm-build |
f2146a |
}
|
|
Packit |
3ff832 |
} else {
|
|
Packit |
3ff832 |
g_signal_emit (context,
|
|
Packit |
3ff832 |
context_signals[UPDATE_PREEDIT_TEXT],
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
context->preedit_text,
|
|
Packit |
3ff832 |
context->preedit_cursor_pos,
|
|
Packit |
3ff832 |
extension_visible);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_set_emoji_extension (BusInputContext *context,
|
|
Packit |
3ff832 |
BusPanelProxy *emoji_extension)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (context->emoji_extension)
|
|
Packit |
3ff832 |
g_object_unref (context->emoji_extension);
|
|
Packit |
3ff832 |
context->emoji_extension = emoji_extension;
|
|
Packit |
3ff832 |
if (emoji_extension) {
|
|
Packit |
3ff832 |
g_object_ref (context->emoji_extension);
|
|
Packit |
3ff832 |
if (!context->connection)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
bus_input_context_show_preedit_text (context, TRUE);
|
|
Packit |
3ff832 |
bus_panel_proxy_set_cursor_location (context->emoji_extension,
|
|
Packit |
3ff832 |
context->x,
|
|
Packit |
3ff832 |
context->y,
|
|
Packit |
3ff832 |
context->w,
|
|
Packit |
3ff832 |
context->h);
|
|
Packit |
3ff832 |
} else {
|
|
Packit |
3ff832 |
if (!context->connection)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
/* https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/113
|
|
Packit |
3ff832 |
* Cannot use bus_input_context_hide_preedit_text () yet.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
if (!context->preedit_visible) {
|
|
Packit |
3ff832 |
bus_input_context_update_preedit_text (context,
|
|
Packit |
3ff832 |
text_empty,
|
|
Packit |
3ff832 |
0,
|
|
Packit |
3ff832 |
FALSE,
|
|
Packit |
3ff832 |
IBUS_ENGINE_PREEDIT_CLEAR,
|
|
Packit |
3ff832 |
FALSE);
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
}
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
void
|
|
Packit |
3ff832 |
bus_input_context_panel_extension_received (BusInputContext *context,
|
|
Packit |
3ff832 |
IBusExtensionEvent *event)
|
|
Packit |
3ff832 |
{
|
|
Packit |
3ff832 |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
if (!context->engine)
|
|
Packit |
3ff832 |
return;
|
|
Packit |
3ff832 |
bus_engine_proxy_panel_extension_received (context->engine, event);
|
|
Packit |
3ff832 |
}
|