diff options
| author | David Lönnhager <david.l@mullvad.net> | 2025-03-04 10:57:02 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-03-05 23:32:58 +0100 |
| commit | aa2176e734c2b7b05d49d8ee1a4f543dc6763235 (patch) | |
| tree | 1e5c9c3ccaf56f1300ec90c722d298c8a5d54967 | |
| parent | d9e4dd0f358a145e2522bcc221f3cba436510252 (diff) | |
| download | mullvadvpn-aa2176e734c2b7b05d49d8ee1a4f543dc6763235.tar.xz mullvadvpn-aa2176e734c2b7b05d49d8ee1a4f543dc6763235.zip | |
Add links to RGB macro
| -rw-r--r-- | installer-downloader/src/winapi_impl/ui.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/installer-downloader/src/winapi_impl/ui.rs b/installer-downloader/src/winapi_impl/ui.rs index af5e39bf21..daf04ce5b7 100644 --- a/installer-downloader/src/winapi_impl/ui.rs +++ b/installer-downloader/src/winapi_impl/ui.rs @@ -383,11 +383,6 @@ fn handle_banner_label_colors( handler_id: usize, ) -> Result<nwg::RawEventHandler, nwg::NwgError> { nwg::bind_raw_event_handler(banner, handler_id, move |_hwnd, msg, w, _p| { - /// This is the RGB() macro except it takes in a slice representing RGB values - pub fn rgb(color: [u8; 3]) -> COLORREF { - color[0] as COLORREF | ((color[1] as COLORREF) << 8) | ((color[2] as COLORREF) << 16) - } - if msg == WM_CTLCOLORSTATIC { // SAFETY: `w` is a valid device context for WM_CTLCOLORSTATIC unsafe { @@ -407,11 +402,6 @@ fn handle_link_messages( ) -> Result<nwg::RawEventHandler, nwg::NwgError> { let link_hwnd = link.handle.hwnd().map(|hwnd| hwnd as isize); nwg::bind_raw_event_handler(parent, handler_id, move |_hwnd, msg, w, p| { - /// This is the RGB() macro except it takes in a slice representing RGB values - pub fn rgb(color: [u8; 3]) -> COLORREF { - color[0] as COLORREF | ((color[1] as COLORREF) << 8) | ((color[2] as COLORREF) << 16) - } - if msg == WM_CTLCOLORSTATIC && Some(p) == link_hwnd { // SAFETY: `w` is a valid device context for WM_CTLCOLORSTATIC unsafe { @@ -504,3 +494,9 @@ fn create_link_font() -> Result<&'static nwg::Font, nwg::NwgError> { Err(err) => Err(err.to_owned()), } } + +/// This is the RGB() macro except it takes in a slice representing RGB values +/// RGB macro: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-rgb +fn rgb(color: [u8; 3]) -> COLORREF { + color[0] as COLORREF | ((color[1] as COLORREF) << 8) | ((color[2] as COLORREF) << 16) +} |
