Some renames

This commit is contained in:
mattkae 2023-02-25 12:57:18 -05:00
parent f854be38d4
commit 1d824274fc
4 changed files with 22 additions and 20 deletions

View File

@ -15,7 +15,7 @@ find_package(PkgConfig)
pkg_check_modules(MIRAL miral REQUIRED) pkg_check_modules(MIRAL miral REQUIRED)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
add_executable(compositor src/main.cpp src/FloatingWindowManager.cpp src/TileNode.cpp) add_executable(compositor src/main.cpp src/TilingWindowManager.cpp src/TileNode.cpp)
target_include_directories(compositor PUBLIC SYSTEM ${MIRAL_INCLUDE_DIRS}) target_include_directories(compositor PUBLIC SYSTEM ${MIRAL_INCLUDE_DIRS})
target_link_libraries( compositor ${MIRAL_LDFLAGS}) target_link_libraries( compositor ${MIRAL_LDFLAGS})

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "FloatingWindowManager.hpp" #include "TilingWindowManager.hpp"
#include "mir/geometry/forward.h" #include "mir/geometry/forward.h"
#include "mir/logging/logger.h" #include "mir/logging/logger.h"
#include "mir_toolkit/events/enums.h" #include "mir_toolkit/events/enums.h"
@ -40,7 +40,7 @@
using namespace miral; using namespace miral;
using namespace miral::toolkit; using namespace miral::toolkit;
FloatingWindowManagerPolicy::FloatingWindowManagerPolicy( TilingWindowManagerPolicy::TilingWindowManagerPolicy(
WindowManagerTools const& inTools, WindowManagerTools const& inTools,
miral::InternalClientLauncher const& launcher, miral::InternalClientLauncher const& launcher,
std::function<void()>& shutdown_hook) : std::function<void()>& shutdown_hook) :
@ -52,9 +52,9 @@ FloatingWindowManagerPolicy::FloatingWindowManagerPolicy(
mActiveTileNode = nullptr; mActiveTileNode = nullptr;
} }
FloatingWindowManagerPolicy::~FloatingWindowManagerPolicy() = default; TilingWindowManagerPolicy::~TilingWindowManagerPolicy() = default;
bool FloatingWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) { bool TilingWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) {
if (MinimalWindowManager::handle_keyboard_event(event)) { if (MinimalWindowManager::handle_keyboard_event(event)) {
return true; return true;
} }
@ -89,7 +89,7 @@ bool FloatingWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const*
return false; return false;
} }
void FloatingWindowManagerPolicy::requestPlacementStrategyChange(PlacementStrategy strategy) { void TilingWindowManagerPolicy::requestPlacementStrategyChange(PlacementStrategy strategy) {
auto activeWindow = tools.active_window(); auto activeWindow = tools.active_window();
if (!activeWindow) { if (!activeWindow) {
@ -101,7 +101,7 @@ void FloatingWindowManagerPolicy::requestPlacementStrategyChange(PlacementStrate
mActiveTileNode->setPlacementStrategy(strategy); mActiveTileNode->setPlacementStrategy(strategy);
} }
void FloatingWindowManagerPolicy::requestQuitSelectedApplication() { void TilingWindowManagerPolicy::requestQuitSelectedApplication() {
if (!mActiveWindow.get()) { if (!mActiveWindow.get()) {
std::cout << "There is no current application to quit." << std::endl; std::cout << "There is no current application to quit." << std::endl;
return; return;
@ -127,7 +127,7 @@ void FloatingWindowManagerPolicy::requestQuitSelectedApplication() {
std::cout << "Quit the current application." << std::endl; std::cout << "Quit the current application." << std::endl;
} }
bool FloatingWindowManagerPolicy::requestChangeActiveWindow(int moveAmount, std::shared_ptr<TileNode> tileNodeToSearch) { bool TilingWindowManagerPolicy::requestChangeActiveWindow(int moveAmount, std::shared_ptr<TileNode> tileNodeToSearch) {
auto parent = tileNodeToSearch->getParent(); auto parent = tileNodeToSearch->getParent();
if (!parent.get()) { if (!parent.get()) {
// We are a root node, all moves are illegal. // We are a root node, all moves are illegal.
@ -169,9 +169,11 @@ bool FloatingWindowManagerPolicy::requestChangeActiveWindow(int moveAmount, std:
// We're going to try and go higher into the tree // We're going to try and go higher into the tree
return requestChangeActiveWindow(moveAmount, parent); return requestChangeActiveWindow(moveAmount, parent);
} }
return false;
} }
WindowSpecification FloatingWindowManagerPolicy::place_new_window( WindowSpecification TilingWindowManagerPolicy::place_new_window(
ApplicationInfo const& app_info, WindowSpecification const& request_parameters) ApplicationInfo const& app_info, WindowSpecification const& request_parameters)
{ {
auto parameters = MinimalWindowManager::place_new_window(app_info, request_parameters); auto parameters = MinimalWindowManager::place_new_window(app_info, request_parameters);
@ -231,15 +233,15 @@ WindowSpecification FloatingWindowManagerPolicy::place_new_window(
return parameters; return parameters;
} }
bool FloatingWindowManagerPolicy::handle_pointer_event(MirPointerEvent const* event) { bool TilingWindowManagerPolicy::handle_pointer_event(MirPointerEvent const* event) {
return true; return true;
} }
bool FloatingWindowManagerPolicy::handle_touch_event(MirTouchEvent const* event) { bool TilingWindowManagerPolicy::handle_touch_event(MirTouchEvent const* event) {
return true; return true;
} }
void FloatingWindowManagerPolicy::advise_new_window(WindowInfo const& window_info) { void TilingWindowManagerPolicy::advise_new_window(WindowInfo const& window_info) {
std::cout << "Adding window into the TileNode" << std::endl; std::cout << "Adding window into the TileNode" << std::endl;
// Add the window into the current tile. // Add the window into the current tile.
@ -260,17 +262,17 @@ void FloatingWindowManagerPolicy::advise_new_window(WindowInfo const& window_inf
} }
} }
void FloatingWindowManagerPolicy::handle_window_ready(WindowInfo& window_info) { void TilingWindowManagerPolicy::handle_window_ready(WindowInfo& window_info) {
MinimalWindowManager::handle_window_ready(window_info); MinimalWindowManager::handle_window_ready(window_info);
return; return;
} }
void FloatingWindowManagerPolicy::advise_focus_gained(WindowInfo const& info) { void TilingWindowManagerPolicy::advise_focus_gained(WindowInfo const& info) {
MinimalWindowManager::advise_focus_gained(info); MinimalWindowManager::advise_focus_gained(info);
return; return;
} }
void FloatingWindowManagerPolicy::handle_modify_window(WindowInfo& window_info, WindowSpecification const& modifications) { void TilingWindowManagerPolicy::handle_modify_window(WindowInfo& window_info, WindowSpecification const& modifications) {
MinimalWindowManager::handle_modify_window(window_info, modifications); MinimalWindowManager::handle_modify_window(window_info, modifications);
return; return;
} }

View File

@ -18,13 +18,13 @@ using namespace mir::geometry;
/** /**
* An implementation of a tiling window manager, much like i3. * An implementation of a tiling window manager, much like i3.
*/ */
class FloatingWindowManagerPolicy : public miral::MinimalWindowManager { class TilingWindowManagerPolicy : public miral::MinimalWindowManager {
public: public:
FloatingWindowManagerPolicy( TilingWindowManagerPolicy(
miral::WindowManagerTools const& tools, miral::WindowManagerTools const& tools,
miral::InternalClientLauncher const& launcher, miral::InternalClientLauncher const& launcher,
std::function<void()>& shutdown_hook); std::function<void()>& shutdown_hook);
~FloatingWindowManagerPolicy(); ~TilingWindowManagerPolicy();
/** /**
* Positions the new window in reference to the currently selected window and the current mode. * Positions the new window in reference to the currently selected window and the current mode.

View File

@ -1,7 +1,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include "FloatingWindowManager.hpp" #include "TilingWindowManager.hpp"
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <miral/set_window_management_policy.h> #include <miral/set_window_management_policy.h>
#include <miral/display_configuration_option.h> #include <miral/display_configuration_option.h>
@ -33,7 +33,7 @@ int main(int argc, char const* argv[]) {
ExternalClientLauncher external_client_launcher; ExternalClientLauncher external_client_launcher;
WindowManagerOptions window_managers WindowManagerOptions window_managers
{ {
add_window_manager_policy<FloatingWindowManagerPolicy>("floating", launcher, shutdown_hook) add_window_manager_policy<TilingWindowManagerPolicy>("tiling", launcher, shutdown_hook)
}; };
std::string terminal_cmd{"xfce4-terminal"}; std::string terminal_cmd{"xfce4-terminal"};