1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-02 14:15:46 +01:00

changed indentation to use spaces only

This commit is contained in:
dan
2004-10-12 21:28:27 +00:00
parent 5912898b06
commit 6830b05716
240 changed files with 35951 additions and 35773 deletions

View File

@@ -1,18 +1,18 @@
/*
/*
* WindowMaker interface definitions
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -78,29 +78,29 @@ typedef struct {
* range INT_MIN+1 to INT_MAX
*/
enum {
WMDesktopWindowLevel = -1000, /* GNUstep addition */
WMNormalWindowLevel = 0,
WMFloatingWindowLevel = 3,
WMSubmenuWindowLevel = 3,
WMTornOffMenuWindowLevel = 3,
WMMainMenuWindowLevel = 20,
WMDockWindowLevel = 21, /* Deprecated - use NSStatusWindowLevel */
WMStatusWindowLevel = 21,
WMModalPanelWindowLevel = 100,
WMPopUpMenuWindowLevel = 101,
WMScreenSaverWindowLevel = 1000
WMDesktopWindowLevel = -1000, /* GNUstep addition */
WMNormalWindowLevel = 0,
WMFloatingWindowLevel = 3,
WMSubmenuWindowLevel = 3,
WMTornOffMenuWindowLevel = 3,
WMMainMenuWindowLevel = 20,
WMDockWindowLevel = 21, /* Deprecated - use NSStatusWindowLevel */
WMStatusWindowLevel = 21,
WMModalPanelWindowLevel = 100,
WMPopUpMenuWindowLevel = 101,
WMScreenSaverWindowLevel = 1000
};
/* window attributes */
enum {
WMBorderlessWindowMask = 0,
WMTitledWindowMask = 1,
WMClosableWindowMask = 2,
WMMiniaturizableWindowMask = 4,
WMResizableWindowMask = 8,
WMIconWindowMask = 64,
WMMiniWindowMask = 128
WMBorderlessWindowMask = 0,
WMTitledWindowMask = 1,
WMClosableWindowMask = 2,
WMMiniaturizableWindowMask = 4,
WMResizableWindowMask = 8,
WMIconWindowMask = 64,
WMMiniWindowMask = 128
};
#endif
@@ -116,7 +116,7 @@ int WMProcessEvent(WMAppContext *app, XEvent *event);
WMAppContext *WMAppCreateWithMain(Display *display, int screen_number,
Window main_window);
Window main_window);
WMAppContext *WMAppCreate(Display *display, int screen_number);
@@ -128,8 +128,8 @@ int WMAppSetMainMenu(WMAppContext *app, WMMenu *menu);
int WMRealizeMenus(WMAppContext *app);
void WMSetWindowAttributes(Display *dpy, Window window,
GNUstepWMAttributes *attributes);
void WMSetWindowAttributes(Display *dpy, Window window,
GNUstepWMAttributes *attributes);
void WMHideApplication(WMAppContext *app);
@@ -141,10 +141,10 @@ void WMHideOthers(WMAppContext *app);
WMMenu *WMMenuCreate(WMAppContext *app, char *title);
int WMMenuAddItem(WMMenu *menu, char *text, WMMenuAction action,
void *clientData, WMFreeFunction freedata, char *rtext);
void *clientData, WMFreeFunction freedata, char *rtext);
int WMMenuInsertItem(WMMenu *menu, int index, char *text,
WMMenuAction *action, char *rtext);
int WMMenuInsertItem(WMMenu *menu, int index, char *text,
WMMenuAction *action, char *rtext);
int WMMenuRemoveItem(WMMenu *menu, int index);

View File

