Support cursor blinking

This commit is contained in:
Mark Hessling
2001-03-03 06:18:35 +00:00
parent 2232e57183
commit 36e358f2f8
3 changed files with 73 additions and 4 deletions

View File

@@ -754,6 +754,15 @@ XtResource app_resources[PDC_NUMBER_APP_RESOURCES] =
XtRImmediate,
(XtPointer)0,
},
{
XtNcursorBlinkRate,
XtCCursorBlinkRate,
XtRInt,
sizeof(int),
XtOffsetOf(AppData,cursorBlinkRate),
XtRImmediate,
(XtPointer)0,
},
#if 0
{
XtNgeometry,
@@ -781,6 +790,7 @@ XrmOptionDescRec options[PDC_NUMBER_OPTIONS] =
{"-scrollbarWidth", "*scrollbarWidth", XrmoptionSepArg, NULL },
{"-pointerForeColor", "*pointerForeColor", XrmoptionSepArg, NULL },
{"-pointerBackColor", "*pointerBackColor", XrmoptionSepArg, NULL },
{"-cursorBlinkRate", "*cursorBlinkRate", XrmoptionSepArg, NULL },
{"-cursorColor", "*cursorColor", XrmoptionSepArg, NULL },
{"-colorBlack", "*colorBlack", XrmoptionSepArg, NULL },
{"-colorRed", "*colorRed", XrmoptionSepArg, NULL },
@@ -1532,7 +1542,9 @@ Boolean *continue_to_dispatch;
#endif
/***********************************************************************/
{
#if 0
XClientMessageEvent *client_event=(XClientMessageEvent *)event;
#endif
#ifdef PDCDEBUG
if (trace_on) PDC_debug("%s:XCursesNonmaskable called: otherpid %d\n",(XCursesProcess)?" X":"CURSES",otherpid);
@@ -2606,6 +2618,47 @@ MOUSE_STATUS *ms;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void XCursesCursorBlink(Widget w, XtIntervalId *id)
#else
void XCursesCursorBlink(w, id)
Widget w;
XtIntervalId *id;
#endif
/***********************************************************************/
{
#ifdef PDCDEBUG
if (trace_on) PDC_debug("%s:XCursesCursorBlink() - called:\n",(XCursesProcess)?" X":"CURSES");
#endif
if ( windowEntered )
{
if ( visible_cursor )
{
/*
* Cursor currently ON, turn it off
*/
int save_visibility = SP->visibility;
SP->visibility = 0;
XCursesDisplayCursor(SP->cursrow,SP->curscol,
SP->cursrow,SP->curscol);
SP->visibility = save_visibility;
visible_cursor = 0;
}
else
{
/*
* Cursor currently OFF, turn it on
*/
XCursesDisplayCursor(SP->cursrow,SP->curscol,
SP->cursrow,SP->curscol);
visible_cursor = 1;
}
}
XtAppAddTimeOut( app_context, XCURSESCURSORBLINKRATE, XCursesCursorBlink, NULL );
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void XCursesButton(Widget w,XEvent *event, String *params, Cardinal *nparams)
#else
void XCursesButton(w,event,params,nparams)

View File

@@ -133,6 +133,9 @@
#define XtCScrollbarWidth "ScrollbarWidth"
#define XtNscrollbarWidth "scrollbarWidth"
#define XtCCursorBlinkRate "CursorBlinkRate"
#define XtNcursorBlinkRate "cursorBlinkRate"
#define XtCPointerForeColor "PointerForeColor"
#define XtNpointerForeColor "pointerForeColor"
#define XtCPointerBackColor "PointerBackColor"
@@ -213,6 +216,7 @@ typedef struct
int clickPeriod;
int doubleClickPeriod;
int scrollbarWidth;
int cursorBlinkRate;
#if 0
XtWidgetGeometry geometry;
#endif
@@ -235,6 +239,7 @@ AppData app_data;
#define XCURSESDOUBLECLICKPERIOD app_data.doubleClickPeriod
#define XCURSESCLICKPERIOD app_data.clickPeriod
#define XCURSESSCROLLBARWIDTH app_data.scrollbarWidth
#define XCURSESCURSORBLINKRATE app_data.cursorBlinkRate
#define XCURSESGEOMETRY app_data.geometry
#define XCURSESDISPLAY (XtDisplay(drawing))
@@ -243,8 +248,8 @@ AppData app_data;
#define MAX_COLORS 8 /* maximum of "normal" colours */
#define COLOR_CURSOR 16 /* colour of cursor - 1 more than 2*MAX_COLORS */
#define COLOR_BORDER 17 /* colour of border - 2 more than 2*MAX_COLORS */
#define PDC_NUMBER_APP_RESOURCES 32
#define PDC_NUMBER_OPTIONS 30
#define PDC_NUMBER_APP_RESOURCES 33
#define PDC_NUMBER_OPTIONS 31
#define PDC_NUMBER_XCURSES_ACTIONS 5
#include "x11.h"
@@ -283,9 +288,11 @@ extern Bool after_first_curses_request;
/* extern char *XCursesProgramName; */
extern int colors[(2*MAX_COLORS)+2];
extern int windowEntered;
extern int visible_cursor;
typedef RETSIGTYPE (*signal_handler)();
#ifdef PROTO
#ifdef HAVE_PROTO
void XCursesNonmaskable(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch);
void XCursesExpose(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch);
signal_handler XCursesSetSignal(int,signal_handler);
@@ -293,6 +300,7 @@ void XCursesGetIcon(void);
int XCursesRefreshScrollbar(void);
int XCursesSendKeyToCurses(unsigned long, MOUSE_STATUS *);
void XCursesButton(Widget,XEvent *,String *,Cardinal *);
void XCursesCursorBlink(Widget w, XtIntervalId *id);
void Scroll_up_down(Widget w, XtPointer client_data, XtPointer call_data);
void Scroll_left_right(Widget w, XtPointer client_data, XtPointer call_data);
void Thumb_up_down(Widget w, XtPointer client_data, XtPointer call_data);
@@ -305,6 +313,7 @@ void XCursesGetIcon();
int XCursesRefreshScrollbar();
int XCursesSendKeyToCurses();
void XCursesButton();
void XCursesCursorBlink();
void Scroll_up_down();
void Scroll_left_right();
void Thumb_up_down();

View File

@@ -23,7 +23,7 @@
#include "pdcx11.h"
static int visible_cursor=0;
int visible_cursor=0;
int windowEntered = 1;
static char *XCursesProgramName;
@@ -722,6 +722,13 @@ printf("Width %d Height %d\n",XCURSESGEOMETRY.width,XCURSESGEOMETRY.height);
* Add input handler from display_sock (requests from curses program)
*/
XtAppAddInput( app_context, display_sock, (XtPointer)XtInputReadMask, XCursesProcessRequestsFromCurses, NULL );
/*
* If there is a cursorBlink resource, start the Timeout event...
*/
if ( XCURSESCURSORBLINKRATE )
{
XtAppAddTimeOut( app_context, XCURSESCURSORBLINKRATE, XCursesCursorBlink, NULL );
}
/*
* Leave telling the curses process that it can start to here so that
* when the curses process makes a request, the Xcurses process can