repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 63ce725d31d1949742d3a0f47be3f108d1d68ea3: path_to: revision_to:
commit 63ce725d31d1949742d3a0f47be3f108d1d68ea3 Author: Marc LehmannDate: Thu Jun 7 16:04:31 2012 +0000 visual selection diff --git a/Changes b/Changes
--- a/Changes
+++ b/Changes
@@ -56,6 +56,8 @@ TODO: description into --help output?
- iso14755 51 mode window now displays row and column.
- perl extensions can now provide commandline switches and resources
which show up in -help etc.
+ - implement a -visual switch and move that and -depth to frills, also
+ warn when we can't get the requested visual.
9.15 Sat Jan 21 13:36:56 CET 2012
- remove "using namespace std" because clang erroneously
diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod
--- a/doc/rxvt.7.pod +++ b/doc/rxvt.7.pod @@ -2438,6 +2438,7 @@ in combination with other switches) is: skip builtin block graphics (-sbg) separate highlight colour (-highlightColor, -highlightTextColor) extended mouse reporting modes (1005 and 1015). + visual selection via -visual and -depth. It also enables some non-essential features otherwise disabled, such as: diff --git a/src/init.C b/src/init.C
--- a/src/init.C +++ b/src/init.C @@ -590,9 +590,11 @@ rxvt_term::init_resources (int argc, const char *const *argv) set (display); extract_resources (); -#if XFT - if (rs[Rs_depth]) - select_visual (strtol (rs[Rs_depth], 0, 0)); +#if ENABLE_FRILLS + if (rs[Rs_visual]) + select_visual (strtol (rs[Rs_visual], 0, 0)); + else if (rs[Rs_depth]) + select_depth (strtol (rs[Rs_depth], 0, 0)); #endif for (int i = NUM_RESOURCES; i--; ) diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
--- a/src/rxvttoolkit.C
+++ b/src/rxvttoolkit.C
@@ -262,21 +262,41 @@ rxvt_screen::set (rxvt_display *disp)
cmap = DefaultColormapOfScreen (screen);
}
+#if ENABLE_FRILLS
+
void
-rxvt_screen::select_visual (int bitdepth)
+rxvt_screen::select_visual (int id)
{
-#if XFT
XVisualInfo vinfo;
+ vinfo.visualid = id;
+ int n;
- if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo))
+ if (XVisualInfo *vi = XGetVisualInfo (dpy, VisualIDMask, &vinfo, &n))
{
- depth = bitdepth;
- visual = vinfo.visual;
- cmap = XCreateColormap (dpy, display->root, visual, AllocNone);
+ depth = vi->depth;
+ visual = vi->visual;
+
+ XFree (vi);
+
+ cmap = XCreateColormap (dpy, display->root, visual, AllocNone);
}
-#endif
+ else
+ rxvt_warn ("cannot requested visual id 0x%02x, using default visual.\n", id);
+}
+
+void
+rxvt_screen::select_depth (int bitdepth)
+{
+ XVisualInfo vinfo;
+
+ if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo))
+ select_visual (vinfo.visualid);
+ else
+ rxvt_warn ("no visual found for requested depth %d, using default visual.\n", bitdepth);
}
+#endif
+
void
rxvt_screen::clear ()
{
diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h
--- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -214,7 +214,8 @@ struct rxvt_screen #endif void set (rxvt_display *disp); - void select_visual (int bitdepth); + void select_visual (int id); + void select_depth (int bitdepth); // select visual by depth void clear (); };
-----END OF PAGE-----