1 #include "xorrectangle.h"
5 bool XORRectangle::initialised() const
10 void XORRectangle::lazy_init()
13 cr = gdk_cairo_create(gtk_widget_get_window(m_widget));
17 void XORRectangle::draw() const
19 #ifndef WORKAROUND_MACOS_GTK2_DESTROY
20 const int x = float_to_integer(m_rectangle.x);
21 const int y = float_to_integer(m_rectangle.y);
22 const int w = float_to_integer(m_rectangle.w);
23 const int h = float_to_integer(m_rectangle.h);
24 GtkAllocation allocation;
25 gtk_widget_get_allocation(m_widget, &allocation);
26 cairo_rectangle(cr, x, -(h) - (y - allocation.height), w, h);
27 cairo_set_source_rgb(cr, 1, 1, 1);
28 cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
33 XORRectangle::XORRectangle(ui::GLArea widget) : m_widget(widget), cr(0)
37 XORRectangle::~XORRectangle()
40 #ifndef WORKAROUND_MACOS_GTK2_DESTROY
46 void XORRectangle::set(rectangle_t rectangle)
48 if (gtk_widget_get_realized(m_widget)) {
51 m_rectangle = rectangle;