Open Bug 179658 Opened 22 years ago Updated 2 months ago

clean up external drag and drop selection target type handling [gtk]

Categories

(Core :: XUL, task)

x86
Linux
task

Tracking

()

REOPENED

People

(Reporter: yinbolian, Unassigned)

References

(Blocks 4 open bugs)

Details

Attachments

(4 files, 3 obsolete files)

 
This is caused by the different target name in Mozilla and gtk2. Some converts 
are needed like what has been done in Copy/Paste. Simple patch about auto 
mapping of target name can work. But I'd like to rewrite part of the code in 
widget/src/gtk2/nsDragService.cpp, to make it easy to read, to expand and I 
think use less lines of code.
-> bolian
Assignee: browser-china-gtk2 → bolian.yin
Attached patch patch (obsolete) — Splinter Review
setup a table to help the converting between mozilla internal target and
outside target.
Attachment #106626 - Flags: review?(blizzard)
a DnD problem with StartOffice and its fix:
---------------
Now, both Mozilla and StarOffice are using XDnD protocol (Mozilla use it through
gtk). But it seems there is problem in ther cooperation.
Think this situation,  user Drags something from StarOffice into Mozilla and
"Keeps Moving the mouse pointer while drops".  In this case, StarOffice will
send one or more "XdndPosition" after the "XdndLeave" and "XdndDrop".  This will
confuse Mozilla, who think "XdndLeave" indicates the end of the current drag
session, and the "XdndPostion" after that will make Mozilla start another drag
session. It of course cause problems.
---------------
Answer from Philipp.Lohmann@Sun.COM
fix is already in the code, will be merged into the 644 tree around mid of
March. You can look at

http://www.openoffice.org/issues/show_bug.cgi?id=11783

to track the corresponding issue. 
---------------
Status: NEW → ASSIGNED
The patch in attachment
http://bugzilla.mozilla.org/attachment.cgi?id=106626&action=view still applies
cleanly [with only line offset fuzz], and I checked that it does make it
possible to drag text from mozilla to GtkEntry/GtkTextView:s. This is an
important issue for embedding [Epiphany]. What work (if any) is needed to make
the patch ready to check it in?
Hi Blizzard,

Can you give r= for this long time waiting bug? It works well for a long time in
our internal built gtk2 mozilla.
*** Bug 210308 has been marked as a duplicate of this bug. ***
Aren't there encoding issues with the UTF8_STRING drag type ? When passing the
data to gtk, the string is encoded using |ConvertUnicodeToPlatformPlainText|
which from my reading of the code isn't guaranteed to return UTF-8.
louie.zhao@sun.com from the Mozilla team reported that this bug is 
pertinent to this Java issue (which is not a Java bug actually):
http://developer.java.sun.com/developer/bugParade/bugs/5005676.html.

When dragging some text from Mozilla (verified with 'Mozilla 1.5, Copyright (c)
2003 mozilla.org, build 2003100718') to an XDND-aware drop target (e.g., a
Java drop target as of JDK 1.5), Mozilla exports data in the following
targets: text/_moz_htmlcontext, text/_moz_htmlinfo, text/html, text/unicode,
text/plain.

Only text/html and text/plain are standard formats that other applications
should be able to understand. But they contain no information about
encoding, so drop targets can't figure out how to translate text/html and
text/plain data. If Mozilla exported text targets specifying their charsets
(e.g., text/html;charset=ISO-2022-JP), then there would not be any troubles.
Attached patch patch v2 (obsolete) — Splinter Review
This patch is based on mozilla 1.7 branch.
Attachment #106626 - Attachment is obsolete: true
Attachment #106626 - Flags: review?(blizzard)
Attached patch patch v2 (obsolete) — Splinter Review
updated patch.
Attachment #145991 - Attachment is obsolete: true
Louie Zhao: is this patch (attachment 145992 [details] [diff] [review]) ready for review? If so, please
request r/sr, so this will be looked at by the right people -- this is an
important issue for embed (Epiphany). Thanks!
Assignee: yinbolian → Louie.Zhao
Status: ASSIGNED → NEW
Comment on attachment 145992 [details] [diff] [review]
patch v2

This patch has been using in Sun Mozilla codebase for a long time and works
fine. 

Blizzard, can you review this patch? Thanks a lot.
Attachment #145992 - Flags: review?(blizzard)
*** Bug 246741 has been marked as a duplicate of this bug. ***
Attachment #145992 - Flags: review?(blizzard) → review+
Attachment #145992 - Flags: superreview?(bryner)
Comment on attachment 145992 [details] [diff] [review]
patch v2

>+//converters
>+
>+void
>+utf8_to_ucs2 (const char *aDataIn, unsigned int aDataInLen,
>+              char **aDataOut, unsigned int *aDataOutLen)

I believe you need |static| here since it was declared with |static|.  Same for
the other converter functions.
Attachment #145992 - Flags: superreview?(bryner) → superreview+
Comment on attachment 145992 [details] [diff] [review]
patch v2

Louie Zhao: This patch has r + sr; if it's still relevant can the sr's comment
in comment 15 be addressed and the patch checked in?
QA Contact: jrgmorrison → xptoolkit.widgets
Fixed up conflicts and diffed against 2.0.x and 1.5.x.  Tested and works.  There were only minor changes to this patch, so I'll carry over the r=blizzard sr=bryner and seek branch approvals.

This is a rather important patch that Sun has carried for a long time and tested according to earlier comments.  I've ran some testing and this also works without regressing anything AFAICT.  This enables dragging and dropping between e.g. Firefox and GTK2 applications, which has been rather broken all this time.
Attachment #145992 - Attachment is obsolete: true
Attachment #271699 - Flags: superreview+
Attachment #271699 - Flags: review+
Attachment #271699 - Flags: approval1.8.1.5?
Attachment #271699 - Flags: approval1.8.0.13?
Same as the 2.0 patch, however, there is a change in one hunk in nsDragService.cpp @@ -1104,28 +1066,18 @@ that should probably get looked at.  The changes to bug 376777 conflicted, but I believe that removing the code in question is correct because it will be converted with the in2out function ucs2_to_text) which should do the same job.  Seeking r+sr on this change.
Attachment #271701 - Flags: superreview?(roc)
Attachment #271701 - Flags: review?(roc)
Comment on attachment 271699 [details] [diff] [review]
forward-port to Mozilla 1.8 (Firefox 2.0)

This is the sort of thing we need to get in early in a cycle, not after the nomination deadline. Now we're in firedrill mode and can't take it. ->1.8.1.6
Attachment #271699 - Flags: approval1.8.1.5? → approval1.8.1.6?
Comment on attachment 271701 [details] [diff] [review]
forward-port to HEAD

+            addBOM(NS_REINTERPRET_CAST(guchar **, &primitive_data),
+                   NS_REINTERPRET_CAST(gint *, &len));

We're using reinterpret_cast<> now.
Attachment #271701 - Flags: superreview?(roc)
Attachment #271701 - Flags: superreview+
Attachment #271701 - Flags: review?(roc)
Attachment #271701 - Flags: review+
Attachment #271699 - Flags: approval1.8.0.13? → approval1.8.0.14?
With the patch applied, Firefox trunk build will hang with dead lock when dragging some text.
Comment on attachment 271699 [details] [diff] [review]
forward-port to Mozilla 1.8 (Firefox 2.0)

approved for 1.8.1.7 and 1.8.0.14, a=dveditz for release-drivers
Attachment #271699 - Flags: approval1.8.1.7?
Attachment #271699 - Flags: approval1.8.1.7+
Attachment #271699 - Flags: approval1.8.0.14?
Attachment #271699 - Flags: approval1.8.0.14+
reassigning to caillon based on patch activity/interest.
Assignee: Louie.Zhao → caillon
Attachment #271701 - Flags: approval1.9?
(In reply to comment #22)
> With the patch applied, Firefox trunk build will hang with dead lock when
> dragging some text.

Is this still a problem?
Attached patch For trunkSplinter Review
Update the patch to apply to the CVS HEAD. It seems that NS_ConvertUTF8toUCS2 isn't in use any more. Use NS_ConvertASCIItoUTF16 instead in function utf8_to_ucs2. Any other better replacement?

(In reply to comment #25)
> Is this still a problem?

Yes, I can still see the hang on my Solaris x86 box here with this patch applied. Will post the stack trace next.
This is one of the traces I've got here. The stack traces are different for the 1-19 frames every time I attach to the Firefox process.
Comment on attachment 271701 [details] [diff] [review]
forward-port to HEAD

a- based on alfred's comments
Attachment #271701 - Flags: approval1.9? → approval1.9-
(In reply to comment #26)
> Yes, I can still see the hang on my Solaris x86 box here with this patch
> applied. Will post the stack trace next.

Can you test MOZILLA_1_8_BRANCH to see if it has the same problem (with regards to the hang)?
Depends on: 398422
This breaks branch compat.  At the very least, it caused bug 398422 on branch.
This caused bug 398422 at least, and may have other issues. Maybe we should back this out and respin without it? :/
Backed out of
 MOZILLA_1_8_BRANCH
 MOZILLA_1_8_0_BRANCH
 GECKO181_20071004_RELBRANCH

to fix regression bug 398422
Comment on attachment 271699 [details] [diff] [review]
forward-port to Mozilla 1.8 (Firefox 2.0)

removing approvals, this patch caused regressions.
Attachment #271699 - Flags: approval1.8.1.8-
Attachment #271699 - Flags: approval1.8.1.8+
Attachment #271699 - Flags: approval1.8.0.14-
Attachment #271699 - Flags: approval1.8.0.14+
Summary: can not DnD between mozilla and other gtk2 apps such as gedit → can not DnD between Firefox and other gtk2 apps such as gedit
Depends on: 40608
Blocks: 205491
Blocks: 497496
Assignee: caillon → netzen
Blocks: 180680
Assignee: netzen → nobody
It looks like bug 513885 has fixed this as originally reported by switching from text/plain to text/plain;charset=utf-8.  Bug 513885 comment 6 mentions some other target types that perhaps could/should be added, but text/plain;charset=utf-8 should be enough for GTK apps.

I suspect there is further value in the patch here.

Ultimately, sharing the selection handling code between nsDragService and nsClipboard would mean that these kind of issues don't need to be fixed twice.
Depends on: 513885
Summary: can not DnD between Firefox and other gtk2 apps such as gedit → clean up external DnD selection target type handling [gtk]
Severity: normal → S3
Summary: clean up external DnD selection target type handling [gtk] → clean up external drag and drop selection target type handling [gtk]
Type: defect → task

Yeah Stransky also reworked GTK DnD for Wayland over time.

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → WORKSFORME

Well I guess I'll let him confirm whether there's something to do here.

Status: RESOLVED → REOPENED
Flags: needinfo?(stransky)
Resolution: WORKSFORME → ---

Will look at it, adding to D&D tracker.

Blocks: linuxdad
Flags: needinfo?(stransky)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: