Nano-X changes: removed spurious -O for Nano-X configuration;
got colour working in Nano-X (uses 8 bit RGB values, not 16 bit); now sets font background mode correctly; window management call correction git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
bb312b54f6
commit
0b5c0e1ac1
@ -1904,7 +1904,7 @@ equivalent variable and GTK+ is version 1.2.3 or above.
|
||||
|
||||
if test "$wxUSE_NANOX" = "yes"; then
|
||||
TOOLKIT_INCLUDE="-I\$(top_srcdir)/include/wx/x11/nanox -I\$(MICROWIN)/src/include $TOOLKIT_INCLUDE"
|
||||
TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__NANOX__ -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_GIF_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DLINUX=1 -DUNIX=1 -O -DUSE_EXPOSURE -DSCREEN_HEIGHT=480 -DSCREEN_WIDTH=640 -DSCREEN_DEPTH=4 -DX11=1"
|
||||
TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__NANOX__ -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_GIF_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DLINUX=1 -DUNIX=1 -DUSE_EXPOSURE -DSCREEN_HEIGHT=480 -DSCREEN_WIDTH=640 -DSCREEN_DEPTH=4 -DX11=1"
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$(MICROWIN)/src/lib/libnano-X.a"
|
||||
else
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lX11$xpm_link"
|
||||
|
@ -111,8 +111,6 @@ typedef struct {
|
||||
#define GXnand GR_MODE_NAND
|
||||
#define GXset GR_MODE_SET
|
||||
|
||||
inline void wxNoop() { /* Do nothing */ }
|
||||
|
||||
#define XSynchronize(display,sync)
|
||||
#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
|
||||
#define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID
|
||||
@ -344,6 +342,8 @@ Status XGetWindowAttributes(Display* display, Window w,
|
||||
int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes);
|
||||
int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn);
|
||||
|
||||
void wxNoop();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -381,10 +381,16 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
|
||||
if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour))
|
||||
return NULL;
|
||||
|
||||
#if wxUSE_NANOX
|
||||
unsigned char r = (unsigned char)(xcolour.red);
|
||||
unsigned char g = (unsigned char)(xcolour.green);
|
||||
unsigned char b = (unsigned char)(xcolour.blue);
|
||||
#else
|
||||
unsigned char r = (unsigned char)(xcolour.red >> 8);
|
||||
unsigned char g = (unsigned char)(xcolour.green >> 8);
|
||||
unsigned char b = (unsigned char)(xcolour.blue >> 8);
|
||||
|
||||
#endif
|
||||
|
||||
wxColour *col = new wxColour(r, g, b);
|
||||
Append(colour, col);
|
||||
|
||||
|
@ -457,7 +457,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
wxWindow* win = NULL;
|
||||
Window window = XEventGetWindow(event);
|
||||
Window actualWindow = window;
|
||||
|
||||
|
||||
// Find the first wxWindow that corresponds to this event window
|
||||
// Because we're receiving events after a window
|
||||
// has been destroyed, assume a 1:1 match between
|
||||
@ -468,6 +468,10 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
wxString windowClass = win->GetClassInfo()->GetClassName();
|
||||
#endif
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case KeyPress:
|
||||
@ -506,6 +510,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
if (event->update.utype == GR_UPDATE_SIZE)
|
||||
#endif
|
||||
{
|
||||
//wxLogDebug("ConfigureNotify: %s", windowClass.c_str());
|
||||
wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() );
|
||||
sizeEvent.SetEventObject( win );
|
||||
|
||||
@ -515,6 +520,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
#if !wxUSE_NANOX
|
||||
case PropertyNotify:
|
||||
{
|
||||
//wxLogDebug("PropertyNotify: %s", windowClass.c_str());
|
||||
HandlePropertyChange(_event);
|
||||
return;
|
||||
}
|
||||
@ -573,6 +579,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
#endif
|
||||
case Expose:
|
||||
{
|
||||
//wxLogDebug("Expose: %s", windowClass.c_str());
|
||||
win->GetUpdateRegion().Union( XExposeEventGetX(event), XExposeEventGetY(event),
|
||||
XExposeEventGetWidth(event), XExposeEventGetHeight(event));
|
||||
|
||||
|
@ -137,9 +137,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
|
||||
wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
|
||||
{
|
||||
m_refData = new wxColourRefData();
|
||||
#if wxUSE_NANOX
|
||||
M_COLDATA->m_color.red = ((unsigned short)red) ;
|
||||
M_COLDATA->m_color.green = ((unsigned short)green) ;
|
||||
M_COLDATA->m_color.blue = ((unsigned short)blue) ;
|
||||
#else
|
||||
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
|
||||
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
|
||||
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
|
||||
#endif
|
||||
M_COLDATA->m_color.pixel = 0;
|
||||
}
|
||||
|
||||
@ -209,9 +215,15 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
|
||||
AllocExclusive();
|
||||
|
||||
m_refData = new wxColourRefData();
|
||||
#if wxUSE_NANOX
|
||||
M_COLDATA->m_color.red = ((unsigned short)red) ;
|
||||
M_COLDATA->m_color.green = ((unsigned short)green) ;
|
||||
M_COLDATA->m_color.blue = ((unsigned short)blue) ;
|
||||
#else
|
||||
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
|
||||
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
|
||||
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
|
||||
#endif
|
||||
M_COLDATA->m_color.pixel = 0;
|
||||
}
|
||||
|
||||
@ -219,21 +231,33 @@ unsigned char wxColour::Red() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, wxT("invalid colour") );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
return (unsigned char) M_COLDATA->m_color.red ;
|
||||
#else
|
||||
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned char wxColour::Green() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, wxT("invalid colour") );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
return (unsigned char) M_COLDATA->m_color.green ;
|
||||
#else
|
||||
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned char wxColour::Blue() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, wxT("invalid colour") );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
return (unsigned char) M_COLDATA->m_color.blue ;
|
||||
#else
|
||||
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxColour::CalcPixel( WXColormap cmap )
|
||||
|
@ -255,6 +255,11 @@ void wxWindowDC::SetUpDC()
|
||||
|
||||
XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillSolid );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
// By default, draw transparently
|
||||
GrSetGCUseBackground((GC) m_textGC, FALSE);
|
||||
#endif
|
||||
|
||||
/* m_penGC */
|
||||
m_pen.GetColour().CalcPixel( m_cmap );
|
||||
XSetForeground( (Display*) m_display, (GC) m_penGC, m_pen.GetColour().GetPixel() );
|
||||
@ -1714,6 +1719,10 @@ void wxWindowDC::SetBackgroundMode( int mode )
|
||||
|
||||
m_backgroundMode = mode;
|
||||
|
||||
#if wxUSE_NANOX
|
||||
GrSetGCUseBackground((GC) m_textGC, mode == wxTRANSPARENT ? FALSE : TRUE);
|
||||
#endif
|
||||
|
||||
if (!m_window) return;
|
||||
|
||||
// CMB 21/7/98: fill style of cross-hatch brushes is affected by
|
||||
|
@ -433,5 +433,13 @@ int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Should not really be necessary but in no-optimize mode
|
||||
* gcc complains that wxNoop is not found if wxNoop is inline.
|
||||
*/
|
||||
|
||||
void wxNoop()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
/* wxUSE_NANOX */
|
||||
|
@ -101,6 +101,18 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
m_backgroundColour.CalcPixel( (WXColormap) cm );
|
||||
m_hasBgCol = TRUE;
|
||||
|
||||
wxSize size2(size);
|
||||
if (size2.x == -1)
|
||||
size2.x = 100;
|
||||
if (size2.y == -1)
|
||||
size2.y = 100;
|
||||
|
||||
wxPoint pos2(pos);
|
||||
if (pos2.x == -1)
|
||||
pos2.x = 100;
|
||||
if (pos2.y == -1)
|
||||
pos2.y = 100;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
XSetWindowAttributes xattributes;
|
||||
XSizeHints size_hints;
|
||||
@ -118,18 +130,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
xattributes.override_redirect = False;
|
||||
#endif
|
||||
|
||||
wxSize size2(size);
|
||||
if (size2.x == -1)
|
||||
size2.x = 100;
|
||||
if (size2.y == -1)
|
||||
size2.y = 100;
|
||||
|
||||
wxPoint pos2(pos);
|
||||
if (pos2.x == -1)
|
||||
pos2.x = 100;
|
||||
if (pos2.y == -1)
|
||||
pos2.y = 100;
|
||||
|
||||
#if wxUSE_NANOX
|
||||
long backColor, foreColor;
|
||||
backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
|
||||
@ -148,7 +148,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
extraFlags |= GR_EVENT_MASK_CLOSE_REQ;
|
||||
#endif
|
||||
|
||||
#if wxUSE_NANOX
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
extraFlags |
|
||||
ExposureMask |
|
||||
@ -166,25 +165,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
StructureNotifyMask |
|
||||
PropertyChangeMask
|
||||
);
|
||||
#else
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
extraFlags |
|
||||
ExposureMask |
|
||||
KeyPressMask |
|
||||
KeyReleaseMask |
|
||||
ButtonPressMask |
|
||||
ButtonReleaseMask |
|
||||
ButtonMotionMask |
|
||||
EnterWindowMask |
|
||||
LeaveWindowMask |
|
||||
PointerMotionMask |
|
||||
KeymapStateMask |
|
||||
FocusChangeMask |
|
||||
ColormapChangeMask |
|
||||
StructureNotifyMask |
|
||||
PropertyChangeMask
|
||||
);
|
||||
#endif
|
||||
|
||||
wxAddWindowToTable( xwindow, (wxWindow*) this );
|
||||
|
||||
@ -221,14 +201,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2);
|
||||
#endif
|
||||
|
||||
#if 0 // wxUSE_NANOX
|
||||
GR_WM_PROPERTIES props;
|
||||
props.flags = GR_WM_FLAGS_TITLE;
|
||||
props.title = (GR_CHAR*) "Hello";
|
||||
GrSetWMProperties(xwindow, &props);
|
||||
#else
|
||||
wxSetWMDecorations( xwindow, style);
|
||||
#endif
|
||||
|
||||
SetTitle(title);
|
||||
|
||||
@ -423,6 +396,7 @@ bool wxSetWMDecorations(Window w, long style)
|
||||
GR_WM_PROPERTIES wmProp;
|
||||
|
||||
wmProp.flags = 0;
|
||||
wmProp.props = 0;
|
||||
|
||||
if (style & wxRESIZE_BORDER)
|
||||
{
|
||||
|
@ -960,6 +960,7 @@ void wxWindowX11::Update()
|
||||
{
|
||||
if (!m_updateRegion.IsEmpty())
|
||||
{
|
||||
// wxLogDebug("wxWindowX11::Update: %s", GetClassInfo()->GetClassName());
|
||||
// Actually send erase events.
|
||||
SendEraseEvents();
|
||||
|
||||
@ -987,7 +988,7 @@ void wxWindowX11::SendEraseEvents()
|
||||
|
||||
wxEraseEvent erase_event( GetId(), &dc );
|
||||
erase_event.SetEventObject( this );
|
||||
|
||||
|
||||
if (!GetEventHandler()->ProcessEvent(erase_event))
|
||||
{
|
||||
Window xwindow = (Window) GetMainWindow();
|
||||
@ -1022,9 +1023,8 @@ void wxWindowX11::SendPaintEvents()
|
||||
wxPaintEvent paint_event( GetId() );
|
||||
paint_event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( paint_event );
|
||||
|
||||
m_updateRegion.Clear();
|
||||
|
||||
m_updateRegion.Clear();
|
||||
m_clipPaintRegion = FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user