summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMustafa Quraish <mustafaq9@gmail.com>2021-08-31 22:16:53 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-04 03:35:23 +0200
commit30ce1d856292a025b5f0e1fd1e4ddbbd6991b8c5 (patch)
tree1e128afcd24a92536ef0f64461cfabef902528af /Userland
parent81326ac8c79f97d352818ecb4381ba2d167280d5 (diff)
downloadserenity-30ce1d856292a025b5f0e1fd1e4ddbbd6991b8c5.zip
Cursors: Add new Eyedropper cursor
This can be used immediately in PixelPaint (separate commit), but I am adding this as a system-wide cursor since it may also be useful for other applications that want to use it.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGfx/StandardCursor.h1
-rw-r--r--Userland/Services/WindowServer/Cursor.cpp2
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp1
-rw-r--r--Userland/Services/WindowServer/WindowManager.h2
4 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/StandardCursor.h b/Userland/Libraries/LibGfx/StandardCursor.h
index 52c4ab84d8..1e15852dbf 100644
--- a/Userland/Libraries/LibGfx/StandardCursor.h
+++ b/Userland/Libraries/LibGfx/StandardCursor.h
@@ -26,6 +26,7 @@ enum class StandardCursor {
Move,
Wait,
Disallowed,
+ Eyedropper,
__Count,
};
diff --git a/Userland/Services/WindowServer/Cursor.cpp b/Userland/Services/WindowServer/Cursor.cpp
index 4f5eda1b0b..18fc08f6a3 100644
--- a/Userland/Services/WindowServer/Cursor.cpp
+++ b/Userland/Services/WindowServer/Cursor.cpp
@@ -109,6 +109,8 @@ RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor)
return WindowManager::the().wait_cursor();
case Gfx::StandardCursor::Disallowed:
return WindowManager::the().disallowed_cursor();
+ case Gfx::StandardCursor::Eyedropper:
+ return WindowManager::the().eyedropper_cursor();
default:
VERIFY_NOT_REACHED();
}
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index eeec1d4f10..be415582c2 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -2080,6 +2080,7 @@ void WindowManager::apply_cursor_theme(const String& theme_name)
reload_cursor(m_drag_cursor, "Drag");
reload_cursor(m_wait_cursor, "Wait");
reload_cursor(m_crosshair_cursor, "Crosshair");
+ reload_cursor(m_eyedropper_cursor, "Eyedropper");
Compositor::the().invalidate_cursor();
m_config->write_entry("Mouse", "CursorTheme", theme_name);
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index cb3aec1d8c..ccfd363e06 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -150,6 +150,7 @@ public:
Cursor const& move_cursor() const { return *m_move_cursor; }
Cursor const& drag_cursor() const { return *m_drag_cursor; }
Cursor const& wait_cursor() const { return *m_wait_cursor; }
+ Cursor const& eyedropper_cursor() const { return *m_eyedropper_cursor; }
Gfx::Font const& font() const;
Gfx::Font const& window_title_font() const;
@@ -364,6 +365,7 @@ private:
RefPtr<Cursor> m_drag_cursor;
RefPtr<Cursor> m_wait_cursor;
RefPtr<Cursor> m_crosshair_cursor;
+ RefPtr<Cursor> m_eyedropper_cursor;
RefPtr<MultiScaleBitmaps> m_overlay_rect_shadow;