Merge lp:~canonical-dx-team/unity/unity.autohide-like-a-boss into lp:unity
- unity.autohide-like-a-boss
- Merge into trunk
Proposed by
Jason Smith
on 2010-11-25
| Status: | Merged |
|---|---|
| Merged at revision: | 627 |
| Proposed branch: | lp:~canonical-dx-team/unity/unity.autohide-like-a-boss |
| Merge into: | lp:unity |
| Diff against target: |
1086 lines (+318/-177) 10 files modified
src/BamfLauncherIcon.cpp (+37/-2) src/BamfLauncherIcon.h (+3/-0) src/Launcher.cpp (+95/-53) src/Launcher.h (+5/-1) src/LauncherController.cpp (+127/-103) src/LauncherController.h (+2/-1) src/LauncherIcon.cpp (+24/-6) src/LauncherIcon.h (+9/-2) src/unity.cpp (+6/-2) src/unity.h (+10/-7) |
| To merge this branch: | bzr merge lp:~canonical-dx-team/unity/unity.autohide-like-a-boss |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Sam Spilsbury (community) | 2010-11-25 | Approve on 2010-11-25 | |
|
Review via email:
|
|||
Commit Message
Description of the Change
Implements a series of autohide behaviors similar to what is currently in design mockups. The behaviors are not well polished yet.
To post a comment you must log in.
lp:~canonical-dx-team/unity/unity.autohide-like-a-boss
updated
on 2010-11-25
- 628. By Jason Smith on 2010-11-25
-
shorten present time on minimize animation
- 629. By Jason Smith on 2010-11-25
-
ensure we minimize to the icon
- 630. By Jason Smith on 2010-11-25
-
Give a little more control over behavior
- 631. By Jason Smith on 2010-11-25
-
fix paint under certain conditions (transformed + notify osd)
- 632. By Jason Smith on 2010-11-25
-
minor render glitch
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === added file 'resources/round_glow_62x62.png' |
| 2 | Binary files resources/round_glow_62x62.png 1970-01-01 00:00:00 +0000 and resources/round_glow_62x62.png 2010-11-25 07:36:29 +0000 differ |
| 3 | === modified file 'src/BamfLauncherIcon.cpp' |
| 4 | --- src/BamfLauncherIcon.cpp 2010-11-24 18:59:55 +0000 |
| 5 | +++ src/BamfLauncherIcon.cpp 2010-11-25 07:36:29 +0000 |
| 6 | @@ -67,6 +67,30 @@ |
| 7 | g_object_unref (m_App); |
| 8 | } |
| 9 | |
| 10 | +bool |
| 11 | +BamfLauncherIcon::IconOwnsWindow (Window w) |
| 12 | +{ |
| 13 | + GList *children, *l; |
| 14 | + BamfView *view; |
| 15 | + |
| 16 | + children = bamf_view_get_children (BAMF_VIEW (m_App)); |
| 17 | + |
| 18 | + for (l = children; l; l = l->next) |
| 19 | + { |
| 20 | + view = (BamfView *) l->data; |
| 21 | + |
| 22 | + if (BAMF_IS_WINDOW (view)) |
| 23 | + { |
| 24 | + guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view)); |
| 25 | + |
| 26 | + if (xid == w) |
| 27 | + return true; |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | + return false; |
| 32 | +} |
| 33 | + |
| 34 | void |
| 35 | BamfLauncherIcon::OnMouseClick (int button) |
| 36 | { |
| 37 | @@ -159,7 +183,10 @@ |
| 38 | self->SetQuirk (LAUNCHER_ICON_QUIRK_RUNNING, running); |
| 39 | |
| 40 | if (running) |
| 41 | + { |
| 42 | self->EnsureWindowState (); |
| 43 | + self->UpdateIconGeometries (self->GetCenter ()); |
| 44 | + } |
| 45 | } |
| 46 | |
| 47 | void |
| 48 | @@ -197,6 +224,7 @@ |
| 49 | { |
| 50 | BamfLauncherIcon *self = (BamfLauncherIcon*) data; |
| 51 | self->EnsureWindowState (); |
| 52 | + self->UpdateIconGeometries (self->GetCenter ()); |
| 53 | } |
| 54 | |
| 55 | void |
| 56 | @@ -227,8 +255,9 @@ |
| 57 | return result; |
| 58 | } |
| 59 | |
| 60 | -void |
| 61 | -BamfLauncherIcon::OnCenterStabilized (nux::Point3 center) |
| 62 | + |
| 63 | +void |
| 64 | +BamfLauncherIcon::UpdateIconGeometries (nux::Point3 center) |
| 65 | { |
| 66 | GList *children, *l; |
| 67 | BamfView *view; |
| 68 | @@ -255,3 +284,9 @@ |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | + |
| 73 | +void |
| 74 | +BamfLauncherIcon::OnCenterStabilized (nux::Point3 center) |
| 75 | +{ |
| 76 | + UpdateIconGeometries (center); |
| 77 | +} |
| 78 | |
| 79 | === modified file 'src/BamfLauncherIcon.h' |
| 80 | --- src/BamfLauncherIcon.h 2010-11-24 18:59:55 +0000 |
| 81 | +++ src/BamfLauncherIcon.h 2010-11-25 07:36:29 +0000 |
| 82 | @@ -43,7 +43,10 @@ |
| 83 | void OnMouseClick (int button); |
| 84 | std::list<DbusmenuClient *> GetMenus (); |
| 85 | |
| 86 | + void UpdateIconGeometries (nux::Point3 center); |
| 87 | void OnCenterStabilized (nux::Point3 center); |
| 88 | + |
| 89 | + bool IconOwnsWindow (Window w); |
| 90 | |
| 91 | private: |
| 92 | BamfApplication *m_App; |
| 93 | |
| 94 | === modified file 'src/Launcher.cpp' |
| 95 | --- src/Launcher.cpp 2010-11-24 23:07:01 +0000 |
| 96 | +++ src/Launcher.cpp 2010-11-25 07:36:29 +0000 |
| 97 | @@ -230,12 +230,14 @@ |
| 98 | _icon_under_mouse = NULL; |
| 99 | _icon_mouse_down = NULL; |
| 100 | _icon_image_size = 48; |
| 101 | + _icon_glow_size = 62; |
| 102 | _icon_image_size_delta = 6; |
| 103 | _icon_size = _icon_image_size + _icon_image_size_delta; |
| 104 | |
| 105 | _icon_bkg_texture = nux::CreateTextureFromFile (PKGDATADIR"/round_corner_54x54.png"); |
| 106 | _icon_outline_texture = nux::CreateTextureFromFile (PKGDATADIR"/round_outline_54x54.png"); |
| 107 | _icon_shine_texture = nux::CreateTextureFromFile (PKGDATADIR"/round_shine_54x54.png"); |
| 108 | + _icon_glow_texture = nux::CreateTextureFromFile (PKGDATADIR"/round_glow_62x62.png"); |
| 109 | _icon_2indicator = nux::CreateTextureFromFile (PKGDATADIR"/2indicate_54x54.png"); |
| 110 | _icon_3indicator = nux::CreateTextureFromFile (PKGDATADIR"/3indicate_54x54.png"); |
| 111 | _icon_4indicator = nux::CreateTextureFromFile (PKGDATADIR"/4indicate_54x54.png"); |
| 112 | @@ -297,9 +299,9 @@ |
| 113 | clock_gettime (CLOCK_MONOTONIC, ¤t); |
| 114 | |
| 115 | if (_hidden) |
| 116 | - return CLAMP ((float) (TimeDelta (¤t, &_autohide_time)) / (float) ANIM_DURATION_LONG, 0.0f, 1.0f); |
| 117 | + return CLAMP ((float) (TimeDelta (¤t, &_autohide_time)) / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
| 118 | else |
| 119 | - return 1.0f - CLAMP ((float) (TimeDelta (¤t, &_autohide_time)) / (float) ANIM_DURATION_LONG, 0.0f, 1.0f); |
| 120 | + return 1.0f - CLAMP ((float) (TimeDelta (¤t, &_autohide_time)) / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
| 121 | } |
| 122 | |
| 123 | gboolean Launcher::AnimationTimeout (gpointer data) |
| 124 | @@ -341,12 +343,9 @@ |
| 125 | if (TimeDelta (¤t, &starting_time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2)) |
| 126 | return true; |
| 127 | |
| 128 | - if (icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT)) |
| 129 | - { |
| 130 | - struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT); |
| 131 | - if (TimeDelta (¤t, &urgent_time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2)) |
| 132 | - return true; |
| 133 | - } |
| 134 | + struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT); |
| 135 | + if (TimeDelta (¤t, &urgent_time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2)) |
| 136 | + return true; |
| 137 | |
| 138 | struct timespec present_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED); |
| 139 | if (TimeDelta (¤t, &present_time) < ANIM_DURATION) |
| 140 | @@ -376,7 +375,7 @@ |
| 141 | if (TimeDelta (¤t, &_drag_end_time) < ANIM_DURATION_LONG) |
| 142 | return true; |
| 143 | |
| 144 | - if (TimeDelta (¤t, &_autohide_time) < ANIM_DURATION_LONG) |
| 145 | + if (TimeDelta (¤t, &_autohide_time) < ANIM_DURATION_SHORT) |
| 146 | return true; |
| 147 | |
| 148 | // animations happening on specific icons |
| 149 | @@ -460,18 +459,26 @@ |
| 150 | |
| 151 | float Launcher::IconPresentProgress (LauncherIcon *icon, struct timespec current) |
| 152 | { |
| 153 | + struct timespec icon_present_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED); |
| 154 | + int ms = TimeDelta (¤t, &icon_present_time); |
| 155 | + float result = CLAMP ((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
| 156 | + |
| 157 | if (icon->GetQuirk (LAUNCHER_ICON_QUIRK_PRESENTED)) |
| 158 | - { |
| 159 | - struct timespec icon_present_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED); |
| 160 | - int ms = TimeDelta (¤t, &icon_present_time); |
| 161 | - return CLAMP ((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
| 162 | - } |
| 163 | - else |
| 164 | - { |
| 165 | - struct timespec icon_unpresent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED); |
| 166 | - int ms = TimeDelta (¤t, &icon_unpresent_time); |
| 167 | - return 1.0f - CLAMP ((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
| 168 | - } |
| 169 | + return result; |
| 170 | + else |
| 171 | + return 1.0f - result; |
| 172 | +} |
| 173 | + |
| 174 | +float Launcher::IconUrgentProgress (LauncherIcon *icon, struct timespec current) |
| 175 | +{ |
| 176 | + struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT); |
| 177 | + int urgent_ms = TimeDelta (¤t, &urgent_time); |
| 178 | + float result = CLAMP ((float) urgent_ms / (float) (ANIM_DURATION_LONG * URGENT_BLINKS * 2), 0.0f, 1.0f); |
| 179 | + |
| 180 | + if (icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT)) |
| 181 | + return result; |
| 182 | + else |
| 183 | + return 1.0f - result; |
| 184 | } |
| 185 | |
| 186 | float Launcher::IconUrgentPulseValue (LauncherIcon *icon, struct timespec current) |
| 187 | @@ -479,10 +486,7 @@ |
| 188 | if (!icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT)) |
| 189 | return 1.0f; // we are full on in a normal condition |
| 190 | |
| 191 | - struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT); |
| 192 | - int urgent_ms = TimeDelta (¤t, &urgent_time); |
| 193 | - double urgent_progress = (double) CLAMP ((float) urgent_ms / (float) (ANIM_DURATION_LONG * URGENT_BLINKS * 2), 0.0f, 1.0f); |
| 194 | - |
| 195 | + double urgent_progress = (double) IconUrgentProgress (icon, current); |
| 196 | return 0.5f + (float) (std::cos (M_PI * (float) (URGENT_BLINKS * 2) * urgent_progress)) * 0.5f; |
| 197 | } |
| 198 | |
| 199 | @@ -617,9 +621,10 @@ |
| 200 | } |
| 201 | |
| 202 | float autohide_progress = AutohideProgress (); |
| 203 | + float autohide_offset = 0.0f; |
| 204 | if (_autohide && autohide_progress > 0.0f) |
| 205 | { |
| 206 | - center.y -= geo.height * autohide_progress; |
| 207 | + autohide_offset -= geo.width * autohide_progress; |
| 208 | } |
| 209 | |
| 210 | // Inform the painter where to paint the box |
| 211 | @@ -629,7 +634,7 @@ |
| 212 | box_geo.height = sum + shelf_sum + _space_between_icons; |
| 213 | |
| 214 | if (_autohide) |
| 215 | - box_geo.height -= box_geo.height * autohide_progress; |
| 216 | + box_geo.x += autohide_offset; |
| 217 | |
| 218 | shelf_geo = nux::Geometry (box_geo.x, box_geo.height - shelf_sum, box_geo.width, shelf_sum); |
| 219 | |
| 220 | @@ -645,7 +650,6 @@ |
| 221 | |
| 222 | arg.icon = icon; |
| 223 | arg.alpha = 1.0f; |
| 224 | - arg.glow_intensity = 0.0f; |
| 225 | arg.running_arrow = false; |
| 226 | arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE); |
| 227 | arg.folding_rads = 0.0f; |
| 228 | @@ -659,6 +663,10 @@ |
| 229 | |
| 230 | arg.backlight_intensity = IconBackgroundIntensity (icon, current); |
| 231 | |
| 232 | + float urgent_progress = IconUrgentProgress (icon, current); |
| 233 | + urgent_progress = CLAMP (urgent_progress * 3, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle |
| 234 | + arg.glow_intensity = urgent_progress; |
| 235 | + |
| 236 | // reset z |
| 237 | center.z = 0; |
| 238 | |
| 239 | @@ -682,13 +690,20 @@ |
| 240 | folding_progress *= 1.0f - present_progress; |
| 241 | |
| 242 | float half_size = (folded_size / 2.0f) + (_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress); |
| 243 | - |
| 244 | + |
| 245 | + float icon_hide_offset = autohide_offset; |
| 246 | + |
| 247 | + if (icon->PresentUrgency () == 1) |
| 248 | + icon_hide_offset *= 0.5f + 0.5f * (1.0f - present_progress); |
| 249 | + else if (icon->PresentUrgency () >= 2) |
| 250 | + icon_hide_offset *= 1.0f - present_progress; |
| 251 | + |
| 252 | // icon is crossing threshold, start folding |
| 253 | center.z += folded_z_distance * folding_progress; |
| 254 | arg.folding_rads = animation_neg_rads * folding_progress; |
| 255 | |
| 256 | center.y += half_size * size_modifier; // move to center |
| 257 | - arg.center = nux::Point3 (center); // copy center |
| 258 | + arg.center = nux::Point3 (center.x + icon_hide_offset, center.y, center.z); // copy center |
| 259 | icon->SetCenter (nux::Point3 (center.x, center.y + vertical_offset, center.z)); |
| 260 | center.y += half_size * size_modifier; // move to end |
| 261 | |
| 262 | @@ -742,7 +757,7 @@ |
| 263 | float half_size = _icon_size / 2.0f; |
| 264 | |
| 265 | center.y += half_size * size_modifier; // move to center |
| 266 | - arg.center = nux::Point3 (center); // copy center |
| 267 | + arg.center = nux::Point3 (center.x + autohide_offset, center.y, center.z); // copy center |
| 268 | icon->SetCenter (nux::Point3 (center.x, center.y + vertical_offset, center.z)); |
| 269 | center.y += half_size * size_modifier; // move to end |
| 270 | center.y += _space_between_icons * size_modifier; |
| 271 | @@ -793,7 +808,7 @@ |
| 272 | { |
| 273 | if (_autohide_handle > 0) |
| 274 | g_source_remove (_autohide_handle); |
| 275 | - _autohide_handle = g_timeout_add (2000, &Launcher::OnAutohideTimeout, this); |
| 276 | + _autohide_handle = g_timeout_add (1000, &Launcher::OnAutohideTimeout, this); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | @@ -895,6 +910,7 @@ |
| 281 | icon->_xform_coords["HitArea"] = new nux::Vector4[4]; |
| 282 | icon->_xform_coords["Image"] = new nux::Vector4[4]; |
| 283 | icon->_xform_coords["Tile"] = new nux::Vector4[4]; |
| 284 | + icon->_xform_coords["Glow"] = new nux::Vector4[4]; |
| 285 | |
| 286 | // needs to be disconnected |
| 287 | icon->needs_redraw.connect (sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw)); |
| 288 | @@ -944,10 +960,9 @@ |
| 289 | nux::Color bkg_color, |
| 290 | float alpha, |
| 291 | nux::Vector4 xform_coords[], |
| 292 | + nux::Geometry geo, |
| 293 | bool render_indicators) |
| 294 | { |
| 295 | - nux::Geometry geo = GetGeometry(); |
| 296 | - |
| 297 | nux::Matrix4 ObjectMatrix; |
| 298 | nux::Matrix4 ViewMatrix; |
| 299 | nux::Matrix4 ProjectionMatrix; |
| 300 | @@ -1104,7 +1119,7 @@ |
| 301 | m_RunningIndicator = nux::CreateTextureFromPixbuf (pbuf); |
| 302 | g_object_unref (pbuf); |
| 303 | } |
| 304 | - gPainter.Draw2DTexture (GfxContext, m_RunningIndicator, 0, markerCenter - (m_ActiveIndicator->GetHeight () / 2)); |
| 305 | + gPainter.Draw2DTexture (GfxContext, m_RunningIndicator, geo.x, markerCenter - (m_ActiveIndicator->GetHeight () / 2)); |
| 306 | } |
| 307 | |
| 308 | if (arg.active_arrow && render_indicators) |
| 309 | @@ -1115,11 +1130,11 @@ |
| 310 | m_ActiveIndicator = nux::CreateTextureFromPixbuf (pbuf); |
| 311 | g_object_unref (pbuf); |
| 312 | } |
| 313 | - gPainter.Draw2DTexture (GfxContext, m_ActiveIndicator, geo.width - m_ActiveIndicator->GetWidth (), markerCenter - (m_ActiveIndicator->GetHeight () / 2)); |
| 314 | + gPainter.Draw2DTexture (GfxContext, m_ActiveIndicator, (geo.x + geo.width) - m_ActiveIndicator->GetWidth (), markerCenter - (m_ActiveIndicator->GetHeight () / 2)); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | -void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg arg) |
| 319 | +void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg arg, nux::Geometry geo) |
| 320 | { |
| 321 | GfxContext.GetRenderStates ().SetSeparateBlend (true, |
| 322 | GL_SRC_ALPHA, |
| 323 | @@ -1137,6 +1152,7 @@ |
| 324 | nux::Color(0xFF6D6D6D), |
| 325 | 1.0f - arg.backlight_intensity, |
| 326 | arg.icon->_xform_coords["Tile"], |
| 327 | + geo, |
| 328 | false); |
| 329 | } |
| 330 | |
| 331 | @@ -1148,6 +1164,7 @@ |
| 332 | arg.icon->BackgroundColor (), |
| 333 | arg.backlight_intensity, |
| 334 | arg.icon->_xform_coords["Tile"], |
| 335 | + geo, |
| 336 | false); |
| 337 | } |
| 338 | |
| 339 | @@ -1164,6 +1181,7 @@ |
| 340 | nux::Color::White, |
| 341 | arg.alpha, |
| 342 | arg.icon->_xform_coords["Image"], |
| 343 | + geo, |
| 344 | true); |
| 345 | |
| 346 | if (arg.backlight_intensity > 0.0f) |
| 347 | @@ -1174,6 +1192,7 @@ |
| 348 | nux::Color::White, |
| 349 | arg.backlight_intensity, |
| 350 | arg.icon->_xform_coords["Tile"], |
| 351 | + geo, |
| 352 | false); |
| 353 | } |
| 354 | |
| 355 | @@ -1186,6 +1205,7 @@ |
| 356 | nux::Color::White, |
| 357 | 1.0f, |
| 358 | arg.icon->_xform_coords["Tile"], |
| 359 | + geo, |
| 360 | false); |
| 361 | break; |
| 362 | case 3: |
| 363 | @@ -1195,6 +1215,7 @@ |
| 364 | nux::Color::White, |
| 365 | 1.0f, |
| 366 | arg.icon->_xform_coords["Tile"], |
| 367 | + geo, |
| 368 | false); |
| 369 | break; |
| 370 | case 4: |
| 371 | @@ -1204,9 +1225,22 @@ |
| 372 | nux::Color::White, |
| 373 | 1.0f, |
| 374 | arg.icon->_xform_coords["Tile"], |
| 375 | + geo, |
| 376 | false); |
| 377 | break; |
| 378 | } |
| 379 | + |
| 380 | + if (arg.glow_intensity > 0.0f) |
| 381 | + { |
| 382 | + RenderIcon(GfxContext, |
| 383 | + arg, |
| 384 | + _icon_glow_texture, |
| 385 | + arg.icon->GlowColor (), |
| 386 | + arg.glow_intensity, |
| 387 | + arg.icon->_xform_coords["Glow"], |
| 388 | + geo, |
| 389 | + false); |
| 390 | + } |
| 391 | } |
| 392 | |
| 393 | void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
| 394 | @@ -1229,7 +1263,8 @@ |
| 395 | // clear region |
| 396 | gPainter.PushDrawColorLayer(GfxContext, base, nux::Color(0x00000000), true, ROP); |
| 397 | |
| 398 | - GfxContext.PushClippingRectangle(bkg_box); |
| 399 | + // clip vertically but not horizontally |
| 400 | + GfxContext.PushClippingRectangle(nux::Geometry (base.x, bkg_box.y, base.width, bkg_box.height)); |
| 401 | GfxContext.GetRenderStates ().SetSeparateBlend (true, |
| 402 | GL_SRC_ALPHA, |
| 403 | GL_ONE_MINUS_SRC_ALPHA, |
| 404 | @@ -1249,7 +1284,7 @@ |
| 405 | if ((*rev_it).folding_rads >= 0.0f || (*rev_it).skip) |
| 406 | continue; |
| 407 | |
| 408 | - DrawRenderArg (GfxContext, *rev_it); |
| 409 | + DrawRenderArg (GfxContext, *rev_it, bkg_box); |
| 410 | } |
| 411 | |
| 412 | std::list<Launcher::RenderArg>::iterator it; |
| 413 | @@ -1258,7 +1293,7 @@ |
| 414 | if ((*it).folding_rads < 0.0f || (*it).skip) |
| 415 | continue; |
| 416 | |
| 417 | - DrawRenderArg (GfxContext, *it); |
| 418 | + DrawRenderArg (GfxContext, *it, bkg_box); |
| 419 | } |
| 420 | |
| 421 | /* draw shelf */ |
| 422 | @@ -1275,17 +1310,17 @@ |
| 423 | if ((*it).skip) |
| 424 | continue; |
| 425 | |
| 426 | - DrawRenderArg (GfxContext, *it); |
| 427 | + DrawRenderArg (GfxContext, *it, bkg_box); |
| 428 | } |
| 429 | |
| 430 | + gPainter.Paint2DQuadColor (GfxContext, nux::Geometry (bkg_box.x + bkg_box.width - 1, bkg_box.y, 1, bkg_box.height), nux::Color(0x60FFFFFF)); |
| 431 | + |
| 432 | GfxContext.GetRenderStates().SetColorMask (true, true, true, true); |
| 433 | GfxContext.GetRenderStates ().SetSeparateBlend (false, |
| 434 | GL_SRC_ALPHA, |
| 435 | GL_ONE_MINUS_SRC_ALPHA, |
| 436 | GL_SRC_ALPHA, |
| 437 | GL_ONE_MINUS_SRC_ALPHA); |
| 438 | - |
| 439 | - gPainter.Paint2DQuadColor (GfxContext, nux::Geometry (bkg_box.x + bkg_box.width - 1, bkg_box.y, 1, bkg_box.height), nux::Color(0x60FFFFFF)); |
| 440 | |
| 441 | gPainter.PopBackground(); |
| 442 | GfxContext.PopClippingRectangle(); |
| 443 | @@ -1328,6 +1363,7 @@ |
| 444 | bool Launcher::MenuNotify(LauncherIcon* Icon) |
| 445 | { |
| 446 | |
| 447 | + |
| 448 | return true; |
| 449 | } |
| 450 | |
| 451 | @@ -1419,15 +1455,15 @@ |
| 452 | |
| 453 | void Launcher::RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags) |
| 454 | { |
| 455 | -} |
| 456 | - |
| 457 | -const gchar* Launcher::GetName () |
| 458 | -{ |
| 459 | - return "Launcher"; |
| 460 | -} |
| 461 | - |
| 462 | -void Launcher::AddProperties (GVariantBuilder *builder) |
| 463 | -{ |
| 464 | +} |
| 465 | + |
| 466 | +const gchar* Launcher::GetName () |
| 467 | +{ |
| 468 | + return "Launcher"; |
| 469 | +} |
| 470 | + |
| 471 | +void Launcher::AddProperties (GVariantBuilder *builder) |
| 472 | +{ |
| 473 | } |
| 474 | |
| 475 | void Launcher::EventLogic () |
| 476 | @@ -1636,10 +1672,8 @@ |
| 477 | |
| 478 | ViewProjectionMatrix = ProjectionMatrix*ViewMatrix*ObjectMatrix; |
| 479 | |
| 480 | - // Icon |
| 481 | SetIconXForm (launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, "Tile"); |
| 482 | |
| 483 | - //// icon image |
| 484 | w = _icon_image_size; |
| 485 | h = _icon_image_size; |
| 486 | x = (*it).center.x - _icon_size/2.0f + _icon_image_size_delta/2.0f; |
| 487 | @@ -1648,6 +1682,14 @@ |
| 488 | |
| 489 | SetIconXForm (launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, "Image"); |
| 490 | |
| 491 | + w = _icon_glow_size; |
| 492 | + h = _icon_glow_size; |
| 493 | + x = (*it).center.x - _icon_glow_size/2.0f; |
| 494 | + y = (*it).center.y - _icon_glow_size/2.0f; |
| 495 | + z = (*it).center.z; |
| 496 | + |
| 497 | + SetIconXForm (launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, "Glow"); |
| 498 | + |
| 499 | w = geo.width + 2; |
| 500 | h = _icon_size + _space_between_icons; |
| 501 | x = (*it).center.x - w/2.0f; |
| 502 | |
| 503 | === modified file 'src/Launcher.h' |
| 504 | --- src/Launcher.h 2010-11-24 17:53:21 +0000 |
| 505 | +++ src/Launcher.h 2010-11-25 07:36:29 +0000 |
| 506 | @@ -125,6 +125,7 @@ |
| 507 | float GetHoverProgress (); |
| 508 | float AutohideProgress (); |
| 509 | float IconPresentProgress (LauncherIcon *icon, struct timespec current); |
| 510 | + float IconUrgentProgress (LauncherIcon *icon, struct timespec current); |
| 511 | float IconUrgentPulseValue (LauncherIcon *icon, struct timespec current); |
| 512 | float IconStartingPulseValue (LauncherIcon *icon, struct timespec current); |
| 513 | float IconBackgroundIntensity (LauncherIcon *icon, struct timespec current); |
| 514 | @@ -138,7 +139,7 @@ |
| 515 | std::list<Launcher::RenderArg> &shelf_args, |
| 516 | nux::Geometry &box_geo, nux::Geometry &shelf_geo); |
| 517 | |
| 518 | - void DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg arg); |
| 519 | + void DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg arg, nux::Geometry geo); |
| 520 | |
| 521 | void OnIconAdded (void *icon_pointer); |
| 522 | void OnIconRemoved (void *icon_pointer); |
| 523 | @@ -152,6 +153,7 @@ |
| 524 | nux::Color bkg_color, |
| 525 | float alpha, |
| 526 | nux::Vector4 xform_coords[], |
| 527 | + nux::Geometry geo, |
| 528 | bool render_indicators); |
| 529 | |
| 530 | void SetIconXForm (LauncherIcon *icon, nux::Matrix4 ViewProjectionMatrix, nux::Geometry geo, |
| 531 | @@ -198,6 +200,7 @@ |
| 532 | int _icon_size; |
| 533 | int _icon_image_size; |
| 534 | int _icon_image_size_delta; |
| 535 | + int _icon_glow_size; |
| 536 | int _dnd_delta; |
| 537 | int _dnd_security; |
| 538 | int _enter_y; |
| 539 | @@ -205,6 +208,7 @@ |
| 540 | nux::BaseTexture* _icon_bkg_texture; |
| 541 | nux::BaseTexture* _icon_shine_texture; |
| 542 | nux::BaseTexture* _icon_outline_texture; |
| 543 | + nux::BaseTexture* _icon_glow_texture; |
| 544 | nux::BaseTexture* _icon_2indicator; |
| 545 | nux::BaseTexture* _icon_3indicator; |
| 546 | nux::BaseTexture* _icon_4indicator; |
| 547 | |
| 548 | === modified file 'src/LauncherController.cpp' |
| 549 | --- src/LauncherController.cpp 2010-11-24 18:59:55 +0000 |
| 550 | +++ src/LauncherController.cpp 2010-11-25 07:36:29 +0000 |
| 551 | @@ -29,18 +29,18 @@ |
| 552 | |
| 553 | LauncherController::LauncherController(Launcher* launcher, CompScreen *screen, nux::BaseWindow* window) |
| 554 | { |
| 555 | - _launcher = launcher; |
| 556 | - _window = window; |
| 557 | - _screen = screen; |
| 558 | - _model = new LauncherModel (); |
| 559 | - _sort_priority = 0; |
| 560 | - |
| 561 | - _launcher->SetModel (_model); |
| 562 | - _favorite_store = FavoriteStore::GetDefault (); |
| 563 | + _launcher = launcher; |
| 564 | + _window = window; |
| 565 | + _screen = screen; |
| 566 | + _model = new LauncherModel (); |
| 567 | + _sort_priority = 0; |
| 568 | |
| 569 | - g_timeout_add (5000, (GSourceFunc) &LauncherController::BamfTimerCallback, this); |
| 570 | - InsertExpoAction (); |
| 571 | - InsertTrash (); |
| 572 | + _launcher->SetModel (_model); |
| 573 | + _favorite_store = FavoriteStore::GetDefault (); |
| 574 | + |
| 575 | + g_timeout_add (5000, (GSourceFunc) &LauncherController::BamfTimerCallback, this); |
| 576 | + InsertExpoAction (); |
| 577 | + InsertTrash (); |
| 578 | } |
| 579 | |
| 580 | LauncherController::~LauncherController() |
| 581 | @@ -48,10 +48,34 @@ |
| 582 | _favorite_store->UnReference (); |
| 583 | } |
| 584 | |
| 585 | +void |
| 586 | +LauncherController::PresentIconOwningWindow (Window window) |
| 587 | +{ |
| 588 | + LauncherModel::iterator it; |
| 589 | + |
| 590 | + for (it = _model->begin (); it != _model->end (); it++) |
| 591 | + { |
| 592 | + if ((*it)->IconOwnsWindow (window)) |
| 593 | + { |
| 594 | + (*it)->Present (2, 600); |
| 595 | + return; |
| 596 | + } |
| 597 | + } |
| 598 | + |
| 599 | + for (it = _model->shelf_begin (); it != _model->shelf_end (); it++) |
| 600 | + { |
| 601 | + if ((*it)->IconOwnsWindow (window)) |
| 602 | + { |
| 603 | + (*it)->Present (2, 600); |
| 604 | + return; |
| 605 | + } |
| 606 | + } |
| 607 | +} |
| 608 | + |
| 609 | void |
| 610 | LauncherController::OnExpoClicked (int button) |
| 611 | { |
| 612 | - PluginAdapter::Default ()->InitiateExpo (); |
| 613 | + PluginAdapter::Default ()->InitiateExpo (); |
| 614 | } |
| 615 | |
| 616 | void |
| 617 | @@ -65,131 +89,131 @@ |
| 618 | void |
| 619 | LauncherController::InsertExpoAction () |
| 620 | { |
| 621 | - SimpleLauncherIcon *expoIcon; |
| 622 | - expoIcon = new SimpleLauncherIcon (_launcher); |
| 623 | - |
| 624 | - expoIcon->SetTooltipText ("Workspace Switcher"); |
| 625 | - expoIcon->SetIconName ("workspace-switcher"); |
| 626 | - expoIcon->SetQuirk (LAUNCHER_ICON_QUIRK_VISIBLE, true); |
| 627 | - expoIcon->SetQuirk (LAUNCHER_ICON_QUIRK_RUNNING, false); |
| 628 | - expoIcon->SetIconType (LAUNCHER_ICON_TYPE_END); |
| 629 | - |
| 630 | - expoIcon->MouseClick.connect (sigc::mem_fun (this, &LauncherController::OnExpoClicked)); |
| 631 | - |
| 632 | - RegisterIcon (expoIcon); |
| 633 | + SimpleLauncherIcon *expoIcon; |
| 634 | + expoIcon = new SimpleLauncherIcon (_launcher); |
| 635 | + |
| 636 | + expoIcon->SetTooltipText ("Workspace Switcher"); |
| 637 | + expoIcon->SetIconName ("workspace-switcher"); |
| 638 | + expoIcon->SetQuirk (LAUNCHER_ICON_QUIRK_VISIBLE, true); |
| 639 | + expoIcon->SetQuirk (LAUNCHER_ICON_QUIRK_RUNNING, false); |
| 640 | + expoIcon->SetIconType (LAUNCHER_ICON_TYPE_END); |
| 641 | + |
| 642 | + expoIcon->MouseClick.connect (sigc::mem_fun (this, &LauncherController::OnExpoClicked)); |
| 643 | + |
| 644 | + RegisterIcon (expoIcon); |
| 645 | } |
| 646 | |
| 647 | bool |
| 648 | LauncherController::CompareIcons (LauncherIcon *first, LauncherIcon *second) |
| 649 | { |
| 650 | - if (first->Type () < second->Type ()) |
| 651 | - return true; |
| 652 | - else if (first->Type () > second->Type ()) |
| 653 | - return false; |
| 654 | + if (first->Type () < second->Type ()) |
| 655 | + return true; |
| 656 | + else if (first->Type () > second->Type ()) |
| 657 | + return false; |
| 658 | |
| 659 | - return first->SortPriority () < second->SortPriority (); |
| 660 | + return first->SortPriority () < second->SortPriority (); |
| 661 | } |
| 662 | |
| 663 | void |
| 664 | LauncherController::RegisterIcon (LauncherIcon *icon) |
| 665 | { |
| 666 | - _model->AddIcon (icon); |
| 667 | - _model->Sort (&LauncherController::CompareIcons); |
| 668 | + _model->AddIcon (icon); |
| 669 | + _model->Sort (&LauncherController::CompareIcons); |
| 670 | } |
| 671 | |
| 672 | /* static private */ |
| 673 | bool |
| 674 | LauncherController::BamfTimerCallback (void *data) |
| 675 | { |
| 676 | - LauncherController *self = (LauncherController*) data; |
| 677 | + LauncherController *self = (LauncherController*) data; |
| 678 | + |
| 679 | + self->SetupBamf (); |
| 680 | |
| 681 | - self->SetupBamf (); |
| 682 | - |
| 683 | - return false; |
| 684 | + return false; |
| 685 | } |
| 686 | |
| 687 | /* static private */ |
| 688 | void |
| 689 | LauncherController::OnViewOpened (BamfMatcher *matcher, BamfView *view, gpointer data) |
| 690 | { |
| 691 | - LauncherController *self = (LauncherController *) data; |
| 692 | - BamfApplication *app; |
| 693 | - |
| 694 | - if (!BAMF_IS_APPLICATION (view)) |
| 695 | - return; |
| 696 | - |
| 697 | - app = BAMF_APPLICATION (view); |
| 698 | - |
| 699 | - BamfLauncherIcon *icon = new BamfLauncherIcon (self->_launcher, app, self->_screen); |
| 700 | - icon->SetIconType (LAUNCHER_ICON_TYPE_APPLICATION); |
| 701 | - icon->SetSortPriority (self->_sort_priority++); |
| 702 | + LauncherController *self = (LauncherController *) data; |
| 703 | + BamfApplication *app; |
| 704 | + |
| 705 | + if (!BAMF_IS_APPLICATION (view)) |
| 706 | + return; |
| 707 | + |
| 708 | + app = BAMF_APPLICATION (view); |
| 709 | + |
| 710 | + BamfLauncherIcon *icon = new BamfLauncherIcon (self->_launcher, app, self->_screen); |
| 711 | + icon->SetIconType (LAUNCHER_ICON_TYPE_APPLICATION); |
| 712 | + icon->SetSortPriority (self->_sort_priority++); |
| 713 | |
| 714 | - self->RegisterIcon (icon); |
| 715 | + self->RegisterIcon (icon); |
| 716 | } |
| 717 | |
| 718 | LauncherIcon * |
| 719 | LauncherController::CreateFavorite (const char *file_path) |
| 720 | { |
| 721 | - BamfApplication *app; |
| 722 | - BamfLauncherIcon *icon; |
| 723 | - |
| 724 | - app = bamf_matcher_get_application_for_desktop_file (_matcher, file_path, true); |
| 725 | + BamfApplication *app; |
| 726 | + BamfLauncherIcon *icon; |
| 727 | + |
| 728 | + app = bamf_matcher_get_application_for_desktop_file (_matcher, file_path, true); |
| 729 | + |
| 730 | + if (g_object_get_qdata (G_OBJECT (app), g_quark_from_static_string ("unity-seen"))) |
| 731 | + { |
| 732 | + bamf_view_set_sticky (BAMF_VIEW (app), true); |
| 733 | + return 0; |
| 734 | + } |
| 735 | + |
| 736 | + g_object_set_qdata (G_OBJECT (app), g_quark_from_static_string ("unity-seen"), GINT_TO_POINTER (1)); |
| 737 | + |
| 738 | + bamf_view_set_sticky (BAMF_VIEW (app), true); |
| 739 | + icon = new BamfLauncherIcon (_launcher, app, _screen); |
| 740 | + icon->SetIconType (LAUNCHER_ICON_TYPE_FAVORITE); |
| 741 | + |
| 742 | + return icon; |
| 743 | +} |
| 744 | + |
| 745 | +/* private */ |
| 746 | +void |
| 747 | +LauncherController::SetupBamf () |
| 748 | +{ |
| 749 | + GList *apps, *l; |
| 750 | + GSList *favs, *f; |
| 751 | + BamfApplication *app; |
| 752 | + BamfLauncherIcon *icon; |
| 753 | + int priority = 0; |
| 754 | + |
| 755 | + _matcher = bamf_matcher_get_default (); |
| 756 | + |
| 757 | + favs = FavoriteStore::GetDefault ()->GetFavorites (); |
| 758 | + |
| 759 | + for (f = favs; f; f = f->next) |
| 760 | + { |
| 761 | + LauncherIcon *fav = CreateFavorite ((const char *) f->data); |
| 762 | + |
| 763 | + if (fav) |
| 764 | + { |
| 765 | + fav->SetSortPriority (priority); |
| 766 | + RegisterIcon (fav); |
| 767 | + priority++; |
| 768 | + } |
| 769 | + } |
| 770 | + |
| 771 | + apps = bamf_matcher_get_applications (_matcher); |
| 772 | + g_signal_connect (_matcher, "view-opened", (GCallback) &LauncherController::OnViewOpened, this); |
| 773 | + |
| 774 | + for (l = apps; l; l = l->next) |
| 775 | + { |
| 776 | + app = BAMF_APPLICATION (l->data); |
| 777 | |
| 778 | if (g_object_get_qdata (G_OBJECT (app), g_quark_from_static_string ("unity-seen"))) |
| 779 | - { |
| 780 | - bamf_view_set_sticky (BAMF_VIEW (app), true); |
| 781 | - return 0; |
| 782 | - } |
| 783 | - |
| 784 | + continue; |
| 785 | g_object_set_qdata (G_OBJECT (app), g_quark_from_static_string ("unity-seen"), GINT_TO_POINTER (1)); |
| 786 | |
| 787 | - bamf_view_set_sticky (BAMF_VIEW (app), true); |
| 788 | icon = new BamfLauncherIcon (_launcher, app, _screen); |
| 789 | - icon->SetIconType (LAUNCHER_ICON_TYPE_FAVORITE); |
| 790 | - |
| 791 | - return icon; |
| 792 | -} |
| 793 | - |
| 794 | -/* private */ |
| 795 | -void |
| 796 | -LauncherController::SetupBamf () |
| 797 | -{ |
| 798 | - GList *apps, *l; |
| 799 | - GSList *favs, *f; |
| 800 | - BamfApplication *app; |
| 801 | - BamfLauncherIcon *icon; |
| 802 | - int priority = 0; |
| 803 | - |
| 804 | - _matcher = bamf_matcher_get_default (); |
| 805 | - |
| 806 | - favs = FavoriteStore::GetDefault ()->GetFavorites (); |
| 807 | - |
| 808 | - for (f = favs; f; f = f->next) |
| 809 | - { |
| 810 | - LauncherIcon *fav = CreateFavorite ((const char *) f->data); |
| 811 | - |
| 812 | - if (fav) |
| 813 | - { |
| 814 | - fav->SetSortPriority (priority); |
| 815 | - RegisterIcon (fav); |
| 816 | - priority++; |
| 817 | - } |
| 818 | - } |
| 819 | - |
| 820 | - apps = bamf_matcher_get_applications (_matcher); |
| 821 | - g_signal_connect (_matcher, "view-opened", (GCallback) &LauncherController::OnViewOpened, this); |
| 822 | - |
| 823 | - for (l = apps; l; l = l->next) |
| 824 | - { |
| 825 | - app = BAMF_APPLICATION (l->data); |
| 826 | - |
| 827 | - if (g_object_get_qdata (G_OBJECT (app), g_quark_from_static_string ("unity-seen"))) |
| 828 | - continue; |
| 829 | - g_object_set_qdata (G_OBJECT (app), g_quark_from_static_string ("unity-seen"), GINT_TO_POINTER (1)); |
| 830 | - |
| 831 | - icon = new BamfLauncherIcon (_launcher, app, _screen); |
| 832 | - icon->SetSortPriority (_sort_priority++); |
| 833 | - RegisterIcon (icon); |
| 834 | - } |
| 835 | + icon->SetSortPriority (_sort_priority++); |
| 836 | + RegisterIcon (icon); |
| 837 | + } |
| 838 | } |
| 839 | |
| 840 | |
| 841 | === modified file 'src/LauncherController.h' |
| 842 | --- src/LauncherController.h 2010-11-24 18:59:55 +0000 |
| 843 | +++ src/LauncherController.h 2010-11-25 07:36:29 +0000 |
| 844 | @@ -43,7 +43,8 @@ |
| 845 | LauncherController(Launcher* launcher, CompScreen *screen, nux::BaseWindow* window); |
| 846 | ~LauncherController(); |
| 847 | |
| 848 | - |
| 849 | + void PresentIconOwningWindow (Window window); |
| 850 | + |
| 851 | private: |
| 852 | BamfMatcher* _matcher; |
| 853 | CompAction* _expo_action; |
| 854 | |
| 855 | === modified file 'src/LauncherIcon.cpp' |
| 856 | --- src/LauncherIcon.cpp 2010-11-24 05:20:00 +0000 |
| 857 | +++ src/LauncherIcon.cpp 2010-11-25 07:36:29 +0000 |
| 858 | @@ -52,6 +52,8 @@ |
| 859 | _related_windows = 0; |
| 860 | |
| 861 | _background_color = nux::Color::White; |
| 862 | + _glow_color = nux::Color::White; |
| 863 | + |
| 864 | _mouse_inside = false; |
| 865 | _tooltip = new nux::Tooltip (); |
| 866 | _icon_type = LAUNCHER_ICON_TYPE_NONE; |
| 867 | @@ -85,13 +87,18 @@ |
| 868 | return _background_color; |
| 869 | } |
| 870 | |
| 871 | +nux::Color LauncherIcon::GlowColor () |
| 872 | +{ |
| 873 | + return _glow_color; |
| 874 | +} |
| 875 | + |
| 876 | nux::BaseTexture * LauncherIcon::TextureForSize (int size) |
| 877 | { |
| 878 | nux::BaseTexture * result = GetTextureForSize (size); |
| 879 | return result; |
| 880 | } |
| 881 | |
| 882 | -nux::Color LauncherIcon::ColorForIcon (GdkPixbuf *pixbuf) |
| 883 | +void LauncherIcon::ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow) |
| 884 | { |
| 885 | unsigned int width = gdk_pixbuf_get_width (pixbuf); |
| 886 | unsigned int height = gdk_pixbuf_get_height (pixbuf); |
| 887 | @@ -136,8 +143,11 @@ |
| 888 | v = .85f; |
| 889 | |
| 890 | nux::HSVtoRGB (r, g, b, h, s, v); |
| 891 | + background = nux::Color (r, g, b); |
| 892 | |
| 893 | - return nux::Color (r, g, b); |
| 894 | + v = 1.0f; |
| 895 | + nux::HSVtoRGB (r, g, b, h, s, v); |
| 896 | + glow = nux::Color (r, g, b); |
| 897 | } |
| 898 | |
| 899 | nux::BaseTexture * LauncherIcon::TextureFromGtkTheme (const char *icon_name, int size) |
| 900 | @@ -178,7 +188,7 @@ |
| 901 | if (GDK_IS_PIXBUF (pbuf)) |
| 902 | { |
| 903 | result = nux::CreateTextureFromPixbuf (pbuf); |
| 904 | - _background_color = ColorForIcon (pbuf); |
| 905 | + ColorForIcon (pbuf, _background_color, _glow_color); |
| 906 | |
| 907 | g_object_unref (pbuf); |
| 908 | } |
| 909 | @@ -404,8 +414,13 @@ |
| 910 | return false; |
| 911 | } |
| 912 | |
| 913 | +int LauncherIcon::PresentUrgency () |
| 914 | +{ |
| 915 | + return _present_urgency; |
| 916 | +} |
| 917 | + |
| 918 | void |
| 919 | -LauncherIcon::Present (int length) |
| 920 | +LauncherIcon::Present (int present_urgency, int length) |
| 921 | { |
| 922 | if (GetQuirk (LAUNCHER_ICON_QUIRK_PRESENTED)) |
| 923 | return; |
| 924 | @@ -413,6 +428,7 @@ |
| 925 | if (length >= 0) |
| 926 | _present_time_handle = g_timeout_add (length, &LauncherIcon::OnPresentTimeout, this); |
| 927 | |
| 928 | + _present_urgency = present_urgency; |
| 929 | SetQuirk (LAUNCHER_ICON_QUIRK_PRESENTED, true); |
| 930 | } |
| 931 | |
| 932 | @@ -486,8 +502,10 @@ |
| 933 | needs_redraw.emit (this); |
| 934 | |
| 935 | // Present on urgent as a general policy |
| 936 | - if ((quirk == LAUNCHER_ICON_QUIRK_URGENT || quirk == LAUNCHER_ICON_QUIRK_VISIBLE) && value) |
| 937 | - Present (1500); |
| 938 | + if (quirk == LAUNCHER_ICON_QUIRK_VISIBLE && value) |
| 939 | + Present (0, 1500); |
| 940 | + if (quirk == LAUNCHER_ICON_QUIRK_URGENT && value) |
| 941 | + Present (1, 1500); |
| 942 | } |
| 943 | |
| 944 | void |
| 945 | |
| 946 | === modified file 'src/LauncherIcon.h' |
| 947 | --- src/LauncherIcon.h 2010-11-24 02:13:08 +0000 |
| 948 | +++ src/LauncherIcon.h 2010-11-25 07:36:29 +0000 |
| 949 | @@ -88,6 +88,7 @@ |
| 950 | int SortPriority (); |
| 951 | |
| 952 | int RelatedWindows (); |
| 953 | + int PresentUrgency (); |
| 954 | |
| 955 | bool GetQuirk (LauncherIconQuirk quirk); |
| 956 | struct timespec GetQuirkTime (LauncherIconQuirk quirk); |
| 957 | @@ -95,11 +96,13 @@ |
| 958 | LauncherIconType Type (); |
| 959 | |
| 960 | nux::Color BackgroundColor (); |
| 961 | + nux::Color GlowColor (); |
| 962 | |
| 963 | nux::BaseTexture * TextureForSize (int size); |
| 964 | |
| 965 | std::list<DbusmenuClient *> Menus (); |
| 966 | |
| 967 | + |
| 968 | sigc::signal<void, int> MouseDown; |
| 969 | sigc::signal<void, int> MouseUp; |
| 970 | sigc::signal<void> MouseEnter; |
| 971 | @@ -119,7 +122,8 @@ |
| 972 | void SetRelatedWindows (int windows); |
| 973 | void Remove (); |
| 974 | |
| 975 | - void Present (int length); |
| 976 | + |
| 977 | + void Present (int urgency, int length); |
| 978 | void Unpresent (); |
| 979 | |
| 980 | void SetIconType (LauncherIconType type); |
| 981 | @@ -129,6 +133,7 @@ |
| 982 | virtual nux::BaseTexture * GetTextureForSize (int size) = 0; |
| 983 | |
| 984 | virtual void OnCenterStabilized (nux::Point3 center) {}; |
| 985 | + virtual bool IconOwnsWindow (Window w) { return false; } |
| 986 | |
| 987 | nux::BaseTexture * TextureFromGtkTheme (const char *name, int size); |
| 988 | |
| 989 | @@ -161,11 +166,13 @@ |
| 990 | static gboolean OnPresentTimeout (gpointer data); |
| 991 | static gboolean OnCenterTimeout (gpointer data); |
| 992 | |
| 993 | - nux::Color ColorForIcon (GdkPixbuf *pixbuf); |
| 994 | + void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow); |
| 995 | |
| 996 | nux::Color _background_color; |
| 997 | + nux::Color _glow_color; |
| 998 | int _sort_priority; |
| 999 | int _related_windows; |
| 1000 | + int _present_urgency; |
| 1001 | guint _present_time_handle; |
| 1002 | guint _center_stabilize_handle; |
| 1003 | bool _quicklist_is_initialized; |
| 1004 | |
| 1005 | === modified file 'src/unity.cpp' |
| 1006 | --- src/unity.cpp 2010-11-24 17:53:21 +0000 |
| 1007 | +++ src/unity.cpp 2010-11-25 07:36:29 +0000 |
| 1008 | @@ -57,7 +57,6 @@ |
| 1009 | { |
| 1010 | /* At the end of every function, you must call BaseClass->functionName (args) in order to pass on |
| 1011 | * the call chain */ |
| 1012 | - |
| 1013 | cScreen->preparePaint (ms); |
| 1014 | } |
| 1015 | |
| 1016 | @@ -125,6 +124,7 @@ |
| 1017 | bool ret; |
| 1018 | |
| 1019 | doShellRepaint = true; |
| 1020 | + allowWindowPaint = true; |
| 1021 | |
| 1022 | /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ |
| 1023 | ret = gScreen->glPaintOutput (attrib, transform, region, output, mask); |
| 1024 | @@ -145,6 +145,7 @@ |
| 1025 | CompOutput *output, // Output properties. Use this to the get output width and height for the output being painted |
| 1026 | unsigned int mask /* Some other paint properties, see opengl.h */) |
| 1027 | { |
| 1028 | + allowWindowPaint = false; |
| 1029 | /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ |
| 1030 | gScreen->glPaintOutput (attrib, transform, region, output, mask); |
| 1031 | } |
| 1032 | @@ -269,7 +270,7 @@ |
| 1033 | const CompRegion ®ion, |
| 1034 | unsigned int mask) |
| 1035 | { |
| 1036 | - if (uScreen->doShellRepaint) |
| 1037 | + if (uScreen->doShellRepaint && uScreen->allowWindowPaint) |
| 1038 | { |
| 1039 | const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList (); |
| 1040 | |
| 1041 | @@ -381,6 +382,9 @@ |
| 1042 | void |
| 1043 | UnityWindow::windowNotify (CompWindowNotify n) |
| 1044 | { |
| 1045 | + if (n == CompWindowNotifyMinimize) |
| 1046 | + uScreen->controller->PresentIconOwningWindow (window->id ()); |
| 1047 | + |
| 1048 | window->windowNotify (n); |
| 1049 | } |
| 1050 | |
| 1051 | |
| 1052 | === modified file 'src/unity.h' |
| 1053 | --- src/unity.h 2010-11-24 17:53:21 +0000 |
| 1054 | +++ src/unity.h 2010-11-25 07:36:29 +0000 |
| 1055 | @@ -160,6 +160,7 @@ |
| 1056 | initPluginForScreen (CompPlugin *p); |
| 1057 | |
| 1058 | bool doShellRepaint; |
| 1059 | + bool allowWindowPaint; |
| 1060 | |
| 1061 | protected: |
| 1062 | |
| 1063 | @@ -190,14 +191,16 @@ |
| 1064 | static gboolean |
| 1065 | strutHackTimeout (gpointer data); |
| 1066 | |
| 1067 | - Launcher *launcher; |
| 1068 | - LauncherController *controller; |
| 1069 | - PanelView *panelView; |
| 1070 | - nux::WindowThread *wt; |
| 1071 | - nux::BaseWindow *launcherWindow; |
| 1072 | - nux::BaseWindow *panelWindow; |
| 1073 | - nux::Geometry lastTooltipArea; |
| 1074 | + Launcher *launcher; |
| 1075 | + LauncherController *controller; |
| 1076 | + PanelView *panelView; |
| 1077 | + nux::WindowThread *wt; |
| 1078 | + nux::BaseWindow *launcherWindow; |
| 1079 | + nux::BaseWindow *panelWindow; |
| 1080 | + nux::Geometry lastTooltipArea; |
| 1081 | IntrospectionDBusInterface *debugger; |
| 1082 | + |
| 1083 | + friend class UnityWindow; |
| 1084 | }; |
| 1085 | |
| 1086 | class UnityWindow : |


Works great.