diff --git a/x11/pdcdisp.c b/x11/pdcdisp.c index 56599258..d8118442 100644 --- a/x11/pdcdisp.c +++ b/x11/pdcdisp.c @@ -19,7 +19,7 @@ #include -RCSID("$Id: pdcdisp.c,v 1.28 2006/07/21 03:23:50 wmcbrine Exp $"); +RCSID("$Id: pdcdisp.c,v 1.29 2006/07/21 04:07:05 wmcbrine Exp $"); int PDC_display_cursor(int oldrow, int oldcol, int newrow, int newcol, int visibility) @@ -168,12 +168,7 @@ void PDC_transform_line(int lineno) dstp = curscr->_y[lineno] + x; len = endx - x + 1; - /* loop until we can write to the line */ - - while (*(Xcurscr + XCURSCR_FLAG_OFF + lineno)) - dummy_function(); - - *(Xcurscr + XCURSCR_FLAG_OFF + lineno) = 1; + get_line_lock(lineno); memcpy(Xcurscr + XCURSCR_Y_OFF(lineno) + (x * sizeof(chtype)), dstp, len * sizeof(chtype)); @@ -181,7 +176,7 @@ void PDC_transform_line(int lineno) *(Xcurscr + XCURSCR_START_OFF + lineno) = x; *(Xcurscr + XCURSCR_LENGTH_OFF + lineno) = len; - *(Xcurscr + XCURSCR_FLAG_OFF + lineno) = 0; + release_line_lock(lineno); curscr->_firstch[lineno] = _NO_CHANGE; curscr->_lastch[lineno] = _NO_CHANGE; diff --git a/x11/pdcx11.c b/x11/pdcx11.c index aa513c83..3fdbdbe8 100644 --- a/x11/pdcx11.c +++ b/x11/pdcx11.c @@ -20,7 +20,7 @@ #include #include -RCSID("$Id: pdcx11.c,v 1.76 2006/07/21 03:45:24 wmcbrine Exp $"); +RCSID("$Id: pdcx11.c,v 1.77 2006/07/21 04:07:05 wmcbrine Exp $"); AppData app_data; @@ -888,10 +888,6 @@ void XCsay(const char *msg) } #endif -void dummy_function(void) -{ -} - #ifdef PDC_WIDE static int to_utf8(char *outcode, int code) { @@ -1382,18 +1378,12 @@ static void XCursesDisplayScreen(void) for (row = 0; row < XCursesLINES; row++) { - /* loop until we can write to the line -- Patch by: - Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */ - - while (*(Xcurscr + XCURSCR_FLAG_OFF + row)) - dummy_function(); - - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; + get_line_lock(row); XCursesDisplayText((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row)), row, 0, COLS, FALSE); - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; + release_line_lock(row); } XCursesDisplayCursor(SP->cursrow, SP->curscol, SP->cursrow, @@ -2007,19 +1997,13 @@ void ShowSelection(int start_x, int start_y, int end_x, int end_y, row = start_y + i; } - /* loop until we can write to the line - Patch by: Georg - Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 */ - - while (*(Xcurscr + XCURSCR_FLAG_OFF + row)) - dummy_function(); - - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; + get_line_lock(row); XCursesDisplayText((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))), row, start_col, num_cols, highlight); - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; + release_line_lock(row); } } @@ -2212,13 +2196,7 @@ void SelectionSet(void) row = start_y + i; } - /* loop until we can write to the line -- Patch by: - Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */ - - while (*(Xcurscr + XCURSCR_FLAG_OFF + row)) - dummy_function(); - - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; + get_line_lock(row); ptr = (chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + start_col * sizeof(chtype)); @@ -2240,7 +2218,7 @@ void SelectionSet(void) for (j = 0; j <= last_nonblank; j++) tmpsel[num_chars++] = ptr[j]; - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; + release_line_lock(row); if (i < end_y - start_y) tmpsel[num_chars++] = '\n'; diff --git a/x11/pdcx11.h b/x11/pdcx11.h index 70e70a76..04dc4556 100644 --- a/x11/pdcx11.h +++ b/x11/pdcx11.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: pdcx11.h,v 1.41 2006/07/21 03:45:25 wmcbrine Exp $ */ +/* $Id: pdcx11.h,v 1.42 2006/07/21 04:07:05 wmcbrine Exp $ */ #define CURSES_LIBRARY 1 #ifdef HAVE_CONFIG_H @@ -277,7 +277,8 @@ extern AppData app_data; #endif #define PDC_NUMBER_XCURSES_ACTIONS 5 -void dummy_function(void); +void get_line_lock(int); +void release_line_lock(int); void get_GC(Display *, Window, GC *, XFontStruct *, int, int, bool); int get_colors(void); diff --git a/x11/process/x11.c b/x11/process/x11.c index 8a1e55c2..ed28b95c 100644 --- a/x11/process/x11.c +++ b/x11/process/x11.c @@ -19,7 +19,7 @@ #include -RCSID("$Id: x11.c,v 1.57 2006/07/21 03:45:25 wmcbrine Exp $"); +RCSID("$Id: x11.c,v 1.58 2006/07/21 04:07:05 wmcbrine Exp $"); int visible_cursor = 0; int windowEntered = 1; @@ -73,10 +73,7 @@ static int XCursesRefreshScreen(void) if (num_cols != 0) { - while (*(Xcurscr + XCURSCR_FLAG_OFF + row)) - dummy_function(); - - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; + get_line_lock(row); start_col = (int)*(Xcurscr + XCURSCR_START_OFF + row); @@ -85,8 +82,7 @@ static int XCursesRefreshScreen(void) sizeof(chtype))), row, start_col, num_cols, FALSE); - *(Xcurscr + XCURSCR_LENGTH_OFF + row) = 0; - *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; + release_line_lock(row); } } diff --git a/x11/process/x11common.c b/x11/process/x11common.c index 06d700bd..dc45e86f 100644 --- a/x11/process/x11common.c +++ b/x11/process/x11common.c @@ -17,7 +17,7 @@ #include "pdcx11.h" -RCSID("$Id: x11common.c,v 1.16 2006/07/02 07:08:28 wmcbrine Exp $"); +RCSID("$Id: x11common.c,v 1.17 2006/07/21 04:07:05 wmcbrine Exp $"); /* Variables specific to process port */ @@ -42,6 +42,26 @@ fd_set writefds; struct timeval socket_timeout; +static void dummy_function(void) +{ +} + +void get_line_lock(int row) +{ + /* loop until we can write to the line -- Patch by: + Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */ + + while (*(Xcurscr + XCURSCR_FLAG_OFF + row)) + dummy_function(); + + *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; +} + +void release_line_lock(int row) +{ + *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; +} + int write_socket(int sock_num, const char *buf, int len) { int start = 0, rc;