@@ -21,12 +21,13 @@ menu_render menu_render::create(int x, int y, menu menu) {
2121 }
2222
2323 static auto rt = []() {
24+ static window_proc_hook glfw_proc_hook;
2425 auto rt = std::make_shared<ui::render_target>();
2526 rt->transparent = true ;
2627 rt->no_activate = true ;
2728 rt->capture_all_input = true ;
2829 rt->decorated = false ;
29- rt->topmost = false ;
30+ rt->topmost = true ;
3031 rt->vsync = config::current->context_menu .vsync ;
3132
3233 if (config::current->avoid_resize_ui ) {
@@ -39,6 +40,18 @@ menu_render menu_render::create(int x, int y, menu menu) {
3940 MB_ICONERROR);
4041 }
4142
43+ glfw_proc_hook.install (rt->hwnd ());
44+ SetCapture ((HWND)rt->hwnd ());
45+ glfw_proc_hook.hooks .push_back ([](void *hwnd, void *original_proc,
46+ size_t msg, size_t wparam,
47+ size_t lparam) -> std::optional<int > {
48+ if (msg == WM_MOUSEACTIVATE) {
49+ return MA_NOACTIVATE;
50+ }
51+
52+ return std::nullopt ;
53+ });
54+
4255 nvgCreateFont (rt->nvg , " main" ,
4356 config::current->font_path_main .string ().c_str ());
4457 nvgCreateFont (rt->nvg , " fallback" ,
@@ -65,17 +78,15 @@ menu_render menu_render::create(int x, int y, menu menu) {
6578 monitor_info.rcMonitor .top , monitor_info.rcMonitor .right ,
6679 monitor_info.rcMonitor .bottom );
6780
68- rt->set_position (monitor_info.rcMonitor .left + 1 , monitor_info.rcMonitor .top + 1 );
81+ rt->set_position (monitor_info.rcMonitor .left + 1 ,
82+ monitor_info.rcMonitor .top + 1 );
6983 if (!config::current->avoid_resize_ui )
70- rt->resize (
71- monitor_info.rcMonitor .right - monitor_info.rcMonitor .left - 2 ,
72- monitor_info.rcMonitor .bottom - monitor_info.rcMonitor .top - 2 );
84+ rt->resize (monitor_info.rcMonitor .right - monitor_info.rcMonitor .left - 2 ,
85+ monitor_info.rcMonitor .bottom - monitor_info.rcMonitor .top - 2 );
7386
7487 glfwMakeContextCurrent (rt->window );
7588 glfwSwapInterval (config::current->context_menu .vsync ? 1 : 0 );
7689
77-
78-
7990 rt->show ();
8091 auto menu_wid = std::make_shared<mouse_menu_widget_main>(
8192 menu,
@@ -89,7 +100,7 @@ menu_render menu_render::create(int x, int y, menu menu) {
89100 js::js_menu_context::$from_window (menu.parent_window ));
90101 })
91102 .get ();
92-
103+
93104 js::menu_info_basic_js menu_info{
94105 .menu = std::make_shared<js::menu_controller>(menu_wid->menu_wid ),
95106 .context = current_js_context};
0 commit comments