3 makefiles/Makefile.bertw | 7 +-
4 source/Makefile.common | 12 +++-
6 util/Makefile.common | 3 -
7 util/Makefile.dependencies | 1
8 util/misc.c | 64 -------------------------
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 \
30 + ../util/prefFile.o \
31 + ../util/wmdesktop.o \
33 + $(CC) $(CFLAGS) $^ $(XLIBS) -o $@
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
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 \
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
61 @@ -2201,70 +2201,6 @@ void CloseAllPopupsFor(Widget shell)
65 -static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
67 - long deskTopNumber = 0;
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 */
79 - if (actualType == None) {
80 - return -1; /* Property does not exist */
83 - if (actualFormat != 32 || nItems != 1) {
85 - return -1; /* Wrong format */
88 - deskTopNumber = *(long*)prop;
90 - return deskTopNumber;
94 -** Returns the current desktop number, or -1 if no desktop information
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
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
151 -LIBS += -lXm -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
152 +XLIBS += -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm
157 @@ -59,8 +60,8 @@ endif
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
167 include Makefile.common
168 diff --quilt /dev/null new/util/wmdesktop.c
170 +++ new/util/wmdesktop.c
172 +static const char CVSID[] = "$Id";
173 +/*******************************************************************************
175 +* wmdesktop.c -- Query WM Desktop *
177 +* Copyright (C) 1999 Mark Edel *
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. *
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. *
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 *
194 +* Nirvana Text Editor *
197 +* Written by Mark Edel *
199 +*******************************************************************************/
201 +#ifdef HAVE_CONFIG_H
202 +#include "../config.h"
205 +#include "wmdesktop.h"
214 +#include <X11/Intrinsic.h>
215 +#include <X11/Xatom.h>
216 +#include <X11/keysym.h>
217 +#include <X11/keysymdef.h>
220 +#include "../debug.h"
223 +static long queryDesktop(Display *display, Window window, Atom deskTopAtom)
225 + long deskTopNumber = 0;
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
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
287 +++ new/util/wmdesktop.h
290 +/*******************************************************************************
292 +* wmdesktop.h -- Nirvana Editor Query WM Desktop *
294 +* Copyright 2004 The NEdit Developers *
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. *
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 *
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 *
311 +* Nirvana Text Editor *
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
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"