Problems with wxWidgets under wayland

14 views
Skip to first unread message

Jouk Jansen

unread,
Jan 15, 2026, 3:58:30 AM (21 hours ago) Jan 15
to WX-U...@googlegroups.com
Hi all,

When I try to run a program, that works fine under
Xorg, DecWindows & Msoftwindows, using wayland I do not see everything
displayed on the screen. Below is an example of the problem code. I try to
catch mouse-movements and write the coordinates (note that actually filling
"text" is omitted in the example) to the screen. When using wayland
everyting that is assigned to the dc (wxClientDC) is not visible. I tried to
"this->Refresh()" on the canvas, but that did not help. What am I missing?
And why is this a problem only when using wayland?


I use wxGTK 3.2.8 on a Fedora 43 system.


Code example :

void wxecanvas::OnMouse(wxMouseEvent& event )
{
wxPoint pos = event.GetPosition();
wxClientDC dc( this );

printf( "Mouse position : %d %d\n" , pos.x , pos.y );
if ( event.Moving() | event.Dragging() )
{
char* text;

printf( "Moving event\n" );
text = (char*) malloc( 30 );
// clear area and write text
// colour is defined in main()
dc.SetLogicalFunction( wxCOPY );
dc.SetPen( wxPen( colour , 1 , wxTRANSPARENT ) );
dc.SetBrush( wxBrush( colour , wxSOLID ) );
dc.DrawRectangle( 790 , 590 , 225 , 50 );
dc.SetTextForeground( wxColour( "RED" ) );
dc.DrawText( text , 800 , 600 );
dc.SetTextForeground( wxColour( "BLACK" ) );
dc.SetPen( wxPen( "BLACK" , 1 , wxSOLID ) );
free( text );
}
}



Kind regards
Jouk


Pax, vel iniusta, utilior est quam iustissimum bellum.
(free after Marcus Tullius Cicero (106 b.Chr.-46 b.Chr.)
Epistularum ad Atticum 7.1.4.3)


Touch not the cat bot a glove

>------------------------------------------------------------------------------<

Jouk Jansen

jo...@hrem.nano.tudelft.nl

Technische Universiteit Delft tttttttttt uu uu ddddddd
Kavli Institute of Nanoscience tttttttttt uu uu dd dd
Nationaal centrum voor HREM tt uu uu dd dd
Lorentzweg 1 tt uu uu dd dd
2628 CJ Delft tt uu uu dd dd
Nederland tt uu uu dd dd
tel. +31-15-2782272 tt uuuuuuu ddddddd

>------------------------------------------------------------------------------<

Vadim Zeitlin

unread,
Jan 15, 2026, 6:35:09 AM (19 hours ago) Jan 15
to WX-U...@googlegroups.com
On Thu, 15 Jan 2026 09:54:36 +0100 (CET) 'Jouk Jansen' via wx-users wrote:

JJ> When I try to run a program, that works fine under
JJ> Xorg, DecWindows & Msoftwindows, using wayland I do not see everything
JJ> displayed on the screen. Below is an example of the problem code. I try to
JJ> catch mouse-movements and write the coordinates (note that actually filling
JJ> "text" is omitted in the example) to the screen. When using wayland
JJ> everyting that is assigned to the dc (wxClientDC) is not visible. I tried to
JJ> "this->Refresh()" on the canvas, but that did not help. What am I missing?
JJ> And why is this a problem only when using wayland?

There is a big and very prominent note on

https://docs.wxwidgets.org/latest/classwx_client_d_c.html

explaining this.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages