diff options
author | Maciej Zygmanowski <sppmacd@pm.me> | 2021-08-01 17:22:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-23 01:41:53 +0200 |
commit | 040a723f1f75de0220abffa5aff085d3d2a45cd2 (patch) | |
tree | f8111dc2a281212898c6f2fc44091e36105b562a /Userland/Demos | |
parent | 7d579b04c511e7333ddbf72da16bd347a3886854 (diff) | |
download | serenity-040a723f1f75de0220abffa5aff085d3d2a45cd2.zip |
WindowServer: Add support for cursor themes
Now you can specify a CursorTheme key in /etc/WindowServer.ini. The
cursors are loaded from /res/cursor-themes/<name> directory. This
directory contains a Config.ini file with format similar to previous
Cursor section, except it uses relative paths.
This commit adds also Default theme, which uses cursors being
previously in /res/cursors.
The WidgetGallery is updated to match the new cursor path format.
Diffstat (limited to 'Userland/Demos')
-rw-r--r-- | Userland/Demos/WidgetGallery/GalleryModels.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h index a193beb073..4e6008f2c3 100644 --- a/Userland/Demos/WidgetGallery/GalleryModels.h +++ b/Userland/Demos/WidgetGallery/GalleryModels.h @@ -10,6 +10,7 @@ #include <AK/Vector.h> #include <LibCore/DirIterator.h> #include <LibGUI/Model.h> +#include <LibGUI/WindowServerConnection.h> class MouseCursorModel final : public GUI::Model { public: @@ -57,17 +58,19 @@ public: { m_cursors.clear(); - Core::DirIterator iterator("/res/cursors", Core::DirIterator::Flags::SkipDots); + Core::DirIterator iterator(String::formatted("/res/cursor-themes/{}", GUI::WindowServerConnection::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots); while (iterator.has_next()) { auto path = iterator.next_full_path(); + if (path.ends_with(".ini")) + continue; if (path.contains("2x")) continue; Cursor cursor; cursor.path = move(path); cursor.bitmap = Gfx::Bitmap::try_load_from_file(cursor.path); auto filename_split = cursor.path.split('/'); - cursor.name = filename_split[2]; + cursor.name = filename_split[3]; m_cursors.append(move(cursor)); } |