summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-04-06 10:28:09 +0000
committersabetts <sabetts>2003-04-06 10:28:09 +0000
commit0034ffb7605fdb3f569e98aca86097f6e480fa8b (patch)
tree410b9d8109eb60c2e3d56e87336ac4621de1f3d1 /src
parent7dad9dd35ea39dbe3faa727cc0c0d074a5ea1abe (diff)
downloadratpoison-0034ffb7605fdb3f569e98aca86097f6e480fa8b.zip
* src/bar.c (marked_wrapped_message): make the marked line span
the whole line. * src/actions.c (cmd_number): update any frames pointing to the windows that have changed.
Diffstat (limited to 'src')
-rw-r--r--src/actions.c17
-rw-r--r--src/bar.c62
2 files changed, 48 insertions, 31 deletions
diff --git a/src/actions.c b/src/actions.c
index 352818c..e287b4d 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1112,6 +1112,7 @@ cmd_time (int interactive, void *data)
char *
cmd_number (int interactive, void *data)
{
+ rp_window_frame *frame;
int old_number, new_number;
rp_window *other_win, *win;
char *str;
@@ -1180,7 +1181,14 @@ cmd_number (int interactive, void *data)
old_number = win->number;
other_win->number = old_number;
- /* Resort the the window in the list */
+ /* Update the frame containing the window. */
+ if (other_win->frame_number != EMPTY)
+ {
+ frame = screen_get_frame (other_win->scr, other_win->frame_number);
+ frame->win_number = old_number;
+ }
+
+ /* Resort the window in the list */
list_del (&other_win->node);
insert_into_list (other_win, &rp_mapped_window);
}
@@ -1192,6 +1200,13 @@ cmd_number (int interactive, void *data)
win->number = new_number;
numset_add_num (rp_window_numset, new_number);
+ /* Update the frame containing the window. */
+ if (win->frame_number != EMPTY)
+ {
+ frame = screen_get_frame (win->scr, win->frame_number);
+ frame->win_number = new_number;
+ }
+
/* resort the the window in the list */
list_del (&win->node);
insert_into_list (win, &rp_mapped_window);
diff --git a/src/bar.c b/src/bar.c
index 0f2fc64..c084775 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -255,18 +255,13 @@ marked_wrapped_message (char *msg, int mark_start, int mark_end)
int num_lines;
int line_no=0;
char tmp_buf[100];
-
-
-
int width = defaults.bar_x_padding * 2 + max_line_length(msg);
- /* XTextWidth (defaults.font, msg, strlen (msg)); */
- int line_height = (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2);
+ int line_height = (FONT_HEIGHT (defaults.font));
int height;
PRINT_DEBUG (("msg = %s\n", msg));
PRINT_DEBUG (("mark_start = %d, mark_end = %d\n", mark_start, mark_end));
-
num_lines = count_lines(msg, strlen(msg));
height = line_height * num_lines;
@@ -284,33 +279,35 @@ marked_wrapped_message (char *msg, int mark_start, int mark_end)
XMoveResizeWindow (dpy, s->bar_window,
bar_x (s, width), bar_y (s, height),
width,
- height);
+ height + defaults.bar_y_padding * 2);
XRaiseWindow (dpy, s->bar_window);
XClearWindow (dpy, s->bar_window);
XSync (dpy, False);
/* if(!defaults.wrap_window_list){
- XDrawString (dpy, s->bar_window, s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent,
- msg, strlen (msg));
- } else { */
+ XDrawString (dpy, s->bar_window, s->normal_gc,
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent,
+ msg, strlen (msg));
+ } else { */
for(i=0; i<=strlen(msg); ++i) {
- if (msg[i]!='\0' && msg[i]!='\n') {
- tmp_buf[j]=msg[i];
- j++;
- }
- else {
- tmp_buf[j]='\0';
- XDrawString (dpy, s->bar_window, s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent
- + line_no * line_height,
- tmp_buf, strlen(tmp_buf));
- j=0;
- line_no++;
- }
+ if (msg[i]!='\0' && msg[i]!='\n')
+ {
+ tmp_buf[j]=msg[i];
+ j++;
+ }
+ else
+ {
+ tmp_buf[j]='\0';
+ XDrawString (dpy, s->bar_window, s->normal_gc,
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent
+ + line_no * line_height,
+ tmp_buf, strlen(tmp_buf));
+ j=0;
+ line_no++;
+ }
}
@@ -360,7 +357,7 @@ marked_wrapped_message (char *msg, int mark_start, int mark_end)
PRINT_DEBUG (("start_line = %d, end_line = %d\n", start_line, end_line));
if (mark_start == 0 || start_pos_in_line == 0)
- start = 0;
+ start = defaults.bar_x_padding;
else
start = XTextWidth (defaults.font,
&msg[start_line_beginning],
@@ -373,7 +370,8 @@ marked_wrapped_message (char *msg, int mark_start, int mark_end)
if (mark_end != strlen (msg)) end -= defaults.bar_x_padding;
- width = end - start;
+/* width = end - start; */
+ width = max_line_length(msg);
PRINT_DEBUG (("start = %d, end = %d, width = %d\n", start, end, width));
@@ -382,12 +380,16 @@ marked_wrapped_message (char *msg, int mark_start, int mark_end)
mask = GCForeground | GCFunction;
lgc = XCreateGC(dpy, s->root, mask, &lgv);
- XFillRectangle (dpy, s->bar_window, lgc, start, (start_line-1)*line_height, width, (end_line-start_line+1)*line_height);
+ XFillRectangle (dpy, s->bar_window, lgc,
+ start, (start_line-1)*line_height + defaults.bar_y_padding,
+ width, (end_line-start_line+1)*line_height);
lgv.foreground = s->bg_color;
lgc = XCreateGC(dpy, s->root, mask, &lgv);
- XFillRectangle (dpy, s->bar_window, lgc, start, (start_line-1)*line_height, width, (end_line-start_line+1)*line_height);
+ XFillRectangle (dpy, s->bar_window, lgc,
+ start, (start_line-1)*line_height + defaults.bar_y_padding,
+ width, (end_line-start_line+1)*line_height);
}
/* Keep a record of the message. */