static void MotionNotifyEvent(object obj, MotionNotifyEventArgs args) { int x, y; Gdk.ModifierType state; Gdk.EventMotion ev = args.Event; Gdk.Window window = ev.Window; if (ev.IsHint) { Gdk.ModifierType s; window.GetPointer(out x, out y, out s); state = s; } else { x = (int)ev.X; y = (int)ev.Y; state = ev.State; } if ((state & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null) { DrawBrush(x, y, true); } else if ((state & Gdk.ModifierType.Button3Mask) != 0 && pixmap != null) { DrawBrush(x, y, false); } args.RetVal = true; }