This patch moves the cursor stuff into WorkArea, gives us the correct cursor on exit from the WorkArea and gives me a nice blue cursor in the WorkArea.
Any objections if I apply it? (and strip the associated X11 stuff from BufferView::pimpl). Angus
Index: src/WorkArea.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/WorkArea.C,v retrieving revision 1.62 diff -u -p -r1.62 WorkArea.C --- src/WorkArea.C 28 Feb 2002 14:06:17 -0000 1.62 +++ src/WorkArea.C 12 Mar 2002 19:18:22 -0000 @@ -24,6 +24,7 @@ #include "lyxlookup.h" #endif +#include "frontends/Dialogs.h" // tooltipsEnabled #include "support/filetools.h" // LibFileSearch #include "support/lstrings.h" #include "support/LAssert.h" @@ -520,12 +521,18 @@ int WorkArea::work_area_handler(FL_OBJEC break; case FL_ENTER: lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl; - area->workAreaEnter(); + fl_set_cursor(FL_ObjWin(ob), XC_xterm); + // area->workAreaEnter(); break; case FL_LEAVE: + { lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl; - area->workAreaLeave(); + Cursor cursor = Dialogs::tooltipsEnabled() ? + XC_question_arrow : FL_DEFAULT_CURSOR; + fl_set_cursor(FL_ObjWin(ob), cursor); + // area->workAreaLeave(); break; + } case FL_DBLCLICK: if (!ev) break; lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl; Index: src/frontends/xforms/FormPreferences.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormPreferences.C,v retrieving revision 1.99 diff -u -p -r1.99 FormPreferences.C --- src/frontends/xforms/FormPreferences.C 12 Mar 2002 14:11:13 -0000 1.99 +++ src/frontends/xforms/FormPreferences.C 12 Mar 2002 19:18:27 -0000 @@ -425,10 +425,7 @@ void FormPreferences::Colors::apply() if (cit->colorID == GUI_COLOR_CURSOR) { fl_mapcolor(GUI_COLOR_CURSOR, cit->r, cit->g, cit->b); - fl_set_cursor_color(FL_DEFAULT_CURSOR, - GUI_COLOR_CURSOR, FL_WHITE); - fl_set_cursor_color(XC_question_arrow, - GUI_COLOR_CURSOR, FL_WHITE); + setCursorColor(GUI_COLOR_CURSOR); } } Dialogs::redrawGUI(); Index: src/frontends/xforms/Tooltips.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Tooltips.C,v retrieving revision 1.4 diff -u -p -r1.4 Tooltips.C --- src/frontends/xforms/Tooltips.C 11 Mar 2002 17:00:41 -0000 1.4 +++ src/frontends/xforms/Tooltips.C 12 Mar 2002 19:18:27 -0000 @@ -72,8 +72,10 @@ void Tooltips::toggleTooltips() // Set the cursor to a question mark or back to the default. FL_OBJECT * const ob = tooltipsMap.begin()->first; - int const cursor = enabled_ ? XC_question_arrow : FL_DEFAULT_CURSOR; - fl_set_cursor(FL_ObjWin(ob), cursor); + Cursor const cursor = enabled_ ? XC_question_arrow : FL_DEFAULT_CURSOR; + Window win = FL_ObjWin(ob); + if (win) + fl_set_cursor(win, cursor); } Index: src/frontends/xforms/xforms_helpers.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.C,v retrieving revision 1.35 diff -u -p -r1.35 xforms_helpers.C --- src/frontends/xforms/xforms_helpers.C 11 Mar 2002 17:00:41 -0000 1.35 +++ src/frontends/xforms/xforms_helpers.C 12 Mar 2002 19:18:27 -0000 @@ -19,13 +19,13 @@ #include "xforms_helpers.h" #include "lyxlex.h" -#include "support/FileInfo.h" -#include "support/filetools.h" -#include "support/lstrings.h" // frontStrip, strip #include "gettext.h" -#include "support/LAssert.h" #include "lyxlength.h" #include "lyxgluelength.h" +#include "support/LAssert.h" +#include "support/FileInfo.h" +#include "support/filetools.h" +#include "support/lstrings.h" // frontStrip, strip using std::ofstream; using std::pair; @@ -364,6 +364,15 @@ string formatted(string const & sin, int } +void setCursorColor(int color) +{ + fl_set_cursor_color(FL_DEFAULT_CURSOR, color, FL_WHITE); + fl_set_cursor_color(XC_question_arrow, color, FL_WHITE); + fl_set_cursor_color(XC_xterm, color, FL_WHITE); + fl_set_cursor_color(XC_watch, color, FL_WHITE); +} + + namespace { // sorted by hand to prevent LyXLex from complaining on read(). @@ -420,10 +429,7 @@ bool XformsColor::read(string const & fi fl_mapcolor(le, col.r, col.g, col.b); if (tag == "\\gui_pointer") { - fl_set_cursor_color(FL_DEFAULT_CURSOR, - FL_FREE_COL16, FL_WHITE); - fl_set_cursor_color(XC_question_arrow, - FL_FREE_COL16, FL_WHITE); + setCursorColor(FL_FREE_COL16); } } Index: src/frontends/xforms/xforms_helpers.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.h,v retrieving revision 1.19 diff -u -p -r1.19 xforms_helpers.h --- src/frontends/xforms/xforms_helpers.h 11 Mar 2002 17:00:41 -0000 1.19 +++ src/frontends/xforms/xforms_helpers.h 12 Mar 2002 19:18:27 -0000 @@ -81,6 +81,11 @@ void updateWidgetsFromLength(FL_OBJECT * LyXLength const & len, string const & default_unit); + +/// Called from Preferences when the cursor color is changed. +void setCursorColor(int color); + + /// struct holding xform-specific colors struct XformsColor : public NamedColor { int colorID;