gecko-dev/widget/gtk/TaskbarProgress.h
Michael Webster 1a8239407b Bug 1418749 - Add a TaskbarProgress implementation for gtk3/x11. r=paolo,karlt
This adds support for download progress reporting via the XApp
method currently used in the Cinnamon desktop, by establishing a new
X11 window property to be supported/read by the window manager.

See https://github.com/linuxmint/xapps/blob/master/libxapp/xapp-gtk-window.c,
as well as https://github.com/linuxmint/muffin/commit/39045da0ea06f
for more details.

The property-setting code lives in nsWindow - it's a small and stable
enough chunk that it made more sense to do this than actually depend on
another external library.  As nsWindow is already using x11 calls, this
seemed the safest place for it, without affecting the build.

The TaskbarProgress instance is initialized via the DownloadsTaskbar
js module, and is handed a pointer to the current main window to call
SetProgress on.  Most of the javascript side of this is in line with
how the other platforms are handled.

Without a supporting window manager/desktop environment (currently just
Cinnamon/Muffin 3.6,) the simplest way to observe working behavior is
by calling 'xprop -spy' on the browser window being testing and watching
for updates during a download.

--HG--
extra : rebase_source : 0606f6c87116204ec290c19276072d0c1c35691e
2018-03-08 18:43:00 +02:00

35 lines
857 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef TaskbarProgress_h_
#define TaskbarProgress_h_
#include "nsIGtkTaskbarProgress.h"
class nsWindow;
class TaskbarProgress final : public nsIGtkTaskbarProgress
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGTKTASKBARPROGRESS
NS_DECL_NSITASKBARPROGRESS
TaskbarProgress();
protected:
~TaskbarProgress();
// We track the progress value so we can avoid updating the X window property
// unnecessarily.
unsigned long mCurrentProgress;
RefPtr<nsWindow> mPrimaryWindow;
};
#endif // #ifndef TaskbarProgress_h_