From 550343399aa1355469ffed72c8cf84c732dcf98b Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Mon, 3 Oct 2005 16:39:45 +0000 Subject: [PATCH] Source cleaning. wxMotif/OS2 adjustements. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 9 +- include/wx/dynlib.h | 8 +- include/wx/filefn.h | 2 +- include/wx/motif/dcclient.h | 2 +- include/wx/motif/listbox.h | 2 +- include/wx/os2/private.h | 20 +++- include/wx/platform.h | 17 ++-- include/wx/thread.h | 5 +- include/wx/thrimpl.cpp | 4 +- include/wx/utils.h | 6 +- src/common/dynlib.cpp | 4 +- src/common/fileconf.cpp | 5 +- src/common/intl.cpp | 7 +- src/common/textbuf.cpp | 4 +- src/motif/accel.cpp | 3 +- src/motif/app.cpp | 8 +- src/motif/choice.cpp | 2 +- src/motif/clipbrd.cpp | 16 ++-- src/motif/colour.cpp | 16 ++-- src/motif/combobox_native.cpp | 4 +- src/motif/cursor.cpp | 38 ++++---- src/motif/dcclient.cpp | 10 +- src/motif/dialog.cpp | 4 +- src/os2/thread.cpp | 6 +- src/unix/fontenum.cpp | 39 ++++---- src/unix/fontutil.cpp | 73 ++++++++------- src/unix/utilsx11.cpp | 17 ++-- src/x11/bitmap.cpp | 167 ++++++++++++++++++---------------- src/x11/brush.cpp | 26 +++--- src/x11/pen.cpp | 32 ++++--- src/x11/region.cpp | 86 ++++++++--------- src/x11/utilsx.cpp | 7 +- 32 files changed, 343 insertions(+), 306 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 0e06ffcb0f..22437ecab7 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1,5 +1,5 @@ /** -* Name: defs.h +* Name: wx/defs.h * Purpose: Declarations/definitions common to all wx source files * Author: Julian Smart and others * Modified by: Ryan Norton (Converted to C) @@ -2583,6 +2583,11 @@ typedef int (__stdcall *WXFARPROC)(); #endif /* __WIN32__ */ +#if defined(__OS2__) +typedef unsigned long DWORD; +typedef unsigned short WORD; +#endif + #if defined(__WXPM__) || defined(__EMX__) #ifdef __WXPM__ /* Stand-ins for OS/2 types, to avoid #including all of os2.h */ @@ -2643,8 +2648,6 @@ typedef unsigned long HCURSOR; typedef unsigned long HINSTANCE; typedef unsigned long HIMAGELIST; typedef unsigned long HGLOBAL; -typedef unsigned long DWORD; -typedef unsigned short WORD; #endif /* WXPM || EMX */ #if defined (__WXPM__) diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index 64aeb305cb..04a10d4fc8 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -19,7 +19,7 @@ #include "wx/string.h" #include "wx/dynarray.h" -#if defined(__WXPM__) || defined(__EMX__) +#if defined(__OS2__) || defined(__EMX__) #include "wx/os2/private.h" #endif @@ -37,9 +37,9 @@ class WXDLLIMPEXP_BASE wxDynamicLibraryDetailsCreator; // conditional compilation // ---------------------------------------------------------------------------- -// Note: WXPM/EMX has to be tested first, since we want to use +// Note: __OS2__/EMX has to be tested first, since we want to use // native version, even if configure detected presence of DLOPEN. -#if defined(__WXPM__) || defined(__EMX__) || defined(__WINDOWS__) +#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__) typedef HMODULE wxDllType; #elif defined(HAVE_DLOPEN) #include @@ -250,7 +250,7 @@ public: return RawGetSymbol ( handle, - name + + name + #if wxUSE_UNICODE L'W' #else diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 5ade748af0..71f1ca14a6 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: filefn.h +// Name: wx/filefn.h // Purpose: File- and directory-related functions // Author: Julian Smart // Modified by: diff --git a/include/wx/motif/dcclient.h b/include/wx/motif/dcclient.h index 6d088a05c6..c8f182c135 100644 --- a/include/wx/motif/dcclient.h +++ b/include/wx/motif/dcclient.h @@ -82,7 +82,7 @@ public: WXGC GetGC() const { return m_gc; } WXGC GetBackingGC() const { return m_gcBacking; } WXDisplay* GetDisplay() const { return m_display; } - bool GetAutoSetting() const { return m_autoSetting; } + bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp void SetAutoSetting(bool flag) { m_autoSetting = flag; } protected: diff --git a/include/wx/motif/listbox.h b/include/wx/motif/listbox.h index 5604e1c1c4..8f4b5b04df 100644 --- a/include/wx/motif/listbox.h +++ b/include/wx/motif/listbox.h @@ -96,7 +96,7 @@ public: WXWidget GetTopWidget() const; #if wxUSE_CHECKLISTBOX - virtual void DoToggleItem(int item, int x) {}; + virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {}; #endif protected: virtual wxSize DoGetBestSize() const; diff --git a/include/wx/os2/private.h b/include/wx/os2/private.h index 6c34e32c5f..aab13247a9 100644 --- a/include/wx/os2/private.h +++ b/include/wx/os2/private.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: private.h +// Name: wx/os2/private.h // Purpose: Private declarations: as this header is only included by // wxWidgets itself, it may contain identifiers which don't start // with "wx". @@ -22,6 +22,19 @@ #define INCL_DOS #include +#if defined(__WATCOMC__) && defined(__WXMOTIF__) + #include + #define I_NEED_OS2_H + #include + #ifdef __cplusplus + extern "C" { + #endif + #include + #ifdef __cplusplus + } + #endif +#endif + #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA) typedef struct _SPBCDATA { @@ -37,6 +50,7 @@ #endif +#include "wx/dlimpexp.h" #include "wx/fontenc.h" class WXDLLEXPORT wxFont; @@ -260,21 +274,25 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); // global data // --------------------------------------------------------------------------- +#ifdef __WXOS2__ // The MakeProcInstance version of the function wxSubclassedGenericControlProc WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc; WXDLLEXPORT_DATA(extern wxChar*) wxBuffer; WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance; +#endif // --------------------------------------------------------------------------- // global functions // --------------------------------------------------------------------------- +#ifdef __WXOS2__ extern "C" { WXDLLEXPORT HINSTANCE wxGetInstance(); } WXDLLEXPORT void wxSetInstance(HINSTANCE hInst); +#endif #include "wx/thread.h" static inline MRESULT MySendMsg(HWND hwnd, ULONG ulMsgid, diff --git a/include/wx/platform.h b/include/wx/platform.h index 606ad4a8d9..545e5f7a56 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -398,14 +398,19 @@ __DARWIN__ for Darwin related corrections (wxMac, wxMotif) */ #elif defined(__OS2__) + + /* wxOS2 vs. non wxOS2 ports on OS2 platform */ +# ifndef __WXMOTIF__ +# ifndef __WXOS2__ +# define __WXOS2__ +# endif +# ifndef __WXPM__ +# define __WXPM__ +# endif +# endif + # if defined(__IBMCPP__) # define __VISAGEAVER__ __IBMCPP__ -# endif -# ifndef __WXOS2__ -# define __WXOS2__ -# endif -# ifndef __WXPM__ -# define __WXPM__ # endif /* Place other OS/2 compiler environment defines here */ diff --git a/include/wx/thread.h b/include/wx/thread.h index e25c3d0647..86b94bd467 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -733,7 +733,7 @@ public: #if wxUSE_THREADS -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXPM__) || defined(__EMX__) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__) // unlock GUI if there are threads waiting for and lock it back when // there are no more of them - should be called periodically by the main // thread @@ -742,10 +742,8 @@ public: // returns true if the main thread has GUI lock extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread(); -#ifndef __WXPM__ // wakes up the main thread if it's sleeping inside ::GetMessage() extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); -#endif // !OS/2 // return true if the main thread is waiting for some other to terminate: // wxApp then should block all "dangerous" messages @@ -755,4 +753,3 @@ public: #endif // wxUSE_THREADS #endif // _WX_THREAD_H_ - diff --git a/include/wx/thrimpl.cpp b/include/wx/thrimpl.cpp index 60ead20789..d0cf9fd610 100644 --- a/include/wx/thrimpl.cpp +++ b/include/wx/thrimpl.cpp @@ -64,12 +64,12 @@ wxMutexError wxMutex::Unlock() // wxConditionInternal // -------------------------------------------------------------------------- -#if defined(__WXMSW__) || defined(__WXPM__) || defined(__EMX__) +#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__) // Win32 and OS/2 don't have explicit support for the POSIX condition // variables and their events/event semaphores have quite different semantics, // so we reimplement the conditions from scratch using the mutexes and // semaphores -#if defined(__WXPM__) || defined(__EMX__) +#if defined(__OS2__) || defined(__EMX__) void InterlockedIncrement(LONG *num) { ::DosEnterCritSec(); diff --git a/include/wx/utils.h b/include/wx/utils.h index e2602b6e1e..4db552306c 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: utils.h +// Name: wx/utils.h // Purpose: Miscellaneous utilities // Author: Julian Smart // Modified by: @@ -26,7 +26,9 @@ class WXDLLIMPEXP_BASE wxArrayString; // wxLongLong #include "wx/longlong.h" -#ifdef __X__ +#ifdef __WATCOMC__ + #include +#elif defined(__X__) #include #include #endif diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index e70d943e6e..949149332d 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dynlib.cpp +// Name: src/common/dynlib.cpp // Purpose: Dynamic library management // Author: Guilhem Lavaux // Modified by: @@ -141,7 +141,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) /* static */ void wxDynamicLibrary::Unload(wxDllType handle) { -#if defined(__WXPM__) || defined(__EMX__) +#if defined(__OS2__) || defined(__EMX__) DosFreeModule( handle ); #elif defined(__WXMAC__) && !defined(__DARWIN__) CloseConnection( (CFragConnectionID*) &handle ); diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 6e4f6ddfef..022a830255 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: fileconf.cpp +// Name: src/common/fileconf.cpp // Purpose: implementation of wxFileConfig derivation of wxConfig // Author: Vadim Zeitlin // Modified by: @@ -271,7 +271,7 @@ wxString wxFileConfig::GetGlobalDir() strDir = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ; #elif defined( __UNIX__ ) strDir = wxT("/etc/"); -#elif defined(__WXPM__) +#elif defined(__OS2__) ULONG aulSysInfo[QSV_MAX] = {0}; UINT drive; APIRET rc; @@ -2076,4 +2076,3 @@ static wxString GetAppName(const wxString& appName) } #endif // wxUSE_CONFIG - diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 911dfaa146..8805dbdcb1 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1600,7 +1600,9 @@ bool wxLocale::Init(int language, int flags) wxString locale; // Set the locale: -#if defined(__UNIX__) && !defined(__WXMAC__) +#if defined(__OS2__) + wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString); +#elif defined(__UNIX__) && !defined(__WXMAC__) if (language == wxLANGUAGE_DEFAULT) locale = wxEmptyString; else @@ -1771,8 +1773,6 @@ bool wxLocale::Init(int language, int flags) wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); return false; } -#elif defined(__WXPM__) - wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString); #else return false; #define WX_NO_LOCALE_SUPPORT @@ -3554,4 +3554,3 @@ void wxLocale::InitLanguagesDB() // --- --- --- generated code ends here --- --- --- #endif // wxUSE_INTL - diff --git a/src/common/textbuf.cpp b/src/common/textbuf.cpp index 97178aeb6e..f7ca5e0818 100644 --- a/src/common/textbuf.cpp +++ b/src/common/textbuf.cpp @@ -3,6 +3,7 @@ // Purpose: implementation of wxTextBuffer class // Created: 14.11.01 // Author: Morten Hanssen, Vadim Zeitlin +// RCS-ID: $Id$ // Copyright: (c) 1998-2001 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -45,7 +46,7 @@ const wxTextFileType wxTextBuffer::typeDefault = wxTextFileType_Unix; #elif defined(__WXMAC__) wxTextFileType_Mac; -#elif defined(__WXPM__) +#elif defined(__OS2__) wxTextFileType_Os2; #else wxTextFileType_None; @@ -283,4 +284,3 @@ bool wxTextBuffer::Write(wxTextFileType typeNew, wxMBConv& conv) } #endif // wxUSE_TEXTBUFFER - diff --git a/src/motif/accel.cpp b/src/motif/accel.cpp index c434a2d893..5ee34248c5 100644 --- a/src/motif/accel.cpp +++ b/src/motif/accel.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: accel.cpp +// Name: src/motif/accel.cpp // Purpose: wxAcceleratorTable // Author: Julian Smart // Modified by: @@ -112,4 +112,3 @@ bool wxAcceleratorEntry::MatchesEvent(const wxKeyEvent& event) const (eventShiftDown == accShiftDown) && ((eventKeyCode == accKeyCode || eventKeyCode == accKeyCode2))) ; } - diff --git a/src/motif/app.cpp b/src/motif/app.cpp index 17ef7bc614..30f5e9b98f 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: app.cpp +// Name: src/motif/app.cpp // Purpose: wxApp // Author: Julian Smart // Modified by: @@ -292,8 +292,8 @@ wxXVisualInfo* wxApp::GetVisualInfo( WXDisplay* display ) return vi; } -static void wxTLWidgetDestroyCallback(Widget w, XtPointer clientData, - XtPointer ptr) +static void wxTLWidgetDestroyCallback(Widget w, XtPointer WXUNUSED(clientData), + XtPointer WXUNUSED(ptr)) { if( wxTheApp ) { @@ -322,7 +322,7 @@ WXWidget wxCreateTopLevelWidget( WXDisplay* display ) return (WXWidget)tlw; } -WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* display ) +WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* WXUNUSED(display) ) { Widget rTlw = XtVaCreateWidget( "dummy_widget", topLevelShellWidgetClass, (Widget)wxTheApp->GetTopLevelWidget(), diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index af308732cf..40bd97b453 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -352,7 +352,7 @@ void wxChoice::SetColumns(int n) { if (n<1) n = 1 ; - short numColumns = n ; + short numColumns = (short)n ; Arg args[3]; XtSetArg(args[0], XmNnumColumns, numColumns); diff --git a/src/motif/clipbrd.cpp b/src/motif/clipbrd.cpp index ea980004f2..94cbda42b3 100644 --- a/src/motif/clipbrd.cpp +++ b/src/motif/clipbrd.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: clipbrd.cpp +// Name: src/motif/clipbrd.cpp // Purpose: Clipboard functionality // Author: Julian Smart // Modified by: Mattia Barbon (added support for generic wxDataObjects) // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -191,7 +191,7 @@ wxClipboard::wxClipboard() wxClipboard::~wxClipboard() { - Clear(); + Clear(); } void wxClipboard::Clear() @@ -215,7 +215,7 @@ void wxClipboard::Clear() bool wxClipboard::Open() { wxCHECK_MSG( !m_open, false, "clipboard already open" ); - + m_open = true; return true; @@ -236,10 +236,10 @@ wxDEFINE_SCOPED_ARRAY( wxDataFormat, wxDataFormatScopedArray ); #if wxCHECK_LESSTIF() void wxClipboardCallback( Widget xwidget, int* data_id, - int* priv, int* reason ) + int* priv, int* WXUNUSED(reason) ) #else void wxClipboardCallback( Widget xwidget, long* data_id, - long* priv, int* reason ) + long* priv, int* WXUNUSED(reason) ) #endif { Display* xdisplay = XtDisplay( xwidget ); @@ -326,7 +326,7 @@ bool wxClipboard::AddData( wxDataObject *data ) void wxClipboard::Close() { wxCHECK_RET( m_open, "clipboard not open" ); - + m_open = false; } @@ -415,7 +415,7 @@ bool wxClipboard::GetData( wxDataObject& data ) size_t dfcount = data.GetFormatCount( wxDataObject::Set ); wxDataFormatScopedArray dfarr( new wxDataFormat[dfcount] ); data.GetAllFormats( dfarr.get(), wxDataObject::Set ); - + if( XmClipboardInquireCount( xdisplay, xwindow, &count, &max_name_length ) == XmClipboardSuccess ) { diff --git a/src/motif/colour.cpp b/src/motif/colour.cpp index 1cc7b3e3a1..473e202864 100644 --- a/src/motif/colour.cpp +++ b/src/motif/colour.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: colour.cpp +// Name: src/motif/colour.cpp // Purpose: wxColour class // Author: Julian Smart // Modified by: // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// //// TODO: make wxColour a ref-counted object, @@ -88,9 +88,9 @@ wxColour wxColour::CreateByName(const wxString& name) XColor xcol; if ( XParseColor( dpy, (Colormap)colormap, name.mb_str(), &xcol ) ) { - col.m_red = xcol.red & 0xff; - col.m_green = xcol.green & 0xff; - col.m_blue = xcol.blue & 0xff; + col.m_red = (unsigned char)(xcol.red & 0xff); + col.m_green = (unsigned char)(xcol.green & 0xff); + col.m_blue = (unsigned char)(xcol.blue & 0xff); col.m_isInit = true; col.m_pixel = -1; } @@ -126,11 +126,11 @@ int wxColour::AllocColour(WXDisplay* display, bool realloc) XColor color; color.red = (unsigned short) Red (); - color.red |= color.red << 8; + color.red |= (unsigned short)(color.red << 8); color.green = (unsigned short) Green (); - color.green |= color.green << 8; + color.green |= (unsigned short)(color.green << 8); color.blue = (unsigned short) Blue (); - color.blue |= color.blue << 8; + color.blue |= (unsigned short)(color.blue << 8); color.flags = DoRed | DoGreen | DoBlue; diff --git a/src/motif/combobox_native.cpp b/src/motif/combobox_native.cpp index e63ac735e0..e6672c200a 100644 --- a/src/motif/combobox_native.cpp +++ b/src/motif/combobox_native.cpp @@ -166,7 +166,7 @@ wxComboBox::~wxComboBox() m_clientDataDict.DestroyData(); } -void wxComboBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) +void wxComboBox::DoSetSize(int x, int y, int width, int WXUNUSED(height), int sizeFlags) { // Necessary so it doesn't call wxChoice::SetSize wxWindow::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags); @@ -292,7 +292,7 @@ wxString wxComboBox::GetString(int n) const return wxDoGetStringInList( GetXmList(this), n ); } -int wxComboBox::FindString(const wxString& s, bool bCase) const +int wxComboBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const { // FIXME: back to base class for not supported value of bCase diff --git a/src/motif/cursor.cpp b/src/motif/cursor.cpp index eab953674a..a3af9a13da 100644 --- a/src/motif/cursor.cpp +++ b/src/motif/cursor.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cursor.cpp +// Name: src/motif/cursor.cpp // Purpose: wxCursor class // Author: Julian Smart // Modified by: // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -19,7 +19,7 @@ #include "wx/window.h" #if wxUSE_IMAGE #include "wx/image.h" -#endif +#endif #ifdef __VMS__ #pragma message disable nosimpint @@ -51,7 +51,7 @@ class WXDLLEXPORT wxCursorRefData: public wxObjectRefData public: wxCursorRefData(); ~wxCursorRefData(); - + wxXCursorList m_cursors; // wxXCursor objects, one per display wxStockCursor m_cursorId; // wxWidgets standard cursor id }; @@ -94,7 +94,8 @@ wxCursor::wxCursor(const wxImage & image) unsigned char * bits = new unsigned char [imagebitcount]; unsigned char * maskBits = new unsigned char [imagebitcount]; - int i, j, i8; unsigned char c, cMask; + int i, j, i8; + unsigned char c, cMask; for (i=0; i mid grey + c = (unsigned char)(rgbBits[(i8+j)*3]/3 + rgbBits[(i8+j)*3+1]/3 + rgbBits[(i8+j)*3+2]/3); + // if average value is > mid grey if (c>127) bits[i] = bits[i] & cMask; - cMask = (cMask << 1) | 1; + cMask = (unsigned char)((cMask << 1) | 1); } } @@ -129,7 +130,7 @@ wxCursor::wxCursor(const wxImage & image) { if (rgbBits[(i8+j)*3] != r || rgbBits[(i8+j)*3+1] != g || rgbBits[(i8+j)*3+2] != b) maskBits[i] = maskBits[i] | cMask; - cMask = (cMask << 1); + cMask = (unsigned char)(cMask << 1); } } } @@ -219,7 +220,7 @@ void wxCursor::Create(WXPixmap pixmap, WXPixmap mask_pixmap, (Pixmap)mask_pixmap, &foreground_color, &background_color, - hotSpotX , + hotSpotX , hotSpotY); if (cursor) @@ -337,17 +338,18 @@ WXCursor wxCursor::MakeCursor(WXDisplay* display, wxStockCursor id) const switch (id) { + case wxCURSOR_CHAR: return (WXCursor)cursor; + case wxCURSOR_WAIT: x_cur = XC_watch; break; - case wxCURSOR_CROSS: x_cur = XC_crosshair; break; - case wxCURSOR_CHAR: return (WXCursor)cursor; break; + case wxCURSOR_CROSS: x_cur = XC_crosshair; break; case wxCURSOR_HAND: x_cur = XC_hand1; break; case wxCURSOR_BULLSEYE: x_cur = XC_target; break; - case wxCURSOR_PENCIL: x_cur = XC_pencil; break; - case wxCURSOR_MAGNIFIER: x_cur = XC_sizing; break; - case wxCURSOR_IBEAM: x_cur = XC_xterm; break; + case wxCURSOR_PENCIL: x_cur = XC_pencil; break; + case wxCURSOR_MAGNIFIER: x_cur = XC_sizing; break; + case wxCURSOR_IBEAM: x_cur = XC_xterm; break; case wxCURSOR_NO_ENTRY: x_cur = XC_pirate; break; - case wxCURSOR_LEFT_BUTTON: x_cur = XC_leftbutton; break; - case wxCURSOR_RIGHT_BUTTON: x_cur = XC_rightbutton; break; + case wxCURSOR_LEFT_BUTTON: x_cur = XC_leftbutton; break; + case wxCURSOR_RIGHT_BUTTON: x_cur = XC_rightbutton; break; case wxCURSOR_MIDDLE_BUTTON: x_cur = XC_middlebutton; break; case wxCURSOR_QUESTION_ARROW: x_cur = XC_question_arrow; break; case wxCURSOR_SIZING: x_cur = XC_sizing; break; @@ -451,7 +453,7 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor) XFlush (display); - for(wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst (); node; + for(wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst (); node; node = node->GetNext()) { wxWindow *child = node->GetData (); diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 51919e9a08..989387e18a 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dcclient.cpp +// Name: src/motif/dcclient.cpp // Purpose: wxClientDC class // Author: Julian Smart // Modified by: @@ -10,7 +10,7 @@ ///////////////////////////////////////////////////////////////////////////// /* - About pens, brushes, and the autoSetting flag: + About pens, brushes, and the m_autoSetting flag: Under X, pens and brushes control some of the same X drawing parameters. Therefore, it is impossible to independently maintain @@ -18,9 +18,9 @@ the current logical function. The m_currentFill, etc. instance variables remember state across the brush and pen. - Since pens are used more than brushes, the autoSetting flag is used to + Since pens are used more than brushes, the m_autoSetting flag is used to indicate that a brush was recently used, and SetPen must be called to - reinstall the current pen's parameters. If autoSetting includes 0x2, then the + reinstall the current pen's parameters. If m_autoSetting includes 0x2, then the pens color may need to be set based on XOR. There is, unfortunately, some confusion between setting the current pen/brush @@ -1319,7 +1319,7 @@ wxCoord wxWindowDC::GetCharWidth() const { wxCHECK_MSG( Ok(), 0, "invalid dc" ); wxCHECK_MSG( m_font.Ok(), 0, "invalid font" ); - + int width; wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY, diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 0b812eadba..ec095ae2c3 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dialog.cpp +// Name: src/motif/dialog.cpp // Purpose: wxDialog class // Author: Julian Smart // Modified by: @@ -304,7 +304,7 @@ bool wxDialog::Show( bool show ) else XtManageChild((Widget)m_mainWidget) ; - XRaiseWindow( XtDisplay( (Widget)m_mainWidget ), + XRaiseWindow( XtDisplay( (Widget)m_mainWidget ), XtWindow( (Widget)m_mainWidget) ); } diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index c292a0e61b..87d0c0611a 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -381,11 +381,9 @@ private: unsigned int m_nPriority; // thread priority in "wx" units }; -void wxThreadInternal::OS2ThreadStart( - void * pParam -) +void wxThreadInternal::OS2ThreadStart( void * pParam ) { - DWORD dwRet; + DWORD dwRet; bool bWasCancelled; wxThread *pThread = (wxThread *)pParam; diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index cf11e65ba8..0496afeeef 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -41,7 +41,7 @@ #ifdef __WXGTK20__ #include "gtk/gtk.h" extern GtkWidget *wxGetRootWindow(); -#endif +#endif // __WXGTK20__ extern "C" int wxCMPFUNC_CONV wxCompareFamilies (const void *a, const void *b) @@ -66,11 +66,11 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, OnFacename( wxT("monospace") ); } else -#endif +#endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE { PangoFontFamily **families = NULL; gint n_families = 0; - pango_context_list_families ( + pango_context_list_families ( #ifdef __WXGTK20__ gtk_widget_get_pango_context( wxGetRootWindow() ), #else @@ -97,12 +97,12 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, g_free(families); } - return TRUE; + return true; } bool wxFontEnumerator::EnumerateEncodings(const wxString& family) { - return FALSE; + return false; } @@ -205,7 +205,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This, if ( !This->OnFacename(fam) ) { // stop enumerating - return FALSE; + return false; } families.Add(fam); @@ -213,7 +213,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This, //else: already seen } - return TRUE; + return true; } #endif // wxUSE_NANOX @@ -226,14 +226,14 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool fixedWidthOnly) { #if wxUSE_NANOX - return FALSE; + return false; #else int nFonts; char **fonts; if ( fixedWidthOnly ) { - bool cont = TRUE; + bool cont = true; fonts = CreateFontList(wxT('m'), encoding, &nFonts); if ( fonts ) { @@ -244,13 +244,13 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, if ( !cont ) { - return TRUE; + return true; } fonts = CreateFontList(wxT('c'), encoding, &nFonts); if ( !fonts ) { - return TRUE; + return true; } } else @@ -264,14 +264,14 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, wxASSERT_MSG(encoding != wxFONTENCODING_SYSTEM, wxT("No fonts at all on this system?")); - return FALSE; + return false; } } (void)ProcessFamiliesFromFontList(this, fonts, nFonts); XFreeFontNames(fonts); - return TRUE; + return true; #endif // wxUSE_NANOX } @@ -279,11 +279,11 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool wxFontEnumerator::EnumerateEncodings(const wxString& family) { #if wxUSE_NANOX - return FALSE; + return false; #else wxString pattern; pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"), - family.IsEmpty() ? wxT("*") : family.c_str()); + family.empty() ? wxT("*") : family.c_str()); // get the list of all fonts int nFonts; @@ -293,7 +293,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) if ( !fonts ) { // unknown family? - return FALSE; + return false; } // extract the list of (unique) encodings @@ -313,7 +313,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) dash = strchr(familyFont, '-'); *dash = '\0'; // !NULL because Matches() above succeeded - if ( !family.IsEmpty() && (family != familyFont) ) + if ( !family.empty() && (family != familyFont) ) { // family doesn't match continue; @@ -344,10 +344,9 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) XFreeFontNames(fonts); - return TRUE; + return true; #endif // wxUSE_NANOX } -#endif - // __WXGTK20__ +#endif // !wxUSE_PANGO diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index cf77187acb..84c7abec5d 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: unix/fontutil.cpp +// Name: src/unix/fontutil.cpp // Purpose: Font helper functions for X11 (GDK/X) // Author: Vadim Zeitlin // Modified by: @@ -122,7 +122,7 @@ wxFontWeight wxNativeFontInfo::GetWeight() const bool wxNativeFontInfo::GetUnderlined() const { - return FALSE; + return false; } wxString wxNativeFontInfo::GetFaceName() const @@ -278,7 +278,7 @@ bool wxNativeFontInfo::FromString(const wxString& s) description = pango_font_description_from_string( wxGTK_CONV( s ) ); - return TRUE; + return true; } wxString wxNativeFontInfo::ToString() const @@ -306,7 +306,7 @@ wxString wxNativeFontInfo::ToUserString() const bool wxNativeEncodingInfo::FromString(const wxString& s) { - return FALSE; + return false; } wxString wxNativeEncodingInfo::ToString() const @@ -316,7 +316,7 @@ wxString wxNativeEncodingInfo::ToString() const bool wxTestFontEncoding(const wxNativeEncodingInfo& info) { - return TRUE; + return true; } bool wxGetNativeFontEncoding(wxFontEncoding encoding, @@ -431,28 +431,28 @@ bool wxNativeEncodingInfo::FromString(const wxString& s) wxString encid = tokenizer.GetNextToken(); long enc; if ( !encid.ToLong(&enc) ) - return FALSE; + return false; encoding = (wxFontEncoding)enc; xregistry = tokenizer.GetNextToken(); if ( !xregistry ) - return FALSE; + return false; xencoding = tokenizer.GetNextToken(); if ( !xencoding ) - return FALSE; + return false; // ok even if empty facename = tokenizer.GetNextToken(); - return TRUE; + return true; } wxString wxNativeEncodingInfo::ToString() const { wxString s; s << (long)encoding << _T(';') << xregistry << _T(';') << xencoding; - if ( !!facename ) + if ( !facename.empty() ) { s << _T(';') << facename; } @@ -466,7 +466,7 @@ wxString wxNativeEncodingInfo::ToString() const void wxNativeFontInfo::Init() { - m_isDefault = TRUE; + m_isDefault = true; } bool wxNativeFontInfo::FromString(const wxString& s) @@ -476,13 +476,13 @@ bool wxNativeFontInfo::FromString(const wxString& s) // check the version wxString token = tokenizer.GetNextToken(); if ( token != _T('0') ) - return FALSE; + return false; xFontName = tokenizer.GetNextToken(); // this should be the end if ( tokenizer.HasMoreTokens() ) - return FALSE; + return false; return FromXFontName(xFontName); } @@ -512,13 +512,13 @@ bool wxNativeFontInfo::HasElements() const wxString wxNativeFontInfo::GetXFontComponent(wxXLFDField field) const { - wxCHECK_MSG( field < wxXLFD_MAX, _T(""), _T("invalid XLFD field") ); + wxCHECK_MSG( field < wxXLFD_MAX, wxEmptyString, _T("invalid XLFD field") ); if ( !HasElements() ) { // const_cast if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) ) - return _T(""); + return wxEmptyString; } return fontElements[field]; @@ -531,7 +531,7 @@ bool wxNativeFontInfo::FromXFontName(const wxString& fontname) // skip the leading, usually empty field (font name registry) if ( !tokenizer.HasMoreTokens() ) - return FALSE; + return false; (void)tokenizer.GetNextToken(); @@ -540,14 +540,14 @@ bool wxNativeFontInfo::FromXFontName(const wxString& fontname) if ( !tokenizer.HasMoreTokens() ) { // not enough elements in the XLFD - or maybe an alias - return FALSE; + return false; } wxString field = tokenizer.GetNextToken(); if ( !field.empty() && field != _T('*') ) { // we're really initialized now - m_isDefault = FALSE; + m_isDefault = false; } fontElements[n] = field; @@ -555,9 +555,9 @@ bool wxNativeFontInfo::FromXFontName(const wxString& fontname) // this should be all if ( tokenizer.HasMoreTokens() ) - return FALSE; + return false; - return TRUE; + return true; } wxString wxNativeFontInfo::GetXFontName() const @@ -615,7 +615,7 @@ void wxNativeFontInfo::SetXFontName(const wxString& xFontName_) xFontName = xFontName_; - m_isDefault = FALSE; + m_isDefault = false; } int wxNativeFontInfo::GetPointSize() const @@ -668,7 +668,7 @@ wxFontWeight wxNativeFontInfo::GetWeight() const bool wxNativeFontInfo::GetUnderlined() const { // X fonts are never underlined - return FALSE; + return false; } wxString wxNativeFontInfo::GetFaceName() const @@ -758,7 +758,7 @@ void wxNativeFontInfo::SetFaceName(const wxString& facename) SetXFontComponent(wxXLFD_FAMILY, facename); } -void wxNativeFontInfo::SetFamily(wxFontFamily family) +void wxNativeFontInfo::SetFamily(wxFontFamily WXUNUSED(family)) { // wxFontFamily -> X foundry, anyone? wxFAIL_MSG( _T("not implemented") ); @@ -783,7 +783,7 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding) bool wxGetNativeFontEncoding(wxFontEncoding encoding, wxNativeEncodingInfo *info) { - wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") ); + wxCHECK_MSG( info, false, _T("bad pointer in wxGetNativeFontEncoding") ); if ( encoding == wxFONTENCODING_DEFAULT ) { @@ -860,12 +860,12 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding, default: // don't know how to translate this encoding into X fontspec - return FALSE; + return false; } info->encoding = encoding; - return TRUE; + return true; } bool wxTestFontEncoding(const wxNativeEncodingInfo& info) @@ -929,7 +929,7 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, wxNativeFont font = 0; // if we already have the X font name, try to use it - if( xFontName && !xFontName->IsEmpty() ) + if( xFontName && !xFontName->empty() ) { // // Make sure point size is correct for scale factor. @@ -1042,7 +1042,7 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, if ( !font ) { font = wxLoadQueryFont(-1, wxDEFAULT, wxNORMAL, wxNORMAL, - FALSE, wxEmptyString, + false, wxEmptyString, info.xregistry, info.xencoding, xFontName); @@ -1055,7 +1055,7 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, font = wxLoadQueryFont(-1, wxDEFAULT, wxNORMAL, wxNORMAL, - FALSE, wxEmptyString, + false, wxEmptyString, _T("*"), _T("*"), xFontName); } @@ -1071,20 +1071,20 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // private functions // ---------------------------------------------------------------------------- -// returns TRUE if there are any fonts matching this font spec +// returns true if there are any fonts matching this font spec static bool wxTestFontSpec(const wxString& fontspec) { // some X servers will fail to load this font because there are too many // matches so we must test explicitly for this if ( fontspec == _T("-*-*-*-*-*-*-*-*-*-*-*-*-*-*") ) { - return TRUE; + return true; } wxNativeFont test = (wxNativeFont) g_fontHash->Get( fontspec ); if (test) { - return TRUE; + return true; } test = wxLoadFont(fontspec); @@ -1094,11 +1094,11 @@ static bool wxTestFontSpec(const wxString& fontspec) { wxFreeFont(test); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1195,7 +1195,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, #else wxString fontSpec; - if (!facename.IsEmpty()) + if (!facename.empty()) { fontSpec.Printf(wxT("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"), facename.c_str()); @@ -1393,7 +1393,7 @@ bool wxFontModule::OnInit() { g_fontHash = new wxHashTable( wxKEY_STRING ); - return TRUE; + return true; } void wxFontModule::OnExit() @@ -1404,4 +1404,3 @@ void wxFontModule::OnExit() } #endif // GTK 2.0/1.x - diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp index c31f11ee97..cce966d98e 100644 --- a/src/unix/utilsx11.cpp +++ b/src/unix/utilsx11.cpp @@ -297,7 +297,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature) False, XA_WINDOW, &type, &format, &nwins, &after, (unsigned char **)&wins); if ( type != XA_WINDOW || nwins <= 0 || wins[0] == None ) - return FALSE; + return false; XFree(wins); // Query for supported features: @@ -306,7 +306,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature) False, XA_ATOM, &type, &format, &natoms, &after, (unsigned char **)&atoms); if ( type != XA_ATOM || atoms == NULL ) - return FALSE; + return false; // Lookup the feature we want: for (unsigned i = 0; i < natoms; i++) @@ -314,11 +314,11 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature) if ( atoms[i] == feature ) { XFree(atoms); - return TRUE; + return true; } } XFree(atoms); - return FALSE; + return false; } #endif @@ -381,7 +381,7 @@ static bool wxKwinRunning(Display *display, Window rootWnd) &type, &format, &nitems, &after, (unsigned char**)&data) != Success) { - return FALSE; + return false; } bool retval = (type == KWIN_RUNNING && @@ -427,7 +427,7 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd, } XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32, - PropModeReplace, (unsigned char *) &data, lng); + PropModeReplace, (unsigned char *) &data[0], lng); XSync(display, False); if (wasMapped) @@ -812,8 +812,3 @@ bool wxGetKeyState(wxKeyCode key) } #endif // __WXX11__ || __WXGTK__ || __WXMOTIF__ - - - - - diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index a929735541..919eef3a12 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.cpp +// Name: src/x11/bitmap.cpp // Purpose: wxBitmap // Author: Julian Smart, Robert Roebling // Modified by: @@ -9,6 +9,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/bitmap.h" #include "wx/icon.h" #include "wx/log.h" @@ -88,7 +91,7 @@ bool wxMask::Create( const wxBitmap& bitmap, m_display = bitmap.GetDisplay(); wxImage image = bitmap.ConvertToImage(); - if (!image.Ok()) return FALSE; + if (!image.Ok()) return false; m_display = bitmap.GetDisplay(); @@ -114,21 +117,21 @@ bool wxMask::Create( const wxBitmap& bitmap, if (bpp == 15) { - red = red & 0xf8; - green = green & 0xf8; - blue = blue & 0xf8; + red &= 0xf8; + green &= 0xf8; + blue &= 0xf8; } else if (bpp == 16) { - red = red & 0xf8; - green = green & 0xfc; - blue = blue & 0xf8; + red &= 0xf8; + green &= 0xfc; + blue &= 0xf8; } else if (bpp == 12) { - red = red & 0xf0; - green = green & 0xf0; - blue = blue & 0xf0; + red &= 0xf0; + green &= 0xf0; + blue &= 0xf0; } XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) ); @@ -164,9 +167,9 @@ bool wxMask::Create( const wxBitmap& bitmap, XFreeGC( xdisplay, gc ); - return TRUE; + return true; #else - return FALSE; + return false; #endif // wxUSE_NANOX } @@ -176,7 +179,7 @@ bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex ) unsigned char r,g,b; wxPalette *pal = bitmap.GetPalette(); - wxCHECK_MSG( pal, FALSE, wxT("Cannot create mask from bitmap without palette") ); + wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") ); pal->GetRGB(paletteIndex, &r, &g, &b); @@ -192,9 +195,9 @@ bool wxMask::Create( const wxBitmap& bitmap ) m_bitmap = NULL; } - if (!bitmap.Ok()) return FALSE; + if (!bitmap.Ok()) return false; - wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") ); + wxCHECK_MSG( bitmap.GetBitmap(), false, wxT("Cannot create mask from colour bitmap") ); m_display = bitmap.GetDisplay(); @@ -203,7 +206,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) m_bitmap = (WXPixmap) XCreatePixmap( (Display*) m_display, xroot, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); - if (!m_bitmap) return FALSE; + if (!m_bitmap) return false; GC gc = XCreateGC( (Display*) m_display, (Pixmap) m_bitmap, 0, NULL ); @@ -212,9 +215,9 @@ bool wxMask::Create( const wxBitmap& bitmap ) XFreeGC( (Display*) m_display, gc ); - return TRUE; + return true; #else - return FALSE; + return false; #endif // wxUSE_NANOX } @@ -309,7 +312,7 @@ bool wxBitmap::Create( int width, int height, int depth ) { UnRef(); - wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") ) + wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") ) m_refData = new wxBitmapRefData(); @@ -324,7 +327,7 @@ bool wxBitmap::Create( int width, int height, int depth ) if (depth == -1) depth = bpp; wxCHECK_MSG( (depth == bpp) || - (depth == 1), FALSE, wxT("invalid bitmap depth") ) + (depth == 1), false, wxT("invalid bitmap depth") ) M_BMPDATA->m_mask = (wxMask *) NULL; M_BMPDATA->m_width = width; @@ -367,7 +370,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type, wxLogWarning(wxT("no data bitmap handler for type %ld defined."), (long)type); - return FALSE; + return false; } return handler->Create(this, data, type, width, height, depth); @@ -415,7 +418,7 @@ bool wxBitmap::Create(WXPixmap pixmap) bool wxBitmap::CreateFromXpm( const char **bits ) { - wxCHECK_MSG( bits, FALSE, wxT("NULL pointer in wxBitmap::CreateFromXpm") ); + wxCHECK_MSG( bits, false, wxT("NULL pointer in wxBitmap::CreateFromXpm") ); return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); } @@ -426,14 +429,14 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (!image.Ok()) { wxASSERT_MSG(image.Ok(), wxT("Invalid wxImage passed to wxBitmap::CreateFromImage.")); - return FALSE; + return false; } int w = image.GetWidth(); int h = image.GetHeight(); if (!Create(w, h, depth)) - return FALSE; + return false; // Unfortunately the mask has to be screen-depth since // 1-bpp bitmaps don't seem to be supported @@ -467,7 +470,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) maskGC = GrNewGC(); maskPixmap = GrNewPixmap(w, h, 0); if (!maskPixmap) - hasMask = FALSE; + hasMask = false; else { wxMask* mask = new wxMask; @@ -525,14 +528,14 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (hasMask) GrDestroyGC(maskGC); - return TRUE; + return true; #else // !wxUSE_NANOX UnRef(); - wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) - wxCHECK_MSG( depth == -1, FALSE, wxT("invalid bitmap depth") ) + wxCHECK_MSG( image.Ok(), false, wxT("invalid image") ) + wxCHECK_MSG( depth == -1, false, wxT("invalid bitmap depth") ) m_refData = new wxBitmapRefData(); @@ -568,7 +571,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (data_image->data == NULL) { wxLogError( wxT("Out of memory.") ); // TODO clean - return FALSE; + return false; } M_BMPDATA->m_pixmap = (WXPixmap) XCreatePixmap( xdisplay, xroot, width, height, depth ); @@ -584,7 +587,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (mask_image->data == NULL) { wxLogError( wxT("Out of memory.") ); // TODO clean - return FALSE; + return false; } wxMask *mask = new wxMask(); @@ -743,7 +746,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) } } - return TRUE; + return true; #endif // wxUSE_NANOX } @@ -812,7 +815,7 @@ wxImage wxBitmap::ConvertToImage() const int red_shift_left = 0; int green_shift_left = 0; int blue_shift_left = 0; - bool use_shift = FALSE; + bool use_shift = false; if (GetPixmap()) { @@ -862,15 +865,15 @@ wxImage wxBitmap::ConvertToImage() const } else if (use_shift) { - data[pos] = (pixel >> red_shift_right) << red_shift_left; - data[pos+1] = (pixel >> green_shift_right) << green_shift_left; - data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left; + data[pos] = (unsigned char)((pixel >> red_shift_right) << red_shift_left); + data[pos+1] = (unsigned char)((pixel >> green_shift_right) << green_shift_left); + data[pos+2] = (unsigned char)((pixel >> blue_shift_right) << blue_shift_left); } else if (colors) { - data[pos] = colors[pixel].red >> 8; - data[pos+1] = colors[pixel].green >> 8; - data[pos+2] = colors[pixel].blue >> 8; + data[pos] = (unsigned char)(colors[pixel].red >> 8); + data[pos+1] = (unsigned char)(colors[pixel].green >> 8); + data[pos+2] = (unsigned char)(colors[pixel].blue >> 8); } else { @@ -983,7 +986,7 @@ void wxBitmap::SetMask( wxMask *mask ) bool wxBitmap::CopyFromIcon(const wxIcon& icon) { *this = icon; - return TRUE; + return true; } wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const @@ -1034,7 +1037,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette ) const { - wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") ); + wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") ); wxBitmapHandler *handler = FindHandler(type); @@ -1044,7 +1047,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, wxImage image(this->ConvertToImage()); if (image.Ok()) return image.SaveFile( name, type ); - return FALSE; + return false; } return handler->SaveFile(this, name, type, palette); @@ -1054,7 +1057,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) { UnRef(); - if (!wxFileExists(name)) return FALSE; + if (!wxFileExists(name)) return false; wxBitmapHandler *handler = FindHandler(type); @@ -1062,14 +1065,14 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) { wxImage image; if (!image.LoadFile( name, type )) - return FALSE; + return false; if (image.Ok()) { *this = wxBitmap(image); - return TRUE; + return true; } - else return FALSE; + else return false; } return handler->LoadFile(this, name, type, -1, -1); @@ -1173,14 +1176,14 @@ bool wxGetImageFromDrawable(GR_DRAW_ID drawable, int srcX, int srcY, int width, if (sinfo.pixtype == MWPF_PALETTE) { if(!(palette = (GR_PALETTE*) malloc(sizeof(GR_PALETTE)))) { - return FALSE; + return false; } GrGetSystemPalette(palette); } if(!(pixels = (GR_PIXELVAL*) malloc(sizeof(GR_PIXELVAL) * width * height))) { - return FALSE; + return false; } image.Create(width, height); @@ -1238,7 +1241,7 @@ bool wxGetImageFromDrawable(GR_DRAW_ID drawable, int srcX, int srcY, int width, free(pixels); if(palette) free(palette); - return TRUE; + return true; } #if 0 @@ -1329,16 +1332,16 @@ public: virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); - virtual bool Create(wxBitmap *bitmap, void *data, long flags, - int width, int height, int depth = 1) - { return FALSE; } + virtual bool Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(flags), + int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth) = 1) + { return false; } }; IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler); bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, - long flags, int desiredWidth, - int desiredHeight) + long WXUNUSED(flags), int WXUNUSED(desiredWidth), + int WXUNUSED(desiredHeight)) { #if wxHAVE_LIB_XPM if (!bitmap->GetRefData()) @@ -1385,10 +1388,10 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, { UnRef(); - return FALSE; + return false; } - return TRUE; + return true; #elif wxUSE_STREAMS wxXPMDecoder decoder; wxFileInputStream stream(name); @@ -1398,9 +1401,9 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, return image.Ok() && bitmap->CreateFromImage(image); } - return FALSE; + return false; #else // !wxHAVE_LIB_XPM && !wxUSE_STREAMS - return FALSE; + return false; #endif // wxHAVE_LIB_XPM / wxUSE_STREAMS } @@ -1411,7 +1414,7 @@ bool wxXPMFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, wxImage image(bitmap->ConvertToImage()); if (image.Ok()) return image.SaveFile( name, (wxBitmapType)type ); - return FALSE; + return false; } #endif // wxHAVE_LIB_XPM || wxUSE_STREAMS @@ -1431,13 +1434,18 @@ public: SetType( wxBITMAP_TYPE_XPM_DATA ); }; - virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight) - { return FALSE; } + virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), + const wxString& WXUNUSED(name), + long WXUNUSED(flags), + int WXUNUSED(desiredWidth), + int WXUNUSED(desiredHeight)) + { return false; } - virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, - int type, const wxPalette *palette = NULL) - { return FALSE; } + virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), + const wxString& WXUNUSED(name), + int WXUNUSED(type), + const wxPalette *WXUNUSED(palette) = NULL) + { return false; } virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); @@ -1447,10 +1455,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler); bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits, long WXUNUSED(flags), - int width, int height, int WXUNUSED(depth)) + int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth)) { #if wxHAVE_LIB_XPM - wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ) + wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") ) if (!bitmap->GetRefData()) bitmap->SetRefData( new wxBitmapRefData() ); @@ -1500,13 +1508,13 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits, M_BMPHANDLERDATA->m_mask->SetBitmap( (WXPixmap) mask ); M_BMPHANDLERDATA->m_mask->SetDisplay( xdisplay ); } - return TRUE; + return true; } else { bitmap->UnRef(); - return FALSE; + return false; } #else // !wxHAVE_LIB_XPM wxXPMDecoder decoder; @@ -1532,13 +1540,18 @@ public: SetType( wxBITMAP_TYPE_XBM_DATA ); }; - virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight) - { return FALSE; } + virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), + const wxString& WXUNUSED(name), + long WXUNUSED(flags), + int WXUNUSED(desiredWidth), + int WXUNUSED(desiredHeight)) + { return false; } - virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, - int type, const wxPalette *palette = NULL) - { return FALSE; } + virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), + const wxString& WXUNUSED(name), + int WXUNUSED(type), + const wxPalette *WXUNUSED(palette) = NULL) + { return false; } virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); @@ -1569,9 +1582,9 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *bits, M_BMPHANDLERDATA->m_height = height; M_BMPHANDLERDATA->m_bpp = 1; - return TRUE; + return true; #else - wxCHECK_MSG( M_BMPHANDLERDATA->m_bitmap, FALSE, + wxCHECK_MSG( M_BMPHANDLERDATA->m_bitmap, false, wxT("couldn't create bitmap") ); #endif } diff --git a/src/x11/brush.cpp b/src/x11/brush.cpp index e67d46f0d2..736dcc6cfd 100644 --- a/src/x11/brush.cpp +++ b/src/x11/brush.cpp @@ -9,7 +9,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/setup.h" +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/utils.h" #include "wx/brush.h" #include "wx/bitmap.h" @@ -26,21 +28,21 @@ public: { m_style = 0; } - + wxBrushRefData( const wxBrushRefData& data ) { m_style = data.m_style; m_stipple = data.m_stipple; m_colour = data.m_colour; } - + bool operator == (const wxBrushRefData& data) const { return (m_style == data.m_style && m_stipple == data.m_stipple && m_colour == data.m_colour); } - + int m_style; wxColour m_colour; wxBitmap m_stipple; @@ -89,10 +91,10 @@ wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const bool wxBrush::operator == ( const wxBrush& brush ) const { - if (m_refData == brush.m_refData) return TRUE; - - if (!m_refData || !brush.m_refData) return FALSE; - + if (m_refData == brush.m_refData) return true; + + if (!m_refData || !brush.m_refData) return false; + return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData ); } @@ -132,28 +134,28 @@ wxBitmap *wxBrush::GetStipple() const void wxBrush::SetColour( const wxColour& col ) { AllocExclusive(); - + M_BRUSHDATA->m_colour = col; } void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) { AllocExclusive(); - + M_BRUSHDATA->m_colour.Set( r, g, b ); } void wxBrush::SetStyle( int style ) { AllocExclusive(); - + M_BRUSHDATA->m_style = style; } void wxBrush::SetStipple( const wxBitmap& stipple ) { AllocExclusive(); - + M_BRUSHDATA->m_stipple = stipple; if (M_BRUSHDATA->m_stipple.GetMask()) { diff --git a/src/x11/pen.cpp b/src/x11/pen.cpp index b5e0cae909..6fc6a57176 100644 --- a/src/x11/pen.cpp +++ b/src/x11/pen.cpp @@ -9,7 +9,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/setup.h" +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/utils.h" #include "wx/pen.h" #include "wx/colour.h" @@ -31,7 +33,7 @@ public: m_dash = (wxX11Dash*) NULL; m_countDashes = 0; } - + wxPenRefData( const wxPenRefData& data ) { m_style = data.m_style; @@ -56,7 +58,7 @@ public: m_capStyle == data.m_capStyle && m_colour == data.m_colour); } - + int m_width; int m_style; int m_joinStyle; @@ -98,24 +100,24 @@ wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const bool wxPen::operator == ( const wxPen& pen ) const { - if (m_refData == pen.m_refData) return TRUE; - - if (!m_refData || !pen.m_refData) return FALSE; - + if (m_refData == pen.m_refData) return true; + + if (!m_refData || !pen.m_refData) return false; + return ( *(wxPenRefData*)m_refData == *(wxPenRefData*)pen.m_refData ); } void wxPen::SetColour( const wxColour &colour ) { AllocExclusive(); - + M_PENDATA->m_colour = colour; } void wxPen::SetDashes( int number_of_dashes, const wxDash *dash ) { AllocExclusive(); - + M_PENDATA->m_countDashes = number_of_dashes; M_PENDATA->m_dash = (wxX11Dash *)dash; // TODO } @@ -123,42 +125,42 @@ void wxPen::SetDashes( int number_of_dashes, const wxDash *dash ) void wxPen::SetColour( int red, int green, int blue ) { AllocExclusive(); - + M_PENDATA->m_colour.Set( red, green, blue ); } void wxPen::SetCap( int capStyle ) { AllocExclusive(); - + M_PENDATA->m_capStyle = capStyle; } void wxPen::SetJoin( int joinStyle ) { AllocExclusive(); - + M_PENDATA->m_joinStyle = joinStyle; } void wxPen::SetStipple( wxBitmap *stipple ) { AllocExclusive(); - + M_PENDATA->m_stipple = *stipple;; } void wxPen::SetStyle( int style ) { AllocExclusive(); - + M_PENDATA->m_style = style; } void wxPen::SetWidth( int width ) { AllocExclusive(); - + M_PENDATA->m_width = width; } diff --git a/src/x11/region.cpp b/src/x11/region.cpp index babe1dcca1..14496f4b2c 100644 --- a/src/x11/region.cpp +++ b/src/x11/region.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// File: region.cpp +// File: src/x11/region.cpp // Purpose: Region class // Author: Julian Smart, Robert Roebling // Created: Fri Oct 24 10:46:34 MET 1997 @@ -8,6 +8,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/region.h" #include "wx/gdicmn.h" #include "wx/log.h" @@ -32,13 +35,13 @@ public: { m_region = NULL; } - + wxRegionRefData(const wxRegionRefData& refData) { m_region = XCreateRegion(); XUnionRegion( refData.m_region, m_region, m_region ); } - + ~wxRegionRefData() { if (m_region) @@ -67,18 +70,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject); void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) { XRectangle rect; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - + rect.x = (short)x; + rect.y = (short)y; + rect.width = (unsigned short)w; + rect.height = (unsigned short)h; + m_refData = new wxRegionRefData(); - + M_REGIONDATA->m_region = XCreateRegion(); XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region ); } -wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle ) +wxRegion::wxRegion( size_t WXUNUSED(n), const wxPoint *WXUNUSED(points), int WXUNUSED(fillStyle) ) { #if 0 XPoint *xpoints = new XPoint[n]; @@ -125,13 +128,13 @@ wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const bool wxRegion::operator==( const wxRegion& region ) const { - if (m_refData == region.m_refData) return TRUE; + if (m_refData == region.m_refData) return true; + + if (!m_refData || !region.m_refData) return false; - if (!m_refData || !region.m_refData) return FALSE; - // compare the regions themselves, not the pointers to ref data! return XEqualRegion( M_REGIONDATA->m_region, - M_REGIONDATA_OF(region)->m_region ); + M_REGIONDATA_OF(region)->m_region ) == True; } // ---------------------------------------------------------------------------- @@ -149,14 +152,14 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) // rect results in an empty region (at least XFree 3.3.6 and 4.0 have this // problem) if ( !width || !height ) - return TRUE; + return true; XRectangle rect; - rect.x = x; - rect.y = y; - rect.width = width; - rect.height = height; - + rect.x = (short)x; + rect.y = (short)y; + rect.width = (unsigned short)width; + rect.height = (unsigned short)height; + if (!m_refData) { m_refData = new wxRegionRefData(); @@ -170,7 +173,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region ); } - return TRUE; + return true; } bool wxRegion::Union( const wxRect& rect ) @@ -181,7 +184,7 @@ bool wxRegion::Union( const wxRect& rect ) bool wxRegion::Union( const wxRegion& region ) { if (region.IsNull()) - return FALSE; + return false; if (!m_refData) { @@ -192,12 +195,12 @@ bool wxRegion::Union( const wxRegion& region ) { AllocExclusive(); } - + XUnionRegion( M_REGIONDATA->m_region, M_REGIONDATA_OF(region)->m_region, M_REGIONDATA->m_region ); - return TRUE; + return true; } bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -210,22 +213,22 @@ bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) bool wxRegion::Intersect( const wxRect& rect ) { wxRegion reg( rect ); - + return Intersect( reg ); } bool wxRegion::Intersect( const wxRegion& region ) { if (region.IsNull()) - return FALSE; + return false; if (!m_refData) { m_refData = new wxRegionRefData(); M_REGIONDATA->m_region = XCreateRegion(); - - // leave here - return TRUE; + + // leave here + return true; } else { @@ -236,7 +239,7 @@ bool wxRegion::Intersect( const wxRegion& region ) M_REGIONDATA_OF(region)->m_region, M_REGIONDATA->m_region ); - return TRUE; + return true; } bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -254,7 +257,7 @@ bool wxRegion::Subtract( const wxRect& rect ) bool wxRegion::Subtract( const wxRegion& region ) { if (region.IsNull()) - return FALSE; + return false; if (!m_refData) { @@ -270,7 +273,7 @@ bool wxRegion::Subtract( const wxRegion& region ) M_REGIONDATA_OF(region)->m_region, M_REGIONDATA->m_region ); - return TRUE; + return true; } bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) @@ -288,7 +291,7 @@ bool wxRegion::Xor( const wxRect& rect ) bool wxRegion::Xor( const wxRegion& region ) { if (region.IsNull()) - return FALSE; + return false; if (!m_refData) { @@ -303,8 +306,8 @@ bool wxRegion::Xor( const wxRegion& region ) XXorRegion( M_REGIONDATA->m_region, M_REGIONDATA_OF(region)->m_region, M_REGIONDATA->m_region ); - - return TRUE; + + return true; } // ---------------------------------------------------------------------------- @@ -341,21 +344,21 @@ wxRect wxRegion::GetBox() const bool wxRegion::Offset( wxCoord x, wxCoord y ) { if (!m_refData) - return FALSE; + return false; AllocExclusive(); XOffsetRegion( M_REGIONDATA->m_region, x, y ); - return TRUE; + return true; } bool wxRegion::Empty() const { if (!m_refData) - return TRUE; + return true; - return XEmptyRegion( M_REGIONDATA->m_region ); + return XEmptyRegion( M_REGIONDATA->m_region ) == True; } wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y ) const @@ -446,9 +449,9 @@ void wxRIRefData::CreateRects( const wxRegion& region ) m_rects = 0; m_numRects = 0; - + if (region.IsEmpty()) return; - + Region r = (Region) region.GetX11Region(); if (r) { @@ -551,4 +554,3 @@ wxRect wxRegionIterator::GetRect() const return r; } - diff --git a/src/x11/utilsx.cpp b/src/x11/utilsx.cpp index 7a25ddbcc5..27eb3c2725 100644 --- a/src/x11/utilsx.cpp +++ b/src/x11/utilsx.cpp @@ -9,6 +9,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #ifdef __VMS #define XShapeQueryExtension XSHAPEQUERYEXTENSION #define XtDisplay XTDISPLAY @@ -180,7 +183,7 @@ void wxXVisualInfo::Init( Display* dpy, XVisualInfo* vi ) XColor* colors = (XColor*) m_visualColormap; for (int i = 0; i < m_visualColormapSize; i++) - colors[i].pixel = i; + colors[i].pixel = i; XQueryColors( dpy, DefaultColormap(dpy, vi->screen), colors, m_visualColormapSize ); @@ -222,7 +225,7 @@ void wxXVisualInfo::Init( Display* dpy, XVisualInfo* vi ) index |= (g >> (5 - m_visualGreenPrec)) << m_visualGreenShift; index |= (b >> (5 - m_visualBluePrec)) << m_visualBlueShift; } - m_colorCube[ (r*1024) + (g*32) + b ] = index; + m_colorCube[ (r*1024) + (g*32) + b ] = (unsigned char)index; } } } -- 2.45.2