Mercurial > mplayer.hg
comparison libvo/video_out.c @ 31:1fc618eba830
added check_events() interface
author | arpi_esp |
---|---|
date | Sat, 03 Mar 2001 21:46:39 +0000 |
parents | 7400af1c6d44 |
children | 46f3aa28aa83 |
comparison
equal
deleted
inserted
replaced
30:3af750fac6c1 | 31:1fc618eba830 |
---|---|
83 &video_out_pgm, | 83 &video_out_pgm, |
84 &video_out_md5, | 84 &video_out_md5, |
85 NULL | 85 NULL |
86 }; | 86 }; |
87 | 87 |
88 #ifdef X11_FULLSCREEN | |
89 | 88 |
90 #include <X11/Xlib.h> | |
91 #include <X11/Xutil.h> | |
92 #include <X11/Xatom.h> | |
93 | |
94 int vo_depthonscreen=0; | |
95 int vo_screenwidth=0; | |
96 int vo_screenheight=0; | |
97 | |
98 int vo_init( void ) | |
99 { | |
100 int CompletionType = -1; | |
101 int mScreen; | |
102 int bpp; | |
103 char * DisplayName = ":0.0"; | |
104 Display * mDisplay; | |
105 XImage * mXImage; | |
106 Window mRootWin; | |
107 static XWindowAttributes attribs; | |
108 | |
109 if(vo_depthonscreen) return 1; // already called | |
110 | |
111 if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); | |
112 mDisplay=XOpenDisplay( DisplayName ); | |
113 if ( !mDisplay ) | |
114 { | |
115 fprintf( stderr,"vo: couldn't open the X11 display!\n" ); | |
116 return 0; | |
117 } | |
118 mScreen=DefaultScreen( mDisplay ); // Screen ID. | |
119 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. | |
120 vo_screenwidth=DisplayWidth( mDisplay,mScreen ); | |
121 vo_screenheight=DisplayHeight( mDisplay,mScreen ); | |
122 // get color depth: | |
123 // XGetWindowAttributes(mydisplay, DefaultRootWindow(mDisplay), &attribs); | |
124 XGetWindowAttributes(mDisplay, mRootWin, &attribs); | |
125 vo_depthonscreen=attribs.depth; | |
126 // get bits/pixel: | |
127 mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap ); | |
128 bpp=mXImage->bits_per_pixel; | |
129 XDestroyImage( mXImage ); | |
130 if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi | |
131 XCloseDisplay( mDisplay ); | |
132 printf("X11 running at %dx%d depth: %d\n",vo_screenwidth,vo_screenheight,vo_depthonscreen); | |
133 return 1; | |
134 } | |
135 | |
136 #include "../linux/keycodes.h" | |
137 extern void mplayer_put_key(int code); | |
138 | |
139 void vo_keyboard( int key ) | |
140 { | |
141 switch ( key ) | |
142 { | |
143 case wsLeft: mplayer_put_key(KEY_LEFT); break; | |
144 case wsRight: mplayer_put_key(KEY_RIGHT); break; | |
145 case wsUp: mplayer_put_key(KEY_UP); break; | |
146 case wsDown: mplayer_put_key(KEY_DOWN); break; | |
147 case wsSpace: mplayer_put_key(' '); break; | |
148 case wsEscape: mplayer_put_key(KEY_ESC); break; | |
149 case wsEnter: mplayer_put_key(KEY_ENTER); break; | |
150 case wsq: | |
151 case wsQ: mplayer_put_key('q'); break; | |
152 case wsp: | |
153 case wsP: mplayer_put_key('p'); break; | |
154 case wsMinus: | |
155 case wsGrayMinus: mplayer_put_key('-'); break; | |
156 case wsPlus: | |
157 case wsGrayPlus: mplayer_put_key('+'); break; | |
158 } | |
159 } | |
160 | |
161 | |
162 // ----- Motif header: ------- | |
163 | |
164 #define MWM_HINTS_DECORATIONS 2 | |
165 | |
166 typedef struct | |
167 { | |
168 long flags; | |
169 long functions; | |
170 long decorations; | |
171 long input_mode; | |
172 } MotifWmHints; | |
173 | |
174 extern MotifWmHints vo_MotifWmHints; | |
175 extern Atom vo_MotifHints; | |
176 extern int vo_depthonscreen; | |
177 extern int vo_screenwidth; | |
178 extern int vo_screenheight; | |
179 | |
180 static MotifWmHints vo_MotifWmHints; | |
181 static Atom vo_MotifHints = None; | |
182 | |
183 void vo_decoration( Display * vo_Display,Window w,int d ) | |
184 { | |
185 vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 ); | |
186 if ( vo_MotifHints != None ) | |
187 { | |
188 vo_MotifWmHints.flags=2; | |
189 vo_MotifWmHints.decorations=d; | |
190 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, | |
191 PropModeReplace,(unsigned char *)&vo_MotifWmHints,4 ); | |
192 } | |
193 } | |
194 | |
195 #include <signal.h> | |
196 | |
197 int vo_eventhandler_pid=-1; | |
198 | |
199 void vo_kill_eventhandler(){ | |
200 if(vo_eventhandler_pid!=-1) kill(vo_eventhandler_pid,SIGTERM); | |
201 | |
202 } | |
203 | |
204 #endif | |
205 |