From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/Makefile.in | 1 - dlls/winex11.drv/dllmain.c | 1 - dlls/winex11.drv/event.c | 122 +++------------------------------ dlls/winex11.drv/mouse.c | 16 ++--- dlls/winex11.drv/systray.c | 55 --------------- dlls/winex11.drv/unixlib.h | 1 - dlls/winex11.drv/window.c | 98 +------------------------- dlls/winex11.drv/x11drv.h | 3 +- dlls/winex11.drv/x11drv_dll.h | 3 - dlls/winex11.drv/x11drv_main.c | 2 - 10 files changed, 18 insertions(+), 284 deletions(-) delete mode 100644 dlls/winex11.drv/systray.c
diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in index f570b026db4..155c0be5345 100644 --- a/dlls/winex11.drv/Makefile.in +++ b/dlls/winex11.drv/Makefile.in @@ -20,7 +20,6 @@ SOURCES = \ opengl.c \ palette.c \ pen.c \ - systray.c \ version.rc \ vulkan.c \ window.c \ diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index 14336adf583..01e5d417800 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -34,7 +34,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) .dnd_post_drop_callback = (UINT_PTR)x11drv_dnd_post_drop, .dnd_drop_event_callback = (UINT_PTR)x11drv_dnd_drop_event, .dnd_leave_event_callback = (UINT_PTR)x11drv_dnd_leave_event, - .foreign_window_proc = (UINT_PTR)foreign_window_proc, };
if (reason != DLL_PROCESS_ATTACH) return TRUE; diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 795320881bd..fe8c734b197 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -89,7 +89,6 @@ static BOOL X11DRV_ReparentNotify( HWND hwnd, XEvent *event ); static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *event ); static BOOL X11DRV_PropertyNotify( HWND hwnd, XEvent *event ); static BOOL X11DRV_ClientMessage( HWND hwnd, XEvent *event ); -static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *event );
#define MAX_EVENT_HANDLERS 128
@@ -119,7 +118,7 @@ static x11drv_event_handler handlers[MAX_EVENT_HANDLERS] = X11DRV_ReparentNotify, /* 21 ReparentNotify */ X11DRV_ConfigureNotify, /* 22 ConfigureNotify */ NULL, /* 23 ConfigureRequest */ - X11DRV_GravityNotify, /* 24 GravityNotify */ + NULL, /* 24 GravityNotify */ NULL, /* 25 ResizeRequest */ NULL, /* 26 CirculateNotify */ NULL, /* 27 CirculateRequest */ @@ -176,7 +175,6 @@ static BOOL host_window_filter_event( XEvent *event ) { struct host_window *win; RECT old_rect; - HWND hwnd;
if (!(win = get_host_window( event->xany.window, FALSE ))) return FALSE; old_rect = win->rect; @@ -233,8 +231,6 @@ static BOOL host_window_filter_event( XEvent *event ) } }
- /* keep processing the event for foreign windows */ - if (!XFindContext( event->xany.display, event->xany.window, winContext, (char **)&hwnd )) return FALSE; return TRUE; }
@@ -1022,40 +1018,6 @@ static BOOL X11DRV_UnmapNotify( HWND hwnd, XEvent *event ) }
-/*********************************************************************** - * reparent_notify - */ -static void reparent_notify( Display *display, HWND hwnd, Window xparent, int x, int y ) -{ - HWND parent, old_parent; - DWORD style, flags = 0; - RECT rect; - - style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); - if (xparent == root_window) - { - parent = NtUserGetDesktopWindow(); - style = (style & ~WS_CHILD) | WS_POPUP; - } - else - { - if (!(parent = create_foreign_window( display, xparent ))) return; - style = (style & ~WS_POPUP) | WS_CHILD; - } - - NtUserShowWindow( hwnd, SW_HIDE ); - old_parent = NtUserSetParent( hwnd, parent ); - NtUserSetWindowLong( hwnd, GWL_STYLE, style, FALSE ); - - if (style & WS_VISIBLE) flags = SWP_SHOWWINDOW; - SetRect( &rect, x, y, x, y ); - NtUserSetRawWindowPos( hwnd, rect, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS | flags, FALSE ); - - /* make old parent destroy itself if it no longer has children */ - if (old_parent != NtUserGetDesktopWindow()) NtUserPostMessage( old_parent, WM_CLOSE, 0, 0 ); -} - - /*********************************************************************** * X11DRV_ReparentNotify */ @@ -1088,39 +1050,9 @@ static BOOL X11DRV_ReparentNotify( HWND hwnd, XEvent *xev )
TRACE( "%p/%lx reparented to %lx\n", hwnd, data->whole_window, event->parent ); release_win_data( data ); - - reparent_notify( event->display, hwnd, event->parent, event->x, event->y ); return TRUE; }
-/* map XConfigureNotify event coordinates to parent-relative monitor DPI coordinates */ -static POINT map_configure_event_coords( struct x11drv_win_data *data, XConfigureEvent *event ) -{ - Window child, parent = data->embedder ? data->embedder : root_window; - POINT pos; - - if (event->send_event && parent == DefaultRootWindow( event->display )) - { - pos.x = event->x; - pos.y = event->y; - } - else if (event->send_event) - { - /* synthetic events are always in root coords */ - XTranslateCoordinates( event->display, DefaultRootWindow( event->display ), parent, - event->x, event->y, (int *)&pos.x, (int *)&pos.y, &child ); - } - else - { - /* query the current window position, events are relative to their parent */ - XTranslateCoordinates( event->display, event->window, parent, 0, 0, - (int *)&pos.x, (int *)&pos.y, &child ); - } - - if (parent == root_window) pos = root_to_virtual_screen( pos.x, pos.y ); - return pos; -} - /*********************************************************************** * X11DRV_ConfigureNotify */ @@ -1129,9 +1061,9 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) XConfigureEvent *event = &xev->xconfigure; struct x11drv_win_data *data; RECT rect; - POINT pos; + POINT pos = {event->x, event->y}; UINT flags; - int cx, cy, x = event->x, y = event->y; + int cx, cy, x, y; DWORD style;
if (!hwnd) return FALSE; @@ -1144,9 +1076,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) }
if (!data->mapped || data->iconic) goto done; - if (data->whole_window && !data->managed) goto done; - /* ignore synthetic events on foreign windows */ - if (event->send_event && !data->whole_window) goto done; + if (!data->whole_window || !data->managed) goto done; if (data->configure_serial && (long)(data->configure_serial - event->serial) > 0) { TRACE( "win %p/%lx event %d,%d,%dx%d ignoring old serial %lu/%lu\n", @@ -1155,9 +1085,11 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) goto done; }
- /* Get geometry */ + /* synthetic events are already in absolute coordinates */ + if (!event->send_event) pos = host_window_map_point( data->parent, event->x, event->y ); + else if (is_virtual_desktop()) FIXME( "synthetic event mapping not implemented\n" );
- pos = map_configure_event_coords( data, event ); + pos = root_to_virtual_screen( pos.x, pos.y ); SetRect( &rect, pos.x, pos.y, pos.x + event->width, pos.y + event->height ); rect = window_rect_from_visible( &data->rects, rect );
@@ -1226,43 +1158,6 @@ done: }
-/********************************************************************** - * X11DRV_GravityNotify - */ -static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *xev ) -{ - XGravityEvent *event = &xev->xgravity; - struct x11drv_win_data *data = get_win_data( hwnd ); - RECT window_rect; - int x, y; - - if (!data) return FALSE; - - if (data->whole_window) /* only handle this for foreign windows */ - { - release_win_data( data ); - return FALSE; - } - - x = event->x + data->rects.window.left - data->rects.visible.left; - y = event->y + data->rects.window.top - data->rects.visible.top; - - TRACE( "win %p/%lx new X pos %d,%d (event %d,%d)\n", - hwnd, data->whole_window, x, y, event->x, event->y ); - - window_rect = data->rects.window; - release_win_data( data ); - - if (window_rect.left != x || window_rect.top != y) - { - RECT rect = {x, y, x, y}; - NtUserSetRawWindowPos( hwnd, rect, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS, FALSE ); - } - - return TRUE; -} - - /*********************************************************************** * get_window_wm_state */ @@ -1672,7 +1567,6 @@ static void handle_xembed_protocol( HWND hwnd, XClientMessageEvent *event ) set_window_parent( data, data->embedder ); make_window_embedded( data ); release_win_data( data ); - reparent_notify( event->display, hwnd, event->data.l[3], 0, 0 ); } break;
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 15557c3d917..cbbb27d6798 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -509,17 +509,15 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x { if (window == root_window) pt = root_to_virtual_screen( pt.x, pt.y ); else if (event_root == root_window) pt = root_to_virtual_screen( x_root, y_root ); + else if (window == data->client_window) + { + pt.x += data->rects.client.left; + pt.y += data->rects.client.top; + } else { - if (window == data->whole_window) - { - pt.x += data->rects.visible.left - data->rects.client.left; - pt.y += data->rects.visible.top - data->rects.client.top; - } - - if (NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) - pt.x = data->rects.client.right - data->rects.client.left - 1 - pt.x; - NtUserMapWindowPoints( hwnd, 0, &pt, 1, 0 /* per-monitor DPI */ ); + pt.x += data->rects.visible.left; + pt.y += data->rects.visible.top; } release_win_data( data ); } diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c deleted file mode 100644 index e21ce481f9b..00000000000 --- a/dlls/winex11.drv/systray.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * X11 system tray management - * - * Copyright (C) 2004 Mike Hearn, for CodeWeavers - * Copyright (C) 2005 Robert Shearman - * Copyright (C) 2008 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "x11drv_dll.h" -#include "commctrl.h" -#include "shellapi.h" - -#include "wine/list.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(systray); - -/* window procedure for foreign windows */ -LRESULT WINAPI foreign_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) -{ - switch(msg) - { - case WM_WINDOWPOSCHANGED: - { - HWND hwnd = FindWindowW( L"Shell_TrayWnd", NULL ); - PostMessageW( hwnd, WM_USER + 0, 0, 0 ); - break; - } - case WM_PARENTNOTIFY: - if (LOWORD(wparam) == WM_DESTROY) - { - TRACE( "%p: got parent notify destroy for win %Ix\n", hwnd, lparam ); - PostMessageW( hwnd, WM_CLOSE, 0, 0 ); /* so that we come back here once the child is gone */ - } - return 0; - case WM_CLOSE: - if (GetWindow( hwnd, GW_CHILD )) return 0; /* refuse to die if we still have children */ - break; - } - return DefWindowProcW( hwnd, msg, wparam, lparam ); -} diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 522411f8e55..f23d7204bcd 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -40,7 +40,6 @@ struct init_params UINT64 dnd_post_drop_callback; UINT64 dnd_drop_event_callback; UINT64 dnd_leave_event_callback; - UINT64 foreign_window_proc; };
/* x11drv_tablet_info params */ diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 299ea8cdcd5..b3ffbfb2a90 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -104,8 +104,6 @@ static XContext host_window_context = 0; static Time last_user_time; static Window user_time_window;
-static const WCHAR foreign_window_prop[] = - {'_','_','w','i','n','e','_','x','1','1','_','f','o','r','e','i','g','n','_','w','i','n','d','o','w',0}; static const WCHAR whole_window_prop[] = {'_','_','w','i','n','e','_','x','1','1','_','w','h','o','l','e','_','w','i','n','d','o','w',0}; static const WCHAR clip_window_prop[] = @@ -137,7 +135,7 @@ static void host_window_release( struct host_window *win ) } }
-static POINT host_window_map_point( struct host_window *win, int x, int y ) +POINT host_window_map_point( struct host_window *win, int x, int y ) { POINT pos = {x, y};
@@ -1858,16 +1856,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des
if (!data->whole_window) { - if (data->embedded) - { - Window xwin = (Window)NtUserGetProp( data->hwnd, foreign_window_prop ); - if (xwin) - { - XDeleteContext( data->display, xwin, winContext ); - NtUserRemoveProp( data->hwnd, foreign_window_prop ); - } - return; - } + if (data->embedded) return; } else { @@ -2229,89 +2218,6 @@ static struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd, const struct w }
-/*********************************************************************** - * create_foreign_window - * - * Create a foreign window for the specified X window and its ancestors - */ -HWND create_foreign_window( Display *display, Window xwin ) -{ - static BOOL class_registered; - struct x11drv_win_data *data; - HWND hwnd, parent; - POINT pos; - Window xparent, xroot; - Window *xchildren; - unsigned int nchildren; - XWindowAttributes attr; - UINT style = WS_CLIPCHILDREN; - UNICODE_STRING class_name = RTL_CONSTANT_STRING( foreign_window_prop ); - - if (!class_registered) - { - UNICODE_STRING version = { 0 }; - WNDCLASSEXW class; - - memset( &class, 0, sizeof(class) ); - class.cbSize = sizeof(class); - class.lpfnWndProc = (WNDPROC)(UINT_PTR)client_foreign_window_proc; - class.lpszClassName = foreign_window_prop; - if (!NtUserRegisterClassExWOW( &class, &class_name, &version, NULL, 0, 0, NULL ) && - RtlGetLastWin32Error() != ERROR_CLASS_ALREADY_EXISTS) - { - ERR( "Could not register foreign window class\n" ); - return FALSE; - } - class_registered = TRUE; - } - - if (XFindContext( display, xwin, winContext, (char **)&hwnd )) hwnd = 0; - if (hwnd) return hwnd; /* already created */ - - if (!XGetWindowAttributes( display, xwin, &attr ) || - !XQueryTree( display, xwin, &xroot, &xparent, &xchildren, &nchildren )) - return 0; - XFree( xchildren ); - - if (xparent == xroot) - { - parent = NtUserGetDesktopWindow(); - style |= WS_POPUP; - pos = root_to_virtual_screen( attr.x, attr.y ); - } - else - { - parent = create_foreign_window( display, xparent ); - style |= WS_CHILD; - pos.x = attr.x; - pos.y = attr.y; - } - - hwnd = NtUserCreateWindowEx( 0, &class_name, &class_name, NULL, style, pos.x, pos.y, - attr.width, attr.height, parent, 0, NULL, NULL, 0, NULL, - 0, FALSE ); - if (!(data = get_win_data( hwnd ))) - { - NtUserDestroyWindow( hwnd ); - return 0; - } - destroy_whole_window( data, FALSE ); - data->embedded = TRUE; - data->mapped = TRUE; - - NtUserSetProp( hwnd, foreign_window_prop, (HANDLE)xwin ); - XSaveContext( display, xwin, winContext, (char *)data->hwnd ); - - TRACE( "win %lx parent %p style %08x %s -> hwnd %p\n", - xwin, parent, style, wine_dbgstr_rect(&data->rects.window), hwnd ); - - release_win_data( data ); - - NtUserShowWindow( hwnd, SW_SHOW ); - return hwnd; -} - - /*********************************************************************** * SystrayDockInit (X11DRV.@) */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 388a6d4fc86..d0a9b57ebc2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -376,6 +376,7 @@ struct host_window extern void host_window_destroy( struct host_window *win ); extern void host_window_set_parent( struct host_window *win, Window parent ); extern RECT host_window_configure_child( struct host_window *win, Window window, RECT rect, BOOL root_coords ); +extern POINT host_window_map_point( struct host_window *win, int x, int y ); extern struct host_window *get_host_window( Window window, BOOL create );
struct x11drv_thread_data @@ -450,7 +451,6 @@ extern int alloc_system_colors; extern int xrender_error_base; extern char *process_name; extern Display *clipboard_display; -extern UINT64 client_foreign_window_proc; extern UINT64 dnd_enter_event_callback; extern UINT64 dnd_position_event_callback; extern UINT64 dnd_post_drop_callback; @@ -664,7 +664,6 @@ extern void attach_client_window( struct x11drv_win_data *data, Window client_wi extern void destroy_client_window( HWND hwnd, Window client_window ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void change_systray_owner( Display *display, Window systray_window ); -extern HWND create_foreign_window( Display *display, Window window ); extern BOOL update_clipboard( HWND hwnd ); extern void init_win_context(void); extern DROPFILES *file_list_to_drop_files( const void *data, size_t size, size_t *ret_size ); diff --git a/dlls/winex11.drv/x11drv_dll.h b/dlls/winex11.drv/x11drv_dll.h index bc68c3996c3..6113f01344a 100644 --- a/dlls/winex11.drv/x11drv_dll.h +++ b/dlls/winex11.drv/x11drv_dll.h @@ -33,9 +33,6 @@ extern NTSTATUS WINAPI x11drv_dnd_post_drop( void *data, ULONG size ); extern NTSTATUS WINAPI x11drv_dnd_drop_event( void *params, ULONG size ); extern NTSTATUS WINAPI x11drv_dnd_leave_event( void *params, ULONG size );
-extern LRESULT WINAPI foreign_window_proc( HWND hwnd, UINT msg, WPARAM wparam, - LPARAM lparam ); - extern HMODULE x11drv_module;
#endif /* __WINE_X11DRV_DLL_H */ diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 3f8e48a7a8d..490a662c16a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -85,7 +85,6 @@ int copy_default_colors = 128; int alloc_system_colors = 256; int xrender_error_base = 0; char *process_name = NULL; -UINT64 client_foreign_window_proc = 0; UINT64 dnd_enter_event_callback = 0; UINT64 dnd_position_event_callback = 0; UINT64 dnd_post_drop_callback = 0; @@ -653,7 +652,6 @@ static NTSTATUS x11drv_init( void *arg ) dnd_post_drop_callback = params->dnd_post_drop_callback; dnd_drop_event_callback = params->dnd_drop_event_callback; dnd_leave_event_callback = params->dnd_leave_event_callback; - client_foreign_window_proc = params->foreign_window_proc;
fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */ root_window = DefaultRootWindow( display );