Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 08 Sep 2014 13:35:28 UTC Commit: e6f8547e3e0d9ad42e7abdd360e4f3b2aac7b534 https://github.com/geany/geany/commit/e6f8547e3e0d9ad42e7abdd360e4f3b2aac7b5...
Log Message: ----------- GTK: cache the completion popup window
This avoids creating and destroying windows quickly under stress, which may lead to XID collisions.
See e.g. https://bugzilla.gnome.org/show_bug.cgi?id=581526 and https://bugzilla.gnome.org/show_bug.cgi?id=590690
Closes [scintilla:bugs:1649].
Modified Paths: -------------- scintilla/gtk/PlatGTK.cxx
Modified: scintilla/gtk/PlatGTK.cxx 25 lines changed, 22 insertions(+), 3 deletions(-) =================================================================== @@ -1225,9 +1225,19 @@ Surface *Surface::Allocate(int) { Window::~Window() {}
void Window::Destroy() { - if (wid) - gtk_widget_destroy(GTK_WIDGET(wid)); - wid = 0; + if (wid) { + ListBox *listbox = dynamic_cast<ListBox*>(this); + if (listbox) { + gtk_widget_hide(GTK_WIDGET(wid)); + listbox->Clear(); + // 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() { @@ -1432,6 +1442,10 @@ class ListBoxX : public ListBox { g_hash_table_foreach((GHashTable *) pixhash, list_image_free, NULL); g_hash_table_destroy((GHashTable *) pixhash); } + if (wid) { + gtk_widget_destroy(GTK_WIDGET(wid)); + wid = 0; + } } virtual void SetFont(Font &font); virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_); @@ -1524,6 +1538,11 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) { }
void ListBoxX::Create(Window &, int, Point, int, bool, int) { + if (wid) { + gtk_widget_realize(PWidget(wid)); + return; + } + wid = gtk_window_new(GTK_WINDOW_POPUP);
GtkWidget *frame = gtk_frame_new(NULL);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).