Skip to content

Commit

Permalink
Fix some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Mar 12, 2024
1 parent 01638fa commit 112fc2b
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/Widgets/DrawingArea.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,20 @@ public class Wacom.Widgets.DrawingArea : Gtk.DrawingArea {
add_controller (stylus_gesture);
}

public override void size_allocate (Gtk.Allocation alloc) {
ensure_drawing_surface (alloc.width, alloc.height);
base.size_allocate (alloc);
public override void size_allocate (int width, int height, int baseline) {
ensure_drawing_surface (width, height);
base.size_allocate (width, height, baseline);
}

public override void map () {
base.map ();

Gtk.Allocation allocation;
get_allocation (out allocation);

ensure_drawing_surface (allocation.width, allocation.height);
ensure_drawing_surface (get_width (), get_height ());
set_draw_func (draw_func);
}

public void clear () {
Gtk.Allocation allocation;
get_allocation (out allocation);

ensure_drawing_surface (allocation.width, allocation.height, true);
ensure_drawing_surface (get_width (), get_height (), true);
}

private void ensure_drawing_surface (int width, int height, bool force = false) {
Expand All @@ -53,23 +48,18 @@ public class Wacom.Widgets.DrawingArea : Gtk.DrawingArea {
}
}

public override bool draw (Cairo.Context cr) {
Gtk.Allocation alloc;

get_allocation (out alloc);
private void draw_func (Gtk.DrawingArea drawing_area, Cairo.Context cr, int width, int height) {
cr.set_source_rgb (1, 1, 1);
cr.paint ();

cr.set_source_surface (surface, 0, 0);
cr.paint ();

return false;
}

private void on_motion (double object, double p0) {
double x, y, pressure;

Gtk.get_current_event ().get_coords (out x, out y);
// Gtk.get_current_event ().get_coords (out x, out y);
stylus_gesture.get_axis (PRESSURE, out pressure);

var tool_type = stylus_gesture.get_device_tool ().get_tool_type ();
Expand Down

0 comments on commit 112fc2b

Please sign in to comment.