Advertisement
chocolateimage

wine_dont_unmap_windows.patch

Dec 25th, 2023
1,219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 10.94 KB | Source Code | 0 0
  1. diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
  2. index 69dd8caba5d..24a9b266130 100644
  3. --- a/dlls/win32u/window.c
  4. +++ b/dlls/win32u/window.c
  5. @@ -1775,6 +1775,7 @@ done:
  6.  static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  7.                                const RECT *window_rect, const RECT *client_rect, const RECT *valid_rects )
  8.  {
  9. +    printf("apply_window_pos %d %d\n",window_rect->left,window_rect->top);
  10.      WND *win;
  11.      HWND surface_win = 0, parent = NtUserGetAncestor( hwnd, GA_PARENT );
  12.      BOOL ret, needs_update = FALSE;
  13. @@ -1795,6 +1796,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  14.          {
  15.              visible_rect = get_virtual_screen_rect( get_thread_dpi() );
  16.              intersect_rect( &visible_rect, &visible_rect, window_rect );
  17. +            printf("something aaa\n");
  18.          }
  19.      }
  20.  
  21. @@ -1803,6 +1805,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  22.  
  23.      if (!(win = get_win_ptr( hwnd )) || win == WND_DESKTOP || win == WND_OTHER_PROCESS)
  24.      {
  25. +        printf("window_surface_release\n");
  26.          if (new_surface) window_surface_release( new_surface );
  27.          return FALSE;
  28.      }
  29. @@ -1812,6 +1815,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  30.          (!(get_window_long( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) ||
  31.             NtUserGetLayeredWindowAttributes( hwnd, NULL, NULL, NULL )))
  32.      {
  33. +        printf("test\n");
  34.          window_surface_release( new_surface );
  35.          if ((new_surface = win->surface)) window_surface_add_ref( new_surface );
  36.          create_offscreen_window_surface( &visible_rect, &new_surface );
  37. @@ -1827,7 +1831,12 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  38.          swp_flags |= SWP_NOCOPYBITS;
  39.          valid_rects = NULL;
  40.      }
  41. -
  42. +    /*if (EqualRect( window_rect, &visible_rect ) ) {
  43. +        printf("equal rect");
  44. +    } else {
  45. +        printf("not equal rect");
  46. +    }
  47. +    printf("\n");*/
  48.      SERVER_START_REQ( set_window_pos )
  49.      {
  50.          req->handle        = wine_server_user_handle( hwnd );
  51. @@ -1875,20 +1884,20 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  52.                  mirror_rect( &client, &win->client_rect );
  53.                  mirror_rect( &client, &win->visible_rect );
  54.              }
  55. -            /* if an RTL window is resized the children have moved */
  56. +            // if an RTL window is resized the children have moved
  57.              if (win->dwExStyle & WS_EX_LAYOUTRTL &&
  58.                  client_rect->right - client_rect->left != old_client_rect.right - old_client_rect.left)
  59.                  win->flags |= WIN_CHILDREN_MOVED;
  60.          }
  61.      }
  62.      SERVER_END_REQ;
  63. -
  64.      if (ret)
  65.      {
  66.          if (needs_update) update_surface_region( surface_win );
  67.          if (((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) ||
  68. -            (swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED | SWP_FRAMECHANGED)))
  69. +            (swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED | SWP_FRAMECHANGED))) {
  70.              invalidate_dce( win, &old_window_rect );
  71. +            }
  72.      }
  73.  
  74.      release_win_ptr( win );
  75. @@ -1939,6 +1948,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
  76.      }
  77.      else if (new_surface) window_surface_release( new_surface );
  78.  
  79. +    //printf("end %d %d\n",ret,needs_update);
  80.      return ret;
  81.  }
  82.  
  83. @@ -2544,6 +2554,7 @@ static void make_point_onscreen( POINT *pt )
  84.  
  85.  static BOOL set_window_placement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT flags )
  86.  {
  87. +    printf("set window placement\n");
  88.      RECT work_rect = get_maximized_work_rect( hwnd );
  89.      WND *win = get_win_ptr( hwnd );
  90.      WINDOWPLACEMENT wp = *wndpl;
  91. @@ -3444,7 +3455,11 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y )
  92.  
  93.      calc_ncsize( winpos, &old_window_rect, &old_client_rect,
  94.                   &new_window_rect, &new_client_rect, valid_rects, parent_x, parent_y );
  95. -
  96. +    /*int addition = -100;
  97. +    new_window_rect.top += addition;
  98. +    new_client_rect.top += addition;
  99. +    new_window_rect.bottom += addition;
  100. +    new_client_rect.bottom += addition;*/
  101.      if (!apply_window_pos( winpos->hwnd, winpos->hwndInsertAfter, winpos->flags,
  102.                             &new_window_rect, &new_client_rect, valid_rects ))
  103.          goto done;
  104. @@ -4243,6 +4258,7 @@ void update_window_state( HWND hwnd )
  105.   */
  106.  static BOOL show_window( HWND hwnd, INT cmd )
  107.  {
  108. +    printf("SSSSSSSSSSSHOWING WINDOW!!!\n");
  109.      WND *win;
  110.      HWND parent;
  111.      DPI_AWARENESS_CONTEXT context;
  112. diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
  113. index 51125065958..5bc79ac9ab7 100644
  114. --- a/dlls/winex11.drv/window.c
  115. +++ b/dlls/winex11.drv/window.c
  116. @@ -1904,6 +1904,7 @@ static BOOL create_desktop_win_data( Window win, HWND hwnd )
  117.   */
  118.  void X11DRV_SetDesktopWindow( HWND hwnd )
  119.  {
  120. +    printf("set desktop window\n");
  121.      unsigned int width, height;
  122.  
  123.      /* retrieve the real size of the desktop */
  124. @@ -2514,8 +2515,7 @@ done:
  125.  static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect )
  126.  {
  127.      *surface_rect = NtUserGetVirtualScreenRect();
  128. -
  129. -    if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE;
  130. +    //if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE;
  131.      OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top );
  132.      surface_rect->left &= ~31;
  133.      surface_rect->top  &= ~31;
  134. @@ -2545,6 +2545,7 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
  135.      {
  136.          TRACE( "making win %p/%lx managed\n", hwnd, data->whole_window );
  137.          release_win_data( data );
  138. +        printf("X11DRV_WindowPosChanging: unmap the frickin window\n");
  139.          unmap_window( hwnd );
  140.          if (!(data = get_win_data( hwnd ))) return TRUE;
  141.          data->managed = TRUE;
  142. @@ -2554,7 +2555,6 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
  143.      X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect );
  144.  
  145.      /* create the window surface if necessary */
  146. -
  147.      if (!data->whole_window && !data->embedded) goto done;
  148.      if (swp_flags & SWP_HIDEWINDOW) goto done;
  149.      if (data->use_alpha) goto done;
  150. @@ -2570,6 +2570,7 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
  151.  
  152.      if (data->surface)
  153.      {
  154. +        //printf("surface_rect %d %d %d %d\n",surface_rect.left,surface_rect.top,surface_rect.right,surface_rect.bottom);
  155.          if (EqualRect( &data->surface->rect, &surface_rect ))
  156.          {
  157.              /* existing surface is good enough */
  158. @@ -2631,7 +2632,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
  159.          int x_offset = old_whole_rect.left - data->whole_rect.left;
  160.          int y_offset = old_whole_rect.top - data->whole_rect.top;
  161.  
  162. -        /* if all that happened is that the whole window moved, copy everything */
  163. +        // if all that happened is that the whole window moved, copy everything
  164.          if (!(swp_flags & SWP_FRAMECHANGED) &&
  165.              old_whole_rect.right   - data->whole_rect.right   == x_offset &&
  166.              old_whole_rect.bottom  - data->whole_rect.bottom  == y_offset &&
  167. @@ -2641,7 +2642,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
  168.              old_client_rect.bottom - data->client_rect.bottom == y_offset &&
  169.              EqualRect( &valid_rects[0], &data->client_rect ))
  170.          {
  171. -            /* if we have an X window the bits will be moved by the X server */
  172. +            // if we have an X window the bits will be moved by the X server
  173.              if (!window && (x_offset != 0 || y_offset != 0))
  174.              {
  175.                  release_win_data( data );
  176. @@ -2660,7 +2661,6 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
  177.      }
  178.  
  179.      XFlush( gdi_display );  /* make sure painting is done before we move the window */
  180. -
  181.      sync_client_position( data, &old_client_rect, &old_whole_rect );
  182.  
  183.      if (!data->whole_window)
  184. @@ -2694,6 +2694,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
  185.               !is_window_rect_mapped( rectWindow ) && is_window_rect_mapped( &old_window_rect )))
  186.          {
  187.              release_win_data( data );
  188. +            printf("X11DRV_WindowPosChanged: unmap the frickin window\n");
  189.              unmap_window( hwnd );
  190.              if (NtUserIsWindowRectFullScreen( &old_window_rect )) NtUserClipCursor( NULL );
  191.              if (!(data = get_win_data( hwnd ))) return;
  192. diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
  193. index c80e4b3d3c9..d5b2b243117 100644
  194. --- a/dlls/winex11.drv/x11drv.h
  195. +++ b/dlls/winex11.drv/x11drv.h
  196. @@ -830,6 +830,7 @@ extern void xim_set_focus( HWND hwnd, BOOL focus );
  197.  
  198.  static inline BOOL is_window_rect_mapped( const RECT *rect )
  199.  {
  200. +    return TRUE;
  201.      RECT virtual_rect = NtUserGetVirtualScreenRect();
  202.      return (rect->left < virtual_rect.right &&
  203.              rect->top < virtual_rect.bottom &&
  204. diff --git a/server/window.c b/server/window.c
  205. index 242e93f303a..468aa1d5f27 100644
  206. --- a/server/window.c
  207. +++ b/server/window.c
  208. @@ -1789,6 +1789,32 @@ static void set_window_pos( struct window *win, struct window *previous,
  209.                              const rectangle_t *client_rect, const rectangle_t *visible_rect,
  210.                              const rectangle_t *surface_rect, const rectangle_t *valid_rect )
  211.  {
  212. +    /*fprintf(stderr, "swp_flags %d",swp_flags);
  213. +    if (swp_flags & SWP_NOACTIVATE) {
  214. +        fprintf(stderr," noactivate");
  215. +    }
  216. +    if (swp_flags & SWP_FRAMECHANGED) {
  217. +        fprintf(stderr," framechanged");
  218. +    }
  219. +    if (swp_flags & SWP_NOSIZE) {
  220. +        fprintf(stderr," no_size");
  221. +    }
  222. +    if (swp_flags & SWP_NOMOVE) {
  223. +        fprintf(stderr," no_move");
  224. +    }
  225. +    if (swp_flags & SWP_NOREDRAW) {
  226. +        fprintf(stderr," no_redraw");
  227. +    }
  228. +    if (swp_flags & SWP_SHOWWINDOW) {
  229. +        fprintf(stderr," show_window");
  230. +    }
  231. +    if (swp_flags & SWP_HIDEWINDOW) {
  232. +        fprintf(stderr," hide_window");
  233. +    }
  234. +    if (swp_flags & SWP_DEFERERASE) {
  235. +        fprintf(stderr," SWP_DEFERERASE");
  236. +    }
  237. +    fprintf(stderr, "\n");*/
  238.      struct region *old_vis_rgn = NULL, *exposed_rgn = NULL;
  239.      const rectangle_t old_window_rect = win->window_rect;
  240.      const rectangle_t old_visible_rect = win->visible_rect;
  241. @@ -1797,9 +1823,7 @@ static void set_window_pos( struct window *win, struct window *previous,
  242.      int client_changed, frame_changed;
  243.      int visible = (win->style & WS_VISIBLE) || (swp_flags & SWP_SHOWWINDOW);
  244.      int zorder_changed = 0;
  245. -
  246.      if (win->parent && !is_visible( win->parent )) visible = 0;
  247. -
  248.      if (visible && !(old_vis_rgn = get_visible_region( win, DCX_WINDOW ))) return;
  249.  
  250.      /* set the new window info before invalidating anything */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement