Alexandre Julliard : winex11: Properly forget about a foreign window when it' s destroyed through DestroyWindow().
Alexandre Julliard
julliard at winehq.org
Tue Nov 16 12:45:44 CST 2010
Module: wine
Branch: master
Commit: 20bc10c354aa20fcf4c025da9df7ad827d5386fc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=20bc10c354aa20fcf4c025da9df7ad827d5386fc
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Nov 15 20:41:07 2010 +0100
winex11: Properly forget about a foreign window when it's destroyed through DestroyWindow().
---
dlls/winex11.drv/window.c | 29 ++++++++++++++++++++---------
dlls/winex11.drv/x11drv_main.c | 2 +-
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 446b71b..dee77bd 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -78,6 +78,7 @@ static XContext win_data_context;
static Time last_user_time;
static Window user_time_window;
+static const char foreign_window_prop[] = "__wine_x11_foreign_window";
static const char whole_window_prop[] = "__wine_x11_whole_window";
static const char client_window_prop[]= "__wine_x11_client_window";
static const char icon_window_prop[] = "__wine_x11_icon_window";
@@ -1753,7 +1754,23 @@ done:
*/
static void destroy_whole_window( Display *display, struct x11drv_win_data *data, BOOL already_destroyed )
{
- if (!data->whole_window) return;
+ if (!data->whole_window)
+ {
+ if (data->embedded)
+ {
+ Window xwin = (Window)GetPropA( data->hwnd, foreign_window_prop );
+ if (xwin)
+ {
+ wine_tsx11_lock();
+ if (!already_destroyed) XSelectInput( display, xwin, 0 );
+ XDeleteContext( display, xwin, winContext );
+ wine_tsx11_unlock();
+ RemovePropA( data->hwnd, foreign_window_prop );
+ }
+ }
+ return;
+ }
+
TRACE( "win %p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window );
wine_tsx11_lock();
@@ -1894,14 +1911,7 @@ void X11DRV_DestroyNotify( HWND hwnd, XEvent *event )
if (!(data = X11DRV_get_win_data( hwnd ))) return;
if (!data->embedded) FIXME( "window %p/%lx destroyed from the outside\n", hwnd, data->whole_window );
- if (!data->whole_window)
- {
- wine_tsx11_lock();
- XDeleteContext( display, event->xdestroywindow.window, winContext );
- wine_tsx11_unlock();
- }
- else destroy_whole_window( display, data, TRUE );
-
+ destroy_whole_window( display, data, TRUE );
if (data->embedded) SendMessageW( hwnd, WM_CLOSE, 0, 0 );
}
@@ -2153,6 +2163,7 @@ HWND create_foreign_window( Display *display, Window xwin )
data->embedded = TRUE;
data->mapped = TRUE;
+ SetPropA( hwnd, foreign_window_prop, (HANDLE)xwin );
wine_tsx11_lock();
XSaveContext( display, xwin, winContext, (char *)data->hwnd );
wine_tsx11_unlock();
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 0d1a7da..54f56b9 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -197,7 +197,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
*/
static inline BOOL ignore_error( Display *display, XErrorEvent *event )
{
- if (event->request_code == X_SetInputFocus &&
+ if ((event->request_code == X_SetInputFocus || event->request_code == X_ChangeWindowAttributes) &&
(event->error_code == BadMatch || event->error_code == BadWindow)) return TRUE;
/* ignore a number of errors on gdi display caused by creating/destroying windows */
More information about the wine-cvs
mailing list