Commit 704d0353 authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed a few issues with tsx11 locking.

Always map the client window when moving out of iconic state.
parent ca4fa365
......@@ -95,7 +95,7 @@ inline static BOOL is_window_top_level( WND *win )
inline static BOOL is_client_window_mapped( WND *win )
{
struct x11drv_win_data *data = win->pDriverData;
return !IsIconic( win->hwndSelf ) && !IsRectEmpty( &data->client_rect );
return !(win->dwStyle & WS_MINIMIZE) && !IsRectEmpty( &data->client_rect );
}
......@@ -217,9 +217,11 @@ inline static void destroy_icon_window( Display *display, WND *win )
struct x11drv_win_data *data = win->pDriverData;
if (!data->icon_window) return;
wine_tsx11_lock();
XDeleteContext( display, data->icon_window, winContext );
XDestroyWindow( display, data->icon_window );
data->icon_window = 0;
wine_tsx11_unlock();
RemovePropA( win->hwndSelf, "__wine_x11_icon_window" );
}
......@@ -357,23 +359,6 @@ static void set_wm_hints( Display *display, WND *win )
}
else group_leader = data->whole_window;
/* wm hints */
if ((wm_hints = XAllocWMHints()))
{
wm_hints->flags = InputHint | StateHint | WindowGroupHint;
/* use globally active model if take focus is supported,
* passive model otherwise (cf. ICCCM) */
wm_hints->input = !wmTakeFocus;
set_icon_hints( display, win, wm_hints );
wm_hints->initial_state = (win->dwStyle & WS_MINIMIZE) ? IconicState : NormalState;
wm_hints->window_group = group_leader;
XSetWMHints( display, data->whole_window, wm_hints );
XFree(wm_hints);
}
/* size hints */
set_size_hints( display, win );
......@@ -390,6 +375,25 @@ static void set_wm_hints( Display *display, WND *win )
}
wine_tsx11_unlock();
/* wm hints */
if ((wm_hints = TSXAllocWMHints()))
{
wm_hints->flags = InputHint | StateHint | WindowGroupHint;
/* use globally active model if take focus is supported,
* passive model otherwise (cf. ICCCM) */
wm_hints->input = !wmTakeFocus;
set_icon_hints( display, win, wm_hints );
wm_hints->initial_state = (win->dwStyle & WS_MINIMIZE) ? IconicState : NormalState;
wm_hints->window_group = group_leader;
wine_tsx11_lock();
XSetWMHints( display, data->whole_window, wm_hints );
XFree(wm_hints);
wine_tsx11_unlock();
}
}
......@@ -405,14 +409,11 @@ void X11DRV_set_iconic_state( WND *win )
XWMHints* wm_hints;
BOOL iconic = IsIconic( win->hwndSelf );
if (!(win->dwExStyle & WS_EX_MANAGED))
{
if (iconic) TSXUnmapWindow( display, data->client_window );
else if (is_client_window_mapped( win )) TSXMapWindow( display, data->client_window );
}
wine_tsx11_lock();
if (iconic) XUnmapWindow( display, data->client_window );
else if (is_client_window_mapped( win )) XMapWindow( display, data->client_window );
if (!(wm_hints = XGetWMHints( display, data->whole_window ))) wm_hints = XAllocWMHints();
wm_hints->flags |= StateHint | IconPositionHint;
wm_hints->initial_state = iconic ? IconicState : NormalState;
......@@ -686,7 +687,11 @@ static Window create_whole_window( Display *display, WND *win )
mask, &attr );
if (attr.cursor) XFreeCursor( display, attr.cursor );
if (!data->whole_window) goto done;
if (!data->whole_window)
{
wine_tsx11_unlock();
return 0;
}
/* non-maximized child must be at bottom of Z order */
if ((win->dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
......@@ -696,10 +701,10 @@ static Window create_whole_window( Display *display, WND *win )
XConfigureWindow( display, data->whole_window, CWStackMode, &changes );
}
wine_tsx11_unlock();
if (is_top_level) set_wm_hints( display, win );
done:
wine_tsx11_unlock();
return data->whole_window;
}
......@@ -1066,9 +1071,9 @@ HWND X11DRV_SetParent( HWND hwnd, HWND parent )
}
}
if (is_window_top_level( wndPtr )) set_wm_hints( display, wndPtr );
wine_tsx11_lock();
sync_window_style( display, wndPtr );
if (is_window_top_level( wndPtr )) set_wm_hints( display, wndPtr );
XReparentWindow( display, data->whole_window, get_client_window(pWndParent),
data->whole_rect.left, data->whole_rect.top );
wine_tsx11_unlock();
......
......@@ -1279,6 +1279,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
if (!fStretch) switch(rop) /* A few optimisations */
{
case BLACKNESS: /* 0x00 */
wine_tsx11_lock();
if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel)
XSetFunction( gdi_display, physDevDst->gc, GXclear );
else
......@@ -1289,12 +1290,14 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
}
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
wine_tsx11_unlock();
return TRUE;
case DSTINVERT: /* 0x55 */
if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel ||
!perfect_graphics())
{
wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXinvert );
if( X11DRV_PALETTE_PaletteFlags & (X11DRV_PALETTE_PRIVATE | X11DRV_PALETTE_VIRTUAL) )
......@@ -1312,6 +1315,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
}
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
wine_tsx11_unlock();
return TRUE;
}
break;
......@@ -1320,9 +1324,11 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
if (perfect_graphics()) break;
if (X11DRV_SetupGCForBrush( dcDst ))
{
wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXxor );
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
wine_tsx11_unlock();
}
return TRUE;
......@@ -1330,25 +1336,30 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
if (perfect_graphics()) break;
if (X11DRV_SetupGCForBrush( dcDst ))
{
wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXequiv );
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
wine_tsx11_unlock();
}
return TRUE;
case SRCCOPY: /* 0xcc */
if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)
{
wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXcopy );
XCopyArea( gdi_display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top );
physDevDst->exposures++;
wine_tsx11_unlock();
return TRUE;
}
if (dcSrc->bitsPerPixel == 1)
{
wine_tsx11_lock();
XSetBackground( gdi_display, physDevDst->gc, physDevDst->textPixel );
XSetForeground( gdi_display, physDevDst->gc, physDevDst->backgroundPixel );
XSetFunction( gdi_display, physDevDst->gc, GXcopy );
......@@ -1357,18 +1368,22 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top, 1 );
physDevDst->exposures++;
wine_tsx11_unlock();
return TRUE;
}
break;
case PATCOPY: /* 0xf0 */
if (!X11DRV_SetupGCForBrush( dcDst )) return TRUE;
wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXcopy );
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
wine_tsx11_unlock();
return TRUE;
case WHITENESS: /* 0xff */
wine_tsx11_lock();
if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel)
XSetFunction( gdi_display, physDevDst->gc, GXset );
else
......@@ -1380,9 +1395,12 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
}
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
wine_tsx11_unlock();
return TRUE;
}
wine_tsx11_lock();
tmpGC = XCreateGC( gdi_display, physDevDst->drawable, 0, NULL );
XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors );
XSetGraphicsExposures( gdi_display, tmpGC, False );
......@@ -1401,6 +1419,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
BITBLT_GetSrcArea( dcSrc, dcDst, pixmaps[SRC], tmpGC,
xSrc, ySrc, &visRectSrc );
}
if (useDst) BITBLT_GetDstArea( dcDst, pixmaps[DST], tmpGC, &visRectDst );
if (usePat) fNullBrush = !X11DRV_SetupGCForPatBlt( dcDst, tmpGC, TRUE );
else fNullBrush = FALSE;
......@@ -1449,6 +1468,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
if (pixmaps[SRC]) XFreePixmap( gdi_display, pixmaps[SRC] );
if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] );
XFreeGC( gdi_display, tmpGC );
wine_tsx11_unlock();
return TRUE;
}
......@@ -1462,9 +1482,7 @@ BOOL X11DRV_PatBlt( DC *dc, INT left, INT top,
BOOL result;
X11DRV_LockDIBSection( dc, DIB_Status_GdiMod, FALSE );
wine_tsx11_lock();
result = BITBLT_InternalStretchBlt( dc, left, top, width, height, NULL, 0, 0, 0, 0, rop );
wine_tsx11_unlock();
X11DRV_UnlockDIBSection( dc, TRUE );
return result;
}
......@@ -1525,10 +1543,8 @@ BOOL X11DRV_BitBlt( DC *dcDst, INT xDst, INT yDst,
X11DRV_CoerceDIBSection( dcDst, DIB_Status_GdiMod, FALSE );
X11DRV_CoerceDIBSection( dcSrc, DIB_Status_GdiMod, FALSE );
wine_tsx11_lock();
result = BITBLT_InternalStretchBlt( dcDst, xDst, yDst, width, height,
dcSrc, xSrc, ySrc, width, height, rop );
wine_tsx11_unlock();
END:
X11DRV_UnlockDIBSection( dcSrc, FALSE );
......@@ -1551,10 +1567,8 @@ BOOL X11DRV_StretchBlt( DC *dcDst, INT xDst, INT yDst,
X11DRV_LockDIBSection( dcDst, DIB_Status_GdiMod, FALSE );
X11DRV_LockDIBSection( dcSrc, DIB_Status_GdiMod, FALSE );
wine_tsx11_lock();
result = BITBLT_InternalStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop );
wine_tsx11_unlock();
X11DRV_UnlockDIBSection( dcSrc, FALSE );
X11DRV_UnlockDIBSection( dcDst, TRUE );
......
......@@ -1254,13 +1254,13 @@ X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color,
rect.bottom - rect.top,
AllPlanes, ZPixmap ))) return FALSE;
wine_tsx11_lock();
if (X11DRV_SetupGCForBrush( dc ))
{
/* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE);
/* ROP mode is always GXcopy for flood-fill */
wine_tsx11_lock();
XSetFunction( gdi_display, physDev->gc, GXcopy );
X11DRV_InternalFloodFill(image, dc,
XLPTODP(dc,x) + dc->DCOrgX - rect.left,
......@@ -1268,12 +1268,12 @@ X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color,
rect.left, rect.top,
X11DRV_PALETTE_ToPhysical( dc, color ),
fillType );
wine_tsx11_unlock();
/* Update the DIBSection of the dc's bitmap */
X11DRV_UnlockDIBSection(dc, TRUE);
}
XDestroyImage( image );
wine_tsx11_unlock();
TSXDestroyImage( image );
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment