#include <gtk/gtk.h>
#include "wx/gtk/private/object.h"
+#include "wx/gtk/private/gtk2-compat.h"
//-----------------------------------------------------------------------------
// wxCursorRefData
if (hotSpotY < 0 || hotSpotY >= height)
hotSpotY = 0;
- GdkBitmap *data = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) bits, width, height );
- GdkBitmap *mask = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) maskBits, width, height);
+ GdkBitmap* data = gdk_bitmap_create_from_data(
+ gtk_widget_get_window(wxGetRootWindow()), const_cast<char*>(bits), width, height);
+ GdkBitmap* mask = gdk_bitmap_create_from_data(
+ gtk_widget_get_window(wxGetRootWindow()), const_cast<char*>(maskBits), width, height);
m_refData = new wxCursorRefData;
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap(
m_refData = new wxCursorRefData;
wxImage image_copy(image);
- GdkDisplay* display = gdk_drawable_get_display(wxGetRootWindow()->window);
+ GdkDisplay* display = gdk_drawable_get_display(gtk_widget_get_window(wxGetRootWindow()));
if (gdk_display_supports_cursor_color(display))
{
if (!image.HasAlpha())
char* bits = new char[size];
memset(bits, 0xff, size);
maskRaw = gdk_bitmap_create_from_data(
- wxGetRootWindow()->window, bits, w, h);
+ gtk_widget_get_window(wxGetRootWindow()), bits, w, h);
delete[] bits;
}
return wxCursor(wxCURSOR_WATCH);
}
-static void UpdateCursors(const wxWindowList& list, GdkDisplay*& display)
+static void UpdateCursors(GdkDisplay** display)
{
- wxWindowList::const_iterator i = list.begin();
- for (size_t n = list.size(); n--; ++i)
+ wxWindowList::const_iterator i = wxTopLevelWindows.begin();
+ for (size_t n = wxTopLevelWindows.size(); n--; ++i)
{
wxWindow* win = *i;
- if (display == NULL && win->m_widget && win->m_widget->window)
- display = gdk_drawable_get_display(win->m_widget->window);
- win->GTKUpdateCursor(true, false);
- UpdateCursors(win->GetChildren(), display);
+ win->GTKUpdateCursor();
+ if (display && *display == NULL && win->m_widget)
+ *display = gtk_widget_get_display(win->m_widget);
}
}
g_globalCursor = gs_savedCursor;
gs_savedCursor = wxNullCursor;
- GdkDisplay* unused = NULL;
- UpdateCursors(wxTopLevelWindows, unused);
+ UpdateCursors(NULL);
}
void wxBeginBusyCursor(const wxCursor* cursor)
if (gs_busyCount++ > 0)
return;
- wxASSERT_MSG( !gs_savedCursor.Ok(),
+ wxASSERT_MSG( !gs_savedCursor.IsOk(),
wxT("forgot to call wxEndBusyCursor, will leak memory") );
gs_savedCursor = g_globalCursor;
g_globalCursor = *cursor;
GdkDisplay* display = NULL;
- UpdateCursors(wxTopLevelWindows, display);
+ UpdateCursors(&display);
if (display)
gdk_display_flush(display);
}
void wxSetCursor( const wxCursor& cursor )
{
g_globalCursor = cursor;
- GdkDisplay* unused = NULL;
- UpdateCursors(wxTopLevelWindows, unused);
+ UpdateCursors(NULL);
}