]> git.lyx.org Git - features.git/commitdiff
redraw fix 1.
authorJohn Levon <levon@movementarian.org>
Thu, 11 Jul 2002 15:09:45 +0000 (15:09 +0000)
committerJohn Levon <levon@movementarian.org>
Thu, 11 Jul 2002 15:09:45 +0000 (15:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4605 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/frontends/xforms/ChangeLog
src/frontends/xforms/XWorkArea.C
src/frontends/xforms/XWorkArea.h

index 95bf55f1d74987f89ffbc2959024fda5943eb522..f2a70a68db3e8ef36a40172cfbb3992a9dc13701 100644 (file)
@@ -929,8 +929,7 @@ void BufferView::Pimpl::workAreaResize()
                }
        }
 
-       // FIXME: GUII temporarily we always repaint for xforms' benefit 
-       if (1 || widthChange || heightChange) {
+       if (widthChange || heightChange) {
                repaint();
        }
 
index 0d826b97c3f8bac31bd0cd8a4f20303d610fe862..134668eb67699c32b5c6e587dce1c507f8ea4809 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-11  John Levon  <moz@compsoc.man.ac.uk>
+
+       * BufferView_pimpl.C: remove unneeded extra repaint()
 2002-07-10  John Levon  <moz@compsoc.man.ac.uk>
 
        * LyXAction.C: allow command-sequence with NoBuffer
index 06af1bf7d7fa2bca532c4aee8a3315a14ecf388a..c5656a15b8619d6d920d9692b0d7b6a42dd23f76 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-11  John Levon  <moz@compsoc.man.ac.uk>
+
+       * XWorkArea.h:
+       * XWorkArea.C: do a copy area on redraw when no geometry change
 2002-07-11  Herbert Voss  <voss@perce.de>
  
        * FormGraphics.C (input): test also the height for %-value, when
index 346804759561f2ce62e741a8a7ab48e07294e0aa..b11948732f8ac73433bea783fdabc004b5d63b08 100644 (file)
@@ -61,7 +61,6 @@ void setXtermCursor(Window win)
 }
 
 
-// FIXME !
 mouse_button::state x_button_state(unsigned int button)
 {
        mouse_button::state b = mouse_button::none;
@@ -88,7 +87,6 @@ mouse_button::state x_button_state(unsigned int button)
 }
 
 
-// FIXME
 mouse_button::state x_motion_state(unsigned int state)
 {
        mouse_button::state b = mouse_button::none;
@@ -182,7 +180,7 @@ XWorkArea::XWorkArea(int x, int y, int w, int h)
        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 @@ XWorkArea::XWorkArea(int x, int y, int w, int h)
        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 @@ void destroy_object(FL_OBJECT * obj)
 } // 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 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                    !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 0b9ba2e6f6c3f5b11f26a25b32a59482d7e4decb..b8a095a5bf486dcc5b6b93eb27f7dfa530648a62 100644 (file)
@@ -34,11 +34,6 @@ public:
        ///
        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 @@ public:
        /// 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;