add motifless-nc.patch
[nedit-bw.git] / motifless-nc.patch
blob334bbc9e1389c3cb9d0457e45dca871cdeaad3f6
1 ---
3 makefiles/Makefile.bertw | 7 +-
4 source/Makefile.common | 12 +++-
5 source/nc.c | 2
6 util/Makefile.common | 3 -
7 util/Makefile.dependencies | 1
8 util/misc.c | 64 -------------------------
9 util/misc.h | 2
10 util/wmdesktop.c | 113 +++++++++++++++++++++++++++++++++++++++++++++
11 util/wmdesktop.h | 36 ++++++++++++++
12 9 files changed, 165 insertions(+), 75 deletions(-)
14 diff --quilt old/source/Makefile.common new/source/Makefile.common
15 --- old/source/Makefile.common
16 +++ new/source/Makefile.common
17 @@ -26,11 +26,15 @@ all: nedit nc
18 nedit: $(OBJS) ../util/libNUtil.a $(XMLLIB) $(XLTLIB)
19 $(CC) $(CFLAGS) -c linkdate.c
20 $(CC) $(CFLAGS) $(OBJS) linkdate.o $(XMLLIB) \
21 - $(XLTLIB) ../util/libNUtil.a $(LIBS) -o $@
22 + $(XLTLIB) ../util/libNUtil.a $(XMLIBS) $(XLIBS) -o $@
24 -# Note LIBS isn't quite right here; it links unnecessarily against Motif
25 -nc: nc.o server_common.o ../util/libNUtil.a
26 - $(CC) $(CFLAGS) nc.o server_common.o ../util/libNUtil.a $(LIBS) -o $@
27 +nc: nc.o server_common.o \
28 + ../util/fileUtils.o \
29 + ../util/utils.o \
30 + ../util/prefFile.o \
31 + ../util/wmdesktop.o \
32 + ../util/clearcase.o
33 + $(CC) $(CFLAGS) $^ $(XLIBS) -o $@
35 help.o: help.c
36 $(CC) $(CFLAGS) $(BIGGER_STRINGS) -c help.c -o $@
37 diff --quilt old/util/Makefile.common new/util/Makefile.common
38 --- old/util/Makefile.common
39 +++ new/util/Makefile.common
40 @@ -5,7 +5,8 @@
43 OBJS = DialogF.o getfiles.o printUtils.o misc.o fileUtils.o \
44 - prefFile.o fontsel.o managedList.o utils.o clearcase.o motif.o
45 + prefFile.o fontsel.o managedList.o utils.o clearcase.o motif.o \
46 + wmdesktop.o
48 all: libNUtil.a
50 diff --quilt old/util/Makefile.dependencies new/util/Makefile.dependencies
51 --- old/util/Makefile.dependencies
52 +++ new/util/Makefile.dependencies
53 @@ -10,3 +10,4 @@ prefFile.o: prefFile.c prefFile.h fileUt
54 printUtils.o: printUtils.c printUtils.h DialogF.h misc.h prefFile.h
55 utils.o: utils.c utils.h
56 vmsUtils.o: vmsUtils.c
57 +wmdesktop.o: wmdesktop.c wmdesktop.h
58 diff --quilt old/util/misc.c new/util/misc.c
59 --- old/util/misc.c
60 +++ new/util/misc.c
61 @@ -2201,70 +2201,6 @@ void CloseAllPopupsFor(Widget shell)
62 #endif
65 -static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
67 - long deskTopNumber = 0;
68 - Atom actualType;
69 - int actualFormat;
70 - unsigned long nItems, bytesAfter;
71 - unsigned char *prop;
73 - if (XGetWindowProperty(display, window, deskTopAtom, 0, 1,
74 - False, AnyPropertyType, &actualType, &actualFormat, &nItems,
75 - &bytesAfter, &prop) != Success) {
76 - return -1; /* Property not found */
77 - }
79 - if (actualType == None) {
80 - return -1; /* Property does not exist */
81 - }
83 - if (actualFormat != 32 || nItems != 1) {
84 - XFree((char*)prop);
85 - return -1; /* Wrong format */
86 - }
88 - deskTopNumber = *(long*)prop;
89 - XFree((char*)prop);
90 - return deskTopNumber;
93 -/*
94 -** Returns the current desktop number, or -1 if no desktop information
95 -** is available.
96 -*/
97 -long QueryCurrentDesktop(Display *display, Window rootWindow)
99 - static Atom currentDesktopAtom = (Atom)-1;
101 - if (currentDesktopAtom == (Atom)-1)
102 - currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
104 - if (currentDesktopAtom != None)
105 - return queryDesktop(display, rootWindow, currentDesktopAtom);
107 - return -1; /* No desktop information */
111 -** Returns the number of the desktop the given shell window is currently on,
112 -** or -1 if no desktop information is available. Note that windows shown
113 -** on all desktops (sometimes called sticky windows) should return 0xFFFFFFFF.
115 -long QueryDesktop(Display *display, Widget shell)
117 - static Atom wmDesktopAtom = (Atom)-1;
119 - if (wmDesktopAtom == (Atom)-1)
120 - wmDesktopAtom = XInternAtom(display, "_NET_WM_DESKTOP", True);
122 - if (wmDesktopAtom != None)
123 - return queryDesktop(display, XtWindow(shell), wmDesktopAtom);
125 - return -1; /* No desktop information */
130 ** Clipboard wrapper functions that call the Motif clipboard functions
131 ** a number of times before giving up. The interfaces are similar to the
132 diff --quilt old/util/misc.h new/util/misc.h
133 --- old/util/misc.h
134 +++ new/util/misc.h
135 @@ -126,8 +126,6 @@ void InstallMouseWheelActions(XtAppConte
136 void AddMouseWheelSupport(Widget w);
137 void RadioButtonChangeState(Widget widget, Boolean state, Boolean notify);
138 void CloseAllPopupsFor(Widget shell);
139 -long QueryCurrentDesktop(Display *display, Window rootWindow);
140 -long QueryDesktop(Display *display, Widget shell);
141 int SpinClipboardStartCopy(Display *display, Window window,
142 XmString clip_label, Time timestamp, Widget widget,
143 XmCutPasteProc callback, long *item_id);
144 diff --quilt old/makefiles/Makefile.bertw new/makefiles/Makefile.bertw
145 --- old/makefiles/Makefile.bertw
146 +++ new/makefiles/Makefile.bertw
147 @@ -47,7 +47,8 @@ endif
149 ARFLAGS=-urs
151 -LIBS += -lXm -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
152 +XLIBS += -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
153 +XMLIBS += -lXm
155 ifdef OM231
156 OM23=1
157 @@ -59,8 +60,8 @@ endif
159 ifdef OM23
160 CFLAGS += -I/home/$(USER)/opt/openmotif-2.3.$(OM23)/include
161 - LIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
162 - LIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
163 + XMLIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
164 + XMLIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib
165 endif
167 include Makefile.common
168 diff --quilt /dev/null new/util/wmdesktop.c
169 --- /dev/null
170 +++ new/util/wmdesktop.c
171 @@ -0,0 +1,113 @@
172 +static const char CVSID[] = "$Id";
173 +/*******************************************************************************
174 +* *
175 +* wmdesktop.c -- Query WM Desktop *
176 +* *
177 +* Copyright (C) 1999 Mark Edel *
178 +* *
179 +* This is free software; you can redistribute it and/or modify it under the *
180 +* terms of the GNU General Public License as published by the Free Software *
181 +* Foundation; either version 2 of the License, or (at your option) any later *
182 +* version. In addition, you may distribute version of this program linked to *
183 +* Motif or Open Motif. See README for details. *
184 +* *
185 +* This software is distributed in the hope that it will be useful, but WITHOUT *
186 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
187 +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
188 +* for more details. *
189 +* *
190 +* You should have received a copy of the GNU General Public License along with *
191 +* software; if not, write to the Free Software Foundation, Inc., 59 Temple *
192 +* Place, Suite 330, Boston, MA 02111-1307 USA *
193 +* *
194 +* Nirvana Text Editor *
195 +* July 28, 1992 *
196 +* *
197 +* Written by Mark Edel *
198 +* *
199 +*******************************************************************************/
201 +#ifdef HAVE_CONFIG_H
202 +#include "../config.h"
203 +#endif
205 +#include "wmdesktop.h"
207 +#include <stdlib.h>
208 +#include <string.h>
209 +#include <stdarg.h>
210 +#include <ctype.h>
211 +#include <stdio.h>
212 +#include <time.h>
214 +#include <X11/Intrinsic.h>
215 +#include <X11/Xatom.h>
216 +#include <X11/keysym.h>
217 +#include <X11/keysymdef.h>
219 +#ifdef HAVE_DEBUG_H
220 +#include "../debug.h"
221 +#endif
223 +static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
225 + long deskTopNumber = 0;
226 + Atom actualType;
227 + int actualFormat;
228 + unsigned long nItems, bytesAfter;
229 + unsigned char *prop;
231 + if (XGetWindowProperty(display, window, deskTopAtom, 0, 1,
232 + False, AnyPropertyType, &actualType, &actualFormat, &nItems,
233 + &bytesAfter, &prop) != Success) {
234 + return -1; /* Property not found */
237 + if (actualType == None) {
238 + return -1; /* Property does not exist */
241 + if (actualFormat != 32 || nItems != 1) {
242 + XFree((char*)prop);
243 + return -1; /* Wrong format */
246 + deskTopNumber = *(long*)prop;
247 + XFree((char*)prop);
248 + return deskTopNumber;
252 +** Returns the current desktop number, or -1 if no desktop information
253 +** is available.
255 +long QueryCurrentDesktop(Display *display, Window rootWindow)
257 + static Atom currentDesktopAtom = (Atom)-1;
259 + if (currentDesktopAtom == (Atom)-1)
260 + currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
262 + if (currentDesktopAtom != None)
263 + return queryDesktop(display, rootWindow, currentDesktopAtom);
265 + return -1; /* No desktop information */
269 +** Returns the number of the desktop the given shell window is currently on,
270 +** or -1 if no desktop information is available. Note that windows shown
271 +** on all desktops (sometimes called sticky windows) should return 0xFFFFFFFF.
273 +long QueryDesktop(Display *display, Widget shell)
275 + static Atom wmDesktopAtom = (Atom)-1;
277 + if (wmDesktopAtom == (Atom)-1)
278 + wmDesktopAtom = XInternAtom(display, "_NET_WM_DESKTOP", True);
280 + if (wmDesktopAtom != None)
281 + return queryDesktop(display, XtWindow(shell), wmDesktopAtom);
283 + return -1; /* No desktop information */
285 diff --quilt /dev/null new/util/wmdesktop.h
286 --- /dev/null
287 +++ new/util/wmdesktop.h
288 @@ -0,0 +1,36 @@
289 +/* $Id$ */
290 +/*******************************************************************************
291 +* *
292 +* wmdesktop.h -- Nirvana Editor Query WM Desktop *
293 +* *
294 +* Copyright 2004 The NEdit Developers *
295 +* *
296 +* This is free software; you can redistribute it and/or modify it under the *
297 +* terms of the GNU General Public License as published by the Free Software *
298 +* Foundation; either version 2 of the License, or (at your option) any later *
299 +* version. In addition, you may distribute versions of this program linked to *
300 +* Motif or Open Motif. See README for details. *
301 +* *
302 +* This software is distributed in the hope that it will be useful, but WITHOUT *
303 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
304 +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
305 +* more details. *
306 +* *
307 +* You should have received a copy of the GNU General Public License along with *
308 +* software; if not, write to the Free Software Foundation, Inc., 59 Temple *
309 +* Place, Suite 330, Boston, MA 02111-1307 USA *
310 +* *
311 +* Nirvana Text Editor *
312 +* July 31, 2001 *
313 +* *
314 +*******************************************************************************/
316 +#ifndef NEDIT_WMDESKTOP_H_INCLUDED
317 +#define NEDIT_WMDESKTOP_H_INCLUDED
319 +#include <X11/Intrinsic.h>
321 +long QueryCurrentDesktop(Display *display, Window rootWindow);
322 +long QueryDesktop(Display *display, Widget shell);
324 +#endif /* NEDIT_WMDESKTOP_H_INCLUDED */
325 diff --quilt old/source/nc.c new/source/nc.c
326 --- old/source/nc.c
327 +++ new/source/nc.c
328 @@ -36,7 +36,7 @@ static const char CVSID[] = "$Id: nc.c,v
329 #include "../util/utils.h"
330 #include "../util/prefFile.h"
331 #include "../util/system.h"
332 -#include "../util/misc.h"
333 +#include "../util/wmdesktop.h"
335 #include <stdio.h>
336 #include <stdlib.h>