Bug 1434565 - Put some meanigful timestamp to nsRemoteService::HandleCommandLine(), r?jhorak
We need to put a timestamp to nsRemoteService::HandleCommandLine() to allow Gtk+ focus
opened Firefox window.
Unfortunately we don't have much choice how to get the timestamp at DBUS remote service
so ask for gtk_get_current_event_time() and when GDK_CURRENT_TIME is returned
(it means we don't have the timestamp) use g_get_monotonic_time() as well
as at nsWindow::GetEventTimeStamp().
MozReview-Commit-ID: 9ilVZ0kPe3x
--- a/toolkit/components/remote/nsDBusRemoteService.cpp
+++ b/toolkit/components/remote/nsDBusRemoteService.cpp
@@ -84,17 +84,21 @@ nsDBusRemoteService::OpenURL(DBusMessage
int length;
if (!dbus_message_get_args(msg, nullptr, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
&commandLine, &length, DBUS_TYPE_INVALID) || length == 0) {
nsAutoCString errorMsg;
errorMsg = nsPrintfCString("org.mozilla.%s.Error", mAppName.get());
reply = dbus_message_new_error(msg, errorMsg.get(), "Wrong argument");
} else {
- nsRemoteService::HandleCommandLine(commandLine, nullptr, 0);
+ guint32 timestamp = gtk_get_current_event_time();
+ if (timestamp == GDK_CURRENT_TIME) {
+ timestamp = guint32(g_get_monotonic_time() / 1000);
+ }
+ nsRemoteService::HandleCommandLine(commandLine, nullptr, timestamp);
reply = dbus_message_new_method_return(msg);
}
dbus_connection_send(mConnection, reply, nullptr);
dbus_message_unref(reply);
return DBUS_HANDLER_RESULT_HANDLED;
}