Skip to content

Commit

Permalink
Merge branch 'main' into feature/mirtest-internal-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Jan 29, 2025
2 parents 1dd58e8 + 3a8c5a9 commit f0e22c3
Show file tree
Hide file tree
Showing 64 changed files with 1,048 additions and 229 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

set(MIR_VERSION_MAJOR 2)
set(MIR_VERSION_MINOR 19)
set(MIR_VERSION_PATCH 2)
set(MIR_VERSION_MINOR 20)
set(MIR_VERSION_PATCH 0)

add_compile_definitions(MIR_VERSION_MAJOR=${MIR_VERSION_MAJOR})
add_compile_definitions(MIR_VERSION_MINOR=${MIR_VERSION_MINOR})
Expand Down
10 changes: 10 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
mir (2.19.3) UNRELEASED; urgency=medium

* New upstream release 2.19.3

- Bug fixes:
. Don't leak VirtualInputDevice keyboards (#3720)
. kms: skip `simple-framebuffer` devices (#3721)

-- Michał Sawicz <[email protected]> Thu, 16 Jan 2025 15:07:09 +0100

mir (2.19.2) UNRELEASED; urgency=medium

* New upstream release 2.19.2
Expand Down
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Vcs-Git: https://github.com/MirServer/mir

#TODO: Packaging infrastructure for better dependency generation,
# ala pkg-xorg's xviddriver:Provides and ABI detection.
Package: libmirserver62
Package: libmirserver63
Section: libs
Architecture: linux-any
Multi-Arch: same
Expand Down Expand Up @@ -158,7 +158,7 @@ Section: libdevel
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libmirserver62 (= ${binary:Version}),
Depends: libmirserver63 (= ${binary:Version}),
libmirplatform-dev (= ${binary:Version}),
libmircommon-dev (= ${binary:Version}),
libglm-dev,
Expand All @@ -175,7 +175,7 @@ Section: libdevel
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libmirserver62 (= ${binary:Version}),
Depends: libmirserver63 (= ${binary:Version}),
libmirplatform-dev (= ${binary:Version}),
libmircommon-dev (= ${binary:Version}),
libmircore-dev (= ${binary:Version}),
Expand Down
4 changes: 4 additions & 0 deletions debian/libmiral7.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,7 @@ libmiral.so.7 libmiral7 #MINVER#
(c++)"miral::InputConfiguration::touchpad(miral::InputConfiguration::Touchpad const&)@MIRAL_5.1" 5.1.0
(c++)"miral::InputConfiguration::~InputConfiguration()@MIRAL_5.1" 5.1.0
(c++)"miral::WindowManagerTools::move_cursor_to(mir::geometry::generic::Point<float>)@MIRAL_5.1" 5.1.0
MIRAL_5.2@MIRAL_5.2 5.2.0
(c++)"miral::MinimalWindowManager::MinimalWindowManager(miral::WindowManagerTools const&, MirInputEventModifier, miral::FocusStealing)@MIRAL_5.0" 5.2.0
(c++)"miral::MinimalWindowManager::MinimalWindowManager(miral::WindowManagerTools const&, miral::FocusStealing)@MIRAL_5.0" 5.2.0
(c++)"miral::WindowManagementPolicy::~WindowManagementPolicy()@MIRAL_5.0" 5.2.0
1 change: 0 additions & 1 deletion debian/libmirserver62.install

This file was deleted.

1 change: 1 addition & 0 deletions debian/libmirserver63.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libmirserver.so.63
12 changes: 11 additions & 1 deletion examples/example-server-lib/floating_window_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ FloatingWindowManagerPolicy::FloatingWindowManagerPolicy(
std::shared_ptr<SplashSession> const& spinner,
miral::InternalClientLauncher const& launcher,
std::function<void()>& shutdown_hook) :
MinimalWindowManager(tools),
FloatingWindowManagerPolicy{tools, spinner, launcher, shutdown_hook, FocusStealing::allow}
{
}

FloatingWindowManagerPolicy::FloatingWindowManagerPolicy(
WindowManagerTools const& tools,
std::shared_ptr<SplashSession> const& spinner,
miral::InternalClientLauncher const& launcher,
std::function<void()>& shutdown_hook,
FocusStealing focus_stealing) :
MinimalWindowManager(tools, focus_stealing),
spinner{spinner},
decoration_provider{std::make_unique<DecorationProvider>()}
{
Expand Down
8 changes: 8 additions & 0 deletions examples/example-server-lib/floating_window_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ class FloatingWindowManagerPolicy : public miral::MinimalWindowManager
std::shared_ptr<SplashSession> const& spinner,
miral::InternalClientLauncher const& launcher,
std::function<void()>& shutdown_hook);

FloatingWindowManagerPolicy(
miral::WindowManagerTools const& tools,
std::shared_ptr<SplashSession> const& spinner,
miral::InternalClientLauncher const& launcher,
std::function<void()>& shutdown_hook,
miral::FocusStealing focus_stealing);

~FloatingWindowManagerPolicy();

virtual miral::WindowSpecification place_new_window(
Expand Down
18 changes: 15 additions & 3 deletions examples/miral-shell/shell_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "miral/minimal_window_manager.h"
#include "tiling_window_manager.h"
#include "floating_window_manager.h"
#include "wallpaper_config.h"
Expand Down Expand Up @@ -68,9 +69,10 @@ int main(int argc, char const* argv[])

SpinnerSplash spinner;
InternalClientLauncher launcher;
auto focus_stealing_prevention = FocusStealing::allow;
WindowManagerOptions window_managers
{
add_window_manager_policy<FloatingWindowManagerPolicy>("floating", spinner, launcher, shutdown_hook),
add_window_manager_policy<FloatingWindowManagerPolicy>("floating", spinner, launcher, shutdown_hook, focus_stealing_prevention),
add_window_manager_policy<TilingWindowManagerPolicy>("tiling", spinner, launcher),
};

Expand Down Expand Up @@ -108,12 +110,12 @@ int main(int argc, char const* argv[])
case XKB_KEY_t:
case XKB_KEY_T:
external_client_launcher.launch({terminal_cmd});
return false;
return true;

case XKB_KEY_x:
case XKB_KEY_X:
external_client_launcher.launch_using_x11({"xterm"});
return false;
return true;

default:
return false;
Expand All @@ -132,13 +134,23 @@ int main(int argc, char const* argv[])
}
};

