redraw fix 1.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4605 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-07-11 15:09:45 +00:00
parent e3d52bd203
commit 61fc371093
5 changed files with 43 additions and 27 deletions

View 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();
}

View 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

View 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

View 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;

View 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;