Make wxSashWindow resizing work with wxGTK3 with X11
Apply similar changes as to wxSplitterWindow to make the existing wxINVERT-based code work at least in this case, i.e. 1. Don't use wxScreenDC with wxGTK3 (although this is more involved in this case, as we can't just use wxClientDC for this window itself). 2. Use white brush so that wxCOMPOSITION_DIFF works as wxINVERT.
This commit is contained in:
parent
946baf7884
commit
f4cdb30646
@ -545,7 +545,6 @@ void wxSashWindow::DrawSashTracker(wxSashEdgePosition edge, int x, int y)
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
|
||||
wxScreenDC screenDC;
|
||||
int x1, y1;
|
||||
int x2, y2;
|
||||
|
||||
@ -583,18 +582,34 @@ void wxSashWindow::DrawSashTracker(wxSashEdgePosition edge, int x, int y)
|
||||
ClientToScreen(&x1, &y1);
|
||||
ClientToScreen(&x2, &y2);
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
// We need to draw over the parent window, not this one, as we want to
|
||||
// allow the sash go outside of this window.
|
||||
wxWindow* const parent = wxGetTopLevelParent(this);
|
||||
if ( !parent )
|
||||
return;
|
||||
|
||||
wxClientDC dc(parent);
|
||||
parent->ScreenToClient(&x1, &y1);
|
||||
parent->ScreenToClient(&x2, &y2);
|
||||
|
||||
// In the ports with wxGraphicsContext-based wxDC, wxINVERT only works for
|
||||
// inverting the background when using white foreground (note that this
|
||||
// code is not going to work anyhow with wxOSX nor with wxGTK when using
|
||||
// Wayland, as drawing using wxClientDC doesn't work at all there), but
|
||||
// this at least makes it work with wxGTK with X11.
|
||||
wxPen sashTrackerPen(*wxWHITE, 2, wxPENSTYLE_SOLID);
|
||||
#else
|
||||
wxScreenDC dc;
|
||||
|
||||
wxPen sashTrackerPen(*wxBLACK, 2, wxPENSTYLE_SOLID);
|
||||
#endif
|
||||
|
||||
screenDC.SetLogicalFunction(wxINVERT);
|
||||
screenDC.SetPen(sashTrackerPen);
|
||||
screenDC.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.SetLogicalFunction(wxINVERT);
|
||||
dc.SetPen(sashTrackerPen);
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
|
||||
screenDC.DrawLine(x1, y1, x2, y2);
|
||||
|
||||
screenDC.SetLogicalFunction(wxCOPY);
|
||||
|
||||
screenDC.SetPen(wxNullPen);
|
||||
screenDC.SetBrush(wxNullBrush);
|
||||
dc.DrawLine(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
// Position and size subwindows.
|
||||
|
Loading…
Reference in New Issue
Block a user