auto const to_focus_stealing = [](bool focus_stealing_prevention)
{
if (focus_stealing_prevention)
return FocusStealing::prevent;
else
return FocusStealing::allow;
};

return runner.run_with(
{
CursorTheme{"default:DMZ-White"},
WaylandExtensions{},
X11Support{},
ConfigureDecorations{},
pre_init(ConfigurationOption{[&](bool is_set)
{ focus_stealing_prevention = to_focus_stealing(is_set); },
"focus-stealing-prevention", "prevent focus stealing", false}),
window_managers,
display_configuration_options,
external_client_launcher,
Expand Down
17 changes: 17 additions & 0 deletions include/miral/miral/minimal_window_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,35 @@

namespace miral
{
enum class FocusStealing
{
prevent,
allow
};

/// Minimal implementation of a floating window management policy
/// \remark Since MirAL 2.5
class MinimalWindowManager : public WindowManagementPolicy
{
public:
explicit MinimalWindowManager(WindowManagerTools const& tools);

/// Allows shells to enable or disable focus stealing prevention.
/// \remark Since MirAL 5.2
explicit MinimalWindowManager(WindowManagerTools const& tools, FocusStealing focus_stealing);

/// Allows shells to change the modifer used to identify a window drag gesture
/// The default is mir_input_event_modifier_alt
/// \remark Since MirAL 3.7
MinimalWindowManager(WindowManagerTools const& tools, MirInputEventModifier pointer_drag_modifier);

/// Allows shells to to change the modifer used to identify a window drag
/// gesture and enable or disable focus stealing prevention.
/// The default drag modifier is mir_input_event_modifier_alt.
/// \remark Since MirAL 5.2
MinimalWindowManager(
WindowManagerTools const& tools, MirInputEventModifier pointer_drag_modifier, FocusStealing focus_stealing);

~MinimalWindowManager();

/// Honours the requested specification
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(MIRPLATFORM_ABI 30)

set(MIRAL_VERSION_MAJOR 5)
set(MIRAL_VERSION_MINOR 1)
set(MIRAL_VERSION_MINOR 2)
set(MIRAL_VERSION_PATCH 0)
set(MIRAL_VERSION ${MIRAL_VERSION_MAJOR}.${MIRAL_VERSION_MINOR}.${MIRAL_VERSION_PATCH})

Expand Down
2 changes: 2 additions & 0 deletions src/include/server/mir/default_server_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class DefaultServerConfiguration : public virtual ServerConfiguration
std::shared_ptr<scene::TextInputHub> the_text_input_hub() override;
std::shared_ptr<scene::IdleHub> the_idle_hub() override;
std::shared_ptr<shell::IdleHandler> the_idle_handler() override;
std::shared_ptr<shell::TokenAuthority> the_token_authority() override;
std::function<void()> the_stop_callback() override;
std::shared_ptr<scene::SessionLock> the_session_lock() override;
void add_wayland_extension(
Expand Down Expand Up @@ -407,6 +408,7 @@ class DefaultServerConfiguration : public virtual ServerConfiguration
CachedPtr<scene::TextInputHub> text_input_hub;
CachedPtr<scene::IdleHub> idle_hub;
CachedPtr<shell::IdleHandler> idle_handler;
CachedPtr<shell::TokenAuthority> token_authority;
CachedPtr<shell::DisplayLayout> shell_display_layout;
CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;
CachedPtr<compositor::Compositor> compositor;
Expand Down
4 changes: 2 additions & 2 deletions src/include/server/mir/frontend/connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#ifndef MIR_FRONTEND_CONNECTOR_H_
#define MIR_FRONTEND_CONNECTOR_H_

#include <mir/optional_value.h>
#include <functional>
#include <memory>
#include <optional>
#include <string>

namespace mir
Expand All @@ -41,7 +41,7 @@ class Connector

virtual int client_socket_fd(std::function<void(std::shared_ptr<scene::Session> const& session)> const& connect_handler) const = 0;

virtual auto socket_name() const -> optional_value<std::string> = 0;
virtual auto socket_name() const -> std::optional<std::string> = 0;

protected:
Connector() = default;
Expand Down
11 changes: 8 additions & 3 deletions src/include/server/mir/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
#define MIR_SERVER_H_

#include "mir/shell/window_manager_builder.h"
#include "mir/optional_value.h"
#include "mir_toolkit/common.h"

#include <functional>
#include <memory>
#include <optional>
#include <vector>

struct wl_display;
Expand All @@ -47,6 +47,7 @@ class DisplayLayout;
class DisplayConfigurationController;
class FocusController;
class IdleHandler;
class TokenAuthority;
class InputTargeter;
class PersistentSurfaceStore;
class Shell;
Expand Down Expand Up @@ -435,6 +436,8 @@ class Server
auto the_idle_handler() const ->
std::shared_ptr<shell::IdleHandler>;

auto the_token_authority() const ->
std::shared_ptr<shell::TokenAuthority>;
/** @} */

/** @name Client side support
Expand Down Expand Up @@ -468,10 +471,12 @@ class Server
std::function<bool(std::shared_ptr<scene::Session> const&, char const*)> const& extension_filter);

/// Get the name of the Wayland endpoint (if any) usable as a $WAYLAND_DISPLAY value
auto wayland_display() const -> optional_value<std::string>;
auto wayland_display() const -> std::optional<std::string>;

/// Get the name of the X11 display usable as a $DISPLAY value
auto x11_display() const -> optional_value<std::string>;
auto x11_display() const -> std::optional<std::string>;

auto get_activation_token() const -> std::string;

/// Overrides the standard set of Wayland extensions (mir::frontend::get_standard_extensions()) with a new list
void set_enabled_wayland_extensions(std::vector<std::string> const& extensions);
Expand Down
2 changes: 2 additions & 0 deletions src/include/server/mir/server_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace shell
class SessionContainer;
class Shell;
class IdleHandler;
class TokenAuthority;
}
namespace graphics
{
Expand Down Expand Up @@ -100,6 +101,7 @@ class ServerConfiguration
virtual std::shared_ptr<scene::TextInputHub> the_text_input_hub() = 0;
virtual std::shared_ptr<scene::IdleHub> the_idle_hub() = 0;
virtual std::shared_ptr<shell::IdleHandler> the_idle_handler() = 0;
virtual std::shared_ptr<shell::TokenAuthority> the_token_authority() = 0;
virtual std::function<void()> the_stop_callback() = 0;
virtual void add_wayland_extension(
std::string const& name,
Expand Down
1 change: 1 addition & 0 deletions src/include/server/mir/shell/abstract_shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class AbstractShell : public virtual Shell, public virtual FocusController
void raise(SurfaceSet const& surfaces) override;
void swap_z_order(SurfaceSet const& first, SurfaceSet const& second) override;
void send_to_back(SurfaceSet const& surfaces) override;
auto is_above(std::weak_ptr<scene::Surface> const& a, std::weak_ptr<scene::Surface> const& b) const -> bool override;
/** @} */

void add_display(geometry::Rectangle const& area) override;
Expand Down
4 changes: 4 additions & 0 deletions src/include/server/mir/shell/focus_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class FocusController

virtual void send_to_back(SurfaceSet const& surfaces) = 0;

/// Returns true if surface [a] is above surface [b].
virtual auto is_above(std::weak_ptr<scene::Surface> const& a, std::weak_ptr<scene::Surface> const& b) const
-> bool = 0;

protected:
FocusController() = default;
FocusController(FocusController const&) = delete;
Expand Down
2 changes: 2 additions & 0 deletions src/include/server/mir/shell/shell_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class ShellWrapper : public Shell

void send_to_back(SurfaceSet const& surfaces) override;

auto is_above(std::weak_ptr<scene::Surface> const& a, std::weak_ptr<scene::Surface> const& b) const -> bool override;

auto open_session(
pid_t client_pid,
Fd socket_fd,
Expand Down
3 changes: 3 additions & 0 deletions src/include/server/mir/shell/surface_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class SurfaceStack

virtual void send_to_back(scene::SurfaceSet const& surfaces) = 0;

virtual auto is_above(std::weak_ptr<scene::Surface> const& a, std::weak_ptr<scene::Surface> const& b) const
-> bool = 0;

protected:
SurfaceStack() = default;
virtual ~SurfaceStack() = default;
Expand Down
2 changes: 2 additions & 0 deletions src/include/server/mir/shell/surface_stack_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class SurfaceStackWrapper : public SurfaceStack

void send_to_back(scene::SurfaceSet const& surfaces) override;

auto is_above(std::weak_ptr<scene::Surface> const& a, std::weak_ptr<scene::Surface> const& b) const -> bool override;

protected:
std::shared_ptr<SurfaceStack> const wrapped;
};
Expand Down
Loading

0 comments on commit f0e22c3

Please sign in to comment.