mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
WindowServer: Run clang-format on everything.
This commit is contained in:
parent
76b3337498
commit
8358833bc8
12 changed files with 134 additions and 114 deletions
|
@ -1,9 +1,9 @@
|
||||||
|
#include <SharedGraphics/CharacterBitmap.h>
|
||||||
|
#include <SharedGraphics/Painter.h>
|
||||||
|
#include <SharedGraphics/StylePainter.h>
|
||||||
#include <WindowServer/WSButton.h>
|
#include <WindowServer/WSButton.h>
|
||||||
#include <WindowServer/WSEvent.h>
|
#include <WindowServer/WSEvent.h>
|
||||||
#include <WindowServer/WSWindowManager.h>
|
#include <WindowServer/WSWindowManager.h>
|
||||||
#include <SharedGraphics/Painter.h>
|
|
||||||
#include <SharedGraphics/StylePainter.h>
|
|
||||||
#include <SharedGraphics/CharacterBitmap.h>
|
|
||||||
|
|
||||||
WSButton::WSButton(WSWindowFrame& frame, Retained<CharacterBitmap>&& bitmap, Function<void(WSButton&)>&& on_click_handler)
|
WSButton::WSButton(WSWindowFrame& frame, Retained<CharacterBitmap>&& bitmap, Function<void(WSButton&)>&& on_click_handler)
|
||||||
: on_click(move(on_click_handler))
|
: on_click(move(on_click_handler))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include <WindowServer/WSCPUMonitor.h>
|
#include <WindowServer/WSCPUMonitor.h>
|
||||||
#include <WindowServer/WSEventLoop.h>
|
#include <WindowServer/WSEventLoop.h>
|
||||||
#include <WindowServer/WSWindowManager.h>
|
#include <WindowServer/WSWindowManager.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
WSCPUMonitor::WSCPUMonitor()
|
WSCPUMonitor::WSCPUMonitor()
|
||||||
: m_proc_all("/proc/all")
|
: m_proc_all("/proc/all")
|
||||||
|
@ -27,7 +27,8 @@ WSCPUMonitor::WSCPUMonitor()
|
||||||
monitor.m_dirty = true;
|
monitor.m_dirty = true;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}, this);
|
},
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSCPUMonitor::get_cpu_usage(unsigned& busy, unsigned& idle)
|
void WSCPUMonitor::get_cpu_usage(unsigned& busy, unsigned& idle)
|
||||||
|
@ -65,8 +66,7 @@ void WSCPUMonitor::paint(Painter& painter, const Rect& rect)
|
||||||
painter.draw_line(
|
painter.draw_line(
|
||||||
{ rect.x() + i, rect.bottom() },
|
{ rect.x() + i, rect.bottom() },
|
||||||
{ rect.x() + i, (int)(rect.y() + (rect.height() - (cpu_usage * (float)rect.height()))) },
|
{ rect.x() + i, (int)(rect.y() + (rect.height() - (cpu_usage * (float)rect.height()))) },
|
||||||
Color::from_rgb(0xaa6d4b)
|
Color::from_rgb(0xaa6d4b));
|
||||||
);
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
#include <WindowServer/WSEventLoop.h>
|
|
||||||
#include <WindowServer/WSEvent.h>
|
|
||||||
#include <LibCore/CObject.h>
|
|
||||||
#include <WindowServer/WSWindowManager.h>
|
|
||||||
#include <WindowServer/WSScreen.h>
|
|
||||||
#include <WindowServer/WSClientConnection.h>
|
|
||||||
#include <WindowServer/WSAPITypes.h>
|
|
||||||
#include <WindowServer/WSCursor.h>
|
|
||||||
#include <Kernel/KeyCode.h>
|
#include <Kernel/KeyCode.h>
|
||||||
#include <Kernel/MousePacket.h>
|
#include <Kernel/MousePacket.h>
|
||||||
#include <sys/socket.h>
|
#include <LibCore/CObject.h>
|
||||||
|
#include <WindowServer/WSAPITypes.h>
|
||||||
|
#include <WindowServer/WSClientConnection.h>
|
||||||
|
#include <WindowServer/WSCursor.h>
|
||||||
|
#include <WindowServer/WSEvent.h>
|
||||||
|
#include <WindowServer/WSEventLoop.h>
|
||||||
|
#include <WindowServer/WSScreen.h>
|
||||||
|
#include <WindowServer/WSWindowManager.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
//#define WSMESSAGELOOP_DEBUG
|
//#define WSMESSAGELOOP_DEBUG
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#include "WSMenu.h"
|
#include "WSMenu.h"
|
||||||
#include "WSMenuItem.h"
|
|
||||||
#include "WSWindow.h"
|
|
||||||
#include "WSEvent.h"
|
#include "WSEvent.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSEventLoop.h"
|
||||||
#include "WSWindowManager.h"
|
#include "WSMenuItem.h"
|
||||||
#include "WSScreen.h"
|
#include "WSScreen.h"
|
||||||
#include <WindowServer/WSAPITypes.h>
|
#include "WSWindow.h"
|
||||||
#include <WindowServer/WSClientConnection.h>
|
#include "WSWindowManager.h"
|
||||||
#include <SharedGraphics/CharacterBitmap.h>
|
#include <SharedGraphics/CharacterBitmap.h>
|
||||||
|
#include <SharedGraphics/Font.h>
|
||||||
#include <SharedGraphics/Painter.h>
|
#include <SharedGraphics/Painter.h>
|
||||||
#include <SharedGraphics/StylePainter.h>
|
#include <SharedGraphics/StylePainter.h>
|
||||||
#include <SharedGraphics/Font.h>
|
#include <WindowServer/WSAPITypes.h>
|
||||||
|
#include <WindowServer/WSClientConnection.h>
|
||||||
|
|
||||||
WSMenu::WSMenu(WSClientConnection* client, int menu_id, const String& name)
|
WSMenu::WSMenu(WSClientConnection* client, int menu_id, const String& name)
|
||||||
: m_client(client)
|
: m_client(client)
|
||||||
|
|
|
@ -11,4 +11,3 @@ WSMenuBar::WSMenuBar(WSClientConnection& client, int menubar_id)
|
||||||
WSMenuBar::~WSMenuBar()
|
WSMenuBar::~WSMenuBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
#include "WSScreen.h"
|
||||||
#include "WSCompositor.h"
|
#include "WSCompositor.h"
|
||||||
#include "WSEvent.h"
|
#include "WSEvent.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSEventLoop.h"
|
||||||
#include "WSScreen.h"
|
|
||||||
#include "WSWindowManager.h"
|
#include "WSWindowManager.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "WSWindow.h"
|
#include "WSWindow.h"
|
||||||
#include "WSWindowManager.h"
|
|
||||||
#include "WSEvent.h"
|
#include "WSEvent.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSEventLoop.h"
|
||||||
|
#include "WSWindowManager.h"
|
||||||
#include <WindowServer/WSAPITypes.h>
|
#include <WindowServer/WSAPITypes.h>
|
||||||
#include <WindowServer/WSClientConnection.h>
|
#include <WindowServer/WSClientConnection.h>
|
||||||
|
|
||||||
|
@ -77,10 +77,14 @@ void WSWindow::set_rect(const Rect& rect)
|
||||||
static WSAPI_MouseButton to_api(MouseButton button)
|
static WSAPI_MouseButton to_api(MouseButton button)
|
||||||
{
|
{
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case MouseButton::None: return WSAPI_MouseButton::NoButton;
|
case MouseButton::None:
|
||||||
case MouseButton::Left: return WSAPI_MouseButton::Left;
|
return WSAPI_MouseButton::NoButton;
|
||||||
case MouseButton::Right: return WSAPI_MouseButton::Right;
|
case MouseButton::Left:
|
||||||
case MouseButton::Middle: return WSAPI_MouseButton::Middle;
|
return WSAPI_MouseButton::Left;
|
||||||
|
case MouseButton::Right:
|
||||||
|
return WSAPI_MouseButton::Right;
|
||||||
|
case MouseButton::Middle:
|
||||||
|
return WSAPI_MouseButton::Middle;
|
||||||
}
|
}
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -93,12 +97,23 @@ void WSWindow::handle_mouse_event(const WSMouseEvent& event)
|
||||||
server_message.window_id = window_id();
|
server_message.window_id = window_id();
|
||||||
|
|
||||||
switch (event.type()) {
|
switch (event.type()) {
|
||||||
case WSEvent::MouseMove: server_message.type = WSAPI_ServerMessage::Type::MouseMove; break;
|
case WSEvent::MouseMove:
|
||||||
case WSEvent::MouseDown: server_message.type = WSAPI_ServerMessage::Type::MouseDown; break;
|
server_message.type = WSAPI_ServerMessage::Type::MouseMove;
|
||||||
case WSEvent::MouseDoubleClick: server_message.type = WSAPI_ServerMessage::Type::MouseDoubleClick; break;
|
break;
|
||||||
case WSEvent::MouseUp: server_message.type = WSAPI_ServerMessage::Type::MouseUp; break;
|
case WSEvent::MouseDown:
|
||||||
case WSEvent::MouseWheel: server_message.type = WSAPI_ServerMessage::Type::MouseWheel; break;
|
server_message.type = WSAPI_ServerMessage::Type::MouseDown;
|
||||||
default: ASSERT_NOT_REACHED();
|
break;
|
||||||
|
case WSEvent::MouseDoubleClick:
|
||||||
|
server_message.type = WSAPI_ServerMessage::Type::MouseDoubleClick;
|
||||||
|
break;
|
||||||
|
case WSEvent::MouseUp:
|
||||||
|
server_message.type = WSAPI_ServerMessage::Type::MouseUp;
|
||||||
|
break;
|
||||||
|
case WSEvent::MouseWheel:
|
||||||
|
server_message.type = WSAPI_ServerMessage::Type::MouseWheel;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
server_message.mouse.position = event.position();
|
server_message.mouse.position = event.position();
|
||||||
|
|
|
@ -248,7 +248,8 @@ void WSWindowFrame::notify_window_rect_changed(const Rect& old_rect, const Rect&
|
||||||
{
|
{
|
||||||
int window_button_width = 15;
|
int window_button_width = 15;
|
||||||
int window_button_height = 15;
|
int window_button_height = 15;
|
||||||
int x = title_bar_text_rect().right() + 1;;
|
int x = title_bar_text_rect().right() + 1;
|
||||||
|
;
|
||||||
for (auto& button : m_buttons) {
|
for (auto& button : m_buttons) {
|
||||||
x -= window_button_width;
|
x -= window_button_width;
|
||||||
Rect rect { x, 0, window_button_width, window_button_height };
|
Rect rect { x, 0, window_button_width, window_button_height };
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "WSWindowManager.h"
|
||||||
#include "WSCompositor.h"
|
#include "WSCompositor.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSEventLoop.h"
|
||||||
#include "WSMenu.h"
|
#include "WSMenu.h"
|
||||||
|
@ -5,7 +6,6 @@
|
||||||
#include "WSMenuItem.h"
|
#include "WSMenuItem.h"
|
||||||
#include "WSScreen.h"
|
#include "WSScreen.h"
|
||||||
#include "WSWindow.h"
|
#include "WSWindow.h"
|
||||||
#include "WSWindowManager.h"
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibCore/CTimer.h>
|
#include <LibCore/CTimer.h>
|
||||||
|
@ -211,7 +211,6 @@ void WSWindowManager::set_resolution(int width, int height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WSWindowManager::menubar_menu_margin() const
|
int WSWindowManager::menubar_menu_margin() const
|
||||||
{
|
{
|
||||||
return 16;
|
return 16;
|
||||||
|
@ -442,7 +441,8 @@ void WSWindowManager::start_window_drag(WSWindow& window, const WSMouseEvent& ev
|
||||||
printf("[WM] Begin dragging WSWindow{%p}\n", &window);
|
printf("[WM] Begin dragging WSWindow{%p}\n", &window);
|
||||||
#endif
|
#endif
|
||||||
move_to_front_and_make_active(window);
|
move_to_front_and_make_active(window);
|
||||||
m_drag_window = window.make_weak_ptr();;
|
m_drag_window = window.make_weak_ptr();
|
||||||
|
;
|
||||||
m_drag_origin = event.position();
|
m_drag_origin = event.position();
|
||||||
m_drag_window_origin = window.position();
|
m_drag_window_origin = window.position();
|
||||||
invalidate(window);
|
invalidate(window);
|
||||||
|
@ -472,7 +472,8 @@ void WSWindowManager::start_window_resize(WSWindow& window, const Point& positio
|
||||||
printf("[WM] Begin resizing WSWindow{%p}\n", &window);
|
printf("[WM] Begin resizing WSWindow{%p}\n", &window);
|
||||||
#endif
|
#endif
|
||||||
m_resizing_mouse_button = button;
|
m_resizing_mouse_button = button;
|
||||||
m_resize_window = window.make_weak_ptr();;
|
m_resize_window = window.make_weak_ptr();
|
||||||
|
;
|
||||||
m_resize_origin = position;
|
m_resize_origin = position;
|
||||||
m_resize_window_original_rect = window.rect();
|
m_resize_window_original_rect = window.rect();
|
||||||
|
|
||||||
|
@ -628,9 +629,12 @@ void WSWindowManager::set_cursor_tracking_button(WSButton* button)
|
||||||
CElapsedTimer& WSWindowManager::DoubleClickInfo::click_clock(MouseButton button)
|
CElapsedTimer& WSWindowManager::DoubleClickInfo::click_clock(MouseButton button)
|
||||||
{
|
{
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case MouseButton::Left: return m_left_click_clock;
|
case MouseButton::Left:
|
||||||
case MouseButton::Right: return m_right_click_clock;
|
return m_left_click_clock;
|
||||||
case MouseButton::Middle: return m_middle_click_clock;
|
case MouseButton::Right:
|
||||||
|
return m_right_click_clock;
|
||||||
|
case MouseButton::Middle:
|
||||||
|
return m_middle_click_clock;
|
||||||
default:
|
default:
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include <WindowServer/WSWindowSwitcher.h>
|
|
||||||
#include <WindowServer/WSWindowManager.h>
|
|
||||||
#include <WindowServer/WSEvent.h>
|
|
||||||
#include <WindowServer/WSScreen.h>
|
|
||||||
#include <SharedGraphics/Font.h>
|
#include <SharedGraphics/Font.h>
|
||||||
#include <SharedGraphics/StylePainter.h>
|
#include <SharedGraphics/StylePainter.h>
|
||||||
|
#include <WindowServer/WSEvent.h>
|
||||||
|
#include <WindowServer/WSScreen.h>
|
||||||
|
#include <WindowServer/WSWindowManager.h>
|
||||||
|
#include <WindowServer/WSWindowSwitcher.h>
|
||||||
|
|
||||||
static WSWindowSwitcher* s_the;
|
static WSWindowSwitcher* s_the;
|
||||||
|
|
||||||
|
@ -123,7 +123,8 @@ void WSWindowSwitcher::refresh()
|
||||||
m_selected_index = m_windows.size();
|
m_selected_index = m_windows.size();
|
||||||
m_windows.append(window.make_weak_ptr());
|
m_windows.append(window.make_weak_ptr());
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
}, true);
|
},
|
||||||
|
true);
|
||||||
if (m_windows.is_empty()) {
|
if (m_windows.is_empty()) {
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
#include <LibCore/CConfigFile.h>
|
||||||
|
#include <WindowServer/WSCompositor.h>
|
||||||
|
#include <WindowServer/WSEventLoop.h>
|
||||||
#include <WindowServer/WSScreen.h>
|
#include <WindowServer/WSScreen.h>
|
||||||
#include <WindowServer/WSWindowManager.h>
|
#include <WindowServer/WSWindowManager.h>
|
||||||
#include <WindowServer/WSEventLoop.h>
|
|
||||||
#include <WindowServer/WSCompositor.h>
|
|
||||||
#include <LibCore/CConfigFile.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue