Closed Bug 513885 Opened 15 years ago Closed 15 years ago

Cannot drag&drop multibyte text to GTK+ application

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: ginnchen+exoracle, Assigned: ginnchen+exoracle)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

D&D multibyte text (e.g. Chinese text) to gedit or gnome-terminal would get garbage characters.
C&P would be fine.

In current nsDragSevice.cpp code, we use text/plain for text/unicode.
It's impossible to transfer multibyte text through "text/plain".
GTK+ application would do g_convert_with_fallback() from "ASCII" to "UTF-8".

We should use "text/plain;charset=utf-8" or "UTF8_STRING".
We might want to leave "text/plain" for legacy application support, but I don't know if there's any.
Assignee: nobody → ginn.chen
Status: NEW → ASSIGNED
Attachment #397835 - Flags: review?(roc)
+                            plainUTF8Target->info = NS_PTR_TO_UINT32(plainUTF8Atom);

So how does this work on a 64-bit system?

Otherwise looks good.
GdkAtom is not a real pointer, so it should work.
The type of "info" is guint.
GPOINTER_TO_UINT() is more accurate for the context.
Bug 331198 changed it to NS_PTR_TO_UINT32 for a  workaround of the build issue of 64bit Firefox on AIX.

I guess the reason is glibconfig.h is not correct for 64bit on that system.
It should be the 64bit version
#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
not the 32bit version
#define GPOINTER_TO_UINT(p) ((guint)  (p))

OpenSolaris also has this bug. Filed at http://defect.opensolaris.org/bz/show_bug.cgi?id=9957

I think we can leave it as-is for now.
http://hg.mozilla.org/mozilla-central/rev/ff296aa200bb
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Does the patch also fix bug 179658?
I think it's partial fixed.
Only "text/plain;charset=utf-8" was added by my patch.

UTF8_STRING, COMPOUND_TEXT, TEXT, STRING, "text/plain;charset=utf-16" were not added.

For GTK+ app, it will fallback to "text/plain;charset=utf-8" if UTF8_STRING, COMPOUND_TEXT, TEXT, STRING were not supported.
Then it will fallback to ""text/plain;charset={current_locale_charset}", then "text/plain".
I think "text/plain;charset=utf-16" will not be used. (Do we have a locale using utf-16?)

It should work for most of GTK+ apps now.

Bug 179658 also mentioned it tries to rewrite the code to make it easier to read.
For this purpose, it is not fixed.
Blocks: 179658
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: