From 7266b6723573ce6317577226cb1e5d32826e24e8 Mon Sep 17 00:00:00 2001 From: Julian Smart <julian@anthemion.co.uk> Date: Fri, 8 Feb 2002 17:44:23 +0000 Subject: [PATCH] Now compiling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/tmake/filelist.txt | 3 +- distrib/msw/tmake/x11.t | 6 +- include/wx/accel.h | 2 - include/wx/cmndata.h | 4 +- include/wx/dataobj.h | 2 + include/wx/filedlg.h | 2 +- include/wx/motif/private.h | 20 +++ include/wx/utils.h | 21 +-- include/wx/x11/accel.h | 51 ------ include/wx/x11/bitmap.h | 7 +- include/wx/x11/icon.h | 2 + include/wx/x11/palette.h | 2 +- include/wx/x11/private.h | 20 +++ src/common/gdicmn.cpp | 11 +- src/x11/accel.cpp | 116 ------------ src/x11/app.cpp | 20 ++- src/x11/bdiag.xbm | 6 + src/x11/bitmap.cpp | 311 +-------------------------------- src/x11/brush.cpp | 2 +- src/x11/cdiag.xbm | 6 + src/x11/clipbrd.cpp | 14 +- src/x11/colour.cpp | 2 +- src/x11/cross.xbm | 6 + src/x11/cursor.cpp | 1 + src/x11/dataobj.cpp | 1 + src/x11/dcclient.cpp | 2 + src/x11/dcmemory.cpp | 2 +- src/x11/evtloop.cpp | 18 +- src/x11/fdiag.xbm | 6 + src/x11/files.lst | 6 +- src/x11/horiz.xbm | 6 + src/x11/icon.cpp | 5 + src/x11/palette.cpp | 2 +- src/x11/pen.cpp | 2 +- src/x11/region.cpp | 6 +- src/x11/timer.cpp | 12 +- src/x11/toolbar.cpp | 2 +- src/x11/utils.cpp | 27 +-- src/x11/verti.xbm | 6 + src/x11/window.cpp | 66 ++++--- src/x11/wxwin.xbm | 46 +++++ 41 files changed, 255 insertions(+), 597 deletions(-) delete mode 100644 include/wx/x11/accel.h delete mode 100644 src/x11/accel.cpp create mode 100644 src/x11/bdiag.xbm create mode 100644 src/x11/cdiag.xbm create mode 100644 src/x11/cross.xbm create mode 100644 src/x11/fdiag.xbm create mode 100644 src/x11/horiz.xbm create mode 100644 src/x11/verti.xbm create mode 100644 src/x11/wxwin.xbm diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index 4664f3e860..fbb6c2842e 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -93,7 +93,7 @@ logg.cpp Generic msgdlgg.cpp Generic Generic notebook.cpp Generic NotWin32,NotGTK,NotOS2,NotMGL,NotMac,NotMicro numdlgg.cpp Generic -paletteg.cpp Generic NotMSW,NotX,NotOS2,NotMGL,NotMac,NotMicro +paletteg.cpp Generic NotMSW,NotX,NotX11,NotOS2,NotMGL,NotMac,NotMicro panelg.cpp Generic printps.cpp Generic NotMSW,NotX11 prntdlgg.cpp Generic NotMSW @@ -601,7 +601,6 @@ utils.cpp Motif window.cpp Motif gsockx11.c X11 Socket -accel.cpp X11 app.cpp X11 bitmap.cpp X11 brush.cpp X11 diff --git a/distrib/msw/tmake/x11.t b/distrib/msw/tmake/x11.t index 35fbba7e61..4036206ddc 100644 --- a/distrib/msw/tmake/x11.t +++ b/distrib/msw/tmake/x11.t @@ -37,7 +37,7 @@ ($fileobj = $file) =~ s/cp?p?$/\o/; $project{"X11_SOURCES"} .= "x11/" . $file . " "; - $project{"GUIOBJS"} .= $fileobj . " "; + $project{"GUI_LOWLEVEL_OBJS"} .= $fileobj . " "; } foreach $file (sort keys %wxUNIX) { @@ -94,8 +94,8 @@ COMMONOBJS = \ GENERICOBJS = \ #$ ExpandList("GENERICOBJS"); -GUIOBJS = \ - #$ ExpandList("GUIOBJS"); +GUI_LOWLEVEL_OBJS = \ + #$ ExpandList("GUI_LOWLEVEL_OBJS"); UNIXOBJS = \ #$ ExpandList("UNIXOBJS"); diff --git a/include/wx/accel.h b/include/wx/accel.h index 78595ea427..a5202e4173 100644 --- a/include/wx/accel.h +++ b/include/wx/accel.h @@ -105,8 +105,6 @@ private: #include "wx/motif/accel.h" #elif defined(__WXGTK__) #include "wx/gtk/accel.h" -#elif defined(__WXX11__) - #include "wx/x11/accel.h" #elif defined(__WXMAC__) #include "wx/mac/accel.h" #elif defined(__WXPM__) diff --git a/include/wx/cmndata.h b/include/wx/cmndata.h index 8a637910e3..b85b01cb26 100644 --- a/include/wx/cmndata.h +++ b/include/wx/cmndata.h @@ -21,7 +21,7 @@ #include "wx/colour.h" #include "wx/gdicmn.h" -#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT +#if (defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT class WXDLLEXPORT wxPrintSetupData; #endif @@ -165,7 +165,7 @@ class WXDLLEXPORT wxPrintData: public wxObject void operator=(const wxPrintData& data); // For compatibility -#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT +#if (defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT void operator=(const wxPrintSetupData& setupData); #endif diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index 1e6ecad470..82c501598f 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -161,6 +161,8 @@ public: #include "wx/msw/ole/dataobj.h" #elif defined(__WXMOTIF__) #include "wx/motif/dataobj.h" +#elif defined(__WXX11__) + #include "wx/x11/dataobj.h" #elif defined(__WXGTK__) #include "wx/gtk/dataobj.h" #elif defined(__WXMAC__) diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h index c8dc4ed5d9..e3564fb8c4 100644 --- a/include/wx/filedlg.h +++ b/include/wx/filedlg.h @@ -21,7 +21,7 @@ enum #elif defined(__WXGTK__) #include "wx/generic/filedlgg.h" #elif defined(__WXX11__) -#include "wx/generic/filedlg.h" +#include "wx/generic/filedlgg.h" #elif defined(__WXMGL__) #include "wx/generic/filedlgg.h" #elif defined(__WXMAC__) diff --git a/include/wx/motif/private.h b/include/wx/motif/private.h index 0a9bfe6823..9f0c237bf3 100644 --- a/include/wx/motif/private.h +++ b/include/wx/motif/private.h @@ -13,6 +13,7 @@ #define _WX_PRIVATE_H_ #include "wx/defs.h" +#include "X11/Xlib.h" class wxMouseEvent; class wxKeyEvent; @@ -116,5 +117,24 @@ private: extern "C" XtAppContext wxGetAppContext(); +#define wxMAX_RGB 0xff +#define wxMAX_SV 1000 +#define wxSIGN(x) ((x < 0) ? -x : x) +#define wxH_WEIGHT 4 +#define wxS_WEIGHT 1 +#define wxV_WEIGHT 2 + +typedef struct wx_hsv { + int h,s,v; + } wxHSV; + +#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)) +#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z)) + +void wxHSVToXColor(wxHSV *hsv,XColor *xcolor); +void wxXColorToHSV(wxHSV *hsv,XColor *xcolor); +void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor); +void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); + #endif // _WX_PRIVATE_H_ diff --git a/include/wx/utils.h b/include/wx/utils.h index 0bd6c258ed..f3cb1257fb 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -425,30 +425,11 @@ void WXDLLEXPORT wxGetMousePosition( int* x, int* y ); // The resulting warnings are switched off here #pragma message disable nosimpint #endif -#include <X11/Xlib.h> +// #include <X11/Xlib.h> #ifdef __VMS__ #pragma message enable nosimpint #endif -#define wxMAX_RGB 0xff -#define wxMAX_SV 1000 -#define wxSIGN(x) ((x < 0) ? -x : x) -#define wxH_WEIGHT 4 -#define wxS_WEIGHT 1 -#define wxV_WEIGHT 2 - -typedef struct wx_hsv { - int h,s,v; - } wxHSV; - -#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)) -#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z)) - -void wxHSVToXColor(wxHSV *hsv,XColor *xcolor); -void wxXColorToHSV(wxHSV *hsv,XColor *xcolor); -void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor); -void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); - #endif //__X__ #endif // wxUSE_GUI diff --git a/include/wx/x11/accel.h b/include/wx/x11/accel.h deleted file mode 100644 index 6b61e38b12..0000000000 --- a/include/wx/x11/accel.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: accel.h -// Purpose: wxAcceleratorTable class -// Author: Julian Smart -// Modified by: -// Created: 17/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCEL_H_ -#define _WX_ACCEL_H_ - -#ifdef __GNUG__ -#pragma interface "accel.h" -#endif - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/event.h" - -class WXDLLEXPORT wxAcceleratorTable: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) -public: - wxAcceleratorTable(); - wxAcceleratorTable(const wxString& resource); // Load from .rc resource - wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array - - // Copy constructors - wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); } - wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); } - - ~wxAcceleratorTable(); - - wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; } - bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; } - bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; } - - bool Ok() const; - - // Implementation only - int GetCount() const; - wxAcceleratorEntry* GetEntries() const; -}; - -WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable; - -#endif -// _WX_ACCEL_H_ diff --git a/include/wx/x11/bitmap.h b/include/wx/x11/bitmap.h index c5973e088c..be3ae6febf 100644 --- a/include/wx/x11/bitmap.h +++ b/include/wx/x11/bitmap.h @@ -135,8 +135,8 @@ public: wxBitmap(const char bits[], int width, int height, int depth = 1); // from XPM - wxBitmap(const char **data) { (void)CreateFromXpm(data); } - wxBitmap(char **data) { (void)CreateFromXpm((const char **)data); } + wxBitmap(const char **data) { (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); } + wxBitmap(char **data) { (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); } // Load a file or resource wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XPM); @@ -161,6 +161,8 @@ public: virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); wxImage ConvertToImage() const; + + bool CopyFromIcon(const wxIcon& icon); bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); } int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); } @@ -205,7 +207,6 @@ protected: static wxList sm_handlers; protected: - bool CreateFromXpm(const char **bits); bool CreateFromImage(const wxImage& image, int depth); }; diff --git a/include/wx/x11/icon.h b/include/wx/x11/icon.h index 4ddc46c336..b72e6c96f4 100644 --- a/include/wx/x11/icon.h +++ b/include/wx/x11/icon.h @@ -51,6 +51,8 @@ public: inline bool operator != (const wxIcon& icon) const { return m_refData != icon.m_refData; } virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); } + + bool CopyFromBitmap(const wxBitmap& bitmap); }; #endif diff --git a/include/wx/x11/palette.h b/include/wx/x11/palette.h index c34767f8ce..3cbf67020d 100644 --- a/include/wx/x11/palette.h +++ b/include/wx/x11/palette.h @@ -69,7 +69,7 @@ public: bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; } bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; } - // Motif-specific + // X-specific WXColormap GetXColormap(WXDisplay* display = NULL) const; bool TransferBitmap(void *data, int depth, int size); bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp); diff --git a/include/wx/x11/private.h b/include/wx/x11/private.h index d279b7f526..181790ea55 100644 --- a/include/wx/x11/private.h +++ b/include/wx/x11/private.h @@ -13,6 +13,7 @@ #define _WX_PRIVATE_H_ #include "wx/defs.h" +#include "X11/Xlib.h" class wxMouseEvent; class wxKeyEvent; @@ -77,6 +78,25 @@ extern XColor itemColors[5] ; #define wxTOPS_INDEX 3 #define wxBOTS_INDEX 4 +#define wxMAX_RGB 0xff +#define wxMAX_SV 1000 +#define wxSIGN(x) ((x < 0) ? -x : x) +#define wxH_WEIGHT 4 +#define wxS_WEIGHT 1 +#define wxV_WEIGHT 2 + +typedef struct wx_hsv { + int h,s,v; + } wxHSV; + +#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)) +#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z)) + +void wxHSVToXColor(wxHSV *hsv,XColor *xcolor); +void wxXColorToHSV(wxHSV *hsv,XColor *xcolor); +void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor); +void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); + // ---------------------------------------------------------------------------- // accessors for C modules // ---------------------------------------------------------------------------- diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 31e336762b..2210dc3485 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -55,6 +55,10 @@ #endif #endif +#ifdef __WXX11__ +#include "X11/Xlib.h" +#endif + IMPLEMENT_CLASS(wxColourDatabase, wxList) IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList) IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) @@ -370,12 +374,9 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour) #ifdef __WXMOTIF__ Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ; #endif -#ifdef __XVIEW__ - Xv_Screen screen = xv_get(xview_server, SERVER_NTH_SCREEN, 0); - Xv_opaque root_window = xv_get(screen, XV_ROOT); - Display *display = (Display *)xv_get(root_window, XV_DISPLAY); +#ifdef __WXX11__ + Display* display = (Display*) wxGetDisplay(); #endif - /* MATTHEW: [4] Use wxGetMainColormap */ if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour)) return NULL; diff --git a/src/x11/accel.cpp b/src/x11/accel.cpp deleted file mode 100644 index d90a47b958..0000000000 --- a/src/x11/accel.cpp +++ /dev/null @@ -1,116 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: accel.cpp -// Purpose: wxAcceleratorTable -// Author: Julian Smart -// Modified by: -// Created: 17/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "accel.h" -#endif - -#include "wx/setup.h" -#include "wx/accel.h" -#include "wx/string.h" -#include "wx/utils.h" -#include <ctype.h> - -IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) - -class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData -{ - friend class WXDLLEXPORT wxAcceleratorTable; -public: - wxAcceleratorRefData(); - ~wxAcceleratorRefData(); - -public: - int m_count; - wxAcceleratorEntry* m_entries; -}; - -#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData) - -wxAcceleratorRefData::wxAcceleratorRefData() -{ - m_count = 0; - m_entries = (wxAcceleratorEntry*) NULL; -} - -wxAcceleratorRefData::~wxAcceleratorRefData() -{ - delete[] m_entries; - m_entries = (wxAcceleratorEntry*) NULL; - m_count = 0; -} - -wxAcceleratorTable::wxAcceleratorTable() -{ - m_refData = (wxAcceleratorRefData*) NULL; -} - -wxAcceleratorTable::~wxAcceleratorTable() -{ - // Data deleted in ~wxObject -} - -// Load from .rc resource -wxAcceleratorTable::wxAcceleratorTable(const wxString& WXUNUSED(resource)) -{ - m_refData = new wxAcceleratorRefData; -} - -// Create from an array -wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[]) -{ - wxAcceleratorRefData* data = new wxAcceleratorRefData; - m_refData = data; - - data->m_count = n; - data->m_entries = new wxAcceleratorEntry[n]; - int i; - for (i = 0; i < n; i++) - data->m_entries[i] = entries[i]; - -} - -bool wxAcceleratorTable::Ok() const -{ - return (m_refData != (wxAcceleratorRefData*) NULL); -} - -int wxAcceleratorTable::GetCount() const -{ - return M_ACCELDATA->m_count; -} - -wxAcceleratorEntry* wxAcceleratorTable::GetEntries() const -{ - return M_ACCELDATA->m_entries; -} - -// Implementation use only -bool wxAcceleratorEntry::MatchesEvent(const wxKeyEvent& event) const -{ - bool eventAltDown = event.AltDown(); - bool eventCtrlDown = event.ControlDown(); - bool eventShiftDown = event.ShiftDown(); - int eventKeyCode = event.KeyCode(); - - bool accAltDown = ((GetFlags() & wxACCEL_ALT) == wxACCEL_ALT); - bool accCtrlDown = ((GetFlags() & wxACCEL_CTRL) == wxACCEL_CTRL); - bool accShiftDown = ((GetFlags() & wxACCEL_SHIFT) == wxACCEL_SHIFT); - int accKeyCode = GetKeyCode(); - int accKeyCode2 = GetKeyCode(); - if (isascii(accKeyCode2)) - accKeyCode2 = tolower(accKeyCode2); - - return ((eventAltDown == accAltDown) && (eventCtrlDown == accCtrlDown) && - (eventShiftDown == accShiftDown) && - ((eventKeyCode == accKeyCode || eventKeyCode == accKeyCode2))) ; -} - diff --git a/src/x11/app.cpp b/src/x11/app.cpp index ef1b07b838..c20d365ad5 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -73,6 +73,8 @@ typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *); XErrorHandlerFunc gs_pfnXErrorHandler = 0; +static Window XGetParent(Window window); + static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent) { // just forward to the default handler for now @@ -315,13 +317,13 @@ void wxApp::ProcessXEvent(WXEvent* _event) if (win) { wxKeyEvent keyEvent(wxEVT_KEY_DOWN); - wxTranslateKeyEvent(keyEvent, win, window, xEvent); + wxTranslateKeyEvent(keyEvent, win, window, event); // We didn't process wxEVT_KEY_DOWN, so send - // wxEVT_KEY_CHAR + // wxEVT_CHAR if (!win->ProcessEvent( keyEvent )) { - keyEvent.SetEventType(wxEVT_KEY_CHAR); + keyEvent.SetEventType(wxEVT_CHAR); win->ProcessEvent( keyEvent ); } @@ -354,7 +356,7 @@ void wxApp::ProcessXEvent(WXEvent* _event) * window is recieved. Prevents flicker as windows are resized. */ - Display *disp = wxGetDisplay(); + Display *disp = (Display*) wxGetDisplay(); XEvent report; // to avoid flicker @@ -370,7 +372,7 @@ void wxApp::ProcessXEvent(WXEvent* _event) wxSizeEvent sizeEvent(sz, win->GetId()); sizeEvent.SetEventObject(win); - win->ProcessEvent( wxevent ); + win->ProcessEvent( sizeEvent ); } return; @@ -589,8 +591,8 @@ bool wxApp::OnInitGui() (const char*) className); exit(-1); } - XSelectInput(m_initialDisplay, - XDefaultRootWindow(m_initialDisplay), + XSelectInput((Display*) m_initialDisplay, + XDefaultRootWindow((Display*) m_initialDisplay), PropertyChangeMask); #ifdef __WXDEBUG__ @@ -624,7 +626,7 @@ static Window XGetParent(Window window) { Window parent, root = 0; unsigned int noChildren = 0; - if (XQueryTree(wxGetDisplay(), window, & root, & parent, + if (XQueryTree((Display*) wxGetDisplay(), window, & root, & parent, NULL, & noChildren)) return parent; else @@ -750,4 +752,4 @@ extern "C" XtAppContext wxGetAppContext() { return (XtAppContext)wxTheApp->GetAppContext(); } -#endif \ No newline at end of file +#endif diff --git a/src/x11/bdiag.xbm b/src/x11/bdiag.xbm new file mode 100644 index 0000000000..9ff0a1822f --- /dev/null +++ b/src/x11/bdiag.xbm @@ -0,0 +1,6 @@ +#define bdiag_width 16 +#define bdiag_height 16 +static char bdiag_bits[] = { + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, + 0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, + 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01}; diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index 9e919994ab..cd66d61993 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -115,11 +115,6 @@ wxBitmap::wxBitmap(const wxString& filename, long type) LoadFile(filename, (int)type); } -wxBitmap::wxBitmap(char **data) -{ - (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); -} - bool wxBitmap::Create(int w, int h, int d) { UnRef(); @@ -502,200 +497,6 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags return TRUE; } -#if wxHAVE_LIB_XPM -class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler -{ - DECLARE_DYNAMIC_CLASS(wxXPMFileHandler) -public: - inline wxXPMFileHandler() - { - m_name = "XPM file"; - m_extension = "xpm"; - m_type = wxBITMAP_TYPE_XPM; - }; - - virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); -}; - -IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler) - -bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), - int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) ) -{ - Display *dpy = (Display*) wxGetDisplay(); - M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy; - - XpmAttributes xpmAttr; - Pixmap pixmap; - Pixmap mask = 0; - - M_BITMAPHANDLERDATA->m_ok = FALSE; - xpmAttr.valuemask = XpmReturnInfos | XpmCloseness; - xpmAttr.closeness = 40000; - int errorStatus = XpmReadFileToPixmap(dpy, - RootWindow(dpy, DefaultScreen(dpy)), (char*) (const char*) name, - &pixmap, &mask, &xpmAttr); - - if (errorStatus == XpmSuccess) - { - M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap; - if ( mask ) - { - M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask; - M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask); - } - - unsigned int depthRet; - int xRet, yRet; - unsigned int widthRet, heightRet, borderWidthRet; - Window rootWindowRet; - XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet, - &widthRet, &heightRet, &borderWidthRet, &depthRet); - - M_BITMAPHANDLERDATA->m_width = xpmAttr.width; - M_BITMAPHANDLERDATA->m_height = xpmAttr.height; - - /* - if ( xpmAttr.npixels > 2 ) - { - M_BITMAPHANDLERDATA->m_depth = 8; // TODO: next time not just a guess :-) ... - } else - { - M_BITMAPHANDLERDATA->m_depth = 1; // mono - } - */ - - M_BITMAPHANDLERDATA->m_depth = depthRet; - - M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels; - - XpmFreeAttributes(&xpmAttr); - - M_BITMAPHANDLERDATA->m_ok = TRUE; - return TRUE; - } else - { - // XpmDebugError(errorStatus, name); - M_BITMAPHANDLERDATA->m_ok = FALSE; - return FALSE; - } -} - -bool wxXPMFileHandler::SaveFile( wxBitmap *bitmap, const wxString& name, int WXUNUSED(type), - const wxPalette *WXUNUSED(palette)) -{ - if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap) - { - Display *dpy = (Display*) M_BITMAPHANDLERDATA->m_display; - int errorStatus = XpmWriteFileFromPixmap(dpy, (char*) (const char*) name, - (Pixmap) M_BITMAPHANDLERDATA->m_pixmap, - (M_BITMAPHANDLERDATA->m_bitmapMask ? (Pixmap) M_BITMAPHANDLERDATA->m_bitmapMask->GetPixmap() : (Pixmap) 0), - (XpmAttributes *) NULL); - if (errorStatus == XpmSuccess) - return TRUE; - else - return FALSE; - } - else - return FALSE; -} - -class WXDLLEXPORT wxXPMDataHandler: public wxBitmapHandler -{ - DECLARE_DYNAMIC_CLASS(wxXPMDataHandler) -public: - inline wxXPMDataHandler() - { - m_name = "XPM data"; - m_extension = "xpm"; - m_type = wxBITMAP_TYPE_XPM_DATA; - }; - - virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); -}; -IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler) - -bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags), - int width, int height, int WXUNUSED(depth)) -{ - M_BITMAPHANDLERDATA->m_width = width; - M_BITMAPHANDLERDATA->m_height = height; - M_BITMAPHANDLERDATA->m_depth = 1; - M_BITMAPHANDLERDATA->m_freePixmap = TRUE; - - Display *dpy = (Display*) wxGetDisplay(); - M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy; - - XpmAttributes xpmAttr; - - xpmAttr.valuemask = XpmReturnInfos; /* nothing yet, but get infos back */ - - XpmColorSymbol symbolicColors[4]; - if (sg_Control && sg_Control->GetMainWidget()) - { - symbolicColors[0].name = "foreground"; - symbolicColors[0].value = NULL; - symbolicColors[1].name = "background"; - symbolicColors[1].value = NULL; - XtVaGetValues((Widget) sg_Control->GetMainWidget(), - XmNforeground, &symbolicColors[0].pixel, - XmNbackground, &symbolicColors[1].pixel,NULL); - xpmAttr.numsymbols = 2; - xpmAttr.colorsymbols = symbolicColors; - xpmAttr.valuemask |= XpmColorSymbols; // add flag - } - - Pixmap pixmap; - Pixmap mask = 0; - int ErrorStatus = XpmCreatePixmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)), - (char**) data, &pixmap, &mask, &xpmAttr); - if (ErrorStatus == XpmSuccess) - { - // Set attributes - M_BITMAPHANDLERDATA->m_width = xpmAttr.width; - M_BITMAPHANDLERDATA->m_height = xpmAttr.height; - - unsigned int depthRet; - int xRet, yRet; - unsigned int widthRet, heightRet, borderWidthRet; - Window rootWindowRet; - XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet, - &widthRet, &heightRet, &borderWidthRet, &depthRet); - - /* - if ( xpmAttr.npixels > 2 ) - { - M_BITMAPHANDLERDATA->m_depth = 8; // next time not just a guess :-) ... - } else - { - M_BITMAPHANDLERDATA->m_depth = 1; // mono - } - */ - - M_BITMAPHANDLERDATA->m_depth = depthRet; - - M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels; - XpmFreeAttributes(&xpmAttr); - M_BITMAPHANDLERDATA->m_ok = TRUE; - M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap; - if ( mask ) - { - M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask; - M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask); - } - } - else - { - // XpmDebugError(ErrorStatus, NULL); - M_BITMAPHANDLERDATA->m_ok = FALSE; - } - return M_BITMAPHANDLERDATA->m_ok ; -} - -#endif // wxHAVE_LIB_XPM - void wxBitmap::CleanUpHandlers() { wxNode *node = sm_handlers.First(); @@ -715,106 +516,7 @@ void wxBitmap::InitStandardHandlers() AddHandler(new wxXBMFileHandler); AddHandler(new wxXBMDataHandler); - // XPM is considered standard for Motif, although it can be omitted if - // libXpm is not installed -#if wxHAVE_LIB_XPM - AddHandler(new wxXPMFileHandler); - AddHandler(new wxXPMDataHandler); -#endif // wxHAVE_LIB_XPM -} - -// We may need this sometime... - -/**************************************************************************** - - NAME - XCreateInsensitivePixmap - create a grayed-out copy of a pixmap - - SYNOPSIS - Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ) - - DESCRIPTION - This function creates a grayed-out copy of the argument pixmap, suitable - for use as a XmLabel's XmNlabelInsensitivePixmap resource. - - RETURN VALUES - The return value is the new Pixmap id or zero on error. Errors include - a NULL display argument or an invalid Pixmap argument. - - ERRORS - If one of the XLib functions fail, it will produce a X error. The - default X error handler prints a diagnostic and calls exit(). - - SEE ALSO - XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3), - XFillRectangle(3), exit(2) - - AUTHOR - John R Veregge - john@puente.jpl.nasa.gov - Advanced Engineering and Prototyping Group (AEG) - Information Systems Technology Section (395) - Jet Propulsion Lab - Calif Institute of Technology - -*****************************************************************************/ - -Pixmap -XCreateInsensitivePixmap( Display *display, Pixmap pixmap ) - -{ - static char stipple_data[] = - { - 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, - 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, - 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, - 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA - }; - GC gc; - Pixmap ipixmap, stipple; - unsigned width, height, depth; - - Window window; /* These return values */ - unsigned border; /* from XGetGeometry() */ - int x, y; /* are not needed. */ - - ipixmap = 0; - - if ( NULL == display || 0 == pixmap ) - return ipixmap; - - if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y, - &width, &height, &border, &depth ) - ) - return ipixmap; /* BadDrawable: probably an invalid pixmap */ - - /* Get the stipple pixmap to be used to 'gray-out' the argument pixmap. - */ - stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 ); - if ( 0 != stipple ) - { - gc = XCreateGC( display, pixmap, (XtGCMask)0, (XGCValues*)NULL ); - if ( NULL != gc ) - { - /* Create an identical copy of the argument pixmap. - */ - ipixmap = XCreatePixmap( display, pixmap, width, height, depth ); - if ( 0 != ipixmap ) - { - /* Copy the argument pixmap into the new pixmap. - */ - XCopyArea( display, pixmap, ipixmap, - gc, 0, 0, width, height, 0, 0 ); - - /* Refill the new pixmap using the stipple algorithm/pixmap. - */ - XSetStipple( display, gc, stipple ); - XSetFillStyle( display, gc, FillStippled ); - XFillRectangle( display, ipixmap, gc, 0, 0, width, height ); - } - XFreeGC( display, gc ); - } - XFreePixmap( display, stipple ); - } - return ipixmap; + // XPM will be handled by wxImage } // Creates a bitmap with transparent areas drawn in @@ -838,9 +540,6 @@ wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour) return newBitmap; } - - - //----------------------------------------------------------------------------- // wxImage conversion routines //----------------------------------------------------------------------------- @@ -1205,7 +904,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) { wxBitmap maskBitmap(width, height, 1); - GC gcMask = XCreateGC( dpy, (Pixmap) maskBitmap.GetPixmap(), (XtGCMask) 0, (XGCValues*)NULL ); + GC gcMask = XCreateGC( dpy, (Pixmap) maskBitmap.GetPixmap(), 0, (XGCValues*)NULL ); XPutImage( dpy, (Drawable)maskBitmap.GetPixmap(), gcMask, mask_image, 0, 0, 0, 0, width, height ); XDestroyImage( mask_image ); @@ -1342,3 +1041,9 @@ wxImage wxBitmap::ConvertToImage() const return image; } + +bool wxBitmap::CopyFromIcon(const wxIcon& icon) +{ + // TODO + return FALSE; +} diff --git a/src/x11/brush.cpp b/src/x11/brush.cpp index 685b376427..2c888c8c53 100644 --- a/src/x11/brush.cpp +++ b/src/x11/brush.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/motif/brush.cpp +// Name: src/x11/brush.cpp // Purpose: wxBrush // Author: Julian Smart // Modified by: diff --git a/src/x11/cdiag.xbm b/src/x11/cdiag.xbm new file mode 100644 index 0000000000..15dc7ba86d --- /dev/null +++ b/src/x11/cdiag.xbm @@ -0,0 +1,6 @@ +#define cdiag_width 16 +#define cdiag_height 16 +static char cdiag_bits[] = { + 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, + 0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, + 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81}; diff --git a/src/x11/clipbrd.cpp b/src/x11/clipbrd.cpp index 41afb324d3..42446b71af 100644 --- a/src/x11/clipbrd.cpp +++ b/src/x11/clipbrd.cpp @@ -77,6 +77,9 @@ bool wxClipboardOpen() bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) { + // TODO + return FALSE; +#if 0 // Only text is supported. if (dataFormat != wxDF_TEXT) return FALSE; @@ -86,7 +89,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) Window window = (Window) 0; if (wxTheApp->GetTopWindow()) - window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWidget() ); + window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWindow() ); int success = XmClipboardRetrieve((Display*) wxGetDisplay(), window, "TEXT", (XtPointer) 0, 0, & numBytes, & privateId) ; @@ -97,10 +100,14 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) return FALSE; else return TRUE; +#endif } bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int WXUNUSED(width), int WXUNUSED(height)) { + // TODO + return FALSE; +#if 0 if (dataFormat != wxDF_TEXT) return FALSE; @@ -147,10 +154,14 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int WXUNUSED(wid ; return TRUE; +#endif } wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len) { + // TODO + return FALSE; +#if 0 if (dataFormat != wxDF_TEXT) return (wxObject*) NULL; @@ -206,6 +217,7 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len) } return NULL; +#endif } wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) diff --git a/src/x11/colour.cpp b/src/x11/colour.cpp index bd112d6a4a..37601ac3cf 100644 --- a/src/x11/colour.cpp +++ b/src/x11/colour.cpp @@ -28,7 +28,7 @@ #pragma message enable nosimpint #endif -#include "wx/motif/private.h" +#include "wx/x11/private.h" IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) diff --git a/src/x11/cross.xbm b/src/x11/cross.xbm new file mode 100644 index 0000000000..b07cbe7fcd --- /dev/null +++ b/src/x11/cross.xbm @@ -0,0 +1,6 @@ +#define cross_width 15 +#define cross_height 15 +static char cross_bits[] = { + 0x84, 0x10, 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10}; diff --git a/src/x11/cursor.cpp b/src/x11/cursor.cpp index cb0e61f34f..cfb2332070 100644 --- a/src/x11/cursor.cpp +++ b/src/x11/cursor.cpp @@ -23,6 +23,7 @@ #pragma message disable nosimpint #endif #include <X11/cursorfont.h> +#include <X11/Xutil.h> #ifdef __VMS__ #pragma message enable nosimpint #endif diff --git a/src/x11/dataobj.cpp b/src/x11/dataobj.cpp index f9120e6be4..ebc3d70da1 100644 --- a/src/x11/dataobj.cpp +++ b/src/x11/dataobj.cpp @@ -25,6 +25,7 @@ #pragma message enable nosimpint #endif #include "wx/utils.h" +#include "wx/x11/private.h" //------------------------------------------------------------------------- // global data diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 2bedcdb5b5..469022b06f 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -51,6 +51,8 @@ #ifdef __VMS__ #pragma message disable nosimpint #endif +#include "X11/Xlib.h" +#include "X11/Xutil.h" #ifdef __VMS__ #pragma message enable nosimpint #endif diff --git a/src/x11/dcmemory.cpp b/src/x11/dcmemory.cpp index 613ec59d8d..eb74c0e252 100644 --- a/src/x11/dcmemory.cpp +++ b/src/x11/dcmemory.cpp @@ -24,7 +24,7 @@ #pragma message enable nosimpint #endif -#include "wx/motif/private.h" +#include "wx/x11/private.h" //----------------------------------------------------------------------------- // wxMemoryDC diff --git a/src/x11/evtloop.cpp b/src/x11/evtloop.cpp index da6b8f6d82..da51dca79e 100644 --- a/src/x11/evtloop.cpp +++ b/src/x11/evtloop.cpp @@ -25,7 +25,9 @@ #include "wx/app.h" #include "wx/evtloop.h" #include "wx/tooltip.h" - +#if wxUSE_THREADS +#include "wx/thread.h" +#endif #include "wx/x11/private.h" #include "X11/Xlib.h" @@ -52,7 +54,7 @@ public: public: // preprocess an event, return TRUE if processed (i.e. no further // dispatching required) - bool PreProcessMessage(XEvent* event); + bool PreProcessEvent(XEvent* event); // the exit code of the event loop int m_exitcode; @@ -152,8 +154,8 @@ int wxEventLoop::Run() m_impl->m_keepGoing = TRUE; while ( m_impl->m_keepGoing ) { -#if wxUSE_THREADS - wxMutexGuiLeaveOrEnter(); +#if 0 // wxUSE_THREADS + wxMutexGuiLeaveOrEnter(); #endif // wxUSE_THREADS // generate and process idle events for as long as we don't have @@ -162,7 +164,7 @@ int wxEventLoop::Run() { if (!m_impl->SendIdleEvent()) { -#if wxUSE_THREADS +#if 0 // wxUSE_THREADS // leave the main loop to give other threads a chance to // perform their GUI work wxMutexGuiLeave(); @@ -205,8 +207,8 @@ void wxEventLoop::Exit(int rc) bool wxEventLoop::Pending() const { - XFlush(wxGetDisplay()); - return (XPending(wxGetDisplay()) > 0); + XFlush((Display*) wxGetDisplay()); + return (XPending((Display*) wxGetDisplay()) > 0); } bool wxEventLoop::Dispatch() @@ -215,7 +217,7 @@ bool wxEventLoop::Dispatch() // TODO allowing for threads, as per e.g. wxMSW - XNextEvent(wxGetDisplay(), & event); + XNextEvent((Display*) wxGetDisplay(), & event); m_impl->ProcessEvent(& event); return TRUE; } diff --git a/src/x11/fdiag.xbm b/src/x11/fdiag.xbm new file mode 100644 index 0000000000..67d3b4732a --- /dev/null +++ b/src/x11/fdiag.xbm @@ -0,0 +1,6 @@ +#define fdiag_width 16 +#define fdiag_height 16 +static char fdiag_bits[] = { + 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, + 0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, + 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80}; diff --git a/src/x11/files.lst b/src/x11/files.lst index 086318cc18..c1dc657e59 100644 --- a/src/x11/files.lst +++ b/src/x11/files.lst @@ -27,7 +27,6 @@ ALL_SOURCES = \ generic/msgdlgg.cpp \ generic/notebook.cpp \ generic/numdlgg.cpp \ - generic/paletteg.cpp \ generic/panelg.cpp \ generic/printps.cpp \ generic/prntdlgg.cpp \ @@ -175,7 +174,6 @@ ALL_SOURCES = \ common/xpmdecod.cpp \ common/zipstrm.cpp \ common/zstream.cpp \ - x11/accel.cpp \ x11/app.cpp \ x11/bitmap.cpp \ x11/brush.cpp \ @@ -712,7 +710,6 @@ GENERICOBJS = \ msgdlgg.o \ notebook.o \ numdlgg.o \ - paletteg.o \ panelg.o \ printps.o \ prntdlgg.o \ @@ -736,8 +733,7 @@ GENERICOBJS = \ treelay.o \ wizard.o -GUIOBJS = \ - accel.o \ +GUI_LOWLEVEL_OBJS = \ app.o \ bitmap.o \ brush.o \ diff --git a/src/x11/horiz.xbm b/src/x11/horiz.xbm new file mode 100644 index 0000000000..ff3309bcc4 --- /dev/null +++ b/src/x11/horiz.xbm @@ -0,0 +1,6 @@ +#define horiz_width 15 +#define horiz_height 15 +static char horiz_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; diff --git a/src/x11/icon.cpp b/src/x11/icon.cpp index 5acb3abee3..11cea5bf32 100644 --- a/src/x11/icon.cpp +++ b/src/x11/icon.cpp @@ -79,3 +79,8 @@ bool wxIcon::LoadFile(const wxString& filename, long type, return FALSE; } +bool wxIcon::CopyFromBitmap(const wxBitmap& bitmap) +{ + // TODO + return FALSE; +} diff --git a/src/x11/palette.cpp b/src/x11/palette.cpp index 36bd8cfafc..eb5cb7bdf1 100644 --- a/src/x11/palette.cpp +++ b/src/x11/palette.cpp @@ -50,7 +50,7 @@ not the functionality that wxPalette::Create() aims to provide. #ifdef __VMS__ #pragma message enable nosimpint #endif -#include "wx/motif/private.h" +#include "wx/x11/private.h" IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject) diff --git a/src/x11/pen.cpp b/src/x11/pen.cpp index 4bc2b0bd89..2608b96bf8 100644 --- a/src/x11/pen.cpp +++ b/src/x11/pen.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/motif/pen.cpp +// Name: src/x11/pen.cpp // Purpose: wxPen // Author: Julian Smart // Modified by: diff --git a/src/x11/region.cpp b/src/x11/region.cpp index 6ab42feeb0..180ca79e2c 100644 --- a/src/x11/region.cpp +++ b/src/x11/region.cpp @@ -14,15 +14,17 @@ #include "wx/region.h" #include "wx/gdicmn.h" +#include "wx/window.h" #ifdef __VMS__ #pragma message disable nosimpint #endif - +#include "wx/x11/private.h" +#include "X11/Xutil.h" #ifdef __VMS__ #pragma message enable nosimpint #endif -// #include "wx/x11/private.h" + IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) diff --git a/src/x11/timer.cpp b/src/x11/timer.cpp index d178cad4f4..c1ceead98a 100644 --- a/src/x11/timer.cpp +++ b/src/x11/timer.cpp @@ -40,13 +40,16 @@ void wxTimerCallback (wxTimer * timer) if (timer->m_id == 0) return; // Avoid to process spurious timer events + // TODO +#if 0 if (!timer->m_oneShot) timer->m_id = XtAppAddTimeOut((XtAppContext) wxTheApp->GetAppContext(), timer->m_milli, (XtTimerCallbackProc) wxTimerCallback, (XtPointer) timer); else - timer->m_id = 0; +#endif + timer->m_id = 0; timer->Notify(); } @@ -71,11 +74,13 @@ bool wxTimer::Start(int milliseconds, bool mode) if (!wxTimerList.Find((long)this)) wxTimerList.Append((long)this, this); - + // TODO +#if 0 m_id = XtAppAddTimeOut((XtAppContext) wxTheApp->GetAppContext(), m_milli, (XtTimerCallbackProc) wxTimerCallback, (XtPointer) this); +#endif return TRUE; } @@ -83,7 +88,10 @@ void wxTimer::Stop() { if (m_id > 0) { + // TODO +#if 0 XtRemoveTimeOut (m_id); +#endif m_id = 0; } m_milli = 0 ; diff --git a/src/x11/toolbar.cpp b/src/x11/toolbar.cpp index 8deee85905..c9b5a7f81c 100644 --- a/src/x11/toolbar.cpp +++ b/src/x11/toolbar.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: motif/toolbar.cpp +// Name: x11/toolbar.cpp // Purpose: wxToolBar // Author: Julian Smart // Modified by: 13.12.99 by VZ during toolbar classes reorganization diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index 66f7f60686..d6b5b7df84 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -52,6 +52,8 @@ #include "wx/unix/execute.h" #include "wx/x11/private.h" +#include "X11/Xresource.h" +#include "X11/Xutil.h" // ---------------------------------------------------------------------------- // private functions @@ -81,7 +83,11 @@ void wxFlushEvents() Display *display = (Display*) wxGetDisplay(); XSync (display, FALSE); + XFlush(display); + // TODO +#if 0 + // XtAppPending returns availability of events AND timers/inputs, which // are processed via callbacks, so XtAppNextEvent will not return if // there are no events. So added '& XtIMXEvent' - Sergey. @@ -91,6 +97,7 @@ void wxFlushEvents() // Jan Lessner: works better when events are non-X events XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent); } +#endif } // Check whether this window wants to process messages, e.g. Stop button @@ -705,8 +712,6 @@ bool wxSetDisplay(const wxString& display_name) } else { - Cardinal argc = 0; - Display* display = XOpenDisplay((const char*) display_name); if (display) @@ -813,24 +818,6 @@ char * wxFindAccelerator (const char *s) #endif } -XmString wxFindAcceleratorText (const char *s) -{ - // VZ: this function returns incorrect keysym which completely breaks kbd - // handling - return NULL; - -#if 0 - // The accelerator text is after the \t char. - while (*s && *s != '\t') - s++; - if (*s == '\0') - return (NULL); - s++; - XmString text = XmStringCreateSimple ((char *)s); - return text; -#endif -} - // ---------------------------------------------------------------------------- // keycode translations // ---------------------------------------------------------------------------- diff --git a/src/x11/verti.xbm b/src/x11/verti.xbm new file mode 100644 index 0000000000..2dd9dc4c05 --- /dev/null +++ b/src/x11/verti.xbm @@ -0,0 +1,6 @@ +#define verti_width 15 +#define verti_height 15 +static char verti_bits[] = { + 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0x84, 0x10, 0x84, 0x10, 0x84, 0x10}; diff --git a/src/x11/window.cpp b/src/x11/window.cpp index d77698cacf..2f49b3f8b5 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -45,6 +45,7 @@ #endif #include "wx/x11/private.h" +#include "X11/Xutil.h" #include <string.h> @@ -97,9 +98,9 @@ void wxWindowX11::Init() // generic initializations first InitBase(); - // Motif-specific + // X11-specific m_needsRefresh = TRUE; - m_mainWidget = (WXWidget) 0; + m_mainWidget = (WXWindow) 0; m_button1Pressed = m_button2Pressed = @@ -114,7 +115,7 @@ void wxWindowX11::Init() m_vScrollBar = m_borderWidget = m_scrolledWindow = - m_drawingArea = (WXWidget) 0; + m_drawingArea = (WXWindow) 0; m_hScroll = m_vScroll = FALSE; @@ -175,14 +176,14 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id, } // Destructor -wxWindowX11::~wxWindow() +wxWindowX11::~wxWindowX11() { if (g_captureWindow == this) g_captureWindow = NULL; m_isBeingDeleted = TRUE; - // Motif-specific actions first + // X11-specific actions first WXWindow wMain = GetMainWindow(); if ( wMain ) { @@ -477,17 +478,17 @@ bool wxWindowX11::Show(bool show) // Raise the window to the top of the Z order void wxWindowX11::Raise() { - Window window = GetTopWindow(); + Window window = (Window) GetTopWindow(); if (window) - XRaiseWindow(wxGetDisplay(), window); + XRaiseWindow((Display*) wxGetDisplay(), window); } // Lower the window to the bottom of the Z order void wxWindowX11::Lower() { - Window window = GetTopWindow(); + Window window = (Window) GetTopWindow(); if (window) - XLowerWindow(wxGetDisplay(), window); + XLowerWindow((Display*) wxGetDisplay(), window); } void wxWindowX11::SetTitle(const wxString& title) @@ -510,7 +511,7 @@ wxString wxWindowX11::GetTitle() const void wxWindowX11::DoCaptureMouse() { - g_captureWindow = this; + g_captureWindow = (wxWindow*) this; if ( m_winCaptured ) return; @@ -581,7 +582,7 @@ void wxWindowX11::WarpPointer (int x, int y) { Window wClient = (Window) GetClientWindow(); - XWarpPointer(wxGetDisplay(), None, wClient, 0, 0, 0, 0, x, y); + XWarpPointer((Display*) wxGetDisplay(), None, wClient, 0, 0, 0, 0, x, y); } // --------------------------------------------------------------------------- @@ -627,7 +628,7 @@ int wxWindowX11::GetScrollThumb(int orient) const #endif } -void wxWindowX11::SetScrollPos(int WXUNUSED(orient), int WXUNUSED(pos), bool WXUNUSED(refresh)) +void wxWindowX11::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh)) { // TODO @@ -755,12 +756,12 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) int x2 = (dx >= 0) ? x + dx : x; int y2 = (dy >= 0) ? y + dy : y; - wxClientDC dc(this); + wxClientDC dc((wxWindow*) this); dc.SetLogicalFunction (wxCOPY); Window window = (Window) GetMainWindow(); - Display* display = wxGetDisplay(); + Display* display = (Display*) wxGetDisplay(); XCopyArea(display, window, window, (GC) dc.GetGC(), x1, y1, w1, h1, x2, y2); @@ -978,7 +979,7 @@ void wxWindowX11::DoGetPosition(int *x, int *y) const void wxWindowX11::DoScreenToClient(int *x, int *y) const { - Display *display = wxGetDisplay(); + Display *display = (Display*) wxGetDisplay(); Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display)); Window thisWindow = (Window) GetClientWindow(); @@ -990,7 +991,7 @@ void wxWindowX11::DoScreenToClient(int *x, int *y) const void wxWindowX11::DoClientToScreen(int *x, int *y) const { - Display *display = wxGetDisplay(); + Display *display = (Display*) wxGetDisplay(); Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display)); Window thisWindow = (Window) GetClientWindow(); @@ -1237,8 +1238,8 @@ void wxWindowX11::GetTextExtent(const wxString& string, void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect) { m_needsRefresh = TRUE; - Display *display = wxGetDisplay(); - Window thisWindow = (Widget) GetMainWindow(); + Display *display = (Display*) wxGetDisplay(); + Window thisWindow = (Window) GetMainWindow(); XExposeEvent dummyEvent; int width, height; @@ -1266,7 +1267,7 @@ void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect) if (eraseBack) { - wxClientDC dc(this); + wxClientDC dc((wxWindow*) this); wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID); dc.SetBackground(backgroundBrush); if (rect) @@ -1280,7 +1281,7 @@ void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect) void wxWindowX11::Clear() { - wxClientDC dc(this); + wxClientDC dc((wxWindow*) this); wxBrush brush(GetBackgroundColour(), wxSOLID); dc.SetBackground(brush); dc.Clear(); @@ -1352,20 +1353,15 @@ bool wxWindowX11::ProcessAccelerator(wxKeyEvent& event) if (!m_acceleratorTable.Ok()) return FALSE; - int count = m_acceleratorTable.GetCount(); - wxAcceleratorEntry* entries = m_acceleratorTable.GetEntries(); - int i; - for (i = 0; i < count; i++) + const wxAcceleratorEntry* entry = m_acceleratorTable.GetEntry(event); + if (entry) { - wxAcceleratorEntry* entry = & (entries[i]); - if (entry->MatchesEvent(event)) - { // Bingo, we have a match. Now find a control that matches the // entry command id. // Need to go up to the top of the window hierarchy, since it might // be e.g. a menu item - wxWindow* parent = this; + wxWindow* parent = (wxWindow*) this; while ( parent && !parent->IsTopLevel() ) parent = parent->GetParent(); @@ -1408,8 +1404,8 @@ bool wxWindowX11::ProcessAccelerator(wxKeyEvent& event) } return FALSE; - } // matches event - }// for + + }// if // We didn't match the key event against an accelerator. return FALSE; @@ -1456,10 +1452,10 @@ void wxDeleteWindowFromTable(Window w) // ---------------------------------------------------------------------------- // Add to hash table, add event handler -bool wxWindowX11::AttachWidget (wxWindow* WXUNUSED(parent), WXWindow mainWidget, +bool wxWindowX11::AttachWindow (wxWindow* WXUNUSED(parent), WXWindow mainWidget, int x, int y, int width, int height) { - wxAddWindowToTable((Window ) mainWidget, this); + wxAddWindowToTable((Window ) mainWidget, (wxWindow*) this); // TODO #if 0 @@ -1503,7 +1499,7 @@ bool wxWindowX11::AttachWidget (wxWindow* WXUNUSED(parent), WXWindow mainWidget, } // Remove event handler, remove from hash table -bool wxWindowX11::DetachWidget(WXWindow widget) +bool wxWindowX11::DetachWindow(WXWindow widget) { // TODO #if 0 @@ -1545,7 +1541,7 @@ WXWindow wxWindowX11::GetMainWindow() const return m_mainWidget; } -WXWindow wxWindowX11::GetClientWidget() const +WXWindow wxWindowX11::GetClientWindow() const { if (m_drawingArea != (WXWindow) 0) return m_drawingArea; @@ -1903,7 +1899,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, // check for a double click // TODO: where can we get this value from? //long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay()); - long dClickTime = 200; + long dclickTime = 200; long ts = wxevent.GetTimestamp(); int buttonLast = win->GetLastClickedButton(); diff --git a/src/x11/wxwin.xbm b/src/x11/wxwin.xbm new file mode 100644 index 0000000000..9c70498190 --- /dev/null +++ b/src/x11/wxwin.xbm @@ -0,0 +1,46 @@ +#define wxwin.xbm_width 64 +#define wxwin.xbm_height 64 +static char wxwin.xbm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x1f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x80, 0xc7, 0x19, + 0x8e, 0x01, 0x50, 0x00, 0x40, 0x00, 0xc7, 0x39, 0xcf, 0x01, 0x70, 0x00, + 0x40, 0x00, 0xc7, 0x31, 0x3c, 0x00, 0x50, 0x00, 0x40, 0x00, 0xc7, 0x21, + 0x1c, 0x00, 0x70, 0x00, 0x40, 0x80, 0xe3, 0x20, 0x38, 0x00, 0x50, 0x00, + 0x40, 0x80, 0xe3, 0x30, 0x3c, 0x00, 0x70, 0x00, 0x40, 0x80, 0xe3, 0x78, + 0x76, 0x01, 0x50, 0x00, 0x40, 0x00, 0xdf, 0xff, 0xf3, 0x20, 0x70, 0x00, + 0x40, 0x00, 0x8e, 0xff, 0x61, 0x70, 0x50, 0x00, 0x40, 0x00, 0x00, 0xfc, + 0x01, 0xf8, 0x70, 0x00, 0x40, 0x00, 0x00, 0xfc, 0x01, 0xfc, 0x51, 0x00, + 0x40, 0x00, 0x00, 0xfe, 0x03, 0xfc, 0x73, 0x00, 0x40, 0x00, 0x00, 0xff, + 0x03, 0xf8, 0x51, 0x00, 0x40, 0x00, 0x00, 0xff, 0x07, 0xf0, 0x70, 0x00, + 0x40, 0x00, 0x80, 0xff, 0x07, 0x60, 0x50, 0x00, 0x40, 0x00, 0x80, 0xff, + 0x0f, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xc0, 0xff, 0x1f, 0xfc, 0x50, 0x00, + 0x40, 0x00, 0xe0, 0xff, 0x1f, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xf0, 0x0f, + 0x00, 0xfc, 0x50, 0x00, 0x40, 0x00, 0xf0, 0x07, 0x00, 0xfc, 0x70, 0x00, + 0x40, 0x00, 0xf8, 0x07, 0x00, 0xfc, 0x50, 0x00, 0x40, 0x00, 0xfc, 0x03, + 0x00, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xfc, 0x01, 0x00, 0xfc, 0x50, 0x00, + 0x40, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xfe, 0x00, + 0x00, 0xfc, 0x50, 0x00, 0x40, 0x00, 0x7f, 0x00, 0x00, 0xfc, 0x70, 0x00, + 0x40, 0x80, 0x7f, 0x00, 0x00, 0xfc, 0x50, 0x00, 0x40, 0x80, 0x3f, 0x00, + 0x00, 0xfc, 0x70, 0x00, 0x40, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x50, 0x00, + 0x40, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x70, 0x00, 0x40, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0x50, 0x00, 0x40, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x70, 0x00, + 0x40, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x50, 0x00, 0x40, 0xf0, 0xff, 0xff, + 0xff, 0xff, 0x70, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x50, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, + 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5f, 0x00, 0x80, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0x6a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -- 2.45.2