ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xdefaults.C
(Generate patch)

Comparing rxvt-unicode/src/xdefaults.C (file contents):
Revision 1.90 by root, Tue Jan 31 19:53:31 2006 UTC vs.
Revision 1.96 by root, Sat Jan 13 15:06:54 2007 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*----------------------------------------------------------------------*
2 * File: xdefaults.C 2 * File: xdefaults.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 6 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
26#include "../config.h" 26#include "../config.h"
27#include "rxvt.h" 27#include "rxvt.h"
28#include "version.h" 28#include "version.h"
29 29
30#ifdef KEYSYM_RESOURCE 30#ifdef KEYSYM_RESOURCE
31#include "keyboard.h" 31# include "keyboard.h"
32#endif 32#endif
33 33
34/* place holders used for parsing command-line options */ 34/* place holders used for parsing command-line options */
35#define Optflag_Reverse 0x40000000UL 35#define Optflag_Reverse 0x40000000UL
36#define Optflag_Boolean 0x80000000UL 36#define Optflag_Boolean 0x80000000UL
37#define Optflag_mask 0x3fffffffUL 37#define Optflag_mask 0x3fffffffUL
38 38
39/*{{{ monolithic option/resource structure: */ 39/* monolithic option/resource structure: */
40/* 40/*
41 * `string' options MUST have a usage argument 41 * `string' options MUST have a usage argument
42 * `switch' and `boolean' options have no argument 42 * `switch' and `boolean' options have no argument
43 * if there's no desc (ription), it won't appear in rxvt_usage () 43 * if there's no desc (ription), it won't appear in rxvt_usage ()
44 */ 44 */
117#if OFF_FOCUS_FADING 117#if OFF_FOCUS_FADING
118 STRG (Rs_fade, "fading", "fade", "%", "fade colors x% percent when rxvt-unicode is losing focus"), 118 STRG (Rs_fade, "fading", "fade", "%", "fade colors x% percent when rxvt-unicode is losing focus"),
119 STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"), 119 STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"),
120#endif 120#endif
121#if TINTING 121#if TINTING
122 STRG (Rs_shade, "shading", "sh", "%", "shade background by x% when tinting."), 122 STRG (Rs_shade, "shading", "sh", "%", "shade background by x % when tinting."),
123#endif 123#endif
124 BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"), 124 BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"),
125#ifndef NO_BELL 125#ifndef NO_BELL
126 BOOL (Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"), 126 BOOL (Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"),
127# if ! defined(NO_MAPALERT) && defined(MAPALERT_OPTION) 127# if ! defined(NO_MAPALERT) && defined(MAPALERT_OPTION)
266#undef INFO 266#undef INFO
267#undef STRG 267#undef STRG
268#undef RSTRG 268#undef RSTRG
269#undef SWCH 269#undef SWCH
270#undef BOOL 270#undef BOOL
271/*}}} */
272 271
273static const char releasestring[] = "rxvt-unicode (" RXVTNAME ") v" VERSION " - released: " DATE "\n"; 272static const char releasestring[] = "rxvt-unicode (" RXVTNAME ") v" VERSION " - released: " DATE "\n";
274static const char optionsstring[] = "options: " 273static const char optionsstring[] = "options: "
275#if ENABLE_PERL 274#if ENABLE_PERL
276 "perl," 275 "perl,"
407 rxvt_log (" [-help] [--help]\n"); 406 rxvt_log (" [-help] [--help]\n");
408 407
409 for (col = 1, i = 0; i < optList_size; i++) 408 for (col = 1, i = 0; i < optList_size; i++)
410 if (optList[i].desc != NULL) 409 if (optList[i].desc != NULL)
411 { 410 {
412 int len = 0; 411 int len = 0;
413 412
414 if (!optList_isBool (i)) 413 if (!optList_isBool (i))
415 { 414 {
416 len = optList_strlen (i); 415 len = optList_strlen (i);
417 if (len > 0) 416 if (len > 0)
484 483
485/*{{{ get command-line options before getting resources */ 484/*{{{ get command-line options before getting resources */
486void 485void
487rxvt_term::get_options (int argc, const char *const *argv) 486rxvt_term::get_options (int argc, const char *const *argv)
488{ 487{
489 int i, bad_option = 0; 488 int i, bad_option = 0;
490 489
491 for (i = 1; i < argc; i++) 490 for (i = 1; i < argc; i++)
492 { 491 {
493 unsigned int entry, longopt = 0; 492 unsigned int entry, longopt = 0;
494 const char *flag, *opt; 493 const char *flag, *opt;
541 * X resources to set these values before we settle for 540 * X resources to set these values before we settle for
542 * default values 541 * default values
543 */ 542 */
544 543
545 if (optList[entry].doff != -1) 544 if (optList[entry].doff != -1)
545 {
546 if (flag == resval_on && !argv [i+1])
547 rxvt_fatal ("option '%s' needs an argument, aborting.\n", argv [i]);
548
546 rs[optList[entry].doff] = flag == resval_on && argv[i+1] 549 rs[optList[entry].doff] = flag == resval_on ? argv[++i] : resval_undef;
547 ? argv[++i] : resval_undef; 550 }
548
549 if (optList[entry].doff == Rs_color + Color_tint) printf ("doff %d is %s\n",optList[entry].doff,rs[optList[entry].doff]);//D
550 } 551 }
551 else 552 else
552 { /* boolean value */ 553 { /* boolean value */
553 set_option (optList[entry].flag & Optflag_mask, flag == resval_on); 554 set_option (optList[entry].flag & Optflag_mask, flag == resval_on);
554 555
773} 774}
774 775
775const char * 776const char *
776rxvt_term::x_resource (const char *name) 777rxvt_term::x_resource (const char *name)
777{ 778{
778 XrmDatabase database = XrmGetDatabase (xdisp); 779 XrmDatabase database = XrmGetDatabase (dpy);
779 780
780 const char *p = get_res (database, rs[Rs_name], name); 781 const char *p = get_res (database, rs[Rs_name], name);
781 const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name); 782 const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name);
782 783
783 if (p == NULL || (p0 && strcmp (p, p0) == 0)) 784 if (p == NULL || (p0 && strcmp (p, p0) == 0))
835 836
836 /* 837 /*
837 * [R5 or later]: enumerate the resource database 838 * [R5 or later]: enumerate the resource database
838 */ 839 */
839# ifdef KEYSYM_RESOURCE 840# ifdef KEYSYM_RESOURCE
840 XrmDatabase database = XrmGetDatabase (xdisp); 841 XrmDatabase database = XrmGetDatabase (dpy);
841 XrmName name_prefix[3]; 842 XrmName name_prefix[3];
842 XrmClass class_prefix[3]; 843 XrmClass class_prefix[3];
843 844
844 name_prefix[0] = XrmStringToName (rs[Rs_name]); 845 name_prefix[0] = XrmStringToName (rs[Rs_name]);
845 name_prefix[1] = XrmStringToName ("keysym"); 846 name_prefix[1] = XrmStringToName ("keysym");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines