1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

Change to the linux kernel coding style

for arq in `git ls-files *.c`; do
    echo $arq;
    indent -linux -l115 $arq;
    done

The different line break at 115 columns is because
I use a widescreen monitor :-)
This commit is contained in:
Carlos R. Mafra
2009-08-20 00:59:40 +02:00
parent 59fc927dc9
commit 688a56e8ab
209 changed files with 87034 additions and 98138 deletions

View File

@@ -9,7 +9,6 @@
#include <X11/Xproto.h>
#include <WMaker.h>
Display *dpy;
Window leader;
WMAppContext *app;
@@ -18,119 +17,106 @@ Atom prots[6];
XWMHints *hints;
WMMenu *menu;
static void
quit(void *foo, int item, Time time)
static void quit(void *foo, int item, Time time)
{
exit(0);
exit(0);
}
static void
hide(void *foo, int item, Time time)
static void hide(void *foo, int item, Time time)
{
WMHideApplication(app);
WMHideApplication(app);
}
int
notify_print( int id, XEvent *event, void *data )
int notify_print(int id, XEvent * event, void *data)
{
printf( "Got notification 0x%x, window 0x%lx, data '%s'\n",
id, event->xclient.data.l[1], (char *) data );
return True;
printf("Got notification 0x%x, window 0x%lx, data '%s'\n", id, event->xclient.data.l[1], (char *)data);
return True;
}
static void
newwin(void *foo, int item, Time time)
static void newwin(void *foo, int item, Time time)
{
Window win;
XClassHint classhint;
char title[100];
Window win;
XClassHint classhint;
char title[100];
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
0, 0, 200, 100, 0, 0, 0);
prots[0] = delete_win;
XSetWMProtocols(dpy, win, prots, 1);
sprintf(title, "Notify Test Window");
XStoreName(dpy, win, title);
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 200, 100, 0, 0, 0);
prots[0] = delete_win;
XSetWMProtocols(dpy, win, prots, 1);
sprintf(title, "Notify Test Window");
XStoreName(dpy, win, title);
/* set class hint */
classhint.res_name = "notest";
classhint.res_class = "Notest";
XSetClassHint(dpy, win, &classhint);
/* set class hint */
classhint.res_name = "notest";
classhint.res_class = "Notest";
XSetClassHint(dpy, win, &classhint);
hints = XAllocWMHints();
/* set window group leader */
hints->window_group = leader;
hints->flags = WindowGroupHint;
XSetWMHints(dpy, win, hints);
hints = XAllocWMHints();
/* set window group leader */
hints->window_group = leader;
hints->flags = WindowGroupHint;
XSetWMHints(dpy, win, hints);
WMAppAddWindow(app, win);
XMapWindow(dpy, win);
WMAppAddWindow(app, win);
XMapWindow(dpy, win);
}
int main(int argc, char **argv)
{
XClassHint classhint;
XClassHint classhint;
dpy = XOpenDisplay("");
if (!dpy) {
puts("could not open display!");
exit(1);
}
delete_win = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
dpy = XOpenDisplay("");
if (!dpy) {
puts("could not open display!");
exit(1);
}
delete_win = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
leader = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 10, 10,
0, 0, 0);
/* set class hint */
classhint.res_name = "notest";
classhint.res_class = "Notest";
XSetClassHint(dpy, leader, &classhint);
leader = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 10, 10, 0, 0, 0);
/* set class hint */
classhint.res_name = "notest";
classhint.res_class = "Notest";
XSetClassHint(dpy, leader, &classhint);
/* set window group leader to self */
hints = XAllocWMHints();
hints->window_group = leader;
hints->flags = WindowGroupHint;
XSetWMHints(dpy, leader, hints);
/* set window group leader to self */
hints = XAllocWMHints();
hints->window_group = leader;
hints->flags = WindowGroupHint;
XSetWMHints(dpy, leader, hints);
/* create app context */
app = WMAppCreateWithMain(dpy, DefaultScreen(dpy), leader);
menu = WMMenuCreate(app, "Notify Test Menu");
WMMenuAddItem(menu, "Hide", (WMMenuAction)hide, NULL, NULL, NULL);
WMMenuAddItem(menu, "Quit", (WMMenuAction)quit, NULL, NULL, NULL);
/* create app context */
app = WMAppCreateWithMain(dpy, DefaultScreen(dpy), leader);
menu = WMMenuCreate(app, "Notify Test Menu");
WMMenuAddItem(menu, "Hide", (WMMenuAction) hide, NULL, NULL, NULL);
WMMenuAddItem(menu, "Quit", (WMMenuAction) quit, NULL, NULL, NULL);
WMAppSetMainMenu(app, menu);
WMRealizeMenus(app);
WMAppSetMainMenu(app, menu);
WMRealizeMenus(app);
/* Get some WindowMaker notifications */
WMNotifySet( app, WMN_APP_START, notify_print, (void *) "App start" );
WMNotifySet( app, WMN_APP_EXIT, notify_print, (void *) "App end" );
WMNotifySet( app, WMN_WIN_FOCUS, notify_print, (void *) "Focus in" );
WMNotifySet( app, WMN_WIN_UNFOCUS, notify_print, (void *) "Focus out" );
WMNotifySet( app, WMN_NOTIFY_ALL, notify_print, (void *) "Unknown type" );
WMNotifyMaskUpdate( app ); /* Mask isn't actually set till we do this */
/* Get some WindowMaker notifications */
WMNotifySet(app, WMN_APP_START, notify_print, (void *)"App start");
WMNotifySet(app, WMN_APP_EXIT, notify_print, (void *)"App end");
WMNotifySet(app, WMN_WIN_FOCUS, notify_print, (void *)"Focus in");
WMNotifySet(app, WMN_WIN_UNFOCUS, notify_print, (void *)"Focus out");
WMNotifySet(app, WMN_NOTIFY_ALL, notify_print, (void *)"Unknown type");
WMNotifyMaskUpdate(app); /* Mask isn't actually set till we do this */
/* set command to use to startup this */
XSetCommand(dpy, leader, argv, argc);
/* set command to use to startup this */
XSetCommand(dpy, leader, argv, argc);
/* create first window */
newwin(NULL, 0, 0);
/* create first window */
newwin(NULL, 0, 0);
XFlush(dpy);
while( 1 ) {
XEvent ev;
XNextEvent(dpy, &ev);
if (ev.type==ClientMessage) {
if (ev.xclient.data.l[0]==delete_win) {
XDestroyWindow(dpy,ev.xclient.window);
break;
}
}
WMProcessEvent(app, &ev);
}
exit(0);
XFlush(dpy);
while (1) {
XEvent ev;
XNextEvent(dpy, &ev);
if (ev.type == ClientMessage) {
if (ev.xclient.data.l[0] == delete_win) {
XDestroyWindow(dpy, ev.xclient.window);
break;
}
}
WMProcessEvent(app, &ev);
}
exit(0);
}