summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrcyeske <rcyeske>2001-02-17 20:01:31 +0000
committerrcyeske <rcyeske>2001-02-17 20:01:31 +0000
commit77159526d8a218f23e496ef5989a40dcdc24e99c (patch)
treedaa420f882ce4e2d259e9d7d597584525c01e85c
parentf1e28f43165b69b18ee06fc29aea44ced65b0382 (diff)
downloadratpoison-77159526d8a218f23e496ef5989a40dcdc24e99c.zip
renamed display_msg_in_bar() to message(); it and get_input() no longer take a screen_info param
-rw-r--r--src/ChangeLog10
-rw-r--r--src/actions.c38
-rw-r--r--src/actions.h2
-rw-r--r--src/bar.c5
-rw-r--r--src/bar.h2
-rw-r--r--src/events.c2
-rw-r--r--src/input.c4
-rw-r--r--src/input.h2
-rw-r--r--src/manage.c9
-rw-r--r--src/manage.h1
10 files changed, 44 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 871a39b..4f1b4af 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
+2001-02-17 Ryan Yeske <rcyeske@cut.hotdog.tmp>
+
+ * manage.c (current_screen): Rename get_screen() and move to this
+ file.
+
+ * input.c (get_input): Remove screen_info as paramater. Call
+ current_screen() to get screen_info.
+
+ * actions.c (get_screen): Remove.
+
2001-02-17 Gergely Nagy <8@free.bsd.hu>
* actions.c (goto_window_by_name, rename_current_window, command)
diff --git a/src/actions.c b/src/actions.c
index 633542e..b7f00ff 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -37,16 +37,6 @@
/* { {XK_t, C, "main-prefix"}, */
/* {0,0,NULL} }; */
-static screen_info*
-get_screen ()
-{
- if (rp_current_window)
- return rp_current_window->scr;
- else
- return &screens[0];
-}
-
-
rp_action key_actions[] =
{ {XK_t, C, "other", command},
{XK_t, 0, "generate", command},
@@ -218,14 +208,14 @@ prev_window (void *data)
else
{
if (rp_current_window == new_win)
- display_msg_in_bar (&screens[0], MESSAGE_NO_OTHER_WINDOW, 0, 0);
+ message (MESSAGE_NO_OTHER_WINDOW, 0, 0);
else
set_active_window (new_win);
}
}
else
{
- display_msg_in_bar (&screens[0], MESSAGE_NO_MANAGED_WINDOWS, 0, 0);
+ message (MESSAGE_NO_MANAGED_WINDOWS, 0, 0);
}
}
@@ -246,14 +236,14 @@ next_window (void *data)
else
{
if (rp_current_window == new_win)
- display_msg_in_bar (&screens[0], MESSAGE_NO_OTHER_WINDOW, 0, 0);
+ message (MESSAGE_NO_OTHER_WINDOW, 0, 0);
else
set_active_window (new_win);
}
}
else
{
- display_msg_in_bar (&screens[0], MESSAGE_NO_MANAGED_WINDOWS, 0, 0);
+ message (MESSAGE_NO_MANAGED_WINDOWS, 0, 0);
}
}
@@ -269,7 +259,7 @@ last_window (void *data)
if (rp_current_window == oldwin)
{
- display_msg_in_bar (&screens[0], MESSAGE_NO_OTHER_WINDOW, 0, 0);
+ message (MESSAGE_NO_OTHER_WINDOW, 0, 0);
}
}
@@ -282,7 +272,7 @@ goto_win_by_name (void *data)
if (rp_current_window == NULL) return;
if (data == NULL)
- winname = get_input (rp_current_window->scr, MESSAGE_PROMPT_GOTO_WINDOW_NAME);
+ winname = get_input (MESSAGE_PROMPT_GOTO_WINDOW_NAME);
else
winname = strdup ((char *) data);
@@ -299,7 +289,7 @@ rename_current_window (void *data)
if (rp_current_window == NULL) return;
if (data == NULL)
- winname = get_input (rp_current_window->scr, MESSAGE_PROMPT_NEW_WINDOW_NAME);
+ winname = get_input (MESSAGE_PROMPT_NEW_WINDOW_NAME);
else
winname = strdup ((char *) data);
@@ -355,7 +345,7 @@ kill_window (void *data)
void
show_version (void *data)
{
- display_msg_in_bar (get_screen(), " " PACKAGE " " VERSION " ", 0, 0);
+ message (" " PACKAGE " " VERSION " ", 0, 0);
}
void
@@ -369,7 +359,7 @@ command (void *data)
struct sbuf *buf = NULL;
if (data == NULL)
- input = get_input (get_screen(), MESSAGE_PROMPT_COMMAND);
+ input = get_input (MESSAGE_PROMPT_COMMAND);
else
input = strdup ((char *) data);
@@ -430,7 +420,7 @@ command (void *data)
sbuf_concat (buf, cmd);
sbuf_concat (buf, "' ");
- display_msg_in_bar (get_screen(), sbuf_get (buf), 0, 0);
+ message (sbuf_get (buf), 0, 0);
sbuf_free (buf);
@@ -443,7 +433,7 @@ shell_command (void *data)
char *cmd;
if (data == NULL)
- cmd = get_input (get_screen(), MESSAGE_PROMPT_SHELL_COMMAND);
+ cmd = get_input (MESSAGE_PROMPT_SHELL_COMMAND);
else
cmd = strdup ((char *) data);
@@ -458,7 +448,7 @@ xterm_command (void *data)
char *cmd, *realcmd;
if (data == NULL)
- cmd = get_input (get_screen(), MESSAGE_PROMPT_XTERM_COMMAND);
+ cmd = get_input (MESSAGE_PROMPT_XTERM_COMMAND);
else
cmd = strdup ((char *) data);
@@ -504,7 +494,7 @@ switch_to(void *data)
char *prog;
if (data == NULL)
- prog = get_input (get_screen(), MESSAGE_PROMPT_SWITCH_WM);
+ prog = get_input (MESSAGE_PROMPT_SWITCH_WM);
else
prog = strdup ((char *) data);
@@ -558,7 +548,7 @@ show_clock (void *data)
if (rp_current_window)
{
s = rp_current_window->scr;
- display_msg_in_bar (s, msg, 0, 0);
+ message (msg, 0, 0);
}
free(msg);
}
diff --git a/src/actions.h b/src/actions.h
index f1229ca..4ab6ddd 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -42,7 +42,7 @@ void bye(void *dummy);
void generate_prefix (void *data);
void generate_key_event (void *data);
void abort_keypress (void *data);
-void goto_window_number (void* data);
+void goto_window_number (void *data);
void spawn(void *data);
void shell_command (void *data);
void command (void *data);
diff --git a/src/bar.c b/src/bar.c
index d5a2a9b..15f0090 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -136,15 +136,16 @@ update_window_names (screen_info *s)
sbuf_copy (bar_buffer, MESSAGE_NO_MANAGED_WINDOWS);
}
- display_msg_in_bar (s, sbuf_get (bar_buffer), mark_start, mark_end);
+ message (sbuf_get (bar_buffer), mark_start, mark_end);
}
void
-display_msg_in_bar (screen_info *s, char *msg, int mark_start, int mark_end)
+message (char *msg, int mark_start, int mark_end)
{
XGCValues lgv;
GC lgc;
unsigned long mask;
+ screen_info *s = current_screen ();
int width = BAR_X_PADDING * 2 + XTextWidth (s->font, msg, strlen (msg));
int height = (FONT_HEIGHT (s->font) + BAR_Y_PADDING * 2);
diff --git a/src/bar.h b/src/bar.h
index 4479667..088c7af 100644
--- a/src/bar.h
+++ b/src/bar.h
@@ -27,6 +27,6 @@ int show_bar (screen_info *s);
int hide_bar (screen_info *s);
int bar_y (screen_info *s);
int bar_x (screen_info *s, int width);
-void display_msg_in_bar (screen_info *s, char *msg, int hl_start, int hl_end);
+void message (char *msg, int hl_start, int hl_end);
#endif /* ! _RATPOISON_BAR_H */
diff --git a/src/events.c b/src/events.c
index 57ab937..4c310a6 100644
--- a/src/events.c
+++ b/src/events.c
@@ -333,7 +333,7 @@ handle_key (screen_info *s)
/* No key match, notify user. */
XSetInputFocus (dpy, fwin, revert, CurrentTime);
- display_msg_in_bar (s, msg, 0, 0);
+ message (msg, 0, 0);
free (msg);
}
diff --git a/src/input.c b/src/input.c
index e9ff714..835d233 100644
--- a/src/input.c
+++ b/src/input.c
@@ -128,8 +128,9 @@ read_key (KeySym *keysym, unsigned int *modifiers)
}
char *
-get_input (screen_info *s, char *prompt)
+get_input (char *prompt)
{
+ screen_info *s = current_screen ();
int cur_len; /* Current length of the string. */
int allocated_len=100; /* The ammount of memory we allocated for str */
KeySym ch;
@@ -140,6 +141,7 @@ get_input (screen_info *s, char *prompt)
int width = 200 + prompt_width;
char *str;
+
/* We don't want to draw overtop of the program bar. */
hide_bar (s);
diff --git a/src/input.h b/src/input.h
index a5fe57a..dd7c44b 100644
--- a/src/input.h
+++ b/src/input.h
@@ -24,7 +24,7 @@
char *keysym_to_string (KeySym keysym, unsigned int modifier);
void cook_keycode (KeyCode keycode, KeySym *keysym, unsigned int *mod);
-char *get_input (screen_info *s, char *prompt);
+char *get_input (char *prompt);
void read_key (KeySym *keysym, unsigned int *mode);
#endif /* ! _RATPOISON_INPUT_H */
diff --git a/src/manage.c b/src/manage.c
index 7a9039b..2c0156e 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -53,6 +53,15 @@ grab_prefix_key (Window w)
#endif
}
+screen_info*
+current_screen ()
+{
+ if (rp_current_window)
+ return rp_current_window->scr;
+ else
+ return &screens[0];
+}
+
void
update_normal_hints (rp_window *win)
{
diff --git a/src/manage.h b/src/manage.h
index fccf8dc..acfa68b 100644
--- a/src/manage.h
+++ b/src/manage.h
@@ -25,6 +25,7 @@
#include "data.h"
int unmanaged_window (Window w);
+screen_info* current_screen ();
void scanwins(screen_info *s);
void manage (rp_window *w, screen_info *s);
void unmanage (rp_window *w);