The attached changes fix flickering xwidgets by moving xwidget display into a separate X window, and also enable the scrolling optimization for xwidgets. Someone with access to a Mac will have to do the changes necessary for xwidget scrolling to work correctly on macOS, as they don't work on GNUstep in the first place. However, event passthrough doesn't work yet, and will require some thought. But that would be a fantastic opportunity to clean up the current xwidget event handling mess (and perhaps even define a mechanism for Lisp code to send events into xwidgets, which would make integrating them into the existing Emacs event model much easier.) Any thoughts? Thanks.