}
-// FIXME !
mouse_button::state x_button_state(unsigned int button)
{
mouse_button::state b = mouse_button::none;
}
-// FIXME
mouse_button::state x_motion_state(unsigned int state)
{
mouse_button::state b = mouse_button::none;
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: +"
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);
}
} // 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();
}
!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;
///
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);
/// 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;