aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColomban Wendling <ban@herbesfolles.org>2014-09-04 00:04:54 +0200
committerColomban Wendling <ban@herbesfolles.org>2014-09-04 00:04:54 +0200
commitebe00c6f5dee25f7b89d54942fdf2a018fe275ea (patch)
treef73889894916817322a594fe6f6c06833ab0d713
parent368efdd03c86273d1df4f58ccebb3042f8e2616f (diff)
downloadscintilla-mirror-ebe00c6f5dee25f7b89d54942fdf2a018fe275ea.tar.gz
GTK: fix cached completion popup window sizing
Only cache the popup window itself and not its content, as it seems the window sizing is affected whether the content was just created or not.
-rw-r--r--gtk/PlatGTK.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index c69571669..46d92213e 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -1226,17 +1226,19 @@ Window::~Window() {}
void Window::Destroy() {
if (wid) {
- ListBox *listbox = dynamic_cast<ListBox*>(this);
- if (listbox) {
+ if (dynamic_cast<ListBox*>(this)) {
gtk_widget_hide(GTK_WIDGET(wid));
- listbox->Clear();
+ // 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;
}
+ wid = 0;
}
}
@@ -1421,6 +1423,7 @@ enum {
};
class ListBoxX : public ListBox {
+ WindowID widCached;
WindowID list;
WindowID scroller;
void *pixhash;
@@ -1433,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) {
}
@@ -1442,9 +1445,9 @@ public:
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;
+ if (widCached) {
+ gtk_widget_destroy(GTK_WIDGET(widCached));
+ wid = widCached = 0;
}
}
virtual void SetFont(Font &font);
@@ -1538,12 +1541,10 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
}
void ListBoxX::Create(Window &, int, Point, int, bool, int) {
- if (wid) {
- gtk_widget_realize(PWidget(wid));
- return;
- }
+ if (widCached == 0)
+ widCached = gtk_window_new(GTK_WINDOW_POPUP);
- wid = gtk_window_new(GTK_WINDOW_POPUP);
+ wid = widCached;
GtkWidget *frame = gtk_frame_new(NULL);
gtk_widget_show(frame);