panel: fix up calendar-vs-menu handling on clock

Give the clock's right-click menu its own PopupMenuManager so that if
you drop down another menu and then mouseover the clock it doesn't
pop up the right-click menu.

https://bugzilla.gnome.org/show_bug.cgi?id=634755
This commit is contained in:
Dan Winship 2010-11-19 13:00:59 -05:00
parent 23f3af832c
commit 7d0eeef90a

View File

@ -512,11 +512,14 @@ ClockButton.prototype = {
_onButtonPress: function(actor, event) { _onButtonPress: function(actor, event) {
let button = event.get_button(); let button = event.get_button();
if (button == 3 && let menuShowing = this.menu.isOpen;
(!this._calendarPopup || !this._calendarPopup.isOpen)) let calendarShowing = this._calendarPopup && this._calendarPopup.isOpen;
if (menuShowing || (button == 3 && !calendarShowing))
this.menu.toggle(); this.menu.toggle();
else else
this._toggleCalendar(); this._toggleCalendar();
return true;
}, },
closeCalendar: function() { closeCalendar: function() {
@ -525,15 +528,12 @@ ClockButton.prototype = {
this._calendarPopup.hide(); this._calendarPopup.hide();
this.menu.isOpen = false;
this.actor.remove_style_pseudo_class('pressed'); this.actor.remove_style_pseudo_class('pressed');
}, },
openCalendar: function() { openCalendar: function() {
this._calendarPopup.show(); this._calendarPopup.show();
// simulate an open menu, so it won't appear beneath the calendar
this.menu.isOpen = true;
this.actor.add_style_pseudo_class('pressed'); this.actor.add_style_pseudo_class('pressed');
}, },
@ -803,7 +803,8 @@ Panel.prototype = {
this._clockButton = new ClockButton(); this._clockButton = new ClockButton();
this._centerBox.add(this._clockButton.actor, { y_fill: true }); this._centerBox.add(this._clockButton.actor, { y_fill: true });
this._menus.addMenu(this._clockButton.menu); let clockMenuManager = new PopupMenu.PopupMenuManager(this);
clockMenuManager.addMenu(this._clockButton.menu);
/* right */ /* right */