mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 03:08:11 +00: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/WSEvent.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)
|
||||
: on_click(move(on_click_handler))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <WindowServer/WSCPUMonitor.h>
|
||||
#include <WindowServer/WSEventLoop.h>
|
||||
#include <WindowServer/WSWindowManager.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
WSCPUMonitor::WSCPUMonitor()
|
||||
: m_proc_all("/proc/all")
|
||||
|
@ -27,7 +27,8 @@ WSCPUMonitor::WSCPUMonitor()
|
|||
monitor.m_dirty = true;
|
||||
sleep(1);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
}
|
||||
|
||||
void WSCPUMonitor::get_cpu_usage(unsigned& busy, unsigned& idle)
|
||||
|
@ -65,8 +66,7 @@ void WSCPUMonitor::paint(Painter& painter, const Rect& rect)
|
|||
painter.draw_line(
|
||||
{ rect.x() + i, rect.bottom() },
|
||||
{ rect.x() + i, (int)(rect.y() + (rect.height() - (cpu_usage * (float)rect.height()))) },
|
||||
Color::from_rgb(0xaa6d4b)
|
||||
);
|
||||
Color::from_rgb(0xaa6d4b));
|
||||
++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/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/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
//#define WSMESSAGELOOP_DEBUG
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "WSMenu.h"
|
||||
#include "WSMenuItem.h"
|
||||
#include "WSWindow.h"
|
||||
#include "WSEvent.h"
|
||||
#include "WSEventLoop.h"
|
||||
#include "WSWindowManager.h"
|
||||
#include "WSMenuItem.h"
|
||||
#include "WSScreen.h"
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
#include <WindowServer/WSClientConnection.h>
|
||||
#include "WSWindow.h"
|
||||
#include "WSWindowManager.h"
|
||||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <SharedGraphics/Font.h>
|
||||
#include <SharedGraphics/Painter.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)
|
||||
: m_client(client)
|
||||
|
|
|
@ -11,4 +11,3 @@ WSMenuBar::WSMenuBar(WSClientConnection& client, int menubar_id)
|
|||
WSMenuBar::~WSMenuBar()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "WSScreen.h"
|
||||
#include "WSCompositor.h"
|
||||
#include "WSEvent.h"
|
||||
#include "WSEventLoop.h"
|
||||
#include "WSScreen.h"
|
||||
#include "WSWindowManager.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "WSWindow.h"
|
||||
#include "WSWindowManager.h"
|
||||
#include "WSEvent.h"
|
||||
#include "WSEventLoop.h"
|
||||
#include "WSWindowManager.h"
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
#include <WindowServer/WSClientConnection.h>
|
||||
|
||||
|
@ -77,10 +77,14 @@ void WSWindow::set_rect(const Rect& rect)
|
|||
static WSAPI_MouseButton to_api(MouseButton button)
|
||||
{
|
||||
switch (button) {
|
||||
case MouseButton::None: return WSAPI_MouseButton::NoButton;
|
||||
case MouseButton::Left: return WSAPI_MouseButton::Left;
|
||||
case MouseButton::Right: return WSAPI_MouseButton::Right;
|
||||
case MouseButton::Middle: return WSAPI_MouseButton::Middle;
|
||||
case MouseButton::None:
|
||||
return WSAPI_MouseButton::NoButton;
|
||||
case MouseButton::Left:
|
||||
return WSAPI_MouseButton::Left;
|
||||
case MouseButton::Right:
|
||||
return WSAPI_MouseButton::Right;
|
||||
case MouseButton::Middle:
|
||||
return WSAPI_MouseButton::Middle;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
@ -93,12 +97,23 @@ void WSWindow::handle_mouse_event(const WSMouseEvent& event)
|
|||
server_message.window_id = window_id();
|
||||
|
||||
switch (event.type()) {
|
||||
case WSEvent::MouseMove: server_message.type = WSAPI_ServerMessage::Type::MouseMove; break;
|
||||
case WSEvent::MouseDown: server_message.type = WSAPI_ServerMessage::Type::MouseDown; 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();
|
||||
case WSEvent::MouseMove:
|
||||
server_message.type = WSAPI_ServerMessage::Type::MouseMove;
|
||||
break;
|
||||
case WSEvent::MouseDown:
|
||||
server_message.type = WSAPI_ServerMessage::Type::MouseDown;
|
||||
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();
|
||||
|
|
|
@ -248,7 +248,8 @@ void WSWindowFrame::notify_window_rect_changed(const Rect& old_rect, const Rect&
|
|||
{
|
||||
int window_button_width = 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) {
|
||||
x -= window_button_width;
|
||||
Rect rect { x, 0, window_button_width, window_button_height };
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "WSWindowManager.h"
|
||||
#include "WSCompositor.h"
|
||||
#include "WSEventLoop.h"
|
||||
#include "WSMenu.h"
|
||||
|
@ -5,7 +6,6 @@
|
|||
#include "WSMenuItem.h"
|
||||
#include "WSScreen.h"
|
||||
#include "WSWindow.h"
|
||||
#include "WSWindowManager.h"
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/CTimer.h>
|
||||
|
@ -211,7 +211,6 @@ void WSWindowManager::set_resolution(int width, int height)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int WSWindowManager::menubar_menu_margin() const
|
||||
{
|
||||
return 16;
|
||||
|
@ -442,7 +441,8 @@ void WSWindowManager::start_window_drag(WSWindow& window, const WSMouseEvent& ev
|
|||
printf("[WM] Begin dragging WSWindow{%p}\n", &window);
|
||||
#endif
|
||||
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_window_origin = window.position();
|
||||
invalidate(window);
|
||||
|
@ -472,7 +472,8 @@ void WSWindowManager::start_window_resize(WSWindow& window, const Point& positio
|
|||
printf("[WM] Begin resizing WSWindow{%p}\n", &window);
|
||||
#endif
|
||||
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_window_original_rect = window.rect();
|
||||
|
||||
|
@ -628,9 +629,12 @@ void WSWindowManager::set_cursor_tracking_button(WSButton* button)
|
|||
CElapsedTimer& WSWindowManager::DoubleClickInfo::click_clock(MouseButton button)
|
||||
{
|
||||
switch (button) {
|
||||
case MouseButton::Left: return m_left_click_clock;
|
||||
case MouseButton::Right: return m_right_click_clock;
|
||||
case MouseButton::Middle: return m_middle_click_clock;
|
||||
case MouseButton::Left:
|
||||
return m_left_click_clock;
|
||||
case MouseButton::Right:
|
||||
return m_right_click_clock;
|
||||
case MouseButton::Middle:
|
||||
return m_middle_click_clock;
|
||||
default:
|
||||
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/StylePainter.h>
|
||||
#include <WindowServer/WSEvent.h>
|
||||
#include <WindowServer/WSScreen.h>
|
||||
#include <WindowServer/WSWindowManager.h>
|
||||
#include <WindowServer/WSWindowSwitcher.h>
|
||||
|
||||
static WSWindowSwitcher* s_the;
|
||||
|
||||
|
@ -123,7 +123,8 @@ void WSWindowSwitcher::refresh()
|
|||
m_selected_index = m_windows.size();
|
||||
m_windows.append(window.make_weak_ptr());
|
||||
return IterationDecision::Continue;
|
||||
}, true);
|
||||
},
|
||||
true);
|
||||
if (m_windows.is_empty()) {
|
||||
hide();
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <LibCore/CConfigFile.h>
|
||||
#include <WindowServer/WSCompositor.h>
|
||||
#include <WindowServer/WSEventLoop.h>
|
||||
#include <WindowServer/WSScreen.h>
|
||||
#include <WindowServer/WSWindowManager.h>
|
||||
#include <WindowServer/WSEventLoop.h>
|
||||
#include <WindowServer/WSCompositor.h>
|
||||
#include <LibCore/CConfigFile.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue