/* ** CreatePreferencesDatabase ** ** Process a preferences file and the command line options pertaining to ** the X resources used to set those preferences. Create an X database ** of the results. The reason for this odd set of functionality is ** to process command line options before XtDisplayInitialize reads them ** into the application database that the toolkit attaches to the display. ** This allows command line arguments to properly override values specified ** in the preferences file. ** ** fileName Name only of the preferences file to be found ** in the user's home directory ** appName Application name to use in reading the preference ** resources ** opTable Xrm command line option table for the resources ** used in the preferences file ONLY. Command line ** options for other X resources should be processed ** by XtDisplayInitialize. ** nOptions Number of items in opTable ** argcInOut Address of argument count. This will be altered ** to remove the command line options that are ** recognized in the option table. ** argvInOut Argument vector. Will be altered as argcInOut. */ XrmDatabase CreatePreferencesDatabase(const char *fullName, const char *appName, XrmOptionDescList opTable, int nOptions, unsigned int *argcInOut, char **argvInOut) { XrmDatabase db; int argcCopy; char **argvCopy; char *fileString; static XrmOptionDescRec xrmOnlyTable[] = {{"-xrm", NULL, XrmoptionResArg, (caddr_t)NULL}}; /* read the preferences file into an X database. On failure prefDB will be NULL. */ if (NULL == fullName) { db = NULL; } else { fileString = ReadAnyTextFile(fullName, False); if (NULL == fileString) { db = NULL; } else { char* rsrcName; db = XrmGetStringDatabase(fileString); XtFree(fileString); /* Add a resource to the database which remembers that the file is read, so that NEdit will know it. */ rsrcName = (char*) XtMalloc(strlen(appName) + 14); sprintf(rsrcName, "%s.prefFileRead", appName); XrmPutStringResource(&db, rsrcName, "True"); XtFree(rsrcName); } } /* parse the command line, storing results in the preferences database */ XrmParseCommand(&db, opTable, nOptions, appName, (int *)argcInOut, argvInOut); /* process -xrm (resource setting by resource name) arguments so those pertaining to preference resources will be included in the database. Don't remove -xrm arguments from the argument vector, however, so XtDisplayInitialize can still read the non-preference resources */ argvCopy = (char**)XtMalloc(sizeof(char *) * *argcInOut); memcpy(argvCopy, argvInOut, sizeof(char *) * *argcInOut); argcCopy = *argcInOut; XrmParseCommand(&db, xrmOnlyTable, XtNumber(xrmOnlyTable), appName, &argcCopy, argvCopy); XtFree((char *)argvCopy); return db; }
GC setup(Display * dpy, int argc, char ** argv, int *width_r, int *height_r, XFontSet *font_r){ int width, height; unsigned long background, border; Window win; GC pen; XGCValues values; XFontSet font; XrmDatabase db; XrmInitialize(); db = XrmGetDatabase(dpy); XrmParseCommand(&db, xrmTable, sizeof(xrmTable)/sizeof(xrmTable[0]), "xtut7", &argc, argv); font = getFont(dpy, db, "xtut7.font", "xtut7.Font", "fixed"); background = getColour(dpy, db, "xtut7.background", "xtut7.BackGround", "DarkGreen"); border = getColour(dpy, db, "xtut7.border", "xtut7.Border", "LightGreen"); values.foreground = getColour(dpy, db, "xtut7.foreground", "xtut7.ForeGround", "Red"); width = 400; height = 400; win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), /* display, parent */ 0,0, /* x, y: the window manager will place the window elsewhere */ width, height, /* width, height */ 2, border, /* border width & colour, unless you have a window manager */ background); /* background colour */ Xutf8SetWMProperties(dpy, win, "XTut7", "xtut7", argv, argc, NULL, NULL, NULL); /* create the pen to draw lines with */ values.line_width = 1; values.line_style = LineSolid; /*values.font = font->fid; */ pen = XCreateGC(dpy, win, GCForeground|GCLineWidth|GCLineStyle,&values); /* tell the display server what kind of events we would like to see */ XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask|StructureNotifyMask|ExposureMask); /* okay, put the window on the screen, please */ XMapWindow(dpy, win); *width_r = width; *height_r = height; *font_r = font; return pen; }
/* Use XrmParseCommand to parse command line options to option variable */ static void doOptMain (int argc, char *argv[]) { /* Initialise resource manager and parse options into database */ XrmInitialize(); XrmParseCommand( &opt_db, opt_tab, sizeof(opt_tab) / sizeof(opt_tab[0]), XC_NAME, &argc, argv ); /* set output level */ if ( XrmGetResource( opt_db, "xclip.olevel", "Xclip.Olevel", &rec_typ, &rec_val ) ) { /* set verbose flag according to option */ if (strcmp(rec_val.addr, "S") == 0) fverb = OSILENT; if (strcmp(rec_val.addr, "Q") == 0) fverb = OQUIET; if (strcmp(rec_val.addr, "V") == 0) fverb = OVERBOSE; } /* set direction flag (in or out) */ if ( XrmGetResource( opt_db, "xclip.direction", "Xclip.Direction", &rec_typ, &rec_val ) ) { if (strcmp(rec_val.addr, "I") == 0) fdiri = T; if (strcmp(rec_val.addr, "O") == 0) fdiri = F; } /* set filter mode */ if ( XrmGetResource( opt_db, "xclip.filter", "Xclip.Filter", &rec_typ, &rec_val ) ) { /* filter mode only allowed in silent mode */ if (fverb == OSILENT) ffilt = T; } /* check for -help and -version */ if ( XrmGetResource( opt_db, "xclip.print", "Xclip.Print", &rec_typ, &rec_val ) ) { if (strcmp(rec_val.addr, "H") == 0) prhelp(argv[0]); if (strcmp(rec_val.addr, "V") == 0) prversion(); } /* check for -display */ if ( XrmGetResource( opt_db, "xclip.display", "Xclip.Display", &rec_typ, &rec_val ) ) { sdisp = rec_val.addr; if (fverb == OVERBOSE) /* print in verbose mode only */ fprintf(stderr, "Display: %s\n", sdisp); } /* check for -loops */ if ( XrmGetResource( opt_db, "xclip.loops", "Xclip.Loops", &rec_typ, &rec_val ) ) { sloop = atoi(rec_val.addr); if (fverb == OVERBOSE) /* print in verbose mode only */ fprintf(stderr, "Loops: %i\n", sloop); } /* Read remaining options (filenames) */ while ( (fil_number + 1) < argc ) { if (fil_number > 0) { fil_names = xcrealloc( fil_names, (fil_number + 1) * sizeof(char*) ); } else { fil_names = xcmalloc(sizeof(char*)); } fil_names[fil_number] = argv[fil_number + 1]; fil_number++; } }
void ProcessGroupOptionsDialog::setArgs(const char *args) { int i; int j; int argc; XrmDatabase db; XrmValue value; char *str_type[20]; char *argv[100]; char *other = new char[512]; XmTextSetString(this->execText, ""); XmTextSetString(this->cwdText, ""); XmTextSetString(this->memText, ""); XmTextSetString(this->optionsText, ""); if(args == NULL) return; // // Otherwise, parse the string // argc = 0; int ndx = 0; argv[0] = "PGOD"; i = 1; while(args[ndx]) { argv[i] = (char *)CALLOC(STRLEN(&args[ndx]), sizeof(char)); SkipWhiteSpace(args, ndx); j = 0; while(!IsWhiteSpace(args, ndx) && args[ndx]) argv[i][j++] = args[ndx++]; i++; } argv[i] = NULL; argc = i; db = NULL; XrmParseCommand(&db, opTable, XtNumber(opTable), "PGOD", &argc, argv); if(XrmGetResource(db, "PGOD.exec", "*Exec", str_type, &value)) XmTextSetString(this->execText, value.addr); if(XrmGetResource(db, "PGOD.directory", "*Directory", str_type, &value)) XmTextSetString(this->cwdText, value.addr); if(XrmGetResource(db, "PGOD.memory", "*Number", str_type, &value)) XmTextSetString(this->memText, value.addr); i = 1; other[0] = '\0'; while(argv[i]) { strcat(other, argv[i]); strcat(other, " "); delete(argv[i++]); } if(STRLEN(other) > 0) XmTextSetString(this->optionsText, other); delete other; }
void Parse_options(int *argcp, char **argvp, char *realName, char *host, int *port, int *my_team, int *list, int *join, int *motd, char *nickName, char *dispName, char *shut_msg) { int i, j, firstKeyDef, num; keys_t key; KeySym ks; char *ptr, *str, *myName = "xpilot", *myClass = "XPilot", resValue[MAX_CHARS]; XrmDatabase argDB, rDB; XrmInitialize(); argDB = 0; XrmParseCommand(&argDB, opts, NELEM(opts), myName, argcp, argvp); /* * Check for bad arguments. */ for (i = 1; i < *argcp; i++) { if (argvp[i][0] == '-') { errno = 0; error("Unknown option '%s'", argvp[i]); error("Type: %s -help to see a list of options", argvp[0]); exit(1); } } if (Get_resource(argDB, myName, myClass, "help", NULL, resValue, sizeof resValue) != 0) { Usage(); } if (Get_resource(argDB, myName, myClass, "version", NULL, resValue, sizeof resValue) != 0) { puts(TITLE); exit(0); } Get_resource(argDB, myName, myClass, "shutdown", "", shut_msg, MAX_CHARS); if (Get_string_resource(argDB, myName, myClass, "display", NULL, dispName, MAX_DISP_LEN) == 0 || dispName[0] == '\0') { #ifdef VMS if ((ptr = getenv("DECW$DISPLAY")) != NULL) { #else if ((ptr = getenv("DISPLAY")) != NULL) { #endif strncpy(dispName, ptr, MAX_DISP_LEN); dispName[MAX_DISP_LEN - 1] = '\0'; } else { #ifdef VMS strcpy(dispName, "::0.0"); sprintf(dispName, "%s::0.0", host); #else strcpy(dispName, ":0.0"); #endif } } if ((dpy = XOpenDisplay(dispName)) == NULL) { error("Can't open display '%s'", dispName); exit(1); } Get_resource(argDB, myName, myClass, "visual", "", visualName, sizeof visualName); if (strncasecmp(visualName, "list", 4) == 0) { List_visuals(); exit(0); } Get_file_defaults(&rDB, myName, myClass); XrmMergeDatabases(argDB, &rDB); Get_string_resource(rDB, myName, myClass, "geometry", "", resValue, sizeof resValue); geometry = strdup(resValue); Get_resource(rDB, myName, myClass, "name", realName, nickName, MAX_NAME_LEN); CAP_LETTER(nickName[0]); if (nickName[0] < 'A' || nickName[0] > 'Z') { errno = 0; error("Your player name \"%s\" should start with an uppercase letter", nickName); exit(1); } strncpy(realname, realName, sizeof(realname) - 1); strncpy(name, nickName, sizeof(name) - 1); Get_int_resource(rDB, myName, myClass, "team", TEAM_NOT_SET, my_team); if (*my_team < 0 || *my_team > 9) { *my_team = TEAM_NOT_SET; } team = *my_team; Get_int_resource(rDB, myName, myClass, "port", SERVER_PORT, port); Get_bool_resource(rDB, myName, myClass, "list", "False", list); Get_bool_resource(rDB, myName, myClass, "join", "False", join); Get_bool_resource(rDB, myName, myClass, "motd", "True", motd); Get_float_resource(rDB, myName, myClass, "power", 45.0, &power); Get_float_resource(rDB, myName, myClass, "turnSpeed", 35.0, &turnspeed); Get_float_resource(rDB, myName, myClass, "turnResistance", 0.12, &turnresistance); Get_float_resource(rDB, myName, myClass, "altPower", 35.0, &power_s); Get_float_resource(rDB, myName, myClass, "altTurnSpeed", 25.0, &turnspeed_s); Get_float_resource(rDB, myName, myClass, "altTurnResistance", 0.12, &turnresistance_s); Get_float_resource(rDB, myName, myClass, "sparkProb", 0.50, &spark_prob); spark_rand = (int)(spark_prob * MAX_SPARK_RAND + 0.5f); Get_int_resource(rDB, myName, myClass, "charsPerSecond", 50, &charsPerSecond); Get_bool_resource(rDB, myName, myClass, "markingLights", "True", &i); markingLights = (i == false) ? false : true; Get_int_resource(rDB, myName, myClass, "backgroundPointDist", 8, &map_point_distance); Get_int_resource(rDB, myName, myClass, "backgroundPointSize", DEF_MAP_POINT_SIZE, &map_point_size); LIMIT(map_point_size, MIN_MAP_POINT_SIZE, MAX_MAP_POINT_SIZE); Get_int_resource(rDB, myName, myClass, "sparkSize", DEF_SPARK_SIZE, &spark_size); LIMIT(spark_size, MIN_SPARK_SIZE, MAX_SPARK_SIZE); Get_resource(rDB, myName, myClass, "visual", "", visualName, sizeof visualName); Get_bool_resource(rDB, myName, myClass, "mono", "False", &i); mono = (i != 0) ? true : false; Get_bool_resource(rDB, myName, myClass, "colorSwitch", "True", &i); colorSwitch = (i != 0) ? true : false; Get_int_resource(rDB, myName, myClass, "maxColors", 4, &maxColors); Get_string_resource(rDB, myName, myClass, "black", "", color_names[BLACK], sizeof(color_names[BLACK])); Get_string_resource(rDB, myName, myClass, "white", "", color_names[WHITE], sizeof(color_names[WHITE])); Get_string_resource(rDB, myName, myClass, "blue", "", color_names[BLUE], sizeof(color_names[BLUE])); Get_string_resource(rDB, myName, myClass, "red", "", color_names[RED], sizeof(color_names[RED])); for (i = 0; i < MAX_COLORS; i++) { char buf[8], def[MAX_COLOR_LEN]; sprintf(buf, "color%d", i); strcpy(def, (i < NUM_COLORS) ? color_names[i] : ""); Get_string_resource(rDB, myName, myClass, buf, def, color_names[i], sizeof(color_names[i])); } instruments = 0; Get_bool_resource(rDB, myName, myClass, "showShipName", "True", &i); if (i) { SET_BIT(instruments, SHOW_SHIP_NAME); } Get_bool_resource(rDB, myName, myClass, "showHUD", "True", &i); if (i) { SET_BIT(instruments, SHOW_HUD_INSTRUMENTS); } Get_bool_resource(rDB, myName, myClass, "verticalHUDLine", "False", &i); if (i) { SET_BIT(instruments, SHOW_HUD_VERTICAL); } Get_bool_resource(rDB, myName, myClass, "horizontalHUDLine", "True", &i); if (i) { SET_BIT(instruments, SHOW_HUD_HORIZONTAL); } Get_bool_resource(rDB, myName, myClass, "fuelMeter", "False", &i); if (i) { SET_BIT(instruments, SHOW_FUEL_METER); } Get_bool_resource(rDB, myName, myClass, "fuelGauge", "True", &i); if (i) { SET_BIT(instruments, SHOW_FUEL_GAUGE); } Get_bool_resource(rDB, myName, myClass, "turnSpeedMeter", "False", &i); if (i) { SET_BIT(instruments, SHOW_TURNSPEED_METER); } Get_bool_resource(rDB, myName, myClass, "powerMeter", "False", &i); if (i) { SET_BIT(instruments, SHOW_POWER_METER); } Get_bool_resource(rDB, myName, myClass, "packetSizeMeter", "False", &i); if (i) { SET_BIT(instruments, SHOW_PACKET_SIZE_METER); } Get_bool_resource(rDB, myName, myClass, "packetLossMeter", "False", &i); if (i) { SET_BIT(instruments, SHOW_PACKET_LOSS_METER); } Get_bool_resource(rDB, myName, myClass, "packetDropMeter", "False", &i); if (i) { SET_BIT(instruments, SHOW_PACKET_DROP_METER); } Get_bool_resource(rDB, myName, myClass, "slidingRadar", "False", &i); if (i) { SET_BIT(instruments, SHOW_SLIDING_RADAR); } Get_bool_resource(rDB, myName, myClass, "outlineWorld", "False", &i); if (i) { SET_BIT(instruments, SHOW_OUTLINE_WORLD); } Get_bool_resource(rDB, myName, myClass, "clock", "False", &i); if (i) { SET_BIT(instruments, SHOW_CLOCK); } Get_float_resource(rDB, myName, myClass, "speedFactHUD", 0.0, &hud_move_fact); Get_float_resource(rDB, myName, myClass, "speedFactPTR", 0.0, &ptr_move_fact); Get_int_resource(rDB, myName, myClass, "fuelNotify", 500, &fuelLevel3); Get_int_resource(rDB, myName, myClass, "fuelWarning", 200, &fuelLevel2); Get_int_resource(rDB, myName, myClass, "fuelCritical", 100, &fuelLevel1); Get_resource(rDB, myName, myClass, "gameFont", GAME_FONT, gameFontName, sizeof gameFontName); Get_resource(rDB, myName, myClass, "messageFont", MESSAGE_FONT, messageFontName, sizeof messageFontName); Get_resource(rDB, myName, myClass, "scoreListFont", SCORE_LIST_FONT, scoreListFontName, sizeof scoreListFontName); Get_resource(rDB, myName, myClass, "buttonFont", BUTTON_FONT, buttonFontName, sizeof buttonFontName); Get_resource(rDB, myName, myClass, "textFont", TEXT_FONT, textFontName, sizeof textFontName); Get_resource(rDB, myName, myClass, "talkFont", TALK_FONT, talkFontName, sizeof talkFontName); Get_int_resource(rDB, myName, myClass, "receiveWindowSize", DEF_RECEIVE_WINDOW_SIZE, &receive_window_size); LIMIT(receive_window_size, MIN_RECEIVE_WINDOW_SIZE, MAX_RECEIVE_WINDOW_SIZE); #ifdef SOUND Get_string_resource(rDB, myName, myClass, "sounds", SOUNDFILE, sounds, sizeof sounds); Get_int_resource(rDB, myName, myClass, "maxVolume", 100, &maxVolume); Get_resource(rDB, myName, myClass, "audioServer", NULL, audioServer, sizeof audioServer); #endif Get_bool_resource(rDB, myName, myClass, "toggleShield", "False", &toggle_shield); /* * Key bindings */ maxKeyDefs = 2 * NUM_KEYS; if ((keyDefs = (keydefs_t *) malloc(maxKeyDefs * sizeof(keydefs_t))) == NULL) { error("No memory for key bindings"); exit(1); } num = 0; for (i = 0; i < NELEM(keyResources); i++) { key = keyResources[i].key; Get_resource(rDB, myName, myClass, keyResources[i].resource, keyResources[i].fallback, resValue, sizeof resValue); firstKeyDef = num; for (str = strtok(resValue, " \t\r\n"); str != NULL; str = strtok(NULL, " \t\r\n")) { if ((ks = XStringToKeysym(str)) == NoSymbol) { printf("\"%s\" is not a valid keysym.\n", str); continue; } for (j = firstKeyDef; j < num; j++) { if (keyDefs[j].keysym == ks && keyDefs[j].key == key) { break; } } if (j < num) { continue; } if (num >= maxKeyDefs) { maxKeyDefs += NUM_KEYS; if ((keyDefs = (keydefs_t *) realloc(keyDefs, maxKeyDefs * sizeof(keydefs_t))) == NULL) { error("No memory for key bindings"); exit(1); } } keyDefs[num].keysym = ks; keyDefs[num].key = key; num++; } } if (num < maxKeyDefs) { maxKeyDefs = num; if ((keyDefs = (keydefs_t *) realloc(keyDefs, maxKeyDefs * sizeof(keydefs_t))) == NULL) { error("No memory for key bindings"); exit(1); } } XrmDestroyDatabase(rDB); #ifdef SOUND audioInit(dispName); #endif /* SOUND */ }
void aX_open_disp(aX_options *useropt, int useroptlen, int *argcp, char *argv[], aX_default_resources *defres) { XrmValue value; char *str_type; char *disp_res; char *environment; char *display_name = NULL; char filename[MAX_FILENAME_LEN]; int i; XrmDatabase commandlineDB = NULL, usercommandlineDB = NULL; XrmDatabase homeDB, serverDB, applicationDB; /* if(disp_start.next_disp != NULL) { fprintf(stderr, "aX_open_disp: Cannot open first display twice.\n"); exit(-1); } */ XrmInitialize(); class_name[0] = '\0'; class_name[MAX_CLASS_NAME_LEN] = '\0'; if(defres->class_name != NULL) strncpy(class_name, defres->class_name, MAX_CLASS_NAME_LEN); fill_event_info(); for(i = 1; i < *argcp; i++) if(strcmp(argv[i], "-name") == 0 && ++i < *argcp){ defres->prog_name = argv[i]; break; } prog_name[0] = '\0'; prog_name[MAX_PROG_NAME_LEN] = '\0'; if(defres->prog_name != NULL) strncpy(prog_name, defres->prog_name, MAX_PROG_NAME_LEN); else strncpy(prog_name, argv[0], MAX_PROG_NAME_LEN); defres->prog_name = prog_name; XrmParseCommand(&commandlineDB, (XrmOptionDescRec *) opTable, opTableEntries, prog_name, argcp, argv); if(useropt != NULL) XrmParseCommand(&usercommandlineDB, (XrmOptionDescRec *) useropt, useroptlen, prog_name, argcp, argv); else usercommandlineDB = NULL; /* if(*argcp != 1) { fprintf(stderr, "%s: aX_open_disp: Unrecognised options in command line!\n", prog_name); exit(-1); } */ if(XrmGetResource(commandlineDB, pname(".display"), pclass(".Display"), &str_type, &value)) display_name = (char *) value.addr; if((defres->disp = XOpenDisplay(display_name)) == NULL) { fprintf(stderr, "%s: aX_open_disp: cannot connect to X server %s\n", prog_name, XDisplayName(display_name)); exit(-1); } applicationDB = XrmGetFileDatabase( addstr("/usr/lib/X11/app-defaults/", class_name, filename, MAX_FILENAME_LEN)); /* if(defres->disp->xdefaults) serverDB = XrmGetStringDatabase(defres->disp->xdefaults); else serverDB = NULL; */ disp_res = XResourceManagerString(defres->disp); if(disp_res) serverDB = XrmGetStringDatabase(disp_res); else serverDB = NULL; if((environment = getenv("XENVIRONMENT")) != NULL) homeDB = XrmGetFileDatabase(environment); else homeDB = NULL; XrmMergeDatabases(applicationDB, &rDB); XrmMergeDatabases(serverDB, &rDB); XrmMergeDatabases(homeDB, &rDB); XrmMergeDatabases(commandlineDB, &rDB); XrmMergeDatabases(usercommandlineDB, &rDB); get_def_res(defres); add_disp(defres); }
static int GTK_get_initial_size(void) { int vwxoff, vwyoff, vwxsz, vwysz; int dpy_xsize, dpy_ysize; XSizeHints *vwin_size_hints; XrmDatabase cmdlineDB = 0; char *str_type; XrmValue value; int gravity; bool user_geometry; int flags; int i; /* Read command-line args */ XrmParseCommand(&cmdlineDB, xlib_opTable, SIZEOF_OPS, OS_GetFileNamePtr(v9t9_argv[0]), &v9t9_argc, v9t9_argv); /* Get hints for -display parsing */ x11_dpy = GDK_DISPLAY(); x11_screen = DefaultScreen(x11_dpy); dpy_xsize = DisplayWidth(x11_dpy, x11_screen); dpy_ysize = DisplayHeight(x11_dpy, x11_screen); if ((vwin_size_hints = XAllocSizeHints()) == NULL) { logger(_L|LOG_ERROR | LOG_USER, _("cannot allocate size hints\n")); return 0; } vwin_size_hints->flags = PMinSize | PMaxSize | PResizeInc | PAspect | PBaseSize; vwin_size_hints->base_width = 0; vwin_size_hints->base_height = 0; vwin_size_hints->min_width = 256; vwin_size_hints->min_height = 192; vwin_size_hints->max_width = dpy_xsize; vwin_size_hints->max_height = dpy_ysize; vwin_size_hints->width_inc = 256; vwin_size_hints->height_inc = 192; vwin_size_hints->min_aspect.x = vwin_size_hints->max_aspect.x = 4; vwin_size_hints->min_aspect.y = vwin_size_hints->max_aspect.y = 3; /* Read sizes from resource */ xlib_get_resources(OS_GetFileNamePtr(v9t9_argv[0]), cmdlineDB); if (!XrmGetResource(xlib_rDB, "v9t9.geometry", "V9t9.Geometry", &str_type, &value)) { user_geometry = false; value.addr = 0L; } else { user_geometry = true; } /* Parse geometry specification */ if ((flags = XWMGeometry(x11_dpy, x11_screen, (char *) value.addr, "1x1", 1 /* border width */ , vwin_size_hints, &vwxoff, &vwyoff, &vwxsz, &vwysz, &gravity))) { if (vwxsz >= 256*256 && vwysz >= 192*192) { // assume they misunderstood the geometry and scale down vwxsz /= 256; vwysz /= 192; } } GTK_x_mult = vwxsz / 256; GTK_y_mult = vwysz / 192; GTK_user_size_configured = 1; // on_v9t9_draw_area_size_request uses this info return 1; }