I've just noticed this regression from the 1.2 series, although I suspect 
things changed quite some time ago.

I once prepared a patch for the 1.2 series that used xforms to change the 
cursor as one entered/left the work area. It did not change LyX's 
functionality but does illustrate clearly what happens in the 1.2 series. The 
cursor changes to XC_xterm as we enter the BufferView and reverts to an arrow 
pointing to 10 o'clock as we leave it.

 void BufferView::Pimpl::enterView()
 {
        if (active() && available()) {
-               SetXtermCursor(workarea_.getWin());
+               fl_set_cursor(workarea_.getWin(), XC_xterm);
                using_xterm_cursor = true;
        }
 }
@@ -835,7 +821,7 @@
 void BufferView::Pimpl::leaveView()
 {
        if (using_xterm_cursor) {
-               XUndefineCursor(fl_get_display(), workarea_.getWin());
+               fl_set_cursor(workarea_.getWin(), FL_DEFAULT_CURSOR);
                using_xterm_cursor = false;
        }
 }

In current cvs the cursor is /always/ an arrow. XC_xterm has disappeared. I 
guess that the fundamental reason is that XWorkArea's handler reacts to these 
events so:

        case FL_ENTER:
                lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
                break;
        case FL_LEAVE:
                lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
                break;

I guess that we need new LFUN_MOUSE_ENTER and LFUN_MOUSE_LEAVE lfuns 
so that dispatch can tell the LyXView to change the cursor. Given that we 
also use XC_watch (XFormsView::prohibitInput()), I guess that XFormsView 
should gain a new method setCursor() and be modified so:

class XFormsView {
        bool input_prohibited_;
        bool editing_;
public:
        virtual void setCursor(bool editting) 
        {
                editing_ = editing;
                if (input_prohibited_)
                        return;
                int const cursor = editing ? XC_xterm : FL_DEFAULT_CURSOR;
                fl_set_cursor(workarea_.getWin(), cursor);
        }
        virtual void XFormsView::prohibitInput() const
        {
                input_prohibited_ = true;
                fl_set_cursor(workarea_.getWin(), XC_watch);
                XFlush(fl_get_display());
                fl_deactivate_all_forms();
        }
        virtual void XFormsView::allowInput() const 
        {
                input_prohibited_ = false;
                int const cursor = editing ? XC_xterm : FL_DEFAULT_CURSOR;
                fl_set_cursor(workarea_.getWin(), cursor);
                XFlush(fl_get_display());
                fl_activate_all_forms();
        }
};

Shall I prepare a patch for 1.3?
Angus

Reply via email to