mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 20:06:18 +08:00
New static member bool Fl_Wayland_Window_Driver::tall_popup
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Definition of Wayland window driver for the Fast Light Tool Kit (FLTK).
|
// Definition of Wayland window driver for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 2010-2022 by Bill Spitzak and others.
|
// Copyright 2010-2023 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
|
||||||
@@ -125,8 +125,10 @@ public:
|
|||||||
void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right) FL_OVERRIDE;
|
void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right) FL_OVERRIDE;
|
||||||
int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data) FL_OVERRIDE;
|
int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data) FL_OVERRIDE;
|
||||||
void wait_for_expose() FL_OVERRIDE;
|
void wait_for_expose() FL_OVERRIDE;
|
||||||
|
// menu-related stuff
|
||||||
void reposition_menu_window(int x, int y) FL_OVERRIDE;
|
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;
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Implementation of the Wayland window driver.
|
// Implementation of the Wayland window driver.
|
||||||
//
|
//
|
||||||
// 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
|
// 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
|
||||||
@@ -57,6 +57,7 @@ Window fl_window = 0;
|
|||||||
|
|
||||||
|
|
||||||
struct wld_window *Fl_Wayland_Window_Driver::wld_window = NULL;
|
struct wld_window *Fl_Wayland_Window_Driver::wld_window = NULL;
|
||||||
|
bool Fl_Wayland_Window_Driver::tall_popup = false; // to support tall menu buttons
|
||||||
|
|
||||||
|
|
||||||
void Fl_Wayland_Window_Driver::destroy_double_buffer() {
|
void Fl_Wayland_Window_Driver::destroy_double_buffer() {
|
||||||
@@ -1024,7 +1025,6 @@ static const char *get_prog_name() {
|
|||||||
|
|
||||||
// A menutitle to be mapped later as the child of a menuwindow
|
// A menutitle to be mapped later as the child of a menuwindow
|
||||||
static Fl_Window *previous_floatingtitle = NULL;
|
static Fl_Window *previous_floatingtitle = NULL;
|
||||||
static int tall_popup = 0; // to support tall menu buttons
|
|
||||||
|
|
||||||
static bool process_menu_or_tooltip(struct wld_window *new_window) {
|
static bool process_menu_or_tooltip(struct wld_window *new_window) {
|
||||||
// a menu window or tooltip
|
// a menu window or tooltip
|
||||||
@@ -1037,11 +1037,11 @@ static bool process_menu_or_tooltip(struct wld_window *new_window) {
|
|||||||
previous_floatingtitle = pWindow;
|
previous_floatingtitle = pWindow;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
tall_popup = 0;
|
Fl_Wayland_Window_Driver::tall_popup = false;
|
||||||
if (pWindow->menu_window() && !Fl_Window_Driver::menu_title(pWindow)) {
|
if (pWindow->menu_window() && !Fl_Window_Driver::menu_title(pWindow)) {
|
||||||
int HH;
|
int HH;
|
||||||
Fl_Window_Driver::menu_parent(&HH);
|
Fl_Window_Driver::menu_parent(&HH);
|
||||||
if (pWindow->h() > HH) tall_popup = 1;
|
if (pWindow->h() > HH) Fl_Wayland_Window_Driver::tall_popup = true;
|
||||||
}
|
}
|
||||||
Fl_Window *menu_origin = NULL;
|
Fl_Window *menu_origin = NULL;
|
||||||
if (pWindow->menu_window()) {
|
if (pWindow->menu_window()) {
|
||||||
@@ -1723,12 +1723,14 @@ void Fl_Wayland_Window_Driver::menu_window_area(int &X, int &Y, int &W, int &H,
|
|||||||
Y = origin->y() + (selected + 0.5) * ih;
|
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)) { // tall menu button
|
||||||
static int y_offset = 0;
|
static int y_offset = 0;
|
||||||
if (tall_popup == 1) y_offset = pWindow->y()- ih;
|
if (tall_popup) {
|
||||||
|
y_offset = pWindow->y()- ih;
|
||||||
|
tall_popup = false;
|
||||||
|
}
|
||||||
Y = 1.5 * ih + y_offset;
|
Y = 1.5 * ih + y_offset;
|
||||||
} else { // has a menutitle
|
} else { // has a menutitle
|
||||||
Y = 1.5 * ih;
|
Y = 1.5 * ih;
|
||||||
}
|
}
|
||||||
tall_popup++;
|
|
||||||
} else { // position the menu window by wayland constraints
|
} else { // position the menu window by wayland constraints
|
||||||
X = -50000;
|
X = -50000;
|
||||||
Y = -50000;
|
Y = -50000;
|
||||||
|
|||||||
Reference in New Issue
Block a user