aboutsummaryrefslogtreecommitdiff
path: root/pipermail/nel/2001-February/000293.html
blob: de2c505e8cb4eb461532187d9776d4e3cf947713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Nel] Linux fullscreen patches</TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:dayta%40ucc.gu.uwa.edu.au">
   <LINK REL="Previous"  HREF="000302.html">
   <LINK REL="Next" HREF="000296.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Nel] Linux fullscreen patches</H1>
    <B>Leighton Haynes</B> 
    <A HREF="mailto:dayta%40ucc.gu.uwa.edu.au"
       TITLE="[Nel] Linux fullscreen patches">dayta@ucc.gu.uwa.edu.au</A><BR>
    <I>Wed, 28 Feb 2001 20:16:17 +0800</I>
    <P><UL>
        <LI> Previous message: <A HREF="000302.html">[Nel] Re: Nel digest, Vol 1 #64 - 21 msgs</A></li>
        <LI> Next message: <A HREF="000296.html">[Nel] Linux fullscreen patches</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#293">[ date ]</a>
              <a href="thread.html#293">[ thread ]</a>
              <a href="subject.html#293">[ subject ]</a>
              <a href="author.html#293">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi Guys,
    Attached to this should be 3 diffs against the current cvs tree
    to enable fullscreen under linux using the XFree86 VidMode
    extensions. The aptches are for the configure.in script, 
    and driver_opengl.{cpp,h}.

    To enable it you need to remake the configure script (./bootstrap)
    and run configure with the --with-xf86vidmode=&lt;position of the 
    Xxf86vm lib&gt; - usually /usr/X11R6/lib. If this option isn't given, 
    it will currently compile without fullscreen support.

    Anyhow, have a play, if anyone finds bugs... erm.. bug me ;)

Leighton...

--

