diff options
-rw-r--r-- | doc/ratpoison.1 | 8 | ||||
-rw-r--r-- | doc/ratpoison.texi | 14 | ||||
-rw-r--r-- | src/actions.c | 66 | ||||
-rw-r--r-- | src/data.h | 4 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/screen.c | 2 | ||||
-rw-r--r-- | src/split.c | 5 | ||||
-rw-r--r-- | src/window.c | 7 |
8 files changed, 104 insertions, 4 deletions
diff --git a/doc/ratpoison.1 b/doc/ratpoison.1 index a110baf..913dce3 100644 --- a/doc/ratpoison.1 +++ b/doc/ratpoison.1 @@ -775,6 +775,14 @@ Default is black. The background color of the windows ratpoison creates. .br Default is white. +.var fwcolor color +The border color of the focused window. +.br +Default is black. +.var bwcolor color +The border color of unfocused windows. +.br +Default is black. .var barpadding x y Set horizontal padding of ratpoison windows to \fIx\fP and vertical padding to \fIy\fP. diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index 5c7e5cc..b1cc5c0 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -1339,6 +1339,20 @@ is any valid X11 color. When called with no arguments, the current setting is returned. @end deffn +@deffn Command {set fwcolor} @var{color} +Set the border color for the focused window. +is any valid X11 color. + +When called with no arguments, the current setting is returned. +@end deffn + +@deffn Command {set bwcolor} @var{color} +Set the border color for unfocused windows. +is any valid X11 color. + +When called with no arguments, the current setting is returned. +@end deffn + @deffn Command {set barpadding} @var{x} @var{y} @c @deffnx Command defbarpadding @var{x} @var{y} Set the horizontal and vertical padding inside the bar. diff --git a/src/actions.c b/src/actions.c index 4365679..0a1f4f1 100644 --- a/src/actions.c +++ b/src/actions.c @@ -64,6 +64,8 @@ static cmdret * set_winname (struct cmdarg **args); static cmdret * set_framefmt (struct cmdarg **args); static cmdret * set_fgcolor (struct cmdarg **args); static cmdret * set_bgcolor (struct cmdarg **args); +static cmdret * set_fwcolor (struct cmdarg **args); +static cmdret * set_bwcolor (struct cmdarg **args); static cmdret * set_barpadding (struct cmdarg **args); static cmdret * set_winliststyle (struct cmdarg **args); static cmdret * set_framesels (struct cmdarg **args); @@ -129,6 +131,8 @@ init_set_vars(void) add_set_var ("framefmt", set_framefmt, 1, "", arg_REST); add_set_var ("fgcolor", set_fgcolor, 1, "", arg_STRING); add_set_var ("bgcolor", set_bgcolor, 1, "", arg_STRING); + add_set_var ("fwcolor", set_fwcolor, 1, "", arg_STRING); + add_set_var ("bwcolor", set_bwcolor, 1, "", arg_STRING); add_set_var ("barpadding", set_barpadding, 2, "", arg_NUMBER, "", arg_NUMBER); add_set_var ("winliststyle", set_winliststyle, 1, "", arg_STRING); add_set_var ("framesels", set_framesels, 1, "", arg_STRING); @@ -3894,6 +3898,68 @@ set_bgcolor (struct cmdarg **args) return cmdret_new (RET_SUCCESS, NULL); } +static cmdret * +set_fwcolor (struct cmdarg **args) +{ + int i; + XColor color, junk; + rp_window *win = current_window(); + + if (args[0] == NULL) + return cmdret_new (RET_SUCCESS, "%s", defaults.fwcolor_string); + + for (i=0; i<num_screens; i++) + { + if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk)) + return cmdret_new (RET_FAILURE, "deffwcolor: unknown color"); + + screens[i].fw_color = color.pixel; + update_gc (&screens[i]); + + free (defaults.fwcolor_string); + defaults.fwcolor_string = xstrdup (ARG_STRING(0)); + } + + /* Update current window. */ + if (win != NULL) + XSetWindowBorder (dpy, win->w, win->scr->fw_color); + + return cmdret_new (RET_SUCCESS, NULL); +} + +static cmdret * +set_bwcolor (struct cmdarg **args) +{ + int i; + XColor color, junk; + rp_window *win, *cur = current_window(); + + if (args[0] == NULL) + return cmdret_new (RET_SUCCESS, "%s", defaults.bwcolor_string); + + for (i=0; i<num_screens; i++) + { + if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk)) + return cmdret_new (RET_FAILURE, "defbwcolor: unknown color"); + + screens[i].bw_color = color.pixel; + update_gc (&screens[i]); + + free (defaults.bwcolor_string); + defaults.bwcolor_string = xstrdup (ARG_STRING(0)); + } + + /* Update all the visible windows. */ + list_for_each_entry (win,&rp_mapped_window,node) + { + if (win != cur) + XSetWindowBorder (dpy, win->w, win->scr->bw_color); + } + + + return cmdret_new (RET_SUCCESS, NULL); +} + cmdret * cmd_setenv (int interactive, struct cmdarg **args) { @@ -155,7 +155,7 @@ struct rp_screen int xine_screen_num; /* Our screen number for the Xinerama extension */ Colormap def_cmap; Cursor rat; - unsigned long fg_color, bg_color; /* The pixel color. */ + unsigned long fg_color, bg_color, fw_color, bw_color; /* The pixel color. */ /* Here to abstract over the Xinerama vs X screens difference */ int left, top, width, height; @@ -235,6 +235,8 @@ struct rp_defaults char *fgcolor_string; char *bgcolor_string; + char *fwcolor_string; + char *bwcolor_string; int wait_for_key_cursor; @@ -548,6 +548,8 @@ init_defaults (void) defaults.fgcolor_string = xstrdup ("black"); defaults.bgcolor_string = xstrdup ("white"); + defaults.fwcolor_string = xstrdup ("black"); + defaults.bwcolor_string = xstrdup ("black"); defaults.wait_for_key_cursor = 1; diff --git a/src/screen.c b/src/screen.c index 88b95b7..71a8f50 100644 --- a/src/screen.c +++ b/src/screen.c @@ -301,6 +301,8 @@ init_screen (rp_screen *s, int screen_num) s->fg_color = BlackPixel (dpy, s->screen_num); s->bg_color = WhitePixel (dpy, s->screen_num); + s->fw_color = BlackPixel (dpy, s->screen_num); + s->bw_color = BlackPixel (dpy, s->screen_num); /* Setup the GC for drawing the font. */ gv.foreground = s->fg_color; diff --git a/src/split.c b/src/split.c index 9b1d41b..561e928 100644 --- a/src/split.c +++ b/src/split.c @@ -806,9 +806,10 @@ remove_frame (rp_frame *frame) the new frame size. */ if (cur->win_number != EMPTY) { - win = find_window_number (cur->win_number); + rp_window *new = find_window_number (cur->win_number); maximize_all_windows_in_frame (cur); - XRaiseWindow (dpy, win->w); + give_window_focus (new, win); + XRaiseWindow (dpy, new->w); } } else diff --git a/src/window.c b/src/window.c index bde03f6..889772c 100644 --- a/src/window.c +++ b/src/window.c @@ -411,7 +411,10 @@ give_window_focus (rp_window *win, rp_window *last_win) /* Warp the cursor to the window's saved position if last_win and win are different windows. */ if (last_win != NULL && win != last_win) - save_mouse_position (last_win); + { + save_mouse_position (last_win); + XSetWindowBorder (dpy, last_win->w, last_win->scr->bw_color); + } if (win == NULL) return; @@ -430,6 +433,8 @@ give_window_focus (rp_window *win, rp_window *last_win) if (last_win != NULL) XUninstallColormap (dpy, last_win->colormap); XInstallColormap (dpy, win->colormap); + XSetWindowBorder (dpy, win->w, win->scr->fw_color); + /* Finally, give the window focus */ rp_current_screen = win->scr->xine_screen_num; set_rp_window_focus (win); |