#include <gtk/gtk.h>
#include "wx/gtk/private/object.h"
+#include "wx/gtk/private/gtk2-compat.h"
//-----------------------------------------------------------------------------
// wxCursorRefData
virtual bool IsOk() const { return m_cursor != NULL; }
GdkCursor *m_cursor;
+
+private:
+ // There is no way to copy m_cursor so we can't implement a copy ctor
+ // properly.
+ wxDECLARE_NO_COPY_CLASS(wxCursorRefData);
};
wxCursorRefData::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 new wxCursorRefData;
}
-wxGDIRefData *wxCursor::CloneGDIRefData(const wxGDIRefData *data) const
+wxGDIRefData *
+wxCursor::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
{
- return new wxCursorRefData(*static_cast<const wxCursorRefData *>(data));
+ // TODO: We can't clone GDK cursors at the moment. To do this we'd need
+ // to remember the original data from which the cursor was created
+ // (i.e. standard cursor type or the bitmap) or use
+ // gdk_cursor_get_cursor_type() (which is in 2.22+ only) and
+ // gdk_cursor_get_image().
+ wxFAIL_MSG( wxS("Cloning cursors is not implemented in wxGTK.") );
+
+ return new wxCursorRefData;
}
//-----------------------------------------------------------------------------
for (size_t n = list.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);
+ if (display == NULL && win->m_widget)
+ {
+ GdkWindow* w = gtk_widget_get_window(win->m_widget);
+ if (w)
+ display = gdk_drawable_get_display(w);
+ }
win->GTKUpdateCursor(true, false);
UpdateCursors(win->GetChildren(), display);
}