Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions native-windows-gui/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ pub enum Event {
/// When a notice is... noticed
OnNotice,

/// When a window is being focused
OnWindowFocus,

/// When a user clicks on the X button of a window
OnWindowClose,
}
Expand Down
3 changes: 2 additions & 1 deletion native-windows-gui/src/win32/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Warning. Not for the faint of heart.
use winapi::shared::minwindef::{BOOL, UINT, DWORD, HMODULE, WPARAM, LPARAM, LRESULT};
use winapi::shared::windef::{HWND, HMENU, HBRUSH};
use winapi::shared::basetsd::{DWORD_PTR, UINT_PTR};
use winapi::um::winuser::{WNDPROC, NMHDR, IDCANCEL, IDOK};
use winapi::um::winuser::{IDCANCEL, IDOK, NMHDR, WM_SETFOCUS, WNDPROC};
use winapi::um::commctrl::{NMTTDISPINFOW, SUBCLASSPROC};
use super::base_helper::{CUSTOM_ID_BEGIN, to_utf16};
use super::window_helper::{NOTICE_MESSAGE, NWG_INIT, NWG_TRAY, NWG_TIMER_TICK, NWG_TIMER_STOP};
Expand Down Expand Up @@ -718,6 +718,7 @@ unsafe extern "system" fn process_events(hwnd: HWND, msg: UINT, w: WPARAM, l: LP
NWG_TIMER_STOP => callback(Event::OnTimerStop, NO_DATA, ControlHandle::Timer(hwnd, w as u32)),
NWG_TIMER_TICK => callback(Event::OnTimerTick, NO_DATA, ControlHandle::Timer(hwnd, w as u32)),
NWG_INIT => callback(Event::OnInit, NO_DATA, base_handle),
WM_SETFOCUS => callback(Event::OnWindowFocus, NO_DATA, base_handle),
WM_CLOSE => {
let mut should_exit = true;
let data = EventData::OnWindowClose(WindowCloseData { data: &mut should_exit as *mut bool });
Expand Down