mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 627699 - Port GTK2 to GTK3, gfx patch. r=karlt
This commit is contained in:
parent
d5ece17979
commit
9ed0cff815
@ -8,7 +8,7 @@
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include <gdk/gdkx.h>
|
||||
// we're using default display for now
|
||||
#define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#define GET_NATIVE_WINDOW(aWidget) GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include "gfxCrashReporterUtils.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gfxPlatformGtk.h"
|
||||
#endif
|
||||
|
||||
@ -224,7 +224,7 @@ GLXLibrary::EnsureInitialized()
|
||||
GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_texturefrompixmap,
|
||||
(GLLibraryLoader::PlatformLookupFunction)&xGetProcAddress))
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
mUseTextureFromPixmap = gfxPlatformGtk::UseXRender();
|
||||
#else
|
||||
mUseTextureFromPixmap = true;
|
||||
|
@ -77,7 +77,6 @@ include $(topsrcdir)/config/rules.mk
|
||||
CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS) $(TK_CFLAGS)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
DEFINES += -DMOZ_ENABLE_GTK2
|
||||
CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_PANGO_CFLAGS)
|
||||
endif
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
// Utilities common to all X clients, regardless of UI toolkit.
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
# include <gdk/gdk.h>
|
||||
# include <gdk/gdkx.h>
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include "gfxQtPlatform.h"
|
||||
@ -33,8 +34,8 @@ namespace mozilla {
|
||||
inline Display*
|
||||
DefaultXDisplay()
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
return GDK_DISPLAY();
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
return gfxQtPlatform::GetXDisplay();
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "gfxPDFSurface.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gfxPSSurface.h"
|
||||
#elif XP_WIN
|
||||
#include "gfxWindowsSurface.h"
|
||||
@ -640,7 +640,7 @@ nsDeviceContext::CalcPrintingSize()
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
case gfxASurface::SurfaceTypePS:
|
||||
inPoints = true;
|
||||
size = reinterpret_cast<gfxPSSurface*>(mPrintingSurface.get())->GetSize();
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "gfxTestCocoaHelper.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gtk/gtk.h"
|
||||
#endif
|
||||
|
||||
@ -297,7 +297,7 @@ main (int argc, char **argv) {
|
||||
int passed = 0;
|
||||
int failed = 0;
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
gtk_init(&argc, &argv);
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "gfxTestCocoaHelper.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gtk/gtk.h"
|
||||
#endif
|
||||
|
||||
@ -106,7 +106,7 @@ PRUint32 iterations = 20;
|
||||
|
||||
int
|
||||
main (int argc, char **argv) {
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
gtk_init(&argc, &argv);
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "gfxTestCocoaHelper.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gtk/gtk.h"
|
||||
#endif
|
||||
|
||||
@ -94,7 +94,7 @@ MakeContext ()
|
||||
|
||||
int
|
||||
main (int argc, char **argv) {
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
gtk_init(&argc, &argv);
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h"
|
||||
#define gfxToolkitPlatform gfxPlatformGtk
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
@ -97,7 +97,7 @@ gfxFT2FontGroup::gfxFT2FontGroup(const nsAString& families,
|
||||
QFont defaultFont;
|
||||
QFontInfo fi (defaultFont);
|
||||
familyArray.AppendElement(nsDependentString(static_cast<const PRUnichar *>(fi.family().utf16())));
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
FcResult result;
|
||||
FcChar8 *family = nsnull;
|
||||
FcPattern* pat = FcPatternCreate();
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <gdk/gdkx.h>
|
||||
#include "cairo-xlib.h"
|
||||
#include "gfxXlibSurface.h"
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
nsresult
|
||||
gfxGdkNativeRenderer::DrawWithXlib(gfxXlibSurface* surface,
|
||||
nsIntPoint offset,
|
||||
@ -59,4 +61,8 @@ gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
|
||||
gfxXlibNativeRenderer::Draw(ctx, size, flags, screen, visual, nsnull);
|
||||
}
|
||||
|
||||
#else
|
||||
// TODO GTK3
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -35,9 +35,12 @@ public:
|
||||
* @param numClipRects the number of rects in the array, or zero if
|
||||
* no clipping is required
|
||||
*/
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
virtual nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX,
|
||||
gint offsetY, GdkRectangle * clipRects, PRUint32 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)
|
||||
@ -65,8 +68,10 @@ 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, nsIntSize size,
|
||||
PRUint32 flags, GdkColormap* colormap);
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef MOZ_X11
|
||||
@ -75,8 +80,10 @@ private:
|
||||
nsIntPoint offset,
|
||||
nsIntRect* clipRects, PRUint32 numClipRects);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkColormap *mColormap;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /*GFXGDKNATIVERENDER_H_*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "gfxContext.h"
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gfxPlatformGtk.h"
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
@ -44,7 +44,7 @@
|
||||
#include <pango/pango-modules.h>
|
||||
#include <pango/pangofc-fontmap.h>
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include <gdk/gdk.h>
|
||||
#endif
|
||||
|
||||
@ -950,7 +950,7 @@ gfx_pango_fc_font_get_coverage(PangoFont *font, PangoLanguage *lang)
|
||||
static PRInt32
|
||||
GetDPI()
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
return gfxPlatformGtk::GetDPI();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
return gfxQtPlatform::GetDPI();
|
||||
@ -1731,7 +1731,7 @@ gfx_pango_font_map_class_init(gfxPangoFontMapClass *klass)
|
||||
// dynamically respond to changes in the screen cairo_font_options_t.
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
static void ApplyGdkScreenFontOptions(FcPattern *aPattern);
|
||||
#endif
|
||||
|
||||
@ -1768,7 +1768,7 @@ PrepareSortPattern(FcPattern *aPattern, double aFallbackSize,
|
||||
cairo_ft_font_options_substitute(options, aPattern);
|
||||
cairo_font_options_destroy(options);
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
ApplyGdkScreenFontOptions(aPattern);
|
||||
#endif
|
||||
}
|
||||
@ -3145,7 +3145,7 @@ GuessPangoLanguage(nsIAtom *aLanguage)
|
||||
return pango_language_from_string(lang.get());
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
/***************************************************************************
|
||||
*
|
||||
* This function must be last in the file because it uses the system cairo
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "gfxD2DSurface.h"
|
||||
#elif defined(XP_MACOSX)
|
||||
#include "gfxPlatformMac.h"
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h"
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include "gfxQtPlatform.h"
|
||||
@ -259,7 +259,7 @@ gfxPlatform::Init()
|
||||
gPlatform = new gfxWindowsPlatform;
|
||||
#elif defined(XP_MACOSX)
|
||||
gPlatform = new gfxPlatformMac;
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
gPlatform = new gfxPlatformGtk;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
gPlatform = new gfxQtPlatform;
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
#include "cairo.h"
|
||||
#include <gtk/gtk.h>
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
#include "gtk2compat.h"
|
||||
#endif
|
||||
|
||||
#include "gfxImageSurface.h"
|
||||
#ifdef MOZ_X11
|
||||
@ -66,11 +69,6 @@ static FT_Library gPlatformFTLibrary = NULL;
|
||||
#endif
|
||||
|
||||
static cairo_user_data_key_t cairo_gdk_drawable_key;
|
||||
static void do_gdk_drawable_unref (void *data)
|
||||
{
|
||||
GdkDrawable *d = (GdkDrawable*) data;
|
||||
g_object_unref (d);
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
bool gfxPlatformGtk::sUseXRender = true;
|
||||
@ -475,7 +473,7 @@ gfxPlatformGtk::GetOffscreenFormat()
|
||||
{
|
||||
// Make sure there is a screen
|
||||
GdkScreen *screen = gdk_screen_get_default();
|
||||
if (screen && gdk_visual_get_system()->depth == 16) {
|
||||
if (screen && gdk_visual_get_depth(gdk_visual_get_system()) == 16) {
|
||||
return gfxASurface::ImageFormatRGB16_565;
|
||||
}
|
||||
|
||||
@ -490,7 +488,7 @@ gfxPlatformGtk::GetPlatformCMSOutputProfile()
|
||||
const char ICC_PROFILE_ATOM_NAME[] = "_ICC_PROFILE";
|
||||
|
||||
Atom edidAtom, iccAtom;
|
||||
Display *dpy = GDK_DISPLAY();
|
||||
Display *dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||
Window root = gdk_x11_get_default_root_xwindow();
|
||||
|
||||
Atom retAtom;
|
||||
@ -690,7 +688,7 @@ gfxPlatformGtk::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxF
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
void
|
||||
gfxPlatformGtk::SetGdkDrawable(gfxASurface *target,
|
||||
GdkDrawable *drawable)
|
||||
@ -703,7 +701,7 @@ gfxPlatformGtk::SetGdkDrawable(gfxASurface *target,
|
||||
cairo_surface_set_user_data (target->CairoSurface(),
|
||||
&cairo_gdk_drawable_key,
|
||||
drawable,
|
||||
do_gdk_drawable_unref);
|
||||
g_object_unref);
|
||||
}
|
||||
|
||||
GdkDrawable *
|
||||
@ -735,6 +733,7 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<ScaledFont>
|
||||
gfxPlatformGtk::GetScaledFontForFont(gfxFont *aFont)
|
||||
|
@ -10,9 +10,11 @@
|
||||
#include "nsAutoRef.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
extern "C" {
|
||||
typedef struct _GdkDrawable GdkDrawable;
|
||||
}
|
||||
#endif
|
||||
|
||||
class gfxFontconfigUtils;
|
||||
#ifndef MOZ_PANGO
|
||||
@ -90,9 +92,11 @@ public:
|
||||
FT_Library GetFTLibrary();
|
||||
#endif
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static void SetGdkDrawable(gfxASurface *target,
|
||||
GdkDrawable *drawable);
|
||||
static GdkDrawable *GetGdkDrawable(gfxASurface *target);
|
||||
#endif
|
||||
|
||||
static PRInt32 GetDPI();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user