keyboard: respect "center" alignment of keys

https://bugzilla.gnome.org/show_bug.cgi?id=679925
This commit is contained in:
Daiki Ueno 2012-08-20 12:22:37 +09:00
parent 5f95351074
commit 32e8a9b377

View File

@ -302,18 +302,27 @@ const Keyboard = new Lang.Class({
let keyboard_row = new St.BoxLayout();
for (let i = 0; i < keys.length; ++i) {
let children = keys[i].get_children();
let right_box = new St.BoxLayout({ style_class: 'keyboard-row' });
let left_box = new St.BoxLayout({ style_class: 'keyboard-row' });
let center_box = new St.BoxLayout({ style_class: 'keyboard-row' });
let right_box = new St.BoxLayout({ style_class: 'keyboard-row' });
for (let j = 0; j < children.length; ++j) {
if (this._numOfHorizKeys == 0)
this._numOfHorizKeys = children.length;
let key = children[j];
let button = new Key(key);
if (key.align == 'right')
switch (key.align) {
case 'right':
right_box.add(button.actor);
else
break;
case 'center':
center_box.add(button.actor);
break;
case 'left':
default:
left_box.add(button.actor);
break;
}
if (key.name == 'Caribou_Prefs') {
key.connect('key-released', Lang.bind(this, this.hide));
}
@ -332,6 +341,7 @@ const Keyboard = new Lang.Class({
}));
}
keyboard_row.add(left_box, { expand: true, x_fill: false, x_align: St.Align.START });
keyboard_row.add(center_box, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
keyboard_row.add(right_box, { expand: true, x_fill: false, x_align: St.Align.END });
}
layout.add(keyboard_row);