Part-time student. Full-time Programmer. 
Seeking the 36 hour day and the 10 hour working week.
(08) 9272 9058 (Home - like I'm ever there)
0401 335 136 (Mobile - like it's ever on)

--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=&quot;diff.configure.in&quot;

Index: configure.in
===================================================================
RCS file: /home/cvsroot/code/nel/configure.in,v
retrieving revision 1.23
diff -r1.23 configure.in
232a233,251
&gt;<i> dnl ============================================
</I>&gt;<i> dnl Check for XF86VidMode extension (-lXxf86vm)
</I>&gt;<i> dnl ============================================
</I>&gt;<i> AC_MSG_CHECKING(&quot;for XF86VidMode extension&quot;)
</I>&gt;<i> AC_ARG_WITH( xf86vidmode,
</I>&gt;<i>     [ --with-xf86vidmode=&lt;path&gt;     path to the XF86VidMode lib.
</I>&gt;<i>                           e.g. /usr/X11R6/lib],
</I>&gt;<i>     [VMLIB_DIR=$with_xf86vidmode
</I>&gt;<i>       AC_MSG_RESULT(using VidMode library located in $with_xf86vidmode.)],
</I>&gt;<i>     AC_MSG_RESULT(Compiling without Xf86VidMode and hence fullscreen support to compile with XF86VidMode support, use --with-xf86vidmode=&lt;pathtolib&gt;)
</I>&gt;<i> )
</I>&gt;<i> 
</I>&gt;<i> if test X&quot;$VMLIB_DIR&quot; != X;
</I>&gt;<i> then
</I>&gt;<i>     LIBS=&quot;-L$VMLIB_DIR -lXxf86vm $LIBS&quot;;
</I>&gt;<i>     CXXFLAGS=&quot;$CXXFLAGS -DXF86VIDMODE&quot;;
</I>&gt;<i> fi
</I>&gt;<i> 
</I>&gt;<i> 
</I>
--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=&quot;diff.driver_opengl.cpp&quot;

Index: driver_opengl.cpp
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl.cpp,v
retrieving revision 1.75
diff -r1.75 driver_opengl.cpp
140d139
&lt; 	_FullScreen= false;
144c143,149
&lt; #endif // NL_OS_WINDOWS
---
&gt;<i> #elif defined (NL_OS_UNIX) // NL_OS_WINDOWS
</I>&gt;<i> #ifdef XF86VIDMODE
</I>&gt;<i>     memset(&amp;_OldScreenMode,0,sizeof(_OldScreenMode));// zero the old screen mode
</I>&gt;<i> #endif //XF86VIDMODE
</I>&gt;<i> #endif
</I>&gt;<i> 
</I>&gt;<i> 	_FullScreen= false;
</I>225a231
&gt;<i>         {
</I>226a233
&gt;<i>         }
</I>351c358
&lt; 	  {
---
&gt;<i>     {
</I>353c360
&lt; 	  }
---
&gt;<i>     }
</I>355c362
&lt; 	  {
---
&gt;<i>     {
</I>357c364
&lt; 	  }
---
&gt;<i>     }
</I>364c371,385
&lt; 	attr.override_redirect = False;
---
&gt;<i> #ifdef XF86VIDMODE
</I>&gt;<i>     // If we're going to attempt fullscreen, we need to set redirect to True,
</I>&gt;<i>     // This basically places the window with no borders in the top left 
</I>&gt;<i>     // corner of the screen.
</I>&gt;<i>     if (mode.Windowed)
</I>&gt;<i>     {
</I>&gt;<i>         attr.override_redirect = False;
</I>&gt;<i>     }
</I>&gt;<i>     else
</I>&gt;<i>     {
</I>&gt;<i> 	    attr.override_redirect = True;
</I>&gt;<i>     }
</I>&gt;<i> #else
</I>&gt;<i>     attr.override_redirect = False;
</I>&gt;<i> #endif
</I>409,411c430,507
&lt; //	XEvent event;
&lt; //	XIfEvent(dpy, &amp;event, WaitForNotify, (char *)this);
&lt; 
---
&gt;<i> #ifdef XF86VIDMODE
</I>&gt;<i>     if (!mode.Windowed)
</I>&gt;<i>     {
</I>&gt;<i>     
</I>&gt;<i>         // Set window to the right size, map it to the display, and raise it
</I>&gt;<i>         // to the front
</I>&gt;<i>         XResizeWindow(dpy,win,mode.Width,mode.Height);
</I>&gt;<i>         XMapRaised(dpy,win);
</I>&gt;<i>         XRaiseWindow(dpy, win);
</I>&gt;<i> 
</I>&gt;<i>         // grab the mouse and keyboard on the fullscreen window 
</I>&gt;<i>         if ((XGrabPointer(dpy, win, True, 0,
</I>&gt;<i>                           GrabModeAsync, GrabModeAsync,
</I>&gt;<i>                           win, None, CurrentTime) != GrabSuccess) ||
</I>&gt;<i>             (XGrabKeyboard(dpy, win, True,
</I>&gt;<i>                           GrabModeAsync, GrabModeAsync, CurrentTime) != 0) )
</I>&gt;<i>         {
</I>&gt;<i>             // Until I work out how to deal with this nicely, it just gives
</I>&gt;<i>             // an error and exits the prorgam.
</I>&gt;<i>             nlerror(&quot;Unable to grab keyboard and mouse\n&quot;);
</I>&gt;<i>         }
</I>&gt;<i>         else
</I>&gt;<i>         {
</I>&gt;<i>             // Save the old screen mode and dotclock
</I>&gt;<i>             memset(&amp;_OldScreenMode, 0, sizeof(_OldScreenMode));
</I>&gt;<i>             XF86VidModeGetModeLine(dpy, 
</I>&gt;<i>                                    DefaultScreen(dpy),
</I>&gt;<i>                                    &amp;_OldDotClock,
</I>&gt;<i>                                    &amp;_OldScreenMode);
</I>&gt;<i>             // Save the old viewport
</I>&gt;<i>             XF86VidModeGetViewPort(dpy, 
</I>&gt;<i>                                    DefaultScreen(dpy),
</I>&gt;<i>                                    &amp;_OldX,
</I>&gt;<i>                                    &amp;_OldY);
</I>&gt;<i>     
</I>&gt;<i>             // get a list of modes, search for an appropriate one.
</I>&gt;<i>             XF86VidModeModeInfo **modes;
</I>&gt;<i>             int nmodes;
</I>&gt;<i>             if (XF86VidModeGetAllModeLines(dpy,
</I>&gt;<i>                                            DefaultScreen(dpy),
</I>&gt;<i>                                            &amp;nmodes,&amp;modes))
</I>&gt;<i>             {
</I>&gt;<i>                 int mode_index = -1; // Gah, magic numbers all bad. 
</I>&gt;<i>                 for (int i = 0; i &lt; nmodes; i++)
</I>&gt;<i>                 {
</I>&gt;<i>                     nldebug(&quot;Available mode - %dx%d\n&quot;,mode.Width,mode.Height);
</I>&gt;<i>                     if( (modes[i]-&gt;hdisplay == mode.Width) &amp;&amp;
</I>&gt;<i>                         (modes[i]-&gt;vdisplay == mode.Height))
</I>&gt;<i>                     {
</I>&gt;<i>                         mode_index = i;
</I>&gt;<i>                     }
</I>&gt;<i>                 }
</I>&gt;<i>                 // Switch to the mode
</I>&gt;<i>                 if (mode_index != -1)
</I>&gt;<i>                 {
</I>&gt;<i>                     if(XF86VidModeSwitchToMode(dpy,
</I>&gt;<i>                                                DefaultScreen(dpy), 
</I>&gt;<i>                                                modes[mode_index]))
</I>&gt;<i>                     {
</I>&gt;<i>                         nlinfo(&quot;Switching to mode %dx%d,\n&quot;,mode.Width, 
</I>&gt;<i>                                                             mode.Height);
</I>&gt;<i>                         XF86VidModeSetViewPort(dpy,DefaultScreen(dpy),0, 0);
</I>&gt;<i>                         _FullScreen = true;
</I>&gt;<i>                     }
</I>&gt;<i>                 }
</I>&gt;<i>                 else
</I>&gt;<i>                 {
</I>&gt;<i>                     // This is a problem, since we've nuked the border from 
</I>&gt;<i>                     // window in the setup stage, until I work out how
</I>&gt;<i>                     // to get it back (recreate window? seems excessive)
</I>&gt;<i>                     nlerror(&quot;Couldn't find an appropriate mode %dx%d\n&quot;,
</I>&gt;<i>                                                                 mode.Width,
</I>&gt;<i>                                                                 mode.Height);
</I>&gt;<i>                 }
</I>&gt;<i>             }
</I>&gt;<i>         }
</I>&gt;<i>     }
</I>&gt;<i> #endif // XF86VIDMODE
</I>659c755,776
&lt; #endif // NL_OS_WINDOWS
---
&gt;<i> #elif defined (NL_OS_UNIX)// NL_OS_WINDOWS
</I>&gt;<i> 
</I>&gt;<i> #ifdef XF86VIDMODE
</I>&gt;<i>     if(_FullScreen)
</I>&gt;<i>     {
</I>&gt;<i>         XF86VidModeModeInfo info;
</I>&gt;<i>         nlinfo(&quot;Switching back to original mode \n&quot;);
</I>&gt;<i> 
</I>&gt;<i>         // This is a bit ugly - a quick hack to copy the ModeLine structure 
</I>&gt;<i>         // into the modeInfo structure.
</I>&gt;<i>         memcpy((XF86VidModeModeLine *)((char *)&amp;info + sizeof(info.dotclock)), &amp;_OldScreenMode, sizeof(XF86VidModeModeLine));
</I>&gt;<i>         info.dotclock = _OldDotClock;
</I>&gt;<i> 
</I>&gt;<i>         nlinfo(&quot;Mode is %dx%d,\n&quot;,info.hdisplay,info.vdisplay);
</I>&gt;<i>         XF86VidModeSwitchToMode(dpy,DefaultScreen(dpy),&amp;info);
</I>&gt;<i>         nlinfo(&quot;Switching viewporr to %d,%d,\n&quot;,_OldX, _OldY);
</I>&gt;<i>         XF86VidModeSetViewPort(dpy,DefaultScreen(dpy),_OldX,_OldY);
</I>&gt;<i>         // Ungrab the keyboard (probably not necessary);
</I>&gt;<i>         XUngrabKeyboard(dpy, CurrentTime);
</I>&gt;<i>     }
</I>&gt;<i> #endif // XF86VIDMODE
</I>&gt;<i> #endif // NL_OS_UNIX
</I>
--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=&quot;diff.driver_opengl.h&quot;

Index: driver_opengl.h
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl.h,v
retrieving revision 1.50
diff -r1.50 driver_opengl.h
40a41
&gt;<i> #include &lt;X11/extensions/xf86vmode.h&gt;
</I>219a221
&gt;<i> 	bool						_FullScreen;
</I>230d231
&lt; 	bool						_FullScreen;
238a240,244
&gt;<i> //#ifdef XF86VIDMODE
</I>&gt;<i>     int                         _OldDotClock;   // old dotclock
</I>&gt;<i>     XF86VidModeModeLine         _OldScreenMode; // old modeline
</I>&gt;<i>     int                         _OldX, _OldY;   //Viewport settings
</I>&gt;<i> //#endif //XF86VIDMODE
</I>240d245
&lt; 

--vkogqOf2sHV7VnPd--

</pre>













<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="000302.html">[Nel] Re: Nel digest, Vol 1 #64 - 21 msgs</A></li>
	<LI> Next message: <A HREF="000296.html">[Nel] Linux fullscreen patches</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#293">[ date ]</a>
              <a href="thread.html#293">[ thread ]</a>
              <a href="subject.html#293">[ subject ]</a>
              <a href="author.html#293">[ author ]</a>
         </LI>
       </UL>
</body></html>