Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#3999 closed defect (fixed)

Journal drag and drop features broken

Reported by: garycmartin Owned by: humitos
Priority: Normal Milestone: Unspecified
Component: Sugar Version: 0.97.x
Severity: Major Keywords: 13.1.0, regression, r?
Cc: erikos, manuq, godiard, ajay_garg Distribution/OS: OLPC
Bug Status: Unconfirmed

Description

It's currently not possible to use drag and drop features in the Journal to copy entries between the Journal and Documents folder or other items in the Volumes bar. Dragging can be triggered on an entry if you get the timing right (press and hold still long enough, about 1 sec, so that the scroll gesture is not triggered). When you drag to an item in the Volumes bar at the bottom of the screen it is always rejected and bounces back to its original position. A hover palette will also often be triggered mid drag, aborting the drag operation part way through the action.

Attachments (8)

0001-Do-not-show-a-palette-while-we-are-dragging-SL-3999.patch (944 bytes) - added by humitos 8 years ago.
A proposal to avoid the palette in the mid drag operation
0001-Reset-event-controllers-on-GdkEventGrabBroken.patch (1.8 KB) - added by garnacho 8 years ago.
more generic patch, reset event controllers (inc. long press) when something else grabs the device
drag.patch (2.2 KB) - added by erikos 8 years ago.
toolkit patch to avoid the Palette coming up
journal_drag_and_drop_testing.diff (11.2 KB) - added by godiard 8 years ago.
On going work patch
treeview_dnd_test.py (4.2 KB) - added by godiard 8 years ago.
Treeview dnd example
0001-Port-Journal-s-Drag-N-Drop-to-Gtk3-SL-3999.patch (2.7 KB) - added by humitos 8 years ago.
Candidate patch. Needs some improvement
0001-Port-Journal-s-Drag-N-Drop-to-Gtk3-SL-3999.2.patch (2.5 KB) - added by humitos 8 years ago.
v2 - includes a HACK to get the proper value of a Gdk.Atom<UTF8_STRING>
0001-Port-Journal-s-Drag-N-Drop-to-Gtk3-SL-3999.3.patch (3.1 KB) - added by humitos 8 years ago.
v3 - improved commit message and fixed some typos in the source comment

Download all attachments as: .zip

Change History (35)

comment:1 Changed 9 years ago by garycmartin

  • Owner set to erikos
  • Status changed from new to assigned

Changed 8 years ago by humitos

A proposal to avoid the palette in the mid drag operation

Changed 8 years ago by garnacho

more generic patch, reset event controllers (inc. long press) when something else grabs the device

comment:2 Changed 8 years ago by erikos

I landed 0001-Reset-event-controllers-on-GdkEventGrabBroken.patch: http://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3/commit/b2df1358447c39e3a4720af2286846d516ea3b02

I don't seem to be able to do drag and drop neverless.

comment:3 follow-up: Changed 8 years ago by erikos

  • Bug Status changed from Unconfirmed to Assigned
  • Distribution/OS changed from Unspecified to OLPC
  • Priority changed from Unspecified by Maintainer to High
  • Severity changed from Unspecified to Major

Oh, ok I see now. I was trying to drag and drop with touch. /me always goes for the hard stuff :)

With the patch in action, I can still see the Palette appearing when I drag an item with the mouse. The controller should probably check the source of the event and if not coming from the touchscreen just not handle it?

comment:4 in reply to: ↑ 3 Changed 8 years ago by garycmartin

Replying to erikos:

Oh, ok I see now. I was trying to drag and drop with touch. /me always goes for the hard stuff :)

With the patch in action, I can still see the Palette appearing when I drag an item with the mouse. The controller should probably check the source of the event and if not coming from the touchscreen just not handle it?

Touch screen use is a case where drag and drop is more natural/intuitive as you are more directly interacting with an object. So we have some timing cases to consider here; a tap to resume/favourite/re-name; a press and immediate drag to scroll; a short press-and-hold and then drag to drag an object; a long-press-and-hold to raise the palette.

comment:5 Changed 8 years ago by godiard

  • Keywords regression added

comment:6 Changed 8 years ago by manuq

  • Priority changed from High to Urgent

comment:7 Changed 8 years ago by erikos

First of all we have to fix the case where the palette is getting in the way. This is because in CellRendererInvoker we listen for motion events on the treeview, and those occur when drag the icon. Similar to the FavoritesView code we can set a boolean that is checking if a drag is going on. I have attached a first patch for this.

The second part is to get the drag&drop right. You can see with the above patch that the icon you want to drop on does not change (should see a +). I think we need to set "drag_dest_set" here. I advanced locally a bit on that, more on that later.

Changed 8 years ago by erikos

toolkit patch to avoid the Palette coming up

comment:8 follow-up: Changed 8 years ago by godiard

Drop in the device toolbutton show error (with mouse):

TypeError: do_drag_data_get() takes exactly 3 arguments (2 given)

comment:9 Changed 8 years ago by godiard

  • Owner changed from erikos to humitos

comment:10 in reply to: ↑ 8 Changed 8 years ago by humitos

Replying to godiard:

Drop in the device toolbutton show error (with mouse):

TypeError: do_drag_data_get() takes exactly 3 arguments (2 given)

