! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
DND support for tabs between terminal windows
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfce4-terminal
Component:
General

Comments

Description Nick Schermer editbugs 2006-12-24 20:16:37 CET
Here is the first attempt for dnd support of tabs, using the GTK+ 2.10 api. It seems to work quite good, but it only supports dragging from 1 notebook to another (so when notebooks are not always visible and there is only 1 screen, it doesn't work).

The patch also includes some other fixes, read the ChangeLog below.

TODO:
* Drag into a vte screen and add the dragged screen to the window.
* Drag outside window and then detach the screen (don't think that's possible with the notebook dnd api, because there is no root window).
Comment 1 Nick Schermer editbugs 2006-12-24 20:19:22 CET
Created attachment 909 
Tabs drag and drop v1

2006-12-24	Nick Schermer <nick@xfce.org>
	* terminal/terminal-screen.c: Fix compiler warning because we
	  ignore the chdir return value.
	* terminal-window.c: Add support for DND the tabs between two windows
	  with GTK+ 2.10.x.
	* terminal-window.c: Disconnect the "remove" signal before destroying
	  the application. This will prevent a lot of GTK+ warnings quiting with
	  multiple tabs opened.
	* terminal/terminal-window.c: Move the code for checking if the tabs
	  should be visible to the rebuild_gomenu function. This will prevent some
	  duplicated code and works better with tab dnd.

NOTE: Geany also removes trailing spaces ^_^.
Comment 2 Nick Schermer editbugs 2006-12-25 13:18:23 CET
Created attachment 910 
terminal dnd v2

This patch will property reconnect the signals. I had to move the structures of terminal-tab-header and terminal-screen to their header files, to set the signal id's. Maybe there is another way to do this, but this seems to work fine.

You can also drop a screen in the vte area now. The new tab position will be calculated and the tab will be added.
Comment 3 Nick Schermer editbugs 2006-12-25 13:50:24 CET
Created attachment 911 
terminal dnd v2.1

This fixes some problems with the connected drag_data_received signal and tab expand.
Comment 4 Nick Schermer editbugs 2006-12-25 14:35:41 CET
Created attachment 912 
terminal dnd v2.2

This patch fixes some minor issues from the previous one.
Comment 5 Nick Schermer editbugs 2006-12-25 14:51:37 CET
Well a small status update. Most of the dnd is working properly now (no crashes, signals connect w/o problems). There is only 1 vte warning when you dnd (debug must be enabled):

(terminal:5110): Vte-WARNING **: Error (Invalid or incomplete multibyte or wide character) converting data for child, dropping.

Stuff that needs to be done before we can even thing about commiting:
* When you set MiscAlwaysShowTabs=TRUE in the rc file and you drag the last tab out of the window, some warnings are shown. We need to handle this properly.
* Run this patch in valgrind and check for memory leaks.

A possible TODO list:
* ATM when you drop a terminal in the vte area, it will be inserted in the right position, but it's not 'visible'. It would be nice to show an empty space in the tab-bar when you're dragging over the window, like the reorder animation.
* You cannot detach the terminal when you drag it out of the window. I don't think this is possible, because we have no root window(1). Anybody any ideas?

Nick

(1) See the gtk_notebook_set_window_creation_hook.
Comment 6 Nick Schermer editbugs 2006-12-25 16:10:18 CET
Created attachment 913 
terminal dnd v2.3

Warnings fixed, disconnect signals in the page-removed function. I think most leaks in valgrind are from libvte, so this should be it...
Comment 7 Nick Schermer editbugs 2006-12-26 11:46:43 CET
I've found a way to recognize if a tab is dropped outside a window. Maybe not the cleanes way, but it seems to work...

/* connect this signal when creating a new notebook */
g_signal_connect(G_OBJECT(window->notebook), "button_release_event",
	         terminal_window_release_event, window);

static gboolean
terminal_window_release_event (GtkNotebook    *notebook,
                               GdkEventButton *event,
                               TerminalWindow *window)
{
  if (gdk_window_at_pointer (NULL, NULL) == NULL)
    {
      /* the tab is dropped outside 1 of our application windows
       * we can detach the tab now */

      /* move the new terminal window to (event->x_root, event->y_root) */

      return TRUE;
    }

  return FALSE;
}

Duno if this is a good way to check if a window is dropped outside 1 of the terminal windows, just an idea...
Comment 8 Benedikt Meurer editbugs 2007-01-03 12:07:56 CET
While this is nice stuff, I'm not sure if it's ready for Xfce 4.4.0. What do you think?
Comment 9 Nick Schermer editbugs 2007-01-03 12:12:13 CET
We should release 4.4.0 ASAP, so I keep this patch in bugzilla. It also needs detach-drop before it can be committed.
Comment 10 Nick Schermer editbugs 2007-10-03 21:43:23 CEST
Created attachment 1381 
terminal dnd v2.4

- Tab drag and drop between windows
- Drop tabs on the root window, Gtk+ 2.12 only. (added a new marshal to pass
  the screen + coordinates)
- Bump Gtk+ version to 2.10
- Cleanup GTK_CHECK_VERSION stuff
- Go-to menu now uses the ui-manager (saved some code, a bit OT but
  I couldn't resist it ;), also included patch from Bug #3522).
- Merge some code and some cleanups
- Removed the terminal_window_page_switched code, it seems vte handles this
  without problems.

Would be cool it this was tested first (I've only tried gtk 2.12 and the latest vte) before committed, since I've moved a bit with the size functions.
Comment 11 Nick Schermer editbugs 2007-10-04 10:28:14 CEST
I'm having some resize problems with the terminal on my laptop atm (not related to the patch tho), but I'll try to figure that out first and send a new version.
Comment 12 Nick Schermer editbugs 2007-10-04 20:13:13 CEST
Created attachment 1385 
terminal dnd v2.5

Ok this patch is a lot better. No resize bug here anymore (the one I had on my laptop is definitly a vte bug), removed the menu changes (shouldn't be in the previous patch): so this is purely tab dnd, gtk 2.10 cleanups, some extra return_if_fail checks (for my personal testing, but they shoudn't hurt anyone), calls to gdk_thread_init in timeout functions and a drag finish in the existing dnd code.
Comment 13 Benedikt Meurer editbugs 2007-10-09 19:16:39 CEST
Uhm, I'm not yet comfortable with the patch. It seems to contain a lot of unrelated code changes.
Comment 14 Nick Schermer editbugs 2007-10-09 19:57:04 CEST
Well maybe the page-selected function could return to make sure we maintain the same grid, but appart from that I don't see much changes myself. But please tell me if you want to see anything changed in the patch.
Comment 15 Benedikt Meurer editbugs 2007-11-28 19:21:04 CET
Can you update the patch for the latest trunk?
Comment 16 Nick Schermer editbugs 2007-11-28 21:07:57 CET
Created attachment 1444 
terminal dnd v2.6

Patch against latest trunk.
Comment 17 Benedikt Meurer editbugs 2007-11-28 21:22:08 CET
Committed with revision 26400.

2007-11-28	Benedikt Meurer <benny@xfce.org>

	* terminal/: Apply patch from Nick Schermer <nick@xfce.org> to
	  enable Drag and Drop for tabs between Terminal windows.
	  Bug #2684.

Bug #2684

Reported by:
Nick Schermer
Reported on: 2006-12-24
Last modified on: 2009-12-17

People

Assignee:
Benedikt Meurer
CC List:
1 user

Version

Version:
0.2.5svn

Attachments

Tabs drag and drop v1 (22.01 KB, patch)
2006-12-24 20:19 CET , Nick Schermer
no flags
terminal dnd v2 (31.13 KB, patch)
2006-12-25 13:18 CET , Nick Schermer
no flags
terminal dnd v2.1 (31.72 KB, patch)
2006-12-25 13:50 CET , Nick Schermer
no flags
terminal dnd v2.2 (31.65 KB, patch)
2006-12-25 14:35 CET , Nick Schermer
no flags
terminal dnd v2.3 (32.03 KB, patch)
2006-12-25 16:10 CET , Nick Schermer
no flags
terminal dnd v2.4 (71.25 KB, patch)
2007-10-03 21:43 CEST , Nick Schermer
no flags
terminal dnd v2.5 (42.24 KB, patch)
2007-10-04 20:13 CEST , Nick Schermer
no flags
terminal dnd v2.6 (42.34 KB, patch)
2007-11-28 21:07 CET , Nick Schermer
no flags

Additional information