release client: UI and macro interface to release clients, waiting for close
[nedit-bw.git] / release-client.patch
blob6e47aa252b96c5c932991d87dff04fa166e2572a
1 ---
3 source/built-ins.h | 1 +
4 source/highlightData.c | 4 ++--
5 source/macro.c | 15 +++++++++++++++
6 source/menu.c | 31 ++++++++++++++++++++++++++++++-
7 source/nc.c | 16 ++++++++++------
8 source/nedit.h | 1 +
9 source/server.c | 25 ++++++++++---------------
10 source/server_common.c | 5 ++---
11 source/server_common.h | 3 +--
12 source/window.c | 21 ++++++++++++++-------
13 source/windowTitle.c | 11 +++++++++++
14 source/windowTitle.h | 1 +
15 12 files changed, 98 insertions(+), 36 deletions(-)
17 diff --quilt old/source/menu.c new/source/menu.c
18 --- old/source/menu.c
19 +++ new/source/menu.c
20 @@ -440,6 +440,8 @@ static void setFontsAP(Widget w, XEvent
21 Cardinal *nArgs);
22 static void setLanguageModeAP(Widget w, XEvent *event, String *args,
23 Cardinal *nArgs);
24 +static void releaseClientAP(Widget w, XEvent *event, String *args,
25 + Cardinal *nArgs);
26 #ifdef SGI_CUSTOM
27 static void shortMenusCB(Widget w, WindowInfo *window, caddr_t callData);
28 static void addToToggleShortList(Widget w);
29 @@ -608,7 +610,8 @@ static XtActionsRec Actions[] = {
30 {"set_use_tabs", setUseTabsAP},
31 {"set_fonts", setFontsAP},
32 {"begin_tab_drag", beginTabDragAP},
33 - {"set_language_mode", setLanguageModeAP}
34 + {"set_language_mode", setLanguageModeAP},
35 + {"release_client", releaseClientAP}
38 /* List of previously opened files for File menu */
39 @@ -1302,6 +1305,15 @@ Widget CreateMenuBar(Widget parent, Wind
40 btn = createMenuSeparator(menuPane, "sep1", SHORT);
41 XtVaSetValues(btn, XmNuserData, PERMANENT_MENU_ITEM, NULL);
43 + if (IsServer) {
44 + window->releaseClientItem = createMenuItem(menuPane, "releaseClient",
45 + "Release Client", 'R', doActionCB, "release_client", SHORT);
46 + XtSetSensitive(window->releaseClientItem,
47 + window->fileClosedAtom != None);
48 + btn = createMenuSeparator(menuPane, "sep2", SHORT);
49 + XtVaSetValues(btn, XmNuserData, PERMANENT_MENU_ITEM, NULL);
50 + }
52 /*
53 ** Create "Help" pull down menu.
55 @@ -4557,6 +4569,23 @@ static void setLanguageModeAP(Widget w,
59 +static void releaseClientAP(Widget w, XEvent *event, String *args,
60 + Cardinal *nArgs)
62 + WindowInfo *window = WidgetToWindow(w);
64 + if (*nArgs != 0) {
65 + fprintf(stderr, "nedit: invalid number of arguments for release_client\n");
66 + return;
67 + }
69 + DeleteFileClosedProperty(window);
71 + XtSetSensitive(window->releaseClientItem, window->fileClosedAtom != None);
72 + UpdateWindowTitle(window);
73 + RefreshTabState(window);
77 ** Same as AddSubMenu from libNUtil.a but 1) mnemonic is optional (NEdit
78 ** users like to be able to re-arrange the mnemonics so they can set Alt
79 diff --quilt old/source/nedit.h new/source/nedit.h
80 --- old/source/nedit.h
81 +++ new/source/nedit.h
82 @@ -455,6 +455,7 @@ typedef struct _WindowInfo {
83 Widget closePaneItem;
84 Widget detachDocumentItem;
85 Widget moveDocumentItem;
86 + Widget releaseClientItem;
87 Widget contextMoveDocumentItem;
88 Widget contextDetachDocumentItem;
89 Widget bgMenuUndoItem;
90 diff --quilt old/source/server.c new/source/server.c
91 --- old/source/server.c
92 +++ new/source/server.c
93 @@ -250,9 +250,7 @@ static Atom findFileClosedProperty(const
95 if (!IsServer) return(None);
97 - atom = CreateServerFileClosedAtom(GetPrefServerName(),
98 - fullname,
99 - True); /* don't create */
100 + atom = CreateServerFileClosedAtom(GetPrefServerName(), fullname);
101 return(atom);
104 @@ -262,6 +260,9 @@ static void getFileClosedProperty(Window
105 if (window->filenameSet) {
106 window->fileClosedAtom = findFileClosedProperty(fullname);
108 + XtSetSensitive(window->releaseClientItem, window->fileClosedAtom != None);
109 + UpdateWindowTitle(window);
110 + RefreshTabState(window);
113 /* Delete the 'FileClosed' atom to inform nc that this file has
114 @@ -335,6 +336,7 @@ static void processServerCommandString(c
115 int editFlags, stringLen = strlen(string);
116 int lineNum, createFlag, readFlag, iconicFlag, lastIconic = 0, tabbed = -1;
117 int fileLen, doLen, lmLen, geomLen, charsRead, itemsRead;
118 + int clientWaits;
119 WindowInfo *window, *lastFile = NULL;
120 long currentDesktop = QueryCurrentDesktop(TheDisplay,
121 RootWindow(TheDisplay, DefaultScreen(TheDisplay)));
122 @@ -374,18 +376,10 @@ static void processServerCommandString(c
123 command both followed by newlines. This bit of code reads the
124 header, and converts the newlines following the filename and do
125 command to nulls to terminate the filename and doCommand strings */
126 - itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d%n", &lineNum,
127 + itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d %d%n", &lineNum,
128 &readFlag, &createFlag, &iconicFlag, &tabbed, &currentDesktop,
129 - &fileLen, &doLen, &lmLen, &geomLen, &charsRead);
130 - if (itemsRead == 9) {
131 - /* backward compatibility, without currentDesktop */
132 - geomLen = lmLen;
133 - lmLen = doLen;
134 - doLen = fileLen;
135 - fileLen = currentDesktop;
136 - currentDesktop = QueryCurrentDesktop(TheDisplay,
137 - RootWindow(TheDisplay, DefaultScreen(TheDisplay)));
138 - } else if (itemsRead != 10)
139 + &clientWaits, &fileLen, &doLen, &lmLen, &geomLen, &charsRead);
140 + if (itemsRead != 11)
141 goto readError;
142 inPtr += charsRead + 1;
143 if (fileLen >= 0 && inPtr - string + fileLen > stringLen)
144 @@ -505,7 +499,8 @@ static void processServerCommandString(c
145 command can do anything, including closing the window!) */
146 if (window != NULL) {
147 deleteFileOpenProperty(window, requestname);
148 - getFileClosedProperty(window, requestname);
149 + if (clientWaits)
150 + getFileClosedProperty(window, requestname);
152 if (lineNum > 0)
153 SelectNumberedLine(window, lineNum);
154 diff --quilt old/source/window.c new/source/window.c
155 --- old/source/window.c
156 +++ new/source/window.c
157 @@ -2184,16 +2184,19 @@ void UpdateWindowTitle(const WindowInfo
158 window->lockReasons,
159 window->fileChanged,
160 window->transient,
161 + window->fileClosedAtom != None,
162 format);
164 if (strcmp(title, format) == 0)
165 filename = title;
167 - iconTitle = XtMalloc(strlen(filename) + 2); /* strlen("*")+1 */
168 + iconTitle = XtMalloc(strlen(filename) + 3); /* strlen("*?")+1 */
170 strcpy(iconTitle, filename);
171 if (window->fileChanged && !window->transient)
172 strcat(iconTitle, "*");
173 + if (IsServer && window->fileClosedAtom != None)
174 + strcat(iconTitle, "?");
175 XtVaSetValues(window->shell, XmNtitle, title, XmNiconName, iconTitle, NULL);
177 /* If there's a find or replace dialog up in "Keep Up" mode, with a
178 @@ -3812,22 +3815,23 @@ int getTabPosition(Widget tab)
179 void RefreshTabState(WindowInfo *win)
181 XmString s1, tipString;
182 - char labelString[MAXPATHLEN];
183 + char labelString[MAXPATHLEN+3];
184 char *tag = XmFONTLIST_DEFAULT_TAG;
185 unsigned char alignment;
186 - const char *star = (win->fileChanged && !win->transient) ? "*" : "";
187 + const char *changed = (win->fileChanged && !win->transient) ? "*" : "";
188 + const char *waiting = (IsServer && win->fileClosedAtom != None) ? "?" : "";
190 /* Set tab label to document's filename. Position of
191 "*" (modified) will change per label alignment setting */
192 XtVaGetValues(win->tab, XmNalignment, &alignment, NULL);
193 if (alignment != XmALIGNMENT_END) {
194 - sprintf(labelString, "%s%s",
195 - star,
196 + sprintf(labelString, "%s%s%s",
197 + waiting, changed,
198 win->filename);
199 } else {
200 - sprintf(labelString, "%s%s",
201 + sprintf(labelString, "%s%s%s",
202 win->filename,
203 - star);
204 + changed, waiting);
207 /* Make the top document stand out a little more */
208 @@ -3985,6 +3989,9 @@ void RefreshMenuToggleStates(WindowInfo
209 XtSetSensitive(window->closePaneItem, window->nPanes > 0);
210 XtSetSensitive(window->detachDocumentItem, NDocuments(window)>1);
211 XtSetSensitive(window->contextDetachDocumentItem, NDocuments(window)>1);
212 + if (IsServer)
213 + XtSetSensitive(window->releaseClientItem,
214 + window->fileClosedAtom != None);
216 for (win=WindowList; win; win=win->next)
217 if (win->shell != window->shell)
218 diff --quilt old/source/built-ins.h new/source/built-ins.h
219 --- old/source/built-ins.h
220 +++ new/source/built-ins.h
221 @@ -134,3 +134,4 @@ MV(VERSION, version)
222 MV(NEDIT_HOME, neditHome)
223 MV(transient, transient)
224 MV(macro_backtrace, macroBacktrace)
225 +MV(client_attached, clientAttached)
226 diff --quilt old/source/highlightData.c new/source/highlightData.c
227 --- old/source/highlightData.c
228 +++ new/source/highlightData.c
229 @@ -554,8 +554,8 @@ static char *DefaultPatternSets[] = {
230 Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line|transient|VERSION|NEDIT_HOME)>\":::Identifier::\n\
231 Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
232 Built-in Special Vars:\"(?<!\\Y)\\$(?:args|[1-9]|list_dialog_button|macro_name|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep|macro_backtrace)>\":::String1::\n\
233 - Built-in Subrs:\"<(?:args|append_file|beep|call|calltip|clipboard_to_string|define|dialog|eval|filename_dialog|dict_(?:insert|complete|save|append|is_element)|e_print|escape_literal|focus_window|get_character|get_matching|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|highlight_calltip_line|kill_calltip|length|list_dialog|max|min|n_args|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_transient|set_window_title|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|timer_(?:add|remove)|to_(?:column|line|pos)|tolower|toupper|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
234 - Menu Actions:\"<(?:new(?:_tab|_opposite)?|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-pane|split_pane|close-pane|close_pane|detach_document(?:_dialog)?|move_document_dialog|(?:next|previous|last)_document|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|post_tab_context_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
235 + Built-in Subrs:\"<(?:args|append_file|beep|call|calltip|client_attached|clipboard_to_string|define|dialog|eval|filename_dialog|dict_(?:insert|complete|save|append|is_element)|e_print|escape_literal|focus_window|get_character|get_matching|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|highlight_calltip_line|kill_calltip|length|list_dialog|max|min|n_args|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_transient|set_window_title|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|timer_(?:add|remove)|to_(?:column|line|pos)|tolower|toupper|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
236 + Menu Actions:\"<(?:new(?:_tab|_opposite)?|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-pane|split_pane|close-pane|close_pane|detach_document(?:_dialog)?|move_document_dialog|(?:next|previous|last)_document|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|post_tab_context_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode|release_client)(?=\\s*\\()\":::Subroutine::\n\
237 Text Actions:\"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|select_word|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)(?=\\s*\\()\":::Subroutine::\n\
238 Macro Hooks:\"<(?:(?:pre|post)_(?:open|save)|cursor_moved|modified|(?:losing_)?focus|language_mode)_hook(?=\\s*\\()\":::Subroutine1::\n\
239 Keyword:\"<(?:break|case|continue|default|define|delete|do|else|finally|for|if|in|readonly|return|switch|typeof|while)>\":::Keyword::\n\
240 diff --quilt old/source/macro.c new/source/macro.c
241 --- old/source/macro.c
242 +++ new/source/macro.c
243 @@ -7216,6 +7216,21 @@ static int macroBacktraceMV(WindowInfo *
244 return GetBacktrace(result, errMsg);
247 +static int clientAttachedMV(WindowInfo *window, DataValue *argList,
248 + int nArgs, DataValue *result, char **errMsg)
250 + result->tag = INT_TAG;
251 + result->val.n = 0;
253 + /* if we don't run in server mode, return always false */
254 + if (!IsServer)
255 + return True;
257 + result->val.n = window->fileClosedAtom != None;
259 + return True;
262 static int wrongNArgsErr(char **errMsg)
264 *errMsg = "Wrong number of arguments to function %s";
265 diff --quilt old/source/nc.c new/source/nc.c
266 --- old/source/nc.c
267 +++ new/source/nc.c
268 @@ -228,8 +228,9 @@ static void createWaitProperties(void)
269 fileListHead.waitForCloseCount++;
270 item->waitForFileClosedAtom =
271 CreateServerFileClosedAtom(Preferences.serverName,
272 - item->path,
273 - False);
274 + item->path);
275 + if (item->waitForFileClosedAtom != None)
276 + fprintf(stderr, "i'm waiting for %s\n", item->path);
277 setPropertyValue(item->waitForFileClosedAtom);
280 @@ -779,9 +780,10 @@ static void parseCommandLine(int argc, c
283 /* See below for casts */
284 - sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n"
285 + sprintf(outPtr, "%d %d %d %d %d %ld %d %ld %ld %ld %ld\n"
286 "%s%s\n%s\n%s\n%s\n%n",
287 lineNum, read, create, iconic, tabbed, currentDesktop,
288 + !!Preferences.waitForClose,
289 filePrefixLen + (long) strlen(path),
290 (long) strlen(toDoCommand), (long) strlen(langMode),
291 (long) strlen(geometry),
292 @@ -824,8 +826,9 @@ static void parseCommandLine(int argc, c
293 The "long" cast on strlen() is necessary because size_t
294 is 64 bit on Alphas, and 32-bit on most others. There is
295 no printf format specifier for "size_t", thanx, ANSI. */
296 - sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n%n", lineNum,
297 - read, create, iconic, isTabbed, currentDesktop,
298 + sprintf(outPtr, "%d %d %d %d %d %ld %d %ld %ld %ld %ld\n%n",
299 + lineNum, read, create, iconic, isTabbed,
300 + currentDesktop, !!Preferences.waitForClose,
301 filePrefixLen + (long) strlen(path),
302 (long) strlen(toDoCommand), (long) strlen(langMode),
303 (long) strlen(geometry), &charsWritten);
304 @@ -863,7 +866,7 @@ static void parseCommandLine(int argc, c
306 if (toDoCommand[0] != '\0' || fileCount == 0) {
307 const char *current = GetCurrentDir();
308 - sprintf(outPtr, "0 0 0 %d %d %ld %ld %ld %ld %ld\n%n", iconic, tabbed,
309 + sprintf(outPtr, "0 0 0 %d %d %ld 0 %ld %ld %ld %ld\n%n", iconic, tabbed,
310 currentDesktop, -(filePrefixLen + (long) strlen(current)),
311 (long) strlen(toDoCommand), (long) strlen(langMode),
312 (long) strlen(geometry), &charsWritten);
313 @@ -1065,3 +1068,4 @@ static void printNcVersion(void ) {
314 COMPILE_OS, COMPILE_MACHINE, COMPILE_COMPILER,
315 __DATE__, __TIME__);
318 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
319 --- old/source/windowTitle.c
320 +++ new/source/windowTitle.c
321 @@ -193,6 +193,7 @@ static void compressWindowTitle(char *ti
323 /* remove empty paranthesis pairs */
324 case '(':
325 + sourcePtr = removeSequence(sourcePtr, ' ');
326 if (*sourcePtr == ')') {
327 modified = True;
328 sourcePtr++;
329 @@ -202,6 +203,7 @@ static void compressWindowTitle(char *ti
330 break;
332 case '[':
333 + sourcePtr = removeSequence(sourcePtr, ' ');
334 if (*sourcePtr == ']') {
335 modified = True;
336 sourcePtr++;
337 @@ -211,6 +213,7 @@ static void compressWindowTitle(char *ti
338 break;
340 case '{':
341 + sourcePtr = removeSequence(sourcePtr, ' ');
342 if (*sourcePtr == '}') {
343 modified = True;
344 sourcePtr++;
345 @@ -250,6 +253,7 @@ static void compressWindowTitle(char *ti
346 of leading hosts components to dispaly.
347 ** %S : file status
348 ** %u : user name
349 +** %w : "waiting" if a client is waiting for the closure of this document
351 ** if the ClearCase view tag and server name are identical, only the first one
352 ** specified in the formatting string will be displayed.
353 @@ -263,6 +267,7 @@ char *FormatWindowTitle(const char* file
354 int lockReasons,
355 int fileChanged,
356 int transient,
357 + int clientWaits,
358 const char* titleFormat)
360 static char title[WINDOWTITLE_MAX_LEN];
361 @@ -410,6 +415,11 @@ char *FormatWindowTitle(const char* file
362 titlePtr = safeCharAdd(titlePtr, titleEnd, '%');
363 break;
365 + case 'w': /* client is waiting */
366 + if (isServer && clientWaits)
367 + titlePtr = safeStrCpy(titlePtr, titleEnd, "waiting");
368 + break;
370 case '*': /* short file status ? */
371 fileStatusPresent = True;
372 if (*titleFormat && *titleFormat == 'S')
373 @@ -593,6 +603,7 @@ static void formatChangedCB(Widget w, Xt
374 etDialog.lockReasons,
375 XmToggleButtonGetState(etDialog.oFileChangedW),
376 XmToggleButtonGetState(etDialog.oTransientW),
377 + False,
378 format);
379 XtFree(format);
380 XmTextFieldSetString(etDialog.previewW, title);
381 diff --quilt old/source/windowTitle.h new/source/windowTitle.h
382 --- old/source/windowTitle.h
383 +++ new/source/windowTitle.h
384 @@ -43,6 +43,7 @@ char *FormatWindowTitle(const char* file
385 int lockReasons,
386 int fileChanged,
387 int transient,
388 + int clientWaits,
389 const char* titleFormat);
391 void EditCustomTitleFormat(WindowInfo *window);
392 diff --quilt old/source/server_common.c new/source/server_common.c
393 --- old/source/server_common.c
394 +++ new/source/server_common.c
395 @@ -99,8 +99,7 @@ Atom CreateServerFileOpenAtom(const char
398 Atom CreateServerFileClosedAtom(const char *serverName,
399 - const char *path,
400 - Bool only_if_exist)
401 + const char *path)
403 char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9+1];
404 const char *userName = GetUserName(NEDIT_NAME);
405 @@ -108,7 +107,7 @@ Atom CreateServerFileClosedAtom(const ch
406 Atom atom;
408 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path);
409 - atom = XInternAtom(TheDisplay, propName, only_if_exist);
410 + atom = XInternAtom(TheDisplay, propName, False);
411 return(atom);
414 diff --quilt old/source/server_common.h new/source/server_common.h
415 --- old/source/server_common.h
416 +++ new/source/server_common.h
417 @@ -43,8 +43,7 @@ void CreateServerPropertyAtoms(const cha
418 Atom CreateServerFileOpenAtom(const char *serverName,
419 const char *path);
420 Atom CreateServerFileClosedAtom(const char *serverName,
421 - const char *path,
422 - Bool only_if_exists);
423 + const char *path);
424 void DeleteServerFileAtoms(const char* serverName, Window rootWindow);
426 #endif /* NEDIT_SERVER_COMMON_H_INCLUDED */