~3v1n0/unity/gnome-keys-timestamp-api

« back to all changes in this revision

Viewing changes to decorations/DecorationsMenuEntry.cpp

  • Committer: CI Train Bot
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2015-02-19 19:33:36 UTC
  • mfrom: (3899.2.85 lim-everywhere)
  • Revision ID: ci-train-bot@canonical.com-20150219193336-1ax9aswzdijrfq0f
Decorations, Panel: add menus for unfocused windows as well

Now the indicator-appmenu exports the menus for all the windows,
then it's up to us to filter them based on their parent window and
show on relevant place.
Also, set LIM as default now. Fixes: #1309778
Approved by: Andrea Azzarone, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
  , in_dropdown(false)
38
38
  , entry_(entry)
39
39
  , grab_(win, true)
 
40
  , show_menu_enabled_(true)
40
41
{
41
42
  entry_->updated.connect(sigc::mem_fun(this, &MenuEntry::EntryUpdated));
42
43
  horizontal_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture)));
43
44
  vertical_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture)));
44
45
  scale.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture)));
 
46
  focused.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture)));
45
47
  in_dropdown.changed.connect([this] (bool in) { visible = entry_->visible() && !in; });
46
48
  EntryUpdated();
47
49
}
63
65
 
64
66
void MenuEntry::RenderTexture()
65
67
{
66
 
  WidgetState state = WidgetState::NORMAL;
 
68
  WidgetState state = focused() ? WidgetState::NORMAL : WidgetState::BACKDROP;
67
69
 
68
70
  if (show_now())
69
71
    state = WidgetState::PRESSED;
120
122
{
121
123
  button_up_timer_.reset();
122
124
  grab_.ButtonDownEvent(p, button, timestamp);
 
125
  show_menu_enabled_ = (focused() || Settings::Instance().lim_unfocused_popup());
123
126
}
124
127
 
125
128
void MenuEntry::ButtonUpEvent(CompPoint const& p, unsigned button, Time timestamp)
126
129
{
 
130
  if (!show_menu_enabled_)
 
131
  {
 
132
    grab_.ButtonUpEvent(p, button, timestamp);
 
133
    return;
 
134
  }
 
135
 
127
136
  if (button == 1 && !grab_.IsGrabbed())
128
137
  {
129
138
    unsigned double_click_wait = Settings::Instance().lim_double_click_wait();
143
152
 
144
153
  if (button == 2 || button == 3)
145
154
  {
146
 
    ShowMenu(button);
 
155
    if (Style::Get()->WindowManagerAction(WMEvent(button)) == WMAction::NONE)
 
156
      ShowMenu(button);
147
157
  }
148
158
 
149
159
  grab_.ButtonUpEvent(p, button, timestamp);