Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #24 from janopae/fix_tab_visual_glitch_on_high_dpi
Browse files Browse the repository at this point in the history
Fix tab visual glitch on high dpi
  • Loading branch information
limburgher authored Aug 15, 2022
2 parents 6782f8f + 42a5a77 commit e55d9d1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ def OnPaint(self, event):
dc.DrawRectangle(0, 0, w, h)

dc.SetPen(cfgGui.tabBorderPen)
dc.DrawLine(0,h-1,w,h-1)
separatorLineThickness = cfgGui.tabBorderPen.GetWidth()
dc.DrawLine(0,h-separatorLineThickness,w,h-separatorLineThickness)

xpos = self.paddingX

Expand All @@ -474,19 +475,25 @@ def OnPaint(self, event):
dc.SetFont(self.font)
p = self.pages[i]

dc.DestroyClippingRegion()
dc.SetClippingRegion(xpos, tabY, tabW, tabH)
dc.SetPen(cfgGui.tabBorderPen)

if i == self.selected:
points=((6,1),(tabW-8,1),(tabW-6,2),(tabW-2,tabH),(0,tabH),(4,2))
points=((0,tabH),(4,2),(6,1),(tabW-8,1),(tabW-6,2),(tabW-2,tabH))
dc.SetBrush(cfgGui.workspaceBrush)
else:
points=((5,2),(tabW-8,2),(tabW-6,3),(tabW-2,tabH-1),(0,tabH-1),(3,3))
points=((0,tabH-separatorLineThickness),(3,3),(5,2),(tabW-8,2),(tabW-6,3),(tabW-2,tabH-separatorLineThickness)) # subtract its thickness to not cover the separator line
dc.SetBrush(cfgGui.tabNonActiveBgBrush)

dc.DestroyClippingRegion()

# draw tab background
dc.SetClippingRegion(xpos, tabY, tabW, tabH)
dc.SetPen(wx.Pen(wx.NullPen))
dc.DrawPolygon(points,xpos,tabY)

# draw tab borders
dc.SetClippingRegion(xpos, tabY, tabW, tabH-separatorLineThickness) # tab borders should never cross the seperator line
dc.SetPen(cfgGui.tabBorderPen)
dc.DrawLines(points,xpos,tabY)

# clip the text to fit within the tabs
dc.DestroyClippingRegion()
dc.SetClippingRegion(xpos, tabY, tabW - self.paddingX * 3, tabH)
Expand Down

0 comments on commit e55d9d1

Please sign in to comment.