[geany/geany] 7d38ff: Merge branch 'scintilla/gtk3-dead-windows'

Colomban Wendling git-noreply at xxxxx
Wed Sep 10 21:23:01 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 10 Sep 2014 21:23:01 UTC
Commit:      7d38ff67ecf18f9f331ed1fad849878a6089097d
             https://github.com/geany/geany/commit/7d38ff67ecf18f9f331ed1fad849878a6089097d

Log Message:
-----------
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.


Modified Paths:
--------------
    scintilla/gtk/PlatGTK.cxx

Modified: scintilla/gtk/PlatGTK.cxx
30 lines changed, 25 insertions(+), 5 deletions(-)
===================================================================
@@ -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 @@ class ListBoxX : public ListBox {
 	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 @@ class ListBoxX : public ListBox {
 			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);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list