After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 86938 - tab drag-and-drop (detachable tabs)
tab drag-and-drop (detachable tabs)
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other other
: High enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
list-kmaraas
: 111212 125947 133021 145408 152319 172362 312226 314886 319318 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-06-30 21:43 UTC by Johannes Berg
Modified: 2005-11-20 15:06 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Add "move left", "move right" and "next tab", "prev tab" menu items with wrap around (12.91 KB, patch)
2005-03-04 03:00 UTC, Mario Manno
none Details | Review
Tab drag-n-drop Patch (57.31 KB, patch)
2005-04-23 06:43 UTC, Tony Tsui
none Details | Review
Screenshot of the rendering problem (16.30 KB, image/png)
2005-04-23 06:44 UTC, Tony Tsui
  Details
Updated Tab reorder patch (64.81 KB, patch)
2005-05-02 13:53 UTC, Tony Tsui
none Details | Review
Updated Tab reorder patch (64.81 KB, patch)
2005-05-02 13:54 UTC, Tony Tsui
none Details | Review
Patch with tab detach support (64.28 KB, patch)
2005-05-24 23:29 UTC, Tony Tsui
none Details | Review
Movable Tab support (76.27 KB, patch)
2005-11-08 01:52 UTC, Tony Tsui
needs-work Details | Review
Update with review comment fixes (79.82 KB, patch)
2005-11-13 12:17 UTC, Tony Tsui
none Details | Review
Update with pointer grab fix (77.62 KB, patch)
2005-11-15 03:24 UTC, Tony Tsui
none Details | Review
Update with proper pointer grab fix (83.79 KB, patch)
2005-11-17 23:51 UTC, Tony Tsui
none Details | Review

Description Johannes Berg 2002-06-30 21:43:51 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.
Comment 1 Havoc Pennington 2002-09-22 22:04:57 UTC
Yes, it should do this. I'm not sure how hard it is either. ;-)
Comment 2 Olav Vitters 2003-06-21 20:59:35 UTC
*** Bug 111212 has been marked as a duplicate of this bug. ***
Comment 3 seth vidal 2003-06-22 15:25:18 UTC
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.

Comment 4 Havoc Pennington 2003-06-22 15:32:31 UTC
It's not near the top of my priority queue, but anyone is welcome to 
code up a patch.
Comment 5 Olav Vitters 2003-10-31 22:47:46 UTC
*** Bug 125947 has been marked as a duplicate of this bug. ***
Comment 6 Olav Vitters 2004-01-31 20:16:33 UTC
*** Bug 133021 has been marked as a duplicate of this bug. ***
Comment 7 Rob Adams 2004-03-23 00:27:19 UTC
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? 
Comment 8 Mariano Suárez-Alvarez 2004-07-04 20:11:10 UTC
*** Bug 145408 has been marked as a duplicate of this bug. ***
Comment 9 matthew arnison 2004-08-01 13:33:58 UTC
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.
Comment 10 Mariano Suárez-Alvarez 2004-11-25 00:08:45 UTC
*** Bug 152319 has been marked as a duplicate of this bug. ***
Comment 11 Mariano Suárez-Alvarez 2004-11-25 00:11:21 UTC
Bug 152319 wants also reordering of tabs 
(and putting the tabs at the bottom or the sides, but that will not happen)
Comment 12 Mario Manno 2005-03-04 03:00:24 UTC
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.
Comment 13 Olav Vitters 2005-04-01 19:00:58 UTC
*** Bug 172362 has been marked as a duplicate of this bug. ***
Comment 14 Tony Tsui 2005-04-23 06:42:33 UTC
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.
Comment 15 Tony Tsui 2005-04-23 06:43:23 UTC
Created attachment 45573 [details] [review]
Tab drag-n-drop Patch
Comment 16 Tony Tsui 2005-04-23 06:44:28 UTC
Created attachment 45574 [details]
Screenshot of the rendering problem
Comment 17 Tony Tsui 2005-05-02 13:53:59 UTC
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
Comment 18 Tony Tsui 2005-05-02 13:54:13 UTC
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
Comment 19 Tony Tsui 2005-05-24 23:29:45 UTC
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
Comment 20 Simone Gotti 2005-06-04 00:37:51 UTC
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.
Comment 21 Olav Vitters 2005-07-03 17:58:34 UTC
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).
Comment 22 Olav Vitters 2005-08-01 16:10:23 UTC
*** Bug 312226 has been marked as a duplicate of this bug. ***
Comment 23 Kjartan Maraas 2005-08-19 20:41:48 UTC
This should be looked at as soon as we open 2.13.x
Comment 24 Tony Tsui 2005-08-22 00:17:16 UTC
That's great news. Tell me if any changes are required in order for acceptance.
Comment 25 Olav Vitters 2005-08-30 21:38:50 UTC
*** Bug 314886 has been marked as a duplicate of this bug. ***
Comment 26 Cesar Garcia Tapia 2005-09-16 12:02:25 UTC
Any news about applying Tony's patch? Detaching and reordering tabs are features
I've been looking for since the beginning of time :-)
Comment 27 Christian Persch 2005-09-24 11:16:35 UTC
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?
Comment 28 Tony Tsui 2005-09-26 00:35:00 UTC
If we move these widgets into libegg I'm happy to create a new patch to use
these widgets.
Comment 29 Olav Vitters 2005-10-20 16:34:12 UTC
*** Bug 319318 has been marked as a duplicate of this bug. ***
Comment 30 Tony Tsui 2005-11-08 01:52:56 UTC
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
Comment 31 Kjartan Maraas 2005-11-08 08:41:50 UTC
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.
Comment 32 Olav Vitters 2005-11-08 08:43:06 UTC
kmaaras: Great news! Was already planning to ping you :)
Comment 33 Kjartan Maraas 2005-11-08 17:04:16 UTC
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.
Comment 34 Tony Tsui 2005-11-09 12:47:03 UTC
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. :)
Comment 35 Tony Tsui 2005-11-13 12:17:15 UTC
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.
Comment 36 Christian Persch 2005-11-13 13:41:32 UTC
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.
Comment 37 Christian Persch 2005-11-13 13:43:34 UTC
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.
Comment 38 Tony Tsui 2005-11-15 03:24:11 UTC
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.
Comment 39 Christian Persch 2005-11-16 22:16:42 UTC
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.
Comment 40 Tony Tsui 2005-11-17 23:51:32 UTC
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.
Comment 41 Kjartan Maraas 2005-11-20 15:06:52 UTC
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 :)