comparison Gui/wm/ws.c @ 6089:39c2bfe5c267

small fixes
author pontscho
date Tue, 14 May 2002 11:41:02 +0000
parents 7570f4666c15
children b9651eb9749e
comparison
equal deleted inserted replaced
6088:99d7f3e033ae 6089:39c2bfe5c267
154 XEvent xev; 154 XEvent xev;
155 int c = 0; 155 int c = 0;
156 int wm = wsWMUnknown; 156 int wm = wsWMUnknown;
157 157
158 // --- gnome 158 // --- gnome
159 /*
159 type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); 160 type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False );
160 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) 161 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 )
161 { 162 {
162 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is Gnome\n" ); 163 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is Gnome\n" );
163 XFree( args ); 164 XFree( args );
164 return wsWMGnome; 165 return wsWMGnome;
165 } 166 }
166 167 */
167 // --- net wm 168 // --- net wm
168 type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); 169 type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False );
169 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) 170 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( long ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 )
170 { 171 {
171 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is NetWM\n" ); 172 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is NetWM\n" );
196 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); wm=wsWMWMaker; break; } 197 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); wm=wsWMWMaker; break; }
197 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); 198 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom );
198 XFree( name ); 199 XFree( name );
199 } 200 }
200 } while( c++ < 25 ); 201 } while( c++ < 25 );
202 XUnmapWindow( wsDisplay,win );
201 XDestroyWindow( wsDisplay,win ); 203 XDestroyWindow( wsDisplay,win );
202 #ifdef MP_DEBUG 204 #ifdef MP_DEBUG
203 if ( wm == wsWMUnknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Unknown wm type...\n" ); 205 if ( wm == wsWMUnknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Unknown wm type...\n" );
204 #endif 206 #endif
205 return wsWMUnknown; 207 return wsWMUnknown;
206 } 208 }
209
210 extern int vo_wm_type;
207 211
208 void wsXInit( void* mDisplay ) 212 void wsXInit( void* mDisplay )
209 { 213 {
210 int eventbase; 214 int eventbase;
211 int errorbase; 215 int errorbase;
254 wsScreen=DefaultScreen( wsDisplay ); 258 wsScreen=DefaultScreen( wsDisplay );
255 wsRootWin=RootWindow( wsDisplay,wsScreen ); 259 wsRootWin=RootWindow( wsDisplay,wsScreen );
256 wsMaxX=DisplayWidth( wsDisplay,wsScreen ); 260 wsMaxX=DisplayWidth( wsDisplay,wsScreen );
257 wsMaxY=DisplayHeight( wsDisplay,wsScreen ); 261 wsMaxY=DisplayHeight( wsDisplay,wsScreen );
258 262
259 wsWMType=wsWindowManagerType(); 263 if ( vo_wm_type != -1 ) wsWMType=vo_wm_type;
264 else wsWMType=wsWindowManagerType();
260 265
261 wsGetDepthOnScreen(); 266 wsGetDepthOnScreen();
262 #ifdef DEBUG 267 #ifdef DEBUG
263 { 268 {
264 int minor,major,shp; 269 int minor,major,shp;
531 return -1; 536 return -1;
532 } 537 }
533 538
534 Bool wsEvents( Display * display,XEvent * Event,XPointer arg ) 539 Bool wsEvents( Display * display,XEvent * Event,XPointer arg )
535 { 540 {
536 KeySym keySym;
537 unsigned long i = 0; 541 unsigned long i = 0;
538 int l; 542 int l;
539 int x,y; 543 int x,y;
540 Window child_window = 0; 544 Window child_window = 0;
541 545
611 if ( Event->xkey.state & Mod1Mask ) wsWindowList[l]->Alt=1; 615 if ( Event->xkey.state & Mod1Mask ) wsWindowList[l]->Alt=1;
612 if ( Event->xkey.state & Mod2Mask ) wsWindowList[l]->NumLock=1; 616 if ( Event->xkey.state & Mod2Mask ) wsWindowList[l]->NumLock=1;
613 if ( Event->xkey.state & ControlMask ) wsWindowList[l]->Control=1; 617 if ( Event->xkey.state & ControlMask ) wsWindowList[l]->Control=1;
614 if ( Event->xkey.state & ShiftMask ) wsWindowList[l]->Shift=1; 618 if ( Event->xkey.state & ShiftMask ) wsWindowList[l]->Shift=1;
615 if ( Event->xkey.state & LockMask ) wsWindowList[l]->CapsLock=1; 619 if ( Event->xkey.state & LockMask ) wsWindowList[l]->CapsLock=1;
620 #if 0
616 keySym=XKeycodeToKeysym( wsDisplay,Event->xkey.keycode,0 ); 621 keySym=XKeycodeToKeysym( wsDisplay,Event->xkey.keycode,0 );
617 if ( keySym != NoSymbol ) 622 if ( keySym != NoSymbol )
618 { 623 {
619 keySym=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ); 624 keySym=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) );
620 wsKeyTable[ keySym ]=i; 625 wsKeyTable[ keySym ]=i;
621 if ( wsWindowList[l]->KeyHandler ) 626 if ( wsWindowList[l]->KeyHandler )
622 wsWindowList[l]->KeyHandler( Event->xkey.state,i,keySym ); 627 wsWindowList[l]->KeyHandler( Event->xkey.state,i,keySym );
623 } 628 }
629 #else
630 {
631 int key;
632 char buf[100];
633 KeySym keySym;
634 static XComposeStatus stat;
635
636 XLookupString( &Event->xkey,buf,sizeof(buf),&keySym,&stat );
637 key=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) );
638 wsKeyTable[ key ]=i;
639 if ( wsWindowList[l]->KeyHandler ) wsWindowList[l]->KeyHandler( Event->xkey.state,i,key );
640 }
641 #endif
624 break; 642 break;
625 643
626 case MotionNotify: i=wsMoveMouse; goto buttonreleased; 644 case MotionNotify: i=wsMoveMouse; goto buttonreleased;
627 case ButtonRelease: i=Event->xbutton.button + 128; goto buttonreleased; 645 case ButtonRelease: i=Event->xbutton.button + 128; goto buttonreleased;
628 case ButtonPress: i=Event->xbutton.button; goto buttonreleased; 646 case ButtonPress: i=Event->xbutton.button; goto buttonreleased;