Playing on the side of safety this time ...

Please test this patch, it works fine for me

thanks
john

-- 
"I know I believe in nothing but it is my nothing"
        - Manic Street Preachers
? texput.log
? a.diff
? newfile1.lyx
? newfile2.lyx
? newfile3.tex
? a.tex
? a.lyx
? a.log
? a.dvi
? lyx_posix_wrappers.tar.bz2
? newfile3.lyx
? frontends/xforms/XWorkArea.new.C
? frontends/xforms/XWorkArea.new.h
? frontends/xforms/xscreen.new.C
? frontends/xforms/XWorkArea.bak.C
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.264
diff -u -r1.264 BufferView_pimpl.C
--- BufferView_pimpl.C  9 Jul 2002 16:19:14 -0000       1.264
+++ BufferView_pimpl.C  10 Jul 2002 01:33:42 -0000
@@ -929,8 +929,7 @@
                }
        }
 
-       // FIXME: GUII temporarily we always repaint for xforms' benefit 
-       if (1 || widthChange || heightChange) {
+       if (widthChange || heightChange) {
                repaint();
        }
 
Index: frontends/xforms/XWorkArea.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XWorkArea.C,v
retrieving revision 1.13
diff -u -r1.13 XWorkArea.C
--- frontends/xforms/XWorkArea.C        24 Jun 2002 20:28:10 -0000      1.13
+++ frontends/xforms/XWorkArea.C        10 Jul 2002 01:33:46 -0000
@@ -61,7 +61,6 @@
 }
 
 
-// FIXME !
 mouse_button::state x_button_state(unsigned int button)
 {
        mouse_button::state b = mouse_button::none;
@@ -88,7 +87,6 @@
 }
 
 
-// FIXME
 mouse_button::state x_motion_state(unsigned int state)
 {
        mouse_button::state b = mouse_button::none;
@@ -182,7 +180,7 @@
        int const bw = int(abs(fl_get_border_width()));
 
        // Create the workarea pixmap
-       createPixmap(w - 15 - 2 * bw, h - 2 * bw);
+       // FIXME remove redraw(w - 15 - 2 * bw, h - 2 * bw);
 
        if (lyxerr.debugging(Debug::WORKAREA))
                lyxerr << "\tfree object: +"
@@ -210,11 +208,18 @@
        fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_XWorkAreaEventCB);
 
        fl_unfreeze_all_forms();
+
+       XGCValues val;
+
+       val.function = GXcopy;
+       copy_gc = XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0),
+               GCFunction, &val);
 }
 
 
 XWorkArea::~XWorkArea()
 {
+       XFreeGC(fl_get_display(), copy_gc);
        if (workareapixmap)
                XFreePixmap(fl_get_display(), workareapixmap);
 }
@@ -235,31 +240,37 @@
 } // namespace anon
 
 
-void XWorkArea::createPixmap(int width, int height)
+void XWorkArea::redraw(int width, int height)
 {
        static int cur_width = -1;
        static int cur_height = -1;
 
-       if (cur_width == width && cur_height == height && workareapixmap)
+       if (cur_width == width && cur_height == height && workareapixmap) {
+               XCopyArea(fl_get_display(),
+                       getPixmap(), getWin(), copy_gc,
+                       0, 0, width, height, xpos(), ypos());
                return;
+       }
 
        cur_width = width;
        cur_height = height;
 
-       if (workareapixmap)
-               XFreePixmap(fl_get_display(), workareapixmap);
-
-       if (lyxerr.debugging(Debug::WORKAREA))
-               lyxerr << "Creating pixmap ("
+       if (lyxerr.debugging(Debug::WORKAREA)) {
+               lyxerr << "(Re)creating pixmap ("
                       << width << 'x' << height << ")" << endl;
+       }
+
+       if (workareapixmap) {
+               XFreePixmap(fl_get_display(), workareapixmap);
+       }
 
        workareapixmap = XCreatePixmap(fl_get_display(),
                                       RootWindow(fl_get_display(), 0),
                                       width,
                                       height,
                                       fl_get_visual_depth());
-       if (lyxerr.debugging(Debug::WORKAREA))
-               lyxerr << "\tpixmap=" << workareapixmap << endl;
+ 
+       workAreaResize();
 }
 
 
@@ -333,9 +344,7 @@
                    !area->work_area->form->visible)
                        return 1;
                lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
-               area->createPixmap(area->workWidth(), area->workHeight());
-               area->workAreaResize();
-               area->redraw();
+               area->redraw(area->workWidth(), area->workHeight());
                break;
        case FL_PUSH:
                if (!ev || ev->xbutton.button == 0) break;
Index: frontends/xforms/XWorkArea.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XWorkArea.h,v
retrieving revision 1.14
diff -u -r1.14 XWorkArea.h
--- frontends/xforms/XWorkArea.h        24 Jun 2002 20:28:10 -0000      1.14
+++ frontends/xforms/XWorkArea.h        10 Jul 2002 01:33:46 -0000
@@ -34,11 +34,6 @@
        ///
        virtual int workHeight() const { return work_area->h; }
        ///
-       virtual void redraw() const {
-               //fl_redraw_object(work_area);
-               //fl_redraw_object(scrollbar);
-       }
-       ///
        Window getWin() const { return work_area->form->window; }
        ///
        virtual void setScrollbarParams(int height, int pos, int line_height);
@@ -66,18 +61,22 @@
        /// handles SelectionRequest X Event, to fill the clipboard
        int event_cb(XEvent * xev);
 private:
-       ///
-       void createPixmap(int, int);
+       /// generate the pixmap, and copy backing pixmap to it,
+       /// and send resize event if needed
+       void redraw(int, int);
 
+       /// GC used for copying to the screen
+       GC copy_gc;
+ 
        ///
        FL_OBJECT * backgroundbox;
-       ///
+       /// the workarea free object
        FL_OBJECT * work_area;
-       ///
+       /// the scrollbar objcet
        FL_OBJECT * scrollbar;
        /// The pixmap overlay on the workarea
        Pixmap workareapixmap;
-       ///
+       /// the xforms-specific painter
        XPainter painter_;
        /// if we call redraw with true needed for locking-insets
        bool screen_cleared;

Reply via email to