fix motifless build, keep original LIBS variable
[nedit-bw.git] / motifless-nc.patch
blobcbc6d4f9bae7ec8ecf0ef20598d0dd1619a7f910
1 ---
3 makefiles/Makefile.bertw | 7 +-
4 source/Makefile.common | 12 +++-
5 source/nc.c | 2
6 source/server_common.c | 4 +
7 util/Makefile.common | 3 -
8 util/Makefile.dependencies | 1
9 util/misc.c | 64 -------------------------
10 util/misc.h | 4 -
11 util/prefFile.c | 6 +-
12 util/wmdesktop.c | 113 +++++++++++++++++++++++++++++++++++++++++++++
13 util/wmdesktop.h | 36 ++++++++++++++
14 11 files changed, 173 insertions(+), 79 deletions(-)
16 diff --quilt old/source/Makefile.common new/source/Makefile.common
17 --- old/source/Makefile.common
18 +++ new/source/Makefile.common
19 @@ -26,11 +26,15 @@ all: nedit nc
20 nedit: $(OBJS) ../util/libNUtil.a $(XMLLIB) $(XLTLIB)
21 $(CC) $(CFLAGS) -c linkdate.c
22 $(CC) $(CFLAGS) $(OBJS) linkdate.o $(XMLLIB) \
23 - $(XLTLIB) ../util/libNUtil.a $(LIBS) -o $@
24 + $(XLTLIB) ../util/libNUtil.a $(XMLIBS) $(LIBS) -o $@
26 -# Note LIBS isn't quite right here; it links unnecessarily against Motif
27 -nc: nc.o server_common.o ../util/libNUtil.a
28 - $(CC) $(CFLAGS) nc.o server_common.o ../util/libNUtil.a $(LIBS) -o $@
29 +nc: nc.o server_common.o \
30 + ../util/fileUtils.o \
31 + ../util/utils.o \
32 + ../util/prefFile.o \
33 + ../util/wmdesktop.o \
34 + ../util/clearcase.o
35 + $(CC) $(CFLAGS) $^ $(LIBS) -o $@
37 help.o: help.c
38 $(CC) $(CFLAGS) $(BIGGER_STRINGS) -c help.c -o $@
39 diff --quilt old/util/Makefile.common new/util/Makefile.common
40 --- old/util/Makefile.common
41 +++ new/util/Makefile.common
42 @@ -5,7 +5,8 @@
45 OBJS = DialogF.o getfiles.o printUtils.o misc.o fileUtils.o \
46 - prefFile.o fontsel.o managedList.o utils.o clearcase.o motif.o
47 + prefFile.o fontsel.o managedList.o utils.o clearcase.o motif.o \
48 + wmdesktop.o
50 all: libNUtil.a
52 diff --quilt old/util/Makefile.dependencies new/util/Makefile.dependencies
53 --- old/util/Makefile.dependencies
54 +++ new/util/Makefile.dependencies
55 @@ -10,3 +10,4 @@ prefFile.o: prefFile.c prefFile.h fileUt
56 printUtils.o: printUtils.c printUtils.h DialogF.h misc.h prefFile.h
57 utils.o: utils.c utils.h
58 vmsUtils.o: vmsUtils.c
59 +wmdesktop.o: wmdesktop.c wmdesktop.h
60 diff --quilt old/util/misc.c new/util/misc.c
61 --- old/util/misc.c
62 +++ new/util/misc.c
63 @@ -2201,70 +2201,6 @@ void CloseAllPopupsFor(Widget shell)
64 #endif
67 -static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
69 - long deskTopNumber = 0;
70 - Atom actualType;
71 - int actualFormat;
72 - unsigned long nItems, bytesAfter;
73 - unsigned char *prop;
75 - if (XGetWindowProperty(display, window, deskTopAtom, 0, 1,
76 - False, AnyPropertyType, &actualType, &actualFormat, &nItems,
77 - &bytesAfter, &prop) != Success) {
78 - return -1; /* Property not found */
79 - }
81 - if (actualType == None) {
82 - return -1; /* Property does not exist */
83 - }
85 - if (actualFormat != 32 || nItems != 1) {
86 - XFree((char*)prop);
87 - return -1; /* Wrong format */
88 - }
90 - deskTopNumber = *(long*)prop;
91 - XFree((char*)prop);
92 - return deskTopNumber;
95 -/*
96 -** Returns the current desktop number, or -1 if no desktop information
97 -** is available.
98 -*/
99 -long QueryCurrentDesktop(Display *display, Window rootWindow)
101 - static Atom currentDesktopAtom = (Atom)-1;
103 - if (currentDesktopAtom == (Atom)-1)
104 - currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
106 - if (currentDesktopAtom != None)
107 - return queryDesktop(display, rootWindow, currentDesktopAtom);
109 - return -1; /* No desktop information */
113 -** Returns the number of the desktop the given shell window is currently on,
114 -** or -1 if no desktop information is available. Note that windows shown
115 -** on all desktops (sometimes called sticky windows) should return 0xFFFFFFFF.
117 -long QueryDesktop(Display *display, Widget shell)
119 - static Atom wmDesktopAtom = (Atom)-1;
121 - if (wmDesktopAtom == (Atom)-1)
122 - wmDesktopAtom = XInternAtom(display, "_NET_WM_DESKTOP", True);
124 - if (wmDesktopAtom != None)
125 - return queryDesktop(display, XtWindow(shell), wmDesktopAtom);
127 - return -1; /* No desktop information */
132 ** Clipboard wrapper functions that call the Motif clipboard functions
133 ** a number of times before giving up. The interfaces are similar to the
134 diff --quilt old/util/misc.h new/util/misc.h
135 --- old/util/misc.h
136 +++ new/util/misc.h
137 @@ -28,6 +28,8 @@
138 #ifndef NEDIT_MISC_H_INCLUDED
139 #define NEDIT_MISC_H_INCLUDED
141 +#include "wmdesktop.h"
143 #include <X11/Intrinsic.h>
144 #include <Xm/Xm.h>
145 #include <Xm/CutPaste.h>
146 @@ -126,8 +128,6 @@ void InstallMouseWheelActions(XtAppConte
147 void AddMouseWheelSupport(Widget w);
148 void RadioButtonChangeState(Widget widget, Boolean state, Boolean notify);
149 void CloseAllPopupsFor(Widget shell);
150 -long QueryCurrentDesktop(Display *display, Window rootWindow);
151 -long QueryDesktop(Display *display, Widget shell);
152 int SpinClipboardStartCopy(Display *display, Window window,
153 XmString clip_label, Time timestamp, Widget widget,
154 XmCutPasteProc callback, long *item_id);
155 diff --quilt old/makefiles/Makefile.bertw new/makefiles/Makefile.bertw
156 --- old/makefiles/Makefile.bertw
157 +++ new/makefiles/Makefile.bertw
158 @@ -47,7 +47,8 @@ endif
160 ARFLAGS=-urs
162 -LIBS += -lXm -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
163 +LIBS += -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
164 +XMLIBS += -lXm
166 ifdef OM231
167 OM23=1
168 @@ -59,8 +60,8 @@ endif
170 ifdef OM23
171 CFLAGS += -I/home/$(USER)/opt/openmotif-2.3.$(OM23)/include
172 - LIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
173 - LIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
174 + XMLIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
175 + XMLIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
176 endif
178 include Makefile.common
179 diff --quilt /dev/null new/util/wmdesktop.c
180 --- /dev/null
181 +++ new/util/wmdesktop.c
182 @@ -0,0 +1,113 @@
183 +static const char CVSID[] = "$Id";
184 +/*******************************************************************************
185 +* *
186 +* wmdesktop.c -- Query WM Desktop *
187 +* *
188 +* Copyright (C) 1999 Mark Edel *
189 +* *
190 +* This is free software; you can redistribute it and/or modify it under the *
191 +* terms of the GNU General Public License as published by the Free Software *
192 +* Foundation; either version 2 of the License, or (at your option) any later *
193 +* version. In addition, you may distribute version of this program linked to *
194 +* Motif or Open Motif. See README for details. *
195 +* *
196 +* This software is distributed in the hope that it will be useful, but WITHOUT *
197 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
198 +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
199 +* for more details. *
200 +* *
201 +* You should have received a copy of the GNU General Public License along with *
202 +* software; if not, write to the Free Software Foundation, Inc., 59 Temple *
203 +* Place, Suite 330, Boston, MA 02111-1307 USA *
204 +* *
205 +* Nirvana Text Editor *
206 +* July 28, 1992 *
207 +* *
208 +* Written by Mark Edel *
209 +* *
210 +*******************************************************************************/
212 +#ifdef HAVE_CONFIG_H
213 +#include "../config.h"
214 +#endif
216 +#include "wmdesktop.h"
218 +#include <stdlib.h>
219 +#include <string.h>
220 +#include <stdarg.h>
221 +#include <ctype.h>
222 +#include <stdio.h>
223 +#include <time.h>
225 +#include <X11/Intrinsic.h>
226 +#include <X11/Xatom.h>
227 +#include <X11/keysym.h>
228 +#include <X11/keysymdef.h>
230 +#ifdef HAVE_DEBUG_H
231 +#include "../debug.h"
232 +#endif
234 +static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
236 + long deskTopNumber = 0;
237 + Atom actualType;
238 + int actualFormat;
239 + unsigned long nItems, bytesAfter;
240 + unsigned char *prop;
242 + if (XGetWindowProperty(display, window, deskTopAtom, 0, 1,
243 + False, AnyPropertyType, &actualType, &actualFormat, &nItems,
244 + &bytesAfter, &prop) != Success) {
245 + return -1; /* Property not found */
248 + if (actualType == None) {
249 + return -1; /* Property does not exist */
252 + if (actualFormat != 32 || nItems != 1) {
253 + XFree((char*)prop);
254 + return -1; /* Wrong format */
257 + deskTopNumber = *(long*)prop;
258 + XFree((char*)prop);
259 + return deskTopNumber;
263 +** Returns the current desktop number, or -1 if no desktop information
264 +** is available.
266 +long QueryCurrentDesktop(Display *display, Window rootWindow)
268 + static Atom currentDesktopAtom = (Atom)-1;
270 + if (currentDesktopAtom == (Atom)-1)
271 + currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
273 + if (currentDesktopAtom != None)
274 + return queryDesktop(display, rootWindow, currentDesktopAtom);
276 + return -1; /* No desktop information */
280 +** Returns the number of the desktop the given shell window is currently on,
281 +** or -1 if no desktop information is available. Note that windows shown
282 +** on all desktops (sometimes called sticky windows) should return 0xFFFFFFFF.
284 +long QueryDesktop(Display *display, Widget shell)
286 + static Atom wmDesktopAtom = (Atom)-1;
288 + if (wmDesktopAtom == (Atom)-1)
289 + wmDesktopAtom = XInternAtom(display, "_NET_WM_DESKTOP", True);
291 + if (wmDesktopAtom != None)
292 + return queryDesktop(display, XtWindow(shell), wmDesktopAtom);
294 + return -1; /* No desktop information */
296 diff --quilt /dev/null new/util/wmdesktop.h
297 --- /dev/null
298 +++ new/util/wmdesktop.h
299 @@ -0,0 +1,36 @@
300 +/* $Id$ */
301 +/*******************************************************************************
302 +* *
303 +* wmdesktop.h -- Nirvana Editor Query WM Desktop *
304 +* *
305 +* Copyright 2004 The NEdit Developers *
306 +* *
307 +* This is free software; you can redistribute it and/or modify it under the *
308 +* terms of the GNU General Public License as published by the Free Software *
309 +* Foundation; either version 2 of the License, or (at your option) any later *
310 +* version. In addition, you may distribute versions of this program linked to *
311 +* Motif or Open Motif. See README for details. *
312 +* *
313 +* This software is distributed in the hope that it will be useful, but WITHOUT *
314 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
315 +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
316 +* more details. *
317 +* *
318 +* You should have received a copy of the GNU General Public License along with *
319 +* software; if not, write to the Free Software Foundation, Inc., 59 Temple *
320 +* Place, Suite 330, Boston, MA 02111-1307 USA *
321 +* *
322 +* Nirvana Text Editor *
323 +* July 31, 2001 *
324 +* *
325 +*******************************************************************************/
327 +#ifndef NEDIT_WMDESKTOP_H_INCLUDED
328 +#define NEDIT_WMDESKTOP_H_INCLUDED
330 +#include <X11/Intrinsic.h>
332 +long QueryCurrentDesktop(Display *display, Window rootWindow);
333 +long QueryDesktop(Display *display, Widget shell);
335 +#endif /* NEDIT_WMDESKTOP_H_INCLUDED */
336 diff --quilt old/source/nc.c new/source/nc.c
337 --- old/source/nc.c
338 +++ new/source/nc.c
339 @@ -36,7 +36,7 @@ static const char CVSID[] = "$Id: nc.c,v
340 #include "../util/utils.h"
341 #include "../util/prefFile.h"
342 #include "../util/system.h"
343 -#include "../util/misc.h"
344 +#include "../util/wmdesktop.h"
346 #include <stdio.h>
347 #include <stdlib.h>
348 diff --quilt old/source/server_common.c new/source/server_common.c
349 --- old/source/server_common.c
350 +++ new/source/server_common.c
351 @@ -35,10 +35,12 @@
352 #include <sys/param.h>
353 #endif
354 #endif /*VMS*/
355 -#include "nedit.h"
356 #include "server_common.h"
357 #include "../util/utils.h"
359 +/* comes from nc.c or nedit.c */
360 +extern Display *TheDisplay;
363 * Create the server property atoms for the server with serverName.
364 * Atom names are generated as follows:
365 diff --quilt old/util/prefFile.c new/util/prefFile.c
366 --- old/util/prefFile.c
367 +++ new/util/prefFile.c
368 @@ -45,7 +45,7 @@ static const char CVSID[] = "$Id: prefFi
369 #include <sys/param.h>
370 #endif
371 #endif
372 -#include <Xm/Xm.h>
373 +#include <X11/IntrinsicI.h>
375 #ifdef HAVE_DEBUG_H
376 #include "../debug.h"
377 @@ -217,14 +217,14 @@ static void readPrefs(XrmDatabase prefDB
378 sprintf(rsrcClass, "%s.%s", appClass, rsrcDescrip[i].class);
379 if (prefDB!=NULL &&
380 XrmGetResource(prefDB, rsrcName, rsrcClass, &type, &rsrcValue)) {
381 - if (strcmp(type, XmRString)) {
382 + if (strcmp(type, XtRString)) {
383 fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n",
384 type);
385 return;
387 valueString = rsrcValue.addr;
388 } else if (XrmGetResource(appDB,rsrcName,rsrcClass,&type,&rsrcValue)) {
389 - if (strcmp(type, XmRString)) {
390 + if (strcmp(type, XtRString)) {
391 fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n",
392 type);
393 return;