[gnome-shell] calendar: Grab key focus when user changes day
- From: Volker Sobek <vsobek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] calendar: Grab key focus when user changes day
- Date: Fri, 7 Mar 2014 18:27:34 +0000 (UTC)
commit 257e1f3096b3a1e896f0fa7de5149c7d84119164
Author: Volker Sobek <reklov live com>
Date: Mon Mar 3 18:14:51 2014 +0100
calendar: Grab key focus when user changes day
When the user changes the active day by mouse click or keyboard focus
plus key press on a day in the grid, always move the keyboard focus to
the newly activated day.
This basically restores functionality that was introduced in commit
31478e9fb441 but got lost again in the re-factoring in commit
cc4659f5c697.
https://bugzilla.gnome.org/show_bug.cgi?id=725606
js/ui/calendar.js | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 0a50138..1058e58 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -403,6 +403,8 @@ const Calendar = new Lang.Class({
// Start off with the current date
this._selectedDate = new Date();
+ this._shouldDateGrabFocus = false;
+
this.actor = new St.Table({ homogeneous: false,
style_class: 'calendar',
reactive: true });
@@ -608,7 +610,9 @@ const Calendar = new Lang.Class({
button._date = new Date(iter);
button.connect('clicked', Lang.bind(this, function() {
+ this._shouldDateGrabFocus = true;
this.setDate(button._date);
+ this._shouldDateGrabFocus = false;
}));
let hasEvents = this._eventSource.hasEvents(iter);
@@ -674,8 +678,11 @@ const Calendar = new Lang.Class({
this._rebuildCalendar();
this._buttons.forEach(Lang.bind(this, function(button) {
- if (_sameDay(button._date, this._selectedDate))
+ if (_sameDay(button._date, this._selectedDate)) {
button.add_style_pseudo_class('active');
+ if (this._shouldDateGrabFocus)
+ button.grab_key_focus();
+ }
else
button.remove_style_pseudo_class('active');
}));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]