comparison libvo/x11_common.c @ 723:c3e0bdb64027

add gui support
author pontscho
date Tue, 08 May 2001 12:17:03 +0000
parents 0bdfd4dc95f2
children 00f97e760cbc
comparison
equal deleted inserted replaced
722:b570318ac2f4 723:c3e0bdb64027
147 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, 147 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32,
148 PropModeReplace,(unsigned char *)&vo_MotifWmHints,4 ); 148 PropModeReplace,(unsigned char *)&vo_MotifWmHints,4 );
149 } 149 }
150 } 150 }
151 151
152 #ifdef HAVE_GUI
153 Window vo_window = None;
154 GC vo_gc;
155 int vo_xeventhandling = 1;
156 int vo_resize = 0;
157 int vo_expose = 0;
158
159 void vo_setwindow( Window w,GC g )
160 { vo_window=w; vo_gc=g; }
161 #endif
162
152 int vo_x11_check_events(Display *mydisplay){ 163 int vo_x11_check_events(Display *mydisplay){
153 int ret=0; 164 int ret=0;
154 XEvent Event; 165 XEvent Event;
155 char buf[100]; 166 char buf[100];
156 KeySym keySym; 167 KeySym keySym;
157 XComposeStatus stat; 168 XComposeStatus stat;
158 // unsigned long vo_KeyTable[512]; 169 // unsigned long vo_KeyTable[512];
159 170
160 while ( XPending( mydisplay ) ) 171 #ifdef HAVE_GUI
161 { 172 if ( vo_xeventhandling )
162 XNextEvent( mydisplay,&Event ); 173 {
163 switch( Event.type ) 174 #endif
164 { 175 while ( XPending( mydisplay ) )
165 case Expose: 176 {
166 ret|=VO_EVENT_EXPOSE; 177 XNextEvent( mydisplay,&Event );
167 break; 178 switch( Event.type )
168 case ConfigureNotify: 179 {
169 vo_dwidth=Event.xconfigure.width; 180 case Expose:
170 vo_dheight=Event.xconfigure.height; 181 ret|=VO_EVENT_EXPOSE;
171 ret|=VO_EVENT_RESIZE; 182 break;
172 break; 183 case ConfigureNotify:
173 case KeyPress: 184 vo_dwidth=Event.xconfigure.width;
174 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat ); 185 vo_dheight=Event.xconfigure.height;
175 vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) ); 186 ret|=VO_EVENT_RESIZE;
176 ret|=VO_EVENT_KEYPRESS; 187 break;
177 break; 188 case KeyPress:
178 } 189 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
179 } 190 vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
191 ret|=VO_EVENT_KEYPRESS;
192 break;
193 }
194 }
195 #ifdef HAVE_GUI
196 }
197 else
198 {
199 if ( vo_resize )
200 {
201 vo_resize=0;
202 ret|=VO_EVENT_RESIZE;
203 }
204 if ( vo_expose )
205 {
206 vo_expose=0;
207 ret|=VO_EVENT_EXPOSE;
208 }
209 }
210 #endif
180 211
181 return ret; 212 return ret;
182 } 213 }
183 214
184 void saver_on(Display *mDisplay) { 215 void saver_on(Display *mDisplay) {