commit 65884acf6a9b2b290cfaa1725a426adec260c8d6
parent 11630440d7ad3cd72f857b671e533caa285c5466
Author: deurzen <m.deurzen@tum.de>
Date: Tue, 28 Sep 2021 03:01:45 +0200
adds initial active-partition resolution
Diffstat:
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/core/context.hh b/src/core/context.hh
@@ -40,6 +40,12 @@ public:
return m_workspaces.size();
}
+ Workspace_ptr
+ workspace() const
+ {
+ return mp_active;
+ }
+
bool
is_partitioned() const
{
diff --git a/src/core/model.cc b/src/core/model.cc
@@ -967,6 +967,17 @@ Model::acquire_partitions()
spdlog::debug("acquired {} partitions", m_partitions.size());
}
+void
+Model::resolve_active_partition(winsys::Pos pos)
+{
+ if (m_partitions.size() == 1 || mp_partition->contains(pos))
+ return;
+
+ for (Partition_ptr partition : m_partitions)
+ if (partition->contains(pos))
+ activate_partition(partition);
+}
+
const Screen&
Model::active_screen() const
{
@@ -1315,7 +1326,8 @@ Model::activate_partition(Partition_ptr next_partition)
stop_moving();
stop_resizing();
- // TODO
+ m_partitions.activate_element(next_partition);
+ mp_partition = next_partition;
}
@@ -1350,7 +1362,8 @@ Model::activate_context(Context_ptr next_context)
stop_moving();
stop_resizing();
- // TODO
+ m_contexts.activate_element(next_context);
+ mp_context = next_context;
}
@@ -3419,6 +3432,8 @@ Model::handle_mouse(MouseEvent event)
switch (event.capture.kind) {
case MouseCapture::MouseCaptureKind::Motion:
{
+ resolve_active_partition(event.capture.root_rpos);
+
perform_move(event.capture.root_rpos);
perform_resize(event.capture.root_rpos);
diff --git a/src/core/model.hh b/src/core/model.hh
@@ -64,6 +64,7 @@ private:
void process_query(winsys::QueryMessage);
void acquire_partitions();
+ void resolve_active_partition(winsys::Pos);
const winsys::Screen& active_screen() const;