mirror of
https://github.com/fltk/fltk.git
synced 2026-03-23 07:24:03 +08:00
Wayland: fix computation of wld_scale parameter for GL subwindows - cont'd (#1382)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Class Fl_Wayland_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 2021-2023 by Bill Spitzak and others.
|
||||
// Copyright 2021-2026 by Bill Spitzak and others.
|
||||
//
|
||||
// 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
|
||||
@@ -271,6 +271,10 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
|
||||
if (!egl_window) {
|
||||
struct wld_window *win = fl_wl_xid(pWindow);
|
||||
struct wl_surface *surface = win->wl_surface;
|
||||
if (pWindow->parent()) { // force toplevel win to enter its display before sizing GL subwin
|
||||
win = fl_wl_xid(pWindow->top_window());
|
||||
while (wl_list_empty(&win->outputs)) wl_display_dispatch(fl_wl_display());
|
||||
}
|
||||
int W = pWindow->pixel_w();
|
||||
int H = pWindow->pixel_h();
|
||||
int scale = Fl_Wayland_Window_Driver::driver(pWindow)->wld_scale();
|
||||
@@ -285,8 +289,9 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
|
||||
// Tested apps: shape, glpuzzle, cube, fractals, gl_overlay, fullscreen, unittests,
|
||||
// OpenGL3-glut-test, OpenGL3test.
|
||||
// Tested wayland compositors: mutter, kde-plasma, weston, sway on FreeBSD.
|
||||
if (pWindow->parent()) win = fl_wl_xid(pWindow->top_window());
|
||||
while (wl_list_empty(&win->outputs)) wl_display_dispatch(fl_wl_display());
|
||||
if (!pWindow->parent()) { // force toplevel GL win to enter its display
|
||||
while (wl_list_empty(&win->outputs)) wl_display_dispatch(fl_wl_display());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -736,9 +736,8 @@ static void surface_enter(void *data, struct wl_surface *wl_surface,
|
||||
struct wl_list *e = &window->outputs;
|
||||
while (e->next != &window->outputs) e = e->next; // move e to end of linked list
|
||||
wl_list_insert(e, &surface_output->link);
|
||||
//printf("window %p enters screen id=%d length=%d\n", window->fl_win, output->id, wl_list_length(&window->outputs));
|
||||
if (list_was_empty && (!window->fl_win->parent() || window->fl_win->as_gl_window()) &&
|
||||
!window->fl_win->menu_window()) {
|
||||
//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()) {
|
||||
change_scale(output, window, 0);
|
||||
}
|
||||
}
|
||||
@@ -2131,11 +2130,11 @@ int Fl_Wayland_Window_Driver::wld_scale() {
|
||||
struct wld_window *xid = (flx ? (struct wld_window *)flx->xid : NULL);
|
||||
if (!xid || wl_list_empty(&xid->outputs)) {
|
||||
int scale = 1;
|
||||
/*Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
|
||||
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
|
||||
Fl_Wayland_Screen_Driver::output *output;
|
||||
wl_list_for_each(output, &(scr_driver->outputs), link) {
|
||||
scale = fl_max(scale, output->wld_scale);
|
||||
}*/
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
struct surface_output *s_output;
|
||||
|
||||
Reference in New Issue
Block a user