GTK3, wxSearchCtrl border size/offset in toolbar

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
bblough
In need of some credit
In need of some credit
Posts: 3
Joined: Sat Oct 05, 2019 4:42 pm

GTK3, wxSearchCtrl border size/offset in toolbar

Post by bblough » Sat Oct 05, 2019 6:15 pm

Hi,

I'm seeing an issue where the border for wxSearchCtrl is either the wrong size and/or is offset when the control is added to a toolbar. This is using wx 3.0.4 with gcc8 on Debian Linux. It has also been reproduced on Fedora, though I don't know what versions are in use there.

I've reproduced this with a minimal implementation (see test.diff for patch against the "minimal" sample) and it only seems to occur when using GTK3 (see srchctrl_gtk3.png), not GTK2 (see srchctrl_gtk2.png). However, the effect is less pronounced in the test implementation than it is in the actual application (see app_gtk3.png).

I don't have much experience with wxWidgets, so I'm sure I could easily be doing something wrong and/or missing something. Though, the fact that it works with GTK2 makes me wonder if it might be a bug (which I'd be happy to file in trac if that is the case).

Can anyone shed light on what I'm seeing? Is it something I'm doing wrong, or is it a bug?

Thanks!
Attachments
app_gtk3.png
app_gtk3.png (5.37 KiB) Viewed 198 times
srchctrl_gtk3.png
srchctrl_gtk3.png (10.94 KiB) Viewed 198 times
srchctrl_gtk2.png
srchctrl_gtk2.png (9.77 KiB) Viewed 198 times

bblough
In need of some credit
In need of some credit
Posts: 3
Joined: Sat Oct 05, 2019 4:42 pm

Re: GTK3, wxSearchCtrl border size/offset in toolbar

Post by bblough » Sat Oct 05, 2019 8:16 pm

Looks like the source diff didn't attach. Let's try again...
Attachments
test.diff
(958 Bytes) Downloaded 4 times

DavidHart
Site Admin
Site Admin
Posts: 3896
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: GTK3, wxSearchCtrl border size/offset in toolbar

Post by DavidHart » Sat Oct 05, 2019 8:37 pm

Hi,

It's very likely to be a gtk+3 bug; there've been a lot of them. I just tested your minimal diff on a gtk+3 build of git HEAD and get the same result as you.

It seems to be toolbar-specific: the same code added to a sizer in the normal way behaved as expected.

Code: Select all

 wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    auto srchCtrl2 = new wxSearchCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
    srchCtrl2->ShowCancelButton(true);
    srchCtrl2->ShowSearchButton(true);

    sizer->Add(srchCtrl2, wxSizerFlags().Center());
    SetSizer(sizer);
A search of wxTrac didn't reveal a previous bug-report so, yes, please report it.

Regards,

David

bblough
In need of some credit
In need of some credit
Posts: 3
Joined: Sat Oct 05, 2019 4:42 pm

Re: GTK3, wxSearchCtrl border size/offset in toolbar

Post by bblough » Sat Oct 05, 2019 11:58 pm

Thanks, David!

I've opened a new ticket here: https://trac.wxwidgets.org/ticket/18522

Post Reply