Commit fc5ce145 authored by Alexandre Julliard's avatar Alexandre Julliard

Avoid most references to the internals of the WND structure by passing

around an x11drv_win_data pointer instead.
parent b819f4cd
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
#include "winbase.h" #include "winbase.h"
#include "winreg.h" #include "winreg.h"
#include "wine/wingdi16.h" #include "wine/wingdi16.h"
#include "win.h"
#include "x11drv.h" #include "x11drv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
......
...@@ -1051,18 +1051,19 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1051,18 +1051,19 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
} u; } u;
int x, y; int x, y;
BOOL bAccept; BOOL bAccept;
Window w_aux_root, w_aux_child; Window win, w_aux_root, w_aux_child;
WND* pWnd; WND* pWnd;
HWND hScope = hWnd; HWND hScope = hWnd;
pWnd = WIN_FindWndPtr(hWnd); win = X11DRV_get_whole_window(hWnd);
wine_tsx11_lock(); wine_tsx11_lock();
XQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child, XQueryPointer( event->display, win, &w_aux_root, &w_aux_child,
&x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y, &x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y,
(unsigned int*)&aux_long); (unsigned int*)&aux_long);
wine_tsx11_unlock(); wine_tsx11_unlock();
pWnd = WIN_FindWndPtr(hWnd);
/* find out drop point and drop window */ /* find out drop point and drop window */
if( x < 0 || y < 0 || if( x < 0 || y < 0 ||
x > (pWnd->rectWindow.right - pWnd->rectWindow.left) || x > (pWnd->rectWindow.right - pWnd->rectWindow.left) ||
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "winbase.h" #include "winbase.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "win.h"
#include "x11drv.h" #include "x11drv.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -69,19 +70,15 @@ static BYTE *pKeyStateTable; ...@@ -69,19 +70,15 @@ static BYTE *pKeyStateTable;
*/ */
static void get_coords( HWND *hwnd, Window window, int x, int y, POINT *pt ) static void get_coords( HWND *hwnd, Window window, int x, int y, POINT *pt )
{ {
struct x11drv_win_data *data; struct x11drv_win_data *data = X11DRV_get_win_data( *hwnd );
WND *win;
if (!(win = WIN_GetPtr( *hwnd )) || win == WND_OTHER_PROCESS) return; if (!data) return;
data = win->pDriverData;
if (window == data->whole_window) if (window == data->whole_window)
{ {
x -= data->client_rect.left; x -= data->client_rect.left;
y -= data->client_rect.top; y -= data->client_rect.top;
} }
WIN_ReleasePtr( win );
pt->x = x; pt->x = x;
pt->y = y; pt->y = y;
if (*hwnd != GetDesktopWindow()) if (*hwnd != GetDesktopWindow())
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "winuser.h" #include "winuser.h"
#include "x11drv.h" #include "x11drv.h"
#include "win.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(scroll); WINE_DEFAULT_DEBUG_CHANNEL(scroll);
......
...@@ -40,7 +40,8 @@ typedef int Status; ...@@ -40,7 +40,8 @@ typedef int Status;
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "win.h" #include "wingdi.h"
#include "winuser.h"
#include "ddrawi.h" #include "ddrawi.h"
#include "thread.h" #include "thread.h"
...@@ -508,9 +509,11 @@ extern int X11DRV_ProcessTabletEvent(HWND hwnd, XEvent *event); ...@@ -508,9 +509,11 @@ extern int X11DRV_ProcessTabletEvent(HWND hwnd, XEvent *event);
/* x11drv private window data */ /* x11drv private window data */
struct x11drv_win_data struct x11drv_win_data
{ {
HWND hwnd; /* hwnd that this private data belongs to */
Window whole_window; /* X window for the complete window */ Window whole_window; /* X window for the complete window */
Window client_window; /* X window for the client area */ Window client_window; /* X window for the client area */
Window icon_window; /* X window for the icon */ Window icon_window; /* X window for the icon */
RECT window_rect; /* USER window rectangle relative to parent */
RECT whole_rect; /* X window rectangle for the whole window relative to parent */ RECT whole_rect; /* X window rectangle for the whole window relative to parent */
RECT client_rect; /* client area relative to whole window */ RECT client_rect; /* client area relative to whole window */
XIC xic; /* X input context */ XIC xic; /* X input context */
...@@ -518,28 +521,16 @@ struct x11drv_win_data ...@@ -518,28 +521,16 @@ struct x11drv_win_data
HBITMAP hWMIconMask; HBITMAP hWMIconMask;
}; };
typedef struct x11drv_win_data X11DRV_WND_DATA; extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd );
extern Window X11DRV_get_client_window( HWND hwnd ); extern Window X11DRV_get_client_window( HWND hwnd );
extern Window X11DRV_get_whole_window( HWND hwnd ); extern Window X11DRV_get_whole_window( HWND hwnd );
extern BOOL X11DRV_is_window_rect_mapped( const RECT *rect ); extern BOOL X11DRV_is_window_rect_mapped( const RECT *rect );
extern XIC X11DRV_get_ic( HWND hwnd ); extern XIC X11DRV_get_ic( HWND hwnd );
inline static Window get_client_window( WND *wnd ) inline static BOOL is_window_top_level( HWND hwnd )
{
struct x11drv_win_data *data = wnd->pDriverData;
return data->client_window;
}
inline static Window get_whole_window( WND *wnd )
{
struct x11drv_win_data *data = wnd->pDriverData;
return data->whole_window;
}
inline static BOOL is_window_top_level( WND *win )
{ {
return (root_window == DefaultRootWindow(gdi_display) && win->parent == GetDesktopWindow()); return (root_window == DefaultRootWindow(gdi_display) &&
GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow());
} }
extern void X11DRV_SetFocus( HWND hwnd ); extern void X11DRV_SetFocus( HWND hwnd );
...@@ -550,17 +541,19 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void ...@@ -550,17 +541,19 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ); extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg );
extern int X11DRV_check_error(void); extern int X11DRV_check_error(void);
extern void X11DRV_register_window( Display *display, HWND hwnd, struct x11drv_win_data *data ); extern void X11DRV_register_window( Display *display, HWND hwnd, struct x11drv_win_data *data );
extern void X11DRV_set_iconic_state( WND *win ); extern void X11DRV_set_iconic_state( HWND hwnd );
extern void X11DRV_window_to_X_rect( WND *win, RECT *rect ); extern void X11DRV_window_to_X_rect( HWND hwnd, RECT *rect );
extern void X11DRV_X_to_window_rect( WND *win, RECT *rect ); extern void X11DRV_X_to_window_rect( HWND hwnd, RECT *rect );
extern void X11DRV_create_desktop_thread(void); extern void X11DRV_create_desktop_thread(void);
extern Window X11DRV_create_desktop( XVisualInfo *desktop_vi, const char *geometry ); extern Window X11DRV_create_desktop( XVisualInfo *desktop_vi, const char *geometry );
extern void X11DRV_sync_window_style( Display *display, WND *win ); extern void X11DRV_sync_window_style( Display *display, struct x11drv_win_data *data );
extern int X11DRV_sync_whole_window_position( Display *display, WND *win, int zorder ); extern int X11DRV_sync_whole_window_position( Display *display, struct x11drv_win_data *data,
extern int X11DRV_sync_client_window_position( Display *display, WND *win ); int zorder );
extern int X11DRV_sync_client_window_position( Display *display, struct x11drv_win_data *data,
const RECT *new_client_rect );
extern BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow, extern BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
const RECT *rectClient, UINT swp_flags, UINT wvr_flags ); const RECT *rectClient, UINT swp_flags, UINT wvr_flags );
extern void X11DRV_set_wm_hints( Display *display, WND *win ); extern void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data );
extern void X11DRV_handle_desktop_resize(unsigned int width, unsigned int height); extern void X11DRV_handle_desktop_resize(unsigned int width, unsigned int height);
extern void X11DRV_Settings_AddDepthModes(void); extern void X11DRV_Settings_AddDepthModes(void);
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "winreg.h" #include "winreg.h"
#include "win.h"
#include "x11drv.h" #include "x11drv.h"
#include "xvidmode.h" #include "xvidmode.h"
#include "xrandr.h" #include "xrandr.h"
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "controls.h" #include "controls.h"
#include "nonclient.h" #include "nonclient.h"
#include "winpos.h" #include "winpos.h"
#include "dce.h"
#include "message.h" #include "message.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
...@@ -201,7 +200,6 @@ static void DEFWND_SetRedraw( HWND hwnd, WPARAM wParam ) ...@@ -201,7 +200,6 @@ static void DEFWND_SetRedraw( HWND hwnd, WPARAM wParam )
if( !bVisible ) if( !bVisible )
{ {
WIN_SetStyle( hwnd, wndPtr->dwStyle | WS_VISIBLE ); WIN_SetStyle( hwnd, wndPtr->dwStyle | WS_VISIBLE );
DCE_InvalidateDCE( hwnd, &wndPtr->rectWindow );
} }
} }
else if( bVisible ) else if( bVisible )
...@@ -210,7 +208,6 @@ static void DEFWND_SetRedraw( HWND hwnd, WPARAM wParam ) ...@@ -210,7 +208,6 @@ static void DEFWND_SetRedraw( HWND hwnd, WPARAM wParam )
else wParam = RDW_ALLCHILDREN | RDW_VALIDATE; else wParam = RDW_ALLCHILDREN | RDW_VALIDATE;
RedrawWindow( hwnd, NULL, 0, wParam ); RedrawWindow( hwnd, NULL, 0, wParam );
DCE_InvalidateDCE( hwnd, &wndPtr->rectWindow );
WIN_SetStyle( hwnd, wndPtr->dwStyle & ~WS_VISIBLE ); WIN_SetStyle( hwnd, wndPtr->dwStyle & ~WS_VISIBLE );
} }
WIN_ReleaseWndPtr( wndPtr ); WIN_ReleaseWndPtr( wndPtr );
......
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