summaryrefslogtreecommitdiff
path: root/bar.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-08-26 04:35:10 +0000
committersabetts <sabetts>2000-08-26 04:35:10 +0000
commit592583e898157e6047412a398e33ed89b080e1d6 (patch)
treed8560e0a118150bcfdb8b8ed3f132c8cb0ccf3a5 /bar.c
parentd8a5963532fb35687bedee59f2235144f3930fbd (diff)
downloadratpoison-592583e898157e6047412a398e33ed89b080e1d6.zip
- Fixed some of the X_SetInputFocus bugs that were crashing ratpoison.
- Now responds to Raise and Lower X events (fixes the C-x 5 o bug with emacs) - Added numbers to each window and the ability to jump to that window by hitting Prefix <window num>
Diffstat (limited to 'bar.c')
-rw-r--r--bar.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/bar.c b/bar.c
index d5ac700..91c67ad 100644
--- a/bar.c
+++ b/bar.c
@@ -52,13 +52,18 @@ toggle_bar (screen_info *s)
static int
calc_bar_width (XFontStruct *font)
{
+ char str[100]; /* window names are capped at 99 chars */
+ int i;
int size = 1;
rp_window *cur;
- for (cur = rp_window_head; cur; cur = cur->next)
+ for (i=0, cur = rp_window_head; cur; cur = cur->next)
{
if (cur->state == STATE_UNMAPPED) continue;
- size += 10 + XTextWidth (font, cur->name, strlen (cur->name));
+
+ sprintf (str, "%d-%s", i, cur->name);
+ size += 10 + XTextWidth (font, str, strlen (str));
+ i++;
}
return size;
@@ -81,6 +86,8 @@ bar_y (screen_info *s)
void
update_window_names (screen_info *s)
{
+ char str[100]; /* window names are capped at 99 chars */
+ int i;
int width = calc_bar_width (s->font);
rp_window *cur;
int cur_x = 5;
@@ -95,23 +102,23 @@ update_window_names (screen_info *s)
XRaiseWindow (dpy, s->bar_window);
if (rp_window_head == NULL) return;
- for (cur = rp_window_head; cur; cur = cur->next)
+ for (i=0, cur = rp_window_head; cur; cur = cur->next)
{
if (cur->state == STATE_UNMAPPED) continue;
+ sprintf (str, "%d-%s", i, cur->name);
if ( rp_current_window == cur)
{
XDrawString (dpy, s->bar_window, s->bold_gc, cur_x,
- BAR_PADDING + s->font->max_bounds.ascent, cur->name, strlen (cur->name));
+ BAR_PADDING + s->font->max_bounds.ascent, str, strlen (str));
}
else
{
XDrawString (dpy, s->bar_window, s->normal_gc, cur_x,
- BAR_PADDING + s->font->max_bounds.ascent, cur->name, strlen (cur->name));
+ BAR_PADDING + s->font->max_bounds.ascent, str, strlen (str));
}
- cur_x += 10 + XTextWidth (s->font, cur->name, strlen (cur->name));
+
+ cur_x += 10 + XTextWidth (s->font, str, strlen (str));
+ i++;
}
}
-
-
-