These cause a problem for GCC 14 which detects that there are no
corresponding copy constructors and assignment operators and gives
-Wdeprecated-copy-dtor due to their presence, e.g.
/home/fedora/swt2c/wxWidgets/bld/bk-deps g++ -c -o test_allheaders_allheaders.o -I/home/fedora/swt2c/wxWidgets/bld/lib/wx/include/gtk3-unicode-3.3 -I../../include -D_FILE_OFFSET_BITS=64 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/atk-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/at-spi2-atk/2.0 -I/usr/include/cloudproviders -I/usr/include/webp -I/usr/include/blkid -I/usr/include/at-spi-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/pixman-1 -I/usr/include/libxml2 -I/usr/include/fribidi -I/usr/include/sysprof-6 -pthread -I/usr/include/libpng16 -DWITH_GZFILEOP -D__WXGTK__ -I../../tests -DWXUSINGDLL -I../../tests/../samples -I../../3rdparty/catch/single_include -pthread -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -O2 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libmount -I/usr/include/libxml2 -I/usr/include/sysprof-6 -I/usr/include/libpng16 -DWITH_GZFILEOP -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/cloudproviders -I/usr/include/at-spi-2.0 -I/usr/include/gio-unix-2.0 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DPIC ../../tests/allheaders.cpp
In file included from ../../include/wx/evtloop.h:13,
from ../../tests/testprec.h:5,
from ../../tests/allheaders.cpp:369:
../../include/wx/event.h: In copy constructor ‘wxSetCursorEvent::wxSetCursorEvent(const wxSetCursorEvent&)’:
../../include/wx/event.h:1943:11: error: implicitly-declared ‘wxCursor::wxCursor(const wxCursor&)’ is deprecated [-Werror=deprecated-copy-dtor]
1943 | m_cursor(event.m_cursor)
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../include/wx/cursor.h:51,
from ../../include/wx/event.h:21:
../../include/wx/gtk/cursor.h:37:13: note: because ‘wxCursor’ has user-provided ‘virtual wxCursor::~wxCursor()’
37 | virtual ~wxCursor();
| ^
../../include/wx/event.h: In member function ‘void wxSetCursorEvent::SetCursor(const wxCursor&)’:
../../include/wx/event.h:1949:57: error: implicitly-declared ‘wxCursor& wxCursor::operator=(const wxCursor&)’ is deprecated [-Werror=deprecated-copy-dtor]
1949 | void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
| ^~~~~~
../../include/wx/gtk/cursor.h:37:13: note: because ‘wxCursor’ has user-provided ‘virtual wxCursor::~wxCursor()’
37 | virtual ~wxCursor();
| ^
Fixes #24248.
Closes #24255.
222 lines
6 KiB
C++
222 lines
6 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: src/x11/cursor.cpp
|
|
// Purpose: wxCursor class
|
|
// Author: Julian Smart
|
|
// Created: 17/09/98
|
|
// Copyright: (c) Julian Smart
|
|
// Licence: wxWindows licence
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
#include "wx/wxprec.h"
|
|
|
|
#include "wx/cursor.h"
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include "wx/app.h"
|
|
#include "wx/utils.h"
|
|
#include "wx/icon.h"
|
|
#include "wx/gdicmn.h"
|
|
#include "wx/image.h"
|
|
#endif
|
|
|
|
#include "wx/x11/private.h"
|
|
|
|
#if !wxUSE_NANOX
|
|
#include <X11/cursorfont.h>
|
|
#endif
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// wxCursor
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class wxCursorRefData: public wxGDIRefData
|
|
{
|
|
public:
|
|
|
|
wxCursorRefData();
|
|
virtual ~wxCursorRefData();
|
|
|
|
WXCursor m_cursor;
|
|
WXDisplay *m_display;
|
|
|
|
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()
|
|
{
|
|
m_cursor = nullptr;
|
|
m_display = nullptr;
|
|
}
|
|
|
|
wxCursorRefData::~wxCursorRefData()
|
|
{
|
|
if (m_cursor)
|
|
XFreeCursor( (Display*) m_display, (Cursor) m_cursor );
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
|
|
|
|
wxIMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject);
|
|
|
|
wxCursor::wxCursor()
|
|
{
|
|
|
|
}
|
|
|
|
void wxCursor::InitFromStock( wxStockCursor cursorId )
|
|
{
|
|
m_refData = new wxCursorRefData();
|
|
|
|
#if wxUSE_NANOX
|
|
// TODO Create some standard cursors from bitmaps.
|
|
|
|
|
|
#else
|
|
// !wxUSE_NANOX
|
|
|
|
M_CURSORDATA->m_display = wxGlobalDisplay();
|
|
wxASSERT_MSG( M_CURSORDATA->m_display, wxT("No display") );
|
|
|
|
int x_cur = XC_left_ptr;
|
|
switch (cursorId)
|
|
{
|
|
case wxCURSOR_DEFAULT: x_cur = XC_left_ptr; break;
|
|
case wxCURSOR_HAND: x_cur = XC_hand1; break;
|
|
case wxCURSOR_CROSS: x_cur = XC_crosshair; break;
|
|
case wxCURSOR_SIZEWE: x_cur = XC_sb_h_double_arrow; break;
|
|
case wxCURSOR_SIZENS: x_cur = XC_sb_v_double_arrow; break;
|
|
case wxCURSOR_ARROWWAIT:
|
|
case wxCURSOR_WAIT:
|
|
case wxCURSOR_WATCH: x_cur = XC_watch; break;
|
|
case wxCURSOR_SIZING: x_cur = XC_sizing; break;
|
|
case wxCURSOR_SPRAYCAN: x_cur = XC_spraycan; break;
|
|
case wxCURSOR_IBEAM: x_cur = XC_xterm; break;
|
|
case wxCURSOR_PENCIL: x_cur = XC_pencil; break;
|
|
case wxCURSOR_NO_ENTRY: x_cur = XC_pirate; break;
|
|
case wxCURSOR_SIZENWSE:
|
|
case wxCURSOR_SIZENESW: x_cur = XC_fleur; break;
|
|
case wxCURSOR_QUESTION_ARROW: x_cur = XC_question_arrow; break;
|
|
case wxCURSOR_PAINT_BRUSH: x_cur = XC_spraycan; break;
|
|
case wxCURSOR_MAGNIFIER: x_cur = XC_plus; break;
|
|
case wxCURSOR_CHAR: x_cur = XC_xterm; break;
|
|
case wxCURSOR_LEFT_BUTTON: x_cur = XC_leftbutton; break;
|
|
case wxCURSOR_MIDDLE_BUTTON: x_cur = XC_middlebutton; break;
|
|
case wxCURSOR_RIGHT_BUTTON: x_cur = XC_rightbutton; break;
|
|
case wxCURSOR_BULLSEYE: x_cur = XC_target; break;
|
|
|
|
case wxCURSOR_POINT_LEFT: x_cur = XC_sb_left_arrow; break;
|
|
case wxCURSOR_POINT_RIGHT: x_cur = XC_sb_right_arrow; break;
|
|
/*
|
|
case wxCURSOR_DOUBLE_ARROW: x_cur = XC_double_arrow; break;
|
|
case wxCURSOR_CROSS_REVERSE: x_cur = XC_cross_reverse; break;
|
|
case wxCURSOR_BASED_ARROW_UP: x_cur = XC_based_arrow_up; break;
|
|
case wxCURSOR_BASED_ARROW_DOWN: x_cur = XC_based_arrow_down; break;
|
|
*/
|
|
default:
|
|
wxFAIL_MSG(wxT("unsupported cursor type"));
|
|
// will use the standard one
|
|
}
|
|
|
|
M_CURSORDATA->m_cursor = (WXCursor) XCreateFontCursor( (Display*) M_CURSORDATA->m_display, x_cur );
|
|
#endif
|
|
}
|
|
|
|
wxCursor::wxCursor(const wxString& WXUNUSED(name),
|
|
wxBitmapType WXUNUSED(type),
|
|
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY))
|
|
{
|
|
wxFAIL_MSG( wxT("wxCursor creation from file not yet implemented") );
|
|
}
|
|
|
|
#if wxUSE_IMAGE
|
|
wxCursor::wxCursor( const wxImage & WXUNUSED(image) )
|
|
{
|
|
wxFAIL_MSG( wxT("wxCursor creation from wxImage not yet implemented") );
|
|
}
|
|
|
|
wxCursor::wxCursor(const char* const* WXUNUSED(xpmData))
|
|
{
|
|
wxFAIL_MSG( wxT("wxCursor creation from XPM not yet implemented") );
|
|
}
|
|
#endif
|
|
|
|
wxGDIRefData *wxCursor::CreateGDIRefData() const
|
|
{
|
|
return new wxCursorRefData;
|
|
}
|
|
|
|
wxGDIRefData *
|
|
wxCursor::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
|
|
{
|
|
wxFAIL_MSG( wxS("Cloning cursors is not implemented in wxX11.") );
|
|
|
|
return new wxCursorRefData;
|
|
}
|
|
|
|
WXCursor wxCursor::GetCursor() const
|
|
{
|
|
return M_CURSORDATA->m_cursor;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// busy cursor routines
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/* extern */ wxCursor g_globalCursor;
|
|
|
|
static wxCursor gs_savedCursor;
|
|
static int gs_busyCount = 0;
|
|
|
|
const wxCursor &wxBusyCursor::GetStoredCursor()
|
|
{
|
|
return gs_savedCursor;
|
|
}
|
|
|
|
const wxCursor wxBusyCursor::GetBusyCursor()
|
|
{
|
|
return wxCursor(wxCURSOR_WATCH);
|
|
}
|
|
|
|
void wxEndBusyCursor()
|
|
{
|
|
if (--gs_busyCount > 0)
|
|
return;
|
|
|
|
wxSetCursor( gs_savedCursor );
|
|
gs_savedCursor = wxNullCursor;
|
|
|
|
if (wxTheApp)
|
|
wxTheApp->ProcessIdle();
|
|
}
|
|
|
|
void wxBeginBusyCursor( const wxCursor *WXUNUSED(cursor) )
|
|
{
|
|
if (gs_busyCount++ > 0)
|
|
return;
|
|
|
|
wxASSERT_MSG( !gs_savedCursor.IsOk(),
|
|
wxT("forgot to call wxEndBusyCursor, will leak memory") );
|
|
|
|
gs_savedCursor = g_globalCursor;
|
|
|
|
wxSetCursor( wxCursor(wxCURSOR_WATCH) );
|
|
|
|
if (wxTheApp)
|
|
wxTheApp->ProcessIdle();
|
|
}
|
|
|
|
bool wxIsBusy()
|
|
{
|
|
return gs_busyCount > 0;
|
|
}
|
|
|
|
void wxSetCursor( const wxCursor& cursor )
|
|
{
|
|
g_globalCursor = cursor;
|
|
}
|