65
/* IBusInputContextPriv */
66
struct _BusInputContextPrivate {
67
BusConnection *connection;
68
BusEngineProxy *engine;
88
IBusText *preedit_text;
89
guint preedit_cursor_pos;
90
gboolean preedit_visible;
93
IBusText *auxiliary_text;
94
gboolean auxiliary_visible;
97
IBusLookupTable *lookup_table;
98
gboolean lookup_table_visible;
101
gboolean filter_release;
105
61
typedef struct _BusInputContextPrivate BusInputContextPrivate;
107
63
static guint context_signals[LAST_SIGNAL] = { 0 };
229
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
232
186
ibus_service_add_to_connection (IBUS_SERVICE (context),
233
187
IBUS_CONNECTION (connection));
236
190
g_object_ref (connection);
237
priv->connection = connection;
238
priv->client = g_strdup (client);
191
context->connection = connection;
192
context->client = g_strdup (client);
240
g_signal_connect (priv->connection,
194
g_signal_connect (context->connection,
242
196
(GCallback) _connection_destroy_cb,
526
478
bus_input_context_init (BusInputContext *context)
528
BusInputContextPrivate *priv;
529
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
531
priv->connection = NULL;
534
priv->has_focus = FALSE;
535
priv->enabled = FALSE;
537
priv->prev_keyval = IBUS_VoidSymbol;
538
priv->prev_modifiers = 0;
540
priv->capabilities = 0;
547
g_object_ref (text_empty);
548
priv->preedit_text = text_empty;
549
priv->preedit_cursor_pos = 0;
550
priv->preedit_visible = FALSE;
552
g_object_ref (text_empty);
553
priv->auxiliary_text = text_empty;
554
priv->auxiliary_visible = FALSE;
480
context->connection = NULL;
481
context->client = NULL;
482
context->engine = NULL;
483
context->has_focus = FALSE;
484
context->enabled = FALSE;
486
context->prev_keyval = IBUS_VoidSymbol;
487
context->prev_modifiers = 0;
489
context->capabilities = 0;
496
g_object_ref (text_empty);
497
context->preedit_text = text_empty;
498
context->preedit_cursor_pos = 0;
499
context->preedit_visible = FALSE;
501
g_object_ref (text_empty);
502
context->auxiliary_text = text_empty;
503
context->auxiliary_visible = FALSE;
556
505
g_object_ref (lookup_table_empty);
557
priv->lookup_table = lookup_table_empty;
558
priv->lookup_table_visible = FALSE;
506
context->lookup_table = lookup_table_empty;
507
context->lookup_table_visible = FALSE;
560
509
g_object_ref (props_empty);
564
513
bus_input_context_destroy (BusInputContext *context)
566
BusInputContextPrivate *priv;
567
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
569
if (priv->has_focus) {
515
if (context->has_focus) {
570
516
bus_input_context_focus_out (context);
571
priv->has_focus = FALSE;
517
context->has_focus = FALSE;
520
if (context->engine) {
575
521
bus_input_context_unset_engine (context);
578
if (priv->preedit_text) {
579
g_object_unref (priv->preedit_text);
580
priv->preedit_text = NULL;
583
if (priv->auxiliary_text) {
584
g_object_unref (priv->auxiliary_text);
585
priv->auxiliary_text = NULL;
588
if (priv->lookup_table) {
589
g_object_unref (priv->lookup_table);
590
priv->lookup_table = NULL;
593
if (priv->connection) {
594
g_signal_handlers_disconnect_by_func (priv->connection,
524
if (context->preedit_text) {
525
g_object_unref (context->preedit_text);
526
context->preedit_text = NULL;
529
if (context->auxiliary_text) {
530
g_object_unref (context->auxiliary_text);
531
context->auxiliary_text = NULL;
534
if (context->lookup_table) {
535
g_object_unref (context->lookup_table);
536
context->lookup_table = NULL;
539
if (context->connection) {
540
g_signal_handlers_disconnect_by_func (context->connection,
595
541
(GCallback) _connection_destroy_cb,
597
g_object_unref (priv->connection);
598
priv->connection = NULL;
543
g_object_unref (context->connection);
544
context->connection = NULL;
602
g_free (priv->client);
547
if (context->client) {
548
g_free (context->client);
549
context->client = NULL;
606
552
IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (context));
620
566
" <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"
622
568
" </interface>\n"
623
" <interface name=\"org.freedesktop.IBus\">\n"
624
" <method name=\"RequestName\">\n"
625
" <arg direction=\"in\" type=\"s\"/>\n"
626
" <arg direction=\"in\" type=\"u\"/>\n"
627
" <arg direction=\"out\" type=\"u\"/>\n"
629
" <signal name=\"NameOwnerChanged\">\n"
630
" <arg type=\"s\"/>\n"
631
" <arg type=\"s\"/>\n"
632
" <arg type=\"s\"/>\n"
569
" <interface name=\"org.freedesktop.IBus.InputContext\">\n"
572
" <method name=\"ProcessKeyEvent\">\n"
573
" <arg name=\"keyval\" direction=\"in\" type=\"u\"/>\n"
574
" <arg name=\"keycode\" direction=\"in\" type=\"u\"/>\n"
575
" <arg name=\"state\" direction=\"in\" type=\"u\"/>\n"
576
" <arg name=\"handled\" direction=\"out\" type=\"b\"/>\n"
578
" <method name=\"SetCursorLocation\">\n"
579
" <arg name=\"x\" direction=\"in\" type=\"i\"/>\n"
580
" <arg name=\"y\" direction=\"in\" type=\"i\"/>\n"
581
" <arg name=\"w\" direction=\"in\" type=\"i\"/>\n"
582
" <arg name=\"h\" direction=\"in\" type=\"i\"/>\n"
584
" <method name=\"FocusIn\"/>\n"
585
" <method name=\"FocusOut\"/>\n"
586
" <method name=\"Reset\"/>\n"
587
" <method name=\"Enable\"/>\n"
588
" <method name=\"Disable\"/>\n"
589
" <method name=\"IsEnabled\">\n"
590
" <arg name=\"enable\" direction=\"out\" type=\"b\"/>\n"
592
" <method name=\"SetCapabilities\">\n"
593
" <arg name=\"caps\" direction=\"in\" type=\"u\"/>\n"
595
" <method name=\"SetEngine\">\n"
596
" <arg name=\"name\" direction=\"in\" type=\"s\"/>\n"
598
" <method name=\"GetEngine\">\n"
599
" <arg name=\"desc\" direction=\"out\" type=\"v\"/>\n"
601
" <method name=\"Destroy\"/>\n"
604
" <signal name=\"CommitText\">\n"
605
" <arg name=\"text\" type=\"v\"/>\n"
607
" <signal name=\"Enabled\"/>\n"
608
" <signal name=\"Disabled\"/>\n"
609
" <signal name=\"ForwardKeyEvent\">\n"
610
" <arg name=\"keyval\" type=\"u\"/>\n"
611
" <arg name=\"keycode\" type=\"u\"/>\n"
612
" <arg name=\"state\" type=\"u\"/>\n"
615
" <signal name=\"UpdatePreeditText\">\n"
616
" <arg name=\"text\" type=\"v\"/>\n"
617
" <arg name=\"cursor_pos\" type=\"u\"/>\n"
618
" <arg name=\"visible\" type=\"b\"/>\n"
620
" <signal name=\"ShowPreeditText\"/>\n"
621
" <signal name=\"HidePreeditText\"/>\n"
623
" <signal name=\"UpdateAuxiliaryText\">\n"
624
" <arg name=\"text\" type=\"v\"/>\n"
625
" <arg name=\"visible\" type=\"b\"/>\n"
627
" <signal name=\"ShowAuxiliaryText\"/>\n"
628
" <signal name=\"HideAuxiliaryText\"/>\n"
630
" <signal name=\"UpdateLookupTable\">\n"
631
" <arg name=\"table\" type=\"v\"/>\n"
632
" <arg name=\"visible\" type=\"b\"/>\n"
634
" <signal name=\"ShowLookupTable\"/>\n"
635
" <signal name=\"HideLookupTable\"/>\n"
636
" <signal name=\"PageUpLookupTable\"/>\n"
637
" <signal name=\"PageDownLookupTable\"/>\n"
638
" <signal name=\"CursorUpLookupTable\"/>\n"
639
" <signal name=\"CursorDownLookupTable\"/>\n"
641
" <signal name=\"RegisterProperties\">\n"
642
" <arg name=\"props\" type=\"v\"/>\n"
644
" <signal name=\"UpdateProperty\">\n"
645
" <arg name=\"prop\" type=\"v\"/>\n"
634
648
" </interface>\n"
659
673
retval = (gboolean) GPOINTER_TO_INT (data);
660
674
call_data = (CallData *) user_data;
662
BusInputContextPrivate *priv;
663
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (call_data->context);
666
676
reply = ibus_message_new_method_return (call_data->message);
667
677
ibus_message_append_args (reply,
668
678
G_TYPE_BOOLEAN, &retval,
670
ibus_connection_send ((IBusConnection *)priv->connection, reply);
681
ibus_connection_send ((IBusConnection *)call_data->context->connection, reply);
672
683
g_object_unref (call_data->context);
673
684
ibus_message_unref (call_data->message);
678
689
static IBusMessage *
679
_ic_process_key_event (BusInputContext *context,
680
IBusMessage *message,
681
BusConnection *connection)
690
_ic_process_key_event (BusInputContext *context,
691
IBusMessage *message,
692
BusConnection *connection)
683
694
g_assert (BUS_IS_INPUT_CONTEXT (context));
684
695
g_assert (message != NULL);
685
696
g_assert (BUS_IS_CONNECTION (connection));
687
698
IBusMessage *reply = NULL;
688
guint keyval, modifiers;
699
guint keyval, keycode, modifiers;
690
701
IBusError *error;
692
BusInputContextPrivate *priv;
693
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
695
703
retval = ibus_message_get_args (message,
697
705
G_TYPE_UINT, &keyval,
706
G_TYPE_UINT, &keycode,
698
707
G_TYPE_UINT, &modifiers,
709
retval = bus_input_context_filter_keyboard_shortcuts (context, keyval, modifiers);
718
retval = bus_input_context_filter_keyboard_shortcuts (context, keyval, keycode, modifiers);
712
priv->filter_release = TRUE;
713
721
reply = ibus_message_new_method_return (message);
714
722
ibus_message_append_args (reply,
715
723
G_TYPE_BOOLEAN, &retval,
718
else if (priv->enabled && priv->engine) {
726
else if (context->enabled && context->engine) {
719
727
CallData *call_data;
721
729
call_data = g_slice_new (CallData);
1138
1124
g_assert (BUS_IS_INPUT_CONTEXT (context));
1140
BusInputContextPrivate *priv;
1141
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1143
if (priv->has_focus)
1126
if (context->has_focus)
1146
priv->has_focus = TRUE;
1129
context->has_focus = TRUE;
1148
if (priv->engine && priv->enabled) {
1149
bus_engine_proxy_focus_in (priv->engine);
1131
if (context->engine && context->enabled) {
1132
bus_engine_proxy_focus_in (context->engine);
1152
if (priv->capabilities & IBUS_CAP_FOCUS) {
1135
if (context->capabilities & IBUS_CAP_FOCUS) {
1153
1136
g_signal_emit (context, context_signals[FOCUS_IN], 0);
1155
if (priv->preedit_visible && (priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
1156
g_signal_emit (context,
1157
context_signals[UPDATE_PREEDIT_TEXT],
1160
priv->preedit_cursor_pos,
1161
priv->preedit_visible);
1163
if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
1164
g_signal_emit (context,
1165
context_signals[UPDATE_AUXILIARY_TEXT],
1167
priv->auxiliary_text,
1168
priv->auxiliary_visible);
1170
if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
1171
g_signal_emit (context,
1172
context_signals[UPDATE_LOOKUP_TABLE],
1175
priv->lookup_table_visible);
1137
if (context->engine && context->enabled) {
1138
if (context->preedit_visible && (context->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
1139
g_signal_emit (context,
1140
context_signals[UPDATE_PREEDIT_TEXT],
1142
context->preedit_text,
1143
context->preedit_cursor_pos,
1144
context->preedit_visible);
1146
if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
1147
g_signal_emit (context,
1148
context_signals[UPDATE_AUXILIARY_TEXT],
1150
context->auxiliary_text,
1151
context->auxiliary_visible);
1153
if (context->lookup_table_visible && (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
1154
g_signal_emit (context,
1155
context_signals[UPDATE_LOOKUP_TABLE],
1157
context->lookup_table,
1158
context->lookup_table_visible);
1183
1167
g_assert (BUS_IS_INPUT_CONTEXT (context));
1185
BusInputContextPrivate *priv;
1186
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1188
if (!priv->has_focus)
1169
if (!context->has_focus)
1191
priv->has_focus = FALSE;
1172
context->has_focus = FALSE;
1193
if (priv->engine && priv->enabled) {
1194
bus_engine_proxy_focus_out (priv->engine);
1174
if (context->engine && context->enabled) {
1175
bus_engine_proxy_focus_out (context->engine);
1197
if (priv->capabilities & IBUS_CAP_FOCUS) {
1198
if (priv->preedit_visible && (priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
1178
if (context->capabilities & IBUS_CAP_FOCUS) {
1179
if (context->preedit_visible && (context->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
1199
1180
g_signal_emit (context, context_signals[HIDE_PREEDIT_TEXT], 0);
1201
if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
1182
if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
1202
1183
g_signal_emit (context, context_signals[HIDE_AUXILIARY_TEXT], 0);
1204
if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
1185
if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
1205
1186
g_signal_emit (context, context_signals[HIDE_LOOKUP_TABLE], 0);
1207
1188
g_signal_emit (context, context_signals[FOCUS_OUT], 0);
1272
1245
g_assert (BUS_IS_INPUT_CONTEXT (context));
1274
BusInputContextPrivate *priv;
1275
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1277
if (priv->preedit_text) {
1278
g_object_unref (priv->preedit_text);
1247
if (context->preedit_text) {
1248
g_object_unref (context->preedit_text);
1281
priv->preedit_text = (IBusText *) g_object_ref (text ? text : text_empty);
1282
priv->preedit_cursor_pos = cursor_pos;
1283
priv->preedit_visible = visible;
1251
context->preedit_text = (IBusText *) g_object_ref (text ? text : text_empty);
1252
context->preedit_cursor_pos = cursor_pos;
1253
context->preedit_visible = visible;
1285
if (priv->capabilities & IBUS_CAP_PREEDIT_TEXT) {
1255
if (context->capabilities & IBUS_CAP_PREEDIT_TEXT) {
1286
1256
bus_input_context_send_signal (context,
1287
1257
"UpdatePreeditText",
1288
IBUS_TYPE_TEXT, &(priv->preedit_text),
1289
G_TYPE_UINT, &(priv->preedit_cursor_pos),
1290
G_TYPE_BOOLEAN, &(priv->preedit_visible),
1258
IBUS_TYPE_TEXT, &(context->preedit_text),
1259
G_TYPE_UINT, &(context->preedit_cursor_pos),
1260
G_TYPE_BOOLEAN, &(context->preedit_visible),
1291
1261
G_TYPE_INVALID);
1294
1264
g_signal_emit (context,
1295
1265
context_signals[UPDATE_PREEDIT_TEXT],
1298
priv->preedit_cursor_pos,
1299
priv->preedit_visible);
1267
context->preedit_text,
1268
context->preedit_cursor_pos,
1269
context->preedit_visible);
1306
1276
g_assert (BUS_IS_INPUT_CONTEXT (context));
1308
BusInputContextPrivate *priv;
1309
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1311
if (priv->preedit_visible) {
1278
if (context->preedit_visible) {
1315
priv->preedit_visible = TRUE;
1282
context->preedit_visible = TRUE;
1317
if ((priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
1284
if ((context->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
1318
1285
bus_input_context_send_signal (context,
1319
1286
"ShowPreeditText",
1320
1287
G_TYPE_INVALID);
1332
1299
g_assert (BUS_IS_INPUT_CONTEXT (context));
1334
BusInputContextPrivate *priv;
1335
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1337
if (!priv->preedit_visible) {
1301
if (!context->preedit_visible) {
1341
priv->preedit_visible = FALSE;
1305
context->preedit_visible = FALSE;
1343
if ((priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
1307
if ((context->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
1344
1308
bus_input_context_send_signal (context,
1345
1309
"HidePreeditText",
1346
1310
G_TYPE_INVALID);
1360
1324
g_assert (BUS_IS_INPUT_CONTEXT (context));
1362
BusInputContextPrivate *priv;
1363
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1365
if (priv->auxiliary_text) {
1366
g_object_unref (priv->auxiliary_text);
1326
if (context->auxiliary_text) {
1327
g_object_unref (context->auxiliary_text);
1369
priv->auxiliary_text = (IBusText *) g_object_ref (text ? text : text_empty);
1370
priv->auxiliary_visible = visible;
1330
context->auxiliary_text = (IBusText *) g_object_ref (text ? text : text_empty);
1331
context->auxiliary_visible = visible;
1372
if (priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) {
1333
if (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) {
1373
1334
bus_input_context_send_signal (context,
1374
1335
"UpdateAuxiliaryText",
1375
IBUS_TYPE_TEXT, &(priv->auxiliary_text),
1376
G_TYPE_BOOLEAN, &(priv->auxiliary_visible),
1336
IBUS_TYPE_TEXT, &(context->auxiliary_text),
1337
G_TYPE_BOOLEAN, &(context->auxiliary_visible),
1377
1338
G_TYPE_INVALID);
1380
1341
g_signal_emit (context,
1381
1342
context_signals[UPDATE_AUXILIARY_TEXT],
1383
priv->auxiliary_text,
1384
priv->auxiliary_visible);
1344
context->auxiliary_text,
1345
context->auxiliary_visible);
1391
1352
g_assert (BUS_IS_INPUT_CONTEXT (context));
1393
BusInputContextPrivate *priv;
1394
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1396
if (priv->auxiliary_visible) {
1354
if (context->auxiliary_visible) {
1400
priv->auxiliary_visible = TRUE;
1358
context->auxiliary_visible = TRUE;
1402
if ((priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) == IBUS_CAP_AUXILIARY_TEXT) {
1360
if ((context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == IBUS_CAP_AUXILIARY_TEXT) {
1403
1361
bus_input_context_send_signal (context,
1404
1362
"ShowAuxiliaryText",
1405
1363
G_TYPE_INVALID);
1417
1375
g_assert (BUS_IS_INPUT_CONTEXT (context));
1419
BusInputContextPrivate *priv;
1420
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1422
if (!priv->auxiliary_visible) {
1377
if (!context->auxiliary_visible) {
1426
priv->auxiliary_visible = FALSE;
1381
context->auxiliary_visible = FALSE;
1428
if ((priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) == IBUS_CAP_AUXILIARY_TEXT) {
1383
if ((context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == IBUS_CAP_AUXILIARY_TEXT) {
1429
1384
bus_input_context_send_signal (context,
1430
1385
"HideAuxiliaryText",
1431
1386
G_TYPE_INVALID);
1445
1400
g_assert (BUS_IS_INPUT_CONTEXT (context));
1447
BusInputContextPrivate *priv;
1448
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1450
if (priv->lookup_table) {
1451
g_object_unref (priv->lookup_table);
1402
if (context->lookup_table) {
1403
g_object_unref (context->lookup_table);
1454
priv->lookup_table = (IBusLookupTable *) g_object_ref (table ? table : lookup_table_empty);
1455
priv->lookup_table_visible = visible;
1406
context->lookup_table = (IBusLookupTable *) g_object_ref (table ? table : lookup_table_empty);
1407
context->lookup_table_visible = visible;
1457
if (priv->capabilities & IBUS_CAP_LOOKUP_TABLE) {
1409
if (context->capabilities & IBUS_CAP_LOOKUP_TABLE) {
1458
1410
bus_input_context_send_signal (context,
1459
1411
"UpdateLookupTable",
1460
IBUS_TYPE_LOOKUP_TABLE, &(priv->lookup_table),
1461
G_TYPE_BOOLEAN, &(priv->lookup_table_visible),
1412
IBUS_TYPE_LOOKUP_TABLE, &(context->lookup_table),
1413
G_TYPE_BOOLEAN, &(context->lookup_table_visible),
1462
1414
G_TYPE_INVALID);
1465
1417
g_signal_emit (context,
1466
1418
context_signals[UPDATE_LOOKUP_TABLE],
1469
priv->lookup_table_visible);
1420
context->lookup_table,
1421
context->lookup_table_visible);
1476
1428
g_assert (BUS_IS_INPUT_CONTEXT (context));
1478
BusInputContextPrivate *priv;
1479
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1481
if (priv->lookup_table_visible) {
1430
if (context->lookup_table_visible) {
1485
priv->lookup_table_visible = TRUE;
1434
context->lookup_table_visible = TRUE;
1487
if ((priv->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
1436
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
1488
1437
bus_input_context_send_signal (context,
1489
1438
"ShowLookupTable",
1490
1439
G_TYPE_INVALID);
1502
1451
g_assert (BUS_IS_INPUT_CONTEXT (context));
1504
BusInputContextPrivate *priv;
1505
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1507
if (!priv->lookup_table_visible) {
1453
if (!context->lookup_table_visible) {
1511
priv->lookup_table_visible = FALSE;
1457
context->lookup_table_visible = FALSE;
1513
if ((priv->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
1459
if ((context->capabilities & IBUS_CAP_LOOKUP_TABLE) == IBUS_CAP_LOOKUP_TABLE) {
1514
1460
bus_input_context_send_signal (context,
1515
1461
"HideLookupTable",
1516
1462
G_TYPE_INVALID);
1707
1629
_engine_forward_key_event_cb (BusEngineProxy *engine,
1710
1633
BusInputContext *context)
1712
1635
g_assert (BUS_IS_ENGINE_PROXY (engine));
1713
1636
g_assert (BUS_IS_INPUT_CONTEXT (context));
1715
BusInputContextPrivate *priv;
1716
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1718
g_assert (priv->engine == engine);
1638
g_assert (context->engine == engine);
1720
1640
bus_input_context_send_signal (context,
1721
1641
"ForwardKeyEvent",
1722
1642
G_TYPE_UINT, &keyval,
1643
G_TYPE_UINT, &keycode,
1723
1644
G_TYPE_UINT, &state,
1724
1645
G_TYPE_INVALID);
1848
1751
g_assert (BUS_IS_INPUT_CONTEXT (context));
1850
BusInputContextPrivate *priv;
1851
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1853
if (priv->engine == NULL) {
1753
if (context->engine == NULL) {
1854
1754
g_signal_emit (context, context_signals[REQUEST_ENGINE], 0, NULL);
1857
if (priv->engine == NULL)
1757
if (context->engine == NULL)
1860
priv->enabled = TRUE;
1760
context->enabled = TRUE;
1862
bus_engine_proxy_enable (priv->engine);
1762
bus_engine_proxy_enable (context->engine);
1863
1763
bus_input_context_send_signal (context,
1865
1765
G_TYPE_INVALID);
1866
1766
g_signal_emit (context,
1867
1767
context_signals[ENABLED],
1869
if (priv->has_focus) {
1870
bus_engine_proxy_focus_in (priv->engine);
1769
if (context->has_focus) {
1770
bus_engine_proxy_focus_in (context->engine);
1938
1832
g_assert (BUS_IS_INPUT_CONTEXT (context));
1940
BusInputContextPrivate *priv;
1941
priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
1943
1834
bus_input_context_register_properties (context, props_empty);
1944
1835
bus_input_context_update_preedit_text (context, text_empty, 0, FALSE);
1945
1836
bus_input_context_update_auxiliary_text (context, text_empty, FALSE);
1946
1837
bus_input_context_update_lookup_table (context, lookup_table_empty, FALSE);
1839
if (context->engine) {
1950
1841
for (i = 0; signals[i].name != NULL; i++) {
1951
g_signal_handlers_disconnect_by_func (priv->engine, signals[i].callback, context);
1842
g_signal_handlers_disconnect_by_func (context->engine, signals[i].callback, context);
1953
1844
/* we destroy the engine */
1954
ibus_object_destroy ((IBusObject *) priv->engine);
1955
g_object_unref (priv->engine);
1956
priv->engine = NULL;
1845
ibus_object_destroy ((IBusObject *) context->engine);
1846
g_object_unref (context->engine);
1847
context->engine = NULL;
1979
priv->engine = engine;
1980
g_object_ref (priv->engine);
1867
context->engine = engine;
1868
g_object_ref (context->engine);
1982
1870
for (i = 0; signals[i].name != NULL; i++) {
1983
g_signal_connect (priv->engine,
1871
g_signal_connect (context->engine,
1984
1872
signals[i].name,
1985
1873
signals[i].callback,
1988
bus_engine_proxy_set_cursor_location (priv->engine, priv->x, priv->y, priv->w, priv->h);
1989
if (priv->enabled) {
1990
bus_engine_proxy_enable (priv->engine);
1991
if (priv->has_focus) {
1992
bus_engine_proxy_focus_in (priv->engine);
1876
bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
1877
if (context->enabled) {
1878
bus_engine_proxy_enable (context->engine);
1879
if (context->has_focus) {
1880
bus_engine_proxy_focus_in (context->engine);
1913
if (keycode != 0 && !BUS_DEFAULT_IBUS->use_sys_layout) {
1914
IBusKeymap *keymap = BUS_DEFAULT_KEYMAP;
1915
if (keymap != NULL) {
1916
guint tmp = ibus_keymap_lookup_keysym (keymap,
1919
if (tmp != IBUS_VoidSymbol)
2030
1924
if (trigger == 0) {
2031
1925
trigger = g_quark_from_static_string ("trigger");
2032
1926
next_factory = g_quark_from_static_string ("next-engine");
2033
1927
prev_factory = g_quark_from_static_string ("prev-engine");
2036
if (priv->filter_release){
1930
if (context->filter_release){
2037
1931
if(modifiers & IBUS_RELEASE_MASK) {
2038
1932
/* filter release key event */
2042
1936
/* stop filter release key event */
2043
priv->filter_release = FALSE;
1937
context->filter_release = FALSE;
2047
1941
event = ibus_hotkey_profile_filter_key_event (BUS_DEFAULT_HOTKEY_PROFILE,
2051
priv->prev_modifiers,
1944
context->prev_keyval,
1945
context->prev_modifiers,
2053
priv->prev_keyval = keyval;
2054
priv->prev_modifiers = modifiers;
1947
context->prev_keyval = keyval;
1948
context->prev_modifiers = modifiers;
2056
1950
if (event == trigger) {
2057
gboolean enabled = priv->enabled;
1951
gboolean enabled = context->enabled;
2059
if (priv->enabled) {
1953
if (context->enabled) {
2060
1954
bus_input_context_disable (context);
2063
1957
bus_input_context_enable (context);
2066
retval = (enabled != priv->enabled);
1960
retval = (enabled != context->enabled);
2068
1962
else if (event == next_factory) {
2069
if (priv->engine == NULL || priv->enabled == FALSE) {
1963
if (context->engine == NULL || context->enabled == FALSE) {
2070
1964
retval = FALSE;