@@ -1,19 +1,19 @@
/* app.c - application context stuff
*
*
* WMlib - WindowMaker application programming interface
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -32,39 +32,39 @@ WMAppContext*
WMAppCreateWithMain(Display *display, int screen_number, Window main_window)
{
wmAppContext *ctx;
ctx = malloc(sizeof(wmAppContext));
if (!ctx)
return NULL;
return NULL;
ctx->dpy = display;
ctx->screen_number = screen_number;
ctx->our_leader_hint = False;
ctx->main_window = main_window;
ctx->windows = malloc(sizeof(Window));
if (!ctx->windows) {
free(ctx);
return NULL;
free(ctx);
return NULL;
}
ctx->win_count = 1;
ctx->windows[0] = main_window;
ctx->main_menu = NULL;
ctx->last_menu_tag = 100;
return ctx;
}
int
int
WMAppAddWindow(WMAppContext *app, Window window)
{
Window *win;
win = malloc(sizeof(Window)*(app->win_count+1));
if (!win)
return False;
return False;
memcpy(win, app->windows, sizeof(Window)*app->win_count);
@@ -78,7 +78,7 @@ WMAppAddWindow(WMAppContext *app, Window window)
}
int
int
WMAppSetMainMenu(WMAppContext *app, WMMenu *menu)
{
app->main_menu = menu;

View File

@@ -1,19 +1,19 @@
/* app.h - private declarations for application context
*
*
* WMlib - WindowMaker application programming interface
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -32,8 +32,9 @@ typedef struct _wmAppContext {
int win_count; /* size of windows array */
WMMenu *main_menu;
int last_menu_tag;
} wmAppContext;
#endif

View File

