GNOME Bugzilla – Bug 86938
tab drag-and-drop (detachable tabs)
Last modified: 2005-11-20 15:06:52 UTC
It would be *really* neat if - like galeon - gnome-terminal would accept other terminals docked into its tabs, and undock tabs into new windows. I don't know how hard/easy this is to implement here though.
Yes, it should do this. I'm not sure how hard it is either. ;-)
*** Bug 111212 has been marked as a duplicate of this bug. ***
I was wondering if there was or would there be any movement on this RFE. It's been almost a year since it was opened.
It's not near the top of my priority queue, but anyone is welcome to code up a patch.
*** Bug 125947 has been marked as a duplicate of this bug. ***
*** Bug 133021 has been marked as a duplicate of this bug. ***
The way GtkNotebook is written I don't think that it's possible to do it. Galeon uses a custom container called gul_notebook (galeon utility library?). The galeon container is however quite general and I think that it would be possible to reuse it. Perhaps it should be eggified?
*** Bug 145408 has been marked as a duplicate of this bug. ***
I was going to suggest this feature too. Most important to me would be the ability to reorder tabs within the same window. Moving tabs between windows would also be useful.
*** Bug 152319 has been marked as a duplicate of this bug. ***
Bug 152319 wants also reordering of tabs (and putting the tabs at the bottom or the sides, but that will not happen)
Created attachment 38231 [details] [review] Add "move left", "move right" and "next tab", "prev tab" menu items with wrap around This patch adds "Next Tab" and "Prev Tab" menu items with wrap around capabilities. They are not assigned any keybindings per default. Also includes the "move tab" patch from bug #106286. Added wrap around to this one too. Did some cleanup to "update_copy_sensitivity", removed the FIXME for bug #73229. Also, if there is only one tab, disable the whole tab menu item.
*** Bug 172362 has been marked as a duplicate of this bug. ***
Hi, I've been working on this and I've got it mostly working. However, there is an issue with rendering which I hope somebody can help me with. Firstly the code is based off how Epiphany does drap-n-drop of tabs. There is a new widget, TerminalNotebook, which inherits from GtkNotebook. TerminalNotebook adds support for detecting when a tab is being dragged and moved. In order to support moving of tabs between terminal windows I've had to turn TerminalScreen into a GtkWidget. Now instead of putting a GtkHBox containing a VTE widget and a scrollbar into the notebook widget, a TerminalScreen widget is added directly into the notebook widget. This way moving a tab between terminal windows is a matter of removing the TerminalScreen widget from one notebook and adding it to another notebook. Now the problem I'm having is that TerminalScreen widgets which are not visible are not resized when the terminal window is resized. That is, the TerminalScreen widget which is visible is resized however all the TerminalScreen widgets in the other tabs are not resized. The most notable affect of this is that when you open up more than on tab. Switching back to the first tab will show the TerminalScreen widget has not been resized to accommodate for the tabs along the top of the window. I'll attach a screenshot. Anyway, the patch is against gnome-terminal 2.10.0. Any help will be appreciated. Tony PS - The patch is far from complete I still have to clean up and refactor a lot of the code. Plus I want to integrate the patch from Mario.
Created attachment 45573 [details] [review] Tab drag-n-drop Patch
Created attachment 45574 [details] Screenshot of the rendering problem
Created attachment 45934 [details] [review] Updated Tab reorder patch Hi, Here is an update of the previous patch with the rendering problem fixed. Now that the basics are in place I'll start looking at detaching tabs. Enjoy, Tony
Created attachment 45935 [details] [review] Updated Tab reorder patch Hi, Here is an update of the previous patch with the rendering problem fixed. Now that the basics are in place I'll start looking at detaching tabs. Enjoy, Tony
Created attachment 46851 [details] [review] Patch with tab detach support Hi, Here is another patch with tab detach support. I'm hoping that this will be good enough to be accepted. Feedback appreciated. Tony
I used your patch for some days and I didn't got any problem with it. It's definitely a great feature that I was missing a lot after my switch to gnome (konsole has this and other more features and it's sad that gnome's bugzilla has a lot of good patches not applied :( ). I really hope that at least this one will be applied soon. Thanks.
Still applies to CVS HEAD. Gave a warning about one part but it patched fine. Patch itself works good, but is quite large. I do wish for something to drag a window into a ander window (making another tab there).
*** Bug 312226 has been marked as a duplicate of this bug. ***
This should be looked at as soon as we open 2.13.x
That's great news. Tell me if any changes are required in order for acceptance.
*** Bug 314886 has been marked as a duplicate of this bug. ***
Any news about applying Tony's patch? Detaching and reordering tabs are features I've been looking for since the beginning of time :-)
So, Epiphany's notebook has made it into GEdit and now this Gnome-Terminal patch (and Galeon's is also very similar since Epiphany's is based on it), and also has had some improvements since this patch was forked from it... should we move that into common EggNotebook + EggTabWidget widgets in libegg?
If we move these widgets into libegg I'm happy to create a new patch to use these widgets.
*** Bug 319318 has been marked as a duplicate of this bug. ***
Created attachment 54449 [details] [review] Movable Tab support Hi, Here is an updated patch which incorporates the patch from Mario Manno to move tabs via the Tabs menu and via keyboard shortcuts. The patch is made against gnome-terminal 2.12.0. Please tell me what else I need to do to get this patch accepted. Thanks. Tony
I'm going to commit this later this week. I agree with Olav that it would be nice to have a way to merge back any detached tabs but that's a feature that could be added at a later time.
kmaaras: Great news! Was already planning to ping you :)
Comment on attachment 54449 [details] [review] Movable Tab support >+static void >+terminal_screen_size_allocate (GtkWidget *widget, >+ GtkAllocation *allocation) >+{ >+ GtkWidget *child; >+ >+ widget->allocation = *allocation; >+ >+ child = GTK_BIN (widget)->child; >+ g_return_if_fail (child != NULL); >+ There's been some discussion lately about removing g_return_[val]_if_fail() and using plain g_assert() or if () checks instead when in static functions. See here: http://live.gnome.org/GnomeLove/PerformanceLoveDay >+static void >+terminal_screen_map (GtkWidget *widget) >+{ >+ GtkWidget *child; >+ >+ g_return_if_fail (GTK_WIDGET_REALIZED (widget)); >+ >+ child = GTK_BIN (widget)->child; >+ g_return_if_fail (child != NULL); >+ Same again... >--- orig/src/terminal-screen.h >+++ mod/src/terminal-screen.h >@@ -22,6 +22,8 @@ > #ifndef TERMINAL_SCREEN_H > #define TERMINAL_SCREEN_H > >+#include <gtk/gtkbin.h> >+ > #include "terminal-profile.h" > > G_BEGIN_DECLS >@@ -42,14 +44,15 @@ typedef struct _TerminalScreenPrivate Te > > struct _TerminalScreen > { >- GObject parent_instance; >+// GObject parent_instance; >+ GtkBin parent_instance; > Is this worth leaving in like this? >+ >+ /* ZvtTerm is a broken POS and requires this realize to get >+ * the size request right. >+ */ >+ term = terminal_screen_get_widget (screen); >+ gtk_widget_realize (GTK_WIDGET (term)); >+ Have we verified that this is still true? Has anyone filed a bug against vte for this problem? >- if (profile == NULL) >- return; >+ g_assert (profile); Are we in such deep shit here that we need to crash if the profile is null? >+static void >+notebook_tab_removed_callback (GtkWidget *notebook, >+ TerminalScreen *screen, >+ TerminalWindow *window) >+{ >+ int old_grid_width; >+ int old_grid_height; >+ >+ /* Called from terminal_notebook_remove_tab() */ >+ if (find_screen (window, screen) != NULL) { >+ g_return_if_fail (terminal_screen_get_window (screen) == window); Same as earlier... >+ /* Put ourselves back in a sane state */ >+ /* FIXME this block never gets called because removing a notebook page >+ * already emitted switch_page and updated the active terminal. >+ */ Is this still true also? >+ >+ /* FIXME multi-head */ >+ win_at_pointer = gdk_window_at_pointer (&x, &y); >+ if (win_at_pointer == NULL) Would it be hard to make the feature multihead safe? There are also a few more instances of g_return_* in static functions in the rest of the patch.
kmaraas: Thanks for the review comments. I am fixing the patch now. However, I have come across a bug where the terminal window does not resize correctly after removing a tab. Hopefully I can get the bug fixed and have an updated patch in a few days. With regards to some of your comments: >>+ >>+ /* ZvtTerm is a broken POS and requires this realize to get >>+ * the size request right. >>+ */ >>+ term = terminal_screen_get_widget (screen); >>+ gtk_widget_realize (GTK_WIDGET (term)); >>+ >Have we verified that this is still true? Has anyone filed a bug against vte >for this problem? > I'm sorry but I don't know the answer to this. This comment was already in the original code. It has shown up in my patch because I moved the code into a different function. >>+ >>+ /* FIXME multi-head */ >>+ win_at_pointer = gdk_window_at_pointer (&x, &y); >>+ if (win_at_pointer == NULL) >Would it be hard to make the feature multihead safe? > I will investigate this. Thanks again for reviewing the patch. :)
Created attachment 54694 [details] [review] Update with review comment fixes Hi, Here is an updated patch with fixes as per the review comments. In addition I've fixed the window resize bug and added a menuitem to detach tabs. I haven't had time to investigate multi-head support yet. In addition, I am currently looking at a pointer grab bug which occurs if you try to detach a tab while the terminal is switching profile.
Multi-head could be as easy as using gdk_display_get_window_at_pointer (gtk_widget_get_display (..),..) instead. I've recently fixed all known grab bugs in Epiphany's EphyNotebook, maybe you should re-sync with it.
Oh and I've just seen another multi-head problem, the gdk_cursor_new thing in drag_start needs to use a cursor for the display, not a global one.
Created attachment 54768 [details] [review] Update with pointer grab fix Hi, Here is an updated patch which fixes the pointer grab bug. The fix was to pass GDK_CURRENT_TIME to gdk_pointer_ungrab() instead of event->time. I'm not sure that this is the correct fix but I'd like to push forward with getting this patch committed while I continue to investigate the root cause of the problem. I plan to have a look at the latest version of Epiphany's EphyNotebook to pick up any grab bug fixes. At the moment I am also looking at the multi-head FIXME. FYI I have been using this patch on a multi-head system for months without any problems.
The right fix would be to use the event->time of the event that causes the ungrab. EphyNotebook in cvs HEAD (and gnome-2-12 branch) has that fix.
Created attachment 54895 [details] [review] Update with proper pointer grab fix Hi, I've re-synced the tab DnD code with EphyNotebook from the gnome-2_12 branch. This has fixed the grab bug. Two new functions, grab_broken_event_cb() and grab_notify_cb(), which came from EphyNotebook has a comment "FIXME?". I don't know if these need to be fixed.
The patch fails to apply and I get a reject of hunk #12 in terminal-window.c. Fixed it up by hand and applied the patch. Thanks for your patience :)