1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "nsWidgetFactory.h"
10 #include "mozilla/Components.h"
11 #include "mozilla/WidgetUtils.h"
12 #include "NativeKeyBindings.h"
13 #include "nsWidgetsCID.h"
14 #include "nsAppShell.h"
15 #include "nsAppShellSingleton.h"
16 #include "nsBaseWidget.h"
17 #include "nsGtkKeyUtils.h"
18 #include "nsLookAndFeel.h"
20 #include "nsHTMLFormatConverter.h"
21 #include "HeadlessClipboard.h"
22 #include "IMContextWrapper.h"
24 # include "nsClipboard.h"
26 #include "TaskbarProgress.h"
27 #include "nsFilePicker.h"
29 #include "nsGTKToolkit.h"
30 #include "WakeLockListener.h"
32 #include "mozilla/gfx/2D.h"
33 #include "mozilla/widget/ScreenManager.h"
36 using namespace mozilla
;
37 using namespace mozilla::widget
;
40 NS_IMPL_COMPONENT_FACTORY(nsIClipboard
) {
41 nsCOMPtr
<nsIClipboard
> inst
;
42 if (gfxPlatform::IsHeadless()) {
43 inst
= new HeadlessClipboard();
45 auto clipboard
= MakeRefPtr
<nsClipboard
>();
46 if (NS_FAILED(clipboard
->Init())) {
49 inst
= std::move(clipboard
);
52 return inst
.forget().downcast
<nsISupports
>();
56 nsresult
nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); }
58 void nsWidgetGtk2ModuleDtor() {
59 // Shutdown all XP level widget classes.
60 WidgetUtils::Shutdown();
62 NativeKeyBindings::Shutdown();
63 nsLookAndFeel::Shutdown();
64 nsFilePicker::Shutdown();
66 nsWindow::ReleaseGlobals();
67 IMContextWrapper::Shutdown();
68 KeymapWrapper::Shutdown();
69 nsGTKToolkit::Shutdown();
71 #ifdef MOZ_ENABLE_DBUS
72 WakeLockListener::Shutdown();