On Thu, Dec 05, 2002 at 03:04:11PM +0000, Angus Leeming wrote:

> I'm very happy to use your approach, but would like to see the code so I can 
> compare/contrast ;-)

Here's the minimal bit. Note that it works fine with busy cursor simply
because of the fl_deactivate_all_forms() in prohibitInput - we never see
enter/leave events. This is still a hack, but it's xforms/ only, so
super.

(of course this means we must deal with unbalanced enter/leaves, I
think)

Still compiling, so ...

john

Index: XWorkArea.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XWorkArea.C,v
retrieving revision 1.27
diff -u -r1.27 XWorkArea.C
--- XWorkArea.C 27 Nov 2002 10:30:25 -0000      1.27
+++ XWorkArea.C 5 Dec 2002 14:58:54 -0000
@@ -311,6 +311,28 @@
        waitForX();
 }
 
+ 
+void XWorkArea::enter(bool entered)
+{
+       if (entered) {
+               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;
+               }
+
+               /// set the cursor to the watch for all forms and the canvas
+               XDefineCursor(fl_get_display(), getForm()->window, cursor);
+               XFlush(fl_get_display());
+       } else {
+               XUndefineCursor(fl_get_display(), getForm()->window);
+               XFlush(fl_get_display());
+       }
+}
+ 
 
 int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                                FL_Coord, FL_Coord,
@@ -512,9 +534,11 @@
 
        case FL_ENTER:
                lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
+               enter(true);
                break;
        case FL_LEAVE:
                lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
+               enter(false); 
                break;
        case FL_DBLCLICK:
                if (ev) {

-- 
"Yeah, I woke up in the day accidentally once, the moon was on fire for some
 reason and I couldn't see very well and all the bandwidth disappeared, it was
 very scary :("
        - Orion

Reply via email to