mirror of
https://github.com/fltk/fltk.git
synced 2026-05-27 19:10:24 +08:00
Close active menus when moving window to new screen.
This prevents menu windows from becoming inadequately located.
This commit is contained in:
@@ -1281,6 +1281,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||||||
lParam_rect->right - lParam_rect->left,
|
lParam_rect->right - lParam_rect->left,
|
||||||
lParam_rect->bottom - lParam_rect->top, flags);
|
lParam_rect->bottom - lParam_rect->top, flags);
|
||||||
if (ns >= 0) {
|
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);
|
scale = Fl::screen_driver()->scale(ns);
|
||||||
EnumChildWindows(hWnd, child_window_cb, (LPARAM)&scale);
|
EnumChildWindows(hWnd, child_window_cb, (LPARAM)&scale);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2221,6 +2221,10 @@ int fl_handle(const XEvent& thisevent)
|
|||||||
if (num == -1) num = olds;
|
if (num == -1) num = olds;
|
||||||
float s = d->scale(num);
|
float s = d->scale(num);
|
||||||
if (num != olds && !window->menu_window()) {
|
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) &&
|
if (s != d->scale(olds) &&
|
||||||
!Fl_X11_Window_Driver::data_for_resize_window_between_screens_.busy &&
|
!Fl_X11_Window_Driver::data_for_resize_window_between_screens_.busy &&
|
||||||
window->user_data() != &Fl_X11_Screen_Driver::transient_scale_display) {
|
window->user_data() != &Fl_X11_Screen_Driver::transient_scale_display) {
|
||||||
|
|||||||
@@ -719,6 +719,13 @@ static void surface_enter(void *data, struct wl_surface *wl_surface,
|
|||||||
(Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output);
|
(Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output);
|
||||||
if (output == NULL)
|
if (output == NULL)
|
||||||
return;
|
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
|
||||||
|
}
|
||||||
|
|
||||||
bool list_was_empty = wl_list_empty(&window->outputs);
|
bool list_was_empty = wl_list_empty(&window->outputs);
|
||||||
struct Fl_Wayland_Window_Driver::surface_output *surface_output =
|
struct Fl_Wayland_Window_Driver::surface_output *surface_output =
|
||||||
|
|||||||
Reference in New Issue
Block a user