Opened 10 months ago

Last modified 10 months ago

#18592 new defect

SetTransparent gtk3

Reported by: dgud Owned by:
Priority: normal Milestone:
Component: wxGTK Version: 3.1.3
Keywords: Cc: dgud@…
Blocked By: Blocking:
Patch: no


wxFrame::setTransparent does NOT work without SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); as it does on the other platforms.

It should either be fixed or documented that GTK-3 works differently.

From what I can see 3.0.4 with gtk-2 works, 3.0.4 with gtk-3 do not work. I have not tested 3.1.3 with gtk-2.

Also the sample doesn't work as intended on GTK-3, removing

Shows a color palette, and the original sample code does not show that
at all for me (ubuntu-18.04)

Also doubleclicking the original sample, asserts.

diff --git a/samples/shaped/shaped.cpp b/samples/shaped/shaped.cpp
index 25c6b6e83c..c91dc042cd 100644
--- a/samples/shaped/shaped.cpp
+++ b/samples/shaped/shaped.cpp
@@ -481,13 +481,14 @@ wxEND_EVENT_TABLE()
 void SeeThroughFrame::Create()
-    SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
+  // SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
     wxFrame::Create(NULL, wxID_ANY, "Transparency test: double click here",
            wxPoint(100, 30), wxSize(300, 300),
            wxDEFAULT_FRAME_STYLE |
            wxFULL_REPAINT_ON_RESIZE |
+    SetTransparent(127);
 // Paints a grid of varying hue and alpha

Change History (1)

comment:1 Changed 10 months ago by dgud

  • Cc dgud@… added

Hmm using SetTransparent() with SetBackgroundStyle(wxBG_STYLE_TRANSPARENT)
creates a transparent window but no children in that window can be seen
as in the other platforms and with gtk2.

Note: See TracTickets for help on using tickets.