Changeset 1785 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Mar 28, 2007 9:07:23 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/xgraphics/vboxvideo.c
r1429 r1785 417 417 ClockRange *clockRanges; 418 418 int i; 419 DisplayModePtr m_prev; 419 420 420 421 /* Are we really starting the server, or is this just a dummy run? */ … … 523 524 xf86SetGamma(pScrn, gzeros); 524 525 525 /* To get around the problem of SUSE specifying a single, invalid mode in their Xorg.conf526 by default, we add an additional mode to the end of the user specified list. This means527 that if all user modes are invalid, X will try our mode before falling back to its standard528 526 /* To get around the problem of SUSE specifying a single, invalid mode in their 527 * Xorg.conf by default, we add an additional mode to the end of the user specified 528 * list. This means that if all user modes are invalid, X will try our mode before 529 * falling back to its standard mode list. */ 529 530 if (pScrn->display->modes == NULL) 530 531 { 531 532 /* The user specified no modes at all - specify 1024x768 as a default. */ 532 pScrn->display->modes = xnfalloc(2 * sizeof(char*));533 pScrn->display->modes = xnfalloc(2 * sizeof(char*)); 533 534 pScrn->display->modes[0] = "1024x768"; 534 535 pScrn->display->modes[1] = NULL; … … 538 539 /* Add 1024x768 to the end of the mode list in case the others are all invalid. */ 539 540 for (i = 0; pScrn->display->modes[i] != NULL; i++); 540 pScrn->display->modes = xnfrealloc(pScrn->display->modes, (i + 2) * sizeof(char *)); 541 pScrn->display->modes[i] = "1024x768"; 542 pScrn->display->modes[i + 1] = NULL; 541 pScrn->display->modes = xnfrealloc(pScrn->display->modes, (i + 2) 542 * sizeof(char *)); 543 pScrn->display->modes[i ] = "1024x768"; 544 pScrn->display->modes[i+1] = NULL; 545 } 546 547 /* Determine the virtual screen resolution from the first mode (which will be selected) */ 548 sscanf(pScrn->display->modes[0], "%dx%d", 549 &pScrn->display->virtualX, &pScrn->display->virtualY); 550 pScrn->display->virtualX = (pScrn->display->virtualX + 7) & ~7; 551 552 /* Create a builtin mode for every specified mode. This allows to specify arbitrary 553 * screen resolutions */ 554 m_prev = NULL; 555 for (i = 0; pScrn->display->modes[i] != NULL; i++) 556 { 557 DisplayModePtr m; 558 int x = 0, y = 0; 559 560 sscanf(pScrn->display->modes[i], "%dx%d", &x, &y); 561 /* sanity check, smaller resolutions does not make sense */ 562 if (x < 64 || y < 64) 563 { 564 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring mode \"%s\"\n", 565 pScrn->display->modes[i]); 566 continue; 567 } 568 m = xnfcalloc(sizeof(DisplayModeRec), 1); 569 m->status = MODE_OK; 570 m->type = M_T_BUILTIN; 571 /* VBox does only support screen widths which are a multiple of 8 */ 572 m->HDisplay = (x + 7) & ~7; 573 m->VDisplay = y; 574 m->name = strdup(pScrn->display->modes[i]); 575 if (!m_prev) 576 pScrn->modePool = m; 577 else 578 m_prev->next = m; 579 m->prev = m_prev; 580 m_prev = m; 543 581 } 544 582
Note:
See TracChangeset
for help on using the changeset viewer.