From 73110e25a9ac95256157c35a1bdc8b4867185070 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 6 Feb 2020 20:03:37 +0100 Subject: [PATCH] WindowServer: Move classes into WindowServer namespace Also remove the leading WS from names and filenames. --- .../DisplayProperties/DisplayProperties.cpp | 2 +- Libraries/LibGUI/GWindowType.h | 2 +- .../WindowServer/{WSButton.cpp => Button.cpp} | 32 +- Servers/WindowServer/{WSButton.h => Button.h} | 20 +- ...entConnection.cpp => ClientConnection.cpp} | 198 +++++----- ...SClientConnection.h => ClientConnection.h} | 40 +- .../{WSClipboard.cpp => Clipboard.cpp} | 26 +- .../{WSClipboard.h => Clipboard.h} | 12 +- .../{WSCompositor.cpp => Compositor.cpp} | 106 ++--- .../{WSCompositor.h => Compositor.h} | 16 +- .../WindowServer/{WSCursor.cpp => Cursor.cpp} | 56 +-- Servers/WindowServer/{WSCursor.h => Cursor.h} | 18 +- Servers/WindowServer/{WSEvent.h => Event.h} | 40 +- .../{WSEventLoop.cpp => EventLoop.cpp} | 42 +- .../{WSEventLoop.h => EventLoop.h} | 12 +- Servers/WindowServer/Makefile | 30 +- Servers/WindowServer/{WSMenu.cpp => Menu.cpp} | 138 +++---- Servers/WindowServer/{WSMenu.h => Menu.h} | 70 ++-- .../{WSMenuBar.cpp => MenuBar.cpp} | 14 +- .../WindowServer/{WSMenuBar.h => MenuBar.h} | 24 +- .../{WSMenuItem.cpp => MenuItem.cpp} | 28 +- .../WindowServer/{WSMenuItem.h => MenuItem.h} | 18 +- .../{WSMenuManager.cpp => MenuManager.cpp} | 150 ++++---- .../{WSMenuManager.h => MenuManager.h} | 80 ++-- .../WindowServer/{WSScreen.cpp => Screen.cpp} | 54 +-- Servers/WindowServer/{WSScreen.h => Screen.h} | 16 +- .../WindowServer/{WSWindow.cpp => Window.cpp} | 197 +++++----- Servers/WindowServer/{WSWindow.h => Window.h} | 70 ++-- .../{WSWindowFrame.cpp => WindowFrame.cpp} | 77 ++-- .../{WSWindowFrame.h => WindowFrame.h} | 28 +- ...{WSWindowManager.cpp => WindowManager.cpp} | 363 +++++++++--------- .../{WSWindowManager.h => WindowManager.h} | 251 ++++++------ ...SWindowSwitcher.cpp => WindowSwitcher.cpp} | 79 ++-- .../{WSWindowSwitcher.h => WindowSwitcher.h} | 28 +- .../{WSWindowType.h => WindowType.h} | 2 +- Servers/WindowServer/main.cpp | 18 +- 36 files changed, 1238 insertions(+), 1119 deletions(-) rename Servers/WindowServer/{WSButton.cpp => Button.cpp} (79%) rename Servers/WindowServer/{WSButton.h => Button.h} (86%) rename Servers/WindowServer/{WSClientConnection.cpp => ClientConnection.cpp} (68%) rename Servers/WindowServer/{WSClientConnection.h => ClientConnection.h} (89%) rename Servers/WindowServer/{WSClipboard.cpp => Clipboard.cpp} (78%) rename Servers/WindowServer/{WSClipboard.h => Clipboard.h} (94%) rename Servers/WindowServer/{WSCompositor.cpp => Compositor.cpp} (86%) rename Servers/WindowServer/{WSCompositor.h => Compositor.h} (94%) rename Servers/WindowServer/{WSCursor.cpp => Cursor.cpp} (52%) rename Servers/WindowServer/{WSCursor.h => Cursor.h} (82%) rename Servers/WindowServer/{WSEvent.h => Event.h} (80%) rename Servers/WindowServer/{WSEventLoop.cpp => EventLoop.cpp} (83%) rename Servers/WindowServer/{WSEventLoop.h => EventLoop.h} (94%) rename Servers/WindowServer/{WSMenu.cpp => Menu.cpp} (82%) rename Servers/WindowServer/{WSMenu.h => Menu.h} (70%) rename Servers/WindowServer/{WSMenuBar.cpp => MenuBar.cpp} (89%) rename Servers/WindowServer/{WSMenuBar.h => MenuBar.h} (83%) rename Servers/WindowServer/{WSMenuItem.cpp => MenuItem.cpp} (79%) rename Servers/WindowServer/{WSMenuItem.h => MenuItem.h} (90%) rename Servers/WindowServer/{WSMenuManager.cpp => MenuManager.cpp} (73%) rename Servers/WindowServer/{WSMenuManager.h => MenuManager.h} (60%) rename Servers/WindowServer/{WSScreen.cpp => Screen.cpp} (69%) rename Servers/WindowServer/{WSScreen.h => Screen.h} (92%) rename Servers/WindowServer/{WSWindow.cpp => Window.cpp} (62%) rename Servers/WindowServer/{WSWindow.h => Window.h} (84%) rename Servers/WindowServer/{WSWindowFrame.cpp => WindowFrame.cpp} (84%) rename Servers/WindowServer/{WSWindowFrame.h => WindowFrame.h} (82%) rename Servers/WindowServer/{WSWindowManager.cpp => WindowManager.cpp} (75%) rename Servers/WindowServer/{WSWindowManager.h => WindowManager.h} (52%) rename Servers/WindowServer/{WSWindowSwitcher.cpp => WindowSwitcher.cpp} (74%) rename Servers/WindowServer/{WSWindowSwitcher.h => WindowSwitcher.h} (82%) rename Servers/WindowServer/{WSWindowType.h => WindowType.h} (98%) diff --git a/Applications/DisplayProperties/DisplayProperties.cpp b/Applications/DisplayProperties/DisplayProperties.cpp index 84668a0c45..3a538f14af 100644 --- a/Applications/DisplayProperties/DisplayProperties.cpp +++ b/Applications/DisplayProperties/DisplayProperties.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include DisplayPropertiesWidget::DisplayPropertiesWidget() : m_wm_config(Core::ConfigFile::get_for_app("WindowManager")) diff --git a/Libraries/LibGUI/GWindowType.h b/Libraries/LibGUI/GWindowType.h index 4099dc5ebe..44f342212a 100644 --- a/Libraries/LibGUI/GWindowType.h +++ b/Libraries/LibGUI/GWindowType.h @@ -28,7 +28,7 @@ namespace GUI { -// Keep this in sync with WSWindowType. +// Keep this in sync with WindowType. enum class WindowType { Invalid = 0, Normal, diff --git a/Servers/WindowServer/WSButton.cpp b/Servers/WindowServer/Button.cpp similarity index 79% rename from Servers/WindowServer/WSButton.cpp rename to Servers/WindowServer/Button.cpp index fd901fd6e7..449ce083e0 100644 --- a/Servers/WindowServer/WSButton.cpp +++ b/Servers/WindowServer/Button.cpp @@ -27,24 +27,26 @@ #include #include #include -#include -#include -#include +#include +#include +#include -WSButton::WSButton(WSWindowFrame& frame, NonnullRefPtr&& bitmap, Function&& on_click_handler) +namespace WindowServer { + +Button::Button(WindowFrame& frame, NonnullRefPtr&& bitmap, Function&& on_click_handler) : on_click(move(on_click_handler)) , m_frame(frame) , m_bitmap(move(bitmap)) { } -WSButton::~WSButton() +Button::~Button() { } -void WSButton::paint(Gfx::Painter& painter) +void Button::paint(Gfx::Painter& painter) { - auto palette = WSWindowManager::the().palette(); + auto palette = WindowManager::the().palette(); Gfx::PainterStateSaver saver(painter); painter.translate(relative_rect().location()); Gfx::StylePainter::paint_button(painter, rect(), palette, Gfx::ButtonStyle::Normal, m_pressed, m_hovered); @@ -55,18 +57,18 @@ void WSButton::paint(Gfx::Painter& painter) painter.draw_bitmap(x_location, *m_bitmap, palette.button_text()); } -void WSButton::on_mouse_event(const WSMouseEvent& event) +void Button::on_mouse_event(const MouseEvent& event) { - auto& wm = WSWindowManager::the(); + auto& wm = WindowManager::the(); - if (event.type() == WSEvent::MouseDown && event.button() == MouseButton::Left) { + if (event.type() == Event::MouseDown && event.button() == MouseButton::Left) { m_pressed = true; wm.set_cursor_tracking_button(this); wm.invalidate(screen_rect()); return; } - if (event.type() == WSEvent::MouseUp && event.button() == MouseButton::Left) { + if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) { if (wm.cursor_tracking_button() != this) return; wm.set_cursor_tracking_button(nullptr); @@ -81,7 +83,7 @@ void WSButton::on_mouse_event(const WSMouseEvent& event) return; } - if (event.type() == WSEvent::MouseMove) { + if (event.type() == Event::MouseMove) { bool old_hovered = m_hovered; m_hovered = rect().contains(event.position()); wm.set_hovered_button(m_hovered ? this : nullptr); @@ -89,7 +91,7 @@ void WSButton::on_mouse_event(const WSMouseEvent& event) wm.invalidate(screen_rect()); } - if (event.type() == WSEvent::MouseMove && event.buttons() & (unsigned)MouseButton::Left) { + if (event.type() == Event::MouseMove && event.buttons() & (unsigned)MouseButton::Left) { if (wm.cursor_tracking_button() != this) return; bool old_pressed = m_pressed; @@ -99,7 +101,9 @@ void WSButton::on_mouse_event(const WSMouseEvent& event) } } -Gfx::Rect WSButton::screen_rect() const +Gfx::Rect Button::screen_rect() const { return m_relative_rect.translated(m_frame.rect().location()); } + +} diff --git a/Servers/WindowServer/WSButton.h b/Servers/WindowServer/Button.h similarity index 86% rename from Servers/WindowServer/WSButton.h rename to Servers/WindowServer/Button.h index ac25210bdc..8bb1ed5b9b 100644 --- a/Servers/WindowServer/WSButton.h +++ b/Servers/WindowServer/Button.h @@ -36,13 +36,15 @@ class CharacterBitmap; class Painter; } -class WSMouseEvent; -class WSWindowFrame; +namespace WindowServer { -class WSButton : public Weakable { +class MouseEvent; +class WindowFrame; + +class Button : public Weakable