wxDC GetHandle and GdkWindow

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
timhirrel
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Aug 07, 2013 6:43 am

wxDC GetHandle and GdkWindow

Post by timhirrel » Tue Oct 13, 2020 7:44 pm

wxWidgets 3.1.4

For a suite of vector graphics software, I have used wxMemoryDC.GetHandle() to get a GdkWindow for a wxBitMap.
But it's not working now with the latest wxWidgets and GTK3.
The documentation for wxDC GetHandle says it returns GdkDrawable but that class is not defined in GTK3.
So, how do I now get a GdkWindow for a wxBitMap?

Thanks in advance.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4404
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDC GetHandle and GdkWindow

Post by ONEEYEMAN » Thu Oct 15, 2020 7:39 am

Hi,
Did you see this?
You may try to check the wx sources to confirm.

Thank you.

timhirrel
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Aug 07, 2013 6:43 am

Re: wxDC GetHandle and GdkWindow

Post by timhirrel » Fri Oct 16, 2020 3:57 am

Thanks, the links in that post are no longer valid.

Here's my take on the matter. I really need a GdkWindow for a wxBitMap in order to continue doing vector graphics the way i have been, i.e.:
setting a background color
displaying a user specified raster image
drawing vector graphics elements through cairo

Since GdkWindow was a component of GdkDrawable I am hoping a minor modification to wxDC.GetHandle will allow it to return a GdkWindow, making it usable again. I was hoping someone with more background in wxWidgets could accomplish this. I have never dove into the code for wxWidgets, but I guess I can give it a try if that is the only option.

User avatar
doublemax
Moderator
Moderator
Posts: 15154
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDC GetHandle and GdkWindow

Post by doublemax » Fri Oct 16, 2020 1:19 pm

I don't work under Linux, so i can't tell if this is helpful or not.

From: <wxdir>/include/gtk/bitmap.h

Code: Select all

#ifdef __WXGTK3__
    cairo_t* CairoCreate() const;
    void Draw(cairo_t* cr, int x, int y, bool useMask = true, const wxColour* fg = NULL, const wxColour* bg = NULL) const;
    void SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg = NULL, const wxColour* bg = NULL) const;
    wxBitmap CreateDisabled() const;
#else
    GdkPixmap *GetPixmap() const;
    bool HasPixmap() const;
    bool HasPixbuf() const;
    wxBitmap(GdkPixmap* pixmap);
#endif
    GdkPixbuf* GetPixbufNoMask() const;
    GdkPixbuf *GetPixbuf() const;
So you have some cairo related methods under GTK3 and you can always get a GdkPixbuf *. Maybe this helps?
Use the source, Luke!

Post Reply