Skip to content

Commit

Permalink
Fix invisible cairo caret issue.
Browse files Browse the repository at this point in the history
Do more check of Cairo context before using it.

https://code.google.com/p/pcmanx-gtk2/issues/detail?id=68
  • Loading branch information
fourdollars committed Nov 18, 2014
1 parent 3fb419f commit fd5d6ab
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/core/caret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,17 @@ void CCaret::DrawInverse()

if (m_Cairo == NULL) {
m_Cairo = gdk_cairo_create(m_pParent->window);
if (cairo_status(m_Cairo) != CAIRO_STATUS_SUCCESS) {
cairo_destroy(m_Cairo);
m_Cairo = NULL;
}
}

if (m_Cairo) {
cairo_set_source_rgb(m_Cairo, 1, 1, 1);
cairo_set_operator(m_Cairo, CAIRO_OPERATOR_DIFFERENCE);
cairo_rectangle(m_Cairo, m_Pos.x, m_Pos.y, m_Width, m_Height);
cairo_fill(m_Cairo);
}
cairo_set_source_rgb(m_Cairo, 1, 1, 1);
cairo_set_operator(m_Cairo, CAIRO_OPERATOR_DIFFERENCE);
cairo_rectangle(m_Cairo, m_Pos.x, m_Pos.y, m_Width, m_Height);
cairo_fill(m_Cairo);
}

0 comments on commit fd5d6ab

Please sign in to comment.