diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-02 02:34:09 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-02 02:34:09 +0200 |
commit | 6673284b06298cf54af5c46e5bdeeffa6e561c86 (patch) | |
tree | 0a6e324ad1b989f64f94c89c96635f6472e6f1df /Servers | |
parent | 94c68dc55a10208cfabb2ee785e697c319931ee4 (diff) | |
download | serenity-6673284b06298cf54af5c46e5bdeeffa6e561c86.zip |
LibGUI: Switch to a resizing cursor when hovering or using a GSplitter.
Also expose the various standard cursors on WSWindowManager so they can
be reused by the override mechanism.
Diffstat (limited to 'Servers')
-rw-r--r-- | Servers/WindowServer/WSAPITypes.h | 2 | ||||
-rw-r--r-- | Servers/WindowServer/WSCursor.cpp | 9 | ||||
-rw-r--r-- | Servers/WindowServer/WSCursor.h | 2 | ||||
-rw-r--r-- | Servers/WindowServer/WSWindowManager.h | 9 |
4 files changed, 20 insertions, 2 deletions
diff --git a/Servers/WindowServer/WSAPITypes.h b/Servers/WindowServer/WSAPITypes.h index 31bcc54e99..cc3318aa24 100644 --- a/Servers/WindowServer/WSAPITypes.h +++ b/Servers/WindowServer/WSAPITypes.h @@ -51,6 +51,8 @@ enum class WSAPI_StandardCursor : unsigned char { None = 0, Arrow, IBeam, + ResizeHorizontal, + ResizeVertical, }; struct WSAPI_ServerMessage { diff --git a/Servers/WindowServer/WSCursor.cpp b/Servers/WindowServer/WSCursor.cpp index 61854a75a7..7862447550 100644 --- a/Servers/WindowServer/WSCursor.cpp +++ b/Servers/WindowServer/WSCursor.cpp @@ -1,4 +1,5 @@ #include <WindowServer/WSCursor.h> +#include <WindowServer/WSWindowManager.h> WSCursor::WSCursor(Retained<GraphicsBitmap>&& bitmap, const Point& hotspot) : m_bitmap(move(bitmap)) @@ -26,9 +27,13 @@ RetainPtr<WSCursor> WSCursor::create(WSStandardCursor standard_cursor) case WSStandardCursor::None: return nullptr; case WSStandardCursor::Arrow: - return create(*GraphicsBitmap::load_from_file("/res/cursors/arrow.png")); + return WSWindowManager::the().arrow_cursor(); case WSStandardCursor::IBeam: - return create(*GraphicsBitmap::load_from_file("/res/cursors/i-beam.png")); + return WSWindowManager::the().i_beam_cursor(); + case WSStandardCursor::ResizeHorizontal: + return WSWindowManager::the().resize_horizontally_cursor(); + case WSStandardCursor::ResizeVertical: + return WSWindowManager::the().resize_vertically_cursor(); } ASSERT_NOT_REACHED(); } diff --git a/Servers/WindowServer/WSCursor.h b/Servers/WindowServer/WSCursor.h index 4a07f2b6de..82d71bcbc8 100644 --- a/Servers/WindowServer/WSCursor.h +++ b/Servers/WindowServer/WSCursor.h @@ -6,6 +6,8 @@ enum class WSStandardCursor { None = 0, Arrow, IBeam, + ResizeHorizontal, + ResizeVertical, }; class WSCursor : public Retainable<WSCursor> { diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h index 40bae77754..84307984b5 100644 --- a/Servers/WindowServer/WSWindowManager.h +++ b/Servers/WindowServer/WSWindowManager.h @@ -87,6 +87,15 @@ public: const WSCursor& active_cursor() const; Rect current_cursor_rect() const; + const WSCursor& arrow_cursor() const { return *m_arrow_cursor; } + const WSCursor& resize_horizontally_cursor() const { return *m_resize_horizontally_cursor; } + const WSCursor& resize_vertically_cursor() const { return *m_resize_vertically_cursor; } + const WSCursor& resize_diagonally_tlbr_cursor() const { return *m_resize_diagonally_tlbr_cursor; } + const WSCursor& resize_diagonally_bltr_cursor() const { return *m_resize_diagonally_bltr_cursor; } + const WSCursor& i_beam_cursor() const { return *m_i_beam_cursor; } + const WSCursor& disallowed_cursor() const { return *m_disallowed_cursor; } + const WSCursor& move_cursor() const { return *m_move_cursor; } + private: void process_mouse_event(const WSMouseEvent&, WSWindow*& event_window); bool process_ongoing_window_resize(const WSMouseEvent&, WSWindow*& event_window); |