Changeset 57

Show
Ignore:
Timestamp:
10/03/07 14:24:27 (1 year ago)
Author:
baxissimo
Message:

Steal gui focus on mousedown that that GUI doesn't handle.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/luigi/examples/example1_sdl.d

    r42 r57  
    451451                continue; 
    452452            } 
     453 
    453454            switch(event.type) { 
    454455            case SDL_VIDEORESIZE: 
    455                 screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 16, 
    456                                           SDL_OPENGL|SDL_RESIZABLE); 
    457                 if ( screen ) { 
    458                     reshape(screen.w, screen.h); 
    459                 } else { 
    460                     /* Uh oh, we couldn't set the new video mode?? */; 
    461                 } 
     456                screen.w = event.resize.w; 
     457                screen.h = event.resize.h; 
     458                reshape(screen.w,screen.h); 
    462459                break; 
    463460 
     
    467464 
    468465            case SDL_KEYDOWN: 
    469                 if (event.key.keysym.sym == SDLK_ESCAPE) { 
    470                     done = 1; 
     466                with (event.key) { 
     467                    if (keysym.sym == SDLK_ESCAPE || 
     468                        (keysym.sym == SDLK_q && (keysym.mod & KMOD_CTRL))) 
     469                    { 
     470                        done = 1; 
     471                    } 
    471472                } 
     473                break; 
     474 
     475            case SDL_MOUSEBUTTONDOWN: 
     476                // Click on the non-gui area -- steal focus from gui. 
     477                gui.set_focus(null); 
    472478                break; 
    473479 
     
    478484        } 
    479485 
    480         if (!gui.get_focus())  
     486        if (!gui.get_focus()) 
    481487        { 
    482488            Uint8 *keys = SDL_GetKeyState(null);