Bug 1628711 Remove #ifdef MOZ_WIDGET_GTK from widget/gtk, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D70391

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2020-04-14 12:35:34 +00:00
Родитель ee15f8367c
Коммит 1536f639a8
9 изменённых файлов: 14 добавлений и 45 удалений

Просмотреть файл

@ -77,7 +77,6 @@ static void delete_from_cursor_cb(GtkWidget* w, GtkDeleteType del_type,
bool forward = count > 0;
#ifdef MOZ_WIDGET_GTK
// Ignore GTK's Ctrl-K keybinding introduced in GTK 3.14 and removed in
// 3.18 if the user has custom bindings set. See bug 1176929.
if (del_type == GTK_DELETE_PARAGRAPH_ENDS && forward && GTK_IS_ENTRY(w) &&
@ -90,7 +89,6 @@ static void delete_from_cursor_cb(GtkWidget* w, GtkDeleteType del_type,
if (!array) return;
g_ptr_array_unref(array);
}
#endif
gHandled = true;
if (uint32_t(del_type) >= ArrayLength(sDeleteCommands)) {

Просмотреть файл

@ -77,14 +77,11 @@ UniquePtr<WindowSurface> WindowSurfaceProvider::CreateWindowSurface() {
// 1. XRender (iff XRender is enabled && we are in-process)
// 2. MIT-SHM
// 3. XPutImage
#ifdef MOZ_WIDGET_GTK
if (!mIsShaped && gfxVars::UseXRender()) {
LOGDRAW(("Drawing to Window 0x%lx will use XRender\n", mXWindow));
return MakeUnique<WindowSurfaceXRender>(mXDisplay, mXWindow, mXVisual,
mXDepth);
}
#endif // MOZ_WIDGET_GTK
#ifdef MOZ_HAVE_SHMIMAGE
if (!mIsShaped && nsShmImage::UseShm()) {

Просмотреть файл

@ -62,7 +62,6 @@ static gint PollWrapper(GPollFD* ufds, guint nfsd, gint timeout_) {
return result;
}
#ifdef MOZ_WIDGET_GTK
// For bug 726483.
static decltype(GtkContainerClass::check_resize) sReal_gtk_window_check_resize;
@ -109,7 +108,6 @@ static void WrapGdkFrameClockDispose(GObject* object) {
sRealGdkFrameClockDispose(object);
}
#endif
/*static*/
gboolean nsAppShell::EventProcessorCallback(GIOChannel* source,
@ -188,7 +186,6 @@ nsresult nsAppShell::Init() {
}
}
#ifdef MOZ_WIDGET_GTK
if (!sReal_gtk_window_check_resize &&
gtk_check_version(3, 8, 0) != nullptr) { // GTK 3.0 to GTK 3.6.
// GtkWindow is a static class and so will leak anyway but this ref
@ -218,10 +215,13 @@ nsresult nsAppShell::Init() {
}
// Workaround for bug 1209659 which is fixed by Gtk3.20
if (gtk_check_version(3, 20, 0) != nullptr) unsetenv("GTK_CSD");
#endif
if (gtk_check_version(3, 20, 0) != nullptr) {
unsetenv("GTK_CSD");
}
if (PR_GetEnv("MOZ_DEBUG_PAINTS")) gdk_window_set_debug_updates(TRUE);
if (PR_GetEnv("MOZ_DEBUG_PAINTS")) {
gdk_window_set_debug_updates(TRUE);
}
// Whitelist of only common, stable formats - see bugs 1197059 and 1203078
GSList* pixbufFormats = gdk_pixbuf_get_formats();

Просмотреть файл

@ -67,7 +67,7 @@ nsRetrievalContextX11::nsRetrievalContextX11()
mTargetMIMEType(gdk_atom_intern("TARGETS", FALSE)) {
// A custom event filter to workaround attempting to dereference a null
// selection requestor in GTK3 versions before 3.11.3. See bug 1178799.
#if defined(MOZ_WIDGET_GTK) && defined(MOZ_X11)
#if defined(MOZ_X11)
if (gtk_check_version(3, 11, 3))
gdk_window_add_filter(nullptr, selection_request_filter, nullptr);
#endif

Просмотреть файл

@ -225,12 +225,8 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIWidget* aWidget,
return NS_OK;
}
static void
#ifdef MOZ_WIDGET_GTK
print_callback(GtkPrintJob* aJob, gpointer aData, const GError* aError) {
#else
print_callback(GtkPrintJob* aJob, gpointer aData, GError* aError) {
#endif
static void print_callback(GtkPrintJob* aJob, gpointer aData,
const GError* aError) {
g_object_unref(aJob);
((nsIFile*)aData)->Remove(false);
}

Просмотреть файл

@ -156,12 +156,8 @@ NS_IMPL_ISUPPORTS(nsFilePicker, nsIFilePicker)
nsFilePicker::nsFilePicker()
: mSelectedType(0),
mRunning(false),
mAllowURLs(false)
#ifdef MOZ_WIDGET_GTK
,
mFileChooserDelegate(nullptr)
#endif
{
mAllowURLs(false),
mFileChooserDelegate(nullptr) {
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
giovfs->ShouldUseFlatpakPortal(&mUseNativeFileChooser);
}
@ -410,7 +406,6 @@ nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
nsAutoCString directory;
defaultPath->GetNativePath(directory);
#ifdef MOZ_WIDGET_GTK
// Workaround for problematic refcounting in GTK3 before 3.16.
// We need to keep a reference to the dialog's internal delegate.
// Otherwise, if our dialog gets destroyed, we'll lose the dialog's
@ -433,8 +428,6 @@ nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
g_object_ref(mFileChooserDelegate);
}
}
#endif
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(file_chooser),
directory.get());
}
@ -550,7 +543,6 @@ void nsFilePicker::Done(void* file_chooser, gint response) {
// been released.
GtkFileChooserDestroy(file_chooser);
#ifdef MOZ_WIDGET_GTK
if (mFileChooserDelegate) {
// Properly deref our acquired reference. We call this after
// gtk_widget_destroy() to try and ensure that pending file info
@ -565,7 +557,6 @@ void nsFilePicker::Done(void* file_chooser, gint response) {
mFileChooserDelegate);
mFileChooserDelegate = nullptr;
}
#endif
if (mCallback) {
mCallback->Done(result);

Просмотреть файл

@ -80,9 +80,7 @@ class nsFilePicker : public nsBaseFilePicker {
void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget,
gboolean modal);
#ifdef MOZ_WIDGET_GTK
GtkFileChooserWidget* mFileChooserDelegate;
#endif
bool mUseNativeFileChooser;
};

Просмотреть файл

@ -14,9 +14,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <dlfcn.h>
#ifdef MOZ_WIDGET_GTK
# include <gdk/gdkkeysyms-compat.h>
#endif
#include <gdk/gdkkeysyms-compat.h>
#include <X11/XKBlib.h>
#include "X11UndefineNone.h"
#include "IMContextWrapper.h"

Просмотреть файл

@ -572,11 +572,7 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
aGtkWidgetType = MOZ_GTK_ENTRY;
break;
case StyleAppearance::Textarea:
#ifdef MOZ_WIDGET_GTK
aGtkWidgetType = MOZ_GTK_TEXT_VIEW;
#else
aGtkWidgetType = MOZ_GTK_ENTRY;
#endif
break;
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
@ -1656,7 +1652,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
aResult->width += border.left + border.right;
aResult->height += border.top + border.bottom;
} break;
#ifdef MOZ_WIDGET_GTK
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield: {
@ -1664,7 +1659,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
? &aResult->width
: &aResult->height);
} break;
#endif
case StyleAppearance::Separator: {
gint separator_width;
@ -1915,9 +1909,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Splitter:
case StyleAppearance::Window:
case StyleAppearance::Dialog:
#ifdef MOZ_WIDGET_GTK
case StyleAppearance::MozGtkInfoBar:
#endif
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
case StyleAppearance::MozWindowButtonBox:
@ -1990,14 +1982,13 @@ nsITheme::Transparency nsNativeThemeGTK::GetWidgetTransparency(
return eOpaque;
case StyleAppearance::ScrollbarVertical:
case StyleAppearance::ScrollbarHorizontal:
#ifdef MOZ_WIDGET_GTK
// Make scrollbar tracks opaque on the window's scroll frame to prevent
// leaf layers from overlapping. See bug 1179780.
if (!(CheckBooleanAttr(aFrame, nsGkAtoms::root_) &&
aFrame->PresContext()->IsRootContentDocument() &&
IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)))
IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL))) {
return eTransparent;
#endif
}
return eOpaque;
// Tooltips use gtk_paint_flat_box() on Gtk2
// but are shaped on Gtk3