mirror of
https://github.com/fltk/fltk.git
synced 2026-05-21 22:51:41 +08:00
Close active menus when moving window to new screen.
This commit is contained in:
@@ -1267,6 +1267,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
lParam_rect->right - lParam_rect->left,
|
||||
lParam_rect->bottom - lParam_rect->top, flags);
|
||||
if (ns >= 0) {
|
||||
if (Fl::modal() && Fl::modal()->menu_window()) { // is a menu window active?
|
||||
Fl::e_x_root = 1000000;
|
||||
Fl::modal()->handle(FL_PUSH); // simulate a distant click to close menus
|
||||
}
|
||||
scale = Fl::screen_driver()->scale(ns);
|
||||
EnumChildWindows(hWnd, child_window_cb, (LPARAM)&scale);
|
||||
}
|
||||
|
||||
@@ -2216,6 +2216,10 @@ int fl_handle(const XEvent& thisevent)
|
||||
if (num == -1) num = olds;
|
||||
float s = d->scale(num);
|
||||
if (num != olds && !window->menu_window()) {
|
||||
if (Fl::modal() && Fl::modal()->menu_window()) { // is a menu window active?
|
||||
Fl::e_x_root = 1000000;
|
||||
Fl::modal()->handle(FL_PUSH); // simulate a distant click to close menus
|
||||
}
|
||||
if (s != d->scale(olds) &&
|
||||
!Fl_X11_Window_Driver::data_for_resize_window_between_screens_.busy &&
|
||||
window->user_data() != &Fl_X11_Screen_Driver::transient_scale_display) {
|
||||
|
||||
@@ -703,6 +703,13 @@ static void surface_enter(void *data, struct wl_surface *wl_surface,
|
||||
(Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output);
|
||||
if (output == NULL)
|
||||
return;
|
||||
// Detect when the parent window of an active menu window enters a screen. If so, we are
|
||||
// moving a window with active menus to a new screen. We want to close all menus.
|
||||
if (Fl::modal() && Fl::modal()->menu_window() &&
|
||||
Fl_Window_Driver::menu_parent() == window->fl_win) {
|
||||
Fl::e_x_root = 1000000;
|
||||
Fl::modal()->handle(FL_PUSH); // simulate a distant click to close menus
|
||||
}
|
||||
|
||||
Fl_Wayland_Window_Driver *win_driver = Fl_Wayland_Window_Driver::driver(window->fl_win);
|
||||
float pre_scale = Fl::screen_scale(win_driver->screen_num()) * win_driver->wld_scale();
|
||||
|
||||
Reference in New Issue
Block a user