Remove friend declaration from Fl_Window.H (see STR 3354)

Although this was not strictly necessary I decided to implement the
proposed patch, but in a slightly different way.

This adds a static public method for internal use only but it wouldn't
do any harm if a user called it.
This commit is contained in:
Albrecht Schlosser 2023-11-17 16:55:37 +01:00
parent a3fd63fd1d
commit 44bb080c0f
6 changed files with 32 additions and 11 deletions

View File

@ -1,7 +1,7 @@
//
// Window header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2022 by Bill Spitzak and others.
// Copyright 1998-2023 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
@ -53,12 +53,11 @@ class Fl_Double_Window;
flags are ignored.
*/
class FL_EXPORT Fl_Window : public Fl_Group {
friend int Fl::arg(int argc, char **argv, int &i);
friend class Fl_X;
friend class Fl_Window_Driver;
private:
static char *default_xclass_;
static char show_iconic_; // 1 means create next window in iconic form
static char show_next_window_iconic_; // 1 means create next window in iconic form
int no_fullscreen_x;
int no_fullscreen_y;
@ -602,6 +601,28 @@ public:
void screen_num(int screen_num);
static bool is_a_rescale();
fl_uintptr_t os_id();
/**
Sets a static flag whether the next window should be opened iconified.
\note This is an <b>internal function</b>, you should not use this in user code.
Please use Fl_Window::iconize() instead.
*/
static void show_next_window_iconic(char stat) {
show_next_window_iconic_ = stat ? 1 : 0;
}
/**
Returns the static flag whether the next window should be opened iconified.
\note This is an <b>internal function</b>, you should not use this in user code.
Please use Fl_Window::iconize() to iconify a window.
*/
static char show_next_window_iconic() {
return show_next_window_iconic_;
}
};
#endif

View File

@ -35,7 +35,7 @@
char *Fl_Window::default_xclass_ = 0L;
char Fl_Window::show_iconic_ = 0;
char Fl_Window::show_next_window_iconic_ = 0;
Fl_Window *Fl_Window::current_;

View File

@ -114,8 +114,8 @@ public:
void x(int X);
void y(int Y);
void current(Fl_Window *c);
char show_iconic() { return Fl_Window::show_iconic_; }
void show_iconic(char c) { Fl_Window::show_iconic_ = c; }
char show_iconic() { return Fl_Window::show_next_window_iconic(); }
void show_iconic(char c) { Fl_Window::show_next_window_iconic(c); }
void flx(Fl_X *x) { pWindow->flx_ = x; }
Fl_Cursor cursor_default() { return pWindow->cursor_default; }
void destroy_double_buffer();

View File

@ -1,7 +1,7 @@
//
// Window minification code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 1998-2023 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
@ -19,7 +19,7 @@
void Fl_Window::iconize() {
if (!shown()) {
show_iconic_ = 1;
show_next_window_iconic(1);
show();
} else {
pWindowDriver->iconize();

View File

@ -126,7 +126,7 @@ int Fl::arg(int argc, char **argv, int &i) {
s++; // point after the dash
if (fl_match(s, "iconic")) {
Fl_Window::show_iconic_ = 1;
Fl_Window::show_next_window_iconic(1);
i++;
return 1;
} else if (fl_match(s, "kbd")) {

View File

@ -2619,10 +2619,10 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
XWMHints *hints = XAllocWMHints();
hints->input = True;
hints->flags = InputHint;
if (Fl_Window::show_iconic_) {
if (Fl_Window::show_next_window_iconic()) {
hints->flags |= StateHint;
hints->initial_state = IconicState;
Fl_Window::show_iconic_ = 0;
Fl_Window::show_next_window_iconic(0);
showit = 0;
}
if (Fl_X11_Window_Driver::driver(win)->icon_ &&