~mir-team/miral/zesty

« back to all changes in this revision

Viewing changes to miral/basic_window_manager.cpp

  • Committer: Bileto Bot
  • Date: 2016-10-24 15:25:22 UTC
  • mfrom: (334.1.4 miral-0.3)
  • Revision ID: ci-train-bot@canonical.com-20161024152522-g758835syc6fca10
* New upstream release 0.3.0 (https://launchpad.net/miral/+milestone/0.3)
  - ABI summary:
    . miral ABI unchanged at 1
  - Enhancements:
    . Add miral-xrun as a better way to use Xmir
    . Added miral/version.h to allow permit compile-time feature detection
    . A convenient overload of WindowManagerTools::modify_window() that
      doesn't require the WindowInfo
    . Add userdata property to WindowSpecification and copy it to WindowInfo
    . miral::Keymap - support for keyboard maps (either programatically
      Keymap::set_keymap(), or via config --keymap)
  - Bugs fixed:
    . Crash after closing Qt dialog (LP: #1631958)
    . tooltips positioned wrong with mir0.24 (LP: #1632325, LP: #1633052)
    . Shell wants way to associate initially requested window creation state
      with the window later created (#1629349)
    . [Xmir] Alt+` switch between different apps not just windows
      (LP: #1625849)
    . miral-shell splash screen should be fullscreen.
    . TitlebarWindowManagerPolicy::end_resize() should do nothing if not
      resizing
    . deduplicate logging of WindowSpecification::top_left

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
    if (spec.parent().is_set() && spec.parent().value().lock())
103
103
        window_info.parent(info_for(spec.parent().value()).window());
104
104
 
 
105
    if (spec.userdata().is_set())
 
106
        window_info.userdata() = spec.userdata().value();
 
107
 
105
108
    session_info.add_window(window);
106
109
 
107
110
    auto const parent = window_info.parent();
528
531
 
529
532
void miral::BasicWindowManager::modify_window(WindowInfo& window_info, WindowSpecification const& modifications)
530
533
{
531
 
    auto window_info_tmp = window_info;
 
534
    WindowInfo window_info_tmp{window_info};
532
535
 
533
536
#define COPY_IF_SET(field)\
534
537
    if (modifications.field().is_set())\
547
550
    COPY_IF_SET(output_id);
548
551
    COPY_IF_SET(preferred_orientation);
549
552
    COPY_IF_SET(confine_pointer);
 
553
    COPY_IF_SET(userdata);
550
554
 
551
555
#undef COPY_IF_SET
552
556
 
733
737
 
734
738
    auto restore_rect = window_info.restore_rect();
735
739
 
736
 
    // window_info.restore_rect() was cached on last state change, update to reflect current window position 
 
740
    // window_info.restore_rect() was cached on last state change, update to reflect current window position
737
741
    switch (window_info.state())
738
742
    {
739
743
    case mir_surface_state_restored:
763
767
    if (modifications.top_left().is_set())
764
768
        restore_rect.top_left = modifications.top_left().value();
765
769
 
766
 
    // If the client or shell has also set size, that overrides restore_rect default 
 
770
    // If the client or shell has also set size, that overrides restore_rect default
767
771
    if (modifications.size().is_set())
768
772
        restore_rect.size = modifications.size().value();
769
773
 
839
843
    policy->advise_state_change(window_info, value);
840
844
    window_info.state(value);
841
845
 
842
 
    if (window_info.is_visible())
843
 
    {
844
 
        mir_surface->show();
845
 
    }
846
 
    else
847
 
    {
 
846
    mir_surface->configure(mir_surface_attrib_state, value);
 
847
 
 
848
    switch (value)
 
849
    {
 
850
    case mir_surface_state_hidden:
 
851
    case mir_surface_state_minimized:
848
852
        mir_surface->hide();
849
853
 
850
854
        if (window == active_window())
854
858
                {
855
859
                    if (candidate == window)
856
860
                        return true;
 
861
                    if (!std::shared_ptr<scene::Surface>(candidate)->visible())
 
862
                        return true;
857
863
                    auto const w = candidate;
858
864
                    return !(select_active_window(w));
859
865
                });
860
866
        }
 
867
        break;
 
868
 
 
869
    default:
 
870
        mir_surface->show();
861
871
    }
862
 
 
863
 
    mir_surface->configure(mir_surface_attrib_state, value);
864
872
}
865
873
 
866
 
 
867
874
void miral::BasicWindowManager::update_event_timestamp(MirKeyboardEvent const* kev)
868
875
{
869
876
    auto iev = mir_keyboard_event_input_event(kev);
925
932
    {
926
933
        if (std::shared_ptr<mir::scene::Surface> surface = child)
927
934
        {
928
 
            if (surface->type() == mir_surface_type_dialog)
929
 
                return (select_active_window(child));
 
935
            if (surface->type() == mir_surface_type_dialog && surface->visible())
 
936
                return select_active_window(child);
930
937
        }
931
938
    }
932
939