~ci-train-bot/miral/miral-ubuntu-zesty-2818

« back to all changes in this revision

Viewing changes to miral-shell/titlebar_window_manager.cpp

  • Committer: Bileto Bot
  • Date: 2017-01-27 03:02:13 UTC
  • mfrom: (330.2.167 miral0)
  • Revision ID: ci-train-bot@canonical.com-20170127030213-q62prxw1xh7kasbu
* New upstream release 1.1.0 (https://launchpad.net/miral/+milestone/1.1)
  - ABI summary:
    . miral ABI unchanged at 2
  - Enhancements:
    . Compatibility with Mir 0.26 and update API to use the new Mir types and
      enums.
    . Logging of exceptions added to --window-management-trace
    . Rename WindowManagementPolicy::place_new_surface => place_new_window"
  - Bugs fixed:
    . top-level window is not raised along with its child (LP: #1658085)
    . miral-shell depends on default cursor theme being installed
      (LP: #1658159)

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
            }
110
110
        }
111
111
    }
112
 
    
 
112
 
113
113
    if (resizing && !is_resize_event)
114
114
        end_resize();
115
115
 
312
312
    }
313
313
}
314
314
 
315
 
void TitlebarWindowManagerPolicy::advise_state_change(WindowInfo const& window_info, MirSurfaceState state)
 
315
void TitlebarWindowManagerPolicy::advise_state_change(WindowInfo const& window_info, MirWindowState state)
316
316
{
317
317
    CanonicalWindowManagerPolicy::advise_state_change(window_info, state);
318
318
 
347
347
        switch (modifiers)
348
348
        {
349
349
        case mir_input_event_modifier_alt:
350
 
            toggle(mir_surface_state_maximized);
 
350
            toggle(mir_window_state_maximized);
351
351
            return true;
352
352
 
353
353
        case mir_input_event_modifier_shift:
354
 
            toggle(mir_surface_state_vertmaximized);
 
354
            toggle(mir_window_state_vertmaximized);
355
355
            return true;
356
356
 
357
357
        case mir_input_event_modifier_ctrl:
358
 
            toggle(mir_surface_state_horizmaximized);
 
358
            toggle(mir_window_state_horizmaximized);
359
359
            return true;
360
360
 
361
361
        default:
418
418
                break;
419
419
 
420
420
            case KEY_UP:
421
 
                if (window_info.state() != mir_surface_state_vertmaximized &&
422
 
                    window_info.state() != mir_surface_state_maximized)
 
421
                if (window_info.state() != mir_window_state_vertmaximized &&
 
422
                    window_info.state() != mir_window_state_maximized)
423
423
                {
424
424
                    modifications.top_left() =
425
425
                        Point{active_window.top_left().x, active_display.top_left.y} + DeltaY{title_bar_height};
455
455
    return false;
456
456
}
457
457
 
458
 
void TitlebarWindowManagerPolicy::toggle(MirSurfaceState state)
 
458
void TitlebarWindowManagerPolicy::toggle(MirWindowState state)
459
459
{
460
460
    if (auto const window = tools.active_window())
461
461
    {
463
463
 
464
464
        WindowSpecification modifications;
465
465
 
466
 
        modifications.state() = (info.state() == state) ? mir_surface_state_restored : state;
 
466
        modifications.state() = (info.state() == state) ? mir_window_state_restored : state;
467
467
        tools.place_and_size_for_state(modifications, info);
468
468
        tools.modify_window(info, modifications);
469
469
    }
558
558
    }
559
559
}
560
560
 
561
 
WindowSpecification TitlebarWindowManagerPolicy::place_new_surface(
 
561
WindowSpecification TitlebarWindowManagerPolicy::place_new_window(
562
562
    ApplicationInfo const& app_info, WindowSpecification const& request_parameters)
563
563
{
564
 
    auto parameters = CanonicalWindowManagerPolicy::place_new_surface(app_info, request_parameters);
 
564
    auto parameters = CanonicalWindowManagerPolicy::place_new_window(app_info, request_parameters);
565
565
 
566
566
    bool const needs_titlebar = WindowInfo::needs_titlebar(parameters.type().value());
567
567
 
568
 
    if (parameters.state().value() != mir_surface_state_fullscreen && needs_titlebar)
 
568
    if (parameters.state().value() != mir_window_state_fullscreen && needs_titlebar)
569
569
        parameters.top_left() = Point{parameters.top_left().value().x, parameters.top_left().value().y + DeltaY{title_bar_height}};
570
570
 
571
571
    if (app_info.application() == titlebar_provider->session())