Skip to content

Commit 69239d3

Browse files
committed
Workspace/WM/properties.c: rename functions.
1 parent 8835f66 commit 69239d3

File tree

12 files changed

+64
-55
lines changed

12 files changed

+64
-55
lines changed

Applications/Workspace/WM/application.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static WWindow *makeMainWindow(WScreen *scr, Window window)
189189
wwin->main_window = window;
190190
wwin->wm_hints = XGetWMHints(dpy, window);
191191

192-
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
192+
wPropertiesGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
193193
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "GNUstep") == 0)
194194
wwin->flags.is_gnustep = 1;
195195

Applications/Workspace/WM/client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ void wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
549549

550550
default:
551551
if (event->atom == w_global.atom.wm.protocols) {
552-
PropGetProtocols(wwin->client_win, &wwin->protocols);
552+
wPropGetProtocols(wwin->client_win, &wwin->protocols);
553553

554554
// WM_TAKE_FOCUS
555555
if (wwin->protocols.TAKE_FOCUS)
@@ -612,7 +612,7 @@ void wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
612612
}
613613
} else if (event->atom == w_global.atom.gnustep.wm_attr) {
614614
GNUstepWMAttributes *attr;
615-
if (PropGetGNUstepWMAttr(wwin->client_win, &attr) != False) {
615+
if (wPropertiesGetGNUstepWMAttr(wwin->client_win, &attr) != False) {
616616
wWindowUpdateGNUstepAttr(wwin, attr);
617617
XFree(attr);
618618
}
@@ -643,7 +643,7 @@ void wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geom
643643
if (!wwin->normal_hints)
644644
wwin->normal_hints = XAllocSizeHints();
645645

646-
if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
646+
if (!wPropertiesGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
647647
wwin->normal_hints->flags = 0;
648648
}
649649
*x = wattribs->x;

Applications/Workspace/WM/dock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3034,7 +3034,7 @@ void wDockTrackWindowLaunch(WDock *dock, Window window)
30343034
Bool found = False;
30353035
char *command = NULL;
30363036

3037-
if (!PropGetWMClass(window, &wm_class, &wm_instance)) {
3037+
if (!wPropertiesGetWMClass(window, &wm_class, &wm_instance)) {
30383038
free(wm_class);
30393039
free(wm_instance);
30403040
return;

Applications/Workspace/WM/motif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int getMWMHints(Window window, MWMHints *mwmhints)
169169
if (!_XA_MOTIF_WM_HINTS)
170170
_XA_MOTIF_WM_HINTS = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
171171

172-
data = (unsigned long *)PropGetCheckProperty(window, _XA_MOTIF_WM_HINTS, _XA_MOTIF_WM_HINTS, 32,
172+
data = (unsigned long *)wPropertiesGetWindowProperty(window, _XA_MOTIF_WM_HINTS, _XA_MOTIF_WM_HINTS, 32,
173173
0, &count);
174174

175175
if (!data)

Applications/Workspace/WM/properties.c

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <X11/Xatom.h>
2828
#include <string.h>
2929
#include <stdlib.h>
30+
#include <unistd.h>
3031

3132
#include <core/util.h>
3233
#include <core/log_utils.h>
@@ -36,7 +37,7 @@
3637
#include "GNUstep.h"
3738
#include "properties.h"
3839

39-
int PropGetNormalHints(Window window, XSizeHints *size_hints, int *pre_iccm)
40+
int wPropertiesGetNormalHints(Window window, XSizeHints *size_hints, int *pre_iccm)
4041
{
4142
long supplied_hints;
4243

@@ -52,7 +53,7 @@ int PropGetNormalHints(Window window, XSizeHints *size_hints, int *pre_iccm)
5253
return True;
5354
}
5455

55-
int PropGetWMClass(Window window, char **wm_class, char **wm_instance)
56+
int wPropertiesGetWMClass(Window window, char **wm_class, char **wm_instance)
5657
{
5758
XClassHint *class_hint;
5859

@@ -73,7 +74,7 @@ int PropGetWMClass(Window window, char **wm_class, char **wm_instance)
7374
return True;
7475
}
7576

76-
void PropGetProtocols(Window window, WProtocols *prots)
77+
void wPropGetProtocols(Window window, WProtocols *prots)
7778
{
7879
Atom *protocols;
7980
int count, i;
@@ -97,7 +98,7 @@ void PropGetProtocols(Window window, WProtocols *prots)
9798
XFree(protocols);
9899
}
99100

100-
unsigned char *PropGetCheckProperty(Window window, Atom hint, Atom type, int format, int count,
101+
unsigned char *wPropertiesGetWindowProperty(Window window, Atom hint, Atom type, int format, int count,
101102
int *retCount)
102103
{
103104
Atom type_ret;
@@ -129,11 +130,11 @@ unsigned char *PropGetCheckProperty(Window window, Atom hint, Atom type, int for
129130
return data;
130131
}
131132

132-
int PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
133+
int wPropertiesGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
133134
{
134135
unsigned long *data;
135136

136-
data = (unsigned long *)PropGetCheckProperty(window, w_global.atom.gnustep.wm_attr,
137+
data = (unsigned long *)wPropertiesGetWindowProperty(window, w_global.atom.gnustep.wm_attr,
137138
w_global.atom.gnustep.wm_attr, 32, 9, NULL);
138139

139140
if (!data)
@@ -159,23 +160,25 @@ int PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
159160
return True;
160161
}
161162

162-
void PropSetWMakerProtocols(Window root)
163+
void wPropertiesSetWMakerProtocols(Window root)
163164
{
164-
Atom protocols[3];
165+
// Atom protocols[3];
166+
Atom protocols[1];
165167
int count = 0;
166168

167-
protocols[count++] = w_global.atom.wmaker.menu;
169+
// protocols[count++] = w_global.atom.wmaker.menu;
170+
// protocols[count++] = w_global.atom.wmaker.noticeboard;
168171
protocols[count++] = w_global.atom.wmaker.wm_function;
169-
protocols[count++] = w_global.atom.wmaker.noticeboard;
170172

171173
XChangeProperty(dpy, root, w_global.atom.wmaker.wm_protocols, XA_ATOM, 32, PropModeReplace,
172174
(unsigned char *)protocols, count);
173175
}
174176

175-
void PropSetWMName(WScreen *scr, char *name, char *class)
177+
void wPropertiesSetWMName(WScreen *scr, char *name, char *class)
176178
{
177179
static Atom wm_name_atom = 0;
178180
static Atom wm_class_atom = 0;
181+
static Atom wm_pid_atom = 0;
179182

180183
if (scr->info_window == None)
181184
return;
@@ -186,6 +189,12 @@ void PropSetWMName(WScreen *scr, char *name, char *class)
186189
wm_class_atom = XInternAtom(dpy, "WM_CLASS", False);
187190
XChangeProperty(dpy, scr->info_window, wm_class_atom, XA_STRING, 8, PropModeReplace,
188191
(unsigned char *)class, strlen(class));
192+
wm_pid_atom = XInternAtom(dpy, "_NET_WM_PID", False);
193+
194+
unsigned long pid = getpid();
195+
CFLog(kCFLogLevelInfo, CFSTR("WorkspaceManager PID: %i"), pid);
196+
XChangeProperty(dpy, scr->info_window, wm_pid_atom, XA_CARDINAL, 32, PropModeReplace,
197+
(unsigned char *)&pid, 1L);
189198
}
190199

191200
#if 0
@@ -239,12 +248,12 @@ void PropSetIconTileHint(WScreen *scr, RImage *image)
239248
}
240249
#endif
241250

242-
Window PropGetClientLeader(Window window)
251+
Window wPropertiesGetClientLeader(Window window)
243252
{
244253
Window *win;
245254
Window leader;
246255

247-
win = (Window *)PropGetCheckProperty(window, w_global.atom.wm.client_leader, XA_WINDOW, 32, 1,
256+
win = (Window *)wPropertiesGetWindowProperty(window, w_global.atom.wm.client_leader, XA_WINDOW, 32, 1,
248257
NULL);
249258

250259
if (!win)
@@ -256,12 +265,12 @@ Window PropGetClientLeader(Window window)
256265
return leader;
257266
}
258267

259-
int PropGetWindowState(Window window)
268+
int wPropertiesGetWindowState(Window window)
260269
{
261270
long *data;
262271
long state;
263272

264-
data = (long *)PropGetCheckProperty(window, w_global.atom.wm.state, w_global.atom.wm.state, 32, 1,
273+
data = (long *)wPropertiesGetWindowProperty(window, w_global.atom.wm.state, w_global.atom.wm.state, 32, 1,
265274
NULL);
266275

267276
if (!data)
@@ -273,9 +282,9 @@ int PropGetWindowState(Window window)
273282
return state;
274283
}
275284

276-
void PropCleanUp(Window root)
285+
void wPropertiesCleanUp(Window root)
277286
{
287+
// XDeleteProperty(dpy, root, w_global.atom.wmaker.noticeboard);
278288
XDeleteProperty(dpy, root, w_global.atom.wmaker.wm_protocols);
279-
XDeleteProperty(dpy, root, w_global.atom.wmaker.noticeboard);
280289
XDeleteProperty(dpy, root, XA_WM_ICON_SIZE);
281290
}

Applications/Workspace/WM/properties.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@
2727
#include "GNUstep.h"
2828
#include "window.h"
2929

30-
unsigned char *PropGetCheckProperty(Window window, Atom hint, Atom type, int format, int count,
30+
unsigned char *wPropertiesGetWindowProperty(Window window, Atom hint, Atom type, int format, int count,
3131
int *retCount);
3232

33-
int PropGetWindowState(Window window);
33+
int wPropertiesGetWindowState(Window window);
3434

35-
int PropGetNormalHints(Window window, XSizeHints *size_hints, int *pre_iccm);
36-
void PropGetProtocols(Window window, WProtocols *prots);
37-
int PropGetWMClass(Window window, char **wm_class, char **wm_instance);
38-
int PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr);
35+
int wPropertiesGetNormalHints(Window window, XSizeHints *size_hints, int *pre_iccm);
36+
void wPropGetProtocols(Window window, WProtocols *prots);
37+
int wPropertiesGetWMClass(Window window, char **wm_class, char **wm_instance);
38+
int wPropertiesGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr);
3939

40-
void PropSetWMakerProtocols(Window root);
41-
void PropCleanUp(Window root);
42-
void PropSetWMName(WScreen *scr, char *name, char *class);
40+
void wPropertiesSetWMakerProtocols(Window root);
41+
void wPropertiesCleanUp(Window root);
42+
void wPropertiesSetWMName(WScreen *scr, char *name, char *class);
4343
// void PropSetIconTileHint(WScreen *scr, RImage *image);
4444

45-
Window PropGetClientLeader(Window window);
45+
Window wPropertiesGetClientLeader(Window window);
4646

4747
#endif /* __WORKSPACE_WM_PROPERTIES__ */

Applications/Workspace/WM/screen.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static Bool replace_existing_wm(WScreen *scr)
254254

255255
/* for our window manager info notice board and the selection owner */
256256
scr->info_window = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, 0, 0);
257-
PropSetWMName(scr, "WorkspaceManager", "NextSpace");
257+
wPropertiesSetWMName(scr, "WorkspaceManager", "NextSpace");
258258

259259
#ifdef USE_ICCCM_WMREPLACE
260260
/* Try to acquire the selection */
@@ -837,13 +837,13 @@ WScreen *wScreenInit(int screen_number)
837837
XSetIconSizes(dpy, scr->root_win, icon_size, 1);
838838

839839
/* setup WM protocols property in the root window */
840-
PropSetWMakerProtocols(scr->root_win);
840+
wPropertiesSetWMakerProtocols(scr->root_win);
841841

842842
/* setup our noticeboard */
843-
XChangeProperty(dpy, scr->info_window, w_global.atom.wmaker.noticeboard, XA_WINDOW, 32,
844-
PropModeReplace, (unsigned char *)&scr->info_window, 1);
845-
XChangeProperty(dpy, scr->root_win, w_global.atom.wmaker.noticeboard, XA_WINDOW, 32,
846-
PropModeReplace, (unsigned char *)&scr->info_window, 1);
843+
// XChangeProperty(dpy, scr->info_window, w_global.atom.wmaker.noticeboard, XA_WINDOW, 32,
844+
// PropModeReplace, (unsigned char *)&scr->info_window, 1);
845+
// XChangeProperty(dpy, scr->root_win, w_global.atom.wmaker.noticeboard, XA_WINDOW, 32,
846+
// PropModeReplace, (unsigned char *)&scr->info_window, 1);
847847

848848
#ifdef BALLOON_TEXT
849849
/* initialize balloon text stuff */

Applications/Workspace/WM/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static CFTypeRef makeWindowState(WWindow *wwin, WApplication *wapp)
171171
if (!command)
172172
return NULL;
173173

174-
if (PropGetWMClass(win, &class, &instance)) {
174+
if (wPropertiesGetWMClass(win, &class, &instance)) {
175175
if (class && instance) {
176176
name = CFStringCreateWithFormat(kCFAllocatorDefault, 0, CFSTR("%s.%s"), instance, class);
177177
} else if (instance) {

Applications/Workspace/WM/shutdown.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void wShutdown(WMShutdownMode mode)
112112

113113
wScreenSaveState(scr);
114114
wNETWMCleanup(scr); /* Delete _NET_* Atoms */
115-
PropCleanUp(scr->root_win); /* WM specific properties */
115+
wPropertiesCleanUp(scr->root_win); /* WM specific properties */
116116
XDeleteProperty(dpy, scr->root_win, XInternAtom(dpy, "_XROOTPMAP_ID", False));
117117
RShutdown(); /* wraster clean exit */
118118
#if HAVE_SYSLOG_H
@@ -187,7 +187,7 @@ void wRestoreDesktop(WScreen *scr)
187187
XUngrabServer(dpy);
188188
XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime);
189189
wColormapInstallForWindow(scr, NULL);
190-
PropCleanUp(scr->root_win);
190+
wPropertiesCleanUp(scr->root_win);
191191
wNETWMCleanup(scr);
192192
XSync(dpy, 0);
193193
}

Applications/Workspace/WM/startup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static void _initializeAtoms(void)
460460
w_global.atom.wmaker.state = XInternAtom(dpy, "_WINDOWMAKER_STATE", False);
461461
w_global.atom.wmaker.wm_protocols = XInternAtom(dpy, "_WINDOWMAKER_WM_PROTOCOLS", False);
462462
w_global.atom.wmaker.wm_function = XInternAtom(dpy, "_WINDOWMAKER_WM_FUNCTION", False);
463-
w_global.atom.wmaker.noticeboard = XInternAtom(dpy, "_WINDOWMAKER_NOTICEBOARD", False);
463+
// w_global.atom.wmaker.noticeboard = XInternAtom(dpy, "_WINDOWMAKER_NOTICEBOARD", False);
464464
w_global.atom.wmaker.command = XInternAtom(dpy, "_WINDOWMAKER_COMMAND", False);
465465
w_global.atom.wmaker.icon_size = XInternAtom(dpy, "_WINDOWMAKER_ICON_SIZE", False);
466466
w_global.atom.wmaker.icon_tile = XInternAtom(dpy, "_WINDOWMAKER_ICON_TILE", False);

0 commit comments

Comments
 (0)