XView Version 3.2 Patch-01 To apply this patch: cd to the top of the xview3.2 source hierarchy (the directory containing the "lib", "config", "clients" subdirectories) and do: patch -p -s < thisFile Brief descriptions of problems fixed: XView: file chooser goto field should not expand links Copy and Paste does not work with R5 *** original29105/lib/libxview/file_chooser/path.c Mon Jun 28 22:17:56 1993 --- lib/libxview/file_chooser/path.c Tue Jun 29 00:38:50 1993 *************** *** 1,13 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)path.c 1.17 93/06/28"; #endif #endif /* ! * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents ! * pending in the U.S. and foreign countries. See LEGAL_NOTICE ! * file for terms of the license. */ --- 1,13 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)path.c 1.18 93/06/29"; #endif #endif /* ! * (c) Copyright 1992, 1993 Sun Microsystems, Inc. Sun design patents ! * pending in the U.S. and foreign countries. See LEGAL_NOTICE file ! * for terms of the license. */ *************** *** 18,23 **** --- 18,24 ---- #include #include #include + #include Pkg_private Panel_setting xv_path_name_notify_proc(); *************** *** 26,31 **** --- 27,33 ---- /* * xv_create() method */ + /* ARGSUSED */ Pkg_private int path_init_avlist ( owner, public, avlist ) Xv_opaque owner; *************** *** 44,49 **** --- 46,52 ---- if ( !path_avlist ) path_avlist = attr_create_list( PANEL_NOTIFY_PROC, xv_path_name_notify_proc, + PANEL_VALUE_STORED_LENGTH, MAXPATHLEN+1, PANEL_PAINT, PANEL_NONE, NULL ); /* *************** *** 157,162 **** --- 160,166 ---- /* * xv_get() method */ + /* ARGSUSED */ Pkg_private Xv_opaque path_get_attr ( public, status, attr, args ) Path_public *public; *************** *** 260,265 **** --- 264,270 ---- char *path = (char *)xv_get(item, PANEL_VALUE); char *full_path; char *buf; + char path_buf[MAXPATHLEN+1]; /* *************** *** 314,350 **** xv_free( buf ); ! #ifdef SVR4 ! { ! char path_buf[MAXPATHLEN+1]; ! ! /* deal with "../.." types of things */ ! if ( realpath(full_path, path_buf) ) { ! full_path = xv_strcpy(full_path, path_buf); ! } else { ! xv_error_sprintf( private->frame, private->use_frame, ! XV_MSG("The folder name \"%s\" does not exist."), ! path ! ); ! xv_free_ref( full_path ); ! private->notify_status = XV_ERROR; ! return PANEL_NONE; ! } ! } ! #else ! /* ! * BUG: *Should* do an xv_realpath() if time permits... ! */ ! if ( strstr(full_path, "..") ) { ! xv_error_sprintf( private->frame, ! private->use_frame, ! XV_MSG("Invalid path \"%s\"."), path ); private->notify_status = XV_ERROR; return PANEL_NONE; } - #endif /* SVR4 */ --- 319,336 ---- xv_free( buf ); ! /* deal with "../." types of things */ ! if ( xv_realpath(full_path, path_buf) ) { ! full_path = xv_strcpy(full_path, path_buf); ! } else { ! xv_error_sprintf( private->frame, private->use_frame, ! XV_MSG("The folder name \"%s\" does not exist."), path ); + xv_free_ref( full_path ); private->notify_status = XV_ERROR; return PANEL_NONE; } *** original29105/lib/libxview/file_chooser/xv_path_util.c Mon Jun 28 22:17:58 1993 --- lib/libxview/file_chooser/xv_path_util.c Tue Jun 29 00:38:50 1993 *************** *** 1,17 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)xv_path_util.c 1.5 93/06/28"; #endif #endif /* ! * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents ! * pending in the U.S. and foreign countries. See LEGAL_NOTICE ! * file for terms of the license. */ #include #include #include #include #include --- 1,19 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)xv_path_util.c 1.6 93/06/29"; #endif #endif /* ! * (c) Copyright 1992, 1993 Sun Microsystems, Inc. Sun design patents ! * pending in the U.S. and foreign countries. See LEGAL_NOTICE file ! * for terms of the license. */ + #include #include #include + #include #include #include #include *************** *** 23,30 **** --- 25,34 ---- */ + extern void expand_path(); + Pkg_private void #ifdef ANSI_FUNC_PROTO xv_error_sprintf( Frame frame, int use_footer, char *format, ... ) *************** *** 37,43 **** #endif { char buf[MAX_MSG_SIZE]; - AVLIST_DECL; va_list list; VA_START(list, format); --- 41,46 ---- *************** *** 253,255 **** --- 256,313 ---- return xv_strcpy(NULL, buf); } /* xv_expand_path() */ + + + + + /* + * similar to realpath(3), except that it: + * ASSumes full path name. + * does *not* expand links. + */ + char * + xv_realpath( file_name, resolved_name ) + char *file_name; + char *resolved_name; + { + extern char * xv_strtok(); + char *tok; + + if ( !file_name || !resolved_name ) + return (char *)NULL; + + /* intialize resolved_path */ + resolved_name[0] = '\0'; + + + /* easy case: check for "/" */ + if ( is_root(file_name) ) { + strcpy(resolved_name, "/"); + return resolved_name; + } + + + tok = xv_strtok(file_name, "/"); + while ( tok ) { + if ( is_dot(tok) ) { + /* EMPTY */; + } else if ( is_dotdot(tok) ) { + char *slash = strrchr(resolved_name, '/'); + + if ( !slash ) + (void) strcpy(resolved_name, "/"); + else if ( slash != resolved_name ) + *slash = '\0'; + else /* if ( slash == resolved_name) ) */ + resolved_name[1] = '\0'; + } else { + if ( !is_root(resolved_name) ) + (void) strcat(resolved_name, "/"); + (void) strcat(resolved_name, tok); + } + tok = xv_strtok(NULL, "/"); + } + + return resolved_name; + } /* xv_realpath() */ + *** original29105/lib/libxview/file_chooser/xv_path_util.h Mon Jun 28 22:17:58 1993 --- lib/libxview/file_chooser/xv_path_util.h Tue Jun 29 00:38:50 1993 *************** *** 1,4 **** ! /* @(#)xv_path_util.h 1.6 93/06/28 SMI */ /* * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents --- 1,4 ---- ! /* @(#)xv_path_util.h 1.7 93/06/29 SMI */ /* * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents *************** *** 29,35 **** #define is_root(dir) (((dir)[0] == '/') && ((dir)[1] == '\0')) #define is_relative(dir) ((dir)[0] != '/') #define is_absolute(dir) ((dir)[0] == '/') ! #define no_string(str) (!(str)|| strequal((str),"")) #define MAX_MSG_SIZE 128 --- 29,35 ---- #define is_root(dir) (((dir)[0] == '/') && ((dir)[1] == '\0')) #define is_relative(dir) ((dir)[0] != '/') #define is_absolute(dir) ((dir)[0] == '/') ! #define no_string(str) (!(str) || !(*str)) #define MAX_MSG_SIZE 128 *************** *** 54,58 **** --- 54,59 ---- EXTERN_FUNCTION(int xv_stat, (char *path, struct stat *stats) ); EXTERN_FUNCTION(int xv_access, (char *path, int mode) ); EXTERN_FUNCTION(char *xv_expand_path, (char *path) ); + EXTERN_FUNCTION(char *xv_realpath, (char *path, char *resolved_name) ); #endif /* ~xv_path_util_DEFINED */ *** original29105/lib/libxview/sel/sel_agent.c Mon Jun 28 22:15:24 1993 --- lib/libxview/sel/sel_agent.c Tue Jun 29 00:33:36 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_agent.c 1.80 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_agent.c 1.81 93/06/29"; #endif #endif *************** *** 758,779 **** SELN_AGENT_INFO); rank = selection_to_rank(clear_event->selection, agent); ! holder = selection_inquire(server, rank); ! ! /* ! * ask the current holder to yield. The current holder should not be the ! * agent. Update the holder info. ! */ ! /* ! * if (!selection_equal_agent(server, holder)) { ! */ ! (void) selection_ask(server, &holder, SELN_REQ_YIELD, rank, 0); selection_init_holder_info(server, rank); - /* - * } - */ } - /* * Some other process has made a request to the agent to give it the contents --- 758,786 ---- SELN_AGENT_INFO); rank = selection_to_rank(clear_event->selection, agent); ! switch (rank) { ! case SELN_UNSPECIFIED: ! case SELN_CARET: ! case SELN_PRIMARY: ! case SELN_SECONDARY: ! case SELN_SHELF: ! holder = agent->client_holder[ord(rank)]; ! break; ! default: ! /* if don't know what kind of selection, then it must be ! some selection that I won't be able to figure out anyway ! so just return now instead of getting an error way ! down in selection_agent_get_holder(). This helps to get rid ! of a warning message when doing dnd. */ ! return; ! } ! /* ask the current holder to yield only if the holder is the agent, ! i.e. don't ask some other process to yield the selection. */ ! if (holder.state != SELN_NONE) { ! (void) selection_ask(server, &holder, SELN_REQ_YIELD, rank, 0); ! } selection_init_holder_info(server, rank); } /* * Some other process has made a request to the agent to give it the contents *** original29105/lib/libxview/sel/sel_appl.c Mon Jun 28 22:15:22 1993 --- lib/libxview/sel/sel_appl.c Tue Jun 29 00:33:34 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_appl.c 20.29 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_appl.c 20.30 93/06/29"; #endif #endif *************** *** 153,159 **** AVLIST_DECL; va_list args; ! VA_START(args, holder); MAKE_AVLIST( args, avlist ); va_end(args); return (selection_query(xv_default_server, holder, reader, context, --- 153,159 ---- AVLIST_DECL; va_list args; ! VA_START(args, context); MAKE_AVLIST( args, avlist ); va_end(args); return (selection_query(xv_default_server, holder, reader, context, *************** *** 192,198 **** return SELN_FAILED; } ! VA_START(valist, holder); /* WARNING: A previous call to attr_make here performed a test to make sure that buffer->data could hold the valist. Since buffer->data holds almost 500 attributes and the attribute --- 192,198 ---- return SELN_FAILED; } ! VA_START(valist, context); /* WARNING: A previous call to attr_make here performed a test to make sure that buffer->data could hold the valist. Since buffer->data holds almost 500 attributes and the attribute *** original29105/lib/libxview/sel/sel_clnt.c Mon Jun 28 22:15:23 1993 --- lib/libxview/sel/sel_clnt.c Tue Jun 29 00:33:35 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_clnt.c 20.40 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_clnt.c 20.41 93/06/29"; #endif #endif *************** *** 56,61 **** --- 56,62 ---- static Seln_function_buffer process_svc_inform(), execute_fn(); + Pkg_private Seln_result selection_send_yield_internal(); Pkg_private Seln_result selection_send_yield(); Pkg_private void seln_give_up_selection(); Pkg_private Seln_result selection_agent_acquire(); *************** *** 495,500 **** --- 496,540 ---- agent->seln_acquired_time[ord(rank)] = 0; } + Pkg_private void + seln_give_up_selection_without_telling_server(server, rank) + Xv_Server server; + Seln_rank rank; + { + Display *display = + (Display *) xv_get(server, (Attr_attribute)XV_DISPLAY); + Seln_agent_info *agent = + (Seln_agent_info *) xv_get(server, (Attr_attribute)XV_KEY_DATA, + SELN_AGENT_INFO); + Atom selection = seln_rank_to_selection(rank, agent); + + if (selection != None) { + if ((XID) XGetSelectionOwner(display, selection) == agent->xid) + { + xv_sel_free_compat_data( display, selection ); + } + + selection_init_holder_info(server, rank); + } + } + + /* + * Yield a selection rank, but don't actually tell X that the selection + * has changed since we don't want a SelectionClear to be sent. This + * routine should only be called if we are going to immediately acquire + * the selection again. I.e. this should only be called from seln_seize(). + */ + static Seln_result + selection_send_yield_without_telling_server(server, rank, holder) + Xv_Server server; + Seln_rank rank; + Seln_holder *holder; + { + Seln_result result; + result = selection_send_yield_internal(server,rank,holder); + seln_give_up_selection_without_telling_server(server, rank); + return (result); + } static Seln_seize_result seln_seize(server, client_data, asked, given) Xv_Server server; *************** *** 513,520 **** if (seln_holder_same_client(&holder, client_data)) { return Seln_seized_self; } ! switch (result = (Seln_result) selection_send_yield(server, holder.rank, ! &holder)) { case SELN_SUCCESS: return Seln_seized_ok; case SELN_WRONG_RANK: /* server's behind; try again */ --- 553,562 ---- if (seln_holder_same_client(&holder, client_data)) { return Seln_seized_self; } ! result = (Seln_result) selection_send_yield_without_telling_server(server, ! holder.rank, ! &holder); ! switch (result) { case SELN_SUCCESS: return Seln_seized_ok; case SELN_WRONG_RANK: /* server's behind; try again */ *************** *** 702,709 **** } holder = selection_inquire(server, input.rank); /* Don't need to yield if the state is SELN_FILE */ ! if (holder.state == SELN_EXISTS) ! (void) selection_send_yield(server, input.rank, &holder); (void) selection_acquire(server, agent->agent_holder.access.client, input.rank); agent->held_file[ord(input.rank)] = fd; --- 744,755 ---- } holder = selection_inquire(server, input.rank); /* Don't need to yield if the state is SELN_FILE */ ! if (holder.state == SELN_EXISTS) { ! /* Don't need to tell server because we will immediately ! acquire it again. */ ! (void) selection_send_yield_without_telling_server(server, ! input.rank,&holder); ! } (void) selection_acquire(server, agent->agent_holder.access.client, input.rank); agent->held_file[ord(input.rank)] = fd; *** original29105/lib/libxview/sel/sel_common.c Mon Jun 28 22:15:24 1993 --- lib/libxview/sel/sel_common.c Tue Jun 29 00:33:35 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_common.c 20.35 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)sel_common.c 20.36 93/06/29"; #endif #endif *************** *** 158,165 **** /* * Yield a selection rank */ Pkg_private Seln_result ! selection_send_yield(server, rank, holder) Xv_Server server; Seln_rank rank; Seln_holder *holder; --- 158,166 ---- /* * Yield a selection rank */ + Pkg_private Seln_result ! selection_send_yield_internal(server, rank, holder) Xv_Server server; Seln_rank rank; Seln_holder *holder; *************** *** 198,204 **** --- 199,215 ---- result = SELN_FAILED; } else result = (Seln_result) * requestp; + return (result); + } + Pkg_private Seln_result + selection_send_yield(server, rank, holder) + Xv_Server server; + Seln_rank rank; + Seln_holder *holder; + { + Seln_result result; + result = selection_send_yield_internal(server,rank,holder); /* * If the owner of the selection already gave up the selection, update * the cache. *** original29105/lib/libxview/selection/sel_req.c Mon Jun 28 22:16:03 1993 --- lib/libxview/selection/sel_req.c Tue Jun 29 00:34:16 1993 *************** *** 1,6 **** #ifndef lint #ifdef SCCS ! static char sccsid[] = "@(#)sel_req.c 1.17 90/12/14"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef SCCS ! static char sccsid[] = "@(#)sel_req.c 1.43 93/06/29"; #endif #endif *************** *** 534,540 **** unsigned long svr_max_req_size; if ( target == reply->seln->atomList->timestamp ) { - reply->data = (Xv_opaque) xv_malloc( sizeof( Time ) ); reply->data = (Xv_opaque) &reply->seln->time; reply->length = 1; reply->format = 32; --- 534,539 ---- *************** *** 1682,1697 **** response = selection_ask(server,&holder,SELN_REQ_CONTENTS_ASCII,0,0); reply->data = (Xv_opaque )response->data+sizeof(SELN_REQ_CONTENTS_ASCII); - #ifdef OW_I18N - /* - * FIX_ME: Even "response->data" is malloced point, you can - * not free the value which offset from malloced point. This - * should also apply to the #else part of the code. This - * is workaround for 1102285. However, should or should - * not free the data in the response->data? - */ reply->data = (Xv_opaque) strdup((char *) reply->data); - #endif reply->length = strlen( (char *) reply->data ); reply->format = 8; --- 1681,1687 ---- *** original29105/lib/libxview/selection/sel_own.c Mon Jun 28 22:16:02 1993 --- lib/libxview/selection/sel_own.c Tue Jun 29 00:34:16 1993 *************** *** 1,6 **** #ifndef lint #ifdef SCCS ! static char sccsid[] = "@(#)sel_own.c 1.28 91/04/30"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef SCCS ! static char sccsid[] = "@(#)sel_own.c 1.50 93/06/29"; #endif #endif *************** *** 1015,1022 **** /* Is this event for this window? */ if ( owner->xid != clrEv->window ) return( FALSE ); ! ! SelLoseOwnership( owner ); return TRUE; } --- 1015,1026 ---- /* Is this event for this window? */ if ( owner->xid != clrEv->window ) return( FALSE ); ! /* make sure that the selection was owned before the clear event ! was sent. If it was owned after the clear event was sent, then ! don't lose the selection. */ ! if (owner->own && (owner->time <= clrEv->time)) { ! SelLoseOwnership( owner ); ! } return TRUE; } *************** *** 1230,1244 **** * make it lose the ownership and occupy the list space. XSelectionClear * event is distributed per process not per window. */ ! if ( (infoPtr->client->selection == owner->selection) && (flag == SEL_ADD_CLIENT) ) { ! ! if (infoPtr->client->xid != owner->xid ) ! SelLoseOwnership( infoPtr->client ); ! ! infoPtr->client = owner; ! return; ! } if ( infoPtr->next == NULL ) break; --- 1234,1249 ---- * make it lose the ownership and occupy the list space. XSelectionClear * event is distributed per process not per window. */ ! if ((infoPtr->client->selection == owner->selection) && (flag == SEL_ADD_CLIENT) ) { ! if (infoPtr->client->xid != owner->xid ) { ! /* only lose ownership if you actually own the selection */ ! if (infoPtr->client->own) { ! SelLoseOwnership( infoPtr->client ); ! } ! } ! infoPtr->client = owner; ! return; } if ( infoPtr->next == NULL ) break; *** original29105/lib/libxview/textsw/txt_menu.c Mon Jun 28 22:17:46 1993 --- lib/libxview/textsw/txt_menu.c Tue Jun 29 00:34:51 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)txt_menu.c 20.90 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)txt_menu.c 20.91 93/06/29"; #endif #endif *************** *** 1123,1169 **** break; } case TEXTSW_MENU_PASTE:{ ! if (textsw_is_seln_nonzero(textsw, EV_SEL_SHELF)) ! textsw_function_get(view); ! else { ! frame = (Frame)xv_get(VIEW_REP_TO_ABS(view), WIN_FRAME); ! text_notice = (Xv_Notice)xv_get(frame, ! XV_KEY_DATA, text_notice_key, NULL); ! if (!text_notice) { ! text_notice = xv_create(frame, NOTICE, ! NOTICE_LOCK_SCREEN, FALSE, ! NOTICE_BLOCK_THREAD, TRUE, ! NOTICE_MESSAGE_STRINGS, ! XV_MSG("Nothing on the clipboard to paste in.\n\ ! Press \"Continue\" to proceed."), ! 0, ! NOTICE_BUTTON_YES, XV_MSG("Continue"), ! XV_SHOW, TRUE, ! NOTICE_BUSY_FRAMES, ! menu_pinned ? menu_cmd_frame : NULL, ! NULL, ! NULL); ! ! xv_set(frame, ! XV_KEY_DATA, text_notice_key, text_notice, ! NULL); ! } ! else { ! xv_set(text_notice, ! NOTICE_LOCK_SCREEN, FALSE, ! NOTICE_BLOCK_THREAD, TRUE, ! NOTICE_MESSAGE_STRINGS, ! XV_MSG("Nothing on the clipboard to paste in.\n\ ! Press \"Continue\" to proceed."), ! 0, ! NOTICE_BUTTON_YES, XV_MSG("Continue"), ! XV_SHOW, TRUE, ! NOTICE_BUSY_FRAMES, ! menu_pinned ? menu_cmd_frame : NULL, ! NULL, ! NULL); ! } ! } break; } default: --- 1123,1129 ---- break; } case TEXTSW_MENU_PASTE:{ ! textsw_function_get(view); break; } default: *** original29105/lib/libxview/textsw/txt_selsvc.c Mon Jun 28 22:17:28 1993 --- lib/libxview/textsw/txt_selsvc.c Tue Jun 29 00:34:50 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)txt_selsvc.c 20.63 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)txt_selsvc.c 20.64 93/06/29"; #endif #endif *************** *** 765,770 **** --- 765,787 ---- static char *extra_ptr; int extra_bytes = 0; char *temp_ptr = (char *) (attr + 1); + + /* if the SELN_REQ_BYTESIZE hasn't been requested (because it + could have failed) then use the strlen() of the + SELN_REQ_CONTENTS_ASCII for the length + */ + if ((selection->first==ES_INFINITY) && + (selection->last_plus_one==ES_INFINITY)) { + temp_len=strlen(temp_ptr); + /* don't set the values unless there really is a string + because we want to preserve any previous values. */ + if (temp_len) { + selection->first = 0; + selection->last_plus_one = temp_len; + } + } else { + temp_len = selection->last_plus_one - selection->first; + } if (reply->status == SELN_CONTINUED) { context->continued_attr = (Seln_attribute) (*attr); *************** *** 779,785 **** temp_len = to_read; } } else { ! to_read = temp_len = selection->last_plus_one - selection->first; if (extra_ptr) { /* Clear out all the uncoverted bytes in the last pass */ xv_free(extra_ptr); --- 796,802 ---- temp_len = to_read; } } else { ! to_read = temp_len; if (extra_ptr) { /* Clear out all the uncoverted bytes in the last pass */ xv_free(extra_ptr); *************** *** 828,833 **** --- 845,864 ---- #else /* OW_I18N */ case SELN_REQ_CONTENTS_ASCII: #endif /* OW_I18N */ + /* if the SELN_REQ_BYTESIZE or CHARSIZE hasn't been requested + (because it could have failed) then use the strlen() of the + SELN_REQ_CONTENTS_ASCII for the length + */ + if ((selection->first==ES_INFINITY) && + (selection->last_plus_one==ES_INFINITY)) { + to_read=STRLEN((CHAR *)(attr + 1)); + /* don't set the values unless there really is a string + because we want to preserve any previous values. */ + if (to_read) { + selection->first = 0; + selection->last_plus_one = to_read; + } + } if (reply->status == SELN_CONTINUED) { context->continued_attr = (Seln_attribute) (*attr); to_read = STRLEN((CHAR *) (attr + 1)); *** original29105/lib/libxview/textsw/txt_getkey.c Mon Jun 28 22:17:36 1993 --- lib/libxview/textsw/txt_getkey.c Tue Jun 29 00:34:50 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)txt_getkey.c 20.35 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)txt_getkey.c 20.36 93/06/29"; #endif #endif *************** *** 43,48 **** --- 43,61 ---- { int easy, result = 0; register Textsw_folio folio = FOLIO_FOR_VIEW(view); + Seln_holder holder; + Xv_Server server = (Xv_Server)XV_SERVER_FROM_WINDOW(VIEW_REP_TO_ABS(view)); + + /* textsw_begin_get() eventually tried to acquire the CARET, but in + doing so, it could have lost it because another textsw in the same + process had it and lost it from a SelectionClear from the server. + So if it doesn't exist, then we need to acquire it again because + execute_fn() (which is eventually called by textsw_inform_seln_svc) + actually tries to get the CARET and might fail. */ + holder = selection_inquire(server, SELN_CARET); + if (holder.state != SELN_EXISTS) { + textsw_acquire_seln(folio, SELN_CARET); + } easy = textsw_inform_seln_svc(folio, TXTSW_FUNC_GET, FALSE); if ((folio->func_state & TXTSW_FUNC_GET) == 0) *** original29105/lib/libxview/ttysw/ttyselect.c Mon Jun 28 22:17:19 1993 --- lib/libxview/ttysw/ttyselect.c Tue Jun 29 00:35:08 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)ttyselect.c 20.46 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)ttyselect.c 20.47 93/06/29"; #endif #endif *************** *** 1341,1353 **** register Ttysw_folio ttysw; { Seln_holder holder; - int ok; ! if (ok = ttysw_is_seln_nonzero(ttysw, SELN_SHELF)) { ! holder = seln_inquire(SELN_SHELF); ! ttysel_get_selection(ttysw, &holder); ! } ! return (ok); } --- 1341,1350 ---- register Ttysw_folio ttysw; { Seln_holder holder; ! holder = seln_inquire(SELN_SHELF); ! ttysel_get_selection(ttysw, &holder); ! return 1; } *************** *** 1831,1837 **** register int current_size; register Attr_attribute *attr; int true_len; ! if (buffer == (Seln_request *) NULL) { return SELN_UNRECOGNIZED; } --- 1828,1835 ---- register int current_size; register Attr_attribute *attr; int true_len; ! int result=SELN_FAILED; ! if (buffer == (Seln_request *) NULL) { return SELN_UNRECOGNIZED; } *************** *** 1847,1852 **** --- 1845,1851 ---- current_size = MIN(context->bytes_left, buffer->buf_size - 3 * sizeof(Seln_attribute)); context->request_is_byte = TRUE; + result = SELN_SUCCESS; break; case SELN_REQ_CHARSIZE: context->bytes_left = (int) *response_ptr++; *************** *** 1853,1875 **** current_size = MIN(context->bytes_left, (buffer->buf_size - 3 * sizeof(Seln_attribute))/sizeof(CHAR)); context->request_is_byte = FALSE; break; case SELN_REQ_CONTENTS_ASCII: context->request_is_ascii = TRUE; break; case SELN_REQ_CONTENTS_WCS: context->request_is_ascii = FALSE; break; default: ! return SELN_FAILED; } ! } ! } else current_size = MIN(context->bytes_left, buffer->buf_size/sizeof(CHAR)); /* ! * BUG! ; Ttysw is confused if null characters are padded at the * end of the selected string. So we need to pass the exact length * of the string to ttwsw. */ --- 1852,1887 ---- current_size = MIN(context->bytes_left, (buffer->buf_size - 3 * sizeof(Seln_attribute))/sizeof(CHAR)); context->request_is_byte = FALSE; + result = SELN_SUCCESS; break; case SELN_REQ_CONTENTS_ASCII: context->request_is_ascii = TRUE; + result = SELN_SUCCESS; break; case SELN_REQ_CONTENTS_WCS: context->request_is_ascii = FALSE; + result = SELN_SUCCESS; break; default: ! /* result is initialized to SELN_FAILED, so don't have ! to set it */ ! break; } ! } ! /* if all the attributes failed, then result will be ! SELN_FAILED, so return. If at least one of the attributes ! succeeded, then we can continue on. */ ! if (result==SELN_FAILED) { ! return result; ! } ! } else current_size = MIN(context->bytes_left, buffer->buf_size/sizeof(CHAR)); + /* Now the response_ptr either points to NULL, or points to value + part of attribute SELN_REQ_CONTENTS_ASCII or SELN_REQ_CONTENTS_WCS */ /* ! * Ttysw is confused if null characters are padded at the * end of the selected string. So we need to pass the exact length * of the string to ttwsw. */ *** original29105/lib/libxview/misc/xv_version.h Mon Jun 28 22:16:34 1993 --- lib/libxview/misc/xv_version.h Tue Jun 29 10:15:32 1993 *************** *** 1,6 **** #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)xv_version.h 1.22 93/06/28"; #endif #endif --- 1,6 ---- #ifndef lint #ifdef sccs ! static char sccsid[] = "@(#)xv_version.h 1.23 93/06/29"; #endif #endif *************** *** 31,41 **** /* REMIND: this will need to be bumped with each release of XView */ #define XV_VERSION_NUMBER 3200 ! #define XV_VERSION_STRING "XView Version 3.2 (Beta2.0)" ! ! ! --- 31,43 ---- /* REMIND: this will need to be bumped with each release of XView */ #define XV_VERSION_NUMBER 3200 ! #define XV_VERSION_STRING "XView Version 3.2 FCS - Patch 01" ! /* ! * Patch 01 fixes: ! * file chooser goto field should not expand links ! * Copy and Paste does not work with R5 ! */