Bug 108376 - [Gtk] drag and drop has black background without composition
Summary: [Gtk] drag and drop has black background without composition
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: arno.
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-30 14:01 PST by arno.
Modified: 2013-01-31 15:47 PST (History)
2 users (show)

See Also:


Attachments
patch proposal (6.47 KB, patch)
2013-01-30 14:21 PST, arno.
no flags Details | Formatted Diff | Diff
updated patch: no need for a ManualTest (5.36 KB, patch)
2013-01-30 16:19 PST, arno.
no flags Details | Formatted Diff | Diff
updated patch to address reviewer comments (5.31 KB, patch)
2013-01-30 18:10 PST, arno.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description arno. 2013-01-30 14:01:38 PST
Hi, when dragging some text, a popup window with 0 opacity is created. It is then set as the drag icon with gtk_drag_set_icon_widget. While this gives a nice transparent result an a desktop with a compositor, it gives a black background when there is not compositor. So, if the text is black, it is not readable. And if the text is white, it's ugly anyway. May be we could use gtk_drag_set_icon_pixbuf as mozilla does (or gtk_drag_set_icon_surface when available to avoid a cairo/pixbuf conversion). This api decompose image into transparent/non transparent rectangles and use Xshape to make the transparent rectangles actually transparent even without a compositor.
Comment 1 arno. 2013-01-30 14:21:54 PST
Created attachment 185571 [details]
patch proposal
Comment 2 Martin Robinson 2013-01-30 15:49:51 PST
If we are falling back, maybe we should just fall back all the way to a simple icon? Maybe you can show me what the fallback looks like.
Comment 3 arno. 2013-01-30 16:19:14 PST
Created attachment 185612 [details]
updated patch: no need for a ManualTest
Comment 4 Martin Robinson 2013-01-30 16:48:20 PST
Comment on attachment 185612 [details]
updated patch: no need for a ManualTest

View in context: https://bugs.webkit.org/attachment.cgi?id=185612&action=review

Looks great, just needs a teensy bit of cleaning up.

> Source/WebCore/platform/gtk/DragIcon.cpp:56
> +#ifdef GTK_API_VERSION_2
> +    , m_pixbuf(0)
> +#endif

This can be eliminated with a GRefPtr. See below.

> Source/WebCore/platform/gtk/DragIcon.cpp:89
> +#ifdef GTK_API_VERSION_2
> +    if (m_pixbuf)
> +        g_object_unref(m_pixbuf);
> +#endif

Instead of a raw pointer you could use a GRefPtr here.

> Source/WebCore/platform/gtk/DragIcon.cpp:116
> +#ifdef GTK_API_VERSION_2
> +    if (m_pixbuf)
> +        g_object_unref(m_pixbuf);
> +    m_pixbuf = cairoImageSurfaceToGdkPixbuf(image);
> +#endif

This would become:

m_pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(image));

> Source/WebCore/platform/gtk/DragIcon.h:45
> +    gboolean m_iscomposited;

This should probably be:

bool isComposited;
Comment 5 arno. 2013-01-30 18:10:00 PST
Created attachment 185642 [details]
updated patch to address reviewer comments
Comment 6 Martin Robinson 2013-01-31 08:46:16 PST
Comment on attachment 185642 [details]
updated patch to address reviewer comments

Great!
Comment 7 WebKit Review Bot 2013-01-31 15:47:36 PST
Comment on attachment 185642 [details]
updated patch to address reviewer comments

Clearing flags on attachment: 185642

Committed r141498: <http://trac.webkit.org/changeset/141498>
Comment 8 WebKit Review Bot 2013-01-31 15:47:39 PST
All reviewed patches have been landed.  Closing bug.