]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/xscreen.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / xscreen.C
index c917944ad308984a9eaad6845d9b22d6c895d4e2..826dae7635b5902a2960745b87e823fbe8519d9c 100644 (file)
@@ -6,33 +6,23 @@
  * \author unknown
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-
-#include <algorithm>
-#include <X11/Xlib.h>
-
-#include "frontends/screen.h"
-#include "frontends/font_metrics.h"
-#include "XWorkArea.h"
 #include "xscreen.h"
-#include "lyxtext.h"
-#include "lyxrow.h"
-#include "Painter.h"
-#include "WorkArea.h"
-#include "buffer.h"
-#include "BufferView.h"
-#include "insets/insettext.h"
+
 #include "ColorHandler.h"
-#include "language.h"
+#include "XWorkArea.h"
+
 #include "debug.h"
+#include "LColor.h"
 
 using std::endl;
-using std::max;
-using std::min;
+
+namespace lyx {
+namespace frontend {
 
 namespace {
 
@@ -69,6 +59,12 @@ XScreen::~XScreen()
 }
 
 
+WorkArea & XScreen::workarea() const
+{
+       return owner_;
+}
+
+
 void XScreen::setCursorColor()
 {
        if (!lyxColorHandler.get())
@@ -85,7 +81,7 @@ void XScreen::setCursorColor()
 
 void XScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
 {
-       // Update the cursor color. (a little slow dooing it like this ??)
+       // Update the cursor color. (a little slow doing it like this ??)
        setCursorColor();
 
        cursor_x_ = x;
@@ -159,26 +155,24 @@ void XScreen::removeCursor()
 
 void XScreen::expose(int x, int y, int w, int h)
 {
-       lyxerr[Debug::GUI] << "expose " << w << 'x' << h
+       lyxerr[Debug::GUI] << "XScreen::expose " << w << 'x' << h
                << '+' << x << '+' << y << endl;
-       XCopyArea(fl_get_display(),
-                 owner_.getPixmap(),
-                 owner_.getWin(),
-                 gc_copy,
-                 x, y, w, h,
-                 x + owner_.xpos(),
-                 y + owner_.ypos());
-}
-
 
-void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
-{
-       int const old_first = text->top_y();
-       text->top_y(y);
+       XEvent ev;
 
-       // make a dumb new-draw
-       drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0);
-       expose(0, 0, owner_.workWidth(), owner_.workHeight());
+       ev.type = Expose;
+       ev.xexpose.window = owner_.getWin();
+       // Adjust the x,y data so that XWorkArea can handle XEvents
+       // received from here in identical fashion to those it receives
+       // direct from X11.
+       ev.xexpose.x = owner_.xpos() + x;
+       ev.xexpose.y = owner_.ypos() + y;
+       ev.xexpose.width = w;
+       ev.xexpose.height = h;
+       ev.xexpose.count = 0;
 
-       XSync(fl_get_display(), 0);
+       XSendEvent(fl_get_display(), owner_.getWin(), False, 0, &ev);
 }
+
+} // namespace frontend
+} // namespace lyx