* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
#include "config.h"
#include <stdio.h>
#include "gtk/gtk.h"
+#include <math.h>
/* Backing surface for drawing area */
static gint cursor_present = 0;
gint state = !gdk_device_get_has_cursor (current_device) && cursor_proximity;
+ x = floor (x);
+ y = floor (y);
+
if (surface != NULL)
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
draw_brush (GtkWidget *widget, GdkInputSource source,
gdouble x, gdouble y, gdouble pressure)
{
- GtkStyle *style;
- GdkColor color;
+ GdkRGBA color;
GdkRectangle update_rect;
cairo_t *cr;
- style = gtk_widget_get_style (widget);
+ color.alpha = 1.0;
switch (source)
{
case GDK_SOURCE_MOUSE:
- color = style->dark[gtk_widget_get_state (widget)];
+ color.red = color.green = 0.0;
+ color.blue = 1.0;
break;
case GDK_SOURCE_PEN:
- color.red = color.green = color.blue = 0;
+ color.red = color.green = color.blue = 0.0;
break;
case GDK_SOURCE_ERASER:
- color.red = color.green = color.blue = 65535;
+ color.red = color.green = color.blue = 1.0;
break;
default:
- color = style->light[gtk_widget_get_state (widget)];
+ color.red = color.blue = 0.0;
+ color.green = 1.0;
}
update_rect.x = x - 10 * pressure;
update_rect.height = 20 * pressure;
cr = cairo_create (surface);
- gdk_cairo_set_source_color (cr, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
gdk_cairo_rectangle (cr, &update_rect);
cairo_fill (cr);
cairo_destroy (cr);
current_device = event->device;
cursor_proximity = TRUE;
- if (event->button == 1 && surface != NULL)
+ if (event->button == GDK_BUTTON_PRIMARY &&
+ surface != NULL)
{
gdouble pressure = 0.5;