>From 45857d70e0dc08885fc96d8ffb94dc2d28858c49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Sun, 24 Jun 2012 12:35:24 +0200
Subject: [PATCH 3/3] Moving header functions to main.h

The header functions of main.c should be included in main.h,
not in funcs.h. This patch addes the main.h file and moves the
functions this file.

The not needed "include funcs.h" are removed.
---
 src/WindowMaker.h |    8 --------
 src/appicon.c     |    2 +-
 src/defaults.c    |    2 +-
 src/dock.c        |    2 +-
 src/event.c       |    2 +-
 src/funcs.h       |    6 ------
 src/main.c        |   10 +++++-----
 src/main.h        |   33 +++++++++++++++++++++++++++++++++
 src/monitor.c     |    2 +-
 src/rootmenu.c    |    1 +
 src/screen.c      |    1 +
 src/session.c     |    2 +-
 src/shutdown.c    |    1 +
 src/startup.c     |    2 +-
 src/winmenu.c     |    2 +-
 15 files changed, 49 insertions(+), 27 deletions(-)
 create mode 100644 src/main.h

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 745cd42..5388fdd 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -448,19 +448,12 @@ typedef struct WPreferences {
     } flags;                          /* internal flags */
 } WPreferences;
 
-
-
 /****** Global Variables  ******/
 extern Display *dpy;
 extern unsigned int ValidModMask;
 extern char WProgramState;
 extern char WProgramSigState;
 
-
-/****** Global Functions ******/
-extern void wAbort(Bool dumpCore);
-
-
 /****** Notifications ******/
 extern const char *WMNManaged;
 extern const char *WMNUnmanaged;
@@ -477,4 +470,3 @@ extern const char *WMNWorkspaceNameChanged;
 
 extern const char *WMNResetStacking;
 #endif
-
diff --git a/src/appicon.c b/src/appicon.c
index 6e6b87a..546c3ac 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -38,7 +38,7 @@
 #include "actions.h"
 #include "stacking.h"
 #include "dock.h"
-#include "funcs.h"
+#include "main.h"
 #include "defaults.h"
 #include "workspace.h"
 #include "superfluous.h"
diff --git a/src/defaults.c b/src/defaults.c
index 86edfa4..e512a8b 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -56,7 +56,7 @@
 #include "keybind.h"
 #include "xmodifier.h"
 #include "icon.h"
-#include "funcs.h"
+#include "main.h"
 #include "actions.h"
 #include "dock.h"
 #include "workspace.h"
diff --git a/src/dock.c b/src/dock.c
index 193bc01..d5d5003 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -45,7 +45,7 @@
 #include "dock.h"
 #include "dockedapp.h"
 #include "dialog.h"
-#include "funcs.h"
+#include "main.h"
 #include "properties.h"
 #include "menu.h"
 #include "client.h"
diff --git a/src/event.c b/src/event.c
index be98466..8e287d1 100644
--- a/src/event.c
+++ b/src/event.c
@@ -54,7 +54,7 @@
 #include "window.h"
 #include "actions.h"
 #include "client.h"
-#include "funcs.h"
+#include "main.h"
 #include "keybind.h"
 #include "application.h"
 #include "stacking.h"
diff --git a/src/funcs.h b/src/funcs.h
index 598f602..ff6ee6c 100644
--- a/src/funcs.h
+++ b/src/funcs.h
@@ -32,9 +32,6 @@ typedef void (WDeathHandler)(pid_t pid, unsigned int status, 
void *cdata);
 
 void Shutdown(WShutdownMode mode);
 void RestoreDesktop(WScreen *scr);
-void Exit(int status) __attribute__((noreturn));
-void Restart(char *manager, Bool abortOnFailure);
-void SetupEnvironment(WScreen *scr);
 void DispatchEvent(XEvent *event);
 void UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action);
 void OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard);
@@ -52,8 +49,6 @@ void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int 
head);
 void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool 
class_only);
 void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
 void UnescapeWM_CLASS(char *str, char **name, char **class);
-void ExecuteShellCommand(WScreen *scr, char *command);
-void ExecExitScript();
 void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
                  unsigned int width, unsigned int height);
 
@@ -84,7 +79,6 @@ char * FindImage(char *paths, char *file);
 char * GetShortcutString(char *text);
 char * EscapeWM_CLASS(char *name, char *class);
 
-Bool RelaunchWindow(WWindow *wwin);
 Bool IsDoubleClick(WScreen *scr, XEvent *event);
 Bool UpdateDomainFile(WDDomain *domain);
 
diff --git a/src/main.c b/src/main.c
index 431d41b..169f830 100644
--- a/src/main.c
+++ b/src/main.c
@@ -485,7 +485,7 @@ void wAbort(Bool dumpCore)
                exit(1);
 }
 
-void print_help()
+static void print_help(void)
 {
        printf(_("Usage: %s [options]\n"), ProgName);
        puts(_("The Window Maker window manager for the X window system"));
@@ -511,7 +511,7 @@ void print_help()
        puts(_(" --help                 show this message"));
 }
 
-void check_defaults()
+static void check_defaults(void)
 {
        char *path;
 
@@ -537,7 +537,7 @@ void check_defaults()
  * files have changed, using linux kernel inotify mechanism
  */
 
-static void inotifyWatchConfig()
+static void inotifyWatchConfig(void)
 {
        char *watchPath = NULL;
        inotifyFD = inotify_init();     /* Initialise an inotify instance */
@@ -563,7 +563,7 @@ static void inotifyWatchConfig()
 }
 #endif /* HAVE_INOTIFY */
 
-static void execInitScript()
+static void execInitScript(void)
 {
        char *file, *paths;
 
@@ -581,7 +581,7 @@ static void execInitScript()
        }
 }
 
-void ExecExitScript()
+void ExecExitScript(void)
 {
        char *file, *paths;
 
diff --git a/src/main.h b/src/main.h
new file mode 100644
index 0000000..d40a743
--- /dev/null
+++ b/src/main.h
@@ -0,0 +1,33 @@
+/*
+ *  Window Maker window manager
+ *
+ *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 1998-2003 Dan Pascu
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef WMMAIN_H_
+#define WMMAIN_H_
+
+void Exit(int status) __attribute__((noreturn));
+void Restart(char *manager, Bool abortOnFailure);
+void SetupEnvironment(WScreen *scr);
+void ExecuteShellCommand(WScreen *scr, char *command);
+Bool RelaunchWindow(WWindow *wwin);
+void wAbort(Bool dumpCore);
+void ExecExitScript(void);
+
+#endif
diff --git a/src/monitor.c b/src/monitor.c
index 355aba9..ecf05b9 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -37,7 +37,7 @@
 #include "screen.h"
 #include "window.h"
 #include "dialog.h"
-#include "funcs.h"
+#include "main.h"
 
 /****** Global Variables ******/
 extern WPreferences wPreferences;
diff --git a/src/rootmenu.c b/src/rootmenu.c
index c32411d..6c4bb2d 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -42,6 +42,7 @@
 #include "actions.h"
 #include "menu.h"
 #include "funcs.h"
+#include "main.h"
 #include "dialog.h"
 #include "keybind.h"
 #include "stacking.h"
diff --git a/src/screen.c b/src/screen.c
index c9ae4c5..2efe7c3 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -46,6 +46,7 @@
 #include "pixmap.h"
 #include "menu.h"
 #include "funcs.h"
+#include "main.h"
 #include "actions.h"
 #include "properties.h"
 #include "dock.h"
diff --git a/src/session.c b/src/session.c
index 421150b..703b5fa 100644
--- a/src/session.c
+++ b/src/session.c
@@ -76,7 +76,7 @@
 #include "session.h"
 #include "framewin.h"
 #include "workspace.h"
-#include "funcs.h"
+#include "main.h"
 #include "properties.h"
 #include "application.h"
 #include "appicon.h"
diff --git a/src/shutdown.c b/src/shutdown.c
index 0cf9ab7..6d87306 100644
--- a/src/shutdown.c
+++ b/src/shutdown.c
@@ -31,6 +31,7 @@
 #include "window.h"
 #include "client.h"
 #include "funcs.h"
+#include "main.h"
 #include "properties.h"
 #include "session.h"
 #include "winspector.h"
diff --git a/src/startup.c b/src/startup.c
index 190cd92..ac7baa4 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -55,7 +55,7 @@
 #include "window.h"
 #include "actions.h"
 #include "client.h"
-#include "funcs.h"
+#include "main.h"
 #include "dock.h"
 #include "workspace.h"
 #include "keybind.h"
diff --git a/src/winmenu.c b/src/winmenu.c
index 4e2b64f..96609aa 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -33,7 +33,7 @@
 #include "WindowMaker.h"
 #include "actions.h"
 #include "menu.h"
-#include "funcs.h"
+#include "main.h"
 #include "window.h"
 #include "client.h"
 #include "application.h"
-- 
1.7.10

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 45857d70e0dc08885fc96d8ffb94dc2d28858c49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Sun, 24 Jun 2012 12:35:24 +0200
Subject: [PATCH 3/3] Moving header functions to main.h

The header functions of main.c should be included in main.h,
not in funcs.h. This patch addes the main.h file and moves the
functions this file.

The not needed "include funcs.h" are removed.
---
 src/WindowMaker.h |    8 --------
 src/appicon.c     |    2 +-
 src/defaults.c    |    2 +-
 src/dock.c        |    2 +-
 src/event.c       |    2 +-
 src/funcs.h       |    6 ------
 src/main.c        |   10 +++++-----
 src/main.h        |   33 +++++++++++++++++++++++++++++++++
 src/monitor.c     |    2 +-
 src/rootmenu.c    |    1 +
 src/screen.c      |    1 +
 src/session.c     |    2 +-
 src/shutdown.c    |    1 +
 src/startup.c     |    2 +-
 src/winmenu.c     |    2 +-
 15 files changed, 49 insertions(+), 27 deletions(-)
 create mode 100644 src/main.h

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 745cd42..5388fdd 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -448,19 +448,12 @@ typedef struct WPreferences {
     } flags;			       /* internal flags */
 } WPreferences;
 
