Alexandre Julliard : winex11: Ignore X11 errors happening on the clipboard display connection.
Alexandre Julliard
julliard at winehq.org
Mon Sep 26 09:29:59 CDT 2016
Module: wine
Branch: master
Commit: 4bbe8f90d47e9a9fffc7e471cd27fa7768636e53
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4bbe8f90d47e9a9fffc7e471cd27fa7768636e53
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Sep 26 21:06:14 2016 +0900
winex11: Ignore X11 errors happening on the clipboard display connection.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winex11.drv/clipboard.c | 17 +++++------------
dlls/winex11.drv/x11drv.h | 1 +
dlls/winex11.drv/x11drv_main.c | 3 +++
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index 1b4817f..d0d301b 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -203,6 +203,8 @@ static ULONG64 last_clipboard_update;
static struct clipboard_format **current_x11_formats;
static unsigned int nb_current_x11_formats;
+Display *clipboard_display = NULL;
+
static const char *debugstr_format( UINT id )
{
WCHAR buffer[256];
@@ -259,11 +261,6 @@ static int is_atom_error( Display *display, XErrorEvent *event, void *arg )
return (event->error_code == BadAtom);
}
-static int is_window_error( Display *display, XErrorEvent *event, void *arg )
-{
- return (event->error_code == BadWindow);
-}
-
/**************************************************************************
* find_win32_format
@@ -2007,12 +2004,12 @@ static DWORD WINAPI clipboard_thread( void *arg )
XSetWindowAttributes attr;
WNDCLASSW class;
MSG msg;
- Display *display = thread_init_display();
if (!wait_clipboard_mutex()) return 0;
+ clipboard_display = thread_init_display();
attr.event_mask = PropertyChangeMask;
- import_window = XCreateWindow( display, root_window, 0, 0, 1, 1, 0, CopyFromParent,
+ import_window = XCreateWindow( clipboard_display, root_window, 0, 0, 1, 1, 0, CopyFromParent,
InputOutput, CopyFromParent, CWEventMask, &attr );
if (!import_window)
{
@@ -2039,7 +2036,7 @@ static DWORD WINAPI clipboard_thread( void *arg )
clipboard_thread_id = GetCurrentThreadId();
AddClipboardFormatListener( clipboard_hwnd );
register_builtin_formats();
- grab_win32_clipboard( display );
+ grab_win32_clipboard( clipboard_display );
TRACE( "clipboard thread %04x running\n", GetCurrentThreadId() );
while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg );
@@ -2075,8 +2072,6 @@ BOOL X11DRV_SelectionRequest( HWND hwnd, XEvent *xev )
XEvent result;
Atom rprop = None;
- X11DRV_expect_error( display, is_window_error, NULL );
-
TRACE( "got request on %lx for selection %s target %s win %lx prop %s\n",
event->owner, debugstr_xatom( event->selection ), debugstr_xatom( event->target ),
event->requestor, debugstr_xatom( event->property ));
@@ -2105,8 +2100,6 @@ done:
result.xselection.time = event->time;
TRACE( "sending SelectionNotify for %s to %lx\n", debugstr_xatom( rprop ), event->requestor );
XSendEvent( display, event->requestor, False, NoEventMask, &result );
- XSync( display, False );
- if (X11DRV_check_error()) WARN( "requestor %lx is no longer valid\n", event->requestor );
return FALSE;
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 544e869..d622468 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -385,6 +385,7 @@ extern int copy_default_colors DECLSPEC_HIDDEN;
extern int alloc_system_colors DECLSPEC_HIDDEN;
extern int xrender_error_base DECLSPEC_HIDDEN;
extern HMODULE x11drv_module DECLSPEC_HIDDEN;
+extern Display *clipboard_display DECLSPEC_HIDDEN;
/* atoms */
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index e020c68..41097f4 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -210,6 +210,9 @@ static inline BOOL ignore_error( Display *display, XErrorEvent *event )
if ((event->request_code == X_SetInputFocus || event->request_code == X_ChangeWindowAttributes) &&
(event->error_code == BadMatch || event->error_code == BadWindow)) return TRUE;
+ /* the clipboard display interacts with external windows, ignore all errors */
+ if (display == clipboard_display) return TRUE;
+
/* ignore a number of errors on gdi display caused by creating/destroying windows */
if (display == gdi_display)
{
More information about the wine-cvs
mailing list