| File: | xvidtune.c |
| Location: | line 1353, column 5 |
| Description: | Value stored to 'w' is never read |
| 1 | /* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.35tsi Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | |
| 5 | Copyright (c) 1995 Kaleb S. KEITHLEY |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining |
| 8 | a copy of this software and associated documentation files (the |
| 9 | "Software"), to deal in the Software without restriction, including |
| 10 | without limitation the rights to use, copy, modify, merge, publish, |
| 11 | distribute, sublicense, and/or sell copies of the Software, and to |
| 12 | permit persons to whom the Software is furnished to do so, subject to |
| 13 | the following conditions: |
| 14 | |
| 15 | The above copyright notice and this permission notice shall be |
| 16 | included in all copies or substantial portions of the Software. |
| 17 | |
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 21 | IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES |
| 22 | OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 24 | OTHER DEALINGS IN THE SOFTWARE. |
| 25 | |
| 26 | Except as contained in this notice, the name of Kaleb S. KEITHLEY |
| 27 | shall not be used in advertising or otherwise to promote the sale, use |
| 28 | or other dealings in this Software without prior written authorization |
| 29 | from Kaleb S. KEITHLEY. |
| 30 | |
| 31 | */ |
| 32 | |
| 33 | #include <X11/Intrinsic.h> |
| 34 | #include <X11/Shell.h> |
| 35 | #include <X11/StringDefs.h> |
| 36 | #include <X11/Xatom.h> |
| 37 | #include <X11/Xaw/Form.h> |
| 38 | #include <X11/Xaw/Scrollbar.h> |
| 39 | #include <X11/Xaw/Label.h> |
| 40 | #include <X11/Xaw/Command.h> |
| 41 | #include <X11/Xaw/AsciiText.h> |
| 42 | #include <X11/Xaw/Box.h> |
| 43 | #include <X11/Xaw/Toggle.h> |
| 44 | #include <X11/Xmu/StdSel.h> |
| 45 | #include <X11/Xmd.h> |
| 46 | #include <X11/extensions/xf86vmode.h> |
| 47 | #include <ctype.h> |
| 48 | #include <stdio.h> |
| 49 | #include <stdlib.h> |
| 50 | #include <signal.h> |
| 51 | |
| 52 | static int MajorVersion, MinorVersion; |
| 53 | static int EventBase, ErrorBase; |
| 54 | static int dot_clock, mode_flags; |
| 55 | static unsigned long TestTimeout=5000; /* Default test timeout */ |
| 56 | static XtSignalId sigId; |
| 57 | |
| 58 | static char *progname; |
| 59 | |
| 60 | /* Minimum extension version required */ |
| 61 | #define MINMAJOR0 0 |
| 62 | #define MINMINOR5 5 |
| 63 | |
| 64 | /* Mode flags -- ignore flags not in V_FLAG_MASK */ |
| 65 | #define V_FLAG_MASK0x1FF; 0x1FF; |
| 66 | #define V_PHSYNC0x001 0x001 |
| 67 | #define V_NHSYNC0x002 0x002 |
| 68 | #define V_PVSYNC0x004 0x004 |
| 69 | #define V_NVSYNC0x008 0x008 |
| 70 | #define V_INTERLACE0x010 0x010 |
| 71 | #define V_DBLSCAN0x020 0x020 |
| 72 | #define V_CSYNC0x040 0x040 |
| 73 | #define V_PCSYNC0x080 0x080 |
| 74 | #define V_NCSYNC0x100 0x100 |
| 75 | |
| 76 | typedef enum { HDisplay, HSyncStart, HSyncEnd, HTotal, |
| 77 | VDisplay, VSyncStart, VSyncEnd, VTotal, Flags, |
| 78 | InvertVclk, BlankDelay1, BlankDelay2, EarlySc, |
| 79 | PixelClock, HSyncRate, VSyncRate, fields_num } fields; |
| 80 | |
| 81 | typedef struct { |
| 82 | fields me; |
| 83 | fields use; |
| 84 | int val; |
| 85 | int lastpercent; |
| 86 | int range; |
| 87 | Widget textwidget; |
| 88 | Widget scrollwidget; |
| 89 | } ScrollData; |
| 90 | |
| 91 | static struct _AppResources { |
| 92 | ScrollData field[fields_num]; |
| 93 | Boolint ad_installed; |
| 94 | int orig[fields_num]; |
| 95 | int old[fields_num]; |
| 96 | } AppRes = { |
| 97 | { |
| 98 | { HDisplay, }, |
| 99 | { HSyncStart, HDisplay, }, |
| 100 | { HSyncEnd, HDisplay, }, |
| 101 | { HTotal, HDisplay, }, |
| 102 | { VDisplay, }, |
| 103 | { VSyncStart, VDisplay, }, |
| 104 | { VSyncEnd, VDisplay, }, |
| 105 | { VTotal, VDisplay, }, |
| 106 | { Flags, }, |
| 107 | { InvertVclk, }, |
| 108 | { BlankDelay1, }, |
| 109 | { BlankDelay2, }, |
| 110 | { EarlySc, }, |
| 111 | { PixelClock, }, |
| 112 | { HSyncRate, }, |
| 113 | { VSyncRate, }, |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | static XtResource Resources[] = { |
| 118 | { "adInstalled", "AdInstalled", XtRBool((char*)&XtStrings[1556]), sizeof(Boolint), |
| 119 | XtOffsetOf(struct _AppResources, ad_installed)__builtin_offsetof(struct _AppResources, ad_installed), |
| 120 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)FALSE0 }, |
| 121 | { "hSyncStartRange", "SyncStartRange", XtRInt((char*)&XtStrings[1718]), sizeof(int), |
| 122 | XtOffsetOf(struct _AppResources, field[HSyncStart].range)__builtin_offsetof(struct _AppResources, field[HSyncStart].range ), |
| 123 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)200 }, |
| 124 | { "hSyncEndRange", "SyncEndRange", XtRInt((char*)&XtStrings[1718]), sizeof(int), |
| 125 | XtOffsetOf(struct _AppResources, field[HSyncEnd].range)__builtin_offsetof(struct _AppResources, field[HSyncEnd].range ), |
| 126 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)400 }, |
| 127 | { "hTotalRange", "TotalRange", XtRInt((char*)&XtStrings[1718]), sizeof(int), |
| 128 | XtOffsetOf(struct _AppResources, field[HTotal].range)__builtin_offsetof(struct _AppResources, field[HTotal].range), |
| 129 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)400 }, |
| 130 | { "vSyncStartRange", "SyncStartRange", XtRInt((char*)&XtStrings[1718]), sizeof(int), |
| 131 | XtOffsetOf(struct _AppResources, field[VSyncStart].range)__builtin_offsetof(struct _AppResources, field[VSyncStart].range ), |
| 132 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)20 }, |
| 133 | { "vSyncEndRange", "SyncEndRange", XtRInt((char*)&XtStrings[1718]), sizeof(int), |
| 134 | XtOffsetOf(struct _AppResources, field[VSyncEnd].range)__builtin_offsetof(struct _AppResources, field[VSyncEnd].range ), |
| 135 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)40 }, |
| 136 | { "vTotalRange", "TotalRange", XtRInt((char*)&XtStrings[1718]), sizeof(int), |
| 137 | XtOffsetOf(struct _AppResources, field[VTotal].range)__builtin_offsetof(struct _AppResources, field[VTotal].range), |
| 138 | XtRImmediate((char*)&XtStrings[1695]), (XtPointer)80 }, |
| 139 | }; |
| 140 | |
| 141 | static XtTranslations trans; |
| 142 | |
| 143 | static Atom wm_delete_window; |
| 144 | static Widget invalid_mode_popup; |
| 145 | static Widget testing_popup; |
| 146 | static Widget Top; |
| 147 | static Widget auto_apply_toggle; |
| 148 | |
| 149 | static Boolint S3Specials = False0; |
| 150 | static char modebuf[160]; |
| 151 | |
| 152 | static void UpdateSyncRates(Boolint dolabels); |
| 153 | |
| 154 | static void |
| 155 | CleanUp(Display *dpy) |
| 156 | { |
| 157 | /* Make sure mode switching is not locked out at exit */ |
| 158 | XF86VidModeLockModeSwitch(dpy, DefaultScreen(dpy)(((_XPrivDisplay)(dpy))->default_screen), FALSE0); |
| 159 | XFlush(dpy); |
| 160 | } |
| 161 | |
| 162 | static void |
| 163 | CatchSig(int signal) |
| 164 | { |
| 165 | XtNoticeSignal(sigId); |
| 166 | } |
| 167 | |
| 168 | static void |
| 169 | CatchXtSig(XtPointer closure, XtSignalId *id) |
| 170 | { |
| 171 | CleanUp(XtDisplay(Top)); |
| 172 | exit(3); |
| 173 | } |
| 174 | |
| 175 | static Boolint |
| 176 | GetModeLine (Display* dpy, int scrn) |
| 177 | { |
| 178 | XF86VidModeModeLine mode_line; |
| 179 | fields i; |
| 180 | |
| 181 | if (!XF86VidModeGetModeLine (dpy, scrn, &dot_clock, &mode_line)) |
| 182 | return FALSE0; |
| 183 | |
| 184 | AppRes.field[HDisplay].val = mode_line.hdisplay; |
| 185 | AppRes.field[HSyncStart].val = mode_line.hsyncstart; |
| 186 | AppRes.field[HSyncEnd].val = mode_line.hsyncend; |
| 187 | AppRes.field[HTotal].val = mode_line.htotal; |
| 188 | AppRes.field[VDisplay].val = mode_line.vdisplay; |
| 189 | AppRes.field[VSyncStart].val = mode_line.vsyncstart; |
| 190 | AppRes.field[VSyncEnd].val = mode_line.vsyncend; |
| 191 | AppRes.field[VTotal].val = mode_line.vtotal; |
| 192 | mode_flags = mode_line.flags; |
| 193 | AppRes.field[Flags].val = mode_flags & V_FLAG_MASK0x1FF;; |
| 194 | AppRes.field[PixelClock].val = dot_clock; |
| 195 | UpdateSyncRates(FALSE0); |
| 196 | if (mode_line.privsize && mode_line.private) { |
| 197 | S3Specials = True1; |
| 198 | AppRes.field[InvertVclk].val = mode_line.private[1]; |
| 199 | AppRes.field[BlankDelay1].val = mode_line.private[2] & 7; |
| 200 | AppRes.field[BlankDelay2].val = (mode_line.private[2] >> 4) & 7; |
| 201 | AppRes.field[EarlySc].val = mode_line.private[3]; |
| 202 | } |
| 203 | |
| 204 | for (i = HDisplay; i < fields_num; i++) |
| 205 | AppRes.orig[i] = AppRes.field[i].val; |
| 206 | return TRUE1; |
| 207 | } |
| 208 | |
| 209 | static Boolint |
| 210 | GetMonitor (Display* dpy, int scrn) |
| 211 | { |
| 212 | XF86VidModeMonitor monitor; |
| 213 | int i; |
| 214 | |
| 215 | if (!XF86VidModeGetMonitor (dpy, scrn, &monitor)) |
| 216 | return FALSE0; |
| 217 | |
| 218 | printf("Vendor: %s, Model: %s\n", monitor.vendor, monitor.model); |
| 219 | printf("Num hsync: %d, Num vsync: %d\n", monitor.nhsync, monitor.nvsync); |
| 220 | for (i = 0; i < monitor.nhsync; i++) { |
| 221 | printf("hsync range %d: %6.2f - %6.2f\n", i, monitor.hsync[i].lo, |
| 222 | monitor.hsync[i].hi); |
| 223 | } |
| 224 | for (i = 0; i < monitor.nvsync; i++) { |
| 225 | printf("vsync range %d: %6.2f - %6.2f\n", i, monitor.vsync[i].lo, |
| 226 | monitor.vsync[i].hi); |
| 227 | } |
| 228 | return TRUE1; |
| 229 | } |
| 230 | |
| 231 | static Boolint |
| 232 | ModeSettable(void) |
| 233 | { |
| 234 | if (AppRes.field[HTotal].val == 0 || AppRes.field[VTotal].val == 0) |
| 235 | return FALSE0; |
| 236 | return TRUE1; |
| 237 | } |
| 238 | |
| 239 | static int hitError = 0; |
| 240 | static int (*xtErrorfunc)(Display *, XErrorEvent *); |
| 241 | |
| 242 | static int |
| 243 | vidmodeError(Display *dis, XErrorEvent *err) |
| 244 | { |
| 245 | if ((err->error_code >= ErrorBase && |
| 246 | err->error_code < ErrorBase + XF86VidModeNumberErrors(6 + 1)) || |
| 247 | err->error_code == BadValue2) { |
| 248 | hitError=1; |
| 249 | } else { |
| 250 | CleanUp(dis); |
| 251 | if (xtErrorfunc) |
| 252 | (*xtErrorfunc)(dis, err); |
| 253 | } |
| 254 | return 0; /* ignored */ |
| 255 | } |
| 256 | |
| 257 | static void |
| 258 | SetScrollbars (void) |
| 259 | { |
| 260 | fields i; |
| 261 | |
| 262 | for (i = HDisplay; i <= Flags; i++) { |
| 263 | |
| 264 | ScrollData* sdp = &AppRes.field[i]; |
| 265 | |
| 266 | if (sdp->scrollwidget != (Widget) NULL((void*)0)) { |
| 267 | int base; |
| 268 | float percent; |
| 269 | |
| 270 | base = AppRes.field[sdp->use].val; |
| 271 | percent = ((float)(sdp->val - base)) / ((float)sdp->range); |
| 272 | XawScrollbarSetThumb (sdp->scrollwidget, percent, 0.0); |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | static void |
| 278 | QuitCB (Widget w, XtPointer client, XtPointer call) |
| 279 | { |
| 280 | CleanUp(XtDisplay(w)); |
| 281 | #if XtSpecificationRelease6 < 6 |
| 282 | exit (0); |
| 283 | #else |
| 284 | XtAppSetExitFlag (XtWidgetToApplicationContext (w)); |
| 285 | #endif |
| 286 | } |
| 287 | |
| 288 | static void |
| 289 | popdownInvalid(Widget w, XtPointer client, XtPointer call) |
| 290 | { |
| 291 | XtPopdown((Widget)client); |
| 292 | } |
| 293 | |
| 294 | static void |
| 295 | ApplyCB (Widget w, XtPointer client, XtPointer call) |
| 296 | { |
| 297 | XF86VidModeModeLine mode_line; |
| 298 | INT32 S3private[4]; |
| 299 | unsigned int i; |
| 300 | char* string; |
| 301 | Boolean state; |
| 302 | |
| 303 | mode_line.hdisplay = AppRes.field[HDisplay].val; |
| 304 | mode_line.hsyncstart = AppRes.field[HSyncStart].val; |
| 305 | mode_line.hsyncend = AppRes.field[HSyncEnd].val; |
| 306 | mode_line.htotal = AppRes.field[HTotal].val; |
| 307 | mode_line.vdisplay = AppRes.field[VDisplay].val; |
| 308 | mode_line.vsyncstart = AppRes.field[VSyncStart].val; |
| 309 | mode_line.vsyncend = AppRes.field[VSyncEnd].val; |
| 310 | mode_line.vtotal = AppRes.field[VTotal].val; |
| 311 | /* Don't read flags from widget */ |
| 312 | #if 0 |
| 313 | XtVaGetValues (AppRes.field[Flags].textwidget, |
| 314 | XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 315 | (void) sscanf (string, "%x", &i); |
| 316 | #endif |
| 317 | mode_line.flags = mode_flags; |
| 318 | if (S3Specials) { |
| 319 | mode_line.privsize = 4; |
| 320 | mode_line.private = S3private; |
| 321 | mode_line.private[0] = (1 << 1) | (1 << 2) | (1 << 3); |
| 322 | XtVaGetValues(AppRes.field[InvertVclk].textwidget, |
| 323 | XtNstate"state", &state, NULL((void*)0)); |
| 324 | AppRes.field[InvertVclk].val = state ? 1 : 0; |
| 325 | mode_line.private[1] = AppRes.field[InvertVclk].val; |
| 326 | XtVaGetValues (AppRes.field[BlankDelay1].textwidget, |
| 327 | XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 328 | (void) sscanf (string, "%x", &i); |
| 329 | AppRes.field[BlankDelay1].val = i; |
| 330 | mode_line.private[2] = AppRes.field[BlankDelay1].val; |
| 331 | XtVaGetValues (AppRes.field[BlankDelay2].textwidget, |
| 332 | XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 333 | (void) sscanf (string, "%x", &i); |
| 334 | AppRes.field[BlankDelay2].val = i; |
| 335 | mode_line.private[2] |= AppRes.field[BlankDelay2].val << 4; |
| 336 | XtVaGetValues(AppRes.field[EarlySc].textwidget, |
| 337 | XtNstate"state", &state, NULL((void*)0)); |
| 338 | AppRes.field[EarlySc].val = state ? 1 : 0; |
| 339 | mode_line.private[3] = AppRes.field[EarlySc].val; |
| 340 | } else |
| 341 | mode_line.privsize = 0; |
| 342 | |
| 343 | hitError = 0; |
| 344 | |
| 345 | XF86VidModeModModeLine (XtDisplay (w), DefaultScreen (XtDisplay (w))(((_XPrivDisplay)(XtDisplay (w)))->default_screen), |
| 346 | &mode_line); |
| 347 | XSync(XtDisplay (w), False0); /* process errors */ |
| 348 | if (hitError) { |
| 349 | XBell(XtDisplay (w), 80); |
| 350 | XtPopup(invalid_mode_popup, XtGrabExclusive /*XtGrabNone*/); |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | |
| 355 | static void |
| 356 | SetLabel(fields i) |
| 357 | { |
| 358 | ScrollData* sdp = &AppRes.field[i]; |
| 359 | |
| 360 | if (sdp->textwidget != (Widget) NULL((void*)0)) { |
| 361 | char buf[10]; |
| 362 | Boolean state; |
| 363 | |
| 364 | /* |
| 365 | * Disable AutoApply so that the apply doesn't happen more than |
| 366 | * once as a consequence of callbacks being called because of the |
| 367 | * XtSetValues calls |
| 368 | */ |
| 369 | |
| 370 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 371 | if (state) |
| 372 | XtVaSetValues(auto_apply_toggle, XtNstate"state", 0, NULL((void*)0)); |
| 373 | |
| 374 | if (i == Flags) |
| 375 | (void) snprintf (buf, sizeof(buf), "%04x", sdp->val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%04x", sdp->val); |
| 376 | else if (i >= PixelClock && i <= VSyncRate) |
| 377 | (void) snprintf (buf, sizeof(buf), "%6.2f", (float)sdp->val / 1000.0)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%6.2f", (float)sdp->val / 1000.0 ); |
| 378 | else if (i == BlankDelay1 || i == BlankDelay2) { |
| 379 | (void) snprintf (buf, sizeof(buf), "%d", sdp->val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%d", sdp->val); |
| 380 | } else |
| 381 | (void) snprintf (buf, sizeof(buf), "%5d", sdp->val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%5d", sdp->val); |
| 382 | |
| 383 | sdp->lastpercent = -1; |
| 384 | if (i == Flags) { |
| 385 | XawTextBlock text; |
| 386 | |
| 387 | text.firstPos = 0; |
| 388 | text.length = 4; |
| 389 | text.ptr = buf; |
| 390 | text.format = XawFmt8Bit; |
| 391 | XawTextReplace (sdp->textwidget, 0, 4, &text); |
| 392 | } else if (i == BlankDelay1 || i == BlankDelay2) { |
| 393 | XawTextBlock text; |
| 394 | |
| 395 | text.firstPos = 0; |
| 396 | text.length = 1; |
| 397 | text.ptr = buf; |
| 398 | XawTextReplace (sdp->textwidget, 0, 1, &text); |
| 399 | } else if (i == InvertVclk || i == EarlySc) { |
| 400 | XtVaSetValues (sdp->textwidget, XtNstate"state", sdp->val, NULL((void*)0)); |
| 401 | } else |
| 402 | XtVaSetValues (sdp->textwidget, XtNlabel((char*)&XtStrings[429]), buf, NULL((void*)0)); |
| 403 | |
| 404 | if (state) |
| 405 | XtVaSetValues(auto_apply_toggle, XtNstate"state", 1, NULL((void*)0)); |
| 406 | } |
| 407 | |
| 408 | } |
| 409 | |
| 410 | static void |
| 411 | UpdateSyncRates(Boolint dolabels) |
| 412 | { |
| 413 | if (!ModeSettable()) |
| 414 | return; |
| 415 | |
| 416 | AppRes.field[HSyncRate].val = AppRes.field[PixelClock].val * 1000 / |
| 417 | AppRes.field[HTotal].val; |
| 418 | AppRes.field[VSyncRate].val = AppRes.field[HSyncRate].val * 1000 / |
| 419 | AppRes.field[VTotal].val; |
| 420 | if (mode_flags & V_INTERLACE0x010) |
| 421 | AppRes.field[VSyncRate].val *= 2; |
| 422 | else if (mode_flags & V_DBLSCAN0x020) |
| 423 | AppRes.field[VSyncRate].val /= 2; |
| 424 | if (dolabels) { |
| 425 | SetLabel(HSyncRate); |
| 426 | SetLabel(VSyncRate); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | static void |
| 431 | RestoreCB (Widget w, XtPointer client, XtPointer call) |
| 432 | { |
| 433 | fields i; |
| 434 | Boolean state; |
| 435 | |
| 436 | for (i = HDisplay; i < fields_num; i++) { |
| 437 | AppRes.field[i].val = AppRes.orig[i]; |
| 438 | SetLabel(i); |
| 439 | } |
| 440 | SetScrollbars (); |
| 441 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 442 | if (state) |
| 443 | ApplyCB (w, client, call); |
| 444 | } |
| 445 | |
| 446 | |
| 447 | static void |
| 448 | ApplyIfAutoCB (Widget w, XtPointer client, XtPointer call) |
| 449 | { |
| 450 | Boolean state; |
| 451 | |
| 452 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 453 | if (state) |
| 454 | ApplyCB (w, client, call); |
| 455 | } |
| 456 | |
| 457 | |
| 458 | static void |
| 459 | FetchCB (Widget w, XtPointer client, XtPointer call) |
| 460 | { |
| 461 | fields i; |
| 462 | (void) GetModeLine(XtDisplay (w), DefaultScreen (XtDisplay (w))(((_XPrivDisplay)(XtDisplay (w)))->default_screen)); |
| 463 | SetScrollbars (); |
| 464 | for (i = HDisplay; i < fields_num; i++) { |
| 465 | SetLabel(i); |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | static XtIntervalId TOid; |
| 470 | |
| 471 | static void |
| 472 | TestTO (XtPointer client, XtIntervalId* id) |
| 473 | { |
| 474 | fields i; |
| 475 | for (i = HDisplay; i < fields_num; i++) |
| 476 | AppRes.field[i].val = AppRes.orig[i]; |
| 477 | |
| 478 | ApplyCB ((Widget) client, NULL((void*)0), NULL((void*)0)); |
| 479 | |
| 480 | for (i = HDisplay; i < fields_num; i++) |
| 481 | AppRes.field[i].val = AppRes.old[i]; |
| 482 | SetScrollbars (); |
| 483 | |
| 484 | XtPopdown(testing_popup); |
| 485 | } |
| 486 | |
| 487 | static void |
| 488 | TestTOCB (Widget w, XtPointer client, XtPointer call) |
| 489 | { |
| 490 | XtRemoveTimeOut(TOid); |
| 491 | TestTO(w, (XtIntervalId *) NULL((void*)0)); |
| 492 | } |
| 493 | |
| 494 | static void |
| 495 | TestCB (Widget w, XtPointer client, XtPointer call) |
| 496 | { |
| 497 | fields i; |
| 498 | for (i = HDisplay; i < fields_num; i++) |
| 499 | AppRes.old[i] = AppRes.field[i].val; |
| 500 | |
| 501 | XtPopup(testing_popup, XtGrabExclusive /*XtGrabNone*/); |
| 502 | XSync(XtDisplay(w), False0); |
| 503 | TOid = XtAppAddTimeOut (XtWidgetToApplicationContext (w), |
| 504 | TestTimeout, TestTO, (XtPointer) w); |
| 505 | |
| 506 | ApplyCB (w, client, call); |
| 507 | } |
| 508 | |
| 509 | static Boolean |
| 510 | ConvertSelection( |
| 511 | Widget w, |
| 512 | Atom *selection, Atom *target, Atom *type, |
| 513 | XtPointer *value, |
| 514 | unsigned long *length, |
| 515 | int *format) |
| 516 | { |
| 517 | if (XmuConvertStandardSelection(w, CurrentTime0L, selection, target, type, |
| 518 | (XPointer *) value, length, format)) |
| 519 | return True1; |
| 520 | |
| 521 | if (*target == XA_STRING((Atom) 31)) { |
| 522 | *type = XA_STRING((Atom) 31); |
| 523 | *value = modebuf; |
| 524 | *length = strlen(*value); |
| 525 | *format = 8; |
| 526 | return True1; |
| 527 | } |
| 528 | return False0; |
| 529 | } |
| 530 | |
| 531 | static void |
| 532 | ShowCB(Widget w, XtPointer client, XtPointer call) |
| 533 | { |
| 534 | Time time; |
| 535 | char tmpbuf[16]; |
| 536 | |
| 537 | snprintf(tmpbuf, sizeof(tmpbuf), "\"%dx%d\"",__builtin___snprintf_chk (tmpbuf, sizeof(tmpbuf), 0, __builtin_object_size (tmpbuf, 2 > 1 ? 1 : 0), "\"%dx%d\"", AppRes.field[HDisplay ].val, AppRes.field[VDisplay].val) |
| 538 | AppRes.field[HDisplay].val, AppRes.field[VDisplay].val)__builtin___snprintf_chk (tmpbuf, sizeof(tmpbuf), 0, __builtin_object_size (tmpbuf, 2 > 1 ? 1 : 0), "\"%dx%d\"", AppRes.field[HDisplay ].val, AppRes.field[VDisplay].val); |
| 539 | snprintf(modebuf, sizeof(modebuf),__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 540 | "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d",__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 541 | tmpbuf, (float)dot_clock/1000.0,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 542 | AppRes.field[HDisplay].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 543 | AppRes.field[HSyncStart].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 544 | AppRes.field[HSyncEnd].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 545 | AppRes.field[HTotal].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 546 | AppRes.field[VDisplay].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 547 | AppRes.field[VSyncStart].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 548 | AppRes.field[VSyncEnd].val,__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val) |
| 549 | AppRes.field[VTotal].val)__builtin___snprintf_chk (modebuf, sizeof(modebuf), 0, __builtin_object_size (modebuf, 2 > 1 ? 1 : 0), "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d" , tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val , AppRes.field[HSyncStart].val, AppRes.field[HSyncEnd].val, AppRes .field[HTotal].val, AppRes.field[VDisplay].val, AppRes.field[ VSyncStart].val, AppRes.field[VSyncEnd].val, AppRes.field[VTotal ].val); |
| 550 | /* Print out the flags (if any) */ |
| 551 | if (mode_flags & V_PHSYNC0x001) strcat(modebuf, " +hsync")__builtin___strcat_chk (modebuf, " +hsync", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 552 | if (mode_flags & V_NHSYNC0x002) strcat(modebuf, " -hsync")__builtin___strcat_chk (modebuf, " -hsync", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 553 | if (mode_flags & V_PVSYNC0x004) strcat(modebuf, " +vsync")__builtin___strcat_chk (modebuf, " +vsync", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 554 | if (mode_flags & V_NVSYNC0x008) strcat(modebuf, " -vsync")__builtin___strcat_chk (modebuf, " -vsync", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 555 | if (mode_flags & V_INTERLACE0x010) strcat(modebuf, " interlace")__builtin___strcat_chk (modebuf, " interlace", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 556 | if (mode_flags & V_CSYNC0x040) strcat(modebuf, " composite")__builtin___strcat_chk (modebuf, " composite", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 557 | if (mode_flags & V_PCSYNC0x080) strcat(modebuf, " +csync")__builtin___strcat_chk (modebuf, " +csync", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 558 | if (mode_flags & V_NCSYNC0x100) strcat(modebuf, " -csync")__builtin___strcat_chk (modebuf, " -csync", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 559 | if (mode_flags & V_DBLSCAN0x020) strcat(modebuf, " doublescan")__builtin___strcat_chk (modebuf, " doublescan", __builtin_object_size (modebuf, 2 > 1 ? 1 : 0)); |
| 560 | printf("%s\n", modebuf); |
| 561 | time = XtLastTimestampProcessed(XtDisplay(w)); |
| 562 | XtOwnSelection(w, XA_PRIMARY((Atom) 1), time, ConvertSelection, NULL((void*)0), NULL((void*)0)); |
| 563 | if (S3Specials) { |
| 564 | unsigned int i; |
| 565 | Boolean state; |
| 566 | char *string; |
| 567 | |
| 568 | XtVaGetValues(AppRes.field[InvertVclk].textwidget, |
| 569 | XtNstate"state", &state, NULL((void*)0)); |
| 570 | AppRes.field[InvertVclk].val = state ? 1 : 0; |
| 571 | XtVaGetValues (AppRes.field[BlankDelay1].textwidget, |
| 572 | XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 573 | (void) sscanf (string, "%x", &i); |
| 574 | AppRes.field[BlankDelay1].val = i; |
| 575 | XtVaGetValues (AppRes.field[BlankDelay2].textwidget, |
| 576 | XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 577 | (void) sscanf (string, "%x", &i); |
| 578 | AppRes.field[BlankDelay2].val = i; |
| 579 | XtVaGetValues(AppRes.field[EarlySc].textwidget, |
| 580 | XtNstate"state", &state, NULL((void*)0)); |
| 581 | AppRes.field[EarlySc].val = state ? 1 : 0; |
| 582 | if (AppRes.field[InvertVclk].val != AppRes.orig[InvertVclk]) |
| 583 | printf("InvertVCLK\t\"%dx%d\" %d\n", AppRes.field[HDisplay].val, |
| 584 | AppRes.field[VDisplay].val, AppRes.field[InvertVclk].val); |
| 585 | if (AppRes.field[EarlySc].val != AppRes.orig[EarlySc]) |
| 586 | printf("EarlySC\t\t\"%dx%d\" %d\n", AppRes.field[HDisplay].val, |
| 587 | AppRes.field[VDisplay].val, AppRes.field[EarlySc].val); |
| 588 | if (AppRes.field[BlankDelay1].val != AppRes.orig[BlankDelay1] |
| 589 | || AppRes.field[BlankDelay2].val != AppRes.orig[BlankDelay2]) |
| 590 | printf("BlankDelay\t\"%dx%d\" %d %d\n", AppRes.field[HDisplay].val, |
| 591 | AppRes.field[VDisplay].val, AppRes.field[BlankDelay1].val, |
| 592 | AppRes.field[BlankDelay2].val); |
| 593 | } |
| 594 | printf("\n"); |
| 595 | } |
| 596 | |
| 597 | static void |
| 598 | AdjustCB(Widget w, XtPointer client, XtPointer call) |
| 599 | { |
| 600 | int what = (long) client; |
| 601 | Boolean state; |
| 602 | |
| 603 | switch (what) { |
| 604 | case HSyncStart: |
| 605 | if (AppRes.field[HSyncEnd].val + 4 < AppRes.field[HTotal].val) { |
| 606 | AppRes.field[HSyncEnd].val += 4; |
| 607 | AppRes.field[HSyncStart].val += 4; |
| 608 | SetLabel(HSyncStart); |
| 609 | SetLabel(HSyncEnd); |
| 610 | } else |
| 611 | XBell(XtDisplay(w), 80); |
| 612 | break; |
| 613 | case -HSyncStart: |
| 614 | if (AppRes.field[HSyncStart].val - 4 > AppRes.field[HDisplay].val) { |
| 615 | AppRes.field[HSyncEnd].val -= 4; |
| 616 | AppRes.field[HSyncStart].val -= 4; |
| 617 | SetLabel(HSyncStart); |
| 618 | SetLabel(HSyncEnd); |
| 619 | } else |
| 620 | XBell(XtDisplay(w), 80); |
| 621 | break; |
| 622 | case HTotal: |
| 623 | AppRes.field[HTotal].val += 4; |
| 624 | SetLabel(HTotal); |
| 625 | UpdateSyncRates(TRUE1); |
| 626 | break; |
| 627 | case -HTotal: |
| 628 | if (AppRes.field[HTotal].val - 4 > AppRes.field[HSyncEnd].val) { |
| 629 | AppRes.field[HTotal].val -= 4; |
| 630 | SetLabel(HTotal); |
| 631 | UpdateSyncRates(TRUE1); |
| 632 | } else |
| 633 | XBell(XtDisplay(w), 80); |
| 634 | break; |
| 635 | case VSyncStart: |
| 636 | if (AppRes.field[VSyncEnd].val + 4 < AppRes.field[VTotal].val) { |
| 637 | AppRes.field[VSyncEnd].val += 4; |
| 638 | AppRes.field[VSyncStart].val += 4; |
| 639 | SetLabel(VSyncStart); |
| 640 | SetLabel(VSyncEnd); |
| 641 | } else |
| 642 | XBell(XtDisplay(w), 80); |
| 643 | break; |
| 644 | case -VSyncStart: |
| 645 | if (AppRes.field[VSyncStart].val - 4 > AppRes.field[VDisplay].val) { |
| 646 | AppRes.field[VSyncEnd].val -= 4; |
| 647 | AppRes.field[VSyncStart].val -= 4; |
| 648 | SetLabel(VSyncStart); |
| 649 | SetLabel(VSyncEnd); |
| 650 | } else |
| 651 | XBell(XtDisplay(w), 80); |
| 652 | break; |
| 653 | case VTotal: |
| 654 | AppRes.field[VTotal].val += 4; |
| 655 | SetLabel(VTotal); |
| 656 | UpdateSyncRates(TRUE1); |
| 657 | break; |
| 658 | case -VTotal: |
| 659 | if (AppRes.field[VTotal].val - 4 > AppRes.field[VSyncEnd].val) { |
| 660 | AppRes.field[VTotal].val -= 4; |
| 661 | SetLabel(VTotal); |
| 662 | UpdateSyncRates(TRUE1); |
| 663 | } else |
| 664 | XBell(XtDisplay(w), 80); |
| 665 | break; |
| 666 | } |
| 667 | SetScrollbars (); |
| 668 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 669 | if (state) |
| 670 | ApplyCB (w, client, call); |
| 671 | } |
| 672 | |
| 673 | |
| 674 | #if 0 |
| 675 | static void |
| 676 | EditCB (Widget w, XtPointer client, XtPointer call) |
| 677 | { |
| 678 | int base, current, i, len; |
| 679 | int lower, upper; |
| 680 | float percent; |
| 681 | ScrollData* sdp = (ScrollData*) client; |
| 682 | |
| 683 | len = strlen (sdp->string); |
| 684 | |
| 685 | for (i = 0; i < len; i++) { |
| 686 | if (!(isdigit (sdp->string[i]) || isspace (sdp->string[i]))) { |
| 687 | XBell (XtDisplay(XtParent(w)), 100); |
| 688 | return; |
| 689 | } |
| 690 | } |
| 691 | switch (sdp->me) { |
| 692 | case HSyncStart: |
| 693 | lower = atoi (AppRes.field[HDisplay].string); |
| 694 | upper = atoi (AppRes.field[HSyncEnd].string); |
| 695 | break; |
| 696 | |
| 697 | case HSyncEnd: |
| 698 | lower = atoi (AppRes.field[HSyncStart].string); |
| 699 | upper = atoi (AppRes.field[HTotal].string); |
| 700 | break; |
| 701 | |
| 702 | case HTotal: |
| 703 | lower = atoi (AppRes.field[HSyncEnd].string); |
| 704 | upper = atoi (AppRes.field[HDisplay].string) + |
| 705 | AppRes.field[HTotal].range; |
| 706 | break; |
| 707 | |
| 708 | case VSyncStart: |
| 709 | lower = atoi (AppRes.field[VDisplay].string); |
| 710 | upper = atoi (AppRes.field[VSyncEnd].string); |
| 711 | break; |
| 712 | |
| 713 | case VSyncEnd: |
| 714 | lower = atoi (AppRes.field[VSyncStart].string); |
| 715 | upper = atoi (AppRes.field[VTotal].string); |
| 716 | break; |
| 717 | |
| 718 | case VTotal: |
| 719 | lower = atoi (AppRes.field[VSyncEnd].string); |
| 720 | upper = atoi (AppRes.field[VDisplay].string) + |
| 721 | AppRes.field[VTotal].range; |
| 722 | break; |
| 723 | } |
| 724 | current = atoi (sdp->string); |
| 725 | if (current < lower || current > upper) { |
| 726 | XawTextBlock text; |
| 727 | char tmp[6]; |
| 728 | |
| 729 | if (current < lower) { |
| 730 | (void) snprintf (tmp, sizeof(tmp), "%5d", lower)__builtin___snprintf_chk (tmp, sizeof(tmp), 0, __builtin_object_size (tmp, 2 > 1 ? 1 : 0), "%5d", lower); |
| 731 | current = lower; |
| 732 | } else { |
| 733 | (void) snprintf (tmp, sizeof(tmp), "%5d", upper)__builtin___snprintf_chk (tmp, sizeof(tmp), 0, __builtin_object_size (tmp, 2 > 1 ? 1 : 0), "%5d", upper); |
| 734 | current = upper; |
| 735 | } |
| 736 | text.firstPos = 0; |
| 737 | text.length = strlen (tmp); |
| 738 | text.ptr = tmp; |
| 739 | text.format = XawFmt8Bit; |
| 740 | XawTextReplace (sdp->textwidget, 0, text.length, &text); |
| 741 | } |
| 742 | base = atoi (AppRes.field[sdp->use].string); |
| 743 | percent = ((float)(current - base)) / ((float)sdp->range); |
| 744 | XawScrollbarSetThumb (sdp->scrollwidget, percent, 0.0); |
| 745 | } |
| 746 | #endif |
| 747 | |
| 748 | static void |
| 749 | FlagsEditCB (Widget w, XtPointer client, XtPointer call) |
| 750 | { |
| 751 | int i, len; |
| 752 | char* string; |
| 753 | fields findex = (fields) (unsigned long) client; |
| 754 | ScrollData* sdp = &AppRes.field[findex]; |
| 755 | |
| 756 | XtVaGetValues (w, XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 757 | len = strlen (string); |
| 758 | if (len > 4) { |
| 759 | char buf[5]; |
| 760 | |
| 761 | XBell (XtDisplay(XtParent(w)), 100); |
| 762 | (void) strncpy (buf, string, 4)__builtin___strncpy_chk (buf, string, 4, __builtin_object_size (buf, 2 > 1 ? 1 : 0)); |
| 763 | buf[4] = '\0'; |
| 764 | XtVaSetValues (sdp->textwidget, XtNstring((char*)&XtStrings[733]), buf, NULL((void*)0)); |
| 765 | XawTextSetInsertionPoint (sdp->textwidget, 4); |
| 766 | } |
| 767 | |
| 768 | for (i = 0; i < len; i++) { |
| 769 | if (!isxdigit (string[i])) { |
| 770 | XBell (XtDisplay(XtParent(w)), 100); |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | static void |
| 776 | BlankEditCB (Widget w, XtPointer client, XtPointer call) |
| 777 | { |
| 778 | int len; |
| 779 | char* string; |
| 780 | fields findex = (fields) (unsigned long) client; |
| 781 | ScrollData* sdp = &AppRes.field[findex]; |
| 782 | char buf[2], old; |
| 783 | Boolean state; |
| 784 | Boolean noAuto = False0; |
| 785 | |
| 786 | XtVaGetValues (w, XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 787 | len = strlen (string); |
| 788 | if (len == 0) { |
| 789 | XBell (XtDisplay(XtParent(w)), 100); |
| 790 | strcpy(buf, "0")__builtin___strcpy_chk (buf, "0", __builtin_object_size (buf, 2 > 1 ? 1 : 0)); |
| 791 | XtVaSetValues (sdp->textwidget, XtNstring((char*)&XtStrings[733]), buf, NULL((void*)0)); |
| 792 | XawTextSetInsertionPoint (sdp->textwidget, 1); |
| 793 | return; |
| 794 | } |
| 795 | if (len > 1) { |
| 796 | if (XawTextGetInsertionPoint(sdp->textwidget) < 1) { |
| 797 | buf[0] = string[0]; |
| 798 | old = string[1]; |
| 799 | } else { |
| 800 | buf[0] = string[1]; |
| 801 | old = string[0]; |
| 802 | } |
| 803 | if (buf[0] == '+' && old < '7') |
| 804 | buf[0] = old + 1; |
| 805 | else if (buf[0] == '-' && old > '0') |
| 806 | buf[0] = old - 1; |
| 807 | if (!isdigit(buf[0]) || buf[0] > '7') { |
| 808 | XBell (XtDisplay(XtParent(w)), 100); |
| 809 | buf[0] = old; |
| 810 | if (!isdigit(buf[0]) || buf[0] > '7') |
| 811 | buf[0] = '0'; |
| 812 | noAuto = True1; |
| 813 | } |
| 814 | buf[1] = '\0'; |
| 815 | XtVaSetValues (sdp->textwidget, XtNstring((char*)&XtStrings[733]), buf, NULL((void*)0)); |
| 816 | XawTextSetInsertionPoint (sdp->textwidget, 1); |
| 817 | } |
| 818 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 819 | if (state && !noAuto) |
| 820 | ApplyCB (sdp->textwidget, client, call); |
| 821 | } |
| 822 | |
| 823 | static void |
| 824 | ChangeBlankCB (Widget w, XtPointer client, XtPointer call) |
| 825 | { |
| 826 | char* string; |
| 827 | char buf[2]; |
| 828 | fields findex; |
| 829 | ScrollData* sdp; |
| 830 | Boolean state; |
| 831 | int what = (long) client; |
| 832 | |
| 833 | |
| 834 | if (what < 0) |
| 835 | findex = (fields)-what; |
| 836 | else |
| 837 | findex = (fields)what; |
| 838 | sdp = &AppRes.field[findex]; |
| 839 | |
| 840 | XtVaGetValues (sdp->textwidget, XtNstring((char*)&XtStrings[733]), &string, NULL((void*)0)); |
| 841 | if (what > 0) |
| 842 | string[0]++; |
| 843 | else |
| 844 | string[0]--; |
| 845 | |
| 846 | if (string[0] < '0' || string[0] > '7') { |
| 847 | XBell (XtDisplay(XtParent(w)), 100); |
| 848 | return; |
| 849 | } |
| 850 | |
| 851 | buf[0] = string[0]; |
| 852 | buf[1] = '\0'; |
| 853 | XtVaSetValues (sdp->textwidget, XtNstring((char*)&XtStrings[733]), buf, NULL((void*)0)); |
| 854 | XawTextSetInsertionPoint (sdp->textwidget, 1); |
| 855 | |
| 856 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 857 | if (state) |
| 858 | ApplyCB (sdp->textwidget, client, call); |
| 859 | } |
| 860 | |
| 861 | static int |
| 862 | isValid(int val, int field) |
| 863 | { |
| 864 | switch(field) { |
| 865 | case HSyncStart: |
| 866 | if (val+8 > AppRes.field[HSyncEnd].val) |
| 867 | val = AppRes.field[HSyncEnd].val - 8; |
| 868 | break; |
| 869 | case HSyncEnd: |
| 870 | if (val-8 < AppRes.field[HSyncStart].val) |
| 871 | val = AppRes.field[HSyncStart].val + 8; |
| 872 | if (val > AppRes.field[HTotal].val) |
| 873 | val = AppRes.field[HTotal].val; |
| 874 | break; |
| 875 | case HTotal: |
| 876 | if (val < AppRes.field[HSyncEnd].val) |
| 877 | val = AppRes.field[HSyncEnd].val; |
| 878 | break; |
| 879 | case VSyncStart: |
| 880 | if (val+8 > AppRes.field[VSyncEnd].val) |
| 881 | val = AppRes.field[VSyncEnd].val - 8; |
| 882 | break; |
| 883 | case VSyncEnd: |
| 884 | if (val-8 < AppRes.field[VSyncStart].val) |
| 885 | val = AppRes.field[VSyncStart].val + 8; |
| 886 | if (val > AppRes.field[VTotal].val) |
| 887 | val = AppRes.field[VTotal].val; |
| 888 | break; |
| 889 | case VTotal: |
| 890 | if (val < AppRes.field[VSyncEnd].val) |
| 891 | val = AppRes.field[VSyncEnd].val; |
| 892 | break; |
| 893 | } |
| 894 | return val; |
| 895 | } |
| 896 | |
| 897 | static void |
| 898 | ScrollCB (Widget w, XtPointer client, XtPointer call) |
| 899 | { |
| 900 | float percent = *(float*) call; |
| 901 | int ipercent = percent * 100; |
| 902 | int fieldindex = (long) client; |
| 903 | ScrollData* sdp = &AppRes.field[fieldindex]; |
| 904 | |
| 905 | |
| 906 | |
| 907 | if (ipercent != sdp->lastpercent) { |
| 908 | int tmp_val; |
| 909 | char buf[6]; |
| 910 | |
| 911 | tmp_val = AppRes.field[sdp->use].val; |
| 912 | tmp_val += (int) (((float)sdp->range) * percent); |
| 913 | |
| 914 | sdp->val = isValid(tmp_val, fieldindex); |
| 915 | |
| 916 | sdp->lastpercent = ipercent; |
| 917 | (void) snprintf (buf, sizeof(buf), "%5d", sdp->val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%5d", sdp->val); |
| 918 | XtVaSetValues (sdp->textwidget, XtNlabel((char*)&XtStrings[429]), buf, NULL((void*)0)); |
| 919 | if (sdp->val != tmp_val) { |
| 920 | int base; |
| 921 | float percent; |
| 922 | |
| 923 | base = AppRes.field[sdp->use].val; |
| 924 | percent = ((float)(sdp->val - base)) / ((float)sdp->range); |
| 925 | /* This doesn't always work, why? */ |
| 926 | XawScrollbarSetThumb (sdp->scrollwidget, percent, 0.0); |
| 927 | } |
| 928 | if (fieldindex == HTotal || fieldindex == VTotal) |
| 929 | UpdateSyncRates(TRUE1); |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | static void |
| 934 | SwitchCB (Widget w, XtPointer client, XtPointer call) |
| 935 | { |
| 936 | XF86VidModeLockModeSwitch(XtDisplay(w), DefaultScreen (XtDisplay (w))(((_XPrivDisplay)(XtDisplay (w)))->default_screen), |
| 937 | FALSE0); |
| 938 | XF86VidModeSwitchMode(XtDisplay(w), DefaultScreen (XtDisplay (w))(((_XPrivDisplay)(XtDisplay (w)))->default_screen), |
| 939 | (int)(long) client); |
| 940 | XF86VidModeLockModeSwitch(XtDisplay(w), DefaultScreen (XtDisplay (w))(((_XPrivDisplay)(XtDisplay (w)))->default_screen), |
| 941 | TRUE1); |
| 942 | FetchCB(w, NULL((void*)0), NULL((void*)0)); |
| 943 | } |
| 944 | |
| 945 | static void |
| 946 | AddCallback ( |
| 947 | Widget w, |
| 948 | String callback_name, |
| 949 | XtCallbackProc callback, |
| 950 | XtPointer client_data) |
| 951 | { |
| 952 | Widget src; |
| 953 | |
| 954 | XtVaGetValues (w, XtNtextSource((char*)&XtStrings[761]), &src, NULL((void*)0)); |
| 955 | XtAddCallback (src, callback_name, callback, client_data); |
| 956 | } |
| 957 | |
| 958 | static void |
| 959 | CreateTyp ( |
| 960 | Widget form, |
| 961 | fields findex, |
| 962 | String w1name, |
| 963 | String w2name, |
| 964 | String w3name) |
| 965 | { |
| 966 | Widget wids[3]; |
| 967 | char buf[10]; |
| 968 | |
| 969 | wids[0] = XtCreateWidget (w1name, labelWidgetClass, form, NULL((void*)0), 0); |
| 970 | if (findex >= PixelClock && findex <= VSyncRate) |
| 971 | (void) snprintf(buf, sizeof(buf), "%6.2f",__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%6.2f", (float)AppRes.field[findex ].val / 1000.0) |
| 972 | (float)AppRes.field[findex].val / 1000.0)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%6.2f", (float)AppRes.field[findex ].val / 1000.0); |
| 973 | else |
| 974 | (void) snprintf (buf, sizeof(buf), "%5d", AppRes.field[findex].val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%5d", AppRes.field[findex].val); |
| 975 | wids[1] = XtVaCreateWidget (w2name, labelWidgetClass, |
| 976 | form, XtNlabel((char*)&XtStrings[429]), buf, NULL((void*)0)); |
| 977 | if (w3name != NULL((void*)0)) { |
| 978 | wids[2] = XtCreateWidget (w3name, scrollbarWidgetClass, form, NULL((void*)0), 0); |
| 979 | XtAddCallback (wids[2], XtNjumpProc((char*)&XtStrings[370]), ScrollCB, (XtPointer) findex); |
| 980 | XtManageChildren (wids, 3); |
| 981 | } else { |
| 982 | wids[2] = (Widget) NULL((void*)0); |
| 983 | XtManageChildren (wids, 2); |
| 984 | } |
| 985 | AppRes.field[findex].textwidget = wids[1]; |
| 986 | AppRes.field[findex].scrollwidget = wids[2]; |
| 987 | } |
| 988 | |
| 989 | |
| 990 | static void |
| 991 | AckWarn (Widget w, XtPointer client, XtPointer call) |
| 992 | { |
| 993 | XtPopdown((Widget) client); |
| 994 | XtDestroyWidget((Widget) client); |
| 995 | } |
| 996 | |
| 997 | static void |
| 998 | AckNoTune (Widget w, XtPointer client, XtPointer call) |
| 999 | { |
| 1000 | CleanUp(XtDisplay(w)); |
| 1001 | #if XtSpecificationRelease6 < 6 |
| 1002 | exit (0); |
| 1003 | #else |
| 1004 | XtAppSetExitFlag (XtWidgetToApplicationContext (w)); |
| 1005 | #endif |
| 1006 | } |
| 1007 | |
| 1008 | static void |
| 1009 | displayWarning(Widget top) |
| 1010 | { |
| 1011 | Widget w, popup, popupBox; |
| 1012 | int x, y; |
| 1013 | |
| 1014 | x = DisplayWidth(XtDisplay (top),DefaultScreen (XtDisplay (top)))((&((_XPrivDisplay)(XtDisplay (top)))->screens[(((_XPrivDisplay )(XtDisplay (top)))->default_screen)])->width) / 3; |
| 1015 | y = DisplayHeight(XtDisplay (top),DefaultScreen (XtDisplay (top)))((&((_XPrivDisplay)(XtDisplay (top)))->screens[(((_XPrivDisplay )(XtDisplay (top)))->default_screen)])->height) / 3; |
| 1016 | |
| 1017 | popup = XtVaCreatePopupShell("Warning", |
| 1018 | transientShellWidgetClass, top, |
| 1019 | XtNtitle((char*)&XtShellStrings[356]), "WARNING", |
| 1020 | XtNx((char*)&XtStrings[885]), x, |
| 1021 | XtNy((char*)&XtStrings[887]), y, |
| 1022 | NULL((void*)0)); |
| 1023 | |
| 1024 | popupBox = XtVaCreateManagedWidget( |
| 1025 | "WarningBox", |
| 1026 | boxWidgetClass, |
| 1027 | popup, |
| 1028 | NULL((void*)0)); |
| 1029 | |
| 1030 | w = XtVaCreateManagedWidget( "WarnLabel", |
| 1031 | labelWidgetClass, |
| 1032 | popupBox, |
| 1033 | NULL((void*)0)); |
| 1034 | |
| 1035 | w = XtVaCreateManagedWidget( "WarnOK", |
| 1036 | commandWidgetClass, |
| 1037 | popupBox, |
| 1038 | NULL((void*)0)); |
| 1039 | |
| 1040 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AckWarn, (XtPointer)popup); |
| 1041 | |
| 1042 | w = XtVaCreateManagedWidget( "WarnCancel", |
| 1043 | commandWidgetClass, |
| 1044 | popupBox, |
| 1045 | NULL((void*)0)); |
| 1046 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), QuitCB, (XtPointer)NULL((void*)0)); |
| 1047 | |
| 1048 | XtPopup(popup, XtGrabExclusive); |
| 1049 | |
| 1050 | } |
| 1051 | |
| 1052 | static void |
| 1053 | displayNoTune(Widget top) |
| 1054 | { |
| 1055 | Widget w, popup, popupBox; |
| 1056 | |
| 1057 | popup = XtCreateWidget ("Notice", formWidgetClass, top, NULL((void*)0), 0); |
| 1058 | popupBox = XtVaCreateManagedWidget( |
| 1059 | "WarningBox", |
| 1060 | boxWidgetClass, |
| 1061 | popup, |
| 1062 | NULL((void*)0)); |
| 1063 | |
| 1064 | w = XtVaCreateManagedWidget( "NoTuneLabel", |
| 1065 | labelWidgetClass, |
| 1066 | popupBox, |
| 1067 | NULL((void*)0)); |
| 1068 | |
| 1069 | w = XtVaCreateManagedWidget( "NoTuneOK", |
| 1070 | commandWidgetClass, |
| 1071 | popupBox, |
| 1072 | NULL((void*)0)); |
| 1073 | |
| 1074 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AckNoTune, (XtPointer)popup); |
| 1075 | |
| 1076 | XtManageChild (popup); |
| 1077 | } |
| 1078 | |
| 1079 | #if 0 |
| 1080 | static void |
| 1081 | s3Special(Widget top) |
| 1082 | { |
| 1083 | Widget w, popup, form, invert_vclk_toggle, wids[6]; |
| 1084 | char buf1[5] = {'\0',}; |
| 1085 | int x, y; |
| 1086 | |
| 1087 | x = DisplayWidth(XtDisplay (top),DefaultScreen (XtDisplay (top)))((&((_XPrivDisplay)(XtDisplay (top)))->screens[(((_XPrivDisplay )(XtDisplay (top)))->default_screen)])->width) / 3; |
| 1088 | y = DisplayHeight(XtDisplay (top),DefaultScreen (XtDisplay (top)))((&((_XPrivDisplay)(XtDisplay (top)))->screens[(((_XPrivDisplay )(XtDisplay (top)))->default_screen)])->height) / 3; |
| 1089 | |
| 1090 | popup = XtVaCreatePopupShell("S3Adjust", |
| 1091 | transientShellWidgetClass, top, |
| 1092 | XtNtitle((char*)&XtShellStrings[356]), "S3Adjust", |
| 1093 | XtNx((char*)&XtStrings[885]), x, |
| 1094 | XtNy((char*)&XtStrings[887]), y, |
| 1095 | NULL((void*)0)); |
| 1096 | |
| 1097 | form = XtVaCreateManagedWidget( |
| 1098 | "S3Box", |
| 1099 | formWidgetClass, |
| 1100 | popup, |
| 1101 | NULL((void*)0)); |
| 1102 | |
| 1103 | w = XtVaCreateManagedWidget( "S3Title", |
| 1104 | labelWidgetClass, |
| 1105 | form, |
| 1106 | NULL((void*)0)); |
| 1107 | |
| 1108 | invert_vclk_toggle = XtVaCreateManagedWidget( "InvertVclk-toggle", |
| 1109 | toggleWidgetClass, |
| 1110 | form, |
| 1111 | NULL((void*)0)); |
| 1112 | |
| 1113 | wids[0] = XtCreateWidget ("Blank1-label", labelWidgetClass, |
| 1114 | form, NULL((void*)0), 0); |
| 1115 | wids[1] = XtVaCreateWidget ("Blank1-text", asciiTextWidgetClass, |
| 1116 | form, XtNstring((char*)&XtStrings[733]), buf1, NULL((void*)0)); |
| 1117 | AddCallback (wids[1], XtNcallback((char*)&XtStrings[136]), FlagsEditCB, (XtPointer) NULL((void*)0)); |
| 1118 | |
| 1119 | XtManageChildren (wids, 2); |
| 1120 | |
| 1121 | XtPopup(popup, XtGrabNone); |
| 1122 | |
| 1123 | } |
| 1124 | #endif |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | static void |
| 1129 | CreateHierarchy(Widget top) |
| 1130 | { |
| 1131 | char buf[5]; |
| 1132 | Widget form, forms[14], s3form; |
| 1133 | Widget wids[10]; |
| 1134 | Widget boxW, popdownW, w; |
| 1135 | int i; |
| 1136 | int x, y; |
| 1137 | static String form_names[] = { |
| 1138 | "HDisplay-form", |
| 1139 | "HSyncStart-form", |
| 1140 | "HSyncEnd-form", |
| 1141 | "HTotal-form", |
| 1142 | "VDisplay-form", |
| 1143 | "VSyncStart-form", |
| 1144 | "VSyncEnd-form", |
| 1145 | "VTotal-form", |
| 1146 | "Flags-form", |
| 1147 | "Buttons-form", |
| 1148 | "PixelClock-form", |
| 1149 | "HSyncRate-form", |
| 1150 | "VSyncRate-form", |
| 1151 | "Buttons2-form", |
| 1152 | }; |
| 1153 | |
| 1154 | form = XtCreateWidget ("form", formWidgetClass, top, NULL((void*)0), 0); |
| 1155 | for (i = 0; i < 14; i++) |
| 1156 | forms[i] = XtCreateWidget (form_names[i], formWidgetClass, |
| 1157 | form, NULL((void*)0), 0); |
| 1158 | |
| 1159 | CreateTyp (forms[0], HDisplay, "HDisplay-label", "HDisplay-text", NULL((void*)0)); |
| 1160 | CreateTyp (forms[1], HSyncStart, "HSyncStart-label", |
| 1161 | "HSyncStart-text", "HSyncStart-scrollbar"); |
| 1162 | CreateTyp (forms[2], HSyncEnd, "HSyncEnd-label", "HSyncEnd-text", |
| 1163 | "HSyncEnd-scrollbar"); |
| 1164 | CreateTyp (forms[3], HTotal, "HTotal-label", "HTotal-text", |
| 1165 | "HTotal-scrollbar"); |
| 1166 | |
| 1167 | w = XtVaCreateManagedWidget( |
| 1168 | "Left-button", |
| 1169 | commandWidgetClass, |
| 1170 | forms[3], |
| 1171 | NULL((void*)0)); |
| 1172 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)HSyncStart); |
| 1173 | w = XtVaCreateManagedWidget( |
| 1174 | "Right-button", |
| 1175 | commandWidgetClass, |
| 1176 | forms[3], |
| 1177 | NULL((void*)0)); |
| 1178 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)-HSyncStart); |
| 1179 | w= XtVaCreateManagedWidget( |
| 1180 | "Wider-button", |
| 1181 | commandWidgetClass, |
| 1182 | forms[3], |
| 1183 | NULL((void*)0)); |
| 1184 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)-HTotal); |
| 1185 | w = XtVaCreateManagedWidget( |
| 1186 | "Narrower-button", |
| 1187 | commandWidgetClass, |
| 1188 | forms[3], |
| 1189 | NULL((void*)0)); |
| 1190 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)HTotal); |
| 1191 | CreateTyp (forms[4], VDisplay, "VDisplay-label", "VDisplay-text", NULL((void*)0)); |
| 1192 | CreateTyp (forms[5], VSyncStart, "VSyncStart-label", |
| 1193 | "VSyncStart-text", "VSyncStart-scrollbar"); |
| 1194 | CreateTyp (forms[6], VSyncEnd, "VSyncEnd-label", "VSyncEnd-text", |
| 1195 | "VSyncEnd-scrollbar"); |
| 1196 | CreateTyp (forms[7], VTotal, "VTotal-label", "VTotal-text", |
| 1197 | "VTotal-scrollbar"); |
| 1198 | w = XtVaCreateManagedWidget( |
| 1199 | "Up-button", |
| 1200 | commandWidgetClass, |
| 1201 | forms[7], |
| 1202 | NULL((void*)0)); |
| 1203 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)VSyncStart); |
| 1204 | w = XtVaCreateManagedWidget( |
| 1205 | "Down-button", |
| 1206 | commandWidgetClass, |
| 1207 | forms[7], |
| 1208 | NULL((void*)0)); |
| 1209 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)-VSyncStart); |
| 1210 | w= XtVaCreateManagedWidget( |
| 1211 | "Shorter-button", |
| 1212 | commandWidgetClass, |
| 1213 | forms[7], |
| 1214 | NULL((void*)0)); |
| 1215 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)VTotal); |
| 1216 | w = XtVaCreateManagedWidget( |
| 1217 | "Taller-button", |
| 1218 | commandWidgetClass, |
| 1219 | forms[7], |
| 1220 | NULL((void*)0)); |
| 1221 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), AdjustCB, (XtPointer)-VTotal); |
| 1222 | |
| 1223 | (void) snprintf (buf, sizeof(buf), "%04x", AppRes.field[Flags].val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%04x", AppRes.field[Flags].val); |
| 1224 | wids[0] = XtCreateWidget ("Flags-label", labelWidgetClass, |
| 1225 | forms[8], NULL((void*)0), 0); |
| 1226 | wids[1] = XtVaCreateWidget ("Flags-text", asciiTextWidgetClass, |
| 1227 | forms[8], XtNstring((char*)&XtStrings[733]), buf, XtNtranslations((char*)&XtStrings[802]), trans, NULL((void*)0)); |
| 1228 | AddCallback (wids[1], XtNcallback((char*)&XtStrings[136]), FlagsEditCB, (XtPointer) Flags); |
| 1229 | XtManageChildren (wids, 2); |
| 1230 | AppRes.field[Flags].textwidget = wids[1]; |
| 1231 | |
| 1232 | wids[0] = XtCreateWidget ("Quit-button", commandWidgetClass, |
| 1233 | forms[9], NULL((void*)0), 0); |
| 1234 | XtAddCallback (wids[0], XtNcallback((char*)&XtStrings[136]), QuitCB, NULL((void*)0)); |
| 1235 | |
| 1236 | wids[1] = XtCreateWidget ("Apply-button", commandWidgetClass, |
| 1237 | forms[9], NULL((void*)0), 0); |
| 1238 | XtAddCallback (wids[1], XtNcallback((char*)&XtStrings[136]), ApplyCB, NULL((void*)0)); |
| 1239 | |
| 1240 | wids[2] = XtCreateWidget ("AutoApply-toggle", toggleWidgetClass, |
| 1241 | forms[9], NULL((void*)0), 0); |
| 1242 | auto_apply_toggle = wids[2]; |
| 1243 | |
| 1244 | wids[3] = XtCreateWidget ("Test-button", commandWidgetClass, |
| 1245 | forms[9], NULL((void*)0), 0); |
| 1246 | XtAddCallback (wids[3], XtNcallback((char*)&XtStrings[136]), TestCB, NULL((void*)0)); |
| 1247 | |
| 1248 | wids[4] = XtCreateWidget ("Restore-button", commandWidgetClass, |
| 1249 | forms[9], NULL((void*)0), 0); |
| 1250 | XtAddCallback (wids[4], XtNcallback((char*)&XtStrings[136]), RestoreCB, NULL((void*)0)); |
| 1251 | |
| 1252 | XtManageChildren (wids, 5); |
| 1253 | |
| 1254 | |
| 1255 | CreateTyp (forms[10], PixelClock, "PixelClock-label", "PixelClock-text", |
| 1256 | NULL((void*)0)); |
| 1257 | CreateTyp (forms[11], HSyncRate, "HSyncRate-label", "HSyncRate-text", |
| 1258 | NULL((void*)0)); |
| 1259 | CreateTyp (forms[12], VSyncRate, "VSyncRate-label", "VSyncRate-text", |
| 1260 | NULL((void*)0)); |
| 1261 | |
| 1262 | wids[0] = XtCreateWidget ("Fetch-button", commandWidgetClass, |
| 1263 | forms[13], NULL((void*)0), 0); |
| 1264 | XtAddCallback (wids[0], XtNcallback((char*)&XtStrings[136]), FetchCB, NULL((void*)0)); |
| 1265 | |
| 1266 | wids[1] = XtCreateWidget ("Show-button", commandWidgetClass, |
| 1267 | forms[13], NULL((void*)0), 0); |
| 1268 | XtAddCallback (wids[1], XtNcallback((char*)&XtStrings[136]), ShowCB, NULL((void*)0)); |
| 1269 | |
| 1270 | wids[2] = XtCreateWidget ("Next-button", commandWidgetClass, |
| 1271 | forms[13], NULL((void*)0), 0); |
| 1272 | XtAddCallback (wids[2], XtNcallback((char*)&XtStrings[136]), SwitchCB, (XtPointer)1); |
| 1273 | |
| 1274 | wids[3] = XtCreateWidget ("Prev-button", commandWidgetClass, |
| 1275 | forms[13], NULL((void*)0), 0); |
| 1276 | XtAddCallback (wids[3], XtNcallback((char*)&XtStrings[136]), SwitchCB, (XtPointer)-1); |
| 1277 | |
| 1278 | XtManageChildren (wids, 4); |
| 1279 | |
| 1280 | XtManageChildren (forms, 14); |
| 1281 | |
| 1282 | if (S3Specials) { |
| 1283 | s3form = XtCreateWidget ("S3-form", formWidgetClass, |
| 1284 | form, NULL((void*)0), 0); |
| 1285 | wids[0] = XtVaCreateWidget("InvertVclk-toggle", toggleWidgetClass, |
| 1286 | s3form, XtNstate"state", AppRes.field[InvertVclk].val, NULL((void*)0)); |
| 1287 | XtAddCallback (wids[0], XtNcallback((char*)&XtStrings[136]), ApplyIfAutoCB, NULL((void*)0)); |
| 1288 | AppRes.field[InvertVclk].textwidget = wids[0]; |
| 1289 | wids[1] = XtVaCreateWidget("EarlySc-toggle", toggleWidgetClass, |
| 1290 | s3form, XtNstate"state", AppRes.field[EarlySc].val, NULL((void*)0)); |
| 1291 | XtAddCallback (wids[1], XtNcallback((char*)&XtStrings[136]), ApplyIfAutoCB, NULL((void*)0)); |
| 1292 | AppRes.field[EarlySc].textwidget = wids[1]; |
| 1293 | wids[2] = XtCreateWidget("Blank1-label", labelWidgetClass, s3form, |
| 1294 | NULL((void*)0), 0); |
| 1295 | wids[3] = XtVaCreateWidget("Blank1Dec-button", commandWidgetClass, |
| 1296 | s3form, NULL((void*)0)); |
| 1297 | XtAddCallback (wids[3], XtNcallback((char*)&XtStrings[136]), ChangeBlankCB, |
| 1298 | (XtPointer)-BlankDelay1); |
| 1299 | (void) snprintf (buf, sizeof(buf), "%d", AppRes.field[BlankDelay1].val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%d", AppRes.field[BlankDelay1].val ); |
| 1300 | wids[4] = XtVaCreateWidget("Blank1-text", asciiTextWidgetClass, |
| 1301 | s3form, XtNstring((char*)&XtStrings[733]), buf, XtNtranslations((char*)&XtStrings[802]), trans, NULL((void*)0)); |
| 1302 | AddCallback(wids[4], XtNcallback((char*)&XtStrings[136]), BlankEditCB, (XPointer) BlankDelay1); |
| 1303 | AppRes.field[BlankDelay1].textwidget = wids[4]; |
| 1304 | wids[5] = XtVaCreateWidget("Blank1Inc-button", commandWidgetClass, |
| 1305 | s3form, NULL((void*)0)); |
| 1306 | XtAddCallback (wids[5], XtNcallback((char*)&XtStrings[136]), ChangeBlankCB, |
| 1307 | (XtPointer)BlankDelay1); |
| 1308 | |
| 1309 | wids[6] = XtCreateWidget("Blank2-label", labelWidgetClass, s3form, |
| 1310 | NULL((void*)0), 0); |
| 1311 | wids[7] = XtVaCreateWidget("Blank2Dec-button", commandWidgetClass, |
| 1312 | s3form, NULL((void*)0)); |
| 1313 | XtAddCallback (wids[7], XtNcallback((char*)&XtStrings[136]), ChangeBlankCB, |
| 1314 | (XtPointer)-BlankDelay2); |
| 1315 | (void) snprintf (buf, sizeof(buf), "%d", AppRes.field[BlankDelay2].val)__builtin___snprintf_chk (buf, sizeof(buf), 0, __builtin_object_size (buf, 2 > 1 ? 1 : 0), "%d", AppRes.field[BlankDelay2].val ); |
| 1316 | wids[8] = XtVaCreateWidget("Blank2-text", asciiTextWidgetClass, |
| 1317 | s3form, XtNstring((char*)&XtStrings[733]), buf, XtNtranslations((char*)&XtStrings[802]), trans, NULL((void*)0)); |
| 1318 | AddCallback(wids[8], XtNcallback((char*)&XtStrings[136]), BlankEditCB, (XPointer) BlankDelay2); |
| 1319 | AppRes.field[BlankDelay2].textwidget = wids[8]; |
| 1320 | wids[9] = XtVaCreateWidget("Blank2Inc-button", commandWidgetClass, |
| 1321 | s3form, NULL((void*)0)); |
| 1322 | XtAddCallback (wids[9], XtNcallback((char*)&XtStrings[136]), ChangeBlankCB, |
| 1323 | (XtPointer)BlankDelay2); |
| 1324 | XtManageChildren (wids, 10); |
| 1325 | XtManageChild(s3form); |
| 1326 | } |
| 1327 | |
| 1328 | XtManageChild (form); |
| 1329 | |
| 1330 | SetScrollbars (); |
| 1331 | x = DisplayWidth(XtDisplay (top),DefaultScreen (XtDisplay (top)))((&((_XPrivDisplay)(XtDisplay (top)))->screens[(((_XPrivDisplay )(XtDisplay (top)))->default_screen)])->width) / 2; |
| 1332 | y = DisplayHeight(XtDisplay (top),DefaultScreen (XtDisplay (top)))((&((_XPrivDisplay)(XtDisplay (top)))->screens[(((_XPrivDisplay )(XtDisplay (top)))->default_screen)])->height) / 2; |
| 1333 | |
| 1334 | invalid_mode_popup = XtVaCreatePopupShell("invalidMode", |
| 1335 | transientShellWidgetClass, top, |
| 1336 | XtNtitle((char*)&XtShellStrings[356]), "Invalid Mode requested", |
| 1337 | XtNx((char*)&XtStrings[885]), x - 20, |
| 1338 | XtNy((char*)&XtStrings[887]), y - 40, |
| 1339 | NULL((void*)0)); |
| 1340 | |
| 1341 | testing_popup = XtVaCreatePopupShell("testing", |
| 1342 | transientShellWidgetClass, top, |
| 1343 | XtNtitle((char*)&XtShellStrings[356]), "Testing_1_2_3", |
| 1344 | XtNx((char*)&XtStrings[885]), x - 20, |
| 1345 | XtNy((char*)&XtStrings[887]), y - 40, |
| 1346 | NULL((void*)0)); |
| 1347 | boxW = XtVaCreateManagedWidget( |
| 1348 | "TestingBox", |
| 1349 | boxWidgetClass, |
| 1350 | testing_popup, |
| 1351 | NULL((void*)0)); |
| 1352 | |
| 1353 | w = XtVaCreateManagedWidget( |
Value stored to 'w' is never read | |
| 1354 | "testingMessage", |
| 1355 | labelWidgetClass, |
| 1356 | boxW, |
| 1357 | NULL((void*)0)); |
| 1358 | |
| 1359 | w = XtVaCreateManagedWidget( |
| 1360 | "Abort", |
| 1361 | commandWidgetClass, |
| 1362 | boxW, |
| 1363 | NULL((void*)0)); |
| 1364 | |
| 1365 | XtAddCallback (w, XtNcallback((char*)&XtStrings[136]), (XtCallbackProc) TestTOCB, |
| 1366 | (XtPointer) NULL((void*)0)); |
| 1367 | |
| 1368 | boxW = XtVaCreateManagedWidget( |
| 1369 | "invalidBox", |
| 1370 | boxWidgetClass, |
| 1371 | invalid_mode_popup, |
| 1372 | NULL((void*)0)); |
| 1373 | |
| 1374 | (void) XtVaCreateManagedWidget( |
| 1375 | "ErrorMessage", |
| 1376 | labelWidgetClass, |
| 1377 | boxW, |
| 1378 | NULL((void*)0)); |
| 1379 | |
| 1380 | popdownW = XtVaCreateManagedWidget( |
| 1381 | "AckError", |
| 1382 | commandWidgetClass, |
| 1383 | boxW, |
| 1384 | NULL((void*)0)); |
| 1385 | |
| 1386 | XtAddCallback (popdownW, XtNcallback((char*)&XtStrings[136]), (XtCallbackProc)popdownInvalid, |
| 1387 | (XtPointer) invalid_mode_popup); |
| 1388 | } |
| 1389 | |
| 1390 | static void |
| 1391 | QuitAction (Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1392 | { |
| 1393 | if ((e->type == ClientMessage33 |
| 1394 | && e->xclient.data.l[0] == (long) wm_delete_window) |
| 1395 | || e->type == KeyPress2) |
| 1396 | QuitCB(w, NULL((void*)0), NULL((void*)0)); |
| 1397 | } |
| 1398 | |
| 1399 | static void |
| 1400 | RestoreAction (Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1401 | { |
| 1402 | Boolean state; |
| 1403 | |
| 1404 | RestoreCB(w, NULL((void*)0), NULL((void*)0)); |
| 1405 | XtVaGetValues(auto_apply_toggle, XtNstate"state", &state, NULL((void*)0)); |
| 1406 | if (!state) |
| 1407 | ApplyCB (w, NULL((void*)0), NULL((void*)0)); |
| 1408 | } |
| 1409 | |
| 1410 | |
| 1411 | static void |
| 1412 | ShowAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1413 | { |
| 1414 | ShowCB(w, NULL((void*)0), NULL((void*)0)); |
| 1415 | } |
| 1416 | |
| 1417 | static void |
| 1418 | MoveLeftAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1419 | { |
| 1420 | AdjustCB(w, (XtPointer)HSyncStart, NULL((void*)0)); |
| 1421 | } |
| 1422 | |
| 1423 | static void |
| 1424 | MoveRightAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1425 | { |
| 1426 | AdjustCB(w, (XtPointer)-HSyncStart, NULL((void*)0)); |
| 1427 | } |
| 1428 | |
| 1429 | static void |
| 1430 | NarrowerAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1431 | { |
| 1432 | AdjustCB(w, (XtPointer)HTotal, NULL((void*)0)); |
| 1433 | } |
| 1434 | |
| 1435 | static void |
| 1436 | WiderAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1437 | { |
| 1438 | AdjustCB(w, (XtPointer)-HTotal, NULL((void*)0)); |
| 1439 | } |
| 1440 | |
| 1441 | static void |
| 1442 | MoveUpAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1443 | { |
| 1444 | AdjustCB(w, (XtPointer)VSyncStart, NULL((void*)0)); |
| 1445 | } |
| 1446 | |
| 1447 | static void |
| 1448 | MoveDownAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1449 | { |
| 1450 | AdjustCB(w, (XtPointer)-VSyncStart, NULL((void*)0)); |
| 1451 | } |
| 1452 | |
| 1453 | static void |
| 1454 | TallerAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1455 | { |
| 1456 | AdjustCB(w, (XtPointer)-VTotal, NULL((void*)0)); |
| 1457 | } |
| 1458 | |
| 1459 | static void |
| 1460 | ShorterAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1461 | { |
| 1462 | AdjustCB(w, (XtPointer)VTotal, NULL((void*)0)); |
| 1463 | } |
| 1464 | |
| 1465 | static void |
| 1466 | NextModeAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1467 | { |
| 1468 | SwitchCB(w, (XPointer) 1, NULL((void*)0)); |
| 1469 | } |
| 1470 | |
| 1471 | static void |
| 1472 | PrevModeAction(Widget w, XEvent* e, String* vector, Cardinal* count) |
| 1473 | { |
| 1474 | SwitchCB(w, (XPointer) -1, NULL((void*)0)); |
| 1475 | } |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | static void |
| 1480 | usage(void) |
| 1481 | { |
| 1482 | fprintf(stderr__stderrp, "Usage: %s [-show|-prev|-next|-unlock|-timeout <sec>] [-toolkitoption...]\n", progname); |
| 1483 | fprintf(stderr__stderrp, " where option is one of:\n"); |
| 1484 | fprintf(stderr__stderrp, " -show Print current modeline to stdout\n"); |
| 1485 | fprintf(stderr__stderrp, " -next Switch to next video mode\n"); |
| 1486 | fprintf(stderr__stderrp, " -prev Switch to previous video mode\n"); |
| 1487 | fprintf(stderr__stderrp, " -unlock Enable mode switch hot-keys\n"); |
| 1488 | fprintf(stderr__stderrp, " -timeout <sec> Set testmode timeout in seconds\n"); |
| 1489 | exit(1); |
| 1490 | } |
| 1491 | |
| 1492 | |
| 1493 | int |
| 1494 | main (int argc, char** argv) |
| 1495 | { |
| 1496 | Widget top; |
| 1497 | XtAppContext app; |
| 1498 | Display* dpy; |
| 1499 | Boolint modeSettable = TRUE1; |
| 1500 | |
| 1501 | progname = argv[0]; |
| 1502 | |
| 1503 | static XtActionsRec actions[] = { { "xvidtune-quit", QuitAction }, |
| 1504 | { "xvidtune-restore", RestoreAction }, |
| 1505 | { "xvidtune-show", ShowAction }, |
| 1506 | { "xvidtune-moveleft", MoveLeftAction }, |
| 1507 | { "xvidtune-moveright", MoveRightAction }, |
| 1508 | { "xvidtune-wider", WiderAction }, |
| 1509 | { "xvidtune-narrower", NarrowerAction }, |
| 1510 | { "xvidtune-moveup", MoveUpAction }, |
| 1511 | { "xvidtune-movedown", MoveDownAction }, |
| 1512 | { "xvidtune-taller", TallerAction }, |
| 1513 | { "xvidtune-shorter", ShorterAction }, |
| 1514 | { "xvidtune-nextmode", NextModeAction }, |
| 1515 | { "xvidtune-prevmode", PrevModeAction } }; |
| 1516 | |
| 1517 | Top = top = XtVaOpenApplication (&app, "Xvidtune", NULL((void*)0), 0, &argc, argv, |
| 1518 | NULL((void*)0), applicationShellWidgetClass, |
| 1519 | XtNmappedWhenManaged((char*)&XtStrings[453]), False0, NULL((void*)0)); |
| 1520 | |
| 1521 | XtGetApplicationResources (top, (XtPointer)&AppRes, |
| 1522 | Resources, XtNumber(Resources)((Cardinal) (sizeof(Resources) / sizeof(Resources[0]))), |
| 1523 | NULL((void*)0), 0); |
| 1524 | |
| 1525 | if (!AppRes.ad_installed) { |
| 1526 | fprintf(stderr__stderrp, "Please install the program before using\n"); |
| 1527 | return 3; |
| 1528 | } |
| 1529 | |
| 1530 | if (!XF86VidModeQueryVersion(XtDisplay (top), &MajorVersion, &MinorVersion)) { |
| 1531 | fprintf(stderr__stderrp, "Unable to query video extension version\n"); |
| 1532 | return 2; |
| 1533 | } |
| 1534 | |
| 1535 | if (!XF86VidModeQueryExtension(XtDisplay (top), &EventBase, &ErrorBase)) { |
| 1536 | fprintf(stderr__stderrp, "Unable to query video extension information\n"); |
| 1537 | return 2; |
| 1538 | } |
| 1539 | |
| 1540 | /* Fail if the extension version in the server is too old */ |
| 1541 | if (MajorVersion < MINMAJOR0 || |
| 1542 | (MajorVersion == MINMAJOR0 && MinorVersion < MINMINOR5)) { |
| 1543 | fprintf(stderr__stderrp, |
| 1544 | "Xserver is running an old XFree86-VidModeExtension version" |
| 1545 | " (%d.%d)\n", MajorVersion, MinorVersion); |
| 1546 | fprintf(stderr__stderrp, "Minimum required version is %d.%d\n", |
| 1547 | MINMAJOR0, MINMINOR5); |
| 1548 | exit(2); |
| 1549 | } |
| 1550 | |
| 1551 | /* This should probably be done differently */ |
| 1552 | |
| 1553 | if( argc == 3 ) { /* this can only be the timeout case */ |
| 1554 | if( (!strcmp(argv[1], "-timeout")) ) { |
| 1555 | TestTimeout = ((unsigned long) atol( argv[2] )) * 1000L; |
| 1556 | } |
| 1557 | else |
| 1558 | usage(); |
| 1559 | } |
| 1560 | |
| 1561 | if (argc > 1) { |
| 1562 | int i = 0; |
| 1563 | |
| 1564 | if (argc != 2) |
| 1565 | usage(); |
| 1566 | if (!strcmp(argv[1], "-show")) { |
| 1567 | if (!GetModeLine(XtDisplay (top), DefaultScreen (XtDisplay (top))(((_XPrivDisplay)(XtDisplay (top)))->default_screen))) { |
| 1568 | fprintf(stderr__stderrp, "Unable to get mode info\n"); |
| 1569 | CleanUp(XtDisplay (top)); |
| 1570 | return 2; |
| 1571 | } |
| 1572 | ShowCB(top, NULL((void*)0), NULL((void*)0)); |
| 1573 | return 0; |
| 1574 | } else if (!strcmp(argv[1], "-next")) |
| 1575 | i = 1; |
| 1576 | else if (!strcmp(argv[1], "-prev")) |
| 1577 | i = -1; |
| 1578 | else if (!strcmp(argv[1], "-unlock")) { |
| 1579 | CleanUp(XtDisplay (top)); |
| 1580 | XSync(XtDisplay (top), True1); |
| 1581 | return 0; |
| 1582 | } else |
| 1583 | usage(); |
| 1584 | if (i != 0) { |
| 1585 | XF86VidModeSwitchMode(XtDisplay (top), |
| 1586 | DefaultScreen (XtDisplay (top))(((_XPrivDisplay)(XtDisplay (top)))->default_screen), i); |
| 1587 | XSync(XtDisplay (top), True1); |
| 1588 | return 0; |
| 1589 | } |
| 1590 | } |
| 1591 | if (!GetMonitor(XtDisplay (top), DefaultScreen (XtDisplay (top))(((_XPrivDisplay)(XtDisplay (top)))->default_screen))) { |
| 1592 | fprintf(stderr__stderrp, "Unable to query monitor info\n"); |
| 1593 | return 2; |
| 1594 | } |
| 1595 | |
| 1596 | if (!XF86VidModeLockModeSwitch(XtDisplay (top), |
| 1597 | DefaultScreen (XtDisplay (top))(((_XPrivDisplay)(XtDisplay (top)))->default_screen), TRUE1)) { |
| 1598 | fprintf(stderr__stderrp, "Failed to disable mode-switch hot-keys\n"); |
| 1599 | return 2; |
| 1600 | } |
| 1601 | |
| 1602 | signal(SIGINT2, CatchSig); |
| 1603 | signal(SIGQUIT3, CatchSig); |
| 1604 | signal(SIGTERM15, CatchSig); |
| 1605 | signal(SIGHUP1, CatchSig); |
| 1606 | sigId = XtAppAddSignal(app, CatchXtSig, NULL((void*)0)); |
| 1607 | |
| 1608 | if (!GetModeLine(XtDisplay (top), DefaultScreen (XtDisplay (top))(((_XPrivDisplay)(XtDisplay (top)))->default_screen))) { |
| 1609 | fprintf(stderr__stderrp, "Unable to get mode info\n"); |
| 1610 | CleanUp(XtDisplay (top)); |
| 1611 | return 2; |
| 1612 | } |
| 1613 | |
| 1614 | xtErrorfunc = XSetErrorHandler(vidmodeError); |
| 1615 | |
| 1616 | trans = XtParseTranslationTable ("\ |
| 1617 | <Key>0: insert-char()\n<Key>1: insert-char()\n\ |
| 1618 | <Key>2: insert-char()\n<Key>3: insert-char()\n\ |
| 1619 | <Key>4: insert-char()\n<Key>5: insert-char()\n\ |
| 1620 | <Key>6: insert-char()\n<Key>7: insert-char()\n\ |
| 1621 | <Key>8: insert-char()\n<Key>9: insert-char()\n\ |
| 1622 | <Key>a: insert-char()\n<Key>b: insert-char()\n\ |
| 1623 | <Key>c: insert-char()\n<Key>d: insert-char()\n\ |
| 1624 | <Key>e: insert-char()\n<Key>f: insert-char()\n\ |
| 1625 | <Key>+: insert-char()\n<Key>-: insert-char()\n\ |
| 1626 | <Key>r: xvidtune-restore()\n<Key>q: xvidtune-quit()\n\ |
| 1627 | <Key>BackSpace: delete-previous-character()\n\ |
| 1628 | <Key>Right: forward-character()\n<Key>KP_Right: forward-character()\n\ |
| 1629 | <Key>Left: backward-character()\n<Key>KP_Left: backward-character()\n\ |
| 1630 | <Key>Delete: delete-previous-character()\n\ |
| 1631 | <Key>KP_Delete: delete-previous-character()\n\ |
| 1632 | <EnterWindow>: enter-window()\n<LeaveWindow>: leave-window()\n\ |
| 1633 | <FocusIn>: focus-in()\n<FocusOut>: focus-out()\n\ |
| 1634 | <Btn1Down>: select-start()\n"); |
| 1635 | |
| 1636 | if (!ModeSettable()) { |
| 1637 | printf("Video modes are not settable on this chip\n"); |
| 1638 | displayNoTune(top); |
| 1639 | modeSettable = FALSE0; |
| 1640 | } else |
| 1641 | CreateHierarchy (top); |
| 1642 | |
| 1643 | |
| 1644 | XtAppAddActions (app, actions, XtNumber(actions)((Cardinal) (sizeof(actions) / sizeof(actions[0])))); |
| 1645 | |
| 1646 | XtOverrideTranslations (top, |
| 1647 | XtParseTranslationTable ("<Message>WM_PROTOCOLS: xvidtune-quit()")); |
| 1648 | |
| 1649 | XtRealizeWidget (top); |
| 1650 | |
| 1651 | dpy = XtDisplay(top); |
| 1652 | |
| 1653 | wm_delete_window = XInternAtom (dpy, "WM_DELETE_WINDOW", False0); |
| 1654 | |
| 1655 | (void) XSetWMProtocols (dpy, XtWindow (top), &wm_delete_window, 1); |
| 1656 | |
| 1657 | XtMapWidget (top)XMapWindow(XtDisplay(top), XtWindow(top)); |
| 1658 | |
| 1659 | if (modeSettable) |
| 1660 | displayWarning(top); |
| 1661 | |
| 1662 | /* really we should run our own event dispatching here until the |
| 1663 | * warning has been read... |
| 1664 | */ |
| 1665 | XtAppMainLoop (app); |
| 1666 | |
| 1667 | return 0; |
| 1668 | } |