1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7with Files("**"):
8    BUG_COMPONENT = ("Core", "Widget: Gtk")
9
10with Files("*CompositorWidget*"):
11    BUG_COMPONENT = ("Core", "Graphics")
12
13with Files("*WindowSurface*"):
14    BUG_COMPONENT = ("Core", "Graphics")
15
16with Files("*IMContextWrapper*"):
17    BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
18
19with Files("*nsGtkKeyUtils*"):
20    BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
21
22DIRS += ["mozgtk"]
23
24if CONFIG["MOZ_WAYLAND"]:
25    DIRS += ["wayland", "mozwayland"]
26
27EXPORTS += [
28    "MozContainer.h",
29    "nsGTKToolkit.h",
30    "nsImageToPixbuf.h",
31]
32
33EXPORTS.mozilla += ["WidgetUtilsGtk.h"]
34
35EXPORTS.mozilla.widget += [
36    "WindowSurface.h",
37    "WindowSurfaceProvider.h",
38]
39
40UNIFIED_SOURCES += [
41    "GfxInfo.cpp",
42    "gtk3drawing.cpp",
43    "GtkCompositorWidget.cpp",
44    "IMContextWrapper.cpp",
45    "MozContainer.cpp",
46    "MPRISServiceHandler.cpp",
47    "NativeKeyBindings.cpp",
48    "nsApplicationChooser.cpp",
49    "nsAppShell.cpp",
50    "nsBidiKeyboard.cpp",
51    "nsClipboard.cpp",
52    "nsColorPicker.cpp",
53    "nsDragService.cpp",
54    "nsFilePicker.cpp",
55    "nsGtkKeyUtils.cpp",
56    "nsImageToPixbuf.cpp",
57    "nsLookAndFeel.cpp",
58    "nsNativeBasicThemeGTK.cpp",
59    "nsSound.cpp",
60    "nsToolkit.cpp",
61    "nsWidgetFactory.cpp",
62    "ScreenHelperGTK.cpp",
63    "TaskbarProgress.cpp",
64    "WakeLockListener.cpp",
65    "WidgetStyleCache.cpp",
66    "WidgetTraceEvent.cpp",
67    "WidgetUtilsGtk.cpp",
68    "WindowSurfaceProvider.cpp",
69]
70
71SOURCES += [
72    "MediaKeysEventSourceFactory.cpp",
73    "nsNativeThemeGTK.cpp",  # conflicts with X11 headers
74    "nsWindow.cpp",  # conflicts with X11 headers
75    "WaylandVsyncSource.cpp",  # conflicts with X11 headers
76]
77
78if CONFIG["ACCESSIBILITY"]:
79    UNIFIED_SOURCES += [
80        "maiRedundantObjectFactory.c",
81    ]
82
83if CONFIG["MOZ_WAYLAND"]:
84    UNIFIED_SOURCES += [
85        "DMABufLibWrapper.cpp",
86        "DMABufSurface.cpp",
87        "MozContainerWayland.cpp",
88        "nsClipboardWayland.cpp",
89        "nsWaylandDisplay.cpp",
90        "WaylandShmBuffer.cpp",
91        "WindowSurfaceWayland.cpp",
92        "WindowSurfaceWaylandMultiBuffer.cpp",
93    ]
94    EXPORTS.mozilla.widget += [
95        "DMABufLibWrapper.h",
96        "DMABufSurface.h",
97        "MozContainerWayland.h",
98        "nsWaylandDisplay.h",
99        "WaylandShmBuffer.h",
100    ]
101
102if CONFIG["MOZ_X11"]:
103    UNIFIED_SOURCES += [
104        "CompositorWidgetChild.cpp",
105        "CompositorWidgetParent.cpp",
106        "InProcessGtkCompositorWidget.cpp",
107        "nsClipboardX11.cpp",
108        "nsShmImage.cpp",
109        "nsUserIdleServiceGTK.cpp",
110        "WindowSurfaceX11.cpp",
111        "WindowSurfaceX11Image.cpp",
112        "WindowSurfaceX11SHM.cpp",
113        "WindowSurfaceXRender.cpp",
114    ]
115    EXPORTS.mozilla.widget += [
116        "CompositorWidgetChild.h",
117        "CompositorWidgetParent.h",
118        "GtkCompositorWidget.h",
119        "InProcessGtkCompositorWidget.h",
120    ]
121
122if CONFIG["NS_PRINTING"]:
123    UNIFIED_SOURCES += [
124        "nsDeviceContextSpecG.cpp",
125        "nsPrintDialogGTK.cpp",
126        "nsPrintSettingsGTK.cpp",
127        "nsPrintSettingsServiceGTK.cpp",
128    ]
129
130XPCOM_MANIFESTS += [
131    "components.conf",
132]
133
134include("/ipc/chromium/chromium-config.mozbuild")
135
136FINAL_LIBRARY = "xul"
137
138LOCAL_INCLUDES += [
139    "/layout/base",
140    "/layout/forms",
141    "/layout/generic",
142    "/layout/xul",
143    "/other-licenses/atk-1.0",
144    "/third_party/cups/include",
145    "/widget",
146    "/widget/headless",
147]
148
149if CONFIG["MOZ_X11"]:
150    LOCAL_INCLUDES += [
151        "/widget/x11",
152    ]
153
154DEFINES["CAIRO_GFX"] = True
155
156DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"]
157
158# When building with GTK3, the widget code always needs to use
159# system Cairo headers, regardless of whether we are also linked
160# against and using in-tree Cairo. By not using in-tree Cairo
161# headers, we avoid picking up our renamed symbols, and instead
162# use only system Cairo symbols that GTK3 uses. This allows that
163# any Cairo objects created can be freely passed back and forth
164# between the widget code and GTK3.
165if not (CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" and CONFIG["MOZ_TREE_CAIRO"]):
166    CXXFLAGS += CONFIG["MOZ_CAIRO_CFLAGS"]
167
168CFLAGS += CONFIG["TK_CFLAGS"]
169CXXFLAGS += CONFIG["TK_CFLAGS"]
170
171if CONFIG["MOZ_WAYLAND"]:
172    CFLAGS += CONFIG["MOZ_WAYLAND_CFLAGS"]
173    CXXFLAGS += CONFIG["MOZ_WAYLAND_CFLAGS"]
174
175if CONFIG["MOZ_ENABLE_DBUS"]:
176    CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
177
178CXXFLAGS += ["-Wno-error=shadow"]
179CXXFLAGS += ["-Werror=switch"]
180