- lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
- area->redraw(area->workWidth(), area->workHeight());
+
+ if (ev) {
+ lyxerr[Debug::WORKAREA]
+ << "work_area_handler, handling X11 "
+ "expose event "
+ << ev->xexpose.width << 'x'
+ << ev->xexpose.height << '+'
+ << ev->xexpose.x << '+'
+ << ev->xexpose.y << endl;
+
+ // X11 generates XEvents with x, y relative to the
+ // top left corner of the window.
+ // XScreen::expose emulates this behaviour.
+ // We therefore need to remove this offset before
+ // generating the pixmap.
+ int const x = ev->xexpose.x - ob->x;
+ int const y = ev->xexpose.y - ob->y;
+
+ area->paint(x, y,
+ ev->xexpose.width, ev->xexpose.height);
+ } else
+ area->paint(0, 0,
+ area->workWidth(), area->workHeight());
+