#104 move tab by drag and drop

TK Soh

This patch allows users to move the tabs by dragging
and dropping them in the target window, either on the
text area or the tabs. If tab sorting is disabled, the
'moved' tab will be relocated to the right-hand-side of
the target tab. WIth this, you can arrange the tabs in
any order you want.

If the tab is dropped on the tab bar gutter, the
right-most tab of the tab bar will serve as the target tab.

This patch is strictly a proof of concept. Comment,
improvement or even replacement is welcome.

Patch v1.0 runs on RedHat 9.0 with OM-2.1.30. Lesstif
(0.93.18) compiled but, however, won't work - help me
fix it if you can.


  • TK Soh

    TK Soh - 2004-03-22

    patch v1.0: original release

  • TK Soh

    TK Soh - 2004-03-24

    patch v1.1: support Lesstif

  • TK Soh

    TK Soh - 2004-03-24

    Logged In: YES

    I found two issues with Lesstif:
    1. the drop rectangles are not updated as the drop-site
    widgets are resized.
    2. drop-sites do not get inactivated/reactivated as the
    widget s(or their parent) are unmapped/mapped.

    I had the workaround for issue #1 in patch v1.1, but the
    drop-site support has been disabled for the editor widgets,
    until a good workaround for issue #2 it found.

  • Huy N Pham

    Huy N Pham - 2004-04-08

    Logged In: YES

    I "cvs checkout nedit" on April 08 04, and apply the patch.
    It failed in one hulk:

    nautilus:~/nedit/source# patch < ../../drag-move-v1_0.diff
    patching file menu.c
    Hunk #4 succeeded at 4189 (offset -13 lines).
    patching file window.c
    Hunk #2 FAILED at 136.
    Hunk #3 succeeded at 203 (offset 14 lines).
    Hunk #4 succeeded at 599 (offset 54 lines).
    Hunk #5 succeeded at 731 (offset 54 lines).
    Hunk #6 succeeded at 830 (offset 54 lines).
    Hunk #7 succeeded at 995 (offset 54 lines).
    Hunk #8 succeeded at 2420 (offset 60 lines).
    Hunk #9 succeeded at 3767 (offset 62 lines).
    Hunk #10 succeeded at 4536 (offset 66 lines).
    Hunk #11 succeeded at 4587 (offset 66 lines).
    Hunk #12 succeeded at 4624 (offset 66 lines).
    1 out of 12 hunks FAILED -- saving rejects to file window.c.rej

    I checked out the rejected file, window.c.rej, and then manually
    added the two lines

    static void registerDropSite(Widget widget);
    static void addTabDragAction(Widget widget);

    into window.c, compile and then run. But the drag and drop is
    not working.

    I have OpenMotiff 2.1.30

    Please give me some advice.

    Thank you.

  • TK Soh

    TK Soh - 2004-04-08

    Logged In: YES

    I can see you're using patch v1.0. Please use v1.1 instead.
    I tried it on the latest snapshot, and it worked.


  • Nobody/Anonymous

    Logged In: NO

    The download links seem not working anymore.

    I have keep trying several times since yesterday.

  • Huy N Pham

    Huy N Pham - 2004-04-09

    Logged In: YES


    I got it working!

    After asking the author several questions, and received prompt
    responds from him, I am finally able to do drag-and-drop with
    the tabs.

    Thank you very much.

    It's just fantastic!


  • TK Soh

    TK Soh - 2005-11-29

    patch v1.2: updated to HEAD; disabled Lesstif support

  • TK Soh

    TK Soh - 2005-11-29

    Logged In: YES

    I have uploaded patch v1.2. The Lesstif support has been
    disabled, after receiving info from realiable source that
    DnD support in Lesstif isn't ready for prime time.

    Please help test the patch. Thanks.

  • Maxim Yanchenko

    Maxim Yanchenko - 2008-10-23

    Hi, there is a patch drag-move-v1_3.diff, against NEdit 5.5 release.

    The changes from the patch 1.2 are:
    - If you drop a tab to left or right side of another tab, it will be placed to the left or to the right of this tab (in 1.2 it's always to the right)
    - If you drop a tab to its neighbour, they will always swap.
    - Works correctly if dropped from another nedit process (will not move anything of course, but will not crash as well). The better way would be to place some unique ID (PID + X connection, maybe) to the DragWidget and read it on drop site - please feel free to implement.

    Please let me know hwo it works. Thanks.

  • Maxim Yanchenko

    Maxim Yanchenko - 2008-11-12

    Hi, there is a patch drag-move-v1_4.diff on the same link.

    What's new:
    - Inter-process drops are fully fixed now.
    - Cursor changes so you visually dragging the tab.
    - When moving the dragged tab above the tab bar, it shows the drop
    - Drag&drop is controlled by three options (all False by default):
    - - dragDropTabs - enable drag and drop for tabs
    - - dragDropTabsCursor - enable nice cursor
    - - dragDropTabsAnimation - enable drag and drop animation

    Tested with OpenMotif 2.3.0 over Exceed on Windows only, so please test it
    with other Motifs, X servers, window managers, and let me know how it works
    (on Exceed, I see artifacts while drawing under a moving cursor).



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks