Kaydet (Commit) 7d38ff67 authored tarafından Colomban Wendling's avatar Colomban Wendling

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.
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment