From 54045771c7fddcb1e325a5f596e4e60be1ec87d5 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 1 Feb 2016 12:40:47 +0100 Subject: [PATCH] window decorator: report decorator margins --- repos/gems/src/app/decorator/main.cc | 17 +++++++++++++++++ repos/gems/src/app/decorator/window.h | 10 ++++++++++ repos/gems/src/app/themed_decorator/main.cc | 17 +++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/repos/gems/src/app/decorator/main.cc b/repos/gems/src/app/decorator/main.cc index 84dd31afa..49a232b31 100644 --- a/repos/gems/src/app/decorator/main.cc +++ b/repos/gems/src/app/decorator/main.cc @@ -77,6 +77,8 @@ struct Decorator::Main : Window_factory_base bool window_layout_update_needed = false; + Reporter decorator_margins_reporter = { "decorator_margins" }; + Animator animator; /** @@ -123,6 +125,21 @@ struct Decorator::Main : Window_factory_base hover_reporter.enabled(true); + decorator_margins_reporter.enabled(true); + + Genode::Reporter::Xml_generator xml(decorator_margins_reporter, [&] () + { + xml.node("floating", [&] () { + + Window::Border const border = Window::border_floating(); + + xml.attribute("top", border.top); + xml.attribute("bottom", border.bottom); + xml.attribute("left", border.left); + xml.attribute("right", border.right); + }); + }); + /* import initial state */ handle_pointer_update(0); handle_window_layout_update(0); diff --git a/repos/gems/src/app/decorator/window.h b/repos/gems/src/app/decorator/window.h index d64206b13..08da789fe 100644 --- a/repos/gems/src/app/decorator/window.h +++ b/repos/gems/src/app/decorator/window.h @@ -397,6 +397,16 @@ class Decorator::Window : public Window_base _animator(animator), _config(config) { } + /** + * Return border margins of floating window + */ + static Border border_floating() + { + return Border(_border_size + _title_height, + _border_size, _border_size, _border_size); + + } + void stack(Nitpicker::Session::View_handle neighbor) override { _neighbor = neighbor; diff --git a/repos/gems/src/app/themed_decorator/main.cc b/repos/gems/src/app/themed_decorator/main.cc index 720a68c36..b8b7be070 100644 --- a/repos/gems/src/app/themed_decorator/main.cc +++ b/repos/gems/src/app/themed_decorator/main.cc @@ -73,6 +73,8 @@ struct Decorator::Main : Window_factory_base Theme theme { *Genode::env()->heap() }; + Reporter decorator_margins_reporter = { "decorator_margins" }; + /** * Process the update every 'frame_period' nitpicker sync signals. The * 'frame_cnt' holds the counter of the nitpicker sync signals. @@ -136,6 +138,21 @@ struct Decorator::Main : Window_factory_base hover_reporter.enabled(true); + decorator_margins_reporter.enabled(true); + + Genode::Reporter::Xml_generator xml(decorator_margins_reporter, [&] () + { + xml.node("floating", [&] () { + + Theme::Margins const margins = theme.decor_margins(); + + xml.attribute("top", margins.top); + xml.attribute("bottom", margins.bottom); + xml.attribute("left", margins.left); + xml.attribute("right", margins.right); + }); + }); + /* import initial state */ handle_pointer_update(0); handle_window_layout_update(0);