diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-01-15 10:18:40 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-01-15 10:18:50 +0100 |
| commit | 761aa5e485f676a3120a42495beb59e91698e5d1 (patch) | |
| tree | 839a5a7d0841be0ff5b511aadac3fa3db063c032 /src | |
| parent | c76285d45747f1c22899861362875c9f2f13846f (diff) | |
Rename static member Fl_Wayland_Window_Driver::tall_popup to new_popup
The new name reflects better the role of this bool member variable.
Also, add explanatory comments about the use of this variable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 23 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H index 1b9b930c5..d1c724127 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H @@ -128,7 +128,7 @@ public: // menu-related stuff void reposition_menu_window(int x, int y) FL_OVERRIDE; void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1) FL_OVERRIDE; - static bool tall_popup; // to support tall menu buttons + static bool new_popup; // to support tall menu buttons bool process_menu_or_tooltip(struct wld_window *); static Fl_Window *previous_floatingtitle; // to support floating menuwindow w/ title }; diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index c5294507c..a7b267682 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -57,7 +57,7 @@ Window fl_window = 0; struct wld_window *Fl_Wayland_Window_Driver::wld_window = NULL; -bool Fl_Wayland_Window_Driver::tall_popup = false; // to support tall menu buttons +bool Fl_Wayland_Window_Driver::new_popup = false; // to support tall menu buttons // A menutitle to be mapped later as the child of a menuwindow Fl_Window *Fl_Wayland_Window_Driver::previous_floatingtitle = NULL; @@ -1019,7 +1019,12 @@ static const char *get_prog_name() { allows FLTK to compute the distance between the source window top and the display top border. Function Fl_Wayland_Window_Driver::menu_window_area() sets the top of the display to a value such that function Fl_Wayland_Window_Driver::reposition_menu_window(), called by - menuwindow::autoscroll(int n), ensures that menu item #n is visible. + menuwindow::autoscroll(int n), ensures that menu item #n is visible. Static boolean member + variable Fl_Wayland_Window_Driver::new_popup is useful to position tall menuwindows created + by an Fl_Menu_Button or Fl_Choice. It is set to true when any menu popup is created. + It is used each time menu_window_area() runs for a particular Fl_Menu_Button or Fl_Choice, + and is reset to false after its first use. This allows menu_window_area() to give the top of + the display an adequate value the first time and to keep this value next times it runs. Fl_Window_Driver::scroll_to_selected_item() scrolls the tall popup so its selected item, when there's one, is visible immediately after the tall popup is mapped on display. */ @@ -1035,12 +1040,7 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi previous_floatingtitle = pWindow; return true; } - Fl_Wayland_Window_Driver::tall_popup = false; - if (pWindow->menu_window() && !Fl_Window_Driver::menu_title(pWindow)) { - int HH; - Fl_Window_Driver::menu_parent(&HH); - if (pWindow->h() > HH) Fl_Wayland_Window_Driver::tall_popup = true; - } + Fl_Wayland_Window_Driver::new_popup = true; Fl_Window *menu_origin = NULL; if (pWindow->menu_window()) { menu_origin = Fl_Window_Driver::menu_leftorigin(pWindow); @@ -1720,11 +1720,12 @@ void Fl_Wayland_Window_Driver::menu_window_area(int &X, int &Y, int &W, int &H, if (origin) { // has left parent int selected = fl_max(Fl_Window_Driver::menu_selected(origin), 0); Y = origin->y() + (selected + 0.5) * ih; - } else if (!Fl_Window_Driver::menu_bartitle(pWindow)) { // tall menu button + } else if (!Fl_Window_Driver::menu_bartitle(pWindow) && + !Fl_Window_Driver::menu_title(pWindow)) { // tall menu button static int y_offset = 0; - if (tall_popup) { + if (new_popup) { y_offset = pWindow->y()- ih; - tall_popup = false; + new_popup = false; } Y = 1.5 * ih + y_offset; } else { // has a menutitle |
