Commit f777d70a authored by Alexandre Julliard's avatar Alexandre Julliard

Only create an X window for top-level windows, not for child windows.

Get rid of the X client window too, it's no longer needed.
parent 2dd40110
......@@ -638,7 +638,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
whichHWND = hFocusWindow;
}
object->win_handle = whichHWND;
object->win = (Window)GetPropA( whichHWND, "__wine_x11_client_window" );
object->win = (Window)GetPropA( whichHWND, "__wine_x11_whole_window" );
hDc = GetDC(whichHWND);
object->display = get_display(hDc);
......
......@@ -1375,7 +1375,7 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
whichHWND = hFocusWindow;
}
object->win_handle = whichHWND;
object->win = (Window)GetPropA( whichHWND, "__wine_x11_client_window" );
object->win = (Window)GetPropA( whichHWND, "__wine_x11_whole_window" );
hDc = GetDC(whichHWND);
object->display = get_display(hDc);
ReleaseDC(whichHWND, hDc);
......
......@@ -68,24 +68,14 @@ static BYTE *pKeyStateTable;
*
* get the coordinates of a mouse event
*/
static void get_coords( HWND *hwnd, Window window, int x, int y, POINT *pt )
static inline void get_coords( HWND hwnd, Window window, int x, int y, POINT *pt )
{
struct x11drv_win_data *data = X11DRV_get_win_data( *hwnd );
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
if (!data) return;
if (window == data->whole_window)
{
x -= data->client_rect.left;
y -= data->client_rect.top;
}
pt->x = x;
pt->y = y;
if (*hwnd != GetDesktopWindow())
{
ClientToScreen( *hwnd, pt );
*hwnd = GetAncestor( *hwnd, GA_ROOT );
}
pt->x = x + data->whole_rect.left;
pt->y = y + data->whole_rect.top;
}
......@@ -153,9 +143,6 @@ static void update_cursor( HWND hwnd, Window win )
{
struct x11drv_thread_data *data = x11drv_thread_data();
if (win == X11DRV_get_client_window( hwnd ))
win = X11DRV_get_whole_window( hwnd ); /* always set cursor on whole window */
if (data->cursor_window != win)
{
data->cursor_window = win;
......@@ -559,7 +546,7 @@ void X11DRV_ButtonPress( HWND hwnd, XButtonEvent *event )
if (!hwnd) return;
update_cursor( hwnd, event->window );
get_coords( &hwnd, event->window, event->x, event->y, &pt );
get_coords( hwnd, event->window, event->x, event->y, &pt );
switch (buttonNum)
{
......@@ -588,7 +575,7 @@ void X11DRV_ButtonRelease( HWND hwnd, XButtonEvent *event )
if (!hwnd) return;
update_cursor( hwnd, event->window );
get_coords( &hwnd, event->window, event->x, event->y, &pt );
get_coords( hwnd, event->window, event->x, event->y, &pt );
update_key_state( event->state );
send_mouse_event( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
pt.x, pt.y, 0, event->time );
......@@ -607,7 +594,7 @@ void X11DRV_MotionNotify( HWND hwnd, XMotionEvent *event )
if (!hwnd) return;
update_cursor( hwnd, event->window );
get_coords( &hwnd, event->window, event->x, event->y, &pt );
get_coords( hwnd, event->window, event->x, event->y, &pt );
update_key_state( event->state );
send_mouse_event( hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
pt.x, pt.y, 0, event->time );
......@@ -628,7 +615,7 @@ void X11DRV_EnterNotify( HWND hwnd, XCrossingEvent *event )
/* simulate a mouse motion event */
update_cursor( hwnd, event->window );
get_coords( &hwnd, event->window, event->x, event->y, &pt );
get_coords( hwnd, event->window, event->x, event->y, &pt );
update_key_state( event->state );
send_mouse_event( hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
pt.x, pt.y, 0, event->time );
......
......@@ -531,7 +531,6 @@ struct x11drv_win_data
{
HWND hwnd; /* hwnd that this private data belongs to */
Window whole_window; /* X window for the complete window */
Window client_window; /* X window for the client area */
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 */
......@@ -542,16 +541,11 @@ struct x11drv_win_data
};
extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd );
extern Window X11DRV_get_client_window( HWND hwnd );
extern POINT X11DRV_get_client_area_offset( HWND hwnd );
extern Window X11DRV_get_whole_window( HWND hwnd );
extern BOOL X11DRV_is_window_rect_mapped( const RECT *rect );
extern XIC X11DRV_get_ic( HWND hwnd );
inline static BOOL is_window_top_level( HWND hwnd )
{
return (root_window == DefaultRootWindow(gdi_display) &&
GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow());
}
/* X context to associate a hwnd to an X window */
extern XContext winContext;
......@@ -569,10 +563,8 @@ extern void X11DRV_X_to_window_rect( HWND hwnd, RECT *rect );
extern void X11DRV_create_desktop_thread(void);
extern Window X11DRV_create_desktop( XVisualInfo *desktop_vi, const char *geometry );
extern void X11DRV_sync_window_style( Display *display, struct x11drv_win_data *data );
extern int X11DRV_sync_whole_window_position( Display *display, struct x11drv_win_data *data,
int zorder );
extern int X11DRV_sync_client_window_position( Display *display, struct x11drv_win_data *data,
const RECT *new_client_rect );
extern void X11DRV_sync_window_position( Display *display, struct x11drv_win_data *data,
UINT swp_flags, const RECT *new_client_rect );
extern BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
const RECT *rectClient, UINT swp_flags, UINT wvr_flags );
extern void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data );
......
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