This is happening because Gtk is not passing the "selection_data" argument to our overridden function do_drag_data_get. The documentation says explicitly that we should receive 2 arguments: "path" and "selection_data". But we are receiving just "path".

[1] http://developer.gnome.org/gtk3/3.6/gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-drag-source-drag-data-get

comment:11 Changed 8 years ago by humitos

  • Cc erikos manuq godiard added

I filled a ticket upstream with an attachment that shows the problem to discuss about this issue:

comment:12 Changed 8 years ago by godiard

I was looking at this, found a few parts where we need to do changes due to gtk3 as .target by .get_target() and .data by .get_data()

The same happen with #3819 "Clipboard drag&drop: error when dragging an icon to the clipboard". The attached patch solve these issues, but does not solve the problem described in these ticket.

I have tried changing the introspection without luck (and updated upstream ticket).

The attached patch can drag a journal entry (if dragged from the date column) to the frame clipboard area. One item is created, but the data is broken. The list of target s have garbage too, and probably is the reason we can't drop over the volume buttons.
This is the reason I was trying work with dnd in the clipboard and journal at the same time.

Also I attached a dnd example using a treeview copied from http://stackoverflow.com/questions/7661016/unresponsive-drag-and-drop-in-pygobject

Changed 8 years ago by godiard

On going work patch

Changed 8 years ago by godiard

Treeview dnd example

comment:13 Changed 8 years ago by ajay_garg

  • Cc ajay_garg added

Hi all.

Is this being intended to be fixed (even though I have to admit that it's better to disable this feature, rather than doing a non-proper fix for touch-scenarios).

comment:14 Changed 8 years ago by humitos

Our bug report was marked as duplicate of this one and it's already fixed. It worth to give it a try.

https://bugzilla.gnome.org/show_bug.cgi?id=692844

Changed 8 years ago by humitos

Candidate patch. Needs some improvement

comment:15 Changed 8 years ago by humitos

@erikos: I compiled gtk+ with this patch[1] (and it worked) on my XO-4 and tried to fix this issue but I couldn't get the proper type of the data dragged and dropped (selection.get_target() returns a Gdk.Atom<UTF8_STRING> from where I couldn't get the 'journal-object-id' nor 'text/uri-list')

If you apply the patch that I've just uploaded, you can Drag And Drop Journal Entries to the Documents folder and they are copied successfully.

[1] http://bugzilla-attachments.gnome.org/attachment.cgi?id=234782

Changed 8 years ago by humitos

v2 - includes a HACK to get the proper value of a Gdk.Atom<UTF8_STRING>

comment:16 Changed 8 years ago by humitos

  • Keywords r? added

Changed 8 years ago by humitos

v3 - improved commit message and fixed some typos in the source comment

comment:17 follow-ups: Changed 8 years ago by erikos

I have added the upstream fix to the gtk rpm, it will be in gtk3-3.6.4.1.fc18.olpc2

comment:18 in reply to: ↑ 17 Changed 8 years ago by manuq

Replying to erikos:

I have added the upstream fix to the gtk rpm, it will be in gtk3-3.6.4.1.fc18.olpc2

Excellent! Using current olpc build and after fixing the API in the same way Gonzalo did in his patch, I was able to drag a row in the Journal and drop it in the Documents drive or USB drive. Pull request at:

https://github.com/sugarlabs/sugar/pull/20

The palette gets in the middle, we need to fix the unwanted popup in a separate patch.

comment:19 in reply to: ↑ 17 Changed 8 years ago by manuq

Replying to erikos:

I have added the upstream fix to the gtk rpm, it will be in gtk3-3.6.4.1.fc18.olpc2

Testing further, I see that in this rpm we lost the patch for Gtk.Clipboard.set_with_data, which was shipped in previous builds:

http://bugs.sugarlabs.org/ticket/4307#comment:24

comment:20 Changed 8 years ago by godiard

Probably related to #4483

comment:21 Changed 8 years ago by manuq

I have pushed the API fix for the Journal DND as b483c14b .

Still we need to fix the palette popup, it is getting in the middle of the drag. So leaving this ticket open.

comment:22 Changed 8 years ago by dnarvaez

  • Component changed from journal to sugar

comment:23 Changed 8 years ago by dnarvaez

  • Milestone changed from 0.98 to Unspecified

comment:24 Changed 8 years ago by dnarvaez

  • Bug Status changed from Assigned to Unconfirmed

comment:25 Changed 8 years ago by dnarvaez

  • Priority changed from Urgent to Normal

comment:26 Changed 7 years ago by Gonzalo Odiard

  • Resolution set to fixed
  • Status changed from assigned to closed

Avoid popup the palette while a dragging in the Journal - SL #3999

This is was a pending issue. See more information in the ticket
Note than drag and drop is allowed only with the mouse, not with touch.
Fixes #3999.

Signed-off-by: Gonzalo Odiard <gonzalo@…>

Changeset: 2c1485add60e919650698cd5a8f67594803672c3

comment:27 Changed 7 years ago by Gonzalo Odiard

Avoid popup the palette while a dragging in the Journal - SL #3999

This is was a pending issue. See more information in the ticket
Note than drag and drop is allowed only with the mouse, not with touch.
Fixes #3999.

Signed-off-by: Gonzalo Odiard <gonzalo@…>

Changeset: 2c1485add60e919650698cd5a8f67594803672c3

Note: See TracTickets for help on using tickets.