Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1036)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 317783012: Pass in the time of the user's last activity timestamp with the NET_ACTIVE_WINDOW event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index d87f9164438b8230b64f3679914046d44368b3cc..0ec85351dcd6a9fc75e28d8688405fa25c270325 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1192,6 +1192,29 @@ void DesktopWindowTreeHostX11::OnFrameExtentsUpdated() {
}
}
+void DesktopWindowTreeHostX11::UpdateWMUserTime(
+ const ui::PlatformEvent& event) {
+ if (!IsActive())
+ return;
+
+ ui::EventType type = ui::EventTypeFromNative(event);
+ if (type == ui::ET_MOUSE_PRESSED ||
+ type == ui::ET_KEY_PRESSED ||
+ type == ui::ET_TOUCH_PRESSED) {
Elliot Glaysher 2014/06/05 20:46:33 I'm pretty sure you want the released versions of
+ unsigned long wm_user_time_ms = static_cast<unsigned long>(
+ ui::EventTimeFromNative(event).InMilliseconds());
+ XChangeProperty(xdisplay_,
+ xwindow_,
+ atom_cache_.GetAtom("_NET_WM_USER_TIME"),
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ reinterpret_cast<const unsigned char *>(&wm_user_time_ms),
+ 1);
+ X11DesktopHandler::get()->set_wm_user_time_ms(wm_user_time_ms);
+ }
+}
+
void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled,
::Atom state1,
::Atom state2) {
@@ -1405,22 +1428,17 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) {
// If SHOW_STATE_INACTIVE, tell the window manager not to focus the window
// when mapping. This is done by setting the _NET_WM_USER_TIME to 0. See e.g.
// http://standards.freedesktop.org/wm-spec/latest/ar01s05.html
- if (show_state == ui::SHOW_STATE_INACTIVE) {
- unsigned long value = 0;
+ unsigned long wm_user_time_ms = (show_state == ui::SHOW_STATE_INACTIVE) ?
+ 0 : X11DesktopHandler::get()->wm_user_time_ms();
+ if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) {
XChangeProperty(xdisplay_,
xwindow_,
atom_cache_.GetAtom("_NET_WM_USER_TIME"),
XA_CARDINAL,
32,
PropModeReplace,
- reinterpret_cast<const unsigned char *>(&value),
+ reinterpret_cast<const unsigned char *>(&wm_user_time_ms),
1);
- } else {
- // TODO(piman): if this window was created in response to an X event, we
- // should set the time to the server time of the event that caused this.
- // https://crbug.com/355667
- XDeleteProperty(
- xdisplay_, xwindow_, atom_cache_.GetAtom("_NET_WM_USER_TIME"));
}
XMapWindow(xdisplay_, xwindow_);
@@ -1456,6 +1474,8 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
TRACE_EVENT1("views", "DesktopWindowTreeHostX11::Dispatch",
"event->type", event->type);
+ UpdateWMUserTime(event);
+
// May want to factor CheckXEventForConsistency(xev); into a common location
// since it is called here.
switch (xev->type) {
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | ui/views/widget/desktop_aura/x11_desktop_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698