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

@@ -22,6 +22,8 @@
#include "wx/gtk/private/object.h"
#include "wx/gtk/private/gtk2-compat.h"
GdkWindow* wxGetTopLevelGDK();
//-----------------------------------------------------------------------------
// wxCursorRefData
//-----------------------------------------------------------------------------
@@ -67,9 +69,6 @@ wxCursorRefData::~wxCursorRefData()
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject)
// used in the following two ctors
extern GtkWidget *wxGetRootWindow();
wxCursor::wxCursor()
{
}
@@ -143,7 +142,8 @@ wxCursor::wxCursor(const char bits[], int width, int height,
}
}
}
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(wxGetRootWindow()), pixbuf, hotSpotX, hotSpotY);
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf(
gdk_window_get_display(wxGetTopLevelGDK()), pixbuf, hotSpotX, hotSpotY);
#else
if (!maskBits)
maskBits = bits;
@@ -153,9 +153,9 @@ wxCursor::wxCursor(const char bits[], int width, int height,
bg = wxWHITE;
GdkBitmap* data = gdk_bitmap_create_from_data(
gtk_widget_get_window(wxGetRootWindow()), const_cast<char*>(bits), width, height);
wxGetTopLevelGDK(), const_cast<char*>(bits), width, height);
GdkBitmap* mask = gdk_bitmap_create_from_data(
gtk_widget_get_window(wxGetRootWindow()), const_cast<char*>(maskBits), width, height);
wxGetTopLevelGDK(), const_cast<char*>(maskBits), width, height);
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap(
data, mask, fg->GetColor(), bg->GetColor(),
@@ -275,7 +275,8 @@ void wxCursor::InitFromImage( const wxImage & image )
}
}
m_refData = new wxCursorRefData;
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(wxGetRootWindow()), pixbuf, hotSpotX, hotSpotY);
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf(
gdk_window_get_display(wxGetTopLevelGDK()), pixbuf, hotSpotX, hotSpotY);
g_object_unref(pixbuf);
}