summaryrefslogtreecommitdiff
path: root/src/menus.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2013-08-04 15:16:20 +0200
committerMatthieu Herrb <matthieu.herrb@laas.fr>2013-08-04 15:16:20 +0200
commitfdf60fe3c0169fa168321deb1a2ccd188ee384f8 (patch)
tree6335d307fb0eeb76d08ac9784b25981d64568e74 /src/menus.c
parent893cbd34370357c0d912a05442a300fba11ef1cc (diff)
parent2a637337713c5c92c44249b88e31696ce9efdf9b (diff)
Merge remote-tracking branch 'origin/master' into obsd
Diffstat (limited to 'src/menus.c')
-rw-r--r--src/menus.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/src/menus.c b/src/menus.c
index 6440bfc..2ca67bf 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -114,6 +114,16 @@ static Cursor LastCursor;
static Bool belongs_to_twm_window ( TwmWindow *t, Window w );
static void Identify ( TwmWindow *t );
static void send_clientmessage ( Window w, Atom a, Time timestamp );
+static void BumpWindowColormap ( TwmWindow *tmp, int inc );
+static int DeferExecution ( int context, int func, Cursor cursor );
+static Bool NeedToDefer ( MenuRoot *root );
+static void DestroyMenu ( MenuRoot *menu );
+static void MakeMenu ( MenuRoot *mr );
+static void Execute ( const char *s );
+static void HideIconManager ( void );
+static void WarpAlongRing ( XButtonEvent *ev, Bool forward );
+static int WarpThere ( TwmWindow * t );
+static void WarpToWindow ( TwmWindow *t );
#define SHADOWWIDTH 5 /* in pixels */
@@ -124,7 +134,7 @@ static void send_clientmessage ( Window w, Atom a, Time timestamp );
* initialize menu roots
*/
void
-InitMenus()
+InitMenus(void)
{
int i, j, k;
FuncKey *key, *tmp;
@@ -213,8 +223,8 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
-int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot,
- Bool rightside, Bool append)
+int CreateTitleButton (const char *name, int func, const char *action,
+ MenuRoot *menuroot, Bool rightside, Bool append)
{
TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton));
@@ -283,7 +293,7 @@ int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot,
* the button, then put in a question; if we can't find the question mark,
* something is wrong and we are probably going to be in trouble later on.
*/
-void InitTitlebarButtons ()
+void InitTitlebarButtons (void)
{
TitleButton *tb;
int h;
@@ -472,7 +482,7 @@ PaintMenu(MenuRoot *mr, XEvent *e)
static Bool fromMenu;
void
-UpdateMenu()
+UpdateMenu(void)
{
MenuItem *mi;
int i, x, y, x_root, y_root, entry;
@@ -617,7 +627,7 @@ UpdateMenu()
* \param name the name of the menu root
*/
MenuRoot *
-NewMenuRoot(char *name)
+NewMenuRoot(const char *name)
{
MenuRoot *tmp;
@@ -676,8 +686,8 @@ NewMenuRoot(char *name)
* \param back background color string
*/
MenuItem *
-AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func,
- char *fore, char *back)
+AddToMenu(MenuRoot *menu, const char *item, const char *action,
+ MenuRoot *sub, int func, const char *fore, const char *back)
{
MenuItem *tmp;
int width;
@@ -741,7 +751,7 @@ AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func,
void
-MakeMenus()
+MakeMenus(void)
{
MenuRoot *mr;
@@ -755,7 +765,7 @@ MakeMenus()
}
-void
+static void
MakeMenu(MenuRoot *mr)
{
MenuItem *start, *end, *cur, *tmp;
@@ -1082,7 +1092,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center)
* unhighlight the current menu selection and take down the menus
*/
void
-PopDownMenu()
+PopDownMenu(void)
{
MenuRoot *tmp;
@@ -1123,7 +1133,7 @@ PopDownMenu()
* \param name the name of the menu root
*/
MenuRoot *
-FindMenuRoot(char *name)
+FindMenuRoot(const char *name)
{
MenuRoot *tmp;
@@ -1157,7 +1167,7 @@ belongs_to_twm_window (TwmWindow *t, Window w)
-void
+static void
resizeFromCenter(Window w, TwmWindow *tmp_win)
{
int lastx, lasty, bw2;
@@ -1265,7 +1275,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win)
* else FALSE to abort
*/
-int
+static int
WarpThere(TwmWindow *t)
{
if (Scr->WarpUnmapped || t->mapped) {
@@ -1279,7 +1289,7 @@ WarpThere(TwmWindow *t)
int
-ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win,
+ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
XEvent *eventp, int context, int pulldown)
{
static Time last_time = 0;
@@ -2250,7 +2260,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win,
* \param func the function to defer
* \param cursor cursor the cursor to display while waiting
*/
-int
+static int
DeferExecution(int context, int func, Cursor cursor)
{
if (context == C_ROOT)
@@ -2275,7 +2285,7 @@ DeferExecution(int context, int func, Cursor cursor)
*regrab the pointer with the LastCursor;
*/
void
-ReGrab()
+ReGrab(void)
{
XGrabPointer(dpy, Scr->Root, True,
ButtonPressMask | ButtonReleaseMask,
@@ -2291,7 +2301,7 @@ ReGrab()
*
* \param root the menu root to check
*/
-Bool
+static Bool
NeedToDefer(MenuRoot *root)
{
MenuItem *mitem;
@@ -2336,7 +2346,7 @@ NeedToDefer(MenuRoot *root)
* \param s the string containing the command
*/
static int
-System (char *s)
+System (const char *s)
{
int pid, status;
if ((pid = fork ()) == 0) {
@@ -2350,8 +2360,8 @@ System (char *s)
#endif
-void
-Execute(char *s)
+static void
+Execute(const char *s)
{
/* FIXME: is all this stuff needed? There could be security problems here. */
static char buf[256];
@@ -2402,7 +2412,7 @@ Execute(char *s)
* put input focus on the root window.
*/
void
-FocusOnRoot()
+FocusOnRoot(void)
{
SetFocus ((TwmWindow *) NULL, LastTimestamp());
if (Scr->Focus != NULL)
@@ -2743,7 +2753,7 @@ WarpToScreen (int n, int inc)
/**
* rotate our internal copy of WM_COLORMAP_WINDOWS
*/
-void
+static void
BumpWindowColormap (TwmWindow *tmp, int inc)
{
int i, j, previously_installed;
@@ -2787,8 +2797,8 @@ BumpWindowColormap (TwmWindow *tmp, int inc)
}
-void
-HideIconManager ()
+static void
+HideIconManager (void)
{
SetMapStateProp (Scr->iconmgr.twm_win, WithdrawnState);
XUnmapWindow(dpy, Scr->iconmgr.twm_win->frame);
@@ -2817,7 +2827,7 @@ SetBorder (TwmWindow *tmp, Bool onoroff)
}
-void
+static void
DestroyMenu (MenuRoot *menu)
{
MenuItem *item;
@@ -2842,7 +2852,7 @@ DestroyMenu (MenuRoot *menu)
* warping routines
*/
-void
+static void
WarpAlongRing (XButtonEvent *ev, Bool forward)
{
TwmWindow *r, *head;
@@ -2892,7 +2902,7 @@ WarpAlongRing (XButtonEvent *ev, Bool forward)
-void
+static void
WarpToWindow (TwmWindow *t)
{
int x, y;