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"
23 #include "nsClipboard.h"
24 #include "TaskbarProgress.h"
25 #include "nsFilePicker.h"
27 #include "nsGTKToolkit.h"
28 #include "WakeLockListener.h"
30 #include "mozilla/gfx/2D.h"
31 #include "mozilla/widget/ScreenManager.h"
34 using namespace mozilla
;
35 using namespace mozilla::widget
;
37 NS_IMPL_COMPONENT_FACTORY(nsIClipboard
) {
38 nsCOMPtr
<nsIClipboard
> inst
;
39 if (gfxPlatform::IsHeadless()) {
40 inst
= new HeadlessClipboard();
42 auto clipboard
= MakeRefPtr
<nsClipboard
>();
43 if (NS_FAILED(clipboard
->Init())) {
46 inst
= std::move(clipboard
);
49 return inst
.forget().downcast
<nsISupports
>();
52 nsresult
nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); }
54 void nsWidgetGtk2ModuleDtor() {
55 // Shutdown all XP level widget classes.
56 WidgetUtils::Shutdown();
58 NativeKeyBindings::Shutdown();
59 nsLookAndFeel::Shutdown();
60 nsFilePicker::Shutdown();
62 nsWindow::ReleaseGlobals();
63 IMContextWrapper::Shutdown();
64 KeymapWrapper::Shutdown();
65 nsGTKToolkit::Shutdown();