mirror of
https://github.com/fltk/fltk.git
synced 2026-03-23 07:24:03 +08:00
Wayland: Fix resize of menutitle windows when across 2 screens with diverse scaling - cont'd.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Menu code for the Fast Light Tool Kit (FLTK).
|
// Menu code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2025 by Bill Spitzak and others.
|
// Copyright 1998-2026 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
// the file "COPYING" which should have been included with this file. If this
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -1659,12 +1659,18 @@ Fl_Window *Fl_Window_Driver::menu_parent(int *display_height) {
|
|||||||
return Menu_Window::parent_;
|
return Menu_Window::parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cast to menuwindow if win is of claa menuwindow and the driver is initialized. */
|
/* Cast to Menu_Window* if win is of class Menu_Window and the driver is initialized. */
|
||||||
static Menu_Window *to_menuwindow(Fl_Window *win) {
|
static Menu_Window *to_menuwindow(Fl_Window *win) {
|
||||||
if (!Fl_Window_Driver::driver(win)->popup_window() || !win->menu_window()) return nullptr;
|
if (!Fl_Window_Driver::driver(win)->popup_window() || !win->menu_window()) return nullptr;
|
||||||
return ((Menu_Window_Basetype*)win)->as_menuwindow();
|
return ((Menu_Window_Basetype*)win)->as_menuwindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns whether win is from class Menu_Title_Window */
|
||||||
|
bool Fl_Window_Driver::to_menutitle(Fl_Window *win) {
|
||||||
|
if (!Fl_Window_Driver::driver(win)->popup_window() || !win->menu_window()) return false;
|
||||||
|
return !((Menu_Window_Basetype*)win)->as_menuwindow();
|
||||||
|
}
|
||||||
|
|
||||||
/** Accessor to the "origin" member variable of class menuwindow.
|
/** Accessor to the "origin" member variable of class menuwindow.
|
||||||
Variable origin is not NULL when 2 menuwindow's occur, one being a submenu of the other;
|
Variable origin is not NULL when 2 menuwindow's occur, one being a submenu of the other;
|
||||||
it links the menuwindow at right to the one at left.
|
it links the menuwindow at right to the one at left.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// A base class for platform specific window handling code
|
// A base class for platform specific window handling code
|
||||||
// for the Fast Light Tool Kit (FLTK).
|
// for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 2010-2025 by Bill Spitzak and others.
|
// Copyright 2010-2026 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
// the file "COPYING" which should have been included with this file. If this
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -197,6 +197,7 @@ public:
|
|||||||
// when that's not the case, as with Wayland.
|
// when that's not the case, as with Wayland.
|
||||||
virtual void reposition_menu_window(int x, int y);
|
virtual void reposition_menu_window(int x, int y);
|
||||||
virtual void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1);
|
virtual void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1);
|
||||||
|
static bool to_menutitle(Fl_Window*);
|
||||||
static Fl_Window *menu_parent(int *display_height = NULL);
|
static Fl_Window *menu_parent(int *display_height = NULL);
|
||||||
static Fl_Window *menu_leftorigin(Fl_Window*);
|
static Fl_Window *menu_leftorigin(Fl_Window*);
|
||||||
static Fl_Window *menu_title(Fl_Window*);
|
static Fl_Window *menu_title(Fl_Window*);
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ void Fl_Wayland_Window_Driver::size_range() {
|
|||||||
pWindow->get_size_range(&minw, &minh, &maxw, &maxh, NULL, NULL, NULL);
|
pWindow->get_size_range(&minw, &minh, &maxw, &maxh, NULL, NULL, NULL);
|
||||||
if (wl_win->kind == DECORATED && wl_win->frame) {
|
if (wl_win->kind == DECORATED && wl_win->frame) {
|
||||||
int X,Y,W,H;
|
int X,Y,W,H;
|
||||||
Fl::screen_work_area(X,Y,W,H, Fl::screen_num(x(),y(),w(),h()));
|
Fl::screen_work_area(X,Y,W,H, pWindow->screen_num());
|
||||||
if (maxw && maxw < W && maxh && maxh < H) {
|
if (maxw && maxw < W && maxh && maxh < H) {
|
||||||
libdecor_frame_unset_capabilities(wl_win->frame, LIBDECOR_ACTION_FULLSCREEN);
|
libdecor_frame_unset_capabilities(wl_win->frame, LIBDECOR_ACTION_FULLSCREEN);
|
||||||
} else {
|
} else {
|
||||||
@@ -737,7 +737,8 @@ static void surface_enter(void *data, struct wl_surface *wl_surface,
|
|||||||
while (e->next != &window->outputs) e = e->next; // move e to end of linked list
|
while (e->next != &window->outputs) e = e->next; // move e to end of linked list
|
||||||
wl_list_insert(e, &surface_output->link);
|
wl_list_insert(e, &surface_output->link);
|
||||||
//printf("%swindow %p enters screen id=%d length=%d\n", window->fl_win->parent()?"(sub)":"", window->fl_win, output->id, wl_list_length(&window->outputs));
|
//printf("%swindow %p enters screen id=%d length=%d\n", window->fl_win->parent()?"(sub)":"", window->fl_win, output->id, wl_list_length(&window->outputs));
|
||||||
if (list_was_empty && !window->fl_win->parent() && !window->fl_win->menu_window()) {
|
if (list_was_empty && !window->fl_win->parent() &&
|
||||||
|
!Fl_Window_Driver::to_menutitle(window->fl_win)) {
|
||||||
change_scale(output, window, 0);
|
change_scale(output, window, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user