3 makefiles/Makefile.bertw | 7 +-
4 source/Makefile.common | 12 +++-
6 source/server_common.c | 4 +
7 util/Makefile.common | 3 -
8 util/Makefile.dependencies | 1
9 util/misc.c | 64 -------------------------
11 util/prefFile.c | 7 +-
12 util/wmdesktop.c | 113 +++++++++++++++++++++++++++++++++++++++++++++
13 util/wmdesktop.h | 36 ++++++++++++++
14 11 files changed, 174 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 \
32 + ../util/prefFile.o \
33 + ../util/wmdesktop.o \
35 + $(CC) $(CFLAGS) $^ $(LIBS) -o $@
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
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 \
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
63 @@ -2201,70 +2201,6 @@ void CloseAllPopupsFor(Widget shell)
67 -static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
69 - long deskTopNumber = 0;
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 */
81 - if (actualType == None) {
82 - return -1; /* Property does not exist */
85 - if (actualFormat != 32 || nItems != 1) {
87 - return -1; /* Wrong format */
90 - deskTopNumber = *(long*)prop;
92 - return deskTopNumber;
96 -** Returns the current desktop number, or -1 if no desktop information
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
138 #ifndef NEDIT_MISC_H_INCLUDED
139 #define NEDIT_MISC_H_INCLUDED
141 +#include "wmdesktop.h"
143 #include <X11/Intrinsic.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
162 -LIBS += -lXm -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
163 +LIBS += -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
168 @@ -59,8 +60,8 @@ endif
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
178 include Makefile.common
179 diff --quilt /dev/null new/util/wmdesktop.c
181 +++ new/util/wmdesktop.c
183 +static const char CVSID[] = "$Id";
184 +/*******************************************************************************
186 +* wmdesktop.c -- Query WM Desktop *
188 +* Copyright (C) 1999 Mark Edel *
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. *
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. *
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 *
205 +* Nirvana Text Editor *
208 +* Written by Mark Edel *
210 +*******************************************************************************/
212 +#ifdef HAVE_CONFIG_H
213 +#include "../config.h"
216 +#include "wmdesktop.h"
225 +#include <X11/Intrinsic.h>
226 +#include <X11/Xatom.h>
227 +#include <X11/keysym.h>
228 +#include <X11/keysymdef.h>
231 +#include "../debug.h"
234 +static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
236 + long deskTopNumber = 0;
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
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
298 +++ new/util/wmdesktop.h
301 +/*******************************************************************************
303 +* wmdesktop.h -- Nirvana Editor Query WM Desktop *
305 +* Copyright 2004 The NEdit Developers *
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. *
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 *
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 *
322 +* Nirvana Text Editor *
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
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"
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
352 #include <sys/param.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,8 @@ static const char CVSID[] = "$Id: prefFi
369 #include <sys/param.h>
373 +#include <X11/Intrinsic.h>
374 +#include <X11/StringDefs.h>
377 #include "../debug.h"
378 @@ -217,14 +218,14 @@ static void readPrefs(XrmDatabase prefDB
379 sprintf(rsrcClass, "%s.%s", appClass, rsrcDescrip[i].class);
381 XrmGetResource(prefDB, rsrcName, rsrcClass, &type, &rsrcValue)) {
382 - if (strcmp(type, XmRString)) {
383 + if (strcmp(type, XtRString)) {
384 fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n",
388 valueString = rsrcValue.addr;
389 } else if (XrmGetResource(appDB,rsrcName,rsrcClass,&type,&rsrcValue)) {
390 - if (strcmp(type, XmRString)) {
391 + if (strcmp(type, XtRString)) {
392 fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n",