appDisplay: Expand titles on keyboard focus as well

In addition to hover, expand wrapped app titles when keyboard
focus is in as well. This gives keyboard users a chance to
read the app name.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3333

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1496
This commit is contained in:
Georges Basile Stavracas Neto 2020-11-13 14:35:29 -03:00 committed by Florian Müllner
parent 5d27a5a42a
commit 548d3b62d7

View File

@ -1512,15 +1512,15 @@ class AppViewItem extends St.Button {
label.disconnect(id); label.disconnect(id);
}); });
const { hover } = this; const expand = this.hover || this.has_key_focus();
label.save_easing_state(); label.save_easing_state();
label.set_easing_duration(hover label.set_easing_duration(expand
? APP_ICON_TITLE_EXPAND_TIME ? APP_ICON_TITLE_EXPAND_TIME
: APP_ICON_TITLE_COLLAPSE_TIME); : APP_ICON_TITLE_COLLAPSE_TIME);
clutterText.set({ clutterText.set({
line_wrap: hover, line_wrap: expand,
line_wrap_mode: hover ? Pango.WrapMode.WORD_CHAR : Pango.WrapMode.NONE, line_wrap_mode: expand ? Pango.WrapMode.WORD_CHAR : Pango.WrapMode.NONE,
ellipsize: hover ? Pango.EllipsizeMode.NONE : Pango.EllipsizeMode.END, ellipsize: expand ? Pango.EllipsizeMode.NONE : Pango.EllipsizeMode.END,
}); });
} }
@ -1608,6 +1608,16 @@ class AppViewItem extends St.Button {
x > this.width - IconGrid.RIGHT_DIVIDER_LEEWAY; x > this.width - IconGrid.RIGHT_DIVIDER_LEEWAY;
} }
vfunc_key_focus_in() {
this._updateMultiline();
super.vfunc_key_focus_in();
}
vfunc_key_focus_out() {
this._updateMultiline();
super.vfunc_key_focus_out();
}
handleDragOver(source, _actor, x) { handleDragOver(source, _actor, x) {
if (source === this) if (source === this)
return DND.DragMotionResult.NO_DROP; return DND.DragMotionResult.NO_DROP;