Menu

#3 Wrong Video Mode

open
nobody
None
5
2003-05-24
2003-05-24
Anonymous
No

I am using XFree86 4.3.
However, I had a few problems with 3DDesktop that were
fixed by a simple
modification to the source code.
The problem I had was that when 3DDesktop was run, it
would change
screen mode, then after exiting it would not change
back to the original
mode. I was wondering why it needed to change mode in
the first place,
so after examining the code in win.cpp, i noticed a
simple loop at about
line 202 that selects the correct screen mode based on
the resolution.

Original Code: Line 202 win.cpp
> for (i = 0; i < modeNum; i++)
> {
> if ((modes[i]->hdisplay == width) &&
(modes[i]->vdisplay == height))
> {
> bestMode = i;
> }
> }

When this loops through the modes[] array, it does not
exit the loop
when it has found a screen mode of the correct size.
The result is that
bestMode will contain the last entry in the list of
modes with the
correct screen size. In my case this had a 60Hz rate
instead of 85Hz.
I noticed that the first entry in the modes[] array was
the current
screen mode, and figured that bestMode should be the
first mode from the
array with correct size instead of the last.
To achieve this behaviour i put in a 'break' just after
bestMode = i

Modified Code: Line 202 win.cpp
> for (i = 0; i < modeNum; i++)
> {
> if ((modes[i]->hdisplay == width) &&
(modes[i]->vdisplay == height))
> {
> bestMode = i;
> break;
> }
> }

Although this alteration stops 3DDesktop from changing
into the wrong mode, and cured all my problems,
it doesn't explain the effect I had where it would not
change back to the correct mode when it exited.

Please let me know if I am doing the right thing by
changing this...

--
Craig Shelley

Discussion


Log in to post a comment.

MongoDB Logo MongoDB