@@ -1,19 +1,19 @@
/* command.c - WindowMaker commands
*
*
* WMlib - WindowMaker application programming interface
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -45,12 +45,12 @@ WMHideApplication(WMAppContext *app)
event.xclient.data.l[1] = 0;
event.xclient.data.l[2] = 0;
event.xclient.data.l[3] = 0;
XSendEvent(app->dpy, RootWindow(app->dpy, app->screen_number), False,
SubstructureNotifyMask|SubstructureRedirectMask, &event);
XSendEvent(app->dpy, RootWindow(app->dpy, app->screen_number), False,
SubstructureNotifyMask|SubstructureRedirectMask, &event);
}
void
void
WMHideOthers(WMAppContext *app)
{
XEvent event;
@@ -64,21 +64,22 @@ WMHideOthers(WMAppContext *app)
event.xclient.data.l[1] = 0;
event.xclient.data.l[2] = 0;
event.xclient.data.l[3] = 0;
XSendEvent(app->dpy, RootWindow(app->dpy, app->screen_number), False,
SubstructureNotifyMask|SubstructureRedirectMask, &event);
XSendEvent(app->dpy, RootWindow(app->dpy, app->screen_number), False,
SubstructureNotifyMask|SubstructureRedirectMask, &event);
}
void
void
WMSetWindowAttributes(Display *dpy, Window window,
GNUstepWMAttributes *attributes)
GNUstepWMAttributes *attributes)
{
Atom atom;
atom = XInternAtom(dpy, "_GNUSTEP_WM_ATTR", False);
XChangeProperty(dpy, window, atom, atom, 32, PropModeReplace,
(unsigned char *)attributes,
sizeof(GNUstepWMAttributes)/sizeof(CARD32));
XChangeProperty(dpy, window, atom, atom, 32, PropModeReplace,
(unsigned char *)attributes,
sizeof(GNUstepWMAttributes)/sizeof(CARD32));
}

View File

@@ -1,19 +1,19 @@
/* event.c - WindowMaker event handler
*
*
* WMlib - WindowMaker application programming interface
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -42,16 +42,16 @@ findEntry(WMMenu *menu, int tag)
wmMenuEntry *entry=menu->first;
while (entry) {
if (entry->tag == tag) {
return entry;
}
if (entry->cascade) {
wmMenuEntry *tmp;
tmp = findEntry(entry->cascade, tag);
if (tmp)
return tmp;
}
entry = entry->next;
if (entry->tag == tag) {
return entry;
}
if (entry->cascade) {
wmMenuEntry *tmp;
tmp = findEntry(entry->cascade, tag);
if (tmp)
return tmp;
}
entry = entry->next;
}
return NULL;
}
@@ -63,13 +63,13 @@ wmHandleMenuEvents(WMAppContext *app, XEvent *event)
wmMenuEntry *entry;
switch (event->xclient.data.l[1]) {
case wmSelectItem:
entry = findEntry(app->main_menu, event->xclient.data.l[2]);
if (entry && entry->callback) {
(*entry->callback)(entry->clientData, event->xclient.data.l[2],
event->xclient.data.l[0]);
}
break;
case wmSelectItem:
entry = findEntry(app->main_menu, event->xclient.data.l[2]);
if (entry && entry->callback) {
(*entry->callback)(entry->clientData, event->xclient.data.l[2],
event->xclient.data.l[0]);
}
break;
}
}
@@ -79,17 +79,18 @@ WMProcessEvent(WMAppContext *app, XEvent *event)
{
int proc=False;
if (!_XA_WINDOWMAKER_MENU) {
_XA_WINDOWMAKER_MENU = XInternAtom(app->dpy, "_WINDOWMAKER_MENU",
False);
_XA_WINDOWMAKER_MENU = XInternAtom(app->dpy, "_WINDOWMAKER_MENU",
False);
}
switch (event->type) {
case ClientMessage:
if (event->xclient.format == 32
&& event->xclient.message_type == _XA_WINDOWMAKER_MENU
&& event->xclient.window == app->main_window) {
wmHandleMenuEvents(app, event);
proc = True;
}
case ClientMessage:
if (event->xclient.format == 32
&& event->xclient.message_type == _XA_WINDOWMAKER_MENU
&& event->xclient.window == app->main_window) {
wmHandleMenuEvents(app, event);
proc = True;
}
}
return proc;
}

View File

@@ -1,19 +1,19 @@
/* menu.c - menu interface functions
*
*
* WMlib - WindowMaker application programming interface
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -36,12 +36,12 @@ WMMenuCreate(WMAppContext *app, char *title)
wmMenu *menu;
if (strlen(title)>255)
return NULL;
return NULL;
menu = malloc(sizeof(wmMenu));
if (!menu)
return NULL;
return NULL;
menu->appcontext = app;
menu->parent = NULL;
menu->title = title;
@@ -50,14 +50,14 @@ WMMenuCreate(WMAppContext *app, char *title)
menu->realized = False;
menu->code = app->last_menu_tag++;
menu->entryline = malloc(strlen(title)+32);
menu->entryline2 = malloc(32);
if (!menu->entryline || !menu->entryline2) {
if (menu->entryline)
free(menu->entryline);
free(menu);
return NULL;
if (menu->entryline)
free(menu->entryline);
free(menu);
return NULL;
}
sprintf(menu->entryline, "%i %i %s", wmBeginMenu, menu->code, title);
sprintf(menu->entryline2, "%i %i", wmEndMenu, menu->code);
@@ -67,38 +67,38 @@ WMMenuCreate(WMAppContext *app, char *title)
int
WMMenuAddItem(WMMenu *menu, char *text, WMMenuAction action,
void *clientData, WMFreeFunction freedata, char *rtext)
void *clientData, WMFreeFunction freedata, char *rtext)
{
wmMenuEntry *entry;
/* max size of right side text */
if (rtext && strlen(rtext)>4)
return -1;
return -1;
/* max size of menu text */
if (strlen(text)>255)
return -1;
return -1;
entry = malloc(sizeof(wmMenuEntry));
if (!entry)
return -1;
return -1;
entry->entryline = malloc(strlen(text)+100);
if (!entry->entryline) {
free(menu);
return -1;
free(menu);
return -1;
}
if (menu->entries)
entry->order = menu->entries->order + 1;
entry->order = menu->entries->order + 1;
else {
entry->order = 0;
menu->first = entry;
entry->order = 0;
menu->first = entry;
}
entry->next = NULL;
entry->prev = menu->entries;
if (menu->entries)
menu->entries->next = entry;
menu->entries->next = entry;
menu->entries = entry;
entry->menu = menu;
@@ -113,11 +113,11 @@ WMMenuAddItem(WMMenu *menu, char *text, WMMenuAction action,
if (!rtext)
sprintf(entry->entryline, "%i %i %i %i %s", wmNormalItem,
menu->code, entry->tag, True, text);
sprintf(entry->entryline, "%i %i %i %i %s", wmNormalItem,
menu->code, entry->tag, True, text);
else
sprintf(entry->entryline, "%i %i %i %i %s %s", wmDoubleItem,
menu->code, entry->tag, True, rtext, text);
sprintf(entry->entryline, "%i %i %i %i %s %s", wmDoubleItem,
menu->code, entry->tag, True, rtext, text);
return entry->tag;
}
@@ -130,28 +130,28 @@ WMMenuAddSubmenu(WMMenu *menu, char *text, WMMenu *submenu)
/* max size of menu text */
if (strlen(text)>255)
return -1;
return -1;
entry = malloc(sizeof(wmMenuEntry));
if (!entry)
return -1;
return -1;
entry->entryline = malloc(strlen(text)+100);
if (!entry->entryline) {
free(menu);
return -1;
free(menu);
return -1;
}
if (menu->entries)
entry->order = menu->entries->order + 1;
entry->order = menu->entries->order + 1;
else {
entry->order = 0;
menu->first = entry;
entry->order = 0;
menu->first = entry;
}
entry->next = NULL;
entry->prev = menu->entries;
if (menu->entries)
menu->entries->next = entry;
menu->entries->next = entry;
menu->entries = entry;
entry->menu = menu;
entry->text = text;
@@ -163,8 +163,8 @@ WMMenuAddSubmenu(WMMenu *menu, char *text, WMMenu *submenu)
entry->enabled = True;
sprintf(entry->entryline, "%i %i %i %i %i %s", wmSubmenuItem,
menu->code, entry->tag, True, submenu->code, text);
return entry->tag;
menu->code, entry->tag, True, submenu->code, text);
return entry->tag;
}
@@ -176,11 +176,11 @@ countItems(WMMenu *menu)
c = 1;
while (entry) {
c++;
if (entry->cascade) {
c += countItems(entry->cascade);
}
entry = entry->next;
c++;
if (entry->cascade) {
c += countItems(entry->cascade);
}
entry = entry->next;
}
c++;
return c;
@@ -191,14 +191,14 @@ static void
addItems(char **slist, int *index, WMMenu *menu)
{
wmMenuEntry *entry = menu->first;
slist[(*index)++] = menu->entryline;
while (entry) {
slist[(*index)++] = entry->entryline;
if (entry->cascade) {
addItems(slist, index, entry->cascade);
}
entry = entry->next;
slist[(*index)++] = entry->entryline;
if (entry->cascade) {
addItems(slist, index, entry->cascade);
}
entry = entry->next;
}
slist[(*index)++] = menu->entryline2;
}
@@ -208,14 +208,14 @@ static Atom
getatom(Display *dpy)
{
static Atom atom=0;
if (atom==0) {
atom = XInternAtom(dpy, WMMENU_PROPNAME, False);
atom = XInternAtom(dpy, WMMENU_PROPNAME, False);
}
return atom;
}
int
int
WMRealizeMenus(WMAppContext *app)
{
int i, count;
@@ -223,17 +223,17 @@ WMRealizeMenus(WMAppContext *app)
XTextProperty text_prop;
if (!app->main_menu)
return False;
return False;
/* first count how many menu items there are */
count = countItems(app->main_menu);
if (count==0)
return True;
return True;
count++;
slist = malloc(count*sizeof(char*));
if (!slist) {
return False;
return False;
}
slist[0] = "WMMenu 0";
@@ -241,12 +241,12 @@ WMRealizeMenus(WMAppContext *app)
addItems(slist, &i, app->main_menu);
if (!XStringListToTextProperty(slist, i, &text_prop)) {
free(slist);
return False;
free(slist);
return False;
}
free(slist);
XSetTextProperty(app->dpy, app->main_window, &text_prop,
getatom(app->dpy));
XSetTextProperty(app->dpy, app->main_window, &text_prop,
getatom(app->dpy));
XFree(text_prop.value);

View File

@@ -1,19 +1,19 @@
/* menu.h - private menu declarations
*
*
* WMlib - WindowMaker application programming interface
*
*
* Copyright (C) 1997-2003 Alfredo K. Kojima
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -40,7 +40,7 @@ typedef struct _wmMenuEntry {
struct _wmMenu *cascade; /* cascade menu */
short order;
short enabled; /* entry is selectable */
char *entryline;
} wmMenuEntry;
@@ -64,11 +64,12 @@ typedef struct _wmMenu {
enum {
wmBeginMenu = 1,
wmEndMenu = 2,
wmNormalItem = 10,
wmDoubleItem = 11,
wmSubmenuItem = 12
wmEndMenu = 2,
wmNormalItem = 10,
wmDoubleItem = 11,
wmSubmenuItem = 12
};
#endif