Merge branch 'scintilla/gtk3-dead-windows'
Backport patches applied upstream to cache auto-completion windows, hopefully avoiding dead popup windows lying around on GTK3 builds in some high stress scenarios.
This commit is contained in:
commit
7d38ff67ec
@ -1225,9 +1225,21 @@ Surface *Surface::Allocate(int) {
|
||||
Window::~Window() {}
|
||||
|
||||
void Window::Destroy() {
|
||||
if (wid)
|
||||
gtk_widget_destroy(GTK_WIDGET(wid));
|
||||
wid = 0;
|
||||
if (wid) {
|
||||
if (dynamic_cast<ListBox*>(this)) {
|
||||
gtk_widget_hide(GTK_WIDGET(wid));
|
||||
// clear up window content
|
||||
GtkWidget *child = gtk_bin_get_child(GTK_BIN(wid));
|
||||
if (child)
|
||||
gtk_widget_destroy(child);
|
||||
// resize the window to the smallest possible size for it to adapt
|
||||
// to future content
|
||||
gtk_window_resize(GTK_WINDOW(wid), 1, 1);
|
||||
} else {
|
||||
gtk_widget_destroy(GTK_WIDGET(wid));
|
||||
}
|
||||
wid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Window::HasFocus() {
|
||||
@ -1411,6 +1423,7 @@ enum {
|
||||
};
|
||||
|
||||
class ListBoxX : public ListBox {
|
||||
WindowID widCached;
|
||||
WindowID list;
|
||||
WindowID scroller;
|
||||
void *pixhash;
|
||||
@ -1423,7 +1436,7 @@ public:
|
||||
CallBackAction doubleClickAction;
|
||||
void *doubleClickActionData;
|
||||
|
||||
ListBoxX() : list(0), scroller(0), pixhash(NULL), pixbuf_renderer(0),
|
||||
ListBoxX() : widCached(0), list(0), scroller(0), pixhash(NULL), pixbuf_renderer(0),
|
||||
desiredVisibleRows(5), maxItemCharacters(0),
|
||||
aveCharWidth(1), doubleClickAction(NULL), doubleClickActionData(NULL) {
|
||||
}
|
||||
@ -1432,6 +1445,10 @@ public:
|
||||
g_hash_table_foreach((GHashTable *) pixhash, list_image_free, NULL);
|
||||
g_hash_table_destroy((GHashTable *) pixhash);
|
||||
}
|
||||
if (widCached) {
|
||||
gtk_widget_destroy(GTK_WIDGET(widCached));
|
||||
wid = widCached = 0;
|
||||
}
|
||||
}
|
||||
virtual void SetFont(Font &font);
|
||||
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_);
|
||||
@ -1524,7 +1541,10 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
|
||||
}
|
||||
|
||||
void ListBoxX::Create(Window &, int, Point, int, bool, int) {
|
||||
wid = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
if (widCached == 0)
|
||||
widCached = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
|
||||
wid = widCached;
|
||||
|
||||
GtkWidget *frame = gtk_frame_new(NULL);
|
||||
gtk_widget_show(frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user