makefile_bertw: always compile with -g
[nedit-bw.git] / multi-client-wait.patch
blob5134385036b46b3d655d357300ea6b5740ff76b8
1 ---
3 source/macro.c | 2 +-
4 source/menu.c | 2 +-
5 source/nedit.h | 8 +++++++-
6 source/server.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
7 source/server.h | 1 +
8 source/window.c | 19 +++++++++++--------
9 6 files changed, 74 insertions(+), 14 deletions(-)
11 diff --quilt old/source/macro.c new/source/macro.c
12 --- old/source/macro.c
13 +++ new/source/macro.c
14 @@ -7226,7 +7226,7 @@ static int clientAttachedMV(WindowInfo *
15 if (!IsServer)
16 return True;
18 - result->val.n = window->fileClosedAtom != None;
19 + result->val.n = HasFileClosedProperty(window);
21 return True;
23 diff --quilt old/source/menu.c new/source/menu.c
24 --- old/source/menu.c
25 +++ new/source/menu.c
26 @@ -4581,7 +4581,7 @@ static void releaseClientAP(Widget w, XE
27 return;
29 DeleteFileClosedProperty(window);
30 - XtSetSensitive(window->releaseClientItem, window->fileClosedAtom != None);
31 + XtSetSensitive(window->releaseClientItem, HasFileClosedProperty(window));
32 UpdateWindowTitle(window);
33 RefreshTabState(window);
35 diff --quilt old/source/nedit.h new/source/nedit.h
36 --- old/source/nedit.h
37 +++ new/source/nedit.h
38 @@ -268,6 +268,12 @@ typedef struct _UserBGMenuCache {
39 UserMenuList ubmcMenuList; /* list of all background menu items */
40 } UserBGMenuCache;
42 +typedef struct _NAtomList {
43 + Atom atoms[8];
44 + Cardinal nAtoms;
45 + struct _NAtomList *next;
46 +} NAtomList;
48 /* The WindowInfo structure holds the information on a Document. A number
49 of 'tabbed' documents may reside within a shell window, hence some of
50 its members are of 'shell-level'; namely the find/replace dialogs, the
51 @@ -545,7 +551,7 @@ typedef struct _WindowInfo {
52 info. about it, otherwise, NULL */
53 void *macroCmdData; /* same for macro commands */
54 void *smartIndentData; /* compiled macros for smart indent */
55 - Atom fileClosedAtom; /* Atom used to tell nc that the file is closed */
56 + NAtomList fileClosedAtoms;
57 int languageMode; /* identifies language mode currently
58 selected in the window */
59 Boolean multiFileReplSelected; /* selected during last multi-window
60 diff --quilt old/source/server.c new/source/server.c
61 --- old/source/server.c
62 +++ new/source/server.c
63 @@ -258,9 +258,37 @@ static Atom findFileClosedProperty(const
64 static void getFileClosedProperty(WindowInfo *window, const char *fullname)
66 if (window->filenameSet) {
67 - window->fileClosedAtom = findFileClosedProperty(fullname);
68 + Atom new = findFileClosedProperty(fullname);
69 + NAtomList *list = &window->fileClosedAtoms;
71 + if (new == None)
72 + return;
74 + while (list) {
75 + int i;
76 + for (i = 0; i < list->nAtoms; i++) {
77 + if (list->atoms[i] == new)
78 + goto out;
79 + }
81 + if (!list->next)
82 + break;
84 + list = list->next;
85 + }
87 + if (list->nAtoms == 8) {
88 + list->next = (NAtomList *)XtMalloc(sizeof(NAtomList));
89 + list = list->next;
90 + list->nAtoms = 0;
91 + list->next = NULL;
92 + }
94 + list->atoms[list->nAtoms++] = new;
96 - XtSetSensitive(window->releaseClientItem, window->fileClosedAtom != None);
98 +out:
99 + XtSetSensitive(window->releaseClientItem, HasFileClosedProperty(window));
100 UpdateWindowTitle(window);
101 RefreshTabState(window);
103 @@ -271,10 +299,32 @@ static void getFileClosedProperty(Window
104 void DeleteFileClosedProperty(WindowInfo *window)
106 if (window->filenameSet) {
107 - deleteProperty(&window->fileClosedAtom);
108 + NAtomList *list = &window->fileClosedAtoms;
109 + while (list) {
110 + NAtomList *t;
111 + int i;
112 + for (i = 0; i < list->nAtoms; i++) {
113 + deleteProperty(&list->atoms[i]);
116 + t = list->next;
117 + if (list != &window->fileClosedAtoms)
118 + XtFree((char *)list);
119 + else {
120 + list->nAtoms = 0;
121 + list->next = NULL;
123 + list = t;
129 +int HasFileClosedProperty(const WindowInfo *window)
131 + return window->fileClosedAtoms.nAtoms > 0;
134 static void deleteFileClosedProperty2(const char* fullname)
136 Atom atom = findFileClosedProperty(fullname);
137 diff --quilt old/source/server.h new/source/server.h
138 --- old/source/server.h
139 +++ new/source/server.h
140 @@ -38,5 +38,6 @@ void InitServerCommunication(void);
141 void ServerMainLoop(XtAppContext context);
142 Boolean ServerDispatchEvent(XEvent *event);
143 void DeleteFileClosedProperty(WindowInfo *window);
144 +int HasFileClosedProperty(const WindowInfo *window);
146 #endif /* NEDIT_SERVER_H_INCLUDED */
147 diff --quilt old/source/window.c new/source/window.c
148 --- old/source/window.c
149 +++ new/source/window.c
150 @@ -298,7 +298,8 @@ WindowInfo *CreateWindow(const char *nam
151 window->ignoreModify = FALSE;
152 window->windowMenuValid = FALSE;
153 window->flashTimeoutID = 0;
154 - window->fileClosedAtom = None;
155 + window->fileClosedAtoms.nAtoms = 0;
156 + window->fileClosedAtoms.next = NULL;
157 window->wasSelected = FALSE;
159 strcpy(window->fontName, GetPrefFontName());
160 @@ -2163,7 +2164,7 @@ void UpdateWindowTitle(const WindowInfo
161 window->lockReasons,
162 window->fileChanged,
163 window->transient,
164 - window->fileClosedAtom != None,
165 + HasFileClosedProperty(window),
166 format);
168 if (strcmp(title, format) == 0)
169 @@ -2174,7 +2175,7 @@ void UpdateWindowTitle(const WindowInfo
170 strcpy(iconTitle, filename);
171 if (window->fileChanged && !window->transient)
172 strcat(iconTitle, "*");
173 - if (window->fileClosedAtom != None)
174 + if (HasFileClosedProperty(window))
175 strcat(iconTitle, "?");
176 XtVaSetValues(window->shell, XmNtitle, title, XmNiconName, iconTitle, NULL);
178 @@ -3525,7 +3526,8 @@ WindowInfo* CreateDocument(WindowInfo* s
179 window->ignoreModify = FALSE;
180 window->windowMenuValid = FALSE;
181 window->flashTimeoutID = 0;
182 - window->fileClosedAtom = None;
183 + window->fileClosedAtoms.nAtoms = 0;
184 + window->fileClosedAtoms.next = NULL;
185 window->wasSelected = FALSE;
186 strcpy(window->fontName, GetPrefFontName());
187 strcpy(window->italicFontName, GetPrefItalicFontName());
188 @@ -3798,7 +3800,7 @@ void RefreshTabState(WindowInfo *win)
189 char *tag = XmFONTLIST_DEFAULT_TAG;
190 unsigned char alignment;
191 const char *changed = (win->fileChanged && !win->transient) ? "*" : "";
192 - const char *waiting = (win->fileClosedAtom != None) ? "?" : "";
193 + const char *waiting = HasFileClosedProperty(win) ? "?" : "";
195 /* Set tab label to document's filename. Position of
196 "*" (modified) will change per label alignment setting */
197 @@ -3976,7 +3978,7 @@ void RefreshMenuToggleStates(WindowInfo
199 if (IsServer)
200 XtSetSensitive(window->releaseClientItem,
201 - window->fileClosedAtom != None);
202 + HasFileClosedProperty(window));
206 @@ -4645,8 +4647,9 @@ static void cloneDocument(WindowInfo *wi
207 window->findLastLiteralCase = orgWin->findLastLiteralCase;
208 window->device = orgWin->device;
209 window->inode = orgWin->inode;
210 - window->fileClosedAtom = orgWin->fileClosedAtom;
211 - orgWin->fileClosedAtom = None;
212 + window->fileClosedAtoms = orgWin->fileClosedAtoms;
213 + orgWin->fileClosedAtoms.nAtoms = 0;
214 + orgWin->fileClosedAtoms.next = NULL;
215 window->hardlinkDontPromptAgain = orgWin->hardlinkDontPromptAgain;
217 /* copy the text/split panes settings, cursor pos & selection */