Implement access to a global toplevel GdkWindow in a way that does not require always having an extra GtkWindow.

And don't use "RootWindow" in the name, it is not a root window in the X11 sense.
Also add wxGetPangoContext() to get access to a PangoContext.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2014-05-05 15:53:27 +00:00
parent 70387b4857
commit a0f10ec1d6
10 changed files with 96 additions and 82 deletions

View File

@@ -41,12 +41,9 @@
#if wxUSE_PANGO
#include "pango/pango.h"
#include <pango/pango.h>
#ifdef __WXGTK20__
#include "gtk/gtk.h"
extern GtkWidget *wxGetRootWindow();
#endif // __WXGTK20__
PangoContext* wxGetPangoContext();
extern "C"
{
@@ -72,13 +69,8 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
PangoFontFamily **families = NULL;
gint n_families = 0;
pango_context_list_families (
#ifdef __WXGTK20__
gtk_widget_get_pango_context( wxGetRootWindow() ),
#else
wxTheApp->GetPangoContext(),
#endif
&families, &n_families );
PangoContext* context = wxGetPangoContext();
pango_context_list_families(context, &families, &n_families);
qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
for ( int i = 0; i < n_families; i++ )
@@ -93,6 +85,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
}
}
g_free(families);
g_object_unref(context);
return true;
}

View File

@@ -40,11 +40,12 @@
#if wxUSE_PANGO
#include "pango/pango.h"
#include <pango/pango.h>
PangoContext* wxGetPangoContext();
#ifdef __WXGTK20__
#include "wx/gtk/private.h"
extern GtkWidget *wxGetRootWindow();
#define wxPANGO_CONV wxGTK_CONV_SYS
#define wxPANGO_CONV_BACK wxGTK_CONV_BACK_SYS
@@ -178,13 +179,8 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
PangoFontFamily **families;
PangoFontFamily *family = NULL;
int n_families;
pango_context_list_families(
#ifdef __WXGTK20__
gtk_widget_get_pango_context( wxGetRootWindow() ),
#else
wxTheApp->GetPangoContext(),
#endif
&families, &n_families);
PangoContext* context = wxGetPangoContext();
pango_context_list_families(context, &families, &n_families);
for (int i = 0; i < n_families; ++i)
{
@@ -197,6 +193,7 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
}
g_free(families);
g_object_unref(context);
// Some gtk+ systems might query for a non-existing font from
// wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) on initialization,