src/video/SDL_video.c
changeset 5403 424f036f7c68
parent 5398 83816c8a2b58
child 5404 6717e01acbe0
equal deleted inserted replaced
5402:5d102cd8aef3 5403:424f036f7c68
   106         SDL_SetError("displayIndex must be in the range 0 - %d", \
   106         SDL_SetError("displayIndex must be in the range 0 - %d", \
   107                      _this->num_displays - 1); \
   107                      _this->num_displays - 1); \
   108         return retval; \
   108         return retval; \
   109     }
   109     }
   110 
   110 
   111 /* Various local functions */
       
   112 static void SDL_UpdateWindowGrab(SDL_Window * window);
       
   113 
       
   114 /* Support for framebuffer emulation using an accelerated renderer */
   111 /* Support for framebuffer emulation using an accelerated renderer */
   115 
   112 
   116 #define SDL_WINDOWTEXTUREDATA   "_SDL_WindowTextureData"
   113 #define SDL_WINDOWTEXTUREDATA   "_SDL_WindowTextureData"
   117 
   114 
   118 typedef struct {
   115 typedef struct {
  1670     }
  1667     }
  1671 
  1668 
  1672     return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
  1669     return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
  1673 }
  1670 }
  1674 
  1671 
  1675 void
  1672 static void
  1676 SDL_SetWindowGrab(SDL_Window * window, int mode)
  1673 SDL_UpdateWindowGrab(SDL_Window * window)
       
  1674 {
       
  1675     if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
       
  1676         _this->SetWindowGrab(_this, window);
       
  1677     }
       
  1678 }
       
  1679 
       
  1680 void
       
  1681 SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed)
  1677 {
  1682 {
  1678     CHECK_WINDOW_MAGIC(window, );
  1683     CHECK_WINDOW_MAGIC(window, );
  1679 
  1684 
  1680     if ((!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
  1685     if ((!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
  1681         return;
  1686         return;
  1682     }
  1687     }
  1683     if (mode) {
  1688     if (grabbed) {
  1684         window->flags |= SDL_WINDOW_INPUT_GRABBED;
  1689         window->flags |= SDL_WINDOW_INPUT_GRABBED;
  1685     } else {
  1690     } else {
  1686         window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
  1691         window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
  1687     }
  1692     }
  1688     SDL_UpdateWindowGrab(window);
  1693     SDL_UpdateWindowGrab(window);
  1689 }
  1694 }
  1690 
  1695 
  1691 static void
  1696 SDL_bool
  1692 SDL_UpdateWindowGrab(SDL_Window * window)
       
  1693 {
       
  1694     if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
       
  1695         _this->SetWindowGrab(_this, window);
       
  1696     }
       
  1697 }
       
  1698 
       
  1699 int
       
  1700 SDL_GetWindowGrab(SDL_Window * window)
  1697 SDL_GetWindowGrab(SDL_Window * window)
  1701 {
  1698 {
  1702     CHECK_WINDOW_MAGIC(window, 0);
  1699     CHECK_WINDOW_MAGIC(window, 0);
  1703 
  1700 
  1704     return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
  1701     return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);