X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eccace042d8adfe2d45dae21ad924bfc4e0d9ed9..7d6a4d96961eac84d05db8bb24c64d39003f6e54:/src/gtk/nonownedwnd.cpp?ds=sidebyside diff --git a/src/gtk/nonownedwnd.cpp b/src/gtk/nonownedwnd.cpp index e4706c8bae..0e6226877d 100644 --- a/src/gtk/nonownedwnd.cpp +++ b/src/gtk/nonownedwnd.cpp @@ -24,18 +24,17 @@ #endif #ifndef WX_PRECOMP + #include "wx/nonownedwnd.h" #include "wx/dcclient.h" #include "wx/dcmemory.h" - #include "wx/nonownedwnd.h" #include "wx/region.h" #endif // WX_PRECOMP -#include "wx/gtk/private.h" - -#include - #include "wx/graphics.h" +#include +#include "wx/gtk/private/gtk2-compat.h" + // ---------------------------------------------------------------------------- // wxNonOwnedWindowShapeImpl: base class for region and path-based classes. // ---------------------------------------------------------------------------- @@ -96,7 +95,7 @@ public: private: virtual bool DoSetShape(GdkWindow* window) { - gdk_window_shape_combine_mask(window, NULL, 0, 0); + gdk_window_shape_combine_region(window, NULL, 0, 0); return true; } @@ -176,7 +175,11 @@ private: dc.SetBackground(*wxBLACK); dc.Clear(); +#ifdef __WXGTK3__ + wxGraphicsContext* context = dc.GetGraphicsContext(); +#else wxScopedPtr context(wxGraphicsContext::Create(dc)); +#endif context->SetBrush(*wxWHITE); context->FillPath(path); @@ -185,11 +188,16 @@ private: virtual bool DoSetShape(GdkWindow *window) { - GdkBitmap* bitmap = m_mask.GetBitmap(); - if ( !bitmap ) + if (m_mask.GetBitmap() == NULL) return false; - gdk_window_shape_combine_mask(window, bitmap, 0, 0); +#ifdef __WXGTK3__ + cairo_region_t* region = gdk_cairo_region_create_from_surface(m_mask.GetBitmap()); + gdk_window_shape_combine_region(window, region, 0, 0); + cairo_region_destroy(region); +#else + gdk_window_shape_combine_mask(window, m_mask.GetBitmap(), 0, 0); +#endif return true; } @@ -200,7 +208,11 @@ private: event.Skip(); wxPaintDC dc(m_win); +#ifdef __WXGTK3__ + wxGraphicsContext* context = dc.GetGraphicsContext(); +#else wxScopedPtr context(wxGraphicsContext::Create(dc)); +#endif context->SetPen(wxPen(*wxLIGHT_GREY, 2)); context->StrokePath(m_path); }