-
-
 /****** Global Variables  ******/
 extern Display	*dpy;
 extern unsigned int ValidModMask;
 extern char WProgramState;
 extern char WProgramSigState;
 
-
-/****** Global Functions ******/
-extern void wAbort(Bool dumpCore);
-
-
 /****** Notifications ******/
 extern const char *WMNManaged;
 extern const char *WMNUnmanaged;
@@ -477,4 +470,3 @@ extern const char *WMNWorkspaceNameChanged;
 
 extern const char *WMNResetStacking;
 #endif
-
diff --git a/src/appicon.c b/src/appicon.c
index 6e6b87a..546c3ac 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -38,7 +38,7 @@
 #include "actions.h"
 #include "stacking.h"
 #include "dock.h"
-#include "funcs.h"
+#include "main.h"
 #include "defaults.h"
 #include "workspace.h"
 #include "superfluous.h"
diff --git a/src/defaults.c b/src/defaults.c
index 86edfa4..e512a8b 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -56,7 +56,7 @@
 #include "keybind.h"
 #include "xmodifier.h"
 #include "icon.h"
-#include "funcs.h"
+#include "main.h"
 #include "actions.h"
 #include "dock.h"
 #include "workspace.h"
diff --git a/src/dock.c b/src/dock.c
index 193bc01..d5d5003 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -45,7 +45,7 @@
 #include "dock.h"
 #include "dockedapp.h"
 #include "dialog.h"
-#include "funcs.h"
+#include "main.h"
 #include "properties.h"
 #include "menu.h"
 #include "client.h"
diff --git a/src/event.c b/src/event.c
index be98466..8e287d1 100644
--- a/src/event.c
+++ b/src/event.c
@@ -54,7 +54,7 @@
 #include "window.h"
 #include "actions.h"
 #include "client.h"
-#include "funcs.h"
+#include "main.h"
 #include "keybind.h"
 #include "application.h"
 #include "stacking.h"
diff --git a/src/funcs.h b/src/funcs.h
index 598f602..ff6ee6c 100644
--- a/src/funcs.h
+++ b/src/funcs.h
@@ -32,9 +32,6 @@ typedef void (WDeathHandler)(pid_t pid, unsigned int status, void *cdata);
 
 void Shutdown(WShutdownMode mode);
 void RestoreDesktop(WScreen *scr);
-void Exit(int status) __attribute__((noreturn));
-void Restart(char *manager, Bool abortOnFailure);
-void SetupEnvironment(WScreen *scr);
 void DispatchEvent(XEvent *event);
 void UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action);
 void OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard);
@@ -52,8 +49,6 @@ void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int head);
 void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only);
 void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
 void UnescapeWM_CLASS(char *str, char **name, char **class);
-void ExecuteShellCommand(WScreen *scr, char *command);
-void ExecExitScript();
 void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
                  unsigned int width, unsigned int height);
 
@@ -84,7 +79,6 @@ char * FindImage(char *paths, char *file);
 char * GetShortcutString(char *text);
 char * EscapeWM_CLASS(char *name, char *class);
 
-Bool RelaunchWindow(WWindow *wwin);
 Bool IsDoubleClick(WScreen *scr, XEvent *event);
 Bool UpdateDomainFile(WDDomain *domain);
 
diff --git a/src/main.c b/src/main.c
index 431d41b..169f830 100644
--- a/src/main.c
+++ b/src/main.c
@@ -485,7 +485,7 @@ void wAbort(Bool dumpCore)
 		exit(1);
 }
 
-void print_help()
+static void print_help(void)
 {
 	printf(_("Usage: %s [options]\n"), ProgName);
 	puts(_("The Window Maker window manager for the X window system"));
@@ -511,7 +511,7 @@ void print_help()
 	puts(_(" --help			show this message"));
 }
 
-void check_defaults()
+static void check_defaults(void)
 {
 	char *path;
 
@@ -537,7 +537,7 @@ void check_defaults()
  * files have changed, using linux kernel inotify mechanism
  */
 
-static void inotifyWatchConfig()
+static void inotifyWatchConfig(void)
 {
 	char *watchPath = NULL;
 	inotifyFD = inotify_init();	/* Initialise an inotify instance */
@@ -563,7 +563,7 @@ static void inotifyWatchConfig()
 }
 #endif /* HAVE_INOTIFY */
 
-static void execInitScript()
+static void execInitScript(void)
 {
 	char *file, *paths;
 
@@ -581,7 +581,7 @@ static void execInitScript()
 	}
 }
 
-void ExecExitScript()
+void ExecExitScript(void)
 {
 	char *file, *paths;
 
diff --git a/src/main.h b/src/main.h
new file mode 100644
index 0000000..d40a743
--- /dev/null
+++ b/src/main.h
@@ -0,0 +1,33 @@
+/*
+ *  Window Maker window manager
+ *
+ *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 1998-2003 Dan Pascu
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef WMMAIN_H_
+#define WMMAIN_H_
+
+void Exit(int status) __attribute__((noreturn));
+void Restart(char *manager, Bool abortOnFailure);
+void SetupEnvironment(WScreen *scr);
+void ExecuteShellCommand(WScreen *scr, char *command);
+Bool RelaunchWindow(WWindow *wwin);
+void wAbort(Bool dumpCore);
+void ExecExitScript(void);
+
+#endif
diff --git a/src/monitor.c b/src/monitor.c
index 355aba9..ecf05b9 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -37,7 +37,7 @@
 #include "screen.h"
 #include "window.h"
 #include "dialog.h"
-#include "funcs.h"
+#include "main.h"
 
 /****** Global Variables ******/
 extern WPreferences wPreferences;
diff --git a/src/rootmenu.c b/src/rootmenu.c
index c32411d..6c4bb2d 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -42,6 +42,7 @@
 #include "actions.h"
 #include "menu.h"
 #include "funcs.h"
+#include "main.h"
 #include "dialog.h"
 #include "keybind.h"
 #include "stacking.h"
diff --git a/src/screen.c b/src/screen.c
index c9ae4c5..2efe7c3 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -46,6 +46,7 @@
 #include "pixmap.h"
 #include "menu.h"
 #include "funcs.h"
+#include "main.h"
 #include "actions.h"
 #include "properties.h"
 #include "dock.h"
diff --git a/src/session.c b/src/session.c
index 421150b..703b5fa 100644
--- a/src/session.c
+++ b/src/session.c
@@ -76,7 +76,7 @@
 #include "session.h"
 #include "framewin.h"
 #include "workspace.h"
-#include "funcs.h"
+#include "main.h"
 #include "properties.h"
 #include "application.h"
 #include "appicon.h"
diff --git a/src/shutdown.c b/src/shutdown.c
index 0cf9ab7..6d87306 100644
--- a/src/shutdown.c
+++ b/src/shutdown.c
@@ -31,6 +31,7 @@
 #include "window.h"
 #include "client.h"
 #include "funcs.h"
+#include "main.h"
 #include "properties.h"
 #include "session.h"
 #include "winspector.h"
diff --git a/src/startup.c b/src/startup.c
index 190cd92..ac7baa4 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -55,7 +55,7 @@
 #include "window.h"
 #include "actions.h"
 #include "client.h"
-#include "funcs.h"
+#include "main.h"
 #include "dock.h"
 #include "workspace.h"
 #include "keybind.h"
diff --git a/src/winmenu.c b/src/winmenu.c
index 4e2b64f..96609aa 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -33,7 +33,7 @@
 #include "WindowMaker.h"
 #include "actions.h"
 #include "menu.h"
-#include "funcs.h"
+#include "main.h"
 #include "window.h"
 #include "client.h"
 #include "application.h"
-- 
1.7.10

Reply via email to