mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 1278282 - Remove the 'MOZ_WIDGET_GTK == 2' defines r=karlt,lsalzman
MozReview-Commit-ID: 3v8D600g8St --HG-- extra : rebase_source : 34ea6f9868c1b322076c24daa75dc33e27b6704e
This commit is contained in:
parent
4b189b7baf
commit
424664ff30
@ -69,14 +69,6 @@ static GnomeAccessibilityModule sAtkBridge = {
|
||||
"gnome_accessibility_module_shutdown", nullptr
|
||||
};
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static GnomeAccessibilityModule sGail = {
|
||||
"libgail.so", nullptr,
|
||||
"gnome_accessibility_module_init", nullptr,
|
||||
"gnome_accessibility_module_shutdown", nullptr
|
||||
};
|
||||
#endif
|
||||
|
||||
static nsresult
|
||||
LoadGtkModule(GnomeAccessibilityModule& aModule)
|
||||
{
|
||||
@ -102,11 +94,7 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
|
||||
else
|
||||
subLen = loc2 - loc1;
|
||||
nsAutoCString sub(Substring(libPath, loc1, subLen));
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
sub.AppendLiteral("/gtk-2.0/modules/");
|
||||
#else
|
||||
sub.AppendLiteral("/gtk-3.0/modules/");
|
||||
#endif
|
||||
sub.Append(aModule.libName);
|
||||
aModule.lib = PR_LoadLibrary(sub.get());
|
||||
if (aModule.lib)
|
||||
@ -176,13 +164,6 @@ a11y::PlatformInit()
|
||||
}
|
||||
}
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
// Load and initialize gail library.
|
||||
nsresult rv = LoadGtkModule(sGail);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
(*sGail.init)();
|
||||
#endif
|
||||
|
||||
// Initialize the MAI Utility class, it will overwrite gail_util.
|
||||
g_type_class_unref(g_type_class_ref(mai_util_get_type()));
|
||||
|
||||
@ -236,19 +217,6 @@ a11y::PlatformShutdown()
|
||||
sAtkBridge.init = nullptr;
|
||||
sAtkBridge.shutdown = nullptr;
|
||||
}
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (sGail.lib) {
|
||||
// Do not shutdown gail because
|
||||
// 1) Maybe it's not init-ed by us. e.g. GtkEmbed
|
||||
// 2) We need it to avoid assert in spi_atk_tidy_windows
|
||||
// if (sGail.shutdown)
|
||||
// (*sGail.shutdown)();
|
||||
// PR_UnloadLibrary(sGail.lib);
|
||||
sGail.lib = nullptr;
|
||||
sGail.init = nullptr;
|
||||
sGail.shutdown = nullptr;
|
||||
}
|
||||
#endif
|
||||
// if (sATKLib) {
|
||||
// PR_UnloadLibrary(sATKLib);
|
||||
// sATKLib = nullptr;
|
||||
|
@ -57,9 +57,6 @@
|
||||
#if (MOZ_WIDGET_GTK)
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
#include "gtk2xtbin.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "nsJSUtils.h"
|
||||
@ -1341,19 +1338,6 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
}
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
// adobe nppdf calls XtGetApplicationNameAndClass(display,
|
||||
// &instance, &class) we have to init Xt toolkit before get
|
||||
// XtDisplay just call gtk_xtbin_new(w,0) once
|
||||
static GtkWidget *gtkXtBinHolder = 0;
|
||||
if (!gtkXtBinHolder) {
|
||||
gtkXtBinHolder = gtk_xtbin_new(gdk_get_default_root_window(),0);
|
||||
// it crashes on destroy, let it leak
|
||||
// gtk_widget_destroy(gtkXtBinHolder);
|
||||
}
|
||||
(*(Display **)result) = GTK_XTBIN(gtkXtBinHolder)->xtdisplay;
|
||||
return NPERR_NO_ERROR;
|
||||
#endif
|
||||
#endif
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
@ -39,172 +39,6 @@
|
||||
#define DEFAULT_X11_PATH ""
|
||||
#endif
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
|
||||
#define PLUGIN_MAX_LEN_OF_TMP_ARR 512
|
||||
|
||||
static void DisplayPR_LoadLibraryErrorMessage(const char *libName)
|
||||
{
|
||||
char errorMsg[PLUGIN_MAX_LEN_OF_TMP_ARR] = "Cannot get error from NSPR.";
|
||||
if (PR_GetErrorTextLength() < (int) sizeof(errorMsg))
|
||||
PR_GetErrorText(errorMsg);
|
||||
|
||||
fprintf(stderr, "LoadPlugin: failed to initialize shared library %s [%s]\n",
|
||||
libName, errorMsg);
|
||||
}
|
||||
|
||||
static void SearchForSoname(const char* name, char** soname)
|
||||
{
|
||||
if (!(name && soname))
|
||||
return;
|
||||
PRDir *fdDir = PR_OpenDir(DEFAULT_X11_PATH);
|
||||
if (!fdDir)
|
||||
return;
|
||||
|
||||
int n = strlen(name);
|
||||
PRDirEntry *dirEntry;
|
||||
while ((dirEntry = PR_ReadDir(fdDir, PR_SKIP_BOTH))) {
|
||||
if (!PL_strncmp(dirEntry->name, name, n)) {
|
||||
if (dirEntry->name[n] == '.' && dirEntry->name[n+1] && !dirEntry->name[n+2]) {
|
||||
// name.N, wild guess this is what we need
|
||||
char out[PLUGIN_MAX_LEN_OF_TMP_ARR] = DEFAULT_X11_PATH;
|
||||
PL_strcat(out, dirEntry->name);
|
||||
*soname = PL_strdup(out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_CloseDir(fdDir);
|
||||
}
|
||||
|
||||
static bool LoadExtraSharedLib(const char *name, char **soname, bool tryToGetSoname)
|
||||
{
|
||||
bool ret = true;
|
||||
PRLibSpec tempSpec;
|
||||
PRLibrary *handle;
|
||||
tempSpec.type = PR_LibSpec_Pathname;
|
||||
tempSpec.value.pathname = name;
|
||||
handle = PR_LoadLibraryWithFlags(tempSpec, PR_LD_NOW|PR_LD_GLOBAL);
|
||||
if (!handle) {
|
||||
ret = false;
|
||||
DisplayPR_LoadLibraryErrorMessage(name);
|
||||
if (tryToGetSoname) {
|
||||
SearchForSoname(name, soname);
|
||||
if (*soname) {
|
||||
ret = LoadExtraSharedLib((const char *) *soname, nullptr, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32
|
||||
#define PREF_PLUGINS_SONAME "plugin.soname.list"
|
||||
#if defined(SOLARIS) || defined(HPUX)
|
||||
#define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX ":libXm" LOCAL_PLUGIN_DLL_SUFFIX
|
||||
#else
|
||||
#define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX
|
||||
#endif
|
||||
/*
|
||||
this function looks for
|
||||
user_pref("plugin.soname.list", "/usr/X11R6/lib/libXt.so.6:libXext.so");
|
||||
in user's pref.js
|
||||
and loads all libs in specified order
|
||||
*/
|
||||
|
||||
static void LoadExtraSharedLibs()
|
||||
{
|
||||
// check out if user's prefs.js has libs name
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
|
||||
if (NS_SUCCEEDED(res) && (prefs != nullptr)) {
|
||||
char *sonameList = nullptr;
|
||||
bool prefSonameListIsSet = true;
|
||||
res = prefs->GetCharPref(PREF_PLUGINS_SONAME, &sonameList);
|
||||
if (!sonameList) {
|
||||
// pref is not set, lets use hardcoded list
|
||||
prefSonameListIsSet = false;
|
||||
sonameList = PL_strdup(DEFAULT_EXTRA_LIBS_LIST);
|
||||
}
|
||||
if (sonameList) {
|
||||
char *arrayOfLibs[PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS] = {0};
|
||||
int numOfLibs = 0;
|
||||
char *nextToken;
|
||||
char *p = nsCRT::strtok(sonameList,":",&nextToken);
|
||||
if (p) {
|
||||
while (p && numOfLibs < PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS) {
|
||||
arrayOfLibs[numOfLibs++] = p;
|
||||
p = nsCRT::strtok(nextToken,":",&nextToken);
|
||||
}
|
||||
} else // there is just one lib
|
||||
arrayOfLibs[numOfLibs++] = sonameList;
|
||||
|
||||
char sonameListToSave[PLUGIN_MAX_LEN_OF_TMP_ARR] = "";
|
||||
for (int i=0; i<numOfLibs; i++) {
|
||||
// trim out head/tail white spaces (just in case)
|
||||
bool head = true;
|
||||
p = arrayOfLibs[i];
|
||||
while (*p) {
|
||||
if (*p == ' ' || *p == '\t') {
|
||||
if (head) {
|
||||
arrayOfLibs[i] = ++p;
|
||||
} else {
|
||||
*p = 0;
|
||||
}
|
||||
} else {
|
||||
head = false;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
if (!arrayOfLibs[i][0]) {
|
||||
continue; // null string
|
||||
}
|
||||
bool tryToGetSoname = true;
|
||||
if (PL_strchr(arrayOfLibs[i], '/')) {
|
||||
//assuming it's real name, try to stat it
|
||||
struct stat st;
|
||||
if (stat((const char*) arrayOfLibs[i], &st)) {
|
||||
//get just a file name
|
||||
arrayOfLibs[i] = PL_strrchr(arrayOfLibs[i], '/') + 1;
|
||||
} else
|
||||
tryToGetSoname = false;
|
||||
}
|
||||
char *soname = nullptr;
|
||||
if (LoadExtraSharedLib(arrayOfLibs[i], &soname, tryToGetSoname)) {
|
||||
//construct soname's list to save in prefs
|
||||
p = soname ? soname : arrayOfLibs[i];
|
||||
int n = PLUGIN_MAX_LEN_OF_TMP_ARR -
|
||||
(strlen(sonameListToSave) + strlen(p));
|
||||
if (n > 0) {
|
||||
PL_strcat(sonameListToSave, p);
|
||||
PL_strcat(sonameListToSave,":");
|
||||
}
|
||||
if (soname) {
|
||||
PL_strfree(soname); // it's from strdup
|
||||
}
|
||||
if (numOfLibs > 1)
|
||||
arrayOfLibs[i][strlen(arrayOfLibs[i])] = ':'; //restore ":" in sonameList
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether sonameListToSave is a empty String, Bug: 329205
|
||||
if (sonameListToSave[0])
|
||||
for (p = &sonameListToSave[strlen(sonameListToSave) - 1]; *p == ':'; p--)
|
||||
*p = 0; //delete tail ":" delimiters
|
||||
|
||||
if (!prefSonameListIsSet || PL_strcmp(sonameList, sonameListToSave)) {
|
||||
// if user specified some bogus soname I overwrite it here,
|
||||
// otherwise it'll decrease performance by calling popen() in SearchForSoname
|
||||
// every time for each bogus name
|
||||
prefs->SetCharPref(PREF_PLUGINS_SONAME, (const char *)sonameListToSave);
|
||||
}
|
||||
PL_strfree(sonameList);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //MOZ_WIDGET_GTK == 2
|
||||
|
||||
/* nsPluginsDir implementation */
|
||||
|
||||
bool nsPluginsDir::IsPluginFile(nsIFile* file)
|
||||
@ -255,43 +89,8 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
|
||||
|
||||
libSpec.value.pathname = path.get();
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
|
||||
// Normally, Mozilla isn't linked against libXt and libXext
|
||||
// since it's a Gtk/Gdk application. On the other hand,
|
||||
// legacy plug-ins expect the libXt and libXext symbols
|
||||
// to already exist in the global name space. This plug-in
|
||||
// wrapper is linked against libXt and libXext, but since
|
||||
// we never call on any of these libraries, plug-ins still
|
||||
// fail to resolve Xt symbols when trying to do a dlopen
|
||||
// at runtime. Explicitly opening Xt/Xext into the global
|
||||
// namespace before attempting to load the plug-in seems to
|
||||
// work fine.
|
||||
|
||||
|
||||
#if defined(SOLARIS) || defined(HPUX)
|
||||
// Acrobat/libXm: Lazy resolving might cause crash later (bug 211587)
|
||||
*outLibrary = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW);
|
||||
pLibrary = *outLibrary;
|
||||
#else
|
||||
// Some dlopen() doesn't recover from a failed PR_LD_NOW (bug 223744)
|
||||
*outLibrary = PR_LoadLibraryWithFlags(libSpec, 0);
|
||||
pLibrary = *outLibrary;
|
||||
#endif
|
||||
if (!pLibrary) {
|
||||
LoadExtraSharedLibs();
|
||||
// try reload plugin once more
|
||||
*outLibrary = PR_LoadLibraryWithFlags(libSpec, 0);
|
||||
pLibrary = *outLibrary;
|
||||
if (!pLibrary) {
|
||||
DisplayPR_LoadLibraryErrorMessage(libSpec.value.pathname);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
*outLibrary = PR_LoadLibraryWithFlags(libSpec, 0);
|
||||
pLibrary = *outLibrary;
|
||||
#endif // MOZ_WIDGET_GTK == 2
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("LoadPlugin() %s returned %lx\n",
|
||||
|
@ -12,58 +12,5 @@
|
||||
#include "cairo-xlib.h"
|
||||
#include "gfxXlibSurface.h"
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
nsresult
|
||||
gfxGdkNativeRenderer::DrawWithXlib(cairo_surface_t* surface,
|
||||
nsIntPoint offset,
|
||||
mozilla::gfx::IntRect* clipRects, uint32_t numClipRects)
|
||||
{
|
||||
GdkDrawable *drawable = gfxPlatformGtk::GetGdkDrawable(surface);
|
||||
if (!drawable) {
|
||||
int depth = cairo_xlib_surface_get_depth(surface);
|
||||
GdkScreen* screen = gdk_colormap_get_screen(mColormap);
|
||||
drawable =
|
||||
gdk_pixmap_foreign_new_for_screen(screen, cairo_xlib_surface_get_drawable(surface),
|
||||
cairo_xlib_surface_get_width(surface),
|
||||
cairo_xlib_surface_get_height(surface),
|
||||
depth);
|
||||
if (!drawable)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gdk_drawable_set_colormap(drawable, mColormap);
|
||||
gfxPlatformGtk::SetGdkDrawable(surface, drawable);
|
||||
g_object_unref(drawable); // The drawable now belongs to |surface|.
|
||||
}
|
||||
|
||||
GdkRectangle clipRect;
|
||||
if (numClipRects) {
|
||||
NS_ASSERTION(numClipRects == 1, "Too many clip rects");
|
||||
clipRect.x = clipRects[0].x;
|
||||
clipRect.y = clipRects[0].y;
|
||||
clipRect.width = clipRects[0].width;
|
||||
clipRect.height = clipRects[0].height;
|
||||
}
|
||||
|
||||
return DrawWithGDK(drawable, offset.x, offset.y,
|
||||
numClipRects ? &clipRect : nullptr, numClipRects);
|
||||
}
|
||||
|
||||
void
|
||||
gfxGdkNativeRenderer::Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
|
||||
uint32_t flags, GdkColormap* colormap)
|
||||
{
|
||||
mColormap = colormap;
|
||||
|
||||
Visual* visual =
|
||||
gdk_x11_visual_get_xvisual(gdk_colormap_get_visual(colormap));
|
||||
Screen* screen =
|
||||
gdk_x11_screen_get_xscreen(gdk_colormap_get_screen(colormap));
|
||||
|
||||
gfxXlibNativeRenderer::Draw(ctx, size, flags, screen, visual);
|
||||
}
|
||||
|
||||
#else
|
||||
// TODO GTK3
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -35,11 +35,6 @@ public:
|
||||
* no clipping is required
|
||||
*/
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
virtual nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX,
|
||||
gint offsetY, GdkRectangle * clipRects, uint32_t numClipRects) = 0;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
// If set, then Draw() is opaque, i.e., every pixel in the intersection
|
||||
// of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
|
||||
@ -67,10 +62,6 @@ public:
|
||||
* the rectangle (offset.x,offset.y,bounds.width,bounds.height)
|
||||
* @param dpy a display to use for the drawing if ctx doesn't have one
|
||||
*/
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
void Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
|
||||
uint32_t flags, GdkColormap* colormap);
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef MOZ_X11
|
||||
@ -79,9 +70,6 @@ private:
|
||||
nsIntPoint offset,
|
||||
mozilla::gfx::IntRect* clipRects, uint32_t numClipRects) override;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkColormap *mColormap;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -67,10 +67,6 @@ using namespace mozilla::gfx;
|
||||
using namespace mozilla::unicode;
|
||||
using mozilla::dom::SystemFontListEntry;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static cairo_user_data_key_t cairo_gdk_drawable_key;
|
||||
#endif
|
||||
|
||||
gfxPlatformGtk::gfxPlatformGtk()
|
||||
{
|
||||
if (!gfxPlatform::IsHeadless()) {
|
||||
@ -532,51 +528,6 @@ gfxPlatformGtk::GetPlatformCMSOutputProfile(void *&mem, size_t &size)
|
||||
}
|
||||
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
void
|
||||
gfxPlatformGtk::SetGdkDrawable(cairo_surface_t *target,
|
||||
GdkDrawable *drawable)
|
||||
{
|
||||
if (cairo_surface_status(target))
|
||||
return;
|
||||
|
||||
g_object_ref(drawable);
|
||||
|
||||
cairo_surface_set_user_data (target,
|
||||
&cairo_gdk_drawable_key,
|
||||
drawable,
|
||||
g_object_unref);
|
||||
}
|
||||
|
||||
GdkDrawable *
|
||||
gfxPlatformGtk::GetGdkDrawable(cairo_surface_t *target)
|
||||
{
|
||||
if (cairo_surface_status(target))
|
||||
return nullptr;
|
||||
|
||||
GdkDrawable *result;
|
||||
|
||||
result = (GdkDrawable*) cairo_surface_get_user_data (target,
|
||||
&cairo_gdk_drawable_key);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
if (cairo_surface_get_type(target) != CAIRO_SURFACE_TYPE_XLIB)
|
||||
return nullptr;
|
||||
|
||||
// try looking it up in gdk's table
|
||||
result = (GdkDrawable*) gdk_xid_table_lookup(cairo_xlib_surface_get_drawable(target));
|
||||
if (result) {
|
||||
SetGdkDrawable(target, result);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GL_PROVIDER_GLX
|
||||
|
||||
class GLXVsyncSource final : public VsyncSource
|
||||
|
@ -11,12 +11,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
extern "C" {
|
||||
typedef struct _GdkDrawable GdkDrawable;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
struct _XDisplay;
|
||||
typedef struct _XDisplay Display;
|
||||
@ -94,12 +88,6 @@ public:
|
||||
|
||||
FT_Library GetFTLibrary() override;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static void SetGdkDrawable(cairo_surface_t *target,
|
||||
GdkDrawable *drawable);
|
||||
static GdkDrawable *GetGdkDrawable(cairo_surface_t *target);
|
||||
#endif
|
||||
|
||||
static int32_t GetFontScaleDPI();
|
||||
static double GetFontScaleFactor();
|
||||
|
||||
|
@ -46,9 +46,6 @@ static const mozilla::Module::CategoryEntry kIconCategories[] = {
|
||||
static void
|
||||
IconDecoderModuleDtor()
|
||||
{
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
nsIconChannel::Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
static const mozilla::Module kIconModule = {
|
||||
|
@ -2300,14 +2300,6 @@ nsMenuPopupFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
if (aAttribute == nsGkAtoms::left || aAttribute == nsGkAtoms::top)
|
||||
MoveToAttributePosition();
|
||||
|
||||
#ifndef MOZ_GTK2
|
||||
if (aAttribute == nsGkAtoms::noautohide) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm)
|
||||
pm->EnableRollup(mContent, !IsNoAutoHide());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aAttribute == nsGkAtoms::remote) {
|
||||
// When the remote attribute changes, we need to create a new widget to
|
||||
// ensure that it has the correct compositor and transparency settings to
|
||||
|
@ -4487,11 +4487,7 @@ pref("ui.panel.default_level_parent", true);
|
||||
|
||||
pref("mousewheel.system_scroll_override_on_root_content.enabled", false);
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
pref("intl.ime.use_simple_context_on_password_field", true);
|
||||
#else
|
||||
pref("intl.ime.use_simple_context_on_password_field", false);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
// maximum number of fonts to substitute for a generic
|
||||
|
@ -129,16 +129,9 @@ int main(int argc, char** argv)
|
||||
|
||||
GdkPixbuf* screenshot = nullptr;
|
||||
GdkWindow* window = gdk_get_default_root_window();
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
screenshot = gdk_pixbuf_get_from_drawable(nullptr, window, nullptr,
|
||||
0, 0, 0, 0,
|
||||
gdk_screen_width(),
|
||||
gdk_screen_height());
|
||||
#else
|
||||
screenshot = gdk_pixbuf_get_from_window(window, 0, 0,
|
||||
gdk_window_get_width(window),
|
||||
gdk_window_get_height(window));
|
||||
#endif
|
||||
if (!screenshot) {
|
||||
fprintf(stderr, "%s: failed to create screenshot GdkPixbuf\n", argv[0]);
|
||||
return 1;
|
||||
|
@ -104,11 +104,7 @@ nsGTKRemoteService::HandleCommandsFor(GtkWidget* widget,
|
||||
|
||||
gtk_widget_add_events(widget, GDK_PROPERTY_CHANGE_MASK);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
Window window = GDK_WINDOW_XWINDOW(widget->window);
|
||||
#else
|
||||
Window window = gdk_x11_window_get_xid(gtk_widget_get_window(widget));
|
||||
#endif
|
||||
nsXRemoteService::HandleCommandsFor(window);
|
||||
}
|
||||
|
||||
@ -120,11 +116,7 @@ nsGTKRemoteService::HandlePropertyChange(GtkWidget *aWidget,
|
||||
if (pevent->state == GDK_PROPERTY_NEW_VALUE) {
|
||||
Atom changedAtom = gdk_x11_atom_to_xatom(pevent->atom);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
XID window = GDK_WINDOW_XWINDOW(pevent->window);
|
||||
#else
|
||||
XID window = gdk_x11_window_get_xid(gtk_widget_get_window(aWidget));
|
||||
#endif
|
||||
return HandleNewProperty(window,
|
||||
GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
|
||||
pevent->time, changedAtom, aThis);
|
||||
|
@ -425,11 +425,7 @@ bool UIShowCrashUI(const StringTable& files,
|
||||
gtk_label_new(gStrings[ST_CRASHREPORTERDESCRIPTION].c_str());
|
||||
gtk_box_pack_start(GTK_BOX(vbox), descriptionLabel, TRUE, TRUE, 0);
|
||||
// force the label to line wrap
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_widget_set_size_request(descriptionLabel, 400, -1);
|
||||
#else
|
||||
gtk_label_set_max_width_chars(GTK_LABEL(descriptionLabel), LABEL_MAX_CHAR_WIDTH);
|
||||
#endif
|
||||
gtk_label_set_line_wrap(GTK_LABEL(descriptionLabel), TRUE);
|
||||
gtk_label_set_selectable(GTK_LABEL(descriptionLabel), TRUE);
|
||||
gtk_misc_set_alignment(GTK_MISC(descriptionLabel), 0, 0.5);
|
||||
@ -534,11 +530,7 @@ bool UIShowCrashUI(const StringTable& files,
|
||||
gtk_label_new(gStrings[ST_REPORTPRESUBMIT].c_str());
|
||||
gtk_box_pack_start(GTK_BOX(progressBox), gProgressLabel, TRUE, TRUE, 0);
|
||||
// force the label to line wrap
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_widget_set_size_request(gProgressLabel, 400, -1);
|
||||
#else
|
||||
gtk_label_set_max_width_chars(GTK_LABEL(gProgressLabel), LABEL_MAX_CHAR_WIDTH);
|
||||
#endif
|
||||
gtk_label_set_line_wrap(GTK_LABEL(gProgressLabel), TRUE);
|
||||
|
||||
GtkWidget* buttonBox = gtk_hbutton_box_new();
|
||||
|
@ -27,10 +27,6 @@
|
||||
#include <fcntl.h>
|
||||
#include "stdint.h"
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
@ -74,11 +70,6 @@ extern pid_t glxtest_pid;
|
||||
// the write end of the pipe, which we're going to write to
|
||||
static int write_end_of_the_pipe = -1;
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
static int gtk_write_end_of_the_pipe = -1;
|
||||
int gtk_read_end_of_the_pipe = -1;
|
||||
#endif
|
||||
|
||||
// C++ standard collides with C standard in that it doesn't allow casting void* to function pointer types.
|
||||
// So the work-around is to convert first to size_t.
|
||||
// http://www.trilithium.com/johan/2004/12/problem-with-dlsym/
|
||||
@ -129,36 +120,6 @@ void glxtest()
|
||||
dup2(fd, i);
|
||||
close(fd);
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
// On Gtk+2 builds, try to get the Gtk+3 version if it's installed, and
|
||||
// use that in nsSystemInfo for secondaryLibrary. Better safe than sorry,
|
||||
// we want to load the Gtk+3 library in a subprocess, and since we already
|
||||
// have such a subprocess for the GLX test, we piggy back on it.
|
||||
void *gtk3 = dlopen("libgtk-3.so.0", RTLD_LOCAL | RTLD_LAZY);
|
||||
if (gtk3) {
|
||||
auto gtk_get_major_version = reinterpret_cast<guint (*)(void)>(
|
||||
dlsym(gtk3, "gtk_get_major_version"));
|
||||
auto gtk_get_minor_version = reinterpret_cast<guint (*)(void)>(
|
||||
dlsym(gtk3, "gtk_get_minor_version"));
|
||||
auto gtk_get_micro_version = reinterpret_cast<guint (*)(void)>(
|
||||
dlsym(gtk3, "gtk_get_micro_version"));
|
||||
|
||||
if (gtk_get_major_version && gtk_get_minor_version &&
|
||||
gtk_get_micro_version) {
|
||||
// 64 bytes is going to be well enough for "GTK " followed by 3 integers
|
||||
// separated with dots.
|
||||
char gtkver[64];
|
||||
int len = snprintf(gtkver, sizeof(gtkver), "GTK %u.%u.%u",
|
||||
gtk_get_major_version(), gtk_get_minor_version(),
|
||||
gtk_get_micro_version());
|
||||
if (len > 0 && size_t(len) < sizeof(gtkver)) {
|
||||
mozilla::Unused << write(gtk_write_end_of_the_pipe, gtkver, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (getenv("MOZ_AVOID_OPENGL_ALTOGETHER"))
|
||||
fatal_error("The MOZ_AVOID_OPENGL_ALTOGETHER environment variable is defined");
|
||||
|
||||
@ -303,22 +264,11 @@ bool fire_glxtest_process()
|
||||
perror("pipe");
|
||||
return false;
|
||||
}
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
int gtkpfd[2];
|
||||
if (pipe(gtkpfd) == -1) {
|
||||
perror("pipe");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
perror("fork");
|
||||
close(pfd[0]);
|
||||
close(pfd[1]);
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
close(gtkpfd[0]);
|
||||
close(gtkpfd[1]);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
// The child exits early to avoid running the full shutdown sequence and avoid conflicting with threads
|
||||
@ -326,24 +276,13 @@ bool fire_glxtest_process()
|
||||
if (pid == 0) {
|
||||
close(pfd[0]);
|
||||
write_end_of_the_pipe = pfd[1];
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
close(gtkpfd[0]);
|
||||
gtk_write_end_of_the_pipe = gtkpfd[1];
|
||||
#endif
|
||||
glxtest();
|
||||
close(pfd[1]);
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
close(gtkpfd[1]);
|
||||
#endif
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
close(pfd[1]);
|
||||
mozilla::widget::glxtest_pipe = pfd[0];
|
||||
mozilla::widget::glxtest_pid = pid;
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
close(gtkpfd[1]);
|
||||
gtk_read_end_of_the_pipe = gtkpfd[0];
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -3864,10 +3864,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
// in nsAppShell::Create, but we need to get in before gtk
|
||||
// has been initialized to make sure everything is running
|
||||
// consistently.
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (CheckArg("install"))
|
||||
gdk_rgb_set_install(TRUE);
|
||||
#endif
|
||||
|
||||
// Set program name to the one defined in application.ini.
|
||||
{
|
||||
@ -4072,9 +4068,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
g_set_application_name(mAppData->name);
|
||||
gtk_window_set_auto_startup_notification(false);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_widget_set_default_colormap(gdk_rgb_get_colormap());
|
||||
#endif /* (MOZ_WIDGET_GTK == 2) */
|
||||
#endif /* defined(MOZ_WIDGET_GTK) */
|
||||
#ifdef MOZ_X11
|
||||
// Do this after initializing GDK, or GDK will install its own handler.
|
||||
@ -4716,25 +4709,6 @@ XREMain::XRE_mainRun()
|
||||
return rv;
|
||||
}
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
void XRE_GlibInit()
|
||||
{
|
||||
static bool ran_once = false;
|
||||
|
||||
// glib < 2.24 doesn't want g_thread_init to be invoked twice, so ensure
|
||||
// we only do it once. No need for thread safety here, since this is invoked
|
||||
// well before any thread is spawned.
|
||||
if (!ran_once) {
|
||||
// glib version < 2.36 doesn't initialize g_slice in a static initializer.
|
||||
// Ensure this happens through g_thread_init (glib version < 2.32) or
|
||||
// g_type_init (2.32 <= gLib version < 2.36)."
|
||||
g_thread_init(nullptr);
|
||||
g_type_init();
|
||||
ran_once = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XRE_main - A class based main entry point used by most platforms.
|
||||
* Note that on OSX, aAppData->xreDirectory will point to
|
||||
@ -4842,10 +4816,6 @@ XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig)
|
||||
mozilla::mscom::MainThreadRuntime msCOMRuntime;
|
||||
#endif
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
XRE_GlibInit();
|
||||
#endif
|
||||
|
||||
// init
|
||||
bool exit = false;
|
||||
int result = XRE_mainInit(&exit);
|
||||
|
@ -515,9 +515,6 @@ XRE_InitChildProcess(int aArgc,
|
||||
#ifdef MOZ_X11
|
||||
XInitThreads();
|
||||
#endif
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
XRE_GlibInit();
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
// Setting the name here avoids the need to pass this through to gtk_init().
|
||||
g_set_prgname(aArgv[0]);
|
||||
|
@ -460,26 +460,6 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
dbus_threads_init_default();
|
||||
#endif
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (gtk_major_version < MIN_GTK_MAJOR_VERSION ||
|
||||
(gtk_major_version == MIN_GTK_MAJOR_VERSION && gtk_minor_version < MIN_GTK_MINOR_VERSION)) {
|
||||
GtkWidget* versionErrDialog = gtk_message_dialog_new(nullptr,
|
||||
GtkDialogFlags(GTK_DIALOG_MODAL |
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT),
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
UNSUPPORTED_GTK_MSG,
|
||||
gtk_major_version,
|
||||
gtk_minor_version,
|
||||
MIN_GTK_MAJOR_VERSION,
|
||||
MIN_GTK_MINOR_VERSION);
|
||||
gtk_dialog_run(GTK_DIALOG(versionErrDialog));
|
||||
gtk_widget_destroy(versionErrDialog);
|
||||
MozExpectedExit();
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
*aRetVal = true;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
|
@ -57,17 +57,6 @@ X11Error(Display *display, XErrorEvent *event) {
|
||||
XFreeExtensionList(extNames);
|
||||
}
|
||||
XCloseDisplay(tmpDisplay);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
// GDK2 calls XCloseDevice the devices that it opened on startup, but
|
||||
// the XI protocol no longer ensures that the devices will still exist.
|
||||
// If they have been removed, then a BadDevice error results. Ignore
|
||||
// this error.
|
||||
if (message.EqualsLiteral("XInputExtension.4") &&
|
||||
event->error_code == first_error + 0) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ public:
|
||||
virtual ~GetTextRangeStyleText() {};
|
||||
};
|
||||
|
||||
const static bool kUseSimpleContextDefault = MOZ_WIDGET_GTK == 2;
|
||||
const static bool kUseSimpleContextDefault = false;
|
||||
|
||||
/******************************************************************************
|
||||
* IMContextWrapper
|
||||
@ -432,12 +432,7 @@ IMContextWrapper::OnDestroyWindow(nsWindow* aWindow)
|
||||
void
|
||||
IMContextWrapper::PrepareToDestroyContext(GtkIMContext* aContext)
|
||||
{
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT(aContext);
|
||||
GtkIMContext *slave = multicontext->slave;
|
||||
#else
|
||||
GtkIMContext *slave = nullptr; //TODO GTK3
|
||||
#endif
|
||||
if (!slave) {
|
||||
return;
|
||||
}
|
||||
|
@ -360,13 +360,8 @@ NativeKeyBindings::GetEditCommandsInternal(const WidgetKeyboardEvent& aEvent,
|
||||
gCurrentCommands = &aCommands;
|
||||
|
||||
gHandled = false;
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_bindings_activate(GTK_OBJECT(mNativeTarget),
|
||||
aKeyval, GdkModifierType(modifiers));
|
||||
#else
|
||||
gtk_bindings_activate(G_OBJECT(mNativeTarget),
|
||||
aKeyval, GdkModifierType(modifiers));
|
||||
#endif
|
||||
|
||||
gCurrentCommands = nullptr;
|
||||
|
||||
|
@ -19,12 +19,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
/*** type definitions ***/
|
||||
typedef struct {
|
||||
guint8 active;
|
||||
@ -335,38 +329,22 @@ void moz_gtk_refresh();
|
||||
*/
|
||||
gint moz_gtk_shutdown();
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
/**
|
||||
* Retrieves the colormap to use for drawables passed to moz_gtk_widget_paint.
|
||||
*/
|
||||
GdkColormap* moz_gtk_widget_get_colormap();
|
||||
#endif
|
||||
|
||||
/*** Widget drawing ***/
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
/**
|
||||
* Paint a widget in the current theme.
|
||||
* widget: a constant giving the widget to paint
|
||||
* drawable: the drawable to paint to;
|
||||
* it's colormap must be moz_gtk_widget_get_colormap().
|
||||
* rect: the bounding rectangle for the widget
|
||||
* cliprect: a clipprect rectangle for this painting operation
|
||||
* state: the state of the widget. ignored for some widgets.
|
||||
* flags: widget-dependant flags; see the WidgetNodeType definition.
|
||||
* direction: the text direction, to draw the widget correctly LTR and RTL.
|
||||
*/
|
||||
gint
|
||||
moz_gtk_widget_paint(WidgetNodeType widget, GdkDrawable* drawable,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect,
|
||||
GtkWidgetState* state, gint flags,
|
||||
GtkTextDirection direction);
|
||||
#else
|
||||
gint
|
||||
moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
|
||||
GdkRectangle* rect,
|
||||
GtkWidgetState* state, gint flags,
|
||||
GtkTextDirection direction);
|
||||
#endif
|
||||
|
||||
|
||||
/*** Widget metrics ***/
|
||||
@ -574,10 +552,4 @@ gint moz_gtk_splitter_get_metrics(gint orientation, gint* size);
|
||||
gint
|
||||
moz_gtk_get_tab_thickness(WidgetNodeType aNodeType);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -350,19 +350,8 @@ moz_container_realize (GtkWidget *widget)
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes_mask |= GDK_WA_COLORMAP;
|
||||
#endif
|
||||
|
||||
window = gdk_window_new (parent, &attributes, attributes_mask);
|
||||
gdk_window_set_user_data (window, widget);
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
/* TODO GTK3? */
|
||||
/* set the back pixmap to None so that you don't end up with the gtk
|
||||
default which is BlackPixel */
|
||||
gdk_window_set_back_pixmap (window, NULL, FALSE);
|
||||
#endif
|
||||
} else {
|
||||
window = parent;
|
||||
g_object_ref (window);
|
||||
@ -370,9 +359,6 @@ moz_container_realize (GtkWidget *widget)
|
||||
|
||||
gtk_widget_set_window (widget, window);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -107,12 +107,8 @@ nsDragService::nsDragService()
|
||||
obsServ->AddObserver(this, "quit-application", false);
|
||||
|
||||
// our hidden source widget
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
mHiddenWidget = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
#else
|
||||
// Using an offscreen window works around bug 983843.
|
||||
mHiddenWidget = gtk_offscreen_window_new();
|
||||
#endif
|
||||
// make sure that the widget is realized so that
|
||||
// we can use it as a drag source.
|
||||
gtk_widget_realize(mHiddenWidget);
|
||||
@ -435,42 +431,6 @@ nsDragService::SetAlphaPixmap(SourceSurface *aSurface,
|
||||
if (!gdk_screen_is_composited(screen))
|
||||
return false;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkColormap* alphaColormap = gdk_screen_get_rgba_colormap(screen);
|
||||
if (!alphaColormap)
|
||||
return false;
|
||||
|
||||
GdkPixmap* pixmap = gdk_pixmap_new(nullptr, dragRect.width, dragRect.height,
|
||||
gdk_colormap_get_visual(alphaColormap)->depth);
|
||||
if (!pixmap)
|
||||
return false;
|
||||
|
||||
gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), alphaColormap);
|
||||
|
||||
// Make a DrawTarget wrapped around the pixmap to render on
|
||||
RefPtr<DrawTarget> dt =
|
||||
nsWindow::GetDrawTargetForGdkDrawable(GDK_DRAWABLE(pixmap),
|
||||
IntSize(dragRect.width,
|
||||
dragRect.height));
|
||||
if (!dt)
|
||||
return false;
|
||||
|
||||
// Clear it...
|
||||
dt->ClearRect(Rect(0, 0, dragRect.width, dragRect.height));
|
||||
|
||||
// ...and paint the drag image with translucency
|
||||
dt->DrawSurface(aSurface,
|
||||
Rect(0, 0, dragRect.width, dragRect.height),
|
||||
Rect(0, 0, dragRect.width, dragRect.height),
|
||||
DrawSurfaceOptions(),
|
||||
DrawOptions(DRAG_IMAGE_ALPHA_LEVEL, CompositionOp::OP_SOURCE));
|
||||
|
||||
// The drag transaction addrefs the pixmap, so we can just unref it from us here
|
||||
gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, nullptr,
|
||||
aXOffset, aYOffset);
|
||||
g_object_unref(pixmap);
|
||||
return true;
|
||||
#else
|
||||
#ifdef cairo_image_surface_create
|
||||
#error "Looks like we're including Mozilla's cairo instead of system cairo"
|
||||
#endif
|
||||
@ -518,7 +478,6 @@ nsDragService::SetAlphaPixmap(SourceSurface *aSurface,
|
||||
gtk_drag_set_icon_surface(aContext, surf);
|
||||
cairo_surface_destroy(surf);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -732,50 +732,6 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
class ThemeRenderer : public gfxGdkNativeRenderer {
|
||||
public:
|
||||
ThemeRenderer(GtkWidgetState aState, WidgetNodeType aGTKWidgetType,
|
||||
gint aFlags, GtkTextDirection aDirection,
|
||||
const GdkRectangle& aGDKRect, const GdkRectangle& aGDKClip)
|
||||
: mState(aState), mGTKWidgetType(aGTKWidgetType), mFlags(aFlags),
|
||||
mDirection(aDirection), mGDKRect(aGDKRect), mGDKClip(aGDKClip) {}
|
||||
nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX, gint offsetY,
|
||||
GdkRectangle * clipRects, uint32_t numClipRects);
|
||||
private:
|
||||
GtkWidgetState mState;
|
||||
WidgetNodeType mGTKWidgetType;
|
||||
gint mFlags;
|
||||
GtkTextDirection mDirection;
|
||||
const GdkRectangle& mGDKRect;
|
||||
const GdkRectangle& mGDKClip;
|
||||
};
|
||||
|
||||
nsresult
|
||||
ThemeRenderer::DrawWithGDK(GdkDrawable * drawable, gint offsetX,
|
||||
gint offsetY, GdkRectangle * clipRects, uint32_t numClipRects)
|
||||
{
|
||||
GdkRectangle gdk_rect = mGDKRect;
|
||||
gdk_rect.x += offsetX;
|
||||
gdk_rect.y += offsetY;
|
||||
|
||||
GdkRectangle gdk_clip = mGDKClip;
|
||||
gdk_clip.x += offsetX;
|
||||
gdk_clip.y += offsetY;
|
||||
|
||||
GdkRectangle surfaceRect;
|
||||
surfaceRect.x = 0;
|
||||
surfaceRect.y = 0;
|
||||
gdk_drawable_get_size(drawable, &surfaceRect.width, &surfaceRect.height);
|
||||
gdk_rectangle_intersect(&gdk_clip, &surfaceRect, &gdk_clip);
|
||||
|
||||
NS_ASSERTION(numClipRects == 0, "We don't support clipping!!!");
|
||||
moz_gtk_widget_paint(mGTKWidgetType, drawable, &gdk_rect, &gdk_clip,
|
||||
&mState, mFlags, mDirection);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#else
|
||||
class SystemCairoClipper : public ClipExporter {
|
||||
public:
|
||||
explicit SystemCairoClipper(cairo_t* aContext) : mContext(aContext)
|
||||
@ -1024,7 +980,6 @@ DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType,
|
||||
@ -1172,42 +1127,10 @@ nsNativeThemeGTK::DrawWidgetBackground(gfxContext* aContext,
|
||||
// translate everything so (0,0) is the top left of the drawingRect
|
||||
gfxPoint origin = rect.TopLeft() + drawingRect.TopLeft();
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gfxContextAutoSaveRestore autoSR(ctx);
|
||||
gfxMatrix matrix;
|
||||
if (!snapped) { // else rects are in device coords
|
||||
matrix = ctx->CurrentMatrixDouble();
|
||||
}
|
||||
matrix.Translate(origin);
|
||||
matrix.Scale(scaleFactor, scaleFactor); // Draw in GDK coords
|
||||
ctx->SetMatrixDouble(matrix);
|
||||
|
||||
// The gdk_clip is just advisory here, meaning "you don't
|
||||
// need to draw outside this rect if you don't feel like it!"
|
||||
GdkRectangle gdk_clip = {0, 0, drawingRect.width, drawingRect.height};
|
||||
|
||||
ThemeRenderer renderer(state, gtkWidgetType, flags, direction,
|
||||
gdk_rect, gdk_clip);
|
||||
|
||||
// Some themes (e.g. Clearlooks) just don't clip properly to any
|
||||
// clip rect we provide, so we cannot advertise support for clipping within
|
||||
// the widget bounds.
|
||||
uint32_t rendererFlags = 0;
|
||||
if (transparency == eOpaque) {
|
||||
rendererFlags |= gfxGdkNativeRenderer::DRAW_IS_OPAQUE;
|
||||
}
|
||||
|
||||
// GtkStyles (used by the widget drawing backend) are created for a
|
||||
// particular colormap/visual.
|
||||
GdkColormap* colormap = moz_gtk_widget_get_colormap();
|
||||
|
||||
renderer.Draw(ctx, drawingRect.Size(), rendererFlags, colormap);
|
||||
#else
|
||||
DrawThemeWithCairo(ctx, aContext->GetDrawTarget(),
|
||||
state, gtkWidgetType, flags, direction, scaleFactor,
|
||||
snapped, ToPoint(origin), drawingRect.Size(),
|
||||
gdk_rect, transparency);
|
||||
#endif
|
||||
|
||||
if (!safeState) {
|
||||
gdk_flush();
|
||||
@ -1968,10 +1891,6 @@ nsNativeThemeGTK::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
|
||||
{
|
||||
switch (aWidgetType) {
|
||||
// These widgets always draw a default background.
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
case NS_THEME_TOOLBAR:
|
||||
case NS_THEME_MENUBAR:
|
||||
#endif
|
||||
case NS_THEME_MENUPOPUP:
|
||||
case NS_THEME_WINDOW:
|
||||
case NS_THEME_DIALOG:
|
||||
@ -1990,11 +1909,7 @@ nsNativeThemeGTK::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
|
||||
// Tooltips use gtk_paint_flat_box() on Gtk2
|
||||
// but are shaped on Gtk3
|
||||
case NS_THEME_TOOLTIP:
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
return eOpaque;
|
||||
#else
|
||||
return eTransparent;
|
||||
#endif
|
||||
}
|
||||
|
||||
return eUnknownTransparency;
|
||||
|
@ -57,11 +57,7 @@ ShowCustomDialog(GtkComboBox *changed_box, gpointer user_data)
|
||||
|
||||
printBundle->GetStringFromName("headerFooterCustom", intlString);
|
||||
GtkWidget* prompt_dialog = gtk_dialog_new_with_buttons(NS_ConvertUTF16toUTF8(intlString).get(), printDialog,
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
|
||||
#else
|
||||
(GtkDialogFlags)(GTK_DIALOG_MODAL),
|
||||
#endif
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
nullptr);
|
||||
@ -467,23 +463,15 @@ nsPrintDialogWidgetGTK::ExportSettings(nsIPrintSettings *aNSSettings)
|
||||
GtkWidget*
|
||||
nsPrintDialogWidgetGTK::ConstructHeaderFooterDropdown(const char16_t *currentString)
|
||||
{
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GtkWidget* dropdown = gtk_combo_box_new_text();
|
||||
#else
|
||||
GtkWidget* dropdown = gtk_combo_box_text_new();
|
||||
#endif
|
||||
const char hf_options[][22] = {"headerFooterBlank", "headerFooterTitle",
|
||||
"headerFooterURL", "headerFooterDate",
|
||||
"headerFooterPage", "headerFooterPageTotal",
|
||||
"headerFooterCustom"};
|
||||
|
||||
for (unsigned int i = 0; i < ArrayLength(hf_options); i++) {
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(dropdown), GetUTF8FromBundle(hf_options[i]).get());
|
||||
#else
|
||||
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dropdown), nullptr,
|
||||
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dropdown), nullptr,
|
||||
GetUTF8FromBundle(hf_options[i]).get());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool shouldBeCustom = true;
|
||||
|
@ -50,15 +50,9 @@
|
||||
#include <X11/extensions/XShm.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <gdk/gdkkeysyms-compat.h>
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
#include "gtk2xtbin.h"
|
||||
#endif
|
||||
#endif /* MOZ_X11 */
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
#include <gtk/gtkprivate.h>
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WAYLAND)
|
||||
#include <gdk/gdkwayland.h>
|
||||
@ -180,13 +174,8 @@ static int is_parent_ungrab_enter(GdkEventCrossing *aEvent);
|
||||
static int is_parent_grab_leave(GdkEventCrossing *aEvent);
|
||||
|
||||
/* callbacks from widgets */
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static gboolean expose_event_cb (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
#else
|
||||
static gboolean expose_event_cb (GtkWidget *widget,
|
||||
cairo_t *rect);
|
||||
#endif
|
||||
static gboolean configure_event_cb (GtkWidget *widget,
|
||||
GdkEventConfigure *event);
|
||||
static void container_unrealize_cb (GtkWidget *widget);
|
||||
@ -390,7 +379,7 @@ static guint gButtonState;
|
||||
static inline int32_t
|
||||
GetBitmapStride(int32_t width)
|
||||
{
|
||||
#if defined(MOZ_X11) || (MOZ_WIDGET_GTK == 2)
|
||||
#if defined(MOZ_X11)
|
||||
return (width+7)/8;
|
||||
#else
|
||||
return cairo_format_stride_for_width(CAIRO_FORMAT_A1, width);
|
||||
@ -1986,11 +1975,7 @@ gdk_window_flash(GdkWindow * aGdkWindow,
|
||||
GdkGC * gc = 0;
|
||||
GdkColor white;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gdk_window_get_geometry(aGdkWindow,nullptr,nullptr,&width,&height,nullptr);
|
||||
#else
|
||||
gdk_window_get_geometry(aGdkWindow,nullptr,nullptr,&width,&height);
|
||||
#endif
|
||||
|
||||
gdk_window_get_origin (aGdkWindow,
|
||||
&x,
|
||||
@ -2034,30 +2019,6 @@ gdk_window_flash(GdkWindow * aGdkWindow,
|
||||
#endif // DEBUG
|
||||
#endif
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static bool
|
||||
ExtractExposeRegion(LayoutDeviceIntRegion& aRegion, GdkEventExpose* aEvent)
|
||||
{
|
||||
GdkRectangle* rects;
|
||||
gint nrects;
|
||||
gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
|
||||
|
||||
if (nrects > MAX_RECTS_IN_REGION) {
|
||||
// Just use the bounding box
|
||||
rects[0] = aEvent->area;
|
||||
nrects = 1;
|
||||
}
|
||||
|
||||
for (GdkRectangle* r = rects; r < rects + nrects; r++) {
|
||||
aRegion.Or(aRegion, LayoutDeviceIntRect(r->x, r->y, r->width, r->height));
|
||||
LOGDRAW(("\t%d %d %d %d\n", r->x, r->y, r->width, r->height));
|
||||
}
|
||||
|
||||
g_free(rects);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
# ifdef cairo_copy_clip_rectangle_list
|
||||
# error "Looks like we're including Mozilla's cairo instead of system cairo"
|
||||
# endif
|
||||
@ -2079,15 +2040,9 @@ ExtractExposeRegion(LayoutDeviceIntRegion& aRegion, cairo_t* cr)
|
||||
cairo_rectangle_list_destroy(rects);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gboolean
|
||||
nsWindow::OnExposeEvent(GdkEventExpose *aEvent)
|
||||
#else
|
||||
gboolean
|
||||
nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
#endif
|
||||
{
|
||||
// Send any pending resize events so that layout can update.
|
||||
// May run event loop.
|
||||
@ -2106,11 +2061,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
return FALSE;
|
||||
|
||||
LayoutDeviceIntRegion exposeRegion;
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (!ExtractExposeRegion(exposeRegion, aEvent)) {
|
||||
#else
|
||||
if (!ExtractExposeRegion(exposeRegion, cr)) {
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2314,19 +2265,11 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
listener->DidPaintWindow();
|
||||
|
||||
// Synchronously flush any new dirty areas
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkRegion* dirtyArea = gdk_window_get_update_area(mGdkWindow);
|
||||
#else
|
||||
cairo_region_t* dirtyArea = gdk_window_get_update_area(mGdkWindow);
|
||||
#endif
|
||||
|
||||
if (dirtyArea) {
|
||||
gdk_window_invalidate_region(mGdkWindow, dirtyArea, false);
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gdk_region_destroy(dirtyArea);
|
||||
#else
|
||||
cairo_region_destroy(dirtyArea);
|
||||
#endif
|
||||
gdk_window_process_updates(mGdkWindow, false);
|
||||
}
|
||||
|
||||
@ -3560,21 +3503,9 @@ CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
|
||||
attributes.visual = gtk_widget_get_visual(widget);
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
attributes_mask |= GDK_WA_COLORMAP;
|
||||
attributes.colormap = gtk_widget_get_colormap(widget);
|
||||
#endif
|
||||
|
||||
GdkWindow *window = gdk_window_new(parent, &attributes, attributes_mask);
|
||||
gdk_window_set_user_data(window, widget);
|
||||
|
||||
// GTK3 TODO?
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
/* set the default pixmap to None so that you don't end up with the
|
||||
gtk default which is BlackPixel. */
|
||||
gdk_window_set_back_pixmap(window, nullptr, FALSE);
|
||||
#endif
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@ -3688,13 +3619,8 @@ nsWindow::Create(nsIWidget* aParent,
|
||||
if (useAlphaVisual) {
|
||||
GdkScreen *screen = gtk_widget_get_screen(mShell);
|
||||
if (gdk_screen_is_composited(screen)) {
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
|
||||
gtk_widget_set_colormap(mShell, colormap);
|
||||
#else
|
||||
GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
|
||||
gtk_widget_set_visual(mShell, visual);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3862,19 +3788,11 @@ nsWindow::Create(nsIWidget* aParent,
|
||||
|
||||
// If the popup ignores mouse events, set an empty input shape.
|
||||
if (aInitData->mMouseTransparent) {
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkRectangle rect = { 0, 0, 0, 0 };
|
||||
GdkRegion *region = gdk_region_rectangle(&rect);
|
||||
|
||||
gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0);
|
||||
gdk_region_destroy(region);
|
||||
#else
|
||||
cairo_rectangle_int_t rect = { 0, 0, 0, 0 };
|
||||
cairo_region_t *region = cairo_region_create_rectangle(&rect);
|
||||
|
||||
gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0);
|
||||
cairo_region_destroy(region);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3975,13 +3893,8 @@ nsWindow::Create(nsIWidget* aParent,
|
||||
hierarchy_changed_cb(GTK_WIDGET(mContainer), nullptr);
|
||||
// Expose, focus, key, and drag events are sent even to GTK_NO_WINDOW
|
||||
// widgets.
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
g_signal_connect(mContainer, "expose_event",
|
||||
G_CALLBACK(expose_event_cb), nullptr);
|
||||
#else
|
||||
g_signal_connect(G_OBJECT(mContainer), "draw",
|
||||
G_CALLBACK(expose_event_cb), nullptr);
|
||||
#endif
|
||||
g_signal_connect(mContainer, "focus_in_event",
|
||||
G_CALLBACK(focus_in_event_cb), nullptr);
|
||||
g_signal_connect(mContainer, "focus_out_event",
|
||||
@ -4033,10 +3946,6 @@ nsWindow::Create(nsIWidget* aParent,
|
||||
}
|
||||
|
||||
if (eventWidget) {
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
// Don't let GTK mess with the shapes of our GdkWindows
|
||||
GTK_PRIVATE_SET_FLAG(eventWidget, GTK_HAS_SHAPE_MASK);
|
||||
#endif
|
||||
|
||||
// These events are sent to the owning widget of the relevant window
|
||||
// and propagate up to the first widget that handles the events, so we
|
||||
@ -4559,17 +4468,6 @@ nsWindow::SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
if (!mGdkWindow)
|
||||
return NS_OK;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkRegion *region = gdk_region_new(); // aborts on OOM
|
||||
for (uint32_t i = 0; i < newRects->Length(); ++i) {
|
||||
const LayoutDeviceIntRect& r = newRects->ElementAt(i);
|
||||
GdkRectangle rect = { r.x, r.y, r.width, r.height };
|
||||
gdk_region_union_with_rect(region, &rect);
|
||||
}
|
||||
|
||||
gdk_window_shape_combine_region(mGdkWindow, region, 0, 0);
|
||||
gdk_region_destroy(region);
|
||||
#else
|
||||
cairo_region_t *region = cairo_region_create();
|
||||
for (uint32_t i = 0; i < newRects->Length(); ++i) {
|
||||
const LayoutDeviceIntRect& r = newRects->ElementAt(i);
|
||||
@ -4579,7 +4477,6 @@ nsWindow::SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
|
||||
gdk_window_shape_combine_region(mGdkWindow, region, 0, 0);
|
||||
cairo_region_destroy(region);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -4687,17 +4584,6 @@ nsWindow::ApplyTransparencyBitmap()
|
||||
ShapeBounding, 0, 0,
|
||||
maskPixmap, ShapeSet);
|
||||
XFreePixmap(xDisplay, maskPixmap);
|
||||
#else
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_widget_reset_shapes(mShell);
|
||||
GdkBitmap* maskBitmap = gdk_bitmap_create_from_data(mGdkWindow,
|
||||
mTransparencyBitmap,
|
||||
mTransparencyBitmapWidth, mTransparencyBitmapHeight);
|
||||
if (!maskBitmap)
|
||||
return;
|
||||
|
||||
gtk_widget_shape_combine_mask(mShell, maskBitmap, 0, 0);
|
||||
g_object_unref(maskBitmap);
|
||||
#else
|
||||
cairo_surface_t *maskBitmap;
|
||||
maskBitmap = cairo_image_surface_create_for_data((unsigned char*)mTransparencyBitmap,
|
||||
@ -4712,7 +4598,6 @@ nsWindow::ApplyTransparencyBitmap()
|
||||
gtk_widget_shape_combine_region(mShell, maskRegion);
|
||||
cairo_region_destroy(maskRegion);
|
||||
cairo_surface_destroy(maskBitmap);
|
||||
#endif // MOZ_WIDGET_GTK == 2
|
||||
#endif // MOZ_X11
|
||||
}
|
||||
|
||||
@ -5288,12 +5173,8 @@ is_mouse_in_window (GdkWindow* aWindow, gdouble aMouseX, gdouble aMouseY)
|
||||
window = gdk_window_get_parent(window);
|
||||
}
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gdk_drawable_get_size(aWindow, &w, &h);
|
||||
#else
|
||||
w = gdk_window_get_width(aWindow);
|
||||
h = gdk_window_get_height(aWindow);
|
||||
#endif
|
||||
|
||||
if (aMouseX > x && aMouseX < x + w &&
|
||||
aMouseY > y && aMouseY < y + h)
|
||||
@ -5549,18 +5430,6 @@ get_gtk_cursor(nsCursor aCursor)
|
||||
|
||||
// gtk callbacks
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static gboolean
|
||||
expose_event_cb(GtkWidget *widget, GdkEventExpose *event)
|
||||
{
|
||||
RefPtr<nsWindow> window = get_window_for_gdk_window(event->window);
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
window->OnExposeEvent(event);
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
void
|
||||
draw_window_of_widget(GtkWidget *widget, GdkWindow *aWindow, cairo_t *cr)
|
||||
{
|
||||
@ -5612,7 +5481,6 @@ expose_event_cb(GtkWidget *widget, cairo_t *cr)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif //MOZ_WIDGET_GTK == 2
|
||||
|
||||
static gboolean
|
||||
configure_event_cb(GtkWidget *widget,
|
||||
@ -6223,11 +6091,7 @@ get_inner_gdk_window (GdkWindow *aWindow,
|
||||
child = g_list_previous(child)) {
|
||||
auto *childWindow = (GdkWindow *) child->data;
|
||||
if (get_window_for_gdk_window(childWindow)) {
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, nullptr);
|
||||
#else
|
||||
gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch);
|
||||
#endif
|
||||
if ((cx < x) && (x < (cx + cw)) &&
|
||||
(cy < y) && (y < (cy + ch)) &&
|
||||
gdk_window_is_visible(childWindow)) {
|
||||
@ -6435,53 +6299,6 @@ nsWindow::GetEditCommands(NativeKeyBindingsType aType,
|
||||
keyBindings->GetEditCommands(aEvent, aCommands);
|
||||
}
|
||||
|
||||
#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
|
||||
/* static */ already_AddRefed<DrawTarget>
|
||||
nsWindow::GetDrawTargetForGdkDrawable(GdkDrawable* aDrawable,
|
||||
const IntSize& aSize)
|
||||
{
|
||||
GdkVisual* visual = gdk_drawable_get_visual(aDrawable);
|
||||
Screen* xScreen =
|
||||
gdk_x11_screen_get_xscreen(gdk_drawable_get_screen(aDrawable));
|
||||
Display* xDisplay = DisplayOfScreen(xScreen);
|
||||
Drawable xDrawable = gdk_x11_drawable_get_xid(aDrawable);
|
||||
|
||||
RefPtr<gfxASurface> surface;
|
||||
|
||||
if (visual) {
|
||||
Visual* xVisual = gdk_x11_visual_get_xvisual(visual);
|
||||
|
||||
surface = new gfxXlibSurface(xDisplay, xDrawable, xVisual, aSize);
|
||||
} else {
|
||||
// no visual? we must be using an xrender format. Find a format
|
||||
// for this depth.
|
||||
XRenderPictFormat *pf = nullptr;
|
||||
switch (gdk_drawable_get_depth(aDrawable)) {
|
||||
case 32:
|
||||
pf = XRenderFindStandardFormat(xDisplay, PictStandardARGB32);
|
||||
break;
|
||||
case 24:
|
||||
pf = XRenderFindStandardFormat(xDisplay, PictStandardRGB24);
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Don't know how to handle the given depth!");
|
||||
break;
|
||||
}
|
||||
|
||||
surface = new gfxXlibSurface(xScreen, xDrawable, pf, aSize);
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surface, aSize);
|
||||
|
||||
if (!dt || !dt->IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return dt.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<DrawTarget>
|
||||
nsWindow::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode)
|
||||
{
|
||||
|
@ -175,11 +175,7 @@ public:
|
||||
GdkRectangle DevicePixelsToGdkRectRoundOut(LayoutDeviceIntRect aRect);
|
||||
|
||||
// event callbacks
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gboolean OnExposeEvent(GdkEventExpose *aEvent);
|
||||
#else
|
||||
gboolean OnExposeEvent(cairo_t *cr);
|
||||
#endif
|
||||
gboolean OnConfigureEvent(GtkWidget *aWidget,
|
||||
GdkEventConfigure *aEvent);
|
||||
void OnContainerUnrealize();
|
||||
@ -318,10 +314,6 @@ public:
|
||||
nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
|
||||
uint8_t* aAlphas, int32_t aStride);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static already_AddRefed<DrawTarget> GetDrawTargetForGdkDrawable(GdkDrawable* aDrawable,
|
||||
const mozilla::gfx::IntSize& aSize);
|
||||
#endif
|
||||
virtual void ReparentNativeWidget(nsIWidget* aNewParent) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
|
@ -715,17 +715,6 @@ nsSystemInfo::Init()
|
||||
char gtkver[64];
|
||||
ssize_t gtkver_len = 0;
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
extern int gtk_read_end_of_the_pipe;
|
||||
|
||||
if (gtk_read_end_of_the_pipe != -1) {
|
||||
do {
|
||||
gtkver_len = read(gtk_read_end_of_the_pipe, >kver, sizeof(gtkver));
|
||||
} while (gtkver_len < 0 && errno == EINTR);
|
||||
close(gtk_read_end_of_the_pipe);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gtkver_len <= 0) {
|
||||
gtkver_len = SprintfLiteral(gtkver, "GTK %u.%u.%u", gtk_major_version,
|
||||
gtk_minor_version, gtk_micro_version);
|
||||
|
@ -512,12 +512,6 @@ XRE_API(int,
|
||||
XRE_XPCShellMain, (int argc, char** argv, char** envp,
|
||||
const XREShellData* aShellData))
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
XRE_API(void,
|
||||
XRE_GlibInit, ())
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LIBFUZZER
|
||||
#include "LibFuzzerRegistry.h"
|
||||
|
||||
|
@ -363,15 +363,6 @@ public:
|
||||
}
|
||||
|
||||
~GSliceInit() {
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
if (sTop) {
|
||||
auto XRE_GlibInit = (void (*)(void)) GetSymbol(sTop->libHandle,
|
||||
"XRE_GlibInit");
|
||||
// Initialize glib enough for G_SLICE to have an effect before it is unset.
|
||||
// unset.
|
||||
XRE_GlibInit();
|
||||
}
|
||||
#endif
|
||||
if (!mHadGSlice) {
|
||||
unsetenv("G_SLICE");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user