~ubuntu-branches/ubuntu/quantal/ibus/quantal

« back to all changes in this revision

Viewing changes to client/x11/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry Warsaw
  • Date: 2011-08-11 17:00:57 UTC
  • mfrom: (6.2.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110811170057-6dmbfs4s3cchzl7x
Tags: 1.3.99.20110419-1ubuntu1
* Merge with Debian unstable.  Remaining Ubuntu changes:
  - Indicator support:
    + Add 05_appindicator.patch: Use an indicator rather than a notification
      icon.
    + debian/control: Recommend python-appindicator.
  - debian/control: Install im-switch instead of im-config by default.
  - debian/README.source: Removed, it was outdated and no longer correct
  - debian/patches/01_ubuntu_desktop: Fix "Desktop entry needs the
    X-Ubuntu-Gettext-Domain key"  (LP: #457632)
  - debian/patches/02_title_update.patch: Rename "IBus Preferences" to
    "Keyboard Input Methods"
  - debian/patches/06_locale_parser.patch: Cherry-picked from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
    text.feedback = feedback;
246
246
 
247
247
    if (len > 0) {
248
 
        Xutf8TextListToTextProperty (GDK_DISPLAY (), (char **)&preedit_string, 1, XCompoundTextStyle, &tp);
 
248
        Xutf8TextListToTextProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
 
249
                                     (char **)&preedit_string,
 
250
                                     1, XCompoundTextStyle, &tp);
249
251
        text.encoding_is_wchar = 0;
250
252
        text.length = strlen ((char*)tp.value);
251
253
        text.string.multi_byte = (char*)tp.value;
384
386
    g_return_val_if_fail (x11ic != NULL, 0);
385
387
 
386
388
    if (x11ic->context) {
387
 
        ibus_object_destroy ((IBusObject *)x11ic->context);
 
389
        ibus_proxy_destroy ((IBusProxy *)x11ic->context);
388
390
        g_object_unref (x11ic->context);
389
391
        x11ic->context = NULL;
390
392
    }
468
470
    if (event.type == GDK_KEY_RELEASE) {
469
471
        event.state |= IBUS_RELEASE_MASK;
470
472
    }
471
 
 
472
473
    retval = ibus_input_context_process_key_event (x11ic->context,
473
474
                                                   event.keyval,
474
475
                                                   event.hardware_keycode - 8,
525
526
    g_return_if_fail (x11ic != NULL);
526
527
 
527
528
    g_free (x11ic->preedit_string);
 
529
    x11ic->preedit_string = NULL;
528
530
 
529
531
    if (x11ic->preedit_attrs) {
530
532
        g_object_unref (x11ic->preedit_attrs);
532
534
    }
533
535
 
534
536
    if (x11ic->context) {
535
 
        ibus_object_destroy ((IBusObject *)x11ic->context);
 
537
        ibus_proxy_destroy ((IBusProxy *)x11ic->context);
536
538
        g_object_unref (x11ic->context);
537
539
        x11ic->context = NULL;
538
540
    }
583
585
        XWindowAttributes xwa;
584
586
        Window child;
585
587
 
586
 
        XGetWindowAttributes (GDK_DISPLAY(), w, &xwa);
 
588
        XGetWindowAttributes (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), w, &xwa);
587
589
        if (preedit_area.x <= 0 && preedit_area.y <= 0) {
588
 
             XTranslateCoordinates (GDK_DISPLAY(), w,
 
590
             XTranslateCoordinates (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), w,
589
591
                xwa.root,
590
592
                0,
591
593
                xwa.height,
594
596
                &child);
595
597
        }
596
598
        else {
597
 
            XTranslateCoordinates (GDK_DISPLAY(), w,
 
599
            XTranslateCoordinates (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), w,
598
600
                xwa.root,
599
601
                preedit_area.x,
600
602
                preedit_area.y,
739
741
    xkp.xkey.serial = 0L;
740
742
    xkp.xkey.send_event = False;
741
743
    xkp.xkey.same_screen = True;
742
 
    xkp.xkey.display = GDK_DISPLAY();
 
744
    xkp.xkey.display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
743
745
    xkp.xkey.window =
744
746
        x11ic->focus_window ? x11ic->focus_window : x11ic->client_window;
745
747
    xkp.xkey.subwindow = None;
746
 
    xkp.xkey.root = DefaultRootWindow (GDK_DISPLAY());
 
748
    xkp.xkey.root = DefaultRootWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
747
749
 
748
750
    xkp.xkey.time = 0;
749
751
    xkp.xkey.state = state;
781
783
    XTextProperty tp;
782
784
    IMCommitStruct cms = {0};
783
785
 
784
 
    Xutf8TextListToTextProperty (GDK_DISPLAY (),
 
786
    Xutf8TextListToTextProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
785
787
        (gchar **)&(text->text), 1, XCompoundTextStyle, &tp);
786
788
 
787
789
    cms.major_code = XIM_COMMIT;
961
963
        sizeof (ims_encodings)/sizeof (XIMEncoding) - 1;
962
964
    encodings.supported_encodings = ims_encodings;
963
965
 
964
 
    _xims = IMOpenIM(GDK_DISPLAY(),
 
966
    _xims = IMOpenIM(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
965
967
        IMModifiers, "Xi18n",
966
968
        IMServerWindow, GDK_WINDOW_XWINDOW(win),
967
969
        IMServerName, _server_name != NULL ? _server_name : "ibus",