I guess that this is for Lars:

Without being rude, why the hell is this code in BufferView::Pimpl and not in 
WorkArea:

void SetXtermCursor(Window win)
{
        static Cursor cursor;
        static bool cursor_undefined = true;
        if (cursor_undefined) {
                cursor = XCreateFontCursor(fl_get_display(), XC_xterm);
                XFlush(fl_get_display());
                cursor_undefined = false;
        }
        XDefineCursor(fl_get_display(), win, cursor);
        XFlush(fl_get_display());
}

void BufferView::Pimpl::enterView()
{
        if (active() && available()) {
                SetXtermCursor(workarea_.getWin());
                using_xterm_cursor = true;
        }
}

void BufferView::Pimpl::leaveView()
{
        if (using_xterm_cursor) {
                XUndefineCursor(fl_get_display(), workarea_.getWin());
                using_xterm_cursor = false;
        }
}


In WorkArea it would be:

        case FL_ENTER:
                lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
                fl_set_cursor(workarea_.getWin(), XC_xterm);
                //area->workAreaEnter();
                break;
        case FL_LEAVE:
                lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
                Cursor cursor = Dialogs::tooltipsEnabled() ? 
                        XC_question_arrow : FL_DEFAULT_CURSOR;
                fl_set_cursor(workarea_.getWin(), cached_cursor);
                //area->workAreaLeave();
                break;

Lars, would you be happy if I changed this? I can't see the reason for the 
current code; it just seems unnecessarily complex.

Alternatively, if you insist on the BufferView::Pimpl::enterView() and 
leaveView(), can we please have a WorkArea method
        void setCursor(Cursor cursor) {
                fl_set_cursor(workarea_.getWin(), cursor);
        }

But really, this X11 stuff shouldn't be in BufferView IMO.

Angus

Reply via email to