If your frame is made of wood you could plane the areas that keep the rest of the frame out from the wall. Or you can trim the wall.
I had this same problem installing oak trim around windows. The interior edge detail was sheetrock jambs meeting sheetrock walls with spackled beaded corners. I removed the metal corners. But, mostly due to use of green studs in construction, the trim would not lie flat against the wall. I dealt with it like so. I lightly marked (erasable) the boundary of the trim piece. Using a straight edge, I determined which areas were high. I then cut along the wall, along the edge of where the trim would fit, in the high regions. Using a Stanley Surform "rasp-plane", I carefully sanded away the high spots. I stayed away from the very edge with the Sureform, trimming it by hand with a chisel.
This worked very well for me. I suppose it depends on how much out of true your wall is. Also, in my case, the trim was about 5/8" thick so the difference in projecting out from the wall would be less noticeable than if your frame was only, say, 1/4" thick in projection. Needless to say, this is a rather permanent fix.