From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 2 +- dlls/winex11.drv/keyboard.c | 2 +- dlls/winex11.drv/mouse.c | 2 +- dlls/winex11.drv/window.c | 19 ++++++++++++++----- dlls/winex11.drv/x11drv.h | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 70b09f4315e..e726884b6d8 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -701,7 +701,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
if (protocol == x11drv_atom(WM_DELETE_WINDOW)) { - update_user_time( event->display, event->window, event_time ); + update_user_time( event->display, event->window, event_time, FALSE );
if (hwnd == NtUserGetDesktopWindow()) { diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index f24313852b5..7a4b22e52cd 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1340,7 +1340,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) TRACE_(key)("type %d, window %lx, state 0x%04x, keycode %u\n", event->type, event->window, event->state, event->keycode);
- if (event->type == KeyPress) update_user_time( event->display, event->window, event->time ); + if (event->type == KeyPress) update_user_time( event->display, event->window, event->time, FALSE );
/* Clients should pass only KeyPress events to XmbLookupString */ if (xic && event->type == KeyPress) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index f1a3a2ab516..f04ceceef78 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1547,7 +1547,7 @@ BOOL X11DRV_ButtonPress( HWND hwnd, XEvent *xev ) input.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.mi.dwExtraInfo = 0;
- update_user_time( event->display, event->window, event->time ); + update_user_time( event->display, event->window, event->time, FALSE ); map_event_coords( hwnd, event->window, event->root, event->x_root, event->y_root, &input ); send_mouse_input( hwnd, event->window, event->state, &input ); return TRUE; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e4ef463a415..8347424b7a5 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -266,7 +266,7 @@ static void remove_startup_notification(Display *display, Window window)
if (!(id = getenv( "DESKTOP_STARTUP_ID" )) || !id[0]) return;
- if ((src = strstr( id, "_TIME" ))) update_user_time( display, window, atol( src + 5 ) ); + if ((src = strstr( id, "_TIME" ))) update_user_time( display, window, atol( src + 5 ), FALSE );
pos = snprintf(message, sizeof(message), "remove: ID="); message[pos++] = '"'; @@ -1140,10 +1140,12 @@ Window init_clip_window(void) /*********************************************************************** * update_user_time */ -void update_user_time( Display *display, Window window, Time time ) +void update_user_time( Display *display, Window window, Time time, BOOL force ) { - XChangeProperty( display, window, x11drv_atom(_NET_WM_USER_TIME), XA_CARDINAL, - 32, PropModeReplace, (unsigned char *)&time, 1 ); + if (!force && (time == -1 || time == 0)) time = 1; + if (time == -1) XDeleteProperty( display, window, x11drv_atom(_NET_WM_USER_TIME) ); + else XChangeProperty( display, window, x11drv_atom(_NET_WM_USER_TIME), XA_CARDINAL, + 32, PropModeReplace, (unsigned char *)&time, 1 ); }
/* Update _NET_WM_FULLSCREEN_MONITORS when _NET_WM_STATE_FULLSCREEN is set to support fullscreen @@ -1451,7 +1453,14 @@ static void window_set_wm_state( struct x11drv_win_data *data, UINT new_state, U break; }
- if (new_state != NormalState && data->has_focus && data->hwnd != foreground) + if (new_state == NormalState) + { + /* try forcing activation if the window is supposed to be foreground */ + if (data->hwnd == foreground) swp_flags = 0; + if (swp_flags & SWP_NOACTIVATE) update_user_time( data->display, data->whole_window, 0, TRUE ); + else update_user_time( data->display, data->whole_window, -1, TRUE ); + } + else if (data->has_focus && data->hwnd != foreground) { Window window = X11DRV_get_whole_window( foreground ); WARN( "Inconsistent input focus, activating window %p/%lx\n", foreground, window ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 147b053943f..ce30fbaa49b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -676,7 +676,7 @@ extern BOOL get_window_state_updates( HWND hwnd, UINT *state_cmd, UINT *config_c extern void net_supported_init( struct x11drv_thread_data *data );
extern Window init_clip_window(void); -extern void update_user_time( Display *display, Window window, Time time ); +extern void update_user_time( Display *display, Window window, Time time, BOOL force ); extern UINT get_window_net_wm_state( Display *display, Window window ); extern void make_window_embedded( struct x11drv_win_data *data ); extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap );