On 03/27/11 09:11, Colomban Wendling wrote:
We need a better fix then. Maybe you can try to find out why the X
clipboard get broken on Scintilla (and fix it :D). If it get fixed, we
will probably can re-apply the patch.

I spent a lot of time studying the Scintilla source and trying various things there and in splitwindow.c. I don't see anywhere that Scintilla is breaking the PRIMARY selection. It seems to become the owner of the PRIMARY selection in ScintillaGTK::ClaimSelection() whenever text is selected, but I can't figure for life of me why it it's not working. It seems like it should own the PRIMARY selection in each widget where you're selecting text. Even setting the owner of the primary selection manually to the "original" scintilla, it still locks into the "split" scintilla.

So after spending way too much time on this, and getting nowhere, I give up. I'm attaching a patch that no dev is going to like because it behaves differently on Windows than it does on non-Windows to work around a know issue in GTK+ that is not documented to affect Windows differently than X windows. Either someone else needs to find the root of the problem deep inside GTK+ (ie. why it reparenting only breaks on Windows), we figure out what's happening in Scintilla, we use the slightly hacky approach of behaving differently on Windows, or we just leave the whole plugin stay disable and let the Windows users not have it, even though we *can* make it working. Since it's just a plugin, completely separate from the core code, which is already kinda hacky with what it's doing, my opinion is just to use the patch.

It's not my call, but the patch is here if you want it.

Cheers,
Matthew Brush
diff --git a/plugins/splitwindow.c b/plugins/splitwindow.c
index ff67508..8e7d054 100644
--- a/plugins/splitwindow.c
+++ b/plugins/splitwindow.c
@@ -307,14 +307,28 @@ static void split_view(gboolean horizontal)
 
 	set_state(horizontal ? STATE_SPLIT_HORIZONTAL : STATE_SPLIT_VERTICAL);
 
+#ifndef G_OS_WIN32
 	/* temporarily put document notebook in main vbox (scintilla widgets must stay
 	 * in a visible parent window, otherwise there are X selection and scrollbar issues) */
 	gtk_widget_reparent(notebook,
 		ui_lookup_widget(geany->main_widgets->window, "vbox1"));
+#else
+	/* On Windows, we don't care about X selection issues and if we reparent,
+	 * the old window will stay where it should not be, see:
+	 * http://library.gnome.org/devel/gtk-faq/stable/x635.html */
+	gtk_widget_ref(notebook);
+	gtk_container_remove(GTK_CONTAINER(parent), notebook);
+#endif
 
 	pane = horizontal ? gtk_hpaned_new() : gtk_vpaned_new();
 	gtk_container_add(GTK_CONTAINER(parent), pane);
+	
+#ifndef G_OS_WIN32
 	gtk_widget_reparent(notebook, pane);
+#else
+	gtk_container_add(GTK_CONTAINER(pane), notebook);
+	gtk_widget_unref(notebook);
+#endif
 
 	box = gtk_vbox_new(FALSE, 0);
 	toolbar = create_toolbar();
@@ -358,10 +372,18 @@ static void on_unsplit(GtkMenuItem *menuitem, gpointer user_data)
 
 	g_return_if_fail(edit_window.editor);
 
+#ifndef G_OS_WIN32
 	/* temporarily put document notebook in main vbox (scintilla widgets must stay
 	 * in a visible parent window, otherwise there are X selection and scrollbar issues) */
 	gtk_widget_reparent(notebook,
 		ui_lookup_widget(geany->main_widgets->window, "vbox1"));
+#else
+	/* On Windows, we don't care about X selection issues and if we reparent,
+	 * the old window will stay where it should not be, see:
+	 * http://library.gnome.org/devel/gtk-faq/stable/x635.html */
+	gtk_widget_ref(notebook);
+	gtk_container_remove(GTK_CONTAINER(pane), notebook);
+#endif
 
 	if (edit_window.sci != NULL && edit_window.handler_id > 0)
 	{
@@ -372,7 +394,13 @@ static void on_unsplit(GtkMenuItem *menuitem, gpointer user_data)
 	gtk_widget_destroy(pane);
 	edit_window.editor = NULL;
 	edit_window.sci = NULL;
+
+#ifndef G_OS_WIN32
 	gtk_widget_reparent(notebook, parent);
+#else
+	gtk_container_add(GTK_CONTAINER(parent), notebook);
+	gtk_widget_unref(notebook);
+#endif
 }
 
 
_______________________________________________
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

Reply via email to