mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07:36 +00:00
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
This commit is contained in:
parent
c11351ac50
commit
0dc9af5f7e
286 changed files with 3244 additions and 2424 deletions
|
@ -3,7 +3,8 @@
|
|||
#include <AK/NetworkOrdered.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
class [[gnu::packed]] DNSPacket {
|
||||
class [[gnu::packed]] DNSPacket
|
||||
{
|
||||
public:
|
||||
DNSPacket()
|
||||
: m_recursion_desired(false)
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
#include <AK/NetworkOrdered.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
class [[gnu::packed]] DNSRecord {
|
||||
class [[gnu::packed]] DNSRecord
|
||||
{
|
||||
public:
|
||||
DNSRecord() { }
|
||||
DNSRecord() {}
|
||||
|
||||
word name() const { return m_name; }
|
||||
word type() const { return m_type; }
|
||||
|
|
|
@ -20,7 +20,8 @@ struct WSAPI_Rect {
|
|||
WSAPI_Size size;
|
||||
};
|
||||
|
||||
enum WSAPI_WindowType {
|
||||
enum WSAPI_WindowType
|
||||
{
|
||||
Invalid = 0,
|
||||
Normal,
|
||||
Menu,
|
||||
|
@ -36,20 +37,25 @@ struct WSAPI_WindowBackingStoreInfo {
|
|||
RGBA32* pixels;
|
||||
};
|
||||
|
||||
enum class WSAPI_MouseButton : unsigned char {
|
||||
enum class WSAPI_MouseButton : unsigned char
|
||||
{
|
||||
NoButton = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Middle = 4,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Middle = 4,
|
||||
};
|
||||
|
||||
struct WSAPI_KeyModifiers { enum {
|
||||
Shift = 1 << 0,
|
||||
Alt = 1 << 1,
|
||||
Ctrl = 1 << 2,
|
||||
}; };
|
||||
struct WSAPI_KeyModifiers {
|
||||
enum
|
||||
{
|
||||
Shift = 1 << 0,
|
||||
Alt = 1 << 1,
|
||||
Ctrl = 1 << 2,
|
||||
};
|
||||
};
|
||||
|
||||
enum class WSAPI_StandardCursor : unsigned char {
|
||||
enum class WSAPI_StandardCursor : unsigned char
|
||||
{
|
||||
None = 0,
|
||||
Arrow,
|
||||
IBeam,
|
||||
|
@ -59,7 +65,8 @@ enum class WSAPI_StandardCursor : unsigned char {
|
|||
ResizeDiagonalBLTR,
|
||||
};
|
||||
|
||||
enum WSAPI_WMEventMask : unsigned {
|
||||
enum WSAPI_WMEventMask : unsigned
|
||||
{
|
||||
WindowRectChanges = 1 << 0,
|
||||
WindowStateChanges = 1 << 1,
|
||||
WindowIconChanges = 1 << 2,
|
||||
|
@ -67,7 +74,8 @@ enum WSAPI_WMEventMask : unsigned {
|
|||
};
|
||||
|
||||
struct WSAPI_ServerMessage {
|
||||
enum Type : unsigned {
|
||||
enum Type : unsigned
|
||||
{
|
||||
Invalid,
|
||||
Error,
|
||||
Paint,
|
||||
|
@ -187,7 +195,8 @@ struct WSAPI_ServerMessage {
|
|||
};
|
||||
|
||||
struct WSAPI_ClientMessage {
|
||||
enum Type : unsigned {
|
||||
enum Type : unsigned
|
||||
{
|
||||
Invalid,
|
||||
CreateMenubar,
|
||||
DestroyMenubar,
|
||||
|
@ -290,9 +299,18 @@ struct WSAPI_ClientMessage {
|
|||
};
|
||||
};
|
||||
|
||||
inline Rect::Rect(const WSAPI_Rect& r) : Rect(r.location, r.size) { }
|
||||
inline Point::Point(const WSAPI_Point& p) : Point(p.x, p.y) { }
|
||||
inline Size::Size(const WSAPI_Size& s) : Size(s.width, s.height) { }
|
||||
inline Rect::Rect(const WSAPI_Rect& r)
|
||||
: Rect(r.location, r.size)
|
||||
{
|
||||
}
|
||||
inline Point::Point(const WSAPI_Point& p)
|
||||
: Point(p.x, p.y)
|
||||
{
|
||||
}
|
||||
inline Size::Size(const WSAPI_Size& s)
|
||||
: Size(s.width, s.height)
|
||||
{
|
||||
}
|
||||
inline Rect::operator WSAPI_Rect() const { return { m_location, m_size }; }
|
||||
inline Point::operator WSAPI_Point() const { return { m_x, m_y }; }
|
||||
inline Size::operator WSAPI_Size() const { return { m_width, m_height }; }
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Retained.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
|
||||
class CharacterBitmap;
|
||||
class Painter;
|
||||
|
@ -18,7 +18,7 @@ public:
|
|||
Rect relative_rect() const { return m_relative_rect; }
|
||||
void set_relative_rect(const Rect& rect) { m_relative_rect = rect; }
|
||||
|
||||
Rect rect() const { return { { }, m_relative_rect.size() }; }
|
||||
Rect rect() const { return { {}, m_relative_rect.size() }; }
|
||||
Rect screen_rect() const;
|
||||
|
||||
void paint(Painter&);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <AK/Function.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <WindowServer/WSEvent.h>
|
||||
|
||||
class WSWindow;
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
static WSClientConnection* from_client_id(int client_id);
|
||||
static void for_each_client(Function<void(WSClientConnection&)>);
|
||||
|
||||
void post_message(const WSAPI_ServerMessage&, const ByteBuffer& = { });
|
||||
void post_message(const WSAPI_ServerMessage&, const ByteBuffer& = {});
|
||||
|
||||
int client_id() const { return m_client_id; }
|
||||
WSMenuBar* app_menubar() { return m_app_menubar.ptr(); }
|
||||
|
@ -33,8 +33,10 @@ public:
|
|||
|
||||
void set_client_pid(pid_t pid) { m_pid = pid; }
|
||||
|
||||
template<typename Matching, typename Callback> void for_each_window_matching(Matching, Callback);
|
||||
template<typename Callback> void for_each_window(Callback);
|
||||
template<typename Matching, typename Callback>
|
||||
void for_each_window_matching(Matching, Callback);
|
||||
template<typename Callback>
|
||||
void for_each_window(Callback);
|
||||
|
||||
void notify_about_new_screen_rect(const Rect&);
|
||||
void post_paint_message(WSWindow&);
|
||||
|
|
|
@ -10,7 +10,14 @@
|
|||
class Painter;
|
||||
class WSCursor;
|
||||
|
||||
enum class WallpaperMode { Simple, Tile, Center, Scaled, Unchecked };
|
||||
enum class WallpaperMode
|
||||
{
|
||||
Simple,
|
||||
Tile,
|
||||
Center,
|
||||
Scaled,
|
||||
Unchecked
|
||||
};
|
||||
|
||||
class WSCompositor final : public CObject {
|
||||
public:
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
|
||||
enum class WSStandardCursor {
|
||||
enum class WSStandardCursor
|
||||
{
|
||||
None = 0,
|
||||
Arrow,
|
||||
IBeam,
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Point.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
#include <SharedGraphics/Point.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <WindowServer/WSCursor.h>
|
||||
#include <WindowServer/WSWindowType.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
|
||||
class WSEvent : public CEvent {
|
||||
public:
|
||||
enum Type {
|
||||
enum Type
|
||||
{
|
||||
Invalid = 2000,
|
||||
WM_DeferredCompose,
|
||||
WM_ClientDisconnected,
|
||||
|
@ -71,9 +72,12 @@ public:
|
|||
__End_API_Client_Requests,
|
||||
};
|
||||
|
||||
WSEvent() { }
|
||||
explicit WSEvent(Type type) : CEvent(type) { }
|
||||
virtual ~WSEvent() { }
|
||||
WSEvent() {}
|
||||
explicit WSEvent(Type type)
|
||||
: CEvent(type)
|
||||
{
|
||||
}
|
||||
virtual ~WSEvent() {}
|
||||
|
||||
bool is_client_request() const { return type() > __Begin_API_Client_Requests && type() < __End_API_Client_Requests; }
|
||||
bool is_mouse_event() const { return type() == MouseMove || type() == MouseDown || type() == MouseDoubleClick || type() == MouseUp || type() == MouseWheel; }
|
||||
|
@ -162,7 +166,6 @@ private:
|
|||
bool m_minimized;
|
||||
};
|
||||
|
||||
|
||||
class WSAPISetGlobalCursorTrackingRequest : public WSAPIClientRequest {
|
||||
public:
|
||||
WSAPISetGlobalCursorTrackingRequest(int client_id, int window_id, bool value)
|
||||
|
@ -688,7 +691,8 @@ private:
|
|||
Vector<Rect, 32> m_rects;
|
||||
};
|
||||
|
||||
enum class MouseButton : byte {
|
||||
enum class MouseButton : byte
|
||||
{
|
||||
None = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibCore/CEventLoop.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <LibCore/CEventLoop.h>
|
||||
|
||||
class WSClientConnection;
|
||||
struct WSAPI_ClientMessage;
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#include <AK/AKString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <WindowServer/WSMenuItem.h>
|
||||
#include <LibCore/CObject.h>
|
||||
|
||||
class WSClientConnection;
|
||||
class WSMenuBar;
|
||||
|
@ -91,4 +91,3 @@ private:
|
|||
Vector<OwnPtr<WSMenuItem>> m_items;
|
||||
OwnPtr<WSWindow> m_menu_window;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include "WSMenu.h"
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <AK/Weakable.h>
|
||||
|
||||
class WSMenuBar : public Weakable<WSMenuBar> {
|
||||
public:
|
||||
|
|
|
@ -8,13 +8,14 @@ class WSMenu;
|
|||
|
||||
class WSMenuItem {
|
||||
public:
|
||||
enum Type {
|
||||
enum Type
|
||||
{
|
||||
None,
|
||||
Text,
|
||||
Separator,
|
||||
};
|
||||
|
||||
WSMenuItem(WSMenu&, unsigned identifier, const String& text, const String& shortcut_text = { }, bool enabled = true, bool checkable = false, bool checked = false);
|
||||
WSMenuItem(WSMenu&, unsigned identifier, const String& text, const String& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false);
|
||||
WSMenuItem(WSMenu&, Type);
|
||||
~WSMenuItem();
|
||||
|
||||
|
@ -51,4 +52,3 @@ private:
|
|||
String m_shortcut_text;
|
||||
Rect m_rect;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <SharedGraphics/Color.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <SharedGraphics/Size.h>
|
||||
#include <SharedGraphics/Color.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
class WSScreen {
|
||||
public:
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <WindowServer/WSWindowType.h>
|
||||
#include <WindowServer/WSWindowFrame.h>
|
||||
#include <SharedGraphics/DisjointRectSet.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <WindowServer/WSWindowFrame.h>
|
||||
#include <WindowServer/WSWindowType.h>
|
||||
|
||||
class WSClientConnection;
|
||||
class WSCursor;
|
||||
class WSMenu;
|
||||
class WSMouseEvent;
|
||||
|
||||
class WSWindow final : public CObject, public InlineLinkedListNode<WSWindow> {
|
||||
class WSWindow final : public CObject
|
||||
, public InlineLinkedListNode<WSWindow> {
|
||||
public:
|
||||
WSWindow(WSClientConnection&, WSWindowType, int window_id, bool modal, bool resizable, bool fullscreen);
|
||||
WSWindow(CObject&, WSWindowType);
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <SharedGraphics/Color.h>
|
||||
#include <SharedGraphics/Painter.h>
|
||||
#include <SharedGraphics/DisjointRectSet.h>
|
||||
#include "WSMenuBar.h"
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include "WSMenuBar.h"
|
||||
#include <WindowServer/WSWindowSwitcher.h>
|
||||
#include <WindowServer/WSWindowType.h>
|
||||
#include <WindowServer/WSWindow.h>
|
||||
#include <LibCore/CConfigFile.h>
|
||||
#include <LibCore/CElapsedTimer.h>
|
||||
#include <SharedGraphics/Color.h>
|
||||
#include <SharedGraphics/DisjointRectSet.h>
|
||||
#include <SharedGraphics/Painter.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <WindowServer/WSCPUMonitor.h>
|
||||
#include <WindowServer/WSCursor.h>
|
||||
#include <WindowServer/WSEvent.h>
|
||||
#include <WindowServer/WSCPUMonitor.h>
|
||||
#include <LibCore/CElapsedTimer.h>
|
||||
#include <LibCore/CConfigFile.h>
|
||||
#include <WindowServer/WSWindow.h>
|
||||
#include <WindowServer/WSWindowSwitcher.h>
|
||||
#include <WindowServer/WSWindowType.h>
|
||||
|
||||
class WSAPIClientRequest;
|
||||
class WSScreen;
|
||||
|
@ -29,12 +29,24 @@ class WSWindowSwitcher;
|
|||
class GraphicsBitmap;
|
||||
class WSButton;
|
||||
|
||||
enum class ResizeDirection { None, Left, UpLeft, Up, UpRight, Right, DownRight, Down, DownLeft };
|
||||
enum class ResizeDirection
|
||||
{
|
||||
None,
|
||||
Left,
|
||||
UpLeft,
|
||||
Up,
|
||||
UpRight,
|
||||
Right,
|
||||
DownRight,
|
||||
Down,
|
||||
DownLeft
|
||||
};
|
||||
|
||||
class WSWindowManager : public CObject {
|
||||
friend class WSCompositor;
|
||||
friend class WSWindowFrame;
|
||||
friend class WSWindowSwitcher;
|
||||
|
||||
public:
|
||||
static WSWindowManager& the();
|
||||
|
||||
|
@ -135,12 +147,18 @@ private:
|
|||
void start_window_drag(WSWindow&, const WSMouseEvent&);
|
||||
void handle_client_request(const WSAPIClientRequest&);
|
||||
void set_hovered_window(WSWindow*);
|
||||
template<typename Callback> IterationDecision for_each_visible_window_of_type_from_back_to_front(WSWindowType, Callback, bool ignore_highlight = false);
|
||||
template<typename Callback> IterationDecision for_each_visible_window_of_type_from_front_to_back(WSWindowType, Callback, bool ignore_highlight = false);
|
||||
template<typename Callback> IterationDecision for_each_visible_window_from_front_to_back(Callback);
|
||||
template<typename Callback> IterationDecision for_each_visible_window_from_back_to_front(Callback);
|
||||
template<typename Callback> void for_each_window_listening_to_wm_events(Callback);
|
||||
template<typename Callback> void for_each_window(Callback);
|
||||
template<typename Callback>
|
||||
IterationDecision for_each_visible_window_of_type_from_back_to_front(WSWindowType, Callback, bool ignore_highlight = false);
|
||||
template<typename Callback>
|
||||
IterationDecision for_each_visible_window_of_type_from_front_to_back(WSWindowType, Callback, bool ignore_highlight = false);
|
||||
template<typename Callback>
|
||||
IterationDecision for_each_visible_window_from_front_to_back(Callback);
|
||||
template<typename Callback>
|
||||
IterationDecision for_each_visible_window_from_back_to_front(Callback);
|
||||
template<typename Callback>
|
||||
void for_each_window_listening_to_wm_events(Callback);
|
||||
template<typename Callback>
|
||||
void for_each_window(Callback);
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_active_menubar_menu(Callback callback)
|
||||
|
@ -185,10 +203,10 @@ private:
|
|||
HashTable<WSWindow*> m_windows;
|
||||
InlineLinkedList<WSWindow> m_windows_in_order;
|
||||
|
||||
struct DoubleClickInfo
|
||||
{
|
||||
struct DoubleClickInfo {
|
||||
CElapsedTimer& click_clock(MouseButton);
|
||||
void reset() {
|
||||
void reset()
|
||||
{
|
||||
m_left_click_clock = CElapsedTimer();
|
||||
m_right_click_clock = CElapsedTimer();
|
||||
m_middle_click_clock = CElapsedTimer();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
|
||||
class Painter;
|
||||
class WSKeyEvent;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
enum class WSWindowType {
|
||||
enum class WSWindowType
|
||||
{
|
||||
Invalid = 0,
|
||||
Normal,
|
||||
Menu,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue