From 30e91ecff6d1e5ad033a92983502315710392041 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Tue, 31 Aug 2021 22:19:31 -0400 Subject: [PATCH] Cursors: Add new Magnifying glass cursor There are a few places in the system where this could be useful, such as PixelPaint and the MandelBrot demo. It seems general enough that it is probably useful to have it as a system-wide cursor rather than loading it manually each time. --- Base/res/cursor-themes/Dark/Config.ini | 1 + Base/res/cursor-themes/Dark/zoom.x0y0.png | Bin 0 -> 527 bytes Base/res/cursor-themes/Default/Config.ini | 1 + Base/res/cursor-themes/Default/zoom.x0y0.png | Bin 0 -> 617 bytes Userland/Libraries/LibGfx/StandardCursor.h | 1 + Userland/Services/WindowServer/Cursor.cpp | 2 ++ Userland/Services/WindowServer/WindowManager.cpp | 1 + Userland/Services/WindowServer/WindowManager.h | 2 ++ 8 files changed, 8 insertions(+) create mode 100644 Base/res/cursor-themes/Dark/zoom.x0y0.png create mode 100644 Base/res/cursor-themes/Default/zoom.x0y0.png diff --git a/Base/res/cursor-themes/Dark/Config.ini b/Base/res/cursor-themes/Dark/Config.ini index 88cc11daae..7813a6b945 100644 --- a/Base/res/cursor-themes/Dark/Config.ini +++ b/Base/res/cursor-themes/Dark/Config.ini @@ -16,3 +16,4 @@ Drag=drag.png Wait=wait.f14t100.png Crosshair=crosshair.png Eyedropper=eyedropper.x2y2.png +Zoom=zoom.x0y0.png \ No newline at end of file diff --git a/Base/res/cursor-themes/Dark/zoom.x0y0.png b/Base/res/cursor-themes/Dark/zoom.x0y0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d5e7c481f128ed279116b5c81db413a30d068e7 GIT binary patch literal 527 zcmeAS@N?(olHy`uVBq!ia0y~yV2}i14mJh`h9fUqlNlHouX(yShIn+YoocP`;wW;w zesdhBwo*s>qDeVRCs(+BIikF1v4E3}R?B+Dg%hT}aP<|*T6%tgVC#ex89R!~&Ktcu z6H|V(-e_m}vwN2NEsdYgQT)VlgYDJIh9fasXBZw6S#z?%@R`UCmaN9Y1+Iam2e=EE zZ5ZTNP8SdjmwWkHMuO>AL+SP7hwRl4Fie>G)sijtcY^OeCb0(B>@%6ywx=%mYJNeS zWye*|&5DohBsQ>_SWSB@@POe4Q=4dew65Krmfe0n zm0{JSMaoO%CMzgu>i#_tcGwdd>=`l_!weR{AfS2*jGAbuK!ULxzZE5*{#3#h{S)6?pS(j{dUY!PC{xWt~$(698LZ?MeUu literal 0 HcmV?d00001 diff --git a/Base/res/cursor-themes/Default/Config.ini b/Base/res/cursor-themes/Default/Config.ini index 88cc11daae..7813a6b945 100644 --- a/Base/res/cursor-themes/Default/Config.ini +++ b/Base/res/cursor-themes/Default/Config.ini @@ -16,3 +16,4 @@ Drag=drag.png Wait=wait.f14t100.png Crosshair=crosshair.png Eyedropper=eyedropper.x2y2.png +Zoom=zoom.x0y0.png \ No newline at end of file diff --git a/Base/res/cursor-themes/Default/zoom.x0y0.png b/Base/res/cursor-themes/Default/zoom.x0y0.png new file mode 100644 index 0000000000000000000000000000000000000000..8a6fdd810bceba9e434b717159293c8e5081c090 GIT binary patch literal 617 zcmeAS@N?(olHy`uVBq!ia0y~yV2}i14mJh`h9fUqlNlJ83_M*NLp(ayPCcJ3VkmOl zUNYJx`|U2#qu&&ilvw${iU%E(*S^FRCo=KX!WWJo6do=8ryOVV<9)@a2RA2cG@b6V zUUT7B_F9*?=SSN-jn0Mb7ic@_eebzyr9R_^iDgm-4s35OynnWT>$JezH`I=H#T&T& zDPaG>@rJ#RIrxCp2i6GVVzq0IpOHIfz z%_mDPY+;CAd#ysiDJ4|zMcHoKg?HIaf)}6K^0rsf{ldFl3nMRFc9PdRO(mz z?BE-#PuU)Lq#?S$DCN-Fv_NB%S;y>LlrkB;*B#n@_uZ`bJFdUxo%8l)Z{_b_M}v1; znLl;7{xyl$L2;|k^Wp=4PgpCz75tFGy(Nm(H~jrthDB|Lu~TDar8jaPNUc5dY|HyN zPOC`P*o)>Tt~hBqJQiJBt$6(Fta!f$J;uqsiYu2Lko<1r;vicayLrjvHigBJTcPnZ5KymBsVR&Mab+b#~1o)tCk dVYK_hcHL#(+qnBiJ`4;D44$rjF6*2UngBmV9^C){ literal 0 HcmV?d00001 diff --git a/Userland/Libraries/LibGfx/StandardCursor.h b/Userland/Libraries/LibGfx/StandardCursor.h index 1e15852dbf..9a8a9c97b6 100644 --- a/Userland/Libraries/LibGfx/StandardCursor.h +++ b/Userland/Libraries/LibGfx/StandardCursor.h @@ -27,6 +27,7 @@ enum class StandardCursor { Wait, Disallowed, Eyedropper, + Zoom, __Count, }; diff --git a/Userland/Services/WindowServer/Cursor.cpp b/Userland/Services/WindowServer/Cursor.cpp index 18fc08f6a3..07ce2ab1f8 100644 --- a/Userland/Services/WindowServer/Cursor.cpp +++ b/Userland/Services/WindowServer/Cursor.cpp @@ -111,6 +111,8 @@ RefPtr Cursor::create(Gfx::StandardCursor standard_cursor) return WindowManager::the().disallowed_cursor(); case Gfx::StandardCursor::Eyedropper: return WindowManager::the().eyedropper_cursor(); + case Gfx::StandardCursor::Zoom: + return WindowManager::the().zoom_cursor(); default: VERIFY_NOT_REACHED(); } diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index be415582c2..c816377c71 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -2081,6 +2081,7 @@ void WindowManager::apply_cursor_theme(const String& theme_name) reload_cursor(m_wait_cursor, "Wait"); reload_cursor(m_crosshair_cursor, "Crosshair"); reload_cursor(m_eyedropper_cursor, "Eyedropper"); + reload_cursor(m_zoom_cursor, "Zoom"); 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 ccfd363e06..98dd20ec0f 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -151,6 +151,7 @@ public: 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; } + Cursor const& zoom_cursor() const { return *m_zoom_cursor; } Gfx::Font const& font() const; Gfx::Font const& window_title_font() const; @@ -366,6 +367,7 @@ private: RefPtr m_wait_cursor; RefPtr m_crosshair_cursor; RefPtr m_eyedropper_cursor; + RefPtr m_zoom_cursor; RefPtr m_overlay_rect_shadow;