Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3309990
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:42:22+00:00 2026-05-17T21:42:22+00:00

I am in the process of adding drag and drop support to an existing

  • 0

I am in the process of adding drag and drop support to an existing Mono/C#/GTK# application. I was wondering whether it was possible to use RGBA transparency on the icons that appear under the mouse pointer when I start dragging an object.

So far, I realized the following:

  • I can set the bitmap in question by calling the Gtk.Drag.SourceSetIconPixbuf() method. However, no luck with alpha transparency: pixels that are not fully opaque would get 100% transparent this way.
  • I also tried calling RenderPixmapAndMask() on the GdkPixbuf so that I could use Gtk.Drag.SourceSetIcon() with an RGBA colormap of my Screen. It didn’t work either: whenever I started dragging, I got the following error:

    [Gdk] IA__gdk_window_set_back_pixmap: assertion 'pixmap == NULL || gdk_drawable_get_depth (window) == gdk_drawable_get_depth (pixmap)' failed.

    This way, the pixmap doesn’t even get copied, only a white shape (presumably set by the mask argument of SetSourceIcon()) shows up on dragging.

I’d like to ask if there’s a way to make these icons have alpha transparency, despite the fact that I failed to do so. In case it’s impossible, answers discussing the reasons of the lack of this feature would also be helpful. Thank you.

(Compositing is – of course – enabled on my desktop (Ubuntu/10.10, Compiz/0.8.6-0ubuntu9).)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:42:23+00:00Added an answer on May 17, 2026 at 9:42 pm

    Ok, finally I solved it. You should create a new Gtk.Window of POPUP type, set its Colormap to your screen’s RGBA colormap, have the background erased by Cairo to a transparent color, draw whatever you’d like on it and finally pass it on to Gtk.Drag.SetIconWidget().

    Sample code (presumably you’ll want to use this inside OnDragBegin, or at a point where you have a valid drag context to be passed to SetIconWidget()):

    Gtk.Window window = new Gtk.Window (Gtk.WindowType.Popup);
    
    window.Colormap = window.Screen.RgbaColormap;
    window.AppPaintable = true;
    window.Decorated = false;
    window.Resize (/* specify width, height */);
    
    /* The cairo context can only be created when the window is being drawn by the
     * window manager, so wrap drawing code into an ExposeEvent delegate. */
    window.ExposeEvent += delegate {
    
        Context ctx = Gdk.CairoHelper.Create (window.GdkWindow);
    
        /* Erase the background */
        ctx.SetSourceRGBA (0, 0, 0, 0);
        ctx.Operator = Operator.Source;
        ctx.Paint ();
    
        /* Draw whatever you'd like to here, and then clean up by calling
           Dispose() on the context's target. */
    
        (ctx.Target as IDisposable).Dispose ();
    };
    
    Gtk.Drag.SetIconWidget(drag_context, window, 10, 10);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in the process of adding Devise to an existing Rails app, with a
I'm in the process of adding 'pretty' URLs to an existing CMS, the menu
I have an application that monitors a process and learns exceptions, by adding them
I am in the process of adding Devise to my application. Everything seems to
Is it possible to automate the appointment adding process of outlook through java code?
I inherited a Django v1.2.4 application and am in the process of adding several
I'm in the process of adding some MVC pages to an already existing WebForms
I'm currently in the process of adding functionality to an existing J2EE webapp, in
I have a support ticketing system. I am in the process of adding in
i have one php file which process adding of record in Database fro array.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.