~ubuntu-branches/ubuntu/trusty/gnome-shell/trusty-proposed

« back to all changes in this revision

Viewing changes to js/ui/keyboard.js

Tags: upstream-3.3.90
ImportĀ upstreamĀ versionĀ 3.3.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    'Alt_L': 'Alt'
40
40
};
41
41
 
42
 
const CaribouKeyboardIface = {
43
 
    name: 'org.gnome.Caribou.Keyboard',
44
 
    methods:    [ { name: 'Show',
45
 
                    inSignature: 'u',
46
 
                    outSignature: ''
47
 
                  },
48
 
                  { name: 'Hide',
49
 
                    inSignature: 'u',
50
 
                    outSignature: ''
51
 
                  },
52
 
                  { name: 'SetCursorLocation',
53
 
                    inSignature: 'iiii',
54
 
                    outSignature: ''
55
 
                  },
56
 
                  { name: 'SetEntryLocation',
57
 
                    inSignature: 'iiii',
58
 
                    outSignature: ''
59
 
                  } ],
60
 
    properties: [ { name: 'Name',
61
 
                    signature: 's',
62
 
                    access: 'read' } ]
63
 
};
64
 
 
65
 
function Key() {
66
 
    this._init.apply(this, arguments);
67
 
}
68
 
 
69
 
Key.prototype = {
 
42
const CaribouKeyboardIface = <interface name='org.gnome.Caribou.Keyboard'>
 
43
<method name='Show'>
 
44
    <arg type='u' direction='in' />
 
45
</method>
 
46
<method name='Hide'>
 
47
    <arg type='u' direction='in' />
 
48
</method>
 
49
<method name='SetCursorLocation'>
 
50
    <arg type='i' direction='in' />
 
51
    <arg type='i' direction='in' />
 
52
    <arg type='i' direction='in' />
 
53
    <arg type='i' direction='in' />
 
54
</method>
 
55
<method name='SetEntryLocation'>
 
56
    <arg type='i' direction='in' />
 
57
    <arg type='i' direction='in' />
 
58
    <arg type='i' direction='in' />
 
59
    <arg type='i' direction='in' />
 
60
</method>
 
61
<property name='Name' access='read' type='s' />
 
62
</interface>;
 
63
 
 
64
const Key = new Lang.Class({
 
65
    Name: 'Key',
 
66
 
70
67
    _init : function(key) {
71
68
        this._key = key;
72
69
 
192
189
            this._boxPointer.hide(true);
193
190
        }
194
191
    }
195
 
};
196
 
 
197
 
function Keyboard() {
198
 
    this._init.apply(this, arguments);
199
 
}
200
 
 
201
 
Keyboard.prototype = {
 
192
});
 
193
 
 
194
const Keyboard = new Lang.Class({
 
195
    // HACK: we can't set Name, because it collides with Name dbus property
 
196
    // Name: 'Keyboard',
 
197
 
202
198
    _init: function () {
203
 
        DBus.session.exportObject('/org/gnome/Caribou/Keyboard', this);
 
199
        this._impl = Gio.DBusExportedObject.wrapJSObject(CaribouKeyboardIface, this);
 
200
        this._impl.export(Gio.DBus.session, '/org/gnome/Caribou/Keyboard');
204
201
 
205
202
        this.actor = null;
206
203
 
289
286
        if (focus && (focus._extended_keys || (focus._key && focus._key.extended_key)))
290
287
            return;
291
288
 
292
 
        let time = global.current_event_time();
 
289
        let time = global.get_current_time();
293
290
        if (focus instanceof Clutter.Text)
294
291
            this.Show(time);
295
292
        else
532
529
    get Name() {
533
530
        return 'gnome-shell';
534
531
    }
535
 
};
536
 
DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface);
537
 
 
538
 
function KeyboardSource() {
539
 
    this._init.apply(this, arguments);
540
 
}
541
 
 
542
 
KeyboardSource.prototype = {
543
 
    __proto__: MessageTray.Source.prototype,
 
532
});
 
533
 
 
534
const KeyboardSource = new Lang.Class({
 
535
    Name: 'KeyboardSource',
 
536
    Extends: MessageTray.Source,
544
537
 
545
538
    _init: function(keyboard) {
 
539
        this.parent(_("Keyboard"));
546
540
        this._keyboard = keyboard;
547
 
        MessageTray.Source.prototype._init.call(this, _("Keyboard"));
548
541
 
549
542
        this._setSummaryIcon(this.createNotificationIcon());
550
543
    },
555
548
                             icon_size: this.ICON_SIZE });
556
549
    },
557
550
 
558
 
     handleSummaryClick: function() {
 
551
    handleSummaryClick: function() {
559
552
        let event = Clutter.get_current_event();
560
553
        if (event.type() != Clutter.EventType.BUTTON_RELEASE)
561
554
            return false;
567
560
    open: function() {
568
561
        this._keyboard.show();
569
562
    }
570
 
};
 
563
});