~anton0/ubuntu/precise/unity/lp-789979

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/UnityShowdesktopHandler.cpp

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2012-04-12 15:22:36 UTC
  • mfrom: (1.1.66) (140.1.1 precise)
  • Revision ID: package-import@ubuntu.com-20120412152236-6rsg51mzr01hlejy
Tags: 5.10.0-0ubuntu1
* New upstream release:
  - bamfdaemon crashed with SIGABRT in g_assertion_message() (LP: #926208)
  - We are using 1 bad hack for compiz hanging on startup (LP: #963264)
  - GConf backend steals glib events from compiz (LP: #965220)
  - when I closed QupZill brawser it crashed and then and then I sow
    worrning that compiz crashed but fire fox and chrome is estle working.
    gtk-window-decorator crashed with SIGSEGV in max_window_name_width()
    (LP: #948580)
  - compiz crashed with SIGSEGV in std::basic_string<...>::basic_string()
    from unity::launcher::HudLauncherIcon::HudLauncherIcon()::{lambda} from
    unity::UBusManager::OnCallback (LP: #964897)
  - unity-panel-service crashed due to heap corruption in g_free() from
    service_proxy_name_changed() [libindicator/indicator-service-
    manager.c:574] (LP: #969360)
  - Opening dash while an application is maximized makes unity completely
    useless, have to relogin (LP: #975103)
  - unity crash on alt-tab (LP: #975168)
  - Top bar - Menus should be condensed to fit panel/overlay of appmenu
    (LP: #655184)
  - Topbar - window controls for maximised windows in the top bar should
    conform to Fitts's law (LP: #839690)
  - [FFe, UIFe] Dash - When the Dash is open and there is a maximised app in
    the background, the top bar background should not disappear
    (LP: #839480)
  - Dash - The inner bottom left, bottom right and top right corners of the
    desktop dash border are rendered incorrectly (LP: #839476)
  - Showdesktoped window contents invisible in window spread (LP: #877778)
  - Maximized windows can be accidentally closed from wrong monitor.
    (LP: #865701)
  - Unity launcher on-screen corruption on resume from suspend with nVidia
    proprietary driver (LP: #915265)
  - Launcher - Inserting items into launcher makes unnecessary animations on
    other monitors (LP: #925021)
  - Far left character in panel (and launcher popups) distorted
    (LP: #927441)
  - Jenkins build failure: SetAcceptKeyNavFocusOnMouseEnter not declared
    (LP: #938037)
  - super+<unbound key> and sometimes super+<number> keys now cause launch
    to wedge with the key hints shown and retains focus instead of selecting
    the requested window (LP: #934084)
  - three-finger move does not move (Precise) (LP: #940612)
  - compiz crashed with SIGSEGV in std::__detail::_List_node_base::_M_hook()
    from unity::ui::PointerBarrierWrapper::EmitCurrentData (LP: #944217)
  - indicators appear intertwined with global menu (LP: #953868)
  - [5.8 pre staging] "sticky edge" option does nothing visible
    (LP: #961285)
  - HUD: The selection always returns to the first item whenever menus are
    updated (LP: #962984)
  - Multimonitor - Using single launcher, the HUD draws incorrectly on a
    secondary monitor (LP: #963577)
  - Type your command does not appear translated in the HUD (LP: #964074)
  - HUD doesnt receive input after pressing Tab (LP: #964760)
  - compiz crashed with SIGSEGV in g_variant_unref() from
    unity::launcher::SoftwareCenterLauncherIcon::OnPropertyChanged
    (LP: #963718)
  - HUD denial of service (LP: #948820)
  - Application launch time increased with type-to-search in unity 5.8
    (LP: #966417)
  - Weird translation on the shortcut overlay dialog (LP: #971332)
  - compiz crashed with SIGSEV in g_type_check_instance_is_a from
    unity::launcher::DeviceLauncherIcon::ShowNotification (LP: #971345)
  - Launcher - launcher have a weird background if cursor is over it while
    opening dash (LP: #974408)
  - compiz crashed with SIGSEGV in
    unity::hud::HudIconTextureSource::ColorForIcon() (LP: #935307)
  - Compiz: Growing idle memory consumption with latest Nux/Unity (~60
    MiB/h) in unity::PanelIndicatorEntryView::Refresh() (LP: #975801)
  - [nvidia] minimized windows are white in the window spread (LP: #977189)
  - compiz crashed with SIGSEGV in nux::Rect::Rect() from
    unity::launcher::LauncherIcon::OpenQuicklist() from RecvMouseDown() from
    unity::launcher::LauncherIcon::RecvMouseDown() (LP: #954736)
  - Alt-tab - Reduce the spread delay for all items other than the initial
    item the select lands on after alt-tab opens (LP: #838232)
  - Dash - The Dash search box should expand horizontally when the Dash
    switches to full screen mode  (LP: #841907)
  - window selected via ALT+F1 doesn't get focus in unity (LP: #875932)
  - Non square icons don't fill result tiles as much as they should
    (LP: #878015)
  - Dash - the spinner and the 'clear' button (the circle with the X) in the
    Dash is blurry (LP: #891691)
  - Dash - Update the Dash card view so that the implementation conforms to
    the attached designs (LP: #901164)
  - Launcher bar doesn't saturate when focused via keynav when dash opened
    (LP: #913569)
  - Global menu doesn't work with multiple monitors (twinview) (LP: #921918)
  - Number shortcut overlay won't show if mouse hovers launcher bar area
    (LP: #924636)
  - Colour of launcher on second monitor is not restored after closing the
    dash (LP: #925442)
  - [autohide] app icons in HUD are poorly scaled (LP: #931406)
  - Show default HUD icon for Desktop (nautilus) menus (LP: #931548)
  - Hud shows wrong application icon when activated with the dash showing
    (LP: #932371)
  - Window management - Dragging down a maximized window from the panel has
    not predictable results (LP: #934680)
  - Launcher - Properly colorize icons (LP: #938620)
  - lens bar clickable area needs to be expanded (LP: #937193)
  - Multimonitor - hidden menu indicators are shown in the non active
    monitor (LP: #951747)
  - Wrong glib #include in Hud.h (LP: #952117)
  - [FFe, UIFe] New animation for adding launchers for newly installed
    applications (LP: #955147)
  - HUD remembers icon of last used app (LP: #961161)
  - Launcher - window buttons are not horizontally ad vertically aligned
    (LP: #963019)
  - Opening HUD after dash shows window title in the panel (LP: #963134)
  - Dash picking a really odd color with default wallpaper (LP: #963140)
  - HUD overlay has one pixel gap on left side (LP: #964061)
  - Launcher icon indicators doesn't redraw when changing the launcher
    settings (LP: #964851)
  - Dash home results take too long to appear (LP: #965492)
  - Multimonitor - Only the panel that controls the focused window should
    draw its title (LP: #968261)
  - Performing a pinch gesture over a window has no effect (LP: #969554)
  - Dash section header icons are missing (LP: #971233)
  - Unity displays "no search results" with results present (LP: #971430)
  - Pressing Ctrl+Tab from the command lens switches to the wrong lens
    (LP: #971850)
  - PanelMenuView causes gtk assertion to fail (LP: #971947)
  - [regression] The keyboard shortcuts overlay bottom is truncated.
    (LP: #973386)
  - Not minimizable windows have an enabled "minimize" button on the unity
    panel (LP: #936425)
  - HUD maximize button affects Dash (LP: #939054)
  - Panel opacity toggle doesn't quite work  (LP: #940683)
  - Dash is totally broken when disabling the blur effect (LP: #941066)
  - Dash collapsed view has scrollbar (LP: #956500)
  - HUD too many triangles with new transition effect (LP: #961230)
  - Menu bar not transparent when invoking dash with super key whilst HUD
    enabled and vice versa (LP: #962410)
  - Windows controls lost if dash is opened after HUD (LP: #963118)
  - HUD service returning more than 5 entries (LP: #965299)
  - Dash - Search box text is clipped (LP: #966424)
  - IBus Pinyin pup box disappears  in the hud (LP: #968777)
  - Dash and HUD search fields appear in slightly different places
    (LP: #969404)
  - Super+Tab, super, loses focus (LP: #970420)
  - Dash - reduce frosty effect (LP: #978785)
  - HUD doesn't ignore key events while ibus is active (LP: #957927)
  - "Show Dekstop icon" typo in Unity's translation template (LP: #934526)
  - Starting dash or hud with mouse over launcher desaturates all icons
    (LP: #973063)
  - Untranslatable strings in the hints screen (LP: #975815)
  - Dash text input does not get focus (LP: #774447)
  - dash ignore queries done just after session start (LP: #979799)
* Cherry-pick an additional commit for a crash
* debian/control:
  - build-dep on latest libnux-2.0-dev for ABI break
  - bump Standards-Version to latest

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
 
2
/* Compiz unity plugin
 
3
 * unity.h
 
4
 *
 
5
 * Copyright (c) 2010-11 Canonical Ltd.
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU General Public License
 
9
 * as published by the Free Software Foundation; either version 3
 
10
 * of the License, or (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * Your own copyright notice would go above. You are free to choose whatever
 
18
 * licence you want, just take note that some compiz code is GPL and you will
 
19
 * not be able to re-use it if you want to use a different licence.
 
20
 */
 
21
 
 
22
#include <glib.h>
 
23
#include "UnityShowdesktopHandler.h"
 
24
 
 
25
namespace unity
 
26
{
 
27
 
 
28
ShowdesktopHandlerWindowInterface::~ShowdesktopHandlerWindowInterface()
 
29
{
 
30
}
 
31
 
 
32
/* 300 ms */
 
33
const unsigned int ShowdesktopHandler::fade_time = 300;
 
34
std::list <ShowdesktopHandlerWindowInterface *> ShowdesktopHandler::animating_windows (0);
 
35
 
 
36
bool ShowdesktopHandler::ShouldHide (ShowdesktopHandlerWindowInterface *wi)
 
37
{
 
38
  if (wi->OverrideRedirect())
 
39
    return false;
 
40
 
 
41
  if (!wi->Managed())
 
42
    return false;
 
43
 
 
44
  if (wi->Grabbed())
 
45
    return false;
 
46
 
 
47
  if (wi->DesktopOrDock())
 
48
   return false;
 
49
 
 
50
  if (wi->SkipTaskbarOrPager())
 
51
    return false;
 
52
 
 
53
  if (wi->Hidden())
 
54
    if ((wi->ShowDesktopMode() || wi->Shaded()))
 
55
      return false;
 
56
 
 
57
  return true;
 
58
}
 
59
 
 
60
guint32 ShowdesktopHandler::inhibiting_xid = 0;
 
61
 
 
62
void
 
63
ShowdesktopHandler::InhibitLeaveShowdesktopMode (guint32 xid)
 
64
{
 
65
  if (!inhibiting_xid)
 
66
    inhibiting_xid = xid;
 
67
}
 
68
 
 
69
void
 
70
ShowdesktopHandler::AllowLeaveShowdesktopMode (guint32 xid)
 
71
{
 
72
  if (inhibiting_xid == xid)
 
73
    inhibiting_xid = 0;
 
74
}
 
75
 
 
76
guint32
 
77
ShowdesktopHandler::InhibitingXid()
 
78
{
 
79
  return inhibiting_xid;
 
80
}
 
81
 
 
82
ShowdesktopHandler::ShowdesktopHandler (ShowdesktopHandlerWindowInterface *wi) :
 
83
  showdesktop_handler_window_interface_ (wi),
 
84
  remover_ (wi->InputRemover()),
 
85
  state_ (StateVisible),
 
86
  progress_ (0.0f)
 
87
{
 
88
}
 
89
 
 
90
ShowdesktopHandler::~ShowdesktopHandler()
 
91
{
 
92
}
 
93
 
 
94
void ShowdesktopHandler::FadeOut()
 
95
{
 
96
  if (state_ != StateVisible && state_ != StateFadeIn)
 
97
    return;
 
98
 
 
99
  state_ = ShowdesktopHandler::StateFadeOut;
 
100
  progress_ = 0.0f;
 
101
 
 
102
  was_hidden_ = showdesktop_handler_window_interface_->Hidden();
 
103
 
 
104
  if (!was_hidden_)
 
105
  {
 
106
    showdesktop_handler_window_interface_->Hide();
 
107
    showdesktop_handler_window_interface_->NotifyHidden();
 
108
    remover_->save();
 
109
    remover_->remove();
 
110
 
 
111
    if (std::find (animating_windows.begin(),
 
112
                   animating_windows.end(),
 
113
                   showdesktop_handler_window_interface_) == animating_windows.end())
 
114
      animating_windows.push_back (showdesktop_handler_window_interface_);
 
115
 
 
116
  }
 
117
}
 
118
 
 
119
void ShowdesktopHandler::FadeIn()
 
120
{
 
121
  if (state_ != StateInvisible && state_ != StateFadeOut)
 
122
    return;
 
123
 
 
124
  state_ = ShowdesktopHandler::StateFadeIn;
 
125
 
 
126
  if (!was_hidden_)
 
127
  {
 
128
    showdesktop_handler_window_interface_->Show();
 
129
    showdesktop_handler_window_interface_->NotifyShown();
 
130
    remover_->restore();
 
131
 
 
132
    if (std::find (animating_windows.begin(),
 
133
                   animating_windows.end(),
 
134
                   showdesktop_handler_window_interface_) == animating_windows.end())
 
135
      animating_windows.push_back(showdesktop_handler_window_interface_);
 
136
  }
 
137
}
 
138
 
 
139
ShowdesktopHandlerWindowInterface::PostPaintAction ShowdesktopHandler::Animate (unsigned int ms)
 
140
{
 
141
  float inc = ms / static_cast <float> (fade_time);
 
142
 
 
143
  if (state_ == ShowdesktopHandler::StateFadeOut)
 
144
  {
 
145
    progress_ += inc;
 
146
    if (progress_ >= 1.0f)
 
147
    {
 
148
      progress_ = 1.0f;
 
149
      state_ = StateInvisible;
 
150
    }
 
151
  }
 
152
  else if (state_ == StateFadeIn)
 
153
  {
 
154
    progress_ -= inc;
 
155
    if (progress_ <= 0.0f)
 
156
    {
 
157
      progress_ = 0.0f;
 
158
      state_ = StateVisible;
 
159
    }
 
160
  }
 
161
  else if (state_ == StateVisible)
 
162
    return ShowdesktopHandlerWindowInterface::PostPaintAction::Remove;
 
163
  else if (state_ == StateInvisible)
 
164
    return ShowdesktopHandlerWindowInterface::PostPaintAction::Wait;
 
165
 
 
166
  return ShowdesktopHandlerWindowInterface::PostPaintAction::Damage;
 
167
}
 
168
 
 
169
void ShowdesktopHandler::PaintOpacity (unsigned short &opacity)
 
170
{
 
171
  if (progress_ == 1.0f || progress_ == 0.0f)
 
172
    opacity = std::numeric_limits <unsigned short>::max();
 
173
  else
 
174
    opacity *= (1.0f - progress_);
 
175
}
 
176
 
 
177
unsigned int ShowdesktopHandler::GetPaintMask()
 
178
{
 
179
  return (progress_ == 1.0f) ? showdesktop_handler_window_interface_->NoCoreInstanceMask() : 0;
 
180
}
 
181
 
 
182
void ShowdesktopHandler::HandleShapeEvent()
 
183
{
 
184
  /* Ignore sent events from the InputRemover */
 
185
  if (remover_)
 
186
  {
 
187
    remover_->save();
 
188
    remover_->remove();
 
189
  }
 
190
}
 
191
 
 
192
void ShowdesktopHandler::WindowFocusChangeNotify()
 
193
{
 
194
  if (showdesktop_handler_window_interface_->Minimized())
 
195
  {
 
196
    for (ShowdesktopHandlerWindowInterface *w : animating_windows)
 
197
      w->DisableFocus();
 
198
 
 
199
    showdesktop_handler_window_interface_->MoveFocusAway();
 
200
 
 
201
    for (ShowdesktopHandlerWindowInterface *w : animating_windows)
 
202
      w->EnableFocus();
 
203
  }
 
204
}
 
205
 
 
206
void ShowdesktopHandler::UpdateFrameRegion (CompRegion &r)
 
207
{
 
208
  r = CompRegion();
 
209
 
 
210
  /* Ensure no other plugins can touch this frame region */
 
211
  showdesktop_handler_window_interface_->OverrideFrameRegion (r);
 
212
}
 
213
 
 
214